@nx/node 23.0.0-pr.35465.2bc2643 → 23.0.0-rc.0
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/{index.d.ts → dist/index.d.ts} +0 -1
- package/dist/internal.d.ts +2 -0
- package/dist/internal.js +5 -0
- package/{src → dist/src}/generators/application/application.d.ts +0 -1
- package/{src → dist/src}/generators/application/application.js +16 -43
- package/{src → dist/src}/generators/application/lib/add-dependencies.d.ts +0 -1
- package/dist/src/generators/application/lib/add-dependencies.js +55 -0
- package/{src → dist/src}/generators/application/lib/add-linting.d.ts +0 -1
- package/{src → dist/src}/generators/application/lib/add-proxy.d.ts +0 -1
- package/{src → dist/src}/generators/application/lib/create-files.d.ts +0 -1
- package/{src → dist/src}/generators/application/lib/create-project.d.ts +0 -1
- package/{src → dist/src}/generators/application/lib/create-project.js +10 -5
- package/{src → dist/src}/generators/application/lib/create-targets.d.ts +0 -1
- package/{src → dist/src}/generators/application/lib/create-targets.js +5 -5
- package/{src → dist/src}/generators/application/lib/index.d.ts +0 -1
- package/{src → dist/src}/generators/application/lib/normalize-options.d.ts +0 -1
- package/{src → dist/src}/generators/application/lib/normalize-options.js +5 -5
- package/{src → dist/src}/generators/application/lib/normalized-schema.d.ts +0 -1
- package/{src → dist/src}/generators/application/schema.d.ts +1 -1
- package/{src → dist/src}/generators/application/schema.json +6 -6
- package/{src → dist/src}/generators/e2e-project/e2e-project.d.ts +0 -1
- package/{src → dist/src}/generators/e2e-project/e2e-project.js +16 -20
- package/{src → dist/src}/generators/init/init.d.ts +0 -1
- package/{src → dist/src}/generators/init/init.js +1 -1
- package/{src → dist/src}/generators/init/schema.json +1 -1
- package/{src → dist/src}/generators/library/library.d.ts +0 -1
- package/{src → dist/src}/generators/library/library.js +11 -15
- package/{src → dist/src}/generators/library/schema.d.ts +0 -1
- package/{src → dist/src}/generators/library/schema.json +0 -6
- package/{src → dist/src}/generators/setup-docker/setup-docker.d.ts +0 -1
- package/dist/src/migrations/update-23-0-0/rewrite-internal-subpath-imports.d.ts +3 -0
- package/dist/src/migrations/update-23-0-0/rewrite-internal-subpath-imports.js +197 -0
- package/dist/src/utils/assert-supported-framework-version.d.ts +5 -0
- package/dist/src/utils/assert-supported-framework-version.js +28 -0
- package/{src → dist/src}/utils/has-webpack-plugin.d.ts +0 -1
- package/{src → dist/src}/utils/kill-port.d.ts +0 -1
- package/dist/src/utils/versions.d.ts +43 -0
- package/dist/src/utils/versions.js +127 -0
- package/{src → dist/src}/utils/vscode-debug-config.d.ts +0 -1
- package/{src → dist/src}/utils/wait-for-port-open.d.ts +0 -1
- package/{utils.d.ts → dist/utils.d.ts} +0 -1
- package/generators.json +8 -8
- package/migrations.json +13 -30
- package/package.json +67 -12
- package/index.d.ts.map +0 -1
- package/src/generators/application/application.d.ts.map +0 -1
- package/src/generators/application/lib/add-dependencies.d.ts.map +0 -1
- package/src/generators/application/lib/add-dependencies.js +0 -51
- package/src/generators/application/lib/add-linting.d.ts.map +0 -1
- package/src/generators/application/lib/add-proxy.d.ts.map +0 -1
- package/src/generators/application/lib/create-files.d.ts.map +0 -1
- package/src/generators/application/lib/create-project.d.ts.map +0 -1
- package/src/generators/application/lib/create-targets.d.ts.map +0 -1
- package/src/generators/application/lib/index.d.ts.map +0 -1
- package/src/generators/application/lib/normalize-options.d.ts.map +0 -1
- package/src/generators/application/lib/normalized-schema.d.ts.map +0 -1
- package/src/generators/e2e-project/e2e-project.d.ts.map +0 -1
- package/src/generators/init/init.d.ts.map +0 -1
- package/src/generators/library/library.d.ts.map +0 -1
- package/src/generators/setup-docker/setup-docker.d.ts.map +0 -1
- package/src/utils/has-webpack-plugin.d.ts.map +0 -1
- package/src/utils/kill-port.d.ts.map +0 -1
- package/src/utils/versions.d.ts +0 -13
- package/src/utils/versions.d.ts.map +0 -1
- package/src/utils/versions.js +0 -15
- package/src/utils/vscode-debug-config.d.ts.map +0 -1
- package/src/utils/wait-for-port-open.d.ts.map +0 -1
- package/utils.d.ts.map +0 -1
- /package/{LICENSE → dist/LICENSE} +0 -0
- /package/{index.js → dist/index.js} +0 -0
- /package/{src → dist/src}/generators/application/files/common/src/assets/.gitkeep +0 -0
- /package/{src → dist/src}/generators/application/files/common/src/main.ts__tmpl__ +0 -0
- /package/{src → dist/src}/generators/application/files/common/tsconfig.app.json +0 -0
- /package/{src → dist/src}/generators/application/files/common/tsconfig.json +0 -0
- /package/{src → dist/src}/generators/application/files/common/webpack.config.js__tmpl__ +0 -0
- /package/{src → dist/src}/generators/application/files/express/src/main.ts__tmpl__ +0 -0
- /package/{src → dist/src}/generators/application/files/fastify/src/app/app.spec.ts__tmpl__ +0 -0
- /package/{src → dist/src}/generators/application/files/fastify/src/app/app.ts__tmpl__ +0 -0
- /package/{src → dist/src}/generators/application/files/fastify/src/app/plugins/sensible.ts__tmpl__ +0 -0
- /package/{src → dist/src}/generators/application/files/fastify/src/app/routes/root.ts__tmpl__ +0 -0
- /package/{src → dist/src}/generators/application/files/fastify/src/main.ts__tmpl__ +0 -0
- /package/{src → dist/src}/generators/application/files/koa/src/main.ts__tmpl__ +0 -0
- /package/{src → dist/src}/generators/application/lib/add-linting.js +0 -0
- /package/{src → dist/src}/generators/application/lib/add-proxy.js +0 -0
- /package/{src → dist/src}/generators/application/lib/create-files.js +0 -0
- /package/{src → dist/src}/generators/application/lib/index.js +0 -0
- /package/{src → dist/src}/generators/application/lib/normalized-schema.js +0 -0
- /package/{src → dist/src}/generators/e2e-project/files/cli/jest.config.ts__tmpl__ +0 -0
- /package/{src → dist/src}/generators/e2e-project/files/cli/src/__fileName__/__fileName__.spec.ts__tmpl__ +0 -0
- /package/{src → dist/src}/generators/e2e-project/files/cli/src/test-setup.ts__tmpl__ +0 -0
- /package/{src → dist/src}/generators/e2e-project/files/non-ts-solution/tsconfig.json__tmpl__ +0 -0
- /package/{src → dist/src}/generators/e2e-project/files/non-ts-solution/tsconfig.spec.json__tmpl__ +0 -0
- /package/{src → dist/src}/generators/e2e-project/files/server/common/jest.config.ts__tmpl__ +0 -0
- /package/{src → dist/src}/generators/e2e-project/files/server/common/src/__fileName__/__fileName__.spec.ts__tmpl__ +0 -0
- /package/{src → dist/src}/generators/e2e-project/files/server/common/src/support/global-setup.ts__tmpl__ +0 -0
- /package/{src → dist/src}/generators/e2e-project/files/server/common/src/support/global-teardown.ts__tmpl__ +0 -0
- /package/{src → dist/src}/generators/e2e-project/files/server/common/src/support/test-setup.ts__tmpl__ +0 -0
- /package/{src → dist/src}/generators/e2e-project/files/server/nest/src/__fileName__/__fileName__.spec.ts__tmpl__ +0 -0
- /package/{src → dist/src}/generators/e2e-project/files/ts-solution/tsconfig.json__tmpl__ +0 -0
- /package/{src → dist/src}/generators/e2e-project/schema.d.ts +0 -0
- /package/{src → dist/src}/generators/e2e-project/schema.json +0 -0
- /package/{src → dist/src}/generators/init/schema.d.ts +0 -0
- /package/{src → dist/src}/generators/library/files/lib/src/lib/__fileName__.spec.ts__tmpl__ +0 -0
- /package/{src → dist/src}/generators/library/files/lib/src/lib/__fileName__.ts__tmpl__ +0 -0
- /package/{src → dist/src}/generators/library/files/non-ts-solution/tsconfig.lib.json +0 -0
- /package/{src → dist/src}/generators/library/files/ts-solution/tsconfig.lib.json +0 -0
- /package/{src → dist/src}/generators/setup-docker/files/Dockerfile__tmpl__ +0 -0
- /package/{src → dist/src}/generators/setup-docker/schema.d.ts +0 -0
- /package/{src → dist/src}/generators/setup-docker/schema.json +0 -0
- /package/{src → dist/src}/generators/setup-docker/setup-docker.js +0 -0
- /package/{src → dist/src}/utils/has-webpack-plugin.js +0 -0
- /package/{src → dist/src}/utils/kill-port.js +0 -0
- /package/{src → dist/src}/utils/vscode-debug-config.js +0 -0
- /package/{src → dist/src}/utils/wait-for-port-open.js +0 -0
- /package/{utils.js → dist/utils.js} +0 -0
package/dist/internal.js
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.tslibVersion = void 0;
|
|
4
|
+
var versions_1 = require("./src/utils/versions");
|
|
5
|
+
Object.defineProperty(exports, "tslibVersion", { enumerable: true, get: function () { return versions_1.tslibVersion; } });
|
|
@@ -3,4 +3,3 @@ import { Schema } from './schema';
|
|
|
3
3
|
export declare function applicationGenerator(tree: Tree, schema: Schema): Promise<GeneratorCallback>;
|
|
4
4
|
export declare function applicationGeneratorInternal(tree: Tree, schema: Schema): Promise<GeneratorCallback>;
|
|
5
5
|
export default applicationGenerator;
|
|
6
|
-
//# sourceMappingURL=application.d.ts.map
|
|
@@ -1,46 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
-
var ownKeys = function(o) {
|
|
20
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
-
var ar = [];
|
|
22
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
-
return ar;
|
|
24
|
-
};
|
|
25
|
-
return ownKeys(o);
|
|
26
|
-
};
|
|
27
|
-
return function (mod) {
|
|
28
|
-
if (mod && mod.__esModule) return mod;
|
|
29
|
-
var result = {};
|
|
30
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
-
__setModuleDefault(result, mod);
|
|
32
|
-
return result;
|
|
33
|
-
};
|
|
34
|
-
})();
|
|
35
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
3
|
exports.applicationGenerator = applicationGenerator;
|
|
37
4
|
exports.applicationGeneratorInternal = applicationGeneratorInternal;
|
|
5
|
+
const internal_1 = require("@nx/devkit/internal");
|
|
38
6
|
const devkit_1 = require("@nx/devkit");
|
|
39
7
|
const jest_1 = require("@nx/jest");
|
|
40
8
|
const js_1 = require("@nx/js");
|
|
41
|
-
const
|
|
42
|
-
const
|
|
43
|
-
const log_show_project_command_1 = require("@nx/devkit/src/utils/log-show-project-command");
|
|
9
|
+
const internal_2 = require("@nx/js/internal");
|
|
10
|
+
const assert_supported_framework_version_1 = require("../../utils/assert-supported-framework-version");
|
|
44
11
|
const versions_1 = require("../../utils/versions");
|
|
45
12
|
const e2e_project_1 = require("../e2e-project/e2e-project");
|
|
46
13
|
const init_1 = require("../init/init");
|
|
@@ -82,8 +49,9 @@ async function applicationGenerator(tree, schema) {
|
|
|
82
49
|
});
|
|
83
50
|
}
|
|
84
51
|
async function applicationGeneratorInternal(tree, schema) {
|
|
52
|
+
(0, assert_supported_framework_version_1.assertSupportedFrameworkVersion)(tree, schema.framework);
|
|
85
53
|
const tasks = [];
|
|
86
|
-
const addTsPlugin = (0,
|
|
54
|
+
const addTsPlugin = (0, internal_2.shouldConfigureTsSolutionSetup)(tree, schema.addPlugin, schema.useTsSolution);
|
|
87
55
|
const jsInitTask = await (0, js_1.initGenerator)(tree, {
|
|
88
56
|
...schema,
|
|
89
57
|
tsConfigName: schema.rootProject ? 'tsconfig.json' : 'tsconfig.base.json',
|
|
@@ -111,7 +79,7 @@ async function applicationGeneratorInternal(tree, schema) {
|
|
|
111
79
|
return (0, devkit_1.runTasksInSerial)(...[
|
|
112
80
|
...tasks,
|
|
113
81
|
() => {
|
|
114
|
-
(0,
|
|
82
|
+
(0, internal_1.logShowProjectCommand)(options.name);
|
|
115
83
|
},
|
|
116
84
|
]);
|
|
117
85
|
}
|
|
@@ -131,7 +99,12 @@ async function applicationGeneratorInternal(tree, schema) {
|
|
|
131
99
|
});
|
|
132
100
|
tasks.push(webpackInitTask);
|
|
133
101
|
if (!options.skipPackageJson) {
|
|
134
|
-
|
|
102
|
+
// Use CommonJS `require` rather than a dynamic ESM `import`:
|
|
103
|
+
// `ensurePackage` makes the on-demand-installed package available via
|
|
104
|
+
// `Module._initPaths`, which `require()` honors but ESM resolution does
|
|
105
|
+
// not. Under nodenext, a dynamic `import()` is preserved as a true ESM
|
|
106
|
+
// dynamic import, so it can't see the temp install.
|
|
107
|
+
const { ensureDependencies, } = require('@nx/webpack/internal');
|
|
135
108
|
tasks.push(ensureDependencies(tree, {
|
|
136
109
|
uiFramework: options.isNest ? 'none' : 'react',
|
|
137
110
|
}));
|
|
@@ -142,7 +115,7 @@ async function applicationGeneratorInternal(tree, schema) {
|
|
|
142
115
|
// If we are using the new TS solution
|
|
143
116
|
// We need to update the workspace file (package.json or pnpm-workspaces.yaml) to include the new project
|
|
144
117
|
if (options.isUsingTsSolutionConfig) {
|
|
145
|
-
await (0,
|
|
118
|
+
await (0, internal_2.addProjectToTsSolutionWorkspace)(tree, options.appProjectRoot);
|
|
146
119
|
}
|
|
147
120
|
updateTsConfigOptions(tree, options);
|
|
148
121
|
if (options.linter === 'eslint') {
|
|
@@ -206,19 +179,19 @@ async function applicationGeneratorInternal(tree, schema) {
|
|
|
206
179
|
tasks.push(dockerTask);
|
|
207
180
|
}
|
|
208
181
|
if (options.isUsingTsSolutionConfig) {
|
|
209
|
-
(0,
|
|
182
|
+
(0, internal_2.updateTsconfigFiles)(tree, options.appProjectRoot, 'tsconfig.app.json', {
|
|
210
183
|
module: 'nodenext',
|
|
211
184
|
moduleResolution: 'nodenext',
|
|
212
185
|
}, options.linter === 'eslint'
|
|
213
186
|
? ['eslint.config.js', 'eslint.config.cjs', 'eslint.config.mjs']
|
|
214
187
|
: undefined);
|
|
215
188
|
}
|
|
216
|
-
(0,
|
|
189
|
+
(0, internal_2.sortPackageJsonFields)(tree, options.appProjectRoot);
|
|
217
190
|
if (!options.skipFormat) {
|
|
218
191
|
await (0, devkit_1.formatFiles)(tree);
|
|
219
192
|
}
|
|
220
193
|
tasks.push(() => {
|
|
221
|
-
(0,
|
|
194
|
+
(0, internal_1.logShowProjectCommand)(options.name);
|
|
222
195
|
});
|
|
223
196
|
return (0, devkit_1.runTasksInSerial)(...tasks);
|
|
224
197
|
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.addProjectDependencies = addProjectDependencies;
|
|
4
|
+
const devkit_1 = require("@nx/devkit");
|
|
5
|
+
const internal_1 = require("@nx/js/internal");
|
|
6
|
+
const versions_1 = require("../../../utils/versions");
|
|
7
|
+
function addProjectDependencies(tree, options) {
|
|
8
|
+
const bundlers = {
|
|
9
|
+
webpack: {
|
|
10
|
+
'@nx/webpack': versions_1.nxVersion,
|
|
11
|
+
},
|
|
12
|
+
esbuild: {
|
|
13
|
+
'@nx/esbuild': versions_1.nxVersion,
|
|
14
|
+
esbuild: internal_1.esbuildVersion,
|
|
15
|
+
},
|
|
16
|
+
};
|
|
17
|
+
const exprPkgVersions = (0, versions_1.expressVersions)(tree);
|
|
18
|
+
const koaPkgVersions = (0, versions_1.koaVersions)(tree);
|
|
19
|
+
const fastifyPkgVersions = (0, versions_1.fastifyVersions)(tree);
|
|
20
|
+
const frameworkDependencies = {
|
|
21
|
+
express: {
|
|
22
|
+
express: exprPkgVersions.expressVersion,
|
|
23
|
+
},
|
|
24
|
+
koa: {
|
|
25
|
+
koa: koaPkgVersions.koaVersion,
|
|
26
|
+
},
|
|
27
|
+
fastify: {
|
|
28
|
+
fastify: fastifyPkgVersions.fastifyVersion,
|
|
29
|
+
'fastify-plugin': fastifyPkgVersions.fastifyPluginVersion,
|
|
30
|
+
'@fastify/autoload': fastifyPkgVersions.fastifyAutoloadVersion,
|
|
31
|
+
'@fastify/sensible': fastifyPkgVersions.fastifySensibleVersion,
|
|
32
|
+
},
|
|
33
|
+
};
|
|
34
|
+
const frameworkDevDependencies = {
|
|
35
|
+
express: {
|
|
36
|
+
'@types/express': exprPkgVersions.expressTypingsVersion,
|
|
37
|
+
},
|
|
38
|
+
koa: {
|
|
39
|
+
'@types/koa': koaPkgVersions.koaTypingsVersion,
|
|
40
|
+
},
|
|
41
|
+
fastify: {},
|
|
42
|
+
};
|
|
43
|
+
const typesNodeVersion = (0, versions_1.nodeTypesVersions)(tree).typesNodeVersion;
|
|
44
|
+
return {
|
|
45
|
+
installTask: (0, devkit_1.addDependenciesToPackageJson)(tree, {
|
|
46
|
+
...frameworkDependencies[options.framework],
|
|
47
|
+
tslib: versions_1.tslibVersion,
|
|
48
|
+
}, {
|
|
49
|
+
...frameworkDevDependencies[options.framework],
|
|
50
|
+
...bundlers[options.bundler],
|
|
51
|
+
'@types/node': typesNodeVersion,
|
|
52
|
+
}, undefined, options.keepExistingVersions ?? true),
|
|
53
|
+
frameworkDependencies: frameworkDependencies[options.framework],
|
|
54
|
+
};
|
|
55
|
+
}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.addProject = addProject;
|
|
4
|
+
const internal_1 = require("@nx/devkit/internal");
|
|
4
5
|
const devkit_1 = require("@nx/devkit");
|
|
5
|
-
const
|
|
6
|
+
const internal_2 = require("@nx/js/internal");
|
|
6
7
|
const has_webpack_plugin_1 = require("../../../utils/has-webpack-plugin");
|
|
7
8
|
const create_targets_1 = require("./create-targets");
|
|
8
9
|
function addProject(tree, options, frameworkDependencies) {
|
|
@@ -14,17 +15,21 @@ function addProject(tree, options, frameworkDependencies) {
|
|
|
14
15
|
tags: options.parsedTags,
|
|
15
16
|
};
|
|
16
17
|
if (options.bundler === 'esbuild') {
|
|
17
|
-
(0,
|
|
18
|
+
(0, internal_1.addBuildTargetDefaults)(tree, '@nx/esbuild:esbuild', 'build', [
|
|
19
|
+
internal_2.TS_SOLUTION_SETUP_TSCONFIG_INPUT,
|
|
20
|
+
]);
|
|
18
21
|
project.targets.build = (0, create_targets_1.getEsBuildConfig)(tree, project, options);
|
|
19
22
|
}
|
|
20
23
|
else if (options.bundler === 'webpack') {
|
|
21
24
|
if (!(0, has_webpack_plugin_1.hasWebpackPlugin)(tree) && options.addPlugin === false) {
|
|
22
|
-
(0,
|
|
25
|
+
(0, internal_1.addBuildTargetDefaults)(tree, `@nx/webpack:webpack`, 'build', [
|
|
26
|
+
internal_2.TS_SOLUTION_SETUP_TSCONFIG_INPUT,
|
|
27
|
+
]);
|
|
23
28
|
project.targets.build = (0, create_targets_1.getWebpackBuildConfig)(tree, project, options);
|
|
24
29
|
}
|
|
25
30
|
else if (options.isNest) {
|
|
26
31
|
// If we are using Nest that has the webpack plugin we need to override the
|
|
27
|
-
// build target so that
|
|
32
|
+
// build target so that NODE_ENV can be set to production or development so the serve target can be run in development mode
|
|
28
33
|
project.targets.build = (0, create_targets_1.getNestWebpackBuildConfig)(project);
|
|
29
34
|
}
|
|
30
35
|
}
|
|
@@ -47,7 +52,7 @@ function addProject(tree, options, frameworkDependencies) {
|
|
|
47
52
|
};
|
|
48
53
|
}
|
|
49
54
|
else {
|
|
50
|
-
(0, devkit_1.addProjectConfiguration)(tree, options.name, project
|
|
55
|
+
(0, devkit_1.addProjectConfiguration)(tree, options.name, project);
|
|
51
56
|
}
|
|
52
57
|
if (!options.useProjectJson || options.isUsingTsSolutionConfig) {
|
|
53
58
|
(0, devkit_1.writeJson)(tree, (0, devkit_1.joinPathFragments)(options.appProjectRoot, 'package.json'), packageJson);
|
|
@@ -6,10 +6,10 @@ exports.getServeConfig = getServeConfig;
|
|
|
6
6
|
exports.getNestWebpackBuildConfig = getNestWebpackBuildConfig;
|
|
7
7
|
exports.getPruneTargets = getPruneTargets;
|
|
8
8
|
const devkit_1 = require("@nx/devkit");
|
|
9
|
-
const
|
|
9
|
+
const internal_1 = require("@nx/js/internal");
|
|
10
10
|
const js_1 = require("@nx/js");
|
|
11
11
|
function getWebpackBuildConfig(tree, project, options) {
|
|
12
|
-
const sourceRoot = (0,
|
|
12
|
+
const sourceRoot = (0, internal_1.getProjectSourceRoot)(project, tree);
|
|
13
13
|
return {
|
|
14
14
|
executor: `@nx/webpack:webpack`,
|
|
15
15
|
outputs: ['{options.outputPath}'],
|
|
@@ -35,7 +35,7 @@ function getWebpackBuildConfig(tree, project, options) {
|
|
|
35
35
|
};
|
|
36
36
|
}
|
|
37
37
|
function getEsBuildConfig(tree, project, options) {
|
|
38
|
-
const sourceRoot = (0,
|
|
38
|
+
const sourceRoot = (0, internal_1.getProjectSourceRoot)(project, tree);
|
|
39
39
|
return {
|
|
40
40
|
executor: '@nx/esbuild:esbuild',
|
|
41
41
|
outputs: ['{options.outputPath}'],
|
|
@@ -98,12 +98,12 @@ function getNestWebpackBuildConfig(project) {
|
|
|
98
98
|
executor: 'nx:run-commands',
|
|
99
99
|
options: {
|
|
100
100
|
command: 'webpack-cli build',
|
|
101
|
-
|
|
101
|
+
env: { NODE_ENV: 'production' },
|
|
102
102
|
cwd: project.root,
|
|
103
103
|
},
|
|
104
104
|
configurations: {
|
|
105
105
|
development: {
|
|
106
|
-
|
|
106
|
+
env: { NODE_ENV: 'development' },
|
|
107
107
|
},
|
|
108
108
|
},
|
|
109
109
|
};
|
|
@@ -2,4 +2,3 @@ import { Tree } from '@nx/devkit';
|
|
|
2
2
|
import { Schema } from '../schema';
|
|
3
3
|
import { NormalizedSchema } from './normalized-schema';
|
|
4
4
|
export declare function normalizeOptions(host: Tree, options: Schema): Promise<NormalizedSchema>;
|
|
5
|
-
//# sourceMappingURL=normalize-options.d.ts.map
|
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.normalizeOptions = normalizeOptions;
|
|
4
4
|
const devkit_1 = require("@nx/devkit");
|
|
5
|
-
const
|
|
6
|
-
const
|
|
5
|
+
const internal_1 = require("@nx/devkit/internal");
|
|
6
|
+
const internal_2 = require("@nx/js/internal");
|
|
7
7
|
async function normalizeOptions(host, options) {
|
|
8
|
-
await (0,
|
|
9
|
-
const { projectName, projectRoot: appProjectRoot, importPath, } = await (0,
|
|
8
|
+
await (0, internal_1.ensureRootProjectName)(options, 'application');
|
|
9
|
+
const { projectName, projectRoot: appProjectRoot, importPath, } = await (0, internal_1.determineProjectNameAndRootOptions)(host, {
|
|
10
10
|
name: options.name,
|
|
11
11
|
projectType: 'application',
|
|
12
12
|
directory: options.directory,
|
|
@@ -22,7 +22,7 @@ async function normalizeOptions(host, options) {
|
|
|
22
22
|
const addPlugin = options.addPlugin ??
|
|
23
23
|
(process.env.NX_ADD_PLUGINS !== 'false' &&
|
|
24
24
|
nxJson.useInferencePlugins !== false);
|
|
25
|
-
const isUsingTsSolutionConfig = (0,
|
|
25
|
+
const isUsingTsSolutionConfig = (0, internal_2.isUsingTsSolutionSetup)(host);
|
|
26
26
|
const swcJest = options.swcJest ?? isUsingTsSolutionConfig;
|
|
27
27
|
const appProjectName = !isUsingTsSolutionConfig || options.name ? projectName : importPath;
|
|
28
28
|
const useProjectJson = options.useProjectJson ?? !isUsingTsSolutionConfig;
|
|
@@ -16,7 +16,6 @@ export interface Schema {
|
|
|
16
16
|
babelJest?: boolean;
|
|
17
17
|
js?: boolean;
|
|
18
18
|
setParserOptionsProject?: boolean;
|
|
19
|
-
standaloneConfig?: boolean;
|
|
20
19
|
bundler?: 'esbuild' | 'webpack';
|
|
21
20
|
framework?: NodeJsFrameWorks;
|
|
22
21
|
port?: number;
|
|
@@ -27,6 +26,7 @@ export interface Schema {
|
|
|
27
26
|
addPlugin?: boolean;
|
|
28
27
|
useTsSolution?: boolean;
|
|
29
28
|
useProjectJson?: boolean;
|
|
29
|
+
keepExistingVersions?: boolean;
|
|
30
30
|
}
|
|
31
31
|
|
|
32
32
|
export type NodeJsFrameWorks = 'express' | 'koa' | 'fastify' | 'nest' | 'none';
|
|
@@ -87,12 +87,6 @@
|
|
|
87
87
|
"description": "Whether or not to configure the ESLint `parserOptions.project` option. We do not do this by default for lint performance reasons.",
|
|
88
88
|
"default": false
|
|
89
89
|
},
|
|
90
|
-
"standaloneConfig": {
|
|
91
|
-
"description": "Split the project configuration into `<projectRoot>/project.json` rather than including it inside `workspace.json`.",
|
|
92
|
-
"type": "boolean",
|
|
93
|
-
"default": true,
|
|
94
|
-
"x-deprecated": "Nx only supports standaloneConfig"
|
|
95
|
-
},
|
|
96
90
|
"bundler": {
|
|
97
91
|
"description": "Bundler which is used to package the application",
|
|
98
92
|
"type": "string",
|
|
@@ -132,6 +126,12 @@
|
|
|
132
126
|
"useProjectJson": {
|
|
133
127
|
"type": "boolean",
|
|
134
128
|
"description": "Use a `project.json` configuration file instead of inlining the Nx configuration in the `package.json` file."
|
|
129
|
+
},
|
|
130
|
+
"keepExistingVersions": {
|
|
131
|
+
"type": "boolean",
|
|
132
|
+
"x-priority": "internal",
|
|
133
|
+
"description": "Keep existing dependencies versions",
|
|
134
|
+
"default": true
|
|
135
135
|
}
|
|
136
136
|
},
|
|
137
137
|
"required": ["directory"]
|
|
@@ -3,4 +3,3 @@ import { Schema } from './schema';
|
|
|
3
3
|
export declare function e2eProjectGenerator(host: Tree, options: Schema): Promise<GeneratorCallback>;
|
|
4
4
|
export declare function e2eProjectGeneratorInternal(host: Tree, _options: Schema): Promise<GeneratorCallback>;
|
|
5
5
|
export default e2eProjectGenerator;
|
|
6
|
-
//# sourceMappingURL=e2e-project.d.ts.map
|
|
@@ -3,19 +3,15 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.e2eProjectGenerator = e2eProjectGenerator;
|
|
4
4
|
exports.e2eProjectGeneratorInternal = e2eProjectGeneratorInternal;
|
|
5
5
|
const tslib_1 = require("tslib");
|
|
6
|
+
const internal_1 = require("@nx/devkit/internal");
|
|
6
7
|
const devkit_1 = require("@nx/devkit");
|
|
7
|
-
const project_name_and_root_utils_1 = require("@nx/devkit/src/generators/project-name-and-root-utils");
|
|
8
8
|
const eslint_1 = require("@nx/eslint");
|
|
9
|
-
const
|
|
9
|
+
const internal_2 = require("@nx/eslint/internal");
|
|
10
10
|
const path = tslib_1.__importStar(require("path"));
|
|
11
11
|
const versions_1 = require("../../utils/versions");
|
|
12
|
-
const
|
|
13
|
-
const
|
|
14
|
-
const config_file_1 = require("@nx/jest/src/utils/config/config-file");
|
|
15
|
-
const versions_2 = require("@nx/jest/src/utils/versions");
|
|
16
|
-
const ts_solution_setup_1 = require("@nx/js/src/utils/typescript/ts-solution-setup");
|
|
12
|
+
const internal_3 = require("@nx/jest/internal");
|
|
13
|
+
const internal_4 = require("@nx/js/internal");
|
|
17
14
|
const posix_1 = require("node:path/posix");
|
|
18
|
-
const add_swc_config_1 = require("@nx/js/src/utils/swc/add-swc-config");
|
|
19
15
|
async function e2eProjectGenerator(host, options) {
|
|
20
16
|
return await e2eProjectGeneratorInternal(host, {
|
|
21
17
|
addPlugin: false,
|
|
@@ -28,7 +24,7 @@ async function e2eProjectGeneratorInternal(host, _options) {
|
|
|
28
24
|
const options = await normalizeOptions(host, _options);
|
|
29
25
|
const appProject = (0, devkit_1.readProjectConfiguration)(host, options.project);
|
|
30
26
|
// Detect Jest 30+ to use .cts config files (CommonJS TypeScript)
|
|
31
|
-
const jestMajorVersion = (0,
|
|
27
|
+
const jestMajorVersion = (0, internal_3.getInstalledJestMajorVersion)(host);
|
|
32
28
|
const useCommonJsConfig = jestMajorVersion === null || jestMajorVersion >= 30;
|
|
33
29
|
const jestConfigExt = useCommonJsConfig ? 'cts' : 'ts';
|
|
34
30
|
// TODO(@ndcunningham): This is broken.. the outputs are wrong.. and this isn't using the jest generator
|
|
@@ -102,7 +98,7 @@ async function e2eProjectGeneratorInternal(host, _options) {
|
|
|
102
98
|
};
|
|
103
99
|
});
|
|
104
100
|
}
|
|
105
|
-
const jestPreset = (0,
|
|
101
|
+
const jestPreset = (0, internal_3.findRootJestPreset)(host) ?? 'jest.preset.js';
|
|
106
102
|
const tsConfigFile = options.isUsingTsSolutionConfig
|
|
107
103
|
? 'tsconfig.json'
|
|
108
104
|
: 'tsconfig.spec.json';
|
|
@@ -150,7 +146,7 @@ async function e2eProjectGeneratorInternal(host, _options) {
|
|
|
150
146
|
host.rename(jestConfigPath, (0, devkit_1.joinPathFragments)(options.e2eProjectRoot, 'jest.config.cts'));
|
|
151
147
|
}
|
|
152
148
|
if (options.isUsingTsSolutionConfig) {
|
|
153
|
-
(0,
|
|
149
|
+
(0, internal_4.addSwcTestConfig)(host, options.e2eProjectRoot, 'es6');
|
|
154
150
|
(0, devkit_1.generateFiles)(host, path.join(__dirname, 'files/ts-solution'), options.e2eProjectRoot, {
|
|
155
151
|
...options,
|
|
156
152
|
relativeProjectReferencePath: (0, posix_1.relative)(options.e2eProjectRoot, appProject.root),
|
|
@@ -182,11 +178,11 @@ async function e2eProjectGeneratorInternal(host, _options) {
|
|
|
182
178
|
addPlugin: options.addPlugin,
|
|
183
179
|
});
|
|
184
180
|
tasks.push(linterTask);
|
|
185
|
-
if (options.rootProject && (0,
|
|
186
|
-
(0,
|
|
187
|
-
(0,
|
|
188
|
-
|
|
189
|
-
|
|
181
|
+
if (options.rootProject && (0, internal_2.isEslintConfigSupported)(host)) {
|
|
182
|
+
(0, internal_2.addPluginsToLintConfig)(host, options.e2eProjectRoot, '@nx');
|
|
183
|
+
(0, internal_2.replaceOverridesInLintConfig)(host, options.e2eProjectRoot, [
|
|
184
|
+
internal_2.typeScriptOverride,
|
|
185
|
+
internal_2.javaScriptOverride,
|
|
190
186
|
]);
|
|
191
187
|
}
|
|
192
188
|
}
|
|
@@ -203,13 +199,13 @@ async function e2eProjectGeneratorInternal(host, _options) {
|
|
|
203
199
|
// If we are using the new TS solution
|
|
204
200
|
// We need to update the workspace file (package.json or pnpm-workspaces.yaml) to include the new project
|
|
205
201
|
if (options.isUsingTsSolutionConfig) {
|
|
206
|
-
await (0,
|
|
202
|
+
await (0, internal_4.addProjectToTsSolutionWorkspace)(host, options.e2eProjectRoot);
|
|
207
203
|
}
|
|
208
204
|
if (!options.skipFormat) {
|
|
209
205
|
await (0, devkit_1.formatFiles)(host);
|
|
210
206
|
}
|
|
211
207
|
tasks.push(() => {
|
|
212
|
-
(0,
|
|
208
|
+
(0, internal_1.logShowProjectCommand)(options.e2eProjectName);
|
|
213
209
|
});
|
|
214
210
|
return (0, devkit_1.runTasksInSerial)(...tasks);
|
|
215
211
|
}
|
|
@@ -219,7 +215,7 @@ async function normalizeOptions(tree, options) {
|
|
|
219
215
|
const projectConfig = (0, devkit_1.readProjectConfiguration)(tree, options.project);
|
|
220
216
|
directory = `${projectConfig.root}-e2e`;
|
|
221
217
|
}
|
|
222
|
-
const { projectName: e2eProjectName, projectRoot: e2eProjectRoot, importPath, } = await (0,
|
|
218
|
+
const { projectName: e2eProjectName, projectRoot: e2eProjectRoot, importPath, } = await (0, internal_1.determineProjectNameAndRootOptions)(tree, {
|
|
223
219
|
name: options.name,
|
|
224
220
|
projectType: 'application',
|
|
225
221
|
directory,
|
|
@@ -227,7 +223,7 @@ async function normalizeOptions(tree, options) {
|
|
|
227
223
|
const nxJson = (0, devkit_1.readNxJson)(tree);
|
|
228
224
|
const addPlugin = process.env.NX_ADD_PLUGINS !== 'false' &&
|
|
229
225
|
nxJson.useInferencePlugins !== false;
|
|
230
|
-
const isUsingTsSolutionConfig = (0,
|
|
226
|
+
const isUsingTsSolutionConfig = (0, internal_4.isUsingTsSolutionSetup)(tree);
|
|
231
227
|
return {
|
|
232
228
|
addPlugin,
|
|
233
229
|
...options,
|
|
@@ -6,7 +6,7 @@ const versions_1 = require("../../utils/versions");
|
|
|
6
6
|
function updateDependencies(tree, options) {
|
|
7
7
|
const tasks = [];
|
|
8
8
|
tasks.push((0, devkit_1.removeDependenciesFromPackageJson)(tree, ['@nx/node'], []));
|
|
9
|
-
tasks.push((0, devkit_1.addDependenciesToPackageJson)(tree, {}, { '@nx/node': versions_1.nxVersion }, undefined, options.keepExistingVersions));
|
|
9
|
+
tasks.push((0, devkit_1.addDependenciesToPackageJson)(tree, {}, { '@nx/node': versions_1.nxVersion }, undefined, options.keepExistingVersions ?? true));
|
|
10
10
|
return (0, devkit_1.runTasksInSerial)(...tasks);
|
|
11
11
|
}
|
|
12
12
|
async function initGenerator(tree, options) {
|
|
@@ -11,4 +11,3 @@ export interface NormalizedSchema extends Schema {
|
|
|
11
11
|
export declare function libraryGenerator(tree: Tree, schema: Schema): Promise<GeneratorCallback>;
|
|
12
12
|
export declare function libraryGeneratorInternal(tree: Tree, schema: Schema): Promise<GeneratorCallback>;
|
|
13
13
|
export default libraryGenerator;
|
|
14
|
-
//# sourceMappingURL=library.d.ts.map
|
|
@@ -2,17 +2,13 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.libraryGenerator = libraryGenerator;
|
|
4
4
|
exports.libraryGeneratorInternal = libraryGeneratorInternal;
|
|
5
|
+
const internal_1 = require("@nx/devkit/internal");
|
|
5
6
|
const devkit_1 = require("@nx/devkit");
|
|
6
|
-
const project_name_and_root_utils_1 = require("@nx/devkit/src/generators/project-name-and-root-utils");
|
|
7
7
|
const js_1 = require("@nx/js");
|
|
8
|
-
const
|
|
9
|
-
const add_swc_dependencies_1 = require("@nx/js/src/utils/swc/add-swc-dependencies");
|
|
8
|
+
const internal_2 = require("@nx/js/internal");
|
|
10
9
|
const path_1 = require("path");
|
|
11
10
|
const versions_1 = require("../../utils/versions");
|
|
12
11
|
const init_1 = require("../init/init");
|
|
13
|
-
const target_defaults_utils_1 = require("@nx/devkit/src/generators/target-defaults-utils");
|
|
14
|
-
const ts_solution_setup_1 = require("@nx/js/src/utils/typescript/ts-solution-setup");
|
|
15
|
-
const sort_fields_1 = require("@nx/js/src/utils/package-json/sort-fields");
|
|
16
12
|
async function libraryGenerator(tree, schema) {
|
|
17
13
|
return await libraryGeneratorInternal(tree, {
|
|
18
14
|
addPlugin: false,
|
|
@@ -25,7 +21,7 @@ async function libraryGeneratorInternal(tree, schema) {
|
|
|
25
21
|
// If we are using the new TS solution
|
|
26
22
|
// We need to update the workspace file (package.json or pnpm-workspaces.yaml) to include the new project
|
|
27
23
|
if (options.isUsingTsSolutionConfig) {
|
|
28
|
-
await (0,
|
|
24
|
+
await (0, internal_2.addProjectToTsSolutionWorkspace)(tree, options.projectRoot);
|
|
29
25
|
}
|
|
30
26
|
const tasks = [];
|
|
31
27
|
if (options.publishable === true && !schema.importPath) {
|
|
@@ -67,7 +63,7 @@ async function libraryGeneratorInternal(tree, schema) {
|
|
|
67
63
|
if (options.isUsingTsSolutionConfig) {
|
|
68
64
|
tasks.push(() => (0, devkit_1.installPackagesTask)(tree, true));
|
|
69
65
|
}
|
|
70
|
-
(0,
|
|
66
|
+
(0, internal_2.sortPackageJsonFields)(tree, options.projectRoot);
|
|
71
67
|
if (!schema.skipFormat) {
|
|
72
68
|
await (0, devkit_1.formatFiles)(tree);
|
|
73
69
|
}
|
|
@@ -75,8 +71,8 @@ async function libraryGeneratorInternal(tree, schema) {
|
|
|
75
71
|
}
|
|
76
72
|
exports.default = libraryGenerator;
|
|
77
73
|
async function normalizeOptions(tree, options) {
|
|
78
|
-
await (0,
|
|
79
|
-
const { projectName, names: projectNames, projectRoot, importPath, } = await (0,
|
|
74
|
+
await (0, internal_1.ensureRootProjectName)(options, 'library');
|
|
75
|
+
const { projectName, names: projectNames, projectRoot, importPath, } = await (0, internal_1.determineProjectNameAndRootOptions)(tree, {
|
|
80
76
|
name: options.name,
|
|
81
77
|
projectType: 'library',
|
|
82
78
|
directory: options.directory,
|
|
@@ -95,8 +91,8 @@ async function normalizeOptions(tree, options) {
|
|
|
95
91
|
// this helper is called before the jsLibraryGenerator is called, so, if the
|
|
96
92
|
// TS solution setup is not configured, we additionally check if the TS
|
|
97
93
|
// solution setup will be configured by the jsLibraryGenerator
|
|
98
|
-
const isUsingTsSolutionConfig = (0,
|
|
99
|
-
(0,
|
|
94
|
+
const isUsingTsSolutionConfig = (0, internal_2.isUsingTsSolutionSetup)(tree) ||
|
|
95
|
+
(0, internal_2.shouldConfigureTsSolutionSetup)(tree, options.addPlugin);
|
|
100
96
|
return {
|
|
101
97
|
...options,
|
|
102
98
|
fileName,
|
|
@@ -132,7 +128,7 @@ function updateProject(tree, options) {
|
|
|
132
128
|
const project = (0, devkit_1.readProjectConfiguration)(tree, options.projectName);
|
|
133
129
|
const rootProject = options.projectRoot === '.' || options.projectRoot === '';
|
|
134
130
|
project.targets = project.targets || {};
|
|
135
|
-
(0,
|
|
131
|
+
(0, internal_1.addBuildTargetDefaults)(tree, `@nx/js:${options.compiler}`);
|
|
136
132
|
// For TS solution, we want tsc build to be inferred by `@nx/js/typescript` plugin.
|
|
137
133
|
if (!options.isUsingTsSolutionConfig || options.compiler === 'swc') {
|
|
138
134
|
project.targets.build = {
|
|
@@ -153,8 +149,8 @@ function updateProject(tree, options) {
|
|
|
153
149
|
};
|
|
154
150
|
}
|
|
155
151
|
if (options.compiler === 'swc') {
|
|
156
|
-
(0,
|
|
157
|
-
(0,
|
|
152
|
+
(0, internal_2.addSwcDependencies)(tree);
|
|
153
|
+
(0, internal_2.addSwcConfig)(tree, options.projectRoot);
|
|
158
154
|
}
|
|
159
155
|
if (options.rootDir) {
|
|
160
156
|
project.targets.build.options.srcRootForCompilationRoot = options.rootDir;
|