UNPKG

1.24 kBJavaScriptView Raw
1"use strict";
2Object.defineProperty(exports, "__esModule", { value: true });
3const tslib_1 = require("tslib");
4const devkit_1 = require("@nrwl/devkit");
5const versions_1 = require("../../utils/versions");
6function default_1(host, schema) {
7 return tslib_1.__awaiter(this, void 0, void 0, function* () {
8 const options = normalizeOptions(schema);
9 (0, devkit_1.generateFiles)(host, (0, devkit_1.joinPathFragments)(__dirname, 'files'), (0, devkit_1.joinPathFragments)('tools/generators', schema.name), options);
10 const installTask = (0, devkit_1.addDependenciesToPackageJson)(host, {}, {
11 '@nrwl/devkit': versions_1.nxVersion,
12 // types/node is neccessary for pnpm since it's used in tsconfig and transitive
13 // dependencies are not resolved correctly
14 '@types/node': 'latest',
15 });
16 if (!schema.skipFormat) {
17 yield (0, devkit_1.formatFiles)(host);
18 }
19 return installTask;
20 });
21}
22exports.default = default_1;
23function normalizeOptions(options) {
24 const name = (0, devkit_1.names)(options.name).fileName;
25 return Object.assign(Object.assign({}, options), { name, tmpl: '' });
26}
27//# sourceMappingURL=workspace-generator.js.map
\No newline at end of file