@nx/node 16.0.0-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +8 -0
- package/LICENSE +22 -0
- package/README.md +61 -0
- package/executors.json +26 -0
- package/generators.json +62 -0
- package/index.d.ts +3 -0
- package/index.js +10 -0
- package/index.js.map +1 -0
- package/migrations.json +60 -0
- package/package.json +48 -0
- package/src/executors/node/compat.d.ts +2 -0
- package/src/executors/node/compat.js +6 -0
- package/src/executors/node/compat.js.map +1 -0
- package/src/executors/node/node.impl.d.ts +4 -0
- package/src/executors/node/node.impl.js +14 -0
- package/src/executors/node/node.impl.js.map +1 -0
- package/src/executors/node/schema.json +74 -0
- package/src/executors/webpack/compat.d.ts +2 -0
- package/src/executors/webpack/compat.js +6 -0
- package/src/executors/webpack/compat.js.map +1 -0
- package/src/executors/webpack/schema.json +275 -0
- package/src/executors/webpack/webpack.impl.d.ts +8 -0
- package/src/executors/webpack/webpack.impl.js +19 -0
- package/src/executors/webpack/webpack.impl.js.map +1 -0
- package/src/generators/application/application.d.ts +10 -0
- package/src/generators/application/application.js +277 -0
- package/src/generators/application/application.js.map +1 -0
- package/src/generators/application/files/common/src/assets/.gitkeep +0 -0
- package/src/generators/application/files/common/src/main.ts__tmpl__ +1 -0
- package/src/generators/application/files/common/tsconfig.app.json +10 -0
- package/src/generators/application/files/common/tsconfig.json +10 -0
- package/src/generators/application/files/common/webpack.config.js__tmpl__ +8 -0
- package/src/generators/application/files/express/src/main.ts__tmpl__ +14 -0
- package/src/generators/application/files/fastify/src/app/app.spec.ts__tmpl__ +20 -0
- package/src/generators/application/files/fastify/src/app/app.ts__tmpl__ +27 -0
- package/src/generators/application/files/fastify/src/app/plugins/sensible.ts__tmpl__ +12 -0
- package/src/generators/application/files/fastify/src/app/routes/root.ts__tmpl__ +7 -0
- package/src/generators/application/files/fastify/src/main.ts__tmpl__ +23 -0
- package/src/generators/application/files/koa/src/main.ts__tmpl__ +14 -0
- package/src/generators/application/schema.d.ts +26 -0
- package/src/generators/application/schema.json +123 -0
- package/src/generators/e2e-project/e2e-project.d.ts +5 -0
- package/src/generators/e2e-project/e2e-project.js +108 -0
- package/src/generators/e2e-project/e2e-project.js.map +1 -0
- package/src/generators/e2e-project/files/cli/jest.config.ts__tmpl__ +14 -0
- package/src/generators/e2e-project/files/cli/src/__fileName__/__fileName__.spec.ts__tmpl__ +13 -0
- package/src/generators/e2e-project/files/cli/src/test-setup.ts__tmpl__ +1 -0
- package/src/generators/e2e-project/files/cli/tsconfig.json__tmpl__ +13 -0
- package/src/generators/e2e-project/files/cli/tsconfig.spec.json__tmpl__ +12 -0
- package/src/generators/e2e-project/files/server/common/jest.config.ts__tmpl__ +16 -0
- package/src/generators/e2e-project/files/server/common/src/__fileName__/__fileName__.spec.ts__tmpl__ +10 -0
- package/src/generators/e2e-project/files/server/common/src/support/global-setup.ts__tmpl__ +11 -0
- package/src/generators/e2e-project/files/server/common/src/support/global-teardown.ts__tmpl__ +7 -0
- package/src/generators/e2e-project/files/server/common/src/support/test-setup.ts__tmpl__ +10 -0
- package/src/generators/e2e-project/files/server/common/tsconfig.json__tmpl__ +13 -0
- package/src/generators/e2e-project/files/server/common/tsconfig.spec.json__tmpl__ +12 -0
- package/src/generators/e2e-project/files/server/nest/src/__fileName__/__fileName__.spec.ts__tmpl__ +10 -0
- package/src/generators/e2e-project/schema.d.ts +11 -0
- package/src/generators/e2e-project/schema.json +65 -0
- package/src/generators/init/init.d.ts +5 -0
- package/src/generators/init/init.js +37 -0
- package/src/generators/init/init.js.map +1 -0
- package/src/generators/init/schema.d.ts +6 -0
- package/src/generators/init/schema.json +27 -0
- package/src/generators/library/files/lib/package.json__tmpl__ +4 -0
- package/src/generators/library/files/lib/src/lib/__fileName__.spec.ts__tmpl__ +7 -0
- package/src/generators/library/files/lib/src/lib/__fileName__.ts__tmpl__ +3 -0
- package/src/generators/library/files/lib/tsconfig.lib.json +11 -0
- package/src/generators/library/library.d.ts +14 -0
- package/src/generators/library/library.js +108 -0
- package/src/generators/library/library.js.map +1 -0
- package/src/generators/library/schema.d.ts +24 -0
- package/src/generators/library/schema.json +129 -0
- package/src/generators/setup-docker/files/Dockerfile__tmpl__ +24 -0
- package/src/generators/setup-docker/schema.d.ts +6 -0
- package/src/generators/setup-docker/schema.json +29 -0
- package/src/generators/setup-docker/setup-docker.d.ts +6 -0
- package/src/generators/setup-docker/setup-docker.js +54 -0
- package/src/generators/setup-docker/setup-docker.js.map +1 -0
- package/src/migrations/update-13-0-0/remove-deprecated-options-13-0-0.d.ts +2 -0
- package/src/migrations/update-13-0-0/remove-deprecated-options-13-0-0.js +31 -0
- package/src/migrations/update-13-0-0/remove-deprecated-options-13-0-0.js.map +1 -0
- package/src/migrations/update-13-0-0/remove-webpack-5-packages-13-0-0.d.ts +2 -0
- package/src/migrations/update-13-0-0/remove-webpack-5-packages-13-0-0.js +33 -0
- package/src/migrations/update-13-0-0/remove-webpack-5-packages-13-0-0.js.map +1 -0
- package/src/migrations/update-13-8-5/rename-build-to-webpack.d.ts +2 -0
- package/src/migrations/update-13-8-5/rename-build-to-webpack.js +17 -0
- package/src/migrations/update-13-8-5/rename-build-to-webpack.js.map +1 -0
- package/src/migrations/update-13-8-5/rename-execute-to-node.d.ts +2 -0
- package/src/migrations/update-13-8-5/rename-execute-to-node.js +17 -0
- package/src/migrations/update-13-8-5/rename-execute-to-node.js.map +1 -0
- package/src/migrations/update-13-8-5/update-package-to-tsc.d.ts +2 -0
- package/src/migrations/update-13-8-5/update-package-to-tsc.js +39 -0
- package/src/migrations/update-13-8-5/update-package-to-tsc.js.map +1 -0
- package/src/migrations/update-14-7-6/update-webpack-executor.d.ts +2 -0
- package/src/migrations/update-14-7-6/update-webpack-executor.js +21 -0
- package/src/migrations/update-14-7-6/update-webpack-executor.js.map +1 -0
- package/src/migrations/update-16-0-0-add-nx-packages/update-16-0-0-add-nx-packages.d.ts +2 -0
- package/src/migrations/update-16-0-0-add-nx-packages/update-16-0-0-add-nx-packages.js +13 -0
- package/src/migrations/update-16-0-0-add-nx-packages/update-16-0-0-add-nx-packages.js.map +1 -0
- package/src/utils/versions.d.ts +13 -0
- package/src/utils/versions.js +17 -0
- package/src/utils/versions.js.map +1 -0
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.initSchematic = exports.initGenerator = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const devkit_1 = require("@nx/devkit");
|
|
6
|
+
const jest_1 = require("@nx/jest");
|
|
7
|
+
const js_1 = require("@nx/js");
|
|
8
|
+
const versions_1 = require("../../utils/versions");
|
|
9
|
+
function updateDependencies(tree) {
|
|
10
|
+
(0, devkit_1.removeDependenciesFromPackageJson)(tree, ['@nrwl/node'], []);
|
|
11
|
+
return (0, devkit_1.addDependenciesToPackageJson)(tree, {
|
|
12
|
+
tslib: versions_1.tslibVersion,
|
|
13
|
+
}, { '@nrwl/node': versions_1.nxVersion, '@types/node': versions_1.typesNodeVersion });
|
|
14
|
+
}
|
|
15
|
+
function normalizeOptions(schema) {
|
|
16
|
+
var _a;
|
|
17
|
+
return Object.assign(Object.assign({}, schema), { unitTestRunner: (_a = schema.unitTestRunner) !== null && _a !== void 0 ? _a : 'jest' });
|
|
18
|
+
}
|
|
19
|
+
function initGenerator(tree, schema) {
|
|
20
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
21
|
+
const options = normalizeOptions(schema);
|
|
22
|
+
const tasks = [];
|
|
23
|
+
tasks.push(yield (0, js_1.initGenerator)(tree, Object.assign(Object.assign({}, schema), { tsConfigName: schema.rootProject ? 'tsconfig.json' : 'tsconfig.base.json', skipFormat: true })));
|
|
24
|
+
if (options.unitTestRunner === 'jest') {
|
|
25
|
+
tasks.push(yield (0, jest_1.jestInitGenerator)(tree, Object.assign(Object.assign({}, schema), { testEnvironment: 'node' })));
|
|
26
|
+
}
|
|
27
|
+
tasks.push(updateDependencies(tree));
|
|
28
|
+
if (!options.skipFormat) {
|
|
29
|
+
yield (0, devkit_1.formatFiles)(tree);
|
|
30
|
+
}
|
|
31
|
+
return (0, devkit_1.runTasksInSerial)(...tasks);
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
exports.initGenerator = initGenerator;
|
|
35
|
+
exports.default = initGenerator;
|
|
36
|
+
exports.initSchematic = (0, devkit_1.convertNxGenerator)(initGenerator);
|
|
37
|
+
//# sourceMappingURL=init.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"init.js","sourceRoot":"","sources":["../../../../../../packages/node/src/generators/init/init.ts"],"names":[],"mappings":";;;;AAAA,uCAQoB;AACpB,mCAA6C;AAE7C,+BAA0D;AAC1D,mDAI8B;AAG9B,SAAS,kBAAkB,CAAC,IAAU;IACpC,IAAA,0CAAiC,EAAC,IAAI,EAAE,CAAC,YAAY,CAAC,EAAE,EAAE,CAAC,CAAC;IAE5D,OAAO,IAAA,qCAA4B,EACjC,IAAI,EACJ;QACE,KAAK,EAAE,uBAAY;KACpB,EACD,EAAE,YAAY,EAAE,oBAAS,EAAE,aAAa,EAAE,2BAAgB,EAAE,CAC7D,CAAC;AACJ,CAAC;AAED,SAAS,gBAAgB,CAAC,MAAc;;IACtC,uCACK,MAAM,KACT,cAAc,EAAE,MAAA,MAAM,CAAC,cAAc,mCAAI,MAAM,IAC/C;AACJ,CAAC;AAED,SAAsB,aAAa,CAAC,IAAU,EAAE,MAAc;;QAC5D,MAAM,OAAO,GAAG,gBAAgB,CAAC,MAAM,CAAC,CAAC;QAEzC,MAAM,KAAK,GAAwB,EAAE,CAAC;QACtC,KAAK,CAAC,IAAI,CACR,MAAM,IAAA,kBAAe,EAAC,IAAI,kCACrB,MAAM,KACT,YAAY,EAAE,MAAM,CAAC,WAAW,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,oBAAoB,EACzE,UAAU,EAAE,IAAI,IAChB,CACH,CAAC;QACF,IAAI,OAAO,CAAC,cAAc,KAAK,MAAM,EAAE;YACrC,KAAK,CAAC,IAAI,CACR,MAAM,IAAA,wBAAiB,EAAC,IAAI,kCAAO,MAAM,KAAE,eAAe,EAAE,MAAM,IAAG,CACtE,CAAC;SACH;QAED,KAAK,CAAC,IAAI,CAAC,kBAAkB,CAAC,IAAI,CAAC,CAAC,CAAC;QAErC,IAAI,CAAC,OAAO,CAAC,UAAU,EAAE;YACvB,MAAM,IAAA,oBAAW,EAAC,IAAI,CAAC,CAAC;SACzB;QAED,OAAO,IAAA,yBAAgB,EAAC,GAAG,KAAK,CAAC,CAAC;IACpC,CAAC;CAAA;AAxBD,sCAwBC;AAED,kBAAe,aAAa,CAAC;AAChB,QAAA,aAAa,GAAG,IAAA,2BAAkB,EAAC,aAAa,CAAC,CAAC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "http://json-schema.org/schema",
|
|
3
|
+
"cli": "nx",
|
|
4
|
+
"$id": "NxNodeInit",
|
|
5
|
+
"title": "Init Node Plugin",
|
|
6
|
+
"description": "Init Node Plugin.",
|
|
7
|
+
"type": "object",
|
|
8
|
+
"properties": {
|
|
9
|
+
"unitTestRunner": {
|
|
10
|
+
"description": "Adds the specified unit test runner.",
|
|
11
|
+
"type": "string",
|
|
12
|
+
"enum": ["jest", "none"],
|
|
13
|
+
"default": "jest"
|
|
14
|
+
},
|
|
15
|
+
"skipFormat": {
|
|
16
|
+
"description": "Skip formatting files.",
|
|
17
|
+
"type": "boolean",
|
|
18
|
+
"default": false
|
|
19
|
+
},
|
|
20
|
+
"js": {
|
|
21
|
+
"type": "boolean",
|
|
22
|
+
"default": false,
|
|
23
|
+
"description": "Use JavaScript instead of TypeScript"
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
"required": []
|
|
27
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
{
|
|
2
|
+
"extends": "./tsconfig.json",
|
|
3
|
+
"compilerOptions": {
|
|
4
|
+
"module": "commonjs",
|
|
5
|
+
"outDir": "<%= offsetFromRoot %>dist/out-tsc",
|
|
6
|
+
"declaration": true,
|
|
7
|
+
"types": ["node"]
|
|
8
|
+
},
|
|
9
|
+
"exclude": ["jest.config.ts", "src/**/*.spec.ts", "src/**/*.test.ts"],
|
|
10
|
+
"include": ["src/**/*.ts"]
|
|
11
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { GeneratorCallback, Tree } from '@nx/devkit';
|
|
2
|
+
import { Schema } from './schema';
|
|
3
|
+
export interface NormalizedSchema extends Schema {
|
|
4
|
+
name: string;
|
|
5
|
+
prefix: string;
|
|
6
|
+
fileName: string;
|
|
7
|
+
projectRoot: string;
|
|
8
|
+
projectDirectory: string;
|
|
9
|
+
parsedTags: string[];
|
|
10
|
+
compiler: 'swc' | 'tsc';
|
|
11
|
+
}
|
|
12
|
+
export declare function libraryGenerator(tree: Tree, schema: Schema): Promise<GeneratorCallback>;
|
|
13
|
+
export default libraryGenerator;
|
|
14
|
+
export declare const librarySchematic: (generatorOptions: Schema) => (tree: any, context: any) => Promise<any>;
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.librarySchematic = exports.libraryGenerator = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const devkit_1 = require("@nx/devkit");
|
|
6
|
+
const path_1 = require("nx/src/utils/path");
|
|
7
|
+
const js_1 = require("@nx/js");
|
|
8
|
+
const path_2 = require("path");
|
|
9
|
+
const add_swc_dependencies_1 = require("@nx/js/src/utils/swc/add-swc-dependencies");
|
|
10
|
+
const add_swc_config_1 = require("@nx/js/src/utils/swc/add-swc-config");
|
|
11
|
+
const init_1 = require("../init/init");
|
|
12
|
+
function libraryGenerator(tree, schema) {
|
|
13
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
14
|
+
const options = normalizeOptions(tree, schema);
|
|
15
|
+
const tasks = [
|
|
16
|
+
yield (0, init_1.initGenerator)(tree, Object.assign(Object.assign({}, options), { skipFormat: true })),
|
|
17
|
+
];
|
|
18
|
+
if (options.publishable === true && !schema.importPath) {
|
|
19
|
+
throw new Error(`For publishable libs you have to provide a proper "--importPath" which needs to be a valid npm package name (e.g. my-awesome-lib or @myorg/my-lib)`);
|
|
20
|
+
}
|
|
21
|
+
const libraryInstall = yield (0, js_1.libraryGenerator)(tree, Object.assign(Object.assign({}, schema), { bundler: schema.buildable ? 'tsc' : 'none', includeBabelRc: schema.babelJest, importPath: options.importPath, testEnvironment: 'node', skipFormat: true, setParserOptionsProject: options.setParserOptionsProject }));
|
|
22
|
+
tasks.push(libraryInstall);
|
|
23
|
+
createFiles(tree, options);
|
|
24
|
+
if (options.js) {
|
|
25
|
+
(0, devkit_1.updateTsConfigsToJs)(tree, options);
|
|
26
|
+
}
|
|
27
|
+
updateProject(tree, options);
|
|
28
|
+
if (!schema.skipFormat) {
|
|
29
|
+
yield (0, devkit_1.formatFiles)(tree);
|
|
30
|
+
}
|
|
31
|
+
return (0, devkit_1.runTasksInSerial)(...tasks);
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
exports.libraryGenerator = libraryGenerator;
|
|
35
|
+
exports.default = libraryGenerator;
|
|
36
|
+
exports.librarySchematic = (0, devkit_1.convertNxGenerator)(libraryGenerator);
|
|
37
|
+
function normalizeOptions(tree, options) {
|
|
38
|
+
const { layoutDirectory, projectDirectory } = (0, devkit_1.extractLayoutDirectory)(options.directory);
|
|
39
|
+
const { npmScope, libsDir: defaultLibsDir } = (0, devkit_1.getWorkspaceLayout)(tree);
|
|
40
|
+
const libsDir = layoutDirectory !== null && layoutDirectory !== void 0 ? layoutDirectory : defaultLibsDir;
|
|
41
|
+
const name = (0, devkit_1.names)(options.name).fileName;
|
|
42
|
+
const fullProjectDirectory = projectDirectory
|
|
43
|
+
? `${(0, devkit_1.names)(projectDirectory).fileName}/${name}`
|
|
44
|
+
: name;
|
|
45
|
+
const projectName = fullProjectDirectory.replace(new RegExp('/', 'g'), '-');
|
|
46
|
+
const fileName = getCaseAwareFileName({
|
|
47
|
+
fileName: options.simpleModuleName ? name : projectName,
|
|
48
|
+
pascalCaseFiles: options.pascalCaseFiles,
|
|
49
|
+
});
|
|
50
|
+
const projectRoot = (0, devkit_1.joinPathFragments)(libsDir, fullProjectDirectory);
|
|
51
|
+
const parsedTags = options.tags
|
|
52
|
+
? options.tags.split(',').map((s) => s.trim())
|
|
53
|
+
: [];
|
|
54
|
+
const importPath = options.importPath || (0, path_1.getImportPath)(npmScope, fullProjectDirectory);
|
|
55
|
+
return Object.assign(Object.assign({}, options), { prefix: npmScope, // we could also allow customizing this
|
|
56
|
+
fileName, name: projectName, projectRoot, projectDirectory: fullProjectDirectory, parsedTags,
|
|
57
|
+
importPath });
|
|
58
|
+
}
|
|
59
|
+
function getCaseAwareFileName(options) {
|
|
60
|
+
const normalized = (0, devkit_1.names)(options.fileName);
|
|
61
|
+
return options.pascalCaseFiles ? normalized.className : normalized.fileName;
|
|
62
|
+
}
|
|
63
|
+
function createFiles(tree, options) {
|
|
64
|
+
const { className, name, propertyName } = (0, devkit_1.names)(options.fileName);
|
|
65
|
+
(0, devkit_1.generateFiles)(tree, (0, path_2.join)(__dirname, './files/lib'), options.projectRoot, Object.assign(Object.assign({}, options), { className,
|
|
66
|
+
name,
|
|
67
|
+
propertyName, tmpl: '', offsetFromRoot: (0, devkit_1.offsetFromRoot)(options.projectRoot) }));
|
|
68
|
+
if (options.unitTestRunner === 'none') {
|
|
69
|
+
tree.delete((0, path_2.join)(options.projectRoot, `./src/lib/${options.fileName}.spec.ts`));
|
|
70
|
+
}
|
|
71
|
+
if (!options.publishable && !options.buildable) {
|
|
72
|
+
tree.delete((0, path_2.join)(options.projectRoot, 'package.json'));
|
|
73
|
+
}
|
|
74
|
+
if (options.js) {
|
|
75
|
+
(0, devkit_1.toJS)(tree);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
function updateProject(tree, options) {
|
|
79
|
+
if (!options.publishable && !options.buildable) {
|
|
80
|
+
return;
|
|
81
|
+
}
|
|
82
|
+
const project = (0, devkit_1.readProjectConfiguration)(tree, options.name);
|
|
83
|
+
const { libsDir } = (0, devkit_1.getWorkspaceLayout)(tree);
|
|
84
|
+
const rootProject = options.projectRoot === '.' || options.projectRoot === '';
|
|
85
|
+
project.targets = project.targets || {};
|
|
86
|
+
project.targets.build = {
|
|
87
|
+
executor: `@nrwl/js:${options.compiler}`,
|
|
88
|
+
outputs: ['{options.outputPath}'],
|
|
89
|
+
options: {
|
|
90
|
+
outputPath: (0, devkit_1.joinPathFragments)('dist', rootProject
|
|
91
|
+
? options.projectDirectory
|
|
92
|
+
: `${libsDir}/${options.projectDirectory}`),
|
|
93
|
+
tsConfig: `${options.projectRoot}/tsconfig.lib.json`,
|
|
94
|
+
packageJson: `${options.projectRoot}/package.json`,
|
|
95
|
+
main: `${options.projectRoot}/src/index` + (options.js ? '.js' : '.ts'),
|
|
96
|
+
assets: [`${options.projectRoot}/*.md`],
|
|
97
|
+
},
|
|
98
|
+
};
|
|
99
|
+
if (options.compiler === 'swc') {
|
|
100
|
+
(0, add_swc_dependencies_1.addSwcDependencies)(tree);
|
|
101
|
+
(0, add_swc_config_1.addSwcConfig)(tree, options.projectRoot);
|
|
102
|
+
}
|
|
103
|
+
if (options.rootDir) {
|
|
104
|
+
project.targets.build.options.srcRootForCompilationRoot = options.rootDir;
|
|
105
|
+
}
|
|
106
|
+
(0, devkit_1.updateProjectConfiguration)(tree, options.name, project);
|
|
107
|
+
}
|
|
108
|
+
//# sourceMappingURL=library.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"library.js","sourceRoot":"","sources":["../../../../../../packages/node/src/generators/library/library.ts"],"names":[],"mappings":";;;;AAAA,uCAgBoB;AACpB,4CAAkD;AAElD,+BAAgE;AAEhE,+BAA4B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C,CAAC;QACzB,IAAA,6BAAY,EAAC,IAAI,EAAE,OAAO,CAAC,WAAW,CAAC,CAAC;KACzC;IAED,IAAI,OAAO,CAAC,OAAO,EAAE;QACnB,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,yBAAyB,GAAG,OAAO,CAAC,OAAO,CAAC;KAC3E;IAED,IAAA,mCAA0B,EAAC,IAAI,EAAE,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;AAC1D,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { Linter } from '@nx/linter';
|
|
2
|
+
|
|
3
|
+
export interface Schema {
|
|
4
|
+
name: string;
|
|
5
|
+
directory?: string;
|
|
6
|
+
simpleModuleName?: boolean;
|
|
7
|
+
skipTsConfig?: boolean;
|
|
8
|
+
skipFormat?: boolean;
|
|
9
|
+
tags?: string;
|
|
10
|
+
unitTestRunner?: 'jest' | 'none';
|
|
11
|
+
linter?: Linter;
|
|
12
|
+
buildable?: boolean;
|
|
13
|
+
publishable?: boolean;
|
|
14
|
+
importPath?: string;
|
|
15
|
+
testEnvironment?: 'jsdom' | 'node';
|
|
16
|
+
rootDir?: string;
|
|
17
|
+
babelJest?: boolean;
|
|
18
|
+
js?: boolean;
|
|
19
|
+
pascalCaseFiles?: boolean;
|
|
20
|
+
strict?: boolean;
|
|
21
|
+
standaloneConfig?: boolean;
|
|
22
|
+
setParserOptionsProject?: boolean;
|
|
23
|
+
compiler: 'tsc' | 'swc';
|
|
24
|
+
}
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "http://json-schema.org/schema",
|
|
3
|
+
"cli": "nx",
|
|
4
|
+
"$id": "NxNodeLibrary",
|
|
5
|
+
"title": "Create a Node Library for Nx",
|
|
6
|
+
"description": "Create a Node Library for an Nx workspace.",
|
|
7
|
+
"type": "object",
|
|
8
|
+
"examples": [
|
|
9
|
+
{
|
|
10
|
+
"command": "nx g lib mylib --directory=myapp",
|
|
11
|
+
"description": "Generate `libs/myapp/mylib`"
|
|
12
|
+
}
|
|
13
|
+
],
|
|
14
|
+
"properties": {
|
|
15
|
+
"name": {
|
|
16
|
+
"type": "string",
|
|
17
|
+
"description": "Library name",
|
|
18
|
+
"$default": {
|
|
19
|
+
"$source": "argv",
|
|
20
|
+
"index": 0
|
|
21
|
+
},
|
|
22
|
+
"x-prompt": "What name would you like to use for the library?"
|
|
23
|
+
},
|
|
24
|
+
"directory": {
|
|
25
|
+
"type": "string",
|
|
26
|
+
"description": "A directory where the lib is placed",
|
|
27
|
+
"alias": "dir"
|
|
28
|
+
},
|
|
29
|
+
"simpleModuleName": {
|
|
30
|
+
"description": "Keep the module name simple (when using `--directory`).",
|
|
31
|
+
"type": "boolean",
|
|
32
|
+
"default": false
|
|
33
|
+
},
|
|
34
|
+
"linter": {
|
|
35
|
+
"description": "The tool to use for running lint checks.",
|
|
36
|
+
"type": "string",
|
|
37
|
+
"enum": ["eslint"],
|
|
38
|
+
"default": "eslint"
|
|
39
|
+
},
|
|
40
|
+
"unitTestRunner": {
|
|
41
|
+
"type": "string",
|
|
42
|
+
"enum": ["jest", "none"],
|
|
43
|
+
"description": "Test runner to use for unit tests.",
|
|
44
|
+
"default": "jest"
|
|
45
|
+
},
|
|
46
|
+
"tags": {
|
|
47
|
+
"type": "string",
|
|
48
|
+
"description": "Add tags to the library (used for linting).",
|
|
49
|
+
"alias": "t"
|
|
50
|
+
},
|
|
51
|
+
"skipFormat": {
|
|
52
|
+
"description": "Skip formatting files.",
|
|
53
|
+
"type": "boolean",
|
|
54
|
+
"default": false,
|
|
55
|
+
"x-priority": "internal"
|
|
56
|
+
},
|
|
57
|
+
"skipTsConfig": {
|
|
58
|
+
"type": "boolean",
|
|
59
|
+
"default": false,
|
|
60
|
+
"description": "Do not update `tsconfig.base.json` for development experience.",
|
|
61
|
+
"x-priority": "internal"
|
|
62
|
+
},
|
|
63
|
+
"publishable": {
|
|
64
|
+
"type": "boolean",
|
|
65
|
+
"description": "Create a publishable library.",
|
|
66
|
+
"x-priority": "important"
|
|
67
|
+
},
|
|
68
|
+
"buildable": {
|
|
69
|
+
"type": "boolean",
|
|
70
|
+
"default": false,
|
|
71
|
+
"description": "Generate a buildable library.",
|
|
72
|
+
"x-priority": "important"
|
|
73
|
+
},
|
|
74
|
+
"compiler": {
|
|
75
|
+
"type": "string",
|
|
76
|
+
"enum": ["tsc", "swc"],
|
|
77
|
+
"default": "tsc",
|
|
78
|
+
"description": "The compiler used by the build and test targets.",
|
|
79
|
+
"x-priority": "important"
|
|
80
|
+
},
|
|
81
|
+
"importPath": {
|
|
82
|
+
"type": "string",
|
|
83
|
+
"description": "The library name used to import it, like `@myorg/my-awesome-lib`. Must be a valid npm name."
|
|
84
|
+
},
|
|
85
|
+
"rootDir": {
|
|
86
|
+
"type": "string",
|
|
87
|
+
"description": "Sets the `rootDir` for TypeScript compilation. When not defined, it uses the project's root property, or `srcRootForCompilationRoot` if it is defined."
|
|
88
|
+
},
|
|
89
|
+
"testEnvironment": {
|
|
90
|
+
"type": "string",
|
|
91
|
+
"enum": ["jsdom", "node"],
|
|
92
|
+
"description": "The test environment to use if `unitTestRunner` is set to `jest`.",
|
|
93
|
+
"default": "jsdom"
|
|
94
|
+
},
|
|
95
|
+
"babelJest": {
|
|
96
|
+
"type": "boolean",
|
|
97
|
+
"description": "Use `babel` instead of `ts-jest`.",
|
|
98
|
+
"default": false
|
|
99
|
+
},
|
|
100
|
+
"pascalCaseFiles": {
|
|
101
|
+
"type": "boolean",
|
|
102
|
+
"description": "Use pascal case file names.",
|
|
103
|
+
"alias": "P",
|
|
104
|
+
"default": false
|
|
105
|
+
},
|
|
106
|
+
"js": {
|
|
107
|
+
"type": "boolean",
|
|
108
|
+
"description": "Generate JavaScript files rather than TypeScript files.",
|
|
109
|
+
"default": false
|
|
110
|
+
},
|
|
111
|
+
"strict": {
|
|
112
|
+
"type": "boolean",
|
|
113
|
+
"description": "Whether to enable tsconfig strict mode or not.",
|
|
114
|
+
"default": false
|
|
115
|
+
},
|
|
116
|
+
"standaloneConfig": {
|
|
117
|
+
"description": "Split the project configuration into `<projectRoot>/project.json` rather than including it inside `workspace.json`.",
|
|
118
|
+
"type": "boolean",
|
|
119
|
+
"default": true,
|
|
120
|
+
"x-deprecated": "Nx only supports standaloneConfig"
|
|
121
|
+
},
|
|
122
|
+
"setParserOptionsProject": {
|
|
123
|
+
"type": "boolean",
|
|
124
|
+
"description": "Whether or not to configure the ESLint `parserOptions.project`. We do not do this by default for lint performance reasons.",
|
|
125
|
+
"default": false
|
|
126
|
+
}
|
|
127
|
+
},
|
|
128
|
+
"required": ["name"]
|
|
129
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# This file is generated by Nx.
|
|
2
|
+
#
|
|
3
|
+
# Build the docker image with `npx nx docker-build <%= project %>`.
|
|
4
|
+
# Tip: Modify "docker-build" options in project.json to change docker build args.
|
|
5
|
+
#
|
|
6
|
+
# Run the container with `docker run -p 3000:3000 -t <%= project %>`.
|
|
7
|
+
FROM docker.io/node:lts-alpine
|
|
8
|
+
|
|
9
|
+
ENV HOST=0.0.0.0
|
|
10
|
+
ENV PORT=3000
|
|
11
|
+
|
|
12
|
+
WORKDIR /app
|
|
13
|
+
|
|
14
|
+
RUN addgroup --system <%= project %> && \
|
|
15
|
+
adduser --system -G <%= project %> <%= project %>
|
|
16
|
+
|
|
17
|
+
COPY <%= buildLocation %> <%= project %>
|
|
18
|
+
RUN chown -R <%= project %>:<%= project %> .
|
|
19
|
+
|
|
20
|
+
# You can remove this install step if you build with `--bundle` option.
|
|
21
|
+
# The bundled output will include external dependencies.
|
|
22
|
+
RUN npm --prefix <%= project %> --omit=dev -f install
|
|
23
|
+
|
|
24
|
+
CMD [ "node", "<%= project %>" ]
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "http://json-schema.org/schema",
|
|
3
|
+
"cli": "nx",
|
|
4
|
+
"$id": "SchematicsNxSetupDocker",
|
|
5
|
+
"title": "Nx Node Docker Options Schema",
|
|
6
|
+
"description": "Nx Node Docker Options Schema.",
|
|
7
|
+
"type": "object",
|
|
8
|
+
"properties": {
|
|
9
|
+
"project": {
|
|
10
|
+
"description": "The name of the project",
|
|
11
|
+
"$default": {
|
|
12
|
+
"$source": "projectName"
|
|
13
|
+
},
|
|
14
|
+
"type": "string",
|
|
15
|
+
"x-prompt": "What project would you like to add a Dockerfile to?",
|
|
16
|
+
"x-priority": "important"
|
|
17
|
+
},
|
|
18
|
+
"targetName": {
|
|
19
|
+
"description": "The name of the target to create",
|
|
20
|
+
"type": "string",
|
|
21
|
+
"default": "docker-build"
|
|
22
|
+
},
|
|
23
|
+
"buildTargetName": {
|
|
24
|
+
"description": "The name of the build target",
|
|
25
|
+
"type": "string",
|
|
26
|
+
"default": "build"
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { GeneratorCallback, Tree } from '@nx/devkit';
|
|
2
|
+
import { SetUpDockerOptions } from './schema';
|
|
3
|
+
export declare function updateProjectConfig(tree: Tree, options: SetUpDockerOptions): void;
|
|
4
|
+
export declare function setupDockerGenerator(tree: Tree, setupOptions: SetUpDockerOptions): Promise<GeneratorCallback>;
|
|
5
|
+
export default setupDockerGenerator;
|
|
6
|
+
export declare const setupDockerSchematic: (generatorOptions: SetUpDockerOptions) => (tree: any, context: any) => Promise<any>;
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.setupDockerSchematic = exports.setupDockerGenerator = exports.updateProjectConfig = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const devkit_1 = require("@nx/devkit");
|
|
6
|
+
function normalizeOptions(tree, setupOptions) {
|
|
7
|
+
var _a, _b, _c;
|
|
8
|
+
return Object.assign(Object.assign({}, setupOptions), { project: (_a = setupOptions.project) !== null && _a !== void 0 ? _a : (0, devkit_1.readNxJson)(tree).defaultProject, targetName: (_b = setupOptions.targetName) !== null && _b !== void 0 ? _b : 'docker-build', buildTarget: (_c = setupOptions.buildTarget) !== null && _c !== void 0 ? _c : 'build' });
|
|
9
|
+
}
|
|
10
|
+
function addDocker(tree, options) {
|
|
11
|
+
var _a;
|
|
12
|
+
const project = (0, devkit_1.readProjectConfiguration)(tree, options.project);
|
|
13
|
+
if (!project || !options.targetName) {
|
|
14
|
+
return;
|
|
15
|
+
}
|
|
16
|
+
if (tree.exists((0, devkit_1.joinPathFragments)(project.root, 'DockerFile'))) {
|
|
17
|
+
devkit_1.logger.info(`Skipping setup since a Dockerfile already exists inside ${project.root}`);
|
|
18
|
+
}
|
|
19
|
+
else {
|
|
20
|
+
const outputPath = (_a = project.targets[`${options.buildTarget}`]) === null || _a === void 0 ? void 0 : _a.options.outputPath;
|
|
21
|
+
(0, devkit_1.generateFiles)(tree, (0, devkit_1.joinPathFragments)(__dirname, './files'), project.root, {
|
|
22
|
+
tmpl: '',
|
|
23
|
+
app: project.sourceRoot,
|
|
24
|
+
buildLocation: outputPath,
|
|
25
|
+
project: options.project,
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
function updateProjectConfig(tree, options) {
|
|
30
|
+
let projectConfig = (0, devkit_1.readProjectConfiguration)(tree, options.project);
|
|
31
|
+
projectConfig.targets[`${options.targetName}`] = {
|
|
32
|
+
dependsOn: [`${options.buildTarget}`],
|
|
33
|
+
command: `docker build -f ${(0, devkit_1.joinPathFragments)(projectConfig.root, 'Dockerfile')} . -t ${options.project}`,
|
|
34
|
+
};
|
|
35
|
+
(0, devkit_1.updateProjectConfiguration)(tree, options.project, projectConfig);
|
|
36
|
+
}
|
|
37
|
+
exports.updateProjectConfig = updateProjectConfig;
|
|
38
|
+
function setupDockerGenerator(tree, setupOptions) {
|
|
39
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
40
|
+
const tasks = [];
|
|
41
|
+
const options = normalizeOptions(tree, setupOptions);
|
|
42
|
+
// Should check if the node project exists
|
|
43
|
+
addDocker(tree, options);
|
|
44
|
+
updateProjectConfig(tree, options);
|
|
45
|
+
if (!options.skipFormat) {
|
|
46
|
+
yield (0, devkit_1.formatFiles)(tree);
|
|
47
|
+
}
|
|
48
|
+
return (0, devkit_1.runTasksInSerial)(...tasks);
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
exports.setupDockerGenerator = setupDockerGenerator;
|
|
52
|
+
exports.default = setupDockerGenerator;
|
|
53
|
+
exports.setupDockerSchematic = (0, devkit_1.convertNxGenerator)(setupDockerGenerator);
|
|
54
|
+
//# sourceMappingURL=setup-docker.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"setup-docker.js","sourceRoot":"","sources":["../../../../../../packages/node/src/generators/setup-docker/setup-docker.ts"],"names":[],"mappings":";;;;AAAA,uCAYoB;AAIpB,SAAS,gBAAgB,CACvB,IAAU,EACV,YAAgC;;IAEhC,uCACK,YAAY,KACf,OAAO,EAAE,MAAA,YAAY,CAAC,OAAO,mCAAI,IAAA,mBAAU,EAAC,IAAI,CAAC,CAAC,cAAc,EAChE,UAAU,EAAE,MAAA,YAAY,CAAC,UAAU,mCAAI,cAAc,EACrD,WAAW,EAAE,MAAA,YAAY,CAAC,WAAW,mCAAI,OAAO,IAChD;AACJ,CAAC;AAED,SAAS,SAAS,CAAC,IAAU,EAAE,OAA2B;;IACxD,MAAM,OAAO,GAAG,IAAA,iCAAwB,EAAC,IAAI,EAAE,OAAO,CAAC,OAAO,CAAC,CAAC;IAChE,IAAI,CAAC,OAAO,IAAI,CAAC,OAAO,CAAC,UAAU,EAAE;QACnC,OAAO;KACR;IAED,IAAI,IAAI,CAAC,MAAM,CAAC,IAAA,0BAAiB,EAAC,OAAO,CAAC,IAAI,EAAE,YAAY,CAAC,CAAC,EAAE;QAC9D,eAAM,CAAC,IAAI,CACT,2DAA2D,O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AU,EAAE;YACvB,MAAM,IAAA,oBAAW,EAAC,IAAI,CAAC,CAAC;SACzB;QAED,OAAO,IAAA,yBAAgB,EAAC,GAAG,KAAK,CAAC,CAAC;IACpC,CAAC;CAAA;AAfD,oDAeC;AAED,kBAAe,oBAAoB,CAAC;AACvB,QAAA,oBAAoB,GAAG,IAAA,2BAAkB,EAAC,oBAAoB,CAAC,CAAC"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
const devkit_1 = require("@nx/devkit");
|
|
5
|
+
function update(host) {
|
|
6
|
+
var _a, _b, _c, _d, _e;
|
|
7
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
8
|
+
const projects = (0, devkit_1.getProjects)(host);
|
|
9
|
+
for (const [name, config] of projects.entries()) {
|
|
10
|
+
if (config.targets.build.executor !== '@nrwl/node:build')
|
|
11
|
+
return;
|
|
12
|
+
let updated = false;
|
|
13
|
+
if (typeof ((_c = (_b = (_a = config.targets.build) === null || _a === void 0 ? void 0 : _a.configurations) === null || _b === void 0 ? void 0 : _b.production) === null || _c === void 0 ? void 0 : _c['showCircularDependencies']) !== 'undefined') {
|
|
14
|
+
delete config.targets.build.configurations.production['showCircularDependencies'];
|
|
15
|
+
updated = true;
|
|
16
|
+
}
|
|
17
|
+
if (typeof ((_e = (_d = config.targets.build) === null || _d === void 0 ? void 0 : _d.options) === null || _e === void 0 ? void 0 : _e['showCircularDependencies']) !==
|
|
18
|
+
'undefined') {
|
|
19
|
+
delete config.targets.build.options['showCircularDependencies'];
|
|
20
|
+
updated = true;
|
|
21
|
+
}
|
|
22
|
+
if (updated) {
|
|
23
|
+
(0, devkit_1.updateProjectConfiguration)(host, name, config);
|
|
24
|
+
devkit_1.logger.info(`NX Removed legacy build option from "${name}": showCircularDependencies`);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
yield (0, devkit_1.formatFiles)(host);
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
exports.default = update;
|
|
31
|
+
//# sourceMappingURL=remove-deprecated-options-13-0-0.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"remove-deprecated-options-13-0-0.js","sourceRoot":"","sources":["../../../../../../packages/node/src/migrations/update-13-0-0/remove-deprecated-options-13-0-0.ts"],"names":[],"mappings":";;;AAAA,uCAMoB;AAEpB,SAA8B,MAAM,CAAC,IAAU;;;QAC7C,MAAM,QAAQ,GAAG,IAAA,oBAAW,EAAC,IAAI,CAAC,CAAC;QAEnC,KAAK,MAAM,CAAC,IAAI,EAAE,MAAM,CAAC,IAAI,QAAQ,CAAC,OAAO,EAAE,EAAE;YAC/C,IAAI,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,QAAQ,KAAK,kBAAkB;gBAAE,OAAO;YAEjE,IAAI,OAAO,GAAG,KAAK,CAAC;YAEpB,IACE,OAAO,CAAA,MAAA,MAAA,MAAA,MAAM,CAAC,OAAO,CAAC,KAAK,0CAAE,cAAc,0CAAE,UAAU,0CACrD,0BAA0B,CAC3B,CAAA,KAAK,WAAW,EACjB;gBACA,OAAO,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,cAAc,CAAC,UAAU,CACnD,0BAA0B,CAC3B,CAAC;gBACF,OAAO,GAAG,IAAI,CAAC;aAChB;YAED,IACE,OAAO,CAAA,MAAA,MAAA,MAAM,CAAC,OAAO,CAAC,KAAK,0CAAE,OAAO,0CAAG,0BAA0B,CAAC,CAAA;gBAClE,WAAW,EACX;gBACA,OAAO,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,0BAA0B,CAAC,CAAC;gBAChE,OAAO,GAAG,IAAI,CAAC;aAChB;YAED,IAAI,OAAO,EAAE;gBACX,IAAA,mCAA0B,EAAC,IAAI,EAAE,IAAI,EAAE,MAAM,CAAC,CAAC;gBAC/C,eAAM,CAAC,IAAI,CACT,wCAAwC,IAAI,6BAA6B,CAC1E,CAAC;aACH;SACF;QAED,MAAM,IAAA,oBAAW,EAAC,IAAI,CAAC,CAAC;;CACzB;AApCD,yBAoCC"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
const devkit_1 = require("@nx/devkit");
|
|
5
|
+
const packages = [
|
|
6
|
+
'webpack',
|
|
7
|
+
'copy-webpack-plugin',
|
|
8
|
+
'webpack-merge',
|
|
9
|
+
'webpack-node-externals',
|
|
10
|
+
'mini-css-extract-plugin',
|
|
11
|
+
'source-map-loader',
|
|
12
|
+
'terser-webpack-plugin',
|
|
13
|
+
'webpack-dev-server',
|
|
14
|
+
'webpack-sources',
|
|
15
|
+
'react-refresh',
|
|
16
|
+
'@pmmmwh/react-refresh-webpack-plugin',
|
|
17
|
+
];
|
|
18
|
+
function update(tree) {
|
|
19
|
+
var _a;
|
|
20
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
21
|
+
const packageJson = (0, devkit_1.readJson)(tree, 'package.json');
|
|
22
|
+
let task = undefined;
|
|
23
|
+
// Undo the install by `nx g @nrwl/web:webpack5` in Nx 12.
|
|
24
|
+
if (((_a = packageJson.devDependencies['webpack']) === null || _a === void 0 ? void 0 : _a.match(/^([\^~])?5\./)) &&
|
|
25
|
+
packages.every((p) => packageJson.devDependencies[p])) {
|
|
26
|
+
task = (0, devkit_1.removeDependenciesFromPackageJson)(tree, [], packages);
|
|
27
|
+
yield (0, devkit_1.formatFiles)(tree);
|
|
28
|
+
}
|
|
29
|
+
return task;
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
exports.default = update;
|
|
33
|
+
//# sourceMappingURL=remove-webpack-5-packages-13-0-0.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"remove-webpack-5-packages-13-0-0.js","sourceRoot":"","sources":["../../../../../../packages/node/src/migrations/update-13-0-0/remove-webpack-5-packages-13-0-0.ts"],"names":[],"mappings":";;;AAAA,uCAMoB;AAEpB,MAAM,QAAQ,GAAG;IACf,SAAS;IACT,qBAAqB;IACrB,eAAe;IACf,wBAAwB;IACxB,yBAAyB;IACzB,mBAAmB;IACnB,uBAAuB;IACvB,oBAAoB;IACpB,iBAAiB;IACjB,eAAe;IACf,sCAAsC;CACvC,CAAC;AAEF,SAA8B,MAAM,CAAC,IAAU;;;QAC7C,MAAM,WAAW,GAAG,IAAA,iBAAQ,EAAC,IAAI,EAAE,cAAc,CAAC,CAAC;QACnD,IAAI,IAAI,GAAkC,SAAS,CAAC;QAEpD,0DAA0D;QAC1D,IACE,CAAA,MAAA,WAAW,CAAC,eAAe,CAAC,SAAS,CAAC,0CAAE,KAAK,CAAC,cAAc,CAAC;YAC7D,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,WAAW,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC,EACrD;YACA,IAAI,GAAG,IAAA,0CAAiC,EAAC,IAAI,EAAE,EAAE,EAAE,QAAQ,CAAC,CAAC;YAC7D,MAAM,IAAA,oBAAW,EAAC,IAAI,CAAC,CAAC;SACzB;QAED,OAAO,IAAI,CAAC;;CACb;AAdD,yBAcC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
const devkit_1 = require("@nx/devkit");
|
|
5
|
+
const executor_options_utils_1 = require("@nx/devkit/src/generators/executor-options-utils");
|
|
6
|
+
function update(host) {
|
|
7
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
8
|
+
(0, executor_options_utils_1.forEachExecutorOptions)(host, '@nrwl/node:build', (_, projectName, targetName) => {
|
|
9
|
+
const projectConfiguration = (0, devkit_1.readProjectConfiguration)(host, projectName);
|
|
10
|
+
projectConfiguration.targets[targetName].executor = '@nrwl/node:webpack';
|
|
11
|
+
(0, devkit_1.updateProjectConfiguration)(host, projectName, projectConfiguration);
|
|
12
|
+
});
|
|
13
|
+
yield (0, devkit_1.formatFiles)(host);
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
exports.default = update;
|
|
17
|
+
//# sourceMappingURL=rename-build-to-webpack.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rename-build-to-webpack.js","sourceRoot":"","sources":["../../../../../../packages/node/src/migrations/update-13-8-5/rename-build-to-webpack.ts"],"names":[],"mappings":";;;AAAA,uCAKoB;AACpB,6FAA0F;AAE1F,SAA8B,MAAM,CAAC,IAAU;;QAC7C,IAAA,+CAAsB,EACpB,IAAI,EACJ,kBAAkB,EAClB,CAAC,CAAC,EAAE,WAAW,EAAE,UAAU,EAAE,EAAE;YAC7B,MAAM,oBAAoB,GAAG,IAAA,iCAAwB,EAAC,IAAI,EAAE,WAAW,CAAC,CAAC;YACzE,oBAAoB,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC,QAAQ,GAAG,oBAAoB,CAAC;YACzE,IAAA,mCAA0B,EAAC,IAAI,EAAE,WAAW,EAAE,oBAAoB,CAAC,CAAC;QACtE,CAAC,CACF,CAAC;QAEF,MAAM,IAAA,oBAAW,EAAC,IAAI,CAAC,CAAC;IAC1B,CAAC;CAAA;AAZD,yBAYC"}
|