@nx/rspack 19.8.0 → 20.0.0-beta.4
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/LICENSE +1 -1
- package/README.md +70 -34
- package/executors.json +2 -2
- package/module-federation.js +0 -1
- package/package.json +14 -9
- package/plugin.js +0 -1
- package/src/executors/dev-server/dev-server.impl.js +39 -38
- package/src/executors/dev-server/lib/get-dev-server-config.js +1 -3
- package/src/executors/dev-server/lib/serve-path.js +0 -1
- package/src/executors/dev-server/schema.json +3 -9
- package/src/executors/module-federation-dev-server/module-federation-dev-server.impl.js +109 -98
- package/src/executors/module-federation-dev-server/schema.json +1 -3
- package/src/executors/module-federation-ssr-dev-server/module-federation-ssr-dev-server.impl.js +153 -148
- package/src/executors/module-federation-ssr-dev-server/schema.json +1 -4
- package/src/executors/module-federation-static-server/module-federation-static-server.impl.js +117 -125
- package/src/executors/rspack/rspack.impl.js +60 -67
- package/src/executors/rspack/schema.json +6 -26
- package/src/executors/ssr-dev-server/lib/wait-until-server-is-listening.js +0 -1
- package/src/executors/ssr-dev-server/schema.json +1 -4
- package/src/executors/ssr-dev-server/ssr-dev-server.impl.js +26 -40
- package/src/generators/application/application.js +79 -76
- package/src/generators/application/lib/create-ts-config.js +5 -3
- package/src/generators/application/lib/normalize-options.js +12 -7
- package/src/generators/application/schema.json +1 -0
- package/src/generators/configuration/configuration.js +63 -65
- package/src/generators/configuration/schema.json +2 -1
- package/src/generators/init/init.js +58 -59
- package/src/generators/init/schema.json +2 -1
- package/src/generators/preset/preset.js +26 -29
- package/src/generators/preset/schema.json +1 -0
- package/src/index.js +0 -1
- package/src/migrations/update-16-0-0-add-nx-packages/update-16-0-0-add-nx-packages.js +3 -7
- package/src/plugins/generate-package-json-plugin.js +1 -3
- package/src/plugins/plugin.js +81 -90
- package/src/utils/config.js +7 -11
- package/src/utils/create-compiler.js +21 -25
- package/src/utils/generator-utils.js +55 -66
- package/src/utils/get-copy-patterns.js +1 -3
- package/src/utils/jest-utils.js +0 -1
- package/src/utils/mode-utils.js +0 -1
- package/src/utils/model.js +0 -1
- package/src/utils/module-federation/build-static.remotes.js +57 -61
- package/src/utils/module-federation/dependencies.js +1 -3
- package/src/utils/module-federation/get-remotes-for-host.js +4 -8
- package/src/utils/module-federation/index.js +0 -1
- package/src/utils/module-federation/models/index.js +0 -1
- package/src/utils/module-federation/package-json.js +0 -1
- package/src/utils/module-federation/parse-static-remotes-config.js +2 -3
- package/src/utils/module-federation/plugins/runtime-library-control.plugin.js +1 -2
- package/src/utils/module-federation/public-api.js +0 -1
- package/src/utils/module-federation/remotes.js +0 -1
- package/src/utils/module-federation/secondary-entry-points.js +4 -5
- package/src/utils/module-federation/share.js +22 -19
- package/src/utils/module-federation/start-remote-proxies.js +0 -1
- package/src/utils/module-federation/start-ssr-remote-proxies.js +0 -1
- package/src/utils/module-federation/typescript.js +6 -6
- package/src/utils/module-federation/with-module-federation/package-json.js +0 -1
- package/src/utils/module-federation/with-module-federation/utils.js +41 -43
- package/src/utils/module-federation/with-module-federation/with-module-federation-ssr.js +48 -35
- package/src/utils/module-federation/with-module-federation/with-module-federation.js +56 -38
- package/src/utils/normalize-assets.js +5 -3
- package/src/utils/read-rspack-options.js +23 -27
- package/src/utils/resolve-user-defined-rspack-config.js +0 -1
- package/src/utils/versions.js +0 -1
- package/src/utils/with-nx.js +30 -13
- package/src/utils/with-react.js +11 -5
- package/src/utils/with-web.js +20 -11
- package/module-federation.js.map +0 -1
- package/plugin.js.map +0 -1
- package/src/executors/dev-server/dev-server.impl.js.map +0 -1
- package/src/executors/dev-server/lib/get-dev-server-config.js.map +0 -1
- package/src/executors/dev-server/lib/serve-path.js.map +0 -1
- package/src/executors/module-federation-dev-server/module-federation-dev-server.impl.js.map +0 -1
- package/src/executors/module-federation-ssr-dev-server/module-federation-ssr-dev-server.impl.js.map +0 -1
- package/src/executors/module-federation-static-server/module-federation-static-server.impl.js.map +0 -1
- package/src/executors/rspack/rspack.impl.js.map +0 -1
- package/src/executors/ssr-dev-server/lib/wait-until-server-is-listening.js.map +0 -1
- package/src/executors/ssr-dev-server/ssr-dev-server.impl.js.map +0 -1
- package/src/generators/application/application.js.map +0 -1
- package/src/generators/application/lib/create-ts-config.js.map +0 -1
- package/src/generators/application/lib/normalize-options.js.map +0 -1
- package/src/generators/configuration/configuration.js.map +0 -1
- package/src/generators/init/init.js.map +0 -1
- package/src/generators/preset/preset.js.map +0 -1
- package/src/index.js.map +0 -1
- package/src/migrations/update-16-0-0-add-nx-packages/update-16-0-0-add-nx-packages.js.map +0 -1
- package/src/plugins/generate-package-json-plugin.js.map +0 -1
- package/src/plugins/plugin.js.map +0 -1
- package/src/utils/config.js.map +0 -1
- package/src/utils/create-compiler.js.map +0 -1
- package/src/utils/generator-utils.js.map +0 -1
- package/src/utils/get-copy-patterns.js.map +0 -1
- package/src/utils/jest-utils.js.map +0 -1
- package/src/utils/mode-utils.js.map +0 -1
- package/src/utils/model.js.map +0 -1
- package/src/utils/module-federation/build-static.remotes.js.map +0 -1
- package/src/utils/module-federation/dependencies.js.map +0 -1
- package/src/utils/module-federation/get-remotes-for-host.js.map +0 -1
- package/src/utils/module-federation/index.js.map +0 -1
- package/src/utils/module-federation/models/index.js.map +0 -1
- package/src/utils/module-federation/package-json.js.map +0 -1
- package/src/utils/module-federation/parse-static-remotes-config.js.map +0 -1
- package/src/utils/module-federation/plugins/runtime-library-control.plugin.js.map +0 -1
- package/src/utils/module-federation/public-api.js.map +0 -1
- package/src/utils/module-federation/remotes.js.map +0 -1
- package/src/utils/module-federation/secondary-entry-points.js.map +0 -1
- package/src/utils/module-federation/share.js.map +0 -1
- package/src/utils/module-federation/start-remote-proxies.js.map +0 -1
- package/src/utils/module-federation/start-ssr-remote-proxies.js.map +0 -1
- package/src/utils/module-federation/typescript.js.map +0 -1
- package/src/utils/module-federation/with-module-federation/package-json.js.map +0 -1
- package/src/utils/module-federation/with-module-federation/utils.js.map +0 -1
- package/src/utils/module-federation/with-module-federation/with-module-federation-ssr.js.map +0 -1
- package/src/utils/module-federation/with-module-federation/with-module-federation.js.map +0 -1
- package/src/utils/normalize-assets.js.map +0 -1
- package/src/utils/read-rspack-options.js.map +0 -1
- package/src/utils/resolve-user-defined-rspack-config.js.map +0 -1
- package/src/utils/versions.js.map +0 -1
- package/src/utils/with-nx.js.map +0 -1
- package/src/utils/with-react.js.map +0 -1
- package/src/utils/with-web.js.map +0 -1
|
@@ -9,26 +9,53 @@ const fs_1 = require("fs");
|
|
|
9
9
|
const path = tslib_1.__importStar(require("path"));
|
|
10
10
|
const create_compiler_1 = require("../../utils/create-compiler");
|
|
11
11
|
const mode_utils_1 = require("../../utils/mode-utils");
|
|
12
|
-
function runExecutor(options, context) {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
12
|
+
async function* runExecutor(options, context) {
|
|
13
|
+
process.env.NODE_ENV ??= options.mode ?? 'production';
|
|
14
|
+
if ((0, mode_utils_1.isMode)(process.env.NODE_ENV)) {
|
|
15
|
+
options.mode = process.env.NODE_ENV;
|
|
16
|
+
}
|
|
17
|
+
if (options.typeCheck) {
|
|
18
|
+
await executeTypeCheck(options, context);
|
|
19
|
+
}
|
|
20
|
+
// Mimic --clean from webpack.
|
|
21
|
+
(0, fs_1.rmSync)(path.join(context.root, options.outputPath), {
|
|
22
|
+
force: true,
|
|
23
|
+
recursive: true,
|
|
24
|
+
});
|
|
25
|
+
const compiler = await (0, create_compiler_1.createCompiler)(options, context);
|
|
26
|
+
const iterable = (0, async_iterable_1.createAsyncIterable)(async ({ next, done }) => {
|
|
27
|
+
if (options.watch) {
|
|
28
|
+
const watcher = compiler.watch({}, async (err, stats) => {
|
|
29
|
+
if (err) {
|
|
30
|
+
devkit_1.logger.error(err);
|
|
31
|
+
next({ success: false });
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
if (!compiler || !stats) {
|
|
35
|
+
devkit_1.logger.error(new Error('Compiler or stats not available'));
|
|
36
|
+
next({ success: false });
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
const statsOptions = getStatsOptions(compiler);
|
|
40
|
+
const printedStats = stats.toString(statsOptions);
|
|
41
|
+
// Avoid extra empty line when `stats: 'none'`
|
|
42
|
+
if (printedStats) {
|
|
43
|
+
console.error(printedStats);
|
|
44
|
+
}
|
|
45
|
+
next({
|
|
46
|
+
success: !stats.hasErrors(),
|
|
47
|
+
outfile: path.resolve(context.root, options.outputPath, 'main.js'),
|
|
48
|
+
});
|
|
49
|
+
});
|
|
50
|
+
registerCleanupCallback(() => {
|
|
51
|
+
watcher.close(() => {
|
|
52
|
+
devkit_1.logger.info('Watcher closed');
|
|
53
|
+
});
|
|
54
|
+
});
|
|
22
55
|
}
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
recursive: true,
|
|
27
|
-
});
|
|
28
|
-
const compiler = yield tslib_1.__await((0, create_compiler_1.createCompiler)(options, context));
|
|
29
|
-
const iterable = (0, async_iterable_1.createAsyncIterable)((_a) => tslib_1.__awaiter(this, [_a], void 0, function* ({ next, done }) {
|
|
30
|
-
if (options.watch) {
|
|
31
|
-
const watcher = compiler.watch({}, (err, stats) => tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
56
|
+
else {
|
|
57
|
+
compiler.run(async (err, stats) => {
|
|
58
|
+
compiler.close(() => {
|
|
32
59
|
if (err) {
|
|
33
60
|
devkit_1.logger.error(err);
|
|
34
61
|
next({ success: false });
|
|
@@ -49,43 +76,12 @@ function runExecutor(options, context) {
|
|
|
49
76
|
success: !stats.hasErrors(),
|
|
50
77
|
outfile: path.resolve(context.root, options.outputPath, 'main.js'),
|
|
51
78
|
});
|
|
52
|
-
|
|
53
|
-
registerCleanupCallback(() => {
|
|
54
|
-
watcher.close(() => {
|
|
55
|
-
devkit_1.logger.info('Watcher closed');
|
|
56
|
-
});
|
|
79
|
+
done();
|
|
57
80
|
});
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
compiler.run((err, stats) => tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
61
|
-
compiler.close(() => {
|
|
62
|
-
if (err) {
|
|
63
|
-
devkit_1.logger.error(err);
|
|
64
|
-
next({ success: false });
|
|
65
|
-
return;
|
|
66
|
-
}
|
|
67
|
-
if (!compiler || !stats) {
|
|
68
|
-
devkit_1.logger.error(new Error('Compiler or stats not available'));
|
|
69
|
-
next({ success: false });
|
|
70
|
-
return;
|
|
71
|
-
}
|
|
72
|
-
const statsOptions = getStatsOptions(compiler);
|
|
73
|
-
const printedStats = stats.toString(statsOptions);
|
|
74
|
-
// Avoid extra empty line when `stats: 'none'`
|
|
75
|
-
if (printedStats) {
|
|
76
|
-
console.error(printedStats);
|
|
77
|
-
}
|
|
78
|
-
next({
|
|
79
|
-
success: !stats.hasErrors(),
|
|
80
|
-
outfile: path.resolve(context.root, options.outputPath, 'main.js'),
|
|
81
|
-
});
|
|
82
|
-
done();
|
|
83
|
-
});
|
|
84
|
-
}));
|
|
85
|
-
}
|
|
86
|
-
}));
|
|
87
|
-
yield tslib_1.__await(yield* tslib_1.__asyncDelegator(tslib_1.__asyncValues(iterable)));
|
|
81
|
+
});
|
|
82
|
+
}
|
|
88
83
|
});
|
|
84
|
+
yield* iterable;
|
|
89
85
|
}
|
|
90
86
|
// copied from packages/esbuild/src/executors/esbuild/esbuild.impl.ts
|
|
91
87
|
function registerCleanupCallback(callback) {
|
|
@@ -99,19 +95,17 @@ function registerCleanupCallback(callback) {
|
|
|
99
95
|
process.on('SIGTERM', wrapped);
|
|
100
96
|
process.on('exit', wrapped);
|
|
101
97
|
}
|
|
102
|
-
function executeTypeCheck(options, context) {
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
mode: 'noEmit',
|
|
109
|
-
});
|
|
110
|
-
yield (0, js_1.printDiagnostics)(result.errors, result.warnings);
|
|
111
|
-
if (result.errors.length > 0) {
|
|
112
|
-
throw new Error('Found type errors. See above.');
|
|
113
|
-
}
|
|
98
|
+
async function executeTypeCheck(options, context) {
|
|
99
|
+
const projectConfiguration = context.projectGraph.nodes[context.projectName].data;
|
|
100
|
+
const result = await (0, js_1.runTypeCheck)({
|
|
101
|
+
workspaceRoot: path.resolve(projectConfiguration.root),
|
|
102
|
+
tsConfigPath: options.tsConfig,
|
|
103
|
+
mode: 'noEmit',
|
|
114
104
|
});
|
|
105
|
+
await (0, js_1.printDiagnostics)(result.errors, result.warnings);
|
|
106
|
+
if (result.errors.length > 0) {
|
|
107
|
+
throw new Error('Found type errors. See above.');
|
|
108
|
+
}
|
|
115
109
|
}
|
|
116
110
|
function getStatsOptions(compiler) {
|
|
117
111
|
return (0, create_compiler_1.isMultiCompiler)(compiler)
|
|
@@ -122,4 +116,3 @@ function getStatsOptions(compiler) {
|
|
|
122
116
|
? compiler.options.stats
|
|
123
117
|
: undefined;
|
|
124
118
|
}
|
|
125
|
-
//# sourceMappingURL=rspack.impl.js.map
|
|
@@ -2,16 +2,13 @@
|
|
|
2
2
|
"$schema": "http://json-schema.org/schema",
|
|
3
3
|
"version": 2,
|
|
4
4
|
"title": "Rspack build executor",
|
|
5
|
-
"description": "",
|
|
5
|
+
"description": "Run Rspack via an executor for a project.",
|
|
6
6
|
"type": "object",
|
|
7
7
|
"properties": {
|
|
8
8
|
"target": {
|
|
9
9
|
"type": "string",
|
|
10
10
|
"description": "The platform to target (e.g. web, node).",
|
|
11
|
-
"enum": [
|
|
12
|
-
"web",
|
|
13
|
-
"node"
|
|
14
|
-
]
|
|
11
|
+
"enum": ["web", "node"]
|
|
15
12
|
},
|
|
16
13
|
"main": {
|
|
17
14
|
"type": "string",
|
|
@@ -122,34 +119,21 @@
|
|
|
122
119
|
}
|
|
123
120
|
},
|
|
124
121
|
"additionalProperties": false,
|
|
125
|
-
"required": [
|
|
126
|
-
"replace",
|
|
127
|
-
"with"
|
|
128
|
-
]
|
|
122
|
+
"required": ["replace", "with"]
|
|
129
123
|
},
|
|
130
124
|
"default": []
|
|
131
125
|
},
|
|
132
126
|
"mode": {
|
|
133
127
|
"type": "string",
|
|
134
128
|
"description": "Mode to run the build in.",
|
|
135
|
-
"enum": [
|
|
136
|
-
"development",
|
|
137
|
-
"production",
|
|
138
|
-
"none"
|
|
139
|
-
]
|
|
129
|
+
"enum": ["development", "production", "none"]
|
|
140
130
|
},
|
|
141
131
|
"generatePackageJson": {
|
|
142
132
|
"type": "boolean",
|
|
143
133
|
"description": "Generates a `package.json` and pruned lock file with the project's `node_module` dependencies populated for installing in a container. If a `package.json` exists in the project's directory, it will be reused with dependencies populated."
|
|
144
134
|
}
|
|
145
135
|
},
|
|
146
|
-
"required": [
|
|
147
|
-
"target",
|
|
148
|
-
"main",
|
|
149
|
-
"outputPath",
|
|
150
|
-
"tsConfig",
|
|
151
|
-
"rspackConfig"
|
|
152
|
-
],
|
|
136
|
+
"required": ["target", "main", "outputPath", "tsConfig", "rspackConfig"],
|
|
153
137
|
"definitions": {
|
|
154
138
|
"assetPattern": {
|
|
155
139
|
"oneOf": [
|
|
@@ -182,11 +166,7 @@
|
|
|
182
166
|
}
|
|
183
167
|
},
|
|
184
168
|
"additionalProperties": false,
|
|
185
|
-
"required": [
|
|
186
|
-
"glob",
|
|
187
|
-
"input",
|
|
188
|
-
"output"
|
|
189
|
-
]
|
|
169
|
+
"required": ["glob", "input", "output"]
|
|
190
170
|
},
|
|
191
171
|
{
|
|
192
172
|
"type": "string"
|
|
@@ -6,47 +6,33 @@ const devkit_1 = require("@nx/devkit");
|
|
|
6
6
|
const async_iterable_1 = require("@nx/devkit/src/utils/async-iterable");
|
|
7
7
|
const chalk = tslib_1.__importStar(require("chalk"));
|
|
8
8
|
const wait_until_server_is_listening_1 = require("./lib/wait-until-server-is-listening");
|
|
9
|
-
function ssrDevServerExecutor(options, context) {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
_c = combined_1_1.value;
|
|
25
|
-
_f = false;
|
|
26
|
-
const output = _c;
|
|
27
|
-
if (!output.success)
|
|
28
|
-
throw new Error('Could not build application');
|
|
29
|
-
if (((_d = output.options) === null || _d === void 0 ? void 0 : _d.target) === 'node') {
|
|
30
|
-
nodeStarted = true;
|
|
31
|
-
}
|
|
32
|
-
else if (((_e = output.options) === null || _e === void 0 ? void 0 : _e.target) === 'web') {
|
|
33
|
-
browserBuilt = true;
|
|
34
|
-
}
|
|
35
|
-
if (nodeStarted && browserBuilt) {
|
|
36
|
-
yield tslib_1.__await((0, wait_until_server_is_listening_1.waitUntilServerIsListening)(options.port));
|
|
37
|
-
console.log(`[ ${chalk.green('ready')} ] on http://localhost:${options.port}`);
|
|
38
|
-
yield yield tslib_1.__await(Object.assign(Object.assign({}, output), { baseUrl: `http://localhost:${options.port}` }));
|
|
39
|
-
}
|
|
40
|
-
}
|
|
9
|
+
async function* ssrDevServerExecutor(options, context) {
|
|
10
|
+
const browserTarget = (0, devkit_1.parseTargetString)(options.browserTarget, context.projectGraph);
|
|
11
|
+
const serverTarget = (0, devkit_1.parseTargetString)(options.serverTarget, context);
|
|
12
|
+
const browserOptions = (0, devkit_1.readTargetOptions)(browserTarget, context);
|
|
13
|
+
const serverOptions = (0, devkit_1.readTargetOptions)(serverTarget, context);
|
|
14
|
+
const runBrowser = await (0, devkit_1.runExecutor)(browserTarget, { ...browserOptions, ...options.browserTargetOptions }, context);
|
|
15
|
+
const runServer = await (0, devkit_1.runExecutor)(serverTarget, { ...serverOptions, ...options.serverTargetOptions }, context);
|
|
16
|
+
let browserBuilt = false;
|
|
17
|
+
let nodeStarted = false;
|
|
18
|
+
const combined = (0, async_iterable_1.combineAsyncIterables)(runBrowser, runServer);
|
|
19
|
+
for await (const output of combined) {
|
|
20
|
+
if (!output.success)
|
|
21
|
+
throw new Error('Could not build application');
|
|
22
|
+
if (output.options?.target === 'node') {
|
|
23
|
+
nodeStarted = true;
|
|
41
24
|
}
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
try {
|
|
45
|
-
if (!_f && !_a && (_b = combined_1.return)) yield tslib_1.__await(_b.call(combined_1));
|
|
46
|
-
}
|
|
47
|
-
finally { if (e_1) throw e_1.error; }
|
|
25
|
+
else if (output.options?.target === 'web') {
|
|
26
|
+
browserBuilt = true;
|
|
48
27
|
}
|
|
49
|
-
|
|
28
|
+
if (nodeStarted && browserBuilt) {
|
|
29
|
+
await (0, wait_until_server_is_listening_1.waitUntilServerIsListening)(options.port);
|
|
30
|
+
console.log(`[ ${chalk.green('ready')} ] on http://localhost:${options.port}`);
|
|
31
|
+
yield {
|
|
32
|
+
...output,
|
|
33
|
+
baseUrl: `http://localhost:${options.port}`,
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
}
|
|
50
37
|
}
|
|
51
38
|
exports.default = ssrDevServerExecutor;
|
|
52
|
-
//# sourceMappingURL=ssr-dev-server.impl.js.map
|
|
@@ -7,81 +7,84 @@ const package_json_1 = require("nx/package.json");
|
|
|
7
7
|
const configuration_1 = tslib_1.__importDefault(require("../configuration/configuration"));
|
|
8
8
|
const init_1 = tslib_1.__importDefault(require("../init/init"));
|
|
9
9
|
const normalize_options_1 = require("./lib/normalize-options");
|
|
10
|
-
function default_1(tree, _options) {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
addPlugin: false }));
|
|
18
|
-
tasks.push(initTask);
|
|
19
|
-
const options = (0, normalize_options_1.normalizeOptions)(tree, _options);
|
|
20
|
-
(_a = options.style) !== null && _a !== void 0 ? _a : (options.style = 'css');
|
|
21
|
-
if (options.framework === 'nest') {
|
|
22
|
-
const { applicationGenerator: nestAppGenerator } = (0, devkit_1.ensurePackage)('@nx/nest', package_json_1.version);
|
|
23
|
-
const createAppTask = yield nestAppGenerator(tree, Object.assign(Object.assign({}, options), { skipFormat: true, tags: (_b = options.tags) !== null && _b !== void 0 ? _b : '', addPlugin: false }));
|
|
24
|
-
const convertAppTask = yield (0, configuration_1.default)(tree, {
|
|
25
|
-
project: options.name,
|
|
26
|
-
target: 'node',
|
|
27
|
-
newProject: false,
|
|
28
|
-
buildTarget: 'build',
|
|
29
|
-
framework: 'nest',
|
|
30
|
-
});
|
|
31
|
-
tasks.push(createAppTask, convertAppTask);
|
|
32
|
-
}
|
|
33
|
-
else if (options.framework === 'web') {
|
|
34
|
-
const { applicationGenerator: webAppGenerator } = (0, devkit_1.ensurePackage)('@nx/web', package_json_1.version);
|
|
35
|
-
const createAppTask = yield webAppGenerator(tree, {
|
|
36
|
-
bundler: 'webpack',
|
|
37
|
-
name: options.name,
|
|
38
|
-
style: options.style,
|
|
39
|
-
directory: options.directory,
|
|
40
|
-
tags: (_c = options.tags) !== null && _c !== void 0 ? _c : '',
|
|
41
|
-
unitTestRunner: options.unitTestRunner,
|
|
42
|
-
e2eTestRunner: options.e2eTestRunner,
|
|
43
|
-
rootProject: options.rootProject,
|
|
44
|
-
skipFormat: true,
|
|
45
|
-
addPlugin: false,
|
|
46
|
-
});
|
|
47
|
-
const convertAppTask = yield (0, configuration_1.default)(tree, {
|
|
48
|
-
project: options.name,
|
|
49
|
-
target: 'web',
|
|
50
|
-
newProject: false,
|
|
51
|
-
buildTarget: 'build',
|
|
52
|
-
serveTarget: 'serve',
|
|
53
|
-
framework: 'web',
|
|
54
|
-
addPlugin: false,
|
|
55
|
-
});
|
|
56
|
-
tasks.push(createAppTask, convertAppTask);
|
|
57
|
-
}
|
|
58
|
-
else {
|
|
59
|
-
// default to react
|
|
60
|
-
const { applicationGenerator: reactAppGenerator } = (0, devkit_1.ensurePackage)('@nx/react', package_json_1.version);
|
|
61
|
-
const createAppTask = yield reactAppGenerator(tree, {
|
|
62
|
-
bundler: 'webpack',
|
|
63
|
-
name: options.name,
|
|
64
|
-
style: options.style,
|
|
65
|
-
directory: options.directory,
|
|
66
|
-
tags: (_d = options.tags) !== null && _d !== void 0 ? _d : '',
|
|
67
|
-
unitTestRunner: options.unitTestRunner,
|
|
68
|
-
e2eTestRunner: options.e2eTestRunner,
|
|
69
|
-
rootProject: options.rootProject,
|
|
70
|
-
skipFormat: true,
|
|
71
|
-
addPlugin: false,
|
|
72
|
-
});
|
|
73
|
-
const convertAppTask = yield (0, configuration_1.default)(tree, {
|
|
74
|
-
project: options.name,
|
|
75
|
-
target: 'web',
|
|
76
|
-
newProject: false,
|
|
77
|
-
buildTarget: 'build',
|
|
78
|
-
serveTarget: 'serve',
|
|
79
|
-
framework: 'react',
|
|
80
|
-
});
|
|
81
|
-
tasks.push(createAppTask, convertAppTask);
|
|
82
|
-
}
|
|
83
|
-
yield (0, devkit_1.formatFiles)(tree);
|
|
84
|
-
return (0, devkit_1.runTasksInSerial)(...tasks);
|
|
10
|
+
async function default_1(tree, _options) {
|
|
11
|
+
const tasks = [];
|
|
12
|
+
const initTask = await (0, init_1.default)(tree, {
|
|
13
|
+
..._options,
|
|
14
|
+
// TODO: Crystalize the default rspack.config.js file.
|
|
15
|
+
// The default setup isn't crystalized so don't add plugin.
|
|
16
|
+
addPlugin: false,
|
|
85
17
|
});
|
|
18
|
+
tasks.push(initTask);
|
|
19
|
+
const options = (0, normalize_options_1.normalizeOptions)(tree, _options);
|
|
20
|
+
options.style ??= 'css';
|
|
21
|
+
if (options.framework === 'nest') {
|
|
22
|
+
const { applicationGenerator: nestAppGenerator } = (0, devkit_1.ensurePackage)('@nx/nest', package_json_1.version);
|
|
23
|
+
const createAppTask = await nestAppGenerator(tree, {
|
|
24
|
+
...options,
|
|
25
|
+
skipFormat: true,
|
|
26
|
+
tags: options.tags ?? '',
|
|
27
|
+
addPlugin: false,
|
|
28
|
+
});
|
|
29
|
+
const convertAppTask = await (0, configuration_1.default)(tree, {
|
|
30
|
+
project: options.name,
|
|
31
|
+
target: 'node',
|
|
32
|
+
newProject: false,
|
|
33
|
+
buildTarget: 'build',
|
|
34
|
+
framework: 'nest',
|
|
35
|
+
});
|
|
36
|
+
tasks.push(createAppTask, convertAppTask);
|
|
37
|
+
}
|
|
38
|
+
else if (options.framework === 'web') {
|
|
39
|
+
const { applicationGenerator: webAppGenerator } = (0, devkit_1.ensurePackage)('@nx/web', package_json_1.version);
|
|
40
|
+
const createAppTask = await webAppGenerator(tree, {
|
|
41
|
+
bundler: 'webpack',
|
|
42
|
+
name: options.name,
|
|
43
|
+
style: options.style,
|
|
44
|
+
directory: options.directory,
|
|
45
|
+
tags: options.tags ?? '',
|
|
46
|
+
unitTestRunner: options.unitTestRunner,
|
|
47
|
+
e2eTestRunner: options.e2eTestRunner,
|
|
48
|
+
rootProject: options.rootProject,
|
|
49
|
+
skipFormat: true,
|
|
50
|
+
addPlugin: false,
|
|
51
|
+
});
|
|
52
|
+
const convertAppTask = await (0, configuration_1.default)(tree, {
|
|
53
|
+
project: options.name,
|
|
54
|
+
target: 'web',
|
|
55
|
+
newProject: false,
|
|
56
|
+
buildTarget: 'build',
|
|
57
|
+
serveTarget: 'serve',
|
|
58
|
+
framework: 'web',
|
|
59
|
+
addPlugin: false,
|
|
60
|
+
});
|
|
61
|
+
tasks.push(createAppTask, convertAppTask);
|
|
62
|
+
}
|
|
63
|
+
else {
|
|
64
|
+
// default to react
|
|
65
|
+
const { applicationGenerator: reactAppGenerator } = (0, devkit_1.ensurePackage)('@nx/react', package_json_1.version);
|
|
66
|
+
const createAppTask = await reactAppGenerator(tree, {
|
|
67
|
+
bundler: 'webpack',
|
|
68
|
+
name: options.name,
|
|
69
|
+
style: options.style,
|
|
70
|
+
directory: options.directory,
|
|
71
|
+
tags: options.tags ?? '',
|
|
72
|
+
unitTestRunner: options.unitTestRunner,
|
|
73
|
+
e2eTestRunner: options.e2eTestRunner,
|
|
74
|
+
rootProject: options.rootProject,
|
|
75
|
+
skipFormat: true,
|
|
76
|
+
addPlugin: false,
|
|
77
|
+
});
|
|
78
|
+
const convertAppTask = await (0, configuration_1.default)(tree, {
|
|
79
|
+
project: options.name,
|
|
80
|
+
target: 'web',
|
|
81
|
+
newProject: false,
|
|
82
|
+
buildTarget: 'build',
|
|
83
|
+
serveTarget: 'serve',
|
|
84
|
+
framework: 'react',
|
|
85
|
+
});
|
|
86
|
+
tasks.push(createAppTask, convertAppTask);
|
|
87
|
+
}
|
|
88
|
+
await (0, devkit_1.formatFiles)(tree);
|
|
89
|
+
return (0, devkit_1.runTasksInSerial)(...tasks);
|
|
86
90
|
}
|
|
87
|
-
//# sourceMappingURL=application.js.map
|
|
@@ -9,7 +9,7 @@ function editTsConfig(tree, projectRoot, framework, relativePathToRootTsConfig)
|
|
|
9
9
|
try {
|
|
10
10
|
shared = require('@nx/js/src/utils/typescript/create-ts-config');
|
|
11
11
|
}
|
|
12
|
-
catch
|
|
12
|
+
catch {
|
|
13
13
|
shared = require('@nx/workspace/src/utils/create-ts-config');
|
|
14
14
|
}
|
|
15
15
|
if (framework === 'react') {
|
|
@@ -32,7 +32,10 @@ function editTsConfig(tree, projectRoot, framework, relativePathToRootTsConfig)
|
|
|
32
32
|
// inline tsconfig.base.json into the project
|
|
33
33
|
if (projectIsRootProjectInStandaloneWorkspace(projectRoot)) {
|
|
34
34
|
json.compileOnSave = false;
|
|
35
|
-
json.compilerOptions =
|
|
35
|
+
json.compilerOptions = {
|
|
36
|
+
...shared.tsConfigBaseOptions,
|
|
37
|
+
...json.compilerOptions,
|
|
38
|
+
};
|
|
36
39
|
json.exclude = ['node_modules', 'tmp'];
|
|
37
40
|
}
|
|
38
41
|
else {
|
|
@@ -44,4 +47,3 @@ function editTsConfig(tree, projectRoot, framework, relativePathToRootTsConfig)
|
|
|
44
47
|
function projectIsRootProjectInStandaloneWorkspace(projectRoot) {
|
|
45
48
|
return (0, path_1.relative)(devkit_1.workspaceRoot, projectRoot).length === 0;
|
|
46
49
|
}
|
|
47
|
-
//# sourceMappingURL=create-ts-config.js.map
|
|
@@ -14,7 +14,6 @@ function normalizeProjectName(options) {
|
|
|
14
14
|
return normalizeDirectory(options).replace(new RegExp('/', 'g'), '-');
|
|
15
15
|
}
|
|
16
16
|
function normalizeOptions(host, options) {
|
|
17
|
-
var _a, _b;
|
|
18
17
|
// --monorepo takes precedence over --rootProject
|
|
19
18
|
// This won't be needed once we add --bundler=rspack to the @nx/react:app preset
|
|
20
19
|
const rootProject = !options.monorepo && options.rootProject;
|
|
@@ -24,14 +23,20 @@ function normalizeOptions(host, options) {
|
|
|
24
23
|
? 'e2e'
|
|
25
24
|
: `${(0, devkit_1.names)(options.name).fileName}-e2e`;
|
|
26
25
|
const { layoutDirectory } = (0, devkit_1.extractLayoutDirectory)(options.directory);
|
|
27
|
-
const appsDir = layoutDirectory
|
|
26
|
+
const appsDir = layoutDirectory ?? (0, devkit_1.getWorkspaceLayout)(host).appsDir;
|
|
28
27
|
const appProjectRoot = rootProject
|
|
29
28
|
? '.'
|
|
30
29
|
: (0, devkit_1.normalizePath)(`${appsDir}/${appDirectory}`);
|
|
31
|
-
const normalized =
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
30
|
+
const normalized = {
|
|
31
|
+
...options,
|
|
32
|
+
rootProject,
|
|
33
|
+
name: (0, devkit_1.names)(options.name).fileName,
|
|
34
|
+
projectName: appProjectName,
|
|
35
|
+
appProjectRoot,
|
|
36
|
+
e2eProjectName,
|
|
37
|
+
fileName: 'app',
|
|
38
|
+
};
|
|
39
|
+
normalized.unitTestRunner ??= 'jest';
|
|
40
|
+
normalized.e2eTestRunner ??= 'cypress';
|
|
35
41
|
return normalized;
|
|
36
42
|
}
|
|
37
|
-
//# sourceMappingURL=normalize-options.js.map
|