@nx/web 20.0.0-beta.4 → 20.0.0-beta.6
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/migrations.json +1 -14
- package/package.json +3 -4
- package/src/generators/application/application.js +5 -3
- package/src/generators/application/schema.d.ts +2 -4
- package/src/generators/application/schema.json +10 -13
- package/src/generators/init/init.js +2 -0
- package/src/migrations/update-16-0-0-add-nx-packages/update-16-0-0-add-nx-packages.d.ts +0 -2
- package/src/migrations/update-16-0-0-add-nx-packages/update-16-0-0-add-nx-packages.js +0 -9
- package/src/migrations/update-16-0-0-update-executors/update-16-0-0-update-executors.d.ts +0 -2
- package/src/migrations/update-16-0-0-update-executors/update-16-0-0-update-executors.js +0 -34
package/migrations.json
CHANGED
|
@@ -1,18 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"generators": {
|
|
3
|
-
"update-16-0-0-add-nx-packages": {
|
|
4
|
-
"cli": "nx",
|
|
5
|
-
"version": "16.0.0-beta.1",
|
|
6
|
-
"description": "Replace @nrwl/web with @nx/web",
|
|
7
|
-
"implementation": "./src/migrations/update-16-0-0-add-nx-packages/update-16-0-0-add-nx-packages"
|
|
8
|
-
},
|
|
9
|
-
"update-16-0-0-update-executors": {
|
|
10
|
-
"cli": "nx",
|
|
11
|
-
"version": "16.0.0-beta.4",
|
|
12
|
-
"description": "Replace @nrwl/web executors with @nx/webpack and @nx/rollup",
|
|
13
|
-
"implementation": "./src/migrations/update-16-0-0-update-executors/update-16-0-0-update-executors"
|
|
14
|
-
}
|
|
15
|
-
},
|
|
2
|
+
"generators": {},
|
|
16
3
|
"packageJsonUpdates": {
|
|
17
4
|
"17.3.0": {
|
|
18
5
|
"version": "17.3.0-beta.3",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nx/web",
|
|
3
|
-
"version": "20.0.0-beta.
|
|
3
|
+
"version": "20.0.0-beta.6",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "The Nx Plugin for Web Components contains generators for managing Web Component applications and libraries within an Nx workspace. It provides:\n\n\n- Integration with libraries such as Jest, Playwright, Cypress, and Storybook.\n\n- Scaffolding for creating buildable libraries that can be published to npm.\n\n- Utilities for automatic workspace refactoring.",
|
|
6
6
|
"repository": {
|
|
@@ -35,9 +35,8 @@
|
|
|
35
35
|
"http-server": "^14.1.0",
|
|
36
36
|
"picocolors": "^1.1.0",
|
|
37
37
|
"tslib": "^2.3.0",
|
|
38
|
-
"@nx/devkit": "20.0.0-beta.
|
|
39
|
-
"@nx/js": "20.0.0-beta.
|
|
40
|
-
"@nrwl/web": "20.0.0-beta.4"
|
|
38
|
+
"@nx/devkit": "20.0.0-beta.6",
|
|
39
|
+
"@nx/js": "20.0.0-beta.6"
|
|
41
40
|
},
|
|
42
41
|
"publishConfig": {
|
|
43
42
|
"access": "public"
|
|
@@ -15,6 +15,7 @@ const target_defaults_utils_1 = require("@nx/devkit/src/generators/target-defaul
|
|
|
15
15
|
const log_show_project_command_1 = require("@nx/devkit/src/utils/log-show-project-command");
|
|
16
16
|
const static_serve_configuration_1 = require("../static-serve/static-serve-configuration");
|
|
17
17
|
const find_plugin_for_config_file_1 = require("@nx/devkit/src/utils/find-plugin-for-config-file");
|
|
18
|
+
const ts_solution_setup_1 = require("@nx/js/src/utils/typescript/ts-solution-setup");
|
|
18
19
|
function createApplicationFiles(tree, options) {
|
|
19
20
|
if (options.bundler === 'vite') {
|
|
20
21
|
(0, devkit_1.generateFiles)(tree, (0, path_1.join)(__dirname, './files/app-vite'), options.appProjectRoot, {
|
|
@@ -160,6 +161,7 @@ async function applicationGenerator(host, schema) {
|
|
|
160
161
|
});
|
|
161
162
|
}
|
|
162
163
|
async function applicationGeneratorInternal(host, schema) {
|
|
164
|
+
(0, ts_solution_setup_1.assertNotUsingTsSolutionSetup)(host, 'web', 'application');
|
|
163
165
|
const options = await normalizeOptions(host, schema);
|
|
164
166
|
const tasks = [];
|
|
165
167
|
const jsInitTask = await (0, js_1.initGenerator)(host, {
|
|
@@ -210,6 +212,7 @@ async function applicationGeneratorInternal(host, schema) {
|
|
|
210
212
|
inSourceTests: options.inSourceTests,
|
|
211
213
|
skipFormat: true,
|
|
212
214
|
addPlugin: options.addPlugin,
|
|
215
|
+
compiler: options.compiler,
|
|
213
216
|
});
|
|
214
217
|
tasks.push(vitestTask);
|
|
215
218
|
createOrEditViteConfig(host, {
|
|
@@ -389,13 +392,12 @@ async function applicationGeneratorInternal(host, schema) {
|
|
|
389
392
|
return (0, devkit_1.runTasksInSerial)(...tasks);
|
|
390
393
|
}
|
|
391
394
|
async function normalizeOptions(host, options) {
|
|
392
|
-
|
|
395
|
+
await (0, project_name_and_root_utils_1.ensureProjectName)(host, options, 'application');
|
|
396
|
+
const { projectName: appProjectName, projectRoot: appProjectRoot } = await (0, project_name_and_root_utils_1.determineProjectNameAndRootOptions)(host, {
|
|
393
397
|
name: options.name,
|
|
394
398
|
projectType: 'application',
|
|
395
399
|
directory: options.directory,
|
|
396
|
-
projectNameAndRootFormat: options.projectNameAndRootFormat,
|
|
397
400
|
});
|
|
398
|
-
options.projectNameAndRootFormat = projectNameAndRootFormat;
|
|
399
401
|
const nxJson = (0, devkit_1.readNxJson)(host);
|
|
400
402
|
const addPluginDefault = process.env.NX_ADD_PLUGINS !== 'false' &&
|
|
401
403
|
nxJson.useInferencePlugins !== false;
|
|
@@ -1,15 +1,13 @@
|
|
|
1
|
-
import type { ProjectNameAndRootFormat } from '@nx/devkit/src/generators/project-name-and-root-utils';
|
|
2
1
|
import type { Linter, LinterType } from '@nx/eslint';
|
|
3
2
|
|
|
4
3
|
export interface Schema {
|
|
5
|
-
|
|
4
|
+
directory: string;
|
|
5
|
+
name?: string;
|
|
6
6
|
prefix?: string;
|
|
7
7
|
style?: string;
|
|
8
8
|
bundler?: 'webpack' | 'none' | 'vite';
|
|
9
9
|
compiler?: 'babel' | 'swc';
|
|
10
10
|
skipFormat?: boolean;
|
|
11
|
-
directory?: string;
|
|
12
|
-
projectNameAndRootFormat?: ProjectNameAndRootFormat;
|
|
13
11
|
tags?: string;
|
|
14
12
|
unitTestRunner?: 'jest' | 'vitest' | 'none';
|
|
15
13
|
inSourceTests?: boolean;
|
|
@@ -6,24 +6,20 @@
|
|
|
6
6
|
"description": "Create a web application using `swc` or `babel` as compiler.",
|
|
7
7
|
"type": "object",
|
|
8
8
|
"properties": {
|
|
9
|
-
"
|
|
10
|
-
"description": "The
|
|
9
|
+
"directory": {
|
|
10
|
+
"description": "The directory of the new application.",
|
|
11
11
|
"type": "string",
|
|
12
12
|
"$default": {
|
|
13
13
|
"$source": "argv",
|
|
14
14
|
"index": 0
|
|
15
15
|
},
|
|
16
|
-
"x-prompt": "
|
|
17
|
-
"pattern": "^[a-zA-Z][^:]*$"
|
|
18
|
-
},
|
|
19
|
-
"directory": {
|
|
20
|
-
"description": "The directory of the new application.",
|
|
21
|
-
"type": "string"
|
|
16
|
+
"x-prompt": "Which directory do you want to create the application in?"
|
|
22
17
|
},
|
|
23
|
-
"
|
|
24
|
-
"description": "
|
|
18
|
+
"name": {
|
|
19
|
+
"description": "The name of the application.",
|
|
25
20
|
"type": "string",
|
|
26
|
-
"
|
|
21
|
+
"pattern": "^[a-zA-Z][^:]*$",
|
|
22
|
+
"x-priority": "important"
|
|
27
23
|
},
|
|
28
24
|
"style": {
|
|
29
25
|
"description": "The file extension to be used for style files.",
|
|
@@ -77,7 +73,8 @@
|
|
|
77
73
|
},
|
|
78
74
|
"unitTestRunner": {
|
|
79
75
|
"type": "string",
|
|
80
|
-
"enum": ["
|
|
76
|
+
"enum": ["vitest", "jest", "none"],
|
|
77
|
+
"default": "vitest",
|
|
81
78
|
"description": "Test runner to use for unit tests. Default value is 'jest' when using 'webpack' or 'none' as the bundler and 'vitest' when using 'vite' as the bundler"
|
|
82
79
|
},
|
|
83
80
|
"inSourceTests": {
|
|
@@ -113,6 +110,6 @@
|
|
|
113
110
|
"x-deprecated": "Nx only supports standaloneConfig"
|
|
114
111
|
}
|
|
115
112
|
},
|
|
116
|
-
"required": ["
|
|
113
|
+
"required": ["directory"],
|
|
117
114
|
"examplesFile": "../../../docs/application-examples.md"
|
|
118
115
|
}
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.webInitGenerator = webInitGenerator;
|
|
4
4
|
const devkit_1 = require("@nx/devkit");
|
|
5
|
+
const ts_solution_setup_1 = require("@nx/js/src/utils/typescript/ts-solution-setup");
|
|
5
6
|
const versions_1 = require("../../utils/versions");
|
|
6
7
|
function updateDependencies(tree, schema) {
|
|
7
8
|
const tasks = [];
|
|
@@ -10,6 +11,7 @@ function updateDependencies(tree, schema) {
|
|
|
10
11
|
return (0, devkit_1.runTasksInSerial)(...tasks);
|
|
11
12
|
}
|
|
12
13
|
async function webInitGenerator(tree, schema) {
|
|
14
|
+
(0, ts_solution_setup_1.assertNotUsingTsSolutionSetup)(tree, 'web', 'init');
|
|
13
15
|
let installTask = () => { };
|
|
14
16
|
if (!schema.skipPackageJson) {
|
|
15
17
|
installTask = updateDependencies(tree, schema);
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.default = replacePackage;
|
|
4
|
-
const devkit_1 = require("@nx/devkit");
|
|
5
|
-
const replace_package_1 = require("@nx/devkit/src/utils/replace-package");
|
|
6
|
-
async function replacePackage(tree) {
|
|
7
|
-
await (0, replace_package_1.replaceNrwlPackageWithNxPackage)(tree, '@nrwl/web', '@nx/web');
|
|
8
|
-
await (0, devkit_1.formatFiles)(tree);
|
|
9
|
-
}
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.default = update;
|
|
4
|
-
const devkit_1 = require("@nx/devkit");
|
|
5
|
-
const versions_1 = require("../../utils/versions");
|
|
6
|
-
async function update(host) {
|
|
7
|
-
const projects = (0, devkit_1.getProjects)(host);
|
|
8
|
-
const deps = {};
|
|
9
|
-
for (const [name, config] of projects.entries()) {
|
|
10
|
-
let updated = false;
|
|
11
|
-
// webpack
|
|
12
|
-
if (config?.targets?.build?.executor === '@nrwl/web:webpack') {
|
|
13
|
-
config.targets.build.executor = '@nx/webpack:webpack';
|
|
14
|
-
deps['@nx/webpack'] = versions_1.nxVersion;
|
|
15
|
-
updated = true;
|
|
16
|
-
}
|
|
17
|
-
if (config?.targets?.serve?.executor === '@nrwl/web:dev-server') {
|
|
18
|
-
config.targets.serve.executor = '@nx/webpack:dev-server';
|
|
19
|
-
deps['@nx/webpack'] = versions_1.nxVersion;
|
|
20
|
-
updated = true;
|
|
21
|
-
}
|
|
22
|
-
// rollup
|
|
23
|
-
if (config?.targets?.build?.executor === '@nrwl/web:rollup') {
|
|
24
|
-
config.targets.build.executor = '@nx/rollup:rollup';
|
|
25
|
-
deps['@nx/rollup'] = versions_1.nxVersion;
|
|
26
|
-
updated = true;
|
|
27
|
-
}
|
|
28
|
-
if (updated) {
|
|
29
|
-
(0, devkit_1.updateProjectConfiguration)(host, name, config);
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
await (0, devkit_1.formatFiles)(host);
|
|
33
|
-
return (0, devkit_1.addDependenciesToPackageJson)(host, {}, deps);
|
|
34
|
-
}
|