@nx/angular 18.1.0-beta.1 → 18.1.0-beta.10
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 +12 -2
- package/package.json +12 -14
- package/src/executors/module-federation-dev-server/module-federation-dev-server.impl.js +4 -2
- package/src/executors/module-federation-dev-server/schema.json +1 -1
- package/src/generators/add-linting/add-linting.d.ts +1 -1
- package/src/generators/add-linting/add-linting.js +6 -11
- package/src/generators/add-linting/lib/add-angular-eslint-dependencies.d.ts +2 -2
- package/src/generators/add-linting/lib/add-angular-eslint-dependencies.js +9 -5
- package/src/generators/add-linting/lib/buildable-project.d.ts +2 -0
- package/src/generators/add-linting/lib/buildable-project.js +9 -0
- package/src/generators/application/files/base/tsconfig.json__tpl__ +3 -0
- package/src/generators/application/lib/add-e2e.js +7 -5
- package/src/generators/application/lib/create-files.js +9 -10
- package/src/generators/application/lib/normalize-options.js +1 -4
- package/src/generators/application/lib/update-editor-tsconfig.d.ts +1 -1
- package/src/generators/application/lib/update-editor-tsconfig.js +11 -14
- package/src/generators/application/schema.json +1 -0
- package/src/generators/component/lib/normalize-options.js +2 -2
- package/src/generators/component-test/component-test.js +4 -2
- package/src/generators/cypress-component-configuration/cypress-component-configuration.js +14 -8
- package/src/generators/directive/lib/normalize-options.js +2 -1
- package/src/generators/library/lib/add-project.js +23 -24
- package/src/generators/library/lib/normalize-options.js +1 -5
- package/src/generators/library/lib/update-tsconfig.js +3 -3
- package/src/generators/ng-add/migrators/projects/e2e.migrator.js +30 -23
- package/src/generators/ng-add/utilities/workspace.js +1 -3
- package/src/generators/setup-mf/lib/add-cypress-workaround.js +14 -6
- package/src/generators/setup-mf/lib/normalize-options.js +1 -1
- package/src/generators/storybook-configuration/lib/generate-stories.js +4 -2
- package/src/generators/storybook-configuration/storybook-configuration.js +5 -0
- package/src/generators/utils/add-jest.js +2 -2
- package/src/generators/utils/add-mf-env-to-inputs.js +4 -1
- package/src/generators/utils/project.d.ts +0 -1
- package/src/generators/utils/project.js +2 -29
- package/src/generators/utils/selector.d.ts +2 -2
- package/src/generators/utils/selector.js +11 -4
- package/src/generators/utils/update-app-editor-tsconfig-excluded-files.d.ts +2 -0
- package/src/generators/utils/update-app-editor-tsconfig-excluded-files.js +23 -0
- package/src/generators/utils/update-project-root-tsconfig.d.ts +3 -0
- package/src/generators/utils/update-project-root-tsconfig.js +26 -0
- package/src/migrations/update-18-1-1/fix-target-defaults-inputs.d.ts +2 -0
- package/src/migrations/update-18-1-1/fix-target-defaults-inputs.js +53 -0
- package/src/utils/mf/with-module-federation-ssr.js +3 -0
- package/src/utils/mf/with-module-federation.js +3 -0
- package/src/utils/versions.d.ts +1 -1
- package/src/utils/versions.js +1 -1
- package/src/generators/utils/create-ts-config.d.ts +0 -9
- package/src/generators/utils/create-ts-config.js +0 -34
package/migrations.json
CHANGED
|
@@ -371,6 +371,12 @@
|
|
|
371
371
|
},
|
|
372
372
|
"description": "Update the @angular/cli package version to ~17.2.0.",
|
|
373
373
|
"factory": "./src/migrations/update-18-1-0/update-angular-cli"
|
|
374
|
+
},
|
|
375
|
+
"fix-target-defaults-for-webpack-browser": {
|
|
376
|
+
"cli": "nx",
|
|
377
|
+
"version": "18.1.1-beta.0",
|
|
378
|
+
"description": "Ensure targetDefaults inputs for task hashing when '@nx/angular:webpack-browser' is used are correct for Module Federation.",
|
|
379
|
+
"factory": "./src/migrations/update-18-1-1/fix-target-defaults-inputs"
|
|
374
380
|
}
|
|
375
381
|
},
|
|
376
382
|
"packageJsonUpdates": {
|
|
@@ -1641,7 +1647,7 @@
|
|
|
1641
1647
|
}
|
|
1642
1648
|
},
|
|
1643
1649
|
"18.1.0-jest": {
|
|
1644
|
-
"version": "18.1.0-beta.
|
|
1650
|
+
"version": "18.1.0-beta.2",
|
|
1645
1651
|
"requires": {
|
|
1646
1652
|
"@angular-devkit/build-angular": ">=15.0.0 <18.0.0",
|
|
1647
1653
|
"@angular/compiler-cli": ">=15.0.0 <18.0.0",
|
|
@@ -1651,13 +1657,17 @@
|
|
|
1651
1657
|
},
|
|
1652
1658
|
"packages": {
|
|
1653
1659
|
"jest-preset-angular": {
|
|
1654
|
-
"version": "~14.0.
|
|
1660
|
+
"version": "~14.0.3",
|
|
1655
1661
|
"alwaysAddToPackageJson": false
|
|
1656
1662
|
}
|
|
1657
1663
|
}
|
|
1658
1664
|
},
|
|
1659
1665
|
"18.1.0": {
|
|
1660
1666
|
"version": "18.1.0-beta.1",
|
|
1667
|
+
"x-prompt": "Do you want to update the Angular version to v17.2?",
|
|
1668
|
+
"requires": {
|
|
1669
|
+
"@angular/core": ">=17.1.0 <17.2.0"
|
|
1670
|
+
},
|
|
1661
1671
|
"packages": {
|
|
1662
1672
|
"@angular-devkit/build-angular": {
|
|
1663
1673
|
"version": "~17.2.0",
|
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nx/angular",
|
|
3
|
-
"version": "18.1.0-beta.
|
|
3
|
+
"version": "18.1.0-beta.10",
|
|
4
4
|
"private": false,
|
|
5
|
-
"description": "The Nx Plugin for Angular contains executors, generators, and utilities for managing Angular applications and libraries within an Nx workspace. It provides: \n\n- Integration with libraries such as Storybook, Jest, ESLint, Tailwind CSS, and Cypress. \n\n- Generators to help scaffold code quickly (like: Micro Frontends, Libraries, both internal to your codebase and publishable to npm) \n\n-
|
|
5
|
+
"description": "The Nx Plugin for Angular contains executors, generators, and utilities for managing Angular applications and libraries within an Nx workspace. It provides: \n\n- Integration with libraries such as Storybook, Jest, ESLint, Tailwind CSS, and Cypress. \n\n- Generators to help scaffold code quickly (like: Micro Frontends, Libraries, both internal to your codebase and publishable to npm) \n\n- Single Component Application Modules (SCAMs) \n\n- NgRx helpers. \n\n- Utilities for automatic workspace refactoring.",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
8
8
|
"url": "https://github.com/nrwl/nx.git",
|
|
@@ -78,24 +78,22 @@
|
|
|
78
78
|
"tslib": "^2.3.0",
|
|
79
79
|
"webpack": "^5.80.0",
|
|
80
80
|
"webpack-merge": "^5.8.0",
|
|
81
|
-
"@nx/devkit": "18.1.0-beta.
|
|
82
|
-
"@nx/
|
|
83
|
-
"@nx/
|
|
84
|
-
"@nx/
|
|
85
|
-
"@nx/
|
|
86
|
-
"@nx/
|
|
87
|
-
"@nx/web": "18.1.0-beta.1",
|
|
88
|
-
"@nx/workspace": "18.1.0-beta.1",
|
|
81
|
+
"@nx/devkit": "18.1.0-beta.10",
|
|
82
|
+
"@nx/js": "18.1.0-beta.10",
|
|
83
|
+
"@nx/eslint": "18.1.0-beta.10",
|
|
84
|
+
"@nx/webpack": "18.1.0-beta.10",
|
|
85
|
+
"@nx/web": "18.1.0-beta.10",
|
|
86
|
+
"@nx/workspace": "18.1.0-beta.10",
|
|
89
87
|
"piscina": "^4.2.1",
|
|
90
|
-
"@nrwl/angular": "18.1.0-beta.
|
|
88
|
+
"@nrwl/angular": "18.1.0-beta.10"
|
|
91
89
|
},
|
|
92
90
|
"peerDependencies": {
|
|
93
91
|
"@angular-devkit/build-angular": ">= 15.0.0 < 18.0.0",
|
|
92
|
+
"@angular-devkit/core": ">= 15.0.0 < 18.0.0",
|
|
94
93
|
"@angular-devkit/schematics": ">= 15.0.0 < 18.0.0",
|
|
95
94
|
"@schematics/angular": ">= 15.0.0 < 18.0.0",
|
|
96
|
-
"
|
|
97
|
-
"rxjs": "^6.5.3 || ^7.5.0"
|
|
98
|
-
"esbuild": "^0.19.2"
|
|
95
|
+
"esbuild": "^0.19.2",
|
|
96
|
+
"rxjs": "^6.5.3 || ^7.5.0"
|
|
99
97
|
},
|
|
100
98
|
"peerDependenciesMeta": {
|
|
101
99
|
"esbuild": {
|
|
@@ -101,8 +101,10 @@ async function* moduleFederationDevServerExecutor(schema, context) {
|
|
|
101
101
|
devkit_1.logger.info(`NX All remotes started, server ready at http://localhost:${options.port}`);
|
|
102
102
|
next({ success: true, baseUrl: `http://localhost:${options.port}` });
|
|
103
103
|
}
|
|
104
|
-
catch {
|
|
105
|
-
throw new Error(`
|
|
104
|
+
catch (err) {
|
|
105
|
+
throw new Error(`Failed to start remotes. Check above for any errors.`, {
|
|
106
|
+
cause: err,
|
|
107
|
+
});
|
|
106
108
|
}
|
|
107
109
|
finally {
|
|
108
110
|
done();
|
|
@@ -122,7 +122,7 @@
|
|
|
122
122
|
"items": {
|
|
123
123
|
"type": "string"
|
|
124
124
|
},
|
|
125
|
-
"description": "List of remote applications to not automatically serve, either statically or in development mode."
|
|
125
|
+
"description": "List of remote applications to not automatically serve, either statically or in development mode. This will not remove the remotes from the `module-federation.config` file, and therefore the application may still try to fetch these remotes.\nThis option is useful for when the `host` application is using a `remote` that does not live in the same workspace as the `host`."
|
|
126
126
|
},
|
|
127
127
|
"pathToManifestFile": {
|
|
128
128
|
"type": "string",
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { GeneratorCallback, Tree } from '@nx/devkit';
|
|
1
|
+
import { type GeneratorCallback, type Tree } from '@nx/devkit';
|
|
2
2
|
import type { AddLintingGeneratorSchema } from './schema';
|
|
3
3
|
export declare function addLintingGenerator(tree: Tree, options: AddLintingGeneratorSchema): Promise<GeneratorCallback>;
|
|
4
4
|
export default addLintingGenerator;
|
|
@@ -2,11 +2,12 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.addLintingGenerator = void 0;
|
|
4
4
|
const devkit_1 = require("@nx/devkit");
|
|
5
|
-
const eslint_1 = require("@nx/eslint");
|
|
6
|
-
const add_angular_eslint_dependencies_1 = require("./lib/add-angular-eslint-dependencies");
|
|
7
|
-
const eslint_file_1 = require("@nx/eslint/src/generators/utils/eslint-file");
|
|
8
5
|
const string_utils_1 = require("@nx/devkit/src/utils/string-utils");
|
|
6
|
+
const eslint_1 = require("@nx/eslint");
|
|
9
7
|
const global_eslint_config_1 = require("@nx/eslint/src/generators/init/global-eslint-config");
|
|
8
|
+
const eslint_file_1 = require("@nx/eslint/src/generators/utils/eslint-file");
|
|
9
|
+
const add_angular_eslint_dependencies_1 = require("./lib/add-angular-eslint-dependencies");
|
|
10
|
+
const buildable_project_1 = require("./lib/buildable-project");
|
|
10
11
|
async function addLintingGenerator(tree, options) {
|
|
11
12
|
const tasks = [];
|
|
12
13
|
const rootProject = options.projectRoot === '.' || options.projectRoot === '';
|
|
@@ -73,7 +74,7 @@ async function addLintingGenerator(tree, options) {
|
|
|
73
74
|
*/
|
|
74
75
|
rules: {},
|
|
75
76
|
},
|
|
76
|
-
...(isBuildableLibraryProject(tree, options.projectName)
|
|
77
|
+
...((0, buildable_project_1.isBuildableLibraryProject)(tree, options.projectName)
|
|
77
78
|
? [
|
|
78
79
|
{
|
|
79
80
|
files: ['*.json'],
|
|
@@ -87,7 +88,7 @@ async function addLintingGenerator(tree, options) {
|
|
|
87
88
|
]);
|
|
88
89
|
}
|
|
89
90
|
if (!options.skipPackageJson) {
|
|
90
|
-
const installTask = (0, add_angular_eslint_dependencies_1.addAngularEsLintDependencies)(tree);
|
|
91
|
+
const installTask = (0, add_angular_eslint_dependencies_1.addAngularEsLintDependencies)(tree, options.projectName);
|
|
91
92
|
tasks.push(installTask);
|
|
92
93
|
}
|
|
93
94
|
if (!options.skipFormat) {
|
|
@@ -96,10 +97,4 @@ async function addLintingGenerator(tree, options) {
|
|
|
96
97
|
return (0, devkit_1.runTasksInSerial)(...tasks);
|
|
97
98
|
}
|
|
98
99
|
exports.addLintingGenerator = addLintingGenerator;
|
|
99
|
-
function isBuildableLibraryProject(tree, projectName) {
|
|
100
|
-
const projectConfig = (0, devkit_1.readProjectConfiguration)(tree, projectName);
|
|
101
|
-
return (projectConfig.projectType === 'library' &&
|
|
102
|
-
projectConfig.targets?.build &&
|
|
103
|
-
!!projectConfig.targets.build);
|
|
104
|
-
}
|
|
105
100
|
exports.default = addLintingGenerator;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import type
|
|
2
|
-
export declare function addAngularEsLintDependencies(tree: Tree): GeneratorCallback;
|
|
1
|
+
import { type GeneratorCallback, type Tree } from '@nx/devkit';
|
|
2
|
+
export declare function addAngularEsLintDependencies(tree: Tree, projectName: string): GeneratorCallback;
|
|
@@ -3,14 +3,18 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.addAngularEsLintDependencies = void 0;
|
|
4
4
|
const devkit_1 = require("@nx/devkit");
|
|
5
5
|
const version_utils_1 = require("../../utils/version-utils");
|
|
6
|
-
|
|
6
|
+
const buildable_project_1 = require("./buildable-project");
|
|
7
|
+
function addAngularEsLintDependencies(tree, projectName) {
|
|
7
8
|
const angularEslintVersionToInstall = (0, version_utils_1.versions)(tree).angularEslintVersion;
|
|
8
|
-
const
|
|
9
|
-
return (0, devkit_1.addDependenciesToPackageJson)(tree, {}, {
|
|
9
|
+
const devDependencies = {
|
|
10
10
|
'@angular-eslint/eslint-plugin': angularEslintVersionToInstall,
|
|
11
11
|
'@angular-eslint/eslint-plugin-template': angularEslintVersionToInstall,
|
|
12
12
|
'@angular-eslint/template-parser': angularEslintVersionToInstall,
|
|
13
|
-
|
|
14
|
-
|
|
13
|
+
};
|
|
14
|
+
if ((0, buildable_project_1.isBuildableLibraryProject)(tree, projectName)) {
|
|
15
|
+
const jsoncEslintParserVersionToInstall = (0, version_utils_1.versions)(tree).jsoncEslintParserVersion;
|
|
16
|
+
devDependencies['jsonc-eslint-parser'] = jsoncEslintParserVersionToInstall;
|
|
17
|
+
}
|
|
18
|
+
return (0, devkit_1.addDependenciesToPackageJson)(tree, {}, devDependencies);
|
|
15
19
|
}
|
|
16
20
|
exports.addAngularEsLintDependencies = addAngularEsLintDependencies;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.isBuildableLibraryProject = void 0;
|
|
4
|
+
const devkit_1 = require("@nx/devkit");
|
|
5
|
+
function isBuildableLibraryProject(tree, projectName) {
|
|
6
|
+
const projectConfig = (0, devkit_1.readProjectConfiguration)(tree, projectName);
|
|
7
|
+
return (projectConfig.projectType === 'library' && !!projectConfig.targets?.build);
|
|
8
|
+
}
|
|
9
|
+
exports.isBuildableLibraryProject = isBuildableLibraryProject;
|
|
@@ -1,14 +1,16 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.addE2e = void 0;
|
|
4
|
-
const cypress_1 = require("@nx/cypress");
|
|
5
4
|
const devkit_1 = require("@nx/devkit");
|
|
6
5
|
const versions_1 = require("../../../utils/versions");
|
|
7
6
|
const version_utils_1 = require("../../utils/version-utils");
|
|
8
7
|
async function addE2e(tree, options) {
|
|
9
8
|
// since e2e are separate projects, default to adding plugins
|
|
10
|
-
const
|
|
9
|
+
const nxJson = (0, devkit_1.readNxJson)(tree);
|
|
10
|
+
const addPlugin = process.env.NX_ADD_PLUGINS !== 'false' &&
|
|
11
|
+
nxJson.useInferencePlugins !== false;
|
|
11
12
|
if (options.e2eTestRunner === 'cypress') {
|
|
13
|
+
const { configurationGenerator } = (0, devkit_1.ensurePackage)('@nx/cypress', versions_1.nxVersion);
|
|
12
14
|
// TODO: This can call `@nx/web:static-config` generator when ready
|
|
13
15
|
addFileServerTarget(tree, options, 'serve-static');
|
|
14
16
|
(0, devkit_1.addProjectConfiguration)(tree, options.e2eProjectName, {
|
|
@@ -19,7 +21,7 @@ async function addE2e(tree, options) {
|
|
|
19
21
|
tags: [],
|
|
20
22
|
implicitDependencies: [options.name],
|
|
21
23
|
});
|
|
22
|
-
await
|
|
24
|
+
await configurationGenerator(tree, {
|
|
23
25
|
project: options.e2eProjectName,
|
|
24
26
|
directory: 'src',
|
|
25
27
|
linter: options.linter,
|
|
@@ -32,7 +34,7 @@ async function addE2e(tree, options) {
|
|
|
32
34
|
});
|
|
33
35
|
}
|
|
34
36
|
else if (options.e2eTestRunner === 'playwright') {
|
|
35
|
-
const { configurationGenerator
|
|
37
|
+
const { configurationGenerator } = (0, devkit_1.ensurePackage)('@nx/playwright', versions_1.nxVersion);
|
|
36
38
|
(0, devkit_1.addProjectConfiguration)(tree, options.e2eProjectName, {
|
|
37
39
|
projectType: 'application',
|
|
38
40
|
root: options.e2eProjectRoot,
|
|
@@ -40,7 +42,7 @@ async function addE2e(tree, options) {
|
|
|
40
42
|
targets: {},
|
|
41
43
|
implicitDependencies: [options.name],
|
|
42
44
|
});
|
|
43
|
-
await
|
|
45
|
+
await configurationGenerator(tree, {
|
|
44
46
|
project: options.e2eProjectName,
|
|
45
47
|
skipFormat: true,
|
|
46
48
|
skipPackageJson: options.skipPackageJson,
|
|
@@ -3,14 +3,19 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.createFiles = void 0;
|
|
4
4
|
const devkit_1 = require("@nx/devkit");
|
|
5
5
|
const js_1 = require("@nx/js");
|
|
6
|
-
const
|
|
6
|
+
const update_project_root_tsconfig_1 = require("../../utils/update-project-root-tsconfig");
|
|
7
7
|
const test_runners_1 = require("../../../utils/test-runners");
|
|
8
8
|
const version_utils_1 = require("../../utils/version-utils");
|
|
9
|
+
const selector_1 = require("../../utils/selector");
|
|
9
10
|
async function createFiles(tree, options, rootOffset) {
|
|
10
11
|
const { major: angularMajorVersion } = (0, version_utils_1.getInstalledAngularVersionInfo)(tree);
|
|
11
12
|
const isUsingApplicationBuilder = angularMajorVersion >= 17 && options.bundler === 'esbuild';
|
|
13
|
+
const rootSelector = `${options.prefix}-root`;
|
|
14
|
+
(0, selector_1.validateHtmlSelector)(rootSelector);
|
|
15
|
+
const nxWelcomeSelector = `${options.prefix}-nx-welcome`;
|
|
16
|
+
(0, selector_1.validateHtmlSelector)(nxWelcomeSelector);
|
|
12
17
|
const substitutions = {
|
|
13
|
-
rootSelector
|
|
18
|
+
rootSelector,
|
|
14
19
|
appName: options.name,
|
|
15
20
|
inlineStyle: options.inlineStyle,
|
|
16
21
|
inlineTemplate: options.inlineTemplate,
|
|
@@ -19,7 +24,7 @@ async function createFiles(tree, options, rootOffset) {
|
|
|
19
24
|
unitTesting: options.unitTestRunner !== test_runners_1.UnitTestRunner.None,
|
|
20
25
|
routing: options.routing,
|
|
21
26
|
minimal: options.minimal,
|
|
22
|
-
nxWelcomeSelector
|
|
27
|
+
nxWelcomeSelector,
|
|
23
28
|
rootTsConfig: (0, devkit_1.joinPathFragments)(rootOffset, (0, js_1.getRootTsConfigFileName)(tree)),
|
|
24
29
|
angularMajorVersion,
|
|
25
30
|
rootOffset,
|
|
@@ -33,13 +38,7 @@ async function createFiles(tree, options, rootOffset) {
|
|
|
33
38
|
else {
|
|
34
39
|
(0, devkit_1.generateFiles)(tree, (0, devkit_1.joinPathFragments)(__dirname, '../files/ng-module'), options.appProjectRoot, substitutions);
|
|
35
40
|
}
|
|
36
|
-
(0,
|
|
37
|
-
bundler: options.bundler,
|
|
38
|
-
rootProject: options.rootProject,
|
|
39
|
-
strict: options.strict,
|
|
40
|
-
style: options.style,
|
|
41
|
-
esModuleInterop: isUsingApplicationBuilder,
|
|
42
|
-
}, (0, js_1.getRelativePathToRootTsConfig)(tree, options.appProjectRoot));
|
|
41
|
+
(0, update_project_root_tsconfig_1.updateProjectRootTsConfig)(tree, options.appProjectRoot, (0, js_1.getRelativePathToRootTsConfig)(tree, options.appProjectRoot), options.rootProject);
|
|
43
42
|
if (!options.routing) {
|
|
44
43
|
tree.delete((0, devkit_1.joinPathFragments)(options.appProjectRoot, '/src/app/app.routes.ts'));
|
|
45
44
|
}
|
|
@@ -4,9 +4,7 @@ exports.normalizeOptions = void 0;
|
|
|
4
4
|
const devkit_1 = require("@nx/devkit");
|
|
5
5
|
const project_name_and_root_utils_1 = require("@nx/devkit/src/generators/project-name-and-root-utils");
|
|
6
6
|
const eslint_1 = require("@nx/eslint");
|
|
7
|
-
const get_npm_scope_1 = require("@nx/js/src/utils/package-json/get-npm-scope");
|
|
8
7
|
const test_runners_1 = require("../../../utils/test-runners");
|
|
9
|
-
const project_1 = require("../../utils/project");
|
|
10
8
|
const version_utils_1 = require("../../utils/version-utils");
|
|
11
9
|
async function normalizeOptions(host, options) {
|
|
12
10
|
const { projectName: appProjectName, projectRoot: appProjectRoot, projectNameAndRootFormat, } = await (0, project_name_and_root_utils_1.determineProjectNameAndRootOptions)(host, {
|
|
@@ -24,7 +22,6 @@ async function normalizeOptions(host, options) {
|
|
|
24
22
|
const parsedTags = options.tags
|
|
25
23
|
? options.tags.split(',').map((s) => s.trim())
|
|
26
24
|
: [];
|
|
27
|
-
const prefix = (0, project_1.normalizeNewProjectPrefix)(options.prefix, (0, get_npm_scope_1.getNpmScope)(host), 'app');
|
|
28
25
|
let bundler = options.bundler;
|
|
29
26
|
if (!bundler) {
|
|
30
27
|
const { major: angularMajorVersion } = (0, version_utils_1.getInstalledAngularVersionInfo)(host);
|
|
@@ -44,7 +41,7 @@ async function normalizeOptions(host, options) {
|
|
|
44
41
|
strict: true,
|
|
45
42
|
standalone: true,
|
|
46
43
|
...options,
|
|
47
|
-
prefix,
|
|
44
|
+
prefix: options.prefix || 'app',
|
|
48
45
|
name: appProjectName,
|
|
49
46
|
appProjectRoot,
|
|
50
47
|
appProjectSourceRoot: `${appProjectRoot}/src`,
|
|
@@ -2,24 +2,21 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.updateEditorTsConfig = void 0;
|
|
4
4
|
const devkit_1 = require("@nx/devkit");
|
|
5
|
+
const update_app_editor_tsconfig_excluded_files_1 = require("../../utils/update-app-editor-tsconfig-excluded-files");
|
|
5
6
|
function getCompilerOptionsTypes(tsConfig) {
|
|
6
7
|
return tsConfig?.compilerOptions?.types ?? [];
|
|
7
8
|
}
|
|
8
9
|
function updateEditorTsConfig(tree, options) {
|
|
9
|
-
const
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
});
|
|
17
|
-
// This should be the last tsconfig references so it's not in the template
|
|
18
|
-
(0, devkit_1.updateJson)(tree, (0, devkit_1.joinPathFragments)(options.appProjectRoot, 'tsconfig.json'), (json) => {
|
|
19
|
-
json.references.push({
|
|
20
|
-
path: './tsconfig.editor.json',
|
|
10
|
+
const appTsConfig = (0, devkit_1.readJson)(tree, (0, devkit_1.joinPathFragments)(options.appProjectRoot, 'tsconfig.app.json'));
|
|
11
|
+
const types = getCompilerOptionsTypes(appTsConfig);
|
|
12
|
+
if (types?.length) {
|
|
13
|
+
(0, devkit_1.updateJson)(tree, (0, devkit_1.joinPathFragments)(options.appProjectRoot, 'tsconfig.editor.json'), (json) => {
|
|
14
|
+
json.compilerOptions ??= {};
|
|
15
|
+
json.compilerOptions.types = Array.from(new Set(types));
|
|
16
|
+
return json;
|
|
21
17
|
});
|
|
22
|
-
|
|
23
|
-
|
|
18
|
+
}
|
|
19
|
+
const project = (0, devkit_1.readProjectConfiguration)(tree, options.name);
|
|
20
|
+
(0, update_app_editor_tsconfig_excluded_files_1.updateAppEditorTsConfigExcludedFiles)(tree, project);
|
|
24
21
|
}
|
|
25
22
|
exports.updateEditorTsConfig = updateEditorTsConfig;
|
|
@@ -20,8 +20,8 @@ async function normalizeOptions(tree, options) {
|
|
|
20
20
|
const { className: suffixClassName } = (0, devkit_1.names)(options.type);
|
|
21
21
|
const symbolName = `${className}${suffixClassName}`;
|
|
22
22
|
const { prefix, root, sourceRoot } = (0, devkit_1.readProjectConfiguration)(tree, projectName);
|
|
23
|
-
const selector = options.selector ??
|
|
24
|
-
|
|
23
|
+
const selector = options.selector ?? (0, selector_1.buildSelector)(name, options.prefix, prefix, 'fileName');
|
|
24
|
+
(0, selector_1.validateHtmlSelector)(selector);
|
|
25
25
|
return {
|
|
26
26
|
...options,
|
|
27
27
|
name,
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.componentTestGenerator = void 0;
|
|
4
|
-
const cypress_version_1 = require("@nx/cypress/src/utils/cypress-version");
|
|
5
4
|
const devkit_1 = require("@nx/devkit");
|
|
5
|
+
const versions_1 = require("../../utils/versions");
|
|
6
6
|
const storybook_inputs_1 = require("../utils/storybook-ast/storybook-inputs");
|
|
7
7
|
async function componentTestGenerator(tree, options) {
|
|
8
|
-
(0,
|
|
8
|
+
(0, devkit_1.ensurePackage)('@nx/cypress', versions_1.nxVersion);
|
|
9
|
+
const { assertMinimumCypressVersion } = await Promise.resolve().then(() => require('@nx/cypress/src/utils/cypress-version'));
|
|
10
|
+
assertMinimumCypressVersion(10);
|
|
9
11
|
const { root } = (0, devkit_1.readProjectConfiguration)(tree, options.project);
|
|
10
12
|
const componentDirPath = (0, devkit_1.joinPathFragments)(root, options.componentDir);
|
|
11
13
|
const componentFilePath = (0, devkit_1.joinPathFragments)(componentDirPath, `${options.componentFileName}.ts`);
|
|
@@ -1,15 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.cypressComponentConfigurationInternal = exports.cypressComponentConfiguration = void 0;
|
|
4
|
-
const cypress_1 = require("@nx/cypress");
|
|
5
|
-
const config_1 = require("@nx/cypress/src/utils/config");
|
|
6
|
-
const find_target_options_1 = require("@nx/cypress/src/utils/find-target-options");
|
|
7
4
|
const devkit_1 = require("@nx/devkit");
|
|
8
5
|
const path_1 = require("path");
|
|
6
|
+
const versions_1 = require("../../utils/versions");
|
|
9
7
|
const component_test_1 = require("../component-test/component-test");
|
|
10
8
|
const component_info_1 = require("../utils/storybook-ast/component-info");
|
|
11
9
|
const entry_point_1 = require("../utils/storybook-ast/entry-point");
|
|
12
10
|
const module_info_1 = require("../utils/storybook-ast/module-info");
|
|
11
|
+
const update_app_editor_tsconfig_excluded_files_1 = require("../utils/update-app-editor-tsconfig-excluded-files");
|
|
13
12
|
function cypressComponentConfiguration(tree, options) {
|
|
14
13
|
return cypressComponentConfigurationInternal(tree, {
|
|
15
14
|
...options,
|
|
@@ -22,7 +21,8 @@ exports.cypressComponentConfiguration = cypressComponentConfiguration;
|
|
|
22
21
|
*/
|
|
23
22
|
async function cypressComponentConfigurationInternal(tree, options) {
|
|
24
23
|
const projectConfig = (0, devkit_1.readProjectConfiguration)(tree, options.project);
|
|
25
|
-
const
|
|
24
|
+
const { componentConfigurationGenerator: baseCyCTConfig } = (0, devkit_1.ensurePackage)('@nx/cypress', versions_1.nxVersion);
|
|
25
|
+
const installTask = await baseCyCTConfig(tree, {
|
|
26
26
|
project: options.project,
|
|
27
27
|
skipFormat: true,
|
|
28
28
|
addPlugin: false,
|
|
@@ -30,6 +30,9 @@ async function cypressComponentConfigurationInternal(tree, options) {
|
|
|
30
30
|
});
|
|
31
31
|
await configureCypressCT(tree, options);
|
|
32
32
|
await addFiles(tree, projectConfig, options);
|
|
33
|
+
if (projectConfig.projectType === 'application') {
|
|
34
|
+
(0, update_app_editor_tsconfig_excluded_files_1.updateAppEditorTsConfigExcludedFiles)(tree, projectConfig);
|
|
35
|
+
}
|
|
33
36
|
if (!options.skipFormat) {
|
|
34
37
|
await (0, devkit_1.formatFiles)(tree);
|
|
35
38
|
}
|
|
@@ -38,7 +41,8 @@ async function cypressComponentConfigurationInternal(tree, options) {
|
|
|
38
41
|
exports.cypressComponentConfigurationInternal = cypressComponentConfigurationInternal;
|
|
39
42
|
async function addFiles(tree, projectConfig, options) {
|
|
40
43
|
const componentFile = (0, devkit_1.joinPathFragments)(projectConfig.root, 'cypress', 'support', 'component.ts');
|
|
41
|
-
const
|
|
44
|
+
const { addMountDefinition } = await Promise.resolve().then(() => require('@nx/cypress/src/utils/config'));
|
|
45
|
+
const updatedCmpContents = await addMountDefinition(tree.read(componentFile, 'utf-8'));
|
|
42
46
|
tree.write(componentFile, `import { mount } from 'cypress/angular';\n${updatedCmpContents}`);
|
|
43
47
|
if (options.generateTests) {
|
|
44
48
|
const entryPoints = (0, entry_point_1.getProjectEntryPoints)(tree, options.project);
|
|
@@ -65,7 +69,8 @@ async function addFiles(tree, projectConfig, options) {
|
|
|
65
69
|
async function configureCypressCT(tree, options) {
|
|
66
70
|
let found = { target: options.buildTarget, config: undefined };
|
|
67
71
|
if (!options.buildTarget) {
|
|
68
|
-
|
|
72
|
+
const { findBuildConfig } = await Promise.resolve().then(() => require('@nx/cypress/src/utils/find-target-options'));
|
|
73
|
+
found = await findBuildConfig(tree, {
|
|
69
74
|
project: options.project,
|
|
70
75
|
buildTarget: options.buildTarget,
|
|
71
76
|
validExecutorNames: new Set([
|
|
@@ -90,8 +95,9 @@ async function configureCypressCT(tree, options) {
|
|
|
90
95
|
else {
|
|
91
96
|
ctConfigOptions.buildTarget = found.target;
|
|
92
97
|
}
|
|
93
|
-
const
|
|
94
|
-
const
|
|
98
|
+
const { addDefaultCTConfig, getProjectCypressConfigPath } = await Promise.resolve().then(() => require('@nx/cypress/src/utils/config'));
|
|
99
|
+
const cypressConfigPath = getProjectCypressConfigPath(tree, projectConfig.root);
|
|
100
|
+
const updatedCyConfig = await addDefaultCTConfig(tree.read(cypressConfigPath, 'utf-8'), ctConfigOptions);
|
|
95
101
|
tree.write(cypressConfigPath, `import { nxComponentTestingPreset } from '@nx/angular/plugins/component-testing';\n${updatedCyConfig}`);
|
|
96
102
|
}
|
|
97
103
|
function assertValidConfig(config) {
|
|
@@ -20,7 +20,8 @@ async function normalizeOptions(tree, options) {
|
|
|
20
20
|
const symbolName = `${className}${suffixClassName}`;
|
|
21
21
|
const { prefix } = (0, devkit_1.readProjectConfiguration)(tree, projectName);
|
|
22
22
|
const selector = options.selector ??
|
|
23
|
-
(0, selector_1.buildSelector)(
|
|
23
|
+
(0, selector_1.buildSelector)(name, options.prefix, prefix, 'propertyName');
|
|
24
|
+
(0, selector_1.validateHtmlSelector)(selector);
|
|
24
25
|
return {
|
|
25
26
|
...options,
|
|
26
27
|
projectName,
|
|
@@ -4,10 +4,6 @@ exports.addProject = void 0;
|
|
|
4
4
|
const devkit_1 = require("@nx/devkit");
|
|
5
5
|
const add_build_target_defaults_1 = require("@nx/devkit/src/generators/add-build-target-defaults");
|
|
6
6
|
function addProject(tree, libraryOptions) {
|
|
7
|
-
const executor = libraryOptions.publishable
|
|
8
|
-
? '@nx/angular:package'
|
|
9
|
-
: '@nx/angular:ng-packagr-lite';
|
|
10
|
-
(0, add_build_target_defaults_1.addBuildTargetDefaults)(tree, executor);
|
|
11
7
|
const project = {
|
|
12
8
|
name: libraryOptions.name,
|
|
13
9
|
root: libraryOptions.projectRoot,
|
|
@@ -15,27 +11,30 @@ function addProject(tree, libraryOptions) {
|
|
|
15
11
|
prefix: libraryOptions.prefix,
|
|
16
12
|
tags: libraryOptions.parsedTags,
|
|
17
13
|
projectType: 'library',
|
|
18
|
-
targets: {
|
|
19
|
-
build: libraryOptions.buildable || libraryOptions.publishable
|
|
20
|
-
? {
|
|
21
|
-
executor,
|
|
22
|
-
outputs: ['{workspaceRoot}/dist/{projectRoot}'],
|
|
23
|
-
options: {
|
|
24
|
-
project: `${libraryOptions.projectRoot}/ng-package.json`,
|
|
25
|
-
},
|
|
26
|
-
configurations: {
|
|
27
|
-
production: {
|
|
28
|
-
tsConfig: `${libraryOptions.projectRoot}/tsconfig.lib.prod.json`,
|
|
29
|
-
},
|
|
30
|
-
development: {
|
|
31
|
-
tsConfig: `${libraryOptions.projectRoot}/tsconfig.lib.json`,
|
|
32
|
-
},
|
|
33
|
-
},
|
|
34
|
-
defaultConfiguration: 'production',
|
|
35
|
-
}
|
|
36
|
-
: undefined,
|
|
37
|
-
},
|
|
14
|
+
targets: {},
|
|
38
15
|
};
|
|
16
|
+
if (libraryOptions.buildable || libraryOptions.publishable) {
|
|
17
|
+
const executor = libraryOptions.publishable
|
|
18
|
+
? '@nx/angular:package'
|
|
19
|
+
: '@nx/angular:ng-packagr-lite';
|
|
20
|
+
(0, add_build_target_defaults_1.addBuildTargetDefaults)(tree, executor);
|
|
21
|
+
project.targets.build = {
|
|
22
|
+
executor,
|
|
23
|
+
outputs: ['{workspaceRoot}/dist/{projectRoot}'],
|
|
24
|
+
options: {
|
|
25
|
+
project: `${libraryOptions.projectRoot}/ng-package.json`,
|
|
26
|
+
},
|
|
27
|
+
configurations: {
|
|
28
|
+
production: {
|
|
29
|
+
tsConfig: `${libraryOptions.projectRoot}/tsconfig.lib.prod.json`,
|
|
30
|
+
},
|
|
31
|
+
development: {
|
|
32
|
+
tsConfig: `${libraryOptions.projectRoot}/tsconfig.lib.json`,
|
|
33
|
+
},
|
|
34
|
+
},
|
|
35
|
+
defaultConfiguration: 'production',
|
|
36
|
+
};
|
|
37
|
+
}
|
|
39
38
|
(0, devkit_1.addProjectConfiguration)(tree, libraryOptions.name, project);
|
|
40
39
|
return project;
|
|
41
40
|
}
|
|
@@ -3,10 +3,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.normalizeOptions = void 0;
|
|
4
4
|
const devkit_1 = require("@nx/devkit");
|
|
5
5
|
const project_name_and_root_utils_1 = require("@nx/devkit/src/generators/project-name-and-root-utils");
|
|
6
|
-
const get_npm_scope_1 = require("@nx/js/src/utils/package-json/get-npm-scope");
|
|
7
6
|
const eslint_1 = require("@nx/eslint");
|
|
8
7
|
const test_runners_1 = require("../../../utils/test-runners");
|
|
9
|
-
const project_1 = require("../../utils/project");
|
|
10
8
|
async function normalizeOptions(host, schema) {
|
|
11
9
|
schema.standalone = schema.standalone ?? true;
|
|
12
10
|
// Create a schema with populated default values
|
|
@@ -40,14 +38,12 @@ async function normalizeOptions(host, schema) {
|
|
|
40
38
|
? options.tags.split(',').map((s) => s.trim())
|
|
41
39
|
: [];
|
|
42
40
|
const modulePath = `${projectRoot}/src/lib/${fileName}.module.ts`;
|
|
43
|
-
const npmScope = (0, get_npm_scope_1.getNpmScope)(host);
|
|
44
|
-
const prefix = (0, project_1.normalizeNewProjectPrefix)(options.prefix, npmScope, 'lib');
|
|
45
41
|
const ngCliSchematicLibRoot = projectName;
|
|
46
42
|
const allNormalizedOptions = {
|
|
47
43
|
...options,
|
|
48
44
|
linter: options.linter ?? eslint_1.Linter.EsLint,
|
|
49
45
|
unitTestRunner: options.unitTestRunner ?? test_runners_1.UnitTestRunner.Jest,
|
|
50
|
-
prefix,
|
|
46
|
+
prefix: options.prefix ?? 'lib',
|
|
51
47
|
name: projectName,
|
|
52
48
|
projectRoot,
|
|
53
49
|
entryFile: 'index',
|
|
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.updateTsConfig = void 0;
|
|
4
4
|
const devkit_1 = require("@nx/devkit");
|
|
5
5
|
const js_1 = require("@nx/js");
|
|
6
|
-
const
|
|
6
|
+
const update_project_root_tsconfig_1 = require("../../utils/update-project-root-tsconfig");
|
|
7
7
|
function updateProjectConfig(host, options) {
|
|
8
8
|
(0, devkit_1.updateJson)(host, `${options.projectRoot}/tsconfig.lib.json`, (json) => {
|
|
9
9
|
json.include = ['src/**/*.ts'];
|
|
@@ -18,7 +18,7 @@ function updateProjectConfig(host, options) {
|
|
|
18
18
|
return json;
|
|
19
19
|
});
|
|
20
20
|
// tsconfig.json
|
|
21
|
-
(0,
|
|
21
|
+
(0, update_project_root_tsconfig_1.updateProjectRootTsConfig)(host, options.projectRoot, (0, js_1.getRelativePathToRootTsConfig)(host, options.projectRoot));
|
|
22
22
|
}
|
|
23
23
|
function updateProjectIvyConfig(host, options) {
|
|
24
24
|
if (options.buildable || options.publishable) {
|
|
@@ -30,7 +30,7 @@ function updateProjectIvyConfig(host, options) {
|
|
|
30
30
|
}
|
|
31
31
|
}
|
|
32
32
|
function updateTsConfig(host, options) {
|
|
33
|
-
(0,
|
|
33
|
+
(0, update_project_root_tsconfig_1.extractTsConfigBase)(host);
|
|
34
34
|
updateProjectConfig(host, options);
|
|
35
35
|
updateProjectIvyConfig(host, options);
|
|
36
36
|
}
|
|
@@ -1,17 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.E2eMigrator = void 0;
|
|
4
|
-
const cypress_1 = require("@nx/cypress");
|
|
5
|
-
const cypress_preset_1 = require("@nx/cypress/plugins/cypress-preset");
|
|
6
|
-
const cypress_version_1 = require("@nx/cypress/src/utils/cypress-version");
|
|
7
4
|
const devkit_1 = require("@nx/devkit");
|
|
8
5
|
const eslint_1 = require("@nx/eslint");
|
|
9
6
|
const js_1 = require("@nx/js");
|
|
7
|
+
const ensure_typescript_1 = require("@nx/js/src/utils/typescript/ensure-typescript");
|
|
10
8
|
const path_1 = require("path");
|
|
11
|
-
const typescript_1 = require("typescript");
|
|
12
9
|
const file_change_recorder_1 = require("../../../../utils/file-change-recorder");
|
|
10
|
+
const versions_1 = require("../../../../utils/versions");
|
|
13
11
|
const project_migrator_1 = require("./project.migrator");
|
|
14
|
-
const ensure_typescript_1 = require("@nx/js/src/utils/typescript/ensure-typescript");
|
|
15
12
|
const supportedTargets = {
|
|
16
13
|
e2e: {
|
|
17
14
|
acceptMultipleDefinitions: true,
|
|
@@ -175,7 +172,9 @@ class E2eMigrator extends project_migrator_1.ProjectMigrator {
|
|
|
175
172
|
};
|
|
176
173
|
}
|
|
177
174
|
else if (this.isCypressE2eProject()) {
|
|
178
|
-
|
|
175
|
+
(0, devkit_1.ensurePackage)('@nx/cypress', versions_1.nxVersion);
|
|
176
|
+
const { installedCypressVersion, } = require('@nx/cypress/src/utils/cypress-version');
|
|
177
|
+
this.cypressInstalledVersion = installedCypressVersion();
|
|
179
178
|
this.project = {
|
|
180
179
|
...this.project,
|
|
181
180
|
name,
|
|
@@ -235,14 +234,18 @@ class E2eMigrator extends project_migrator_1.ProjectMigrator {
|
|
|
235
234
|
tags: [],
|
|
236
235
|
implicitDependencies: [this.appName],
|
|
237
236
|
});
|
|
238
|
-
|
|
237
|
+
const nxJson = (0, devkit_1.readNxJson)(this.tree) ?? {};
|
|
238
|
+
const addPlugin = process.env.NX_ADD_PLUGINS !== 'false' &&
|
|
239
|
+
nxJson.useInferencePlugins !== false;
|
|
240
|
+
const { configurationGenerator } = await Promise.resolve().then(() => require('@nx/cypress'));
|
|
241
|
+
await configurationGenerator(this.tree, {
|
|
239
242
|
project: this.project.name,
|
|
240
243
|
linter: this.isProjectUsingEsLint ? eslint_1.Linter.EsLint : eslint_1.Linter.None,
|
|
241
244
|
skipFormat: true,
|
|
242
245
|
// any target would do, we replace it later with the target existing in the project being migrated
|
|
243
246
|
devServerTarget: `${this.appName}:serve`,
|
|
244
247
|
baseUrl: 'http://localhost:4200',
|
|
245
|
-
addPlugin
|
|
248
|
+
addPlugin,
|
|
246
249
|
});
|
|
247
250
|
const cypressConfigFilePath = this.updateOrCreateCypressConfigFile(oldCypressConfigFilePath);
|
|
248
251
|
this.updateCypressProjectConfiguration(cypressConfigFilePath);
|
|
@@ -363,9 +366,10 @@ class E2eMigrator extends project_migrator_1.ProjectMigrator {
|
|
|
363
366
|
: undefined;
|
|
364
367
|
}
|
|
365
368
|
updateCypress10ConfigFile(configFilePath) {
|
|
366
|
-
(0, ensure_typescript_1.ensureTypescript)();
|
|
369
|
+
const { isPropertyAssignment } = (0, ensure_typescript_1.ensureTypescript)();
|
|
367
370
|
const { tsquery } = require('@phenomnomnominal/tsquery');
|
|
368
|
-
|
|
371
|
+
const { nxE2EPreset } = require('@nx/cypress/plugins/cypress-preset');
|
|
372
|
+
this.cypressPreset = nxE2EPreset(configFilePath);
|
|
369
373
|
const fileContent = this.tree.read(configFilePath, 'utf-8');
|
|
370
374
|
let sourceFile = tsquery.ast(fileContent);
|
|
371
375
|
const recorder = new file_change_recorder_1.FileChangeRecorder(this.tree, configFilePath);
|
|
@@ -378,15 +382,15 @@ class E2eMigrator extends project_migrator_1.ProjectMigrator {
|
|
|
378
382
|
let componentNode;
|
|
379
383
|
const globalConfig = {};
|
|
380
384
|
defineConfigExpression.forEachChild((node) => {
|
|
381
|
-
if (
|
|
385
|
+
if (isPropertyAssignment(node) && node.name.getText() === 'component') {
|
|
382
386
|
componentNode = node;
|
|
383
387
|
return;
|
|
384
388
|
}
|
|
385
|
-
if (
|
|
389
|
+
if (isPropertyAssignment(node) && node.name.getText() === 'e2e') {
|
|
386
390
|
e2eNode = node;
|
|
387
391
|
return;
|
|
388
392
|
}
|
|
389
|
-
if (
|
|
393
|
+
if (isPropertyAssignment(node)) {
|
|
390
394
|
this.updateCypressConfigNodeValue(recorder, node, globalConfig);
|
|
391
395
|
}
|
|
392
396
|
});
|
|
@@ -398,14 +402,15 @@ class E2eMigrator extends project_migrator_1.ProjectMigrator {
|
|
|
398
402
|
if (!componentNode) {
|
|
399
403
|
return;
|
|
400
404
|
}
|
|
401
|
-
|
|
405
|
+
const { isObjectLiteralExpression, isPropertyAssignment } = (0, ensure_typescript_1.ensureTypescript)();
|
|
406
|
+
if (!isObjectLiteralExpression(componentNode.initializer)) {
|
|
402
407
|
this.logger.warn('The automatic migration only supports having an object literal in the "component" option of the Cypress configuration. ' +
|
|
403
408
|
`The configuration won't be updated. Please make sure to update any paths you may have in the "component" option ` +
|
|
404
409
|
'manually to point to the new location.');
|
|
405
410
|
return;
|
|
406
411
|
}
|
|
407
412
|
componentNode.initializer.properties.forEach((node) => {
|
|
408
|
-
if (
|
|
413
|
+
if (isPropertyAssignment(node)) {
|
|
409
414
|
this.updateCypressConfigNodeValue(recorder, node);
|
|
410
415
|
}
|
|
411
416
|
});
|
|
@@ -428,7 +433,8 @@ class E2eMigrator extends project_migrator_1.ProjectMigrator {
|
|
|
428
433
|
recorder.insertRight(defineConfigNode.getStart() + 1, e2eAssignment);
|
|
429
434
|
}
|
|
430
435
|
else {
|
|
431
|
-
|
|
436
|
+
const { isObjectLiteralExpression, isPropertyAssignment } = (0, ensure_typescript_1.ensureTypescript)();
|
|
437
|
+
if (!isObjectLiteralExpression(e2eNode.initializer)) {
|
|
432
438
|
this.logger.warn('The automatic migration only supports having an object literal in the "e2e" option of the Cypress configuration. ' +
|
|
433
439
|
`The configuration won't be updated. Please make sure to update any paths you might have in the "e2e" option ` +
|
|
434
440
|
'manually to point to the new location.');
|
|
@@ -436,7 +442,7 @@ class E2eMigrator extends project_migrator_1.ProjectMigrator {
|
|
|
436
442
|
}
|
|
437
443
|
recorder.insertRight(e2eNode.initializer.getStart() + 1, presetSpreadAssignment);
|
|
438
444
|
e2eNode.initializer.properties.forEach((node) => {
|
|
439
|
-
if (!
|
|
445
|
+
if (!isPropertyAssignment(node)) {
|
|
440
446
|
return;
|
|
441
447
|
}
|
|
442
448
|
let change = { type: 'ignore' };
|
|
@@ -515,7 +521,8 @@ class E2eMigrator extends project_migrator_1.ProjectMigrator {
|
|
|
515
521
|
}
|
|
516
522
|
}
|
|
517
523
|
isValidPathLikePropertyWithStringLiteralValue(node, properties) {
|
|
518
|
-
|
|
524
|
+
const { isPropertyAssignment, isStringLiteralLike, isTemplateExpression, SyntaxKind, } = (0, ensure_typescript_1.ensureTypescript)();
|
|
525
|
+
if (!isPropertyAssignment(node)) {
|
|
519
526
|
// TODO(leo): handle more scenarios (spread assignments, etc)
|
|
520
527
|
return false;
|
|
521
528
|
}
|
|
@@ -523,13 +530,13 @@ class E2eMigrator extends project_migrator_1.ProjectMigrator {
|
|
|
523
530
|
if (!property) {
|
|
524
531
|
return false;
|
|
525
532
|
}
|
|
526
|
-
if (node.initializer.kind ===
|
|
527
|
-
node.initializer.kind ===
|
|
528
|
-
node.initializer.kind ===
|
|
533
|
+
if (node.initializer.kind === SyntaxKind.UndefinedKeyword ||
|
|
534
|
+
node.initializer.kind === SyntaxKind.NullKeyword ||
|
|
535
|
+
node.initializer.kind === SyntaxKind.FalseKeyword) {
|
|
529
536
|
return false;
|
|
530
537
|
}
|
|
531
|
-
if (!
|
|
532
|
-
if (
|
|
538
|
+
if (!isStringLiteralLike(node.initializer)) {
|
|
539
|
+
if (isTemplateExpression(node.initializer)) {
|
|
533
540
|
this.logger.warn(`The "${node.name.getText()}" in the Cypress configuration file is set to a template expression ("${node.initializer.getText()}"). ` +
|
|
534
541
|
`This is not supported by the automatic migration and its value won't be automatically migrated. ` +
|
|
535
542
|
`Please make sure to update its value to match the new location if needed.`);
|
|
@@ -29,9 +29,7 @@ exports.validateWorkspace = validateWorkspace;
|
|
|
29
29
|
function createNxJson(tree, options, defaultProject) {
|
|
30
30
|
const targets = getWorkspaceCommonTargets(tree);
|
|
31
31
|
(0, devkit_1.writeJson)(tree, 'nx.json', {
|
|
32
|
-
|
|
33
|
-
defaultBase: options.defaultBase ?? (0, default_base_1.deduceDefaultBase)(),
|
|
34
|
-
},
|
|
32
|
+
defaultBase: options.defaultBase ?? (0, default_base_1.deduceDefaultBase)(),
|
|
35
33
|
namedInputs: {
|
|
36
34
|
sharedGlobals: [],
|
|
37
35
|
default: ['{projectRoot}/**/*', 'sharedGlobals'],
|
|
@@ -4,7 +4,6 @@
|
|
|
4
4
|
// is attached to the index.html with type=module
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.addCypressOnErrorWorkaround = void 0;
|
|
7
|
-
const config_1 = require("@nx/cypress/src/utils/config");
|
|
8
7
|
const devkit_1 = require("@nx/devkit");
|
|
9
8
|
function addCypressOnErrorWorkaround(tree, schema) {
|
|
10
9
|
if (!schema.e2eProjectName) {
|
|
@@ -23,11 +22,20 @@ function addCypressOnErrorWorkaround(tree, schema) {
|
|
|
23
22
|
`);
|
|
24
23
|
return;
|
|
25
24
|
}
|
|
26
|
-
if (e2eProject.targets?.e2e?.executor !== '@nx/cypress:cypress'
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
25
|
+
if (e2eProject.targets?.e2e?.executor !== '@nx/cypress:cypress') {
|
|
26
|
+
try {
|
|
27
|
+
// don't ensure package is installed, if it's not installed, we don't need to add the workaround
|
|
28
|
+
const { CYPRESS_CONFIG_FILE_NAME_PATTERN, } = require('@nx/cypress/src/utils/config');
|
|
29
|
+
if (!(0, devkit_1.glob)(tree, [`${e2eProject.root}/${CYPRESS_CONFIG_FILE_NAME_PATTERN}`])
|
|
30
|
+
.length) {
|
|
31
|
+
// Not a cypress e2e project, skip
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
catch {
|
|
36
|
+
// assume cypress is not installed
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
31
39
|
}
|
|
32
40
|
const commandToAdd = `Cypress.on('uncaught:exception', err => {
|
|
33
41
|
if (err.message.includes(\`Cannot use 'import.meta' outside a module\`)) {
|
|
@@ -7,7 +7,7 @@ function normalizeOptions(tree, options) {
|
|
|
7
7
|
...options,
|
|
8
8
|
typescriptConfiguration: options.typescriptConfiguration ?? true,
|
|
9
9
|
federationType: options.federationType ?? 'static',
|
|
10
|
-
prefix: options.prefix ?? (0, project_1.getProjectPrefix)(tree, options.appName),
|
|
10
|
+
prefix: options.prefix ?? (0, project_1.getProjectPrefix)(tree, options.appName) ?? 'app',
|
|
11
11
|
standalone: options.standalone ?? true,
|
|
12
12
|
};
|
|
13
13
|
}
|
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.generateStories = void 0;
|
|
4
|
-
const project_name_1 = require("@nx/cypress/src/utils/project-name");
|
|
5
4
|
const devkit_1 = require("@nx/devkit");
|
|
5
|
+
const versions_1 = require("../../../utils/versions");
|
|
6
6
|
const stories_1 = require("../../stories/stories");
|
|
7
7
|
async function generateStories(tree, options) {
|
|
8
8
|
const project = (0, devkit_1.readProjectConfiguration)(tree, options.project);
|
|
9
|
-
|
|
9
|
+
(0, devkit_1.ensurePackage)('@nx/cypress', versions_1.nxVersion);
|
|
10
|
+
const { getE2eProjectName } = await Promise.resolve().then(() => require('@nx/cypress/src/utils/project-name'));
|
|
11
|
+
const e2eProjectName = getE2eProjectName(options.project, project.root, options.cypressDirectory);
|
|
10
12
|
await (0, stories_1.angularStoriesGenerator)(tree, {
|
|
11
13
|
name: options.project,
|
|
12
14
|
generateCypressSpecs: options.configureCypress && options.generateCypressSpecs,
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.storybookConfigurationGenerator = void 0;
|
|
4
4
|
const devkit_1 = require("@nx/devkit");
|
|
5
|
+
const update_app_editor_tsconfig_excluded_files_1 = require("../utils/update-app-editor-tsconfig-excluded-files");
|
|
5
6
|
const assert_compatible_storybook_version_1 = require("./lib/assert-compatible-storybook-version");
|
|
6
7
|
const generate_stories_1 = require("./lib/generate-stories");
|
|
7
8
|
const generate_storybook_configuration_1 = require("./lib/generate-storybook-configuration");
|
|
@@ -22,6 +23,10 @@ async function storybookConfigurationGenerator(tree, options) {
|
|
|
22
23
|
skipFormat: true,
|
|
23
24
|
});
|
|
24
25
|
}
|
|
26
|
+
const project = (0, devkit_1.readProjectConfiguration)(tree, options.project);
|
|
27
|
+
if (project.projectType === 'application') {
|
|
28
|
+
(0, update_app_editor_tsconfig_excluded_files_1.updateAppEditorTsConfigExcludedFiles)(tree, project);
|
|
29
|
+
}
|
|
25
30
|
if (!options.skipFormat) {
|
|
26
31
|
await (0, devkit_1.formatFiles)(tree);
|
|
27
32
|
}
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.addJest = void 0;
|
|
4
4
|
const devkit_1 = require("@nx/devkit");
|
|
5
|
-
const jest_1 = require("@nx/jest");
|
|
6
5
|
const versions_1 = require("../../utils/versions");
|
|
7
6
|
const version_utils_1 = require("./version-utils");
|
|
8
7
|
async function addJest(tree, options) {
|
|
@@ -10,7 +9,8 @@ async function addJest(tree, options) {
|
|
|
10
9
|
process.env.npm_config_legacy_peer_deps ??= 'true';
|
|
11
10
|
(0, version_utils_1.addDependenciesToPackageJsonIfDontExist)(tree, {}, { 'jest-preset-angular': versions_1.jestPresetAngularVersion });
|
|
12
11
|
}
|
|
13
|
-
|
|
12
|
+
const { configurationGenerator } = (0, devkit_1.ensurePackage)('@nx/jest', versions_1.nxVersion);
|
|
13
|
+
await configurationGenerator(tree, {
|
|
14
14
|
project: options.name,
|
|
15
15
|
setupFile: 'angular',
|
|
16
16
|
supportTsx: false,
|
|
@@ -8,7 +8,10 @@ function addMfEnvToTargetDefaultInputs(tree) {
|
|
|
8
8
|
const mfEnvVar = 'NX_MF_DEV_SERVER_STATIC_REMOTES';
|
|
9
9
|
nxJson.targetDefaults ??= {};
|
|
10
10
|
nxJson.targetDefaults[webpackExecutor] ??= {};
|
|
11
|
-
nxJson.targetDefaults[webpackExecutor].inputs ??= [
|
|
11
|
+
nxJson.targetDefaults[webpackExecutor].inputs ??= [
|
|
12
|
+
'production',
|
|
13
|
+
'^production',
|
|
14
|
+
];
|
|
12
15
|
let mfEnvVarExists = false;
|
|
13
16
|
for (const input of nxJson.targetDefaults[webpackExecutor].inputs) {
|
|
14
17
|
if (typeof input === 'object' && input['env'] === mfEnvVar) {
|
|
@@ -1,35 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getProjectPrefix =
|
|
3
|
+
exports.getProjectPrefix = void 0;
|
|
4
4
|
const devkit_1 = require("@nx/devkit");
|
|
5
|
-
const get_npm_scope_1 = require("@nx/js/src/utils/package-json/get-npm-scope");
|
|
6
|
-
function normalizeNewProjectPrefix(prefix, npmScope, fallbackPrefix) {
|
|
7
|
-
// Prefix needs to be a valid html selector, if npmScope it's not valid, we don't default
|
|
8
|
-
// to it and let it fall through to the Angular schematic to handle it
|
|
9
|
-
// https://github.com/angular/angular-cli/blob/aa9f0528f174e856a4923cb24861fdf6e6f96b48/packages/schematics/angular/component/index.ts#L64
|
|
10
|
-
const htmlSelectorRegex = /^[a-zA-Z][.0-9a-zA-Z]*((:?-[0-9]+)*|(:?-[a-zA-Z][.0-9a-zA-Z]*(:?-[0-9]+)*)*)$/;
|
|
11
|
-
if (prefix) {
|
|
12
|
-
if (!htmlSelectorRegex.test(prefix)) {
|
|
13
|
-
throw new Error('The provided "prefix" is invalid. The prefix must start with a letter, and must contain only alphanumeric characters or dashes.');
|
|
14
|
-
}
|
|
15
|
-
return prefix;
|
|
16
|
-
}
|
|
17
|
-
if (npmScope && !htmlSelectorRegex.test(npmScope)) {
|
|
18
|
-
throw new Error(`The "--prefix" option was not provided, therefore attempted to use the "npmScope" defined in "nx.json" to set the application's selector prefix, but it is invalid.
|
|
19
|
-
|
|
20
|
-
There are two options that can be followed to resolve this issue:
|
|
21
|
-
- Pass a valid "--prefix" option.
|
|
22
|
-
- Update the "npmScope" in "nx.json" (Note: this can be an involved process, as other libraries and applications may need to be updated to match the new scope).
|
|
23
|
-
|
|
24
|
-
If you encountered this error when creating a new Nx Workspace, the workspace name or "npmScope" is invalid to use as the selector prefix for the application being generated.
|
|
25
|
-
|
|
26
|
-
Valid selector prefixes must start with a letter, and must contain only alphanumeric characters or dashes.`);
|
|
27
|
-
}
|
|
28
|
-
return npmScope || fallbackPrefix;
|
|
29
|
-
}
|
|
30
|
-
exports.normalizeNewProjectPrefix = normalizeNewProjectPrefix;
|
|
31
5
|
function getProjectPrefix(tree, project) {
|
|
32
|
-
return (
|
|
33
|
-
.prefix ?? (0, get_npm_scope_1.getNpmScope)(tree));
|
|
6
|
+
return (0, devkit_1.readProjectConfiguration)(tree, project).prefix;
|
|
34
7
|
}
|
|
35
8
|
exports.getProjectPrefix = getProjectPrefix;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import type { Tree } from '@nx/devkit';
|
|
2
1
|
import { names } from '@nx/devkit';
|
|
3
|
-
export declare function buildSelector(
|
|
2
|
+
export declare function buildSelector(name: string, prefix: string | undefined, projectPrefix: string | undefined, casing: keyof Pick<ReturnType<typeof names>, 'fileName' | 'propertyName'>): string;
|
|
3
|
+
export declare function validateHtmlSelector(selector: string): void;
|
|
@@ -1,14 +1,21 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.buildSelector = void 0;
|
|
3
|
+
exports.validateHtmlSelector = exports.buildSelector = void 0;
|
|
4
4
|
const devkit_1 = require("@nx/devkit");
|
|
5
|
-
|
|
6
|
-
function buildSelector(tree, name, prefix, projectPrefix, casing) {
|
|
5
|
+
function buildSelector(name, prefix, projectPrefix, casing) {
|
|
7
6
|
let selector = name;
|
|
8
|
-
prefix ??= projectPrefix
|
|
7
|
+
prefix ??= projectPrefix;
|
|
9
8
|
if (prefix) {
|
|
10
9
|
selector = `${prefix}-${selector}`;
|
|
11
10
|
}
|
|
12
11
|
return (0, devkit_1.names)(selector)[casing];
|
|
13
12
|
}
|
|
14
13
|
exports.buildSelector = buildSelector;
|
|
14
|
+
// https://github.com/angular/angular-cli/blob/main/packages/schematics/angular/utility/validation.ts#L11-L14
|
|
15
|
+
const htmlSelectorRegex = /^[a-zA-Z][.0-9a-zA-Z]*((:?-[0-9]+)*|(:?-[a-zA-Z][.0-9a-zA-Z]*(:?-[0-9]+)*)*)$/;
|
|
16
|
+
function validateHtmlSelector(selector) {
|
|
17
|
+
if (selector && !htmlSelectorRegex.test(selector)) {
|
|
18
|
+
throw new Error(`The selector "${selector}" is invalid.`);
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
exports.validateHtmlSelector = validateHtmlSelector;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.updateAppEditorTsConfigExcludedFiles = void 0;
|
|
4
|
+
const devkit_1 = require("@nx/devkit");
|
|
5
|
+
function updateAppEditorTsConfigExcludedFiles(tree, projectConfig) {
|
|
6
|
+
if (projectConfig.projectType !== 'application') {
|
|
7
|
+
return;
|
|
8
|
+
}
|
|
9
|
+
const editorTsConfigPath = (0, devkit_1.joinPathFragments)(projectConfig.root, 'tsconfig.editor.json');
|
|
10
|
+
const appTsConfigPath = (0, devkit_1.joinPathFragments)(projectConfig.root, 'tsconfig.app.json');
|
|
11
|
+
if (!tree.exists(editorTsConfigPath) || !tree.exists(appTsConfigPath)) {
|
|
12
|
+
return;
|
|
13
|
+
}
|
|
14
|
+
const appTsConfig = (0, devkit_1.readJson)(tree, appTsConfigPath);
|
|
15
|
+
(0, devkit_1.updateJson)(tree, editorTsConfigPath, (json) => {
|
|
16
|
+
const exclude = [...(json.exclude ?? []), ...(appTsConfig.exclude ?? [])];
|
|
17
|
+
if (exclude.length) {
|
|
18
|
+
json.exclude = Array.from(new Set(exclude));
|
|
19
|
+
}
|
|
20
|
+
return json;
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
exports.updateAppEditorTsConfigExcludedFiles = updateAppEditorTsConfigExcludedFiles;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.updateProjectRootTsConfig = exports.extractTsConfigBase = void 0;
|
|
4
|
+
const devkit_1 = require("@nx/devkit");
|
|
5
|
+
const js_1 = require("@nx/js");
|
|
6
|
+
var js_2 = require("@nx/js");
|
|
7
|
+
Object.defineProperty(exports, "extractTsConfigBase", { enumerable: true, get: function () { return js_2.extractTsConfigBase; } });
|
|
8
|
+
function updateProjectRootTsConfig(host, projectRoot, relativePathToRootTsConfig, isRootProject) {
|
|
9
|
+
(0, devkit_1.updateJson)(host, `${projectRoot}/tsconfig.json`, (json) => {
|
|
10
|
+
if (isRootProject) {
|
|
11
|
+
// inline tsconfig.base.json into the project
|
|
12
|
+
json.compileOnSave = false;
|
|
13
|
+
json.compilerOptions = {
|
|
14
|
+
...js_1.tsConfigBaseOptions,
|
|
15
|
+
...json.compilerOptions,
|
|
16
|
+
};
|
|
17
|
+
json.exclude = ['node_modules', 'tmp'];
|
|
18
|
+
delete json.extends;
|
|
19
|
+
}
|
|
20
|
+
else {
|
|
21
|
+
json.extends = relativePathToRootTsConfig;
|
|
22
|
+
}
|
|
23
|
+
return json;
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
exports.updateProjectRootTsConfig = updateProjectRootTsConfig;
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const devkit_1 = require("@nx/devkit");
|
|
4
|
+
async function default_1(tree) {
|
|
5
|
+
if (!isWebpackBrowserUsed(tree)) {
|
|
6
|
+
return;
|
|
7
|
+
}
|
|
8
|
+
ensureTargetDefaultsContainProductionInputs(tree);
|
|
9
|
+
await (0, devkit_1.formatFiles)(tree);
|
|
10
|
+
}
|
|
11
|
+
exports.default = default_1;
|
|
12
|
+
function ensureTargetDefaultsContainProductionInputs(tree) {
|
|
13
|
+
const nxJson = (0, devkit_1.readNxJson)(tree);
|
|
14
|
+
const webpackExecutor = '@nx/angular:webpack-browser';
|
|
15
|
+
const mfEnvVar = 'NX_MF_DEV_SERVER_STATIC_REMOTES';
|
|
16
|
+
nxJson.targetDefaults[webpackExecutor] ??= {};
|
|
17
|
+
nxJson.targetDefaults[webpackExecutor].inputs ??= [
|
|
18
|
+
'production',
|
|
19
|
+
'^production',
|
|
20
|
+
{ env: mfEnvVar },
|
|
21
|
+
];
|
|
22
|
+
if (!nxJson.targetDefaults[webpackExecutor].inputs.includes('production')) {
|
|
23
|
+
nxJson.targetDefaults[webpackExecutor].inputs.push('production');
|
|
24
|
+
}
|
|
25
|
+
if (!nxJson.targetDefaults[webpackExecutor].inputs.includes('^production')) {
|
|
26
|
+
nxJson.targetDefaults[webpackExecutor].inputs.push('^production');
|
|
27
|
+
}
|
|
28
|
+
let mfEnvVarExists = false;
|
|
29
|
+
for (const input of nxJson.targetDefaults[webpackExecutor].inputs) {
|
|
30
|
+
if (typeof input === 'object' && input['env'] === mfEnvVar) {
|
|
31
|
+
mfEnvVarExists = true;
|
|
32
|
+
break;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
if (!mfEnvVarExists) {
|
|
36
|
+
nxJson.targetDefaults[webpackExecutor].inputs.push({ env: mfEnvVar });
|
|
37
|
+
}
|
|
38
|
+
(0, devkit_1.updateNxJson)(tree, nxJson);
|
|
39
|
+
}
|
|
40
|
+
function isWebpackBrowserUsed(tree) {
|
|
41
|
+
const projects = (0, devkit_1.getProjects)(tree);
|
|
42
|
+
for (const project of projects.values()) {
|
|
43
|
+
const targets = project.targets || {};
|
|
44
|
+
for (const [_, target] of Object.entries(targets)) {
|
|
45
|
+
if (target.executor === '@nx/angular:webpack-browser' &&
|
|
46
|
+
(tree.exists((0, devkit_1.joinPathFragments)(project.root, 'module-federation.config.ts')) ||
|
|
47
|
+
tree.exists((0, devkit_1.joinPathFragments)(project.root, 'module-federation.config.js')))) {
|
|
48
|
+
return true;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
return false;
|
|
53
|
+
}
|
|
@@ -3,6 +3,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.withModuleFederationForSSR = void 0;
|
|
4
4
|
const utils_1 = require("./utils");
|
|
5
5
|
async function withModuleFederationForSSR(options) {
|
|
6
|
+
if (global.NX_GRAPH_CREATION) {
|
|
7
|
+
return (config) => config;
|
|
8
|
+
}
|
|
6
9
|
const { sharedLibraries, sharedDependencies, mappedRemotes } = await (0, utils_1.getModuleFederationConfig)(options, {
|
|
7
10
|
isServer: true,
|
|
8
11
|
});
|
|
@@ -4,6 +4,9 @@ exports.withModuleFederation = void 0;
|
|
|
4
4
|
const utils_1 = require("./utils");
|
|
5
5
|
const ModuleFederationPlugin = require("webpack/lib/container/ModuleFederationPlugin");
|
|
6
6
|
async function withModuleFederation(options) {
|
|
7
|
+
if (global.NX_GRAPH_CREATION) {
|
|
8
|
+
return (config) => config;
|
|
9
|
+
}
|
|
7
10
|
const { sharedLibraries, sharedDependencies, mappedRemotes } = await (0, utils_1.getModuleFederationConfig)(options);
|
|
8
11
|
return (config) => ({
|
|
9
12
|
...(config ?? {}),
|
package/src/utils/versions.d.ts
CHANGED
|
@@ -19,7 +19,7 @@ export declare const postcssVersion = "^8.4.5";
|
|
|
19
19
|
export declare const postcssUrlVersion = "~10.1.3";
|
|
20
20
|
export declare const autoprefixerVersion = "^10.4.0";
|
|
21
21
|
export declare const tsNodeVersion = "10.9.1";
|
|
22
|
-
export declare const jestPresetAngularVersion = "~14.0.
|
|
22
|
+
export declare const jestPresetAngularVersion = "~14.0.3";
|
|
23
23
|
export declare const typesNodeVersion = "18.16.9";
|
|
24
24
|
export declare const jasmineMarblesVersion = "^0.9.2";
|
|
25
25
|
export declare const jsoncEslintParserVersion = "^2.1.0";
|
package/src/utils/versions.js
CHANGED
|
@@ -22,7 +22,7 @@ exports.postcssVersion = '^8.4.5';
|
|
|
22
22
|
exports.postcssUrlVersion = '~10.1.3';
|
|
23
23
|
exports.autoprefixerVersion = '^10.4.0';
|
|
24
24
|
exports.tsNodeVersion = '10.9.1';
|
|
25
|
-
exports.jestPresetAngularVersion = '~14.0.
|
|
25
|
+
exports.jestPresetAngularVersion = '~14.0.3';
|
|
26
26
|
exports.typesNodeVersion = '18.16.9';
|
|
27
27
|
exports.jasmineMarblesVersion = '^0.9.2';
|
|
28
28
|
exports.jsoncEslintParserVersion = '^2.1.0';
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import type { Tree } from '@nx/devkit';
|
|
2
|
-
export { extractTsConfigBase } from '@nx/js';
|
|
3
|
-
export declare function createTsConfig(host: Tree, projectRoot: string, type: 'app' | 'lib', options: {
|
|
4
|
-
strict?: boolean;
|
|
5
|
-
style?: string;
|
|
6
|
-
bundler?: string;
|
|
7
|
-
rootProject?: boolean;
|
|
8
|
-
esModuleInterop?: boolean;
|
|
9
|
-
}, relativePathToRootTsConfig: string): void;
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.createTsConfig = exports.extractTsConfigBase = void 0;
|
|
4
|
-
const devkit_1 = require("@nx/devkit");
|
|
5
|
-
const js_1 = require("@nx/js");
|
|
6
|
-
var js_2 = require("@nx/js");
|
|
7
|
-
Object.defineProperty(exports, "extractTsConfigBase", { enumerable: true, get: function () { return js_2.extractTsConfigBase; } });
|
|
8
|
-
function createTsConfig(host, projectRoot, type, options, relativePathToRootTsConfig) {
|
|
9
|
-
const json = {
|
|
10
|
-
compilerOptions: {
|
|
11
|
-
target: 'es2022',
|
|
12
|
-
useDefineForClassFields: false,
|
|
13
|
-
esModuleInterop: options.esModuleInterop ? true : undefined,
|
|
14
|
-
},
|
|
15
|
-
files: [],
|
|
16
|
-
include: [],
|
|
17
|
-
references: [
|
|
18
|
-
{
|
|
19
|
-
path: type === 'app' ? './tsconfig.app.json' : './tsconfig.lib.json',
|
|
20
|
-
},
|
|
21
|
-
],
|
|
22
|
-
};
|
|
23
|
-
// inline tsconfig.base.json into the project
|
|
24
|
-
if (options.rootProject) {
|
|
25
|
-
json.compileOnSave = false;
|
|
26
|
-
json.compilerOptions = { ...js_1.tsConfigBaseOptions, ...json.compilerOptions };
|
|
27
|
-
json.exclude = ['node_modules', 'tmp'];
|
|
28
|
-
}
|
|
29
|
-
else {
|
|
30
|
-
json.extends = relativePathToRootTsConfig;
|
|
31
|
-
}
|
|
32
|
-
(0, devkit_1.writeJson)(host, `${projectRoot}/tsconfig.json`, json);
|
|
33
|
-
}
|
|
34
|
-
exports.createTsConfig = createTsConfig;
|