@nx/angular 16.6.0-beta.0 → 16.6.0-beta.2
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/ng-package.json +2 -1
- package/package.json +11 -12
- package/src/builders/utilities/module-federation.js +18 -5
- package/src/builders/utilities/webpack.js +3 -22
- package/src/executors/ng-packagr-lite/schema.json +5 -7
- package/src/executors/package/schema.d.ts +10 -0
- package/src/executors/package/schema.json +5 -7
- package/src/generators/application/lib/add-unit-test-runner.js +1 -1
- package/src/generators/library/library.js +1 -1
- package/src/generators/storybook-configuration/lib/generate-storybook-configuration.js +1 -1
- package/src/generators/storybook-configuration/schema.d.ts +1 -1
- package/src/generators/storybook-configuration/schema.json +13 -12
- package/src/migrations/update-16-6-0/explicitly-set-projects-to-update-buildable-deps.js +14 -11
package/ng-package.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nx/angular",
|
|
3
|
-
"version": "16.6.0-beta.
|
|
3
|
+
"version": "16.6.0-beta.2",
|
|
4
4
|
"private": false,
|
|
5
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- Upgrading AngularJS applications \n\n- Single Component Application Modules (SCAMs) \n\n- NgRx helpers. \n\n- Utilities for automatic workspace refactoring.",
|
|
6
6
|
"repository": {
|
|
@@ -66,26 +66,25 @@
|
|
|
66
66
|
"migrations": "./migrations.json"
|
|
67
67
|
},
|
|
68
68
|
"dependencies": {
|
|
69
|
-
"@nrwl/angular": "16.6.0-beta.
|
|
70
|
-
"@nx/cypress": "16.6.0-beta.
|
|
71
|
-
"@nx/devkit": "16.6.0-beta.
|
|
72
|
-
"@nx/jest": "16.6.0-beta.
|
|
73
|
-
"@nx/js": "16.6.0-beta.
|
|
74
|
-
"@nx/linter": "16.6.0-beta.
|
|
75
|
-
"@nx/webpack": "16.6.0-beta.
|
|
76
|
-
"@nx/workspace": "16.6.0-beta.
|
|
69
|
+
"@nrwl/angular": "16.6.0-beta.2",
|
|
70
|
+
"@nx/cypress": "16.6.0-beta.2",
|
|
71
|
+
"@nx/devkit": "16.6.0-beta.2",
|
|
72
|
+
"@nx/jest": "16.6.0-beta.2",
|
|
73
|
+
"@nx/js": "16.6.0-beta.2",
|
|
74
|
+
"@nx/linter": "16.6.0-beta.2",
|
|
75
|
+
"@nx/webpack": "16.6.0-beta.2",
|
|
76
|
+
"@nx/workspace": "16.6.0-beta.2",
|
|
77
77
|
"@phenomnomnominal/tsquery": "~5.0.1",
|
|
78
78
|
"@typescript-eslint/type-utils": "^5.36.1",
|
|
79
79
|
"chalk": "^4.1.0",
|
|
80
80
|
"chokidar": "^3.5.1",
|
|
81
81
|
"enquirer": "^2.3.6",
|
|
82
|
+
"find-cache-dir": "^3.3.2",
|
|
82
83
|
"http-server": "^14.1.0",
|
|
83
84
|
"ignore": "^5.0.4",
|
|
84
85
|
"magic-string": "~0.26.2",
|
|
85
86
|
"minimatch": "3.0.5",
|
|
86
87
|
"semver": "7.5.3",
|
|
87
|
-
"ts-node": "10.9.1",
|
|
88
|
-
"tsconfig-paths": "^4.1.2",
|
|
89
88
|
"tslib": "^2.3.0",
|
|
90
89
|
"webpack": "^5.80.0",
|
|
91
90
|
"webpack-merge": "5.7.3"
|
|
@@ -109,5 +108,5 @@
|
|
|
109
108
|
"module": "fesm2022/nx-angular.mjs",
|
|
110
109
|
"typings": "index.d.ts",
|
|
111
110
|
"sideEffects": false,
|
|
112
|
-
"gitHead": "
|
|
111
|
+
"gitHead": "c3d31711b71d648cedeff688fce9334d393b586b"
|
|
113
112
|
}
|
|
@@ -4,6 +4,7 @@ exports.validateDevRemotes = exports.getStaticRemotes = exports.getDynamicRemote
|
|
|
4
4
|
const path_1 = require("path");
|
|
5
5
|
const fs_1 = require("fs");
|
|
6
6
|
const devkit_1 = require("@nx/devkit");
|
|
7
|
+
const tsnode_register_1 = require("@nx/js/src/utils/typescript/tsnode-register");
|
|
7
8
|
function getDynamicRemotes(project, context, workspaceProjects, remotesToSkip, pathToManifestFile = (0, path_1.join)(context.workspaceRoot, project.sourceRoot, 'assets/module-federation.manifest.json')) {
|
|
8
9
|
// check for dynamic remotes
|
|
9
10
|
// we should only check for dynamic based on what we generate
|
|
@@ -40,15 +41,27 @@ function getDynamicRemotes(project, context, workspaceProjects, remotesToSkip, p
|
|
|
40
41
|
return dynamicRemotes;
|
|
41
42
|
}
|
|
42
43
|
exports.getDynamicRemotes = getDynamicRemotes;
|
|
43
|
-
function
|
|
44
|
-
const
|
|
45
|
-
|
|
44
|
+
function getModuleFederationConfig(tsconfigPath, workspaceRoot, projectRoot) {
|
|
45
|
+
const moduleFederationConfigPathJS = (0, path_1.join)(workspaceRoot, projectRoot, 'module-federation.config.js');
|
|
46
|
+
const moduleFederationConfigPathTS = (0, path_1.join)(workspaceRoot, projectRoot, 'module-federation.config.ts');
|
|
47
|
+
let moduleFederationConfigPath = moduleFederationConfigPathJS;
|
|
48
|
+
if ((0, fs_1.existsSync)(moduleFederationConfigPathTS)) {
|
|
49
|
+
(0, tsnode_register_1.tsNodeRegister)(moduleFederationConfigPathTS, tsconfigPath);
|
|
50
|
+
moduleFederationConfigPath = moduleFederationConfigPathTS;
|
|
51
|
+
}
|
|
46
52
|
try {
|
|
47
|
-
|
|
53
|
+
const config = require(moduleFederationConfigPath);
|
|
54
|
+
return {
|
|
55
|
+
mfeConfig: config.default || config,
|
|
56
|
+
mfConfigPath: moduleFederationConfigPath,
|
|
57
|
+
};
|
|
48
58
|
}
|
|
49
59
|
catch (_a) {
|
|
50
|
-
throw new Error(`Could not load ${
|
|
60
|
+
throw new Error(`Could not load ${moduleFederationConfigPath}. Was this project generated with "@nx/angular:host"?`);
|
|
51
61
|
}
|
|
62
|
+
}
|
|
63
|
+
function getStaticRemotes(project, context, workspaceProjects, remotesToSkip) {
|
|
64
|
+
const { mfeConfig, mfConfigPath } = getModuleFederationConfig(project.targets.build.options.tsConfig, context.workspaceRoot, project.root);
|
|
52
65
|
const remotesConfig = Array.isArray(mfeConfig.remotes) && mfeConfig.remotes.length > 0
|
|
53
66
|
? mfeConfig.remotes
|
|
54
67
|
: [];
|
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.resolveIndexHtmlTransformer = exports.resolveCustomWebpackConfig = exports.mergeCustomWebpackConfig = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const webpack_merge_1 = require("webpack-merge");
|
|
6
|
+
const tsnode_register_1 = require("@nx/js/src/utils/typescript/tsnode-register");
|
|
6
7
|
function mergeCustomWebpackConfig(baseWebpackConfig, pathToWebpackConfig, options, target) {
|
|
7
8
|
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
8
9
|
const customWebpackConfiguration = resolveCustomWebpackConfig(pathToWebpackConfig, options.tsConfig);
|
|
@@ -23,7 +24,7 @@ function mergeCustomWebpackConfig(baseWebpackConfig, pathToWebpackConfig, option
|
|
|
23
24
|
exports.mergeCustomWebpackConfig = mergeCustomWebpackConfig;
|
|
24
25
|
function resolveCustomWebpackConfig(path, tsConfig) {
|
|
25
26
|
var _a;
|
|
26
|
-
tsNodeRegister(path, tsConfig);
|
|
27
|
+
(0, tsnode_register_1.tsNodeRegister)(path, tsConfig);
|
|
27
28
|
const customWebpackConfig = require(path);
|
|
28
29
|
// If the user provides a configuration in TS file
|
|
29
30
|
// then there are 2 cases for exporting an object. The first one is:
|
|
@@ -35,29 +36,9 @@ function resolveCustomWebpackConfig(path, tsConfig) {
|
|
|
35
36
|
exports.resolveCustomWebpackConfig = resolveCustomWebpackConfig;
|
|
36
37
|
function resolveIndexHtmlTransformer(path, tsConfig, target) {
|
|
37
38
|
var _a;
|
|
38
|
-
tsNodeRegister(path, tsConfig);
|
|
39
|
+
(0, tsnode_register_1.tsNodeRegister)(path, tsConfig);
|
|
39
40
|
const indexTransformer = require(path);
|
|
40
41
|
const transform = (_a = indexTransformer.default) !== null && _a !== void 0 ? _a : indexTransformer;
|
|
41
42
|
return (indexHtml) => transform(target, indexHtml);
|
|
42
43
|
}
|
|
43
44
|
exports.resolveIndexHtmlTransformer = resolveIndexHtmlTransformer;
|
|
44
|
-
function tsNodeRegister(file, tsConfig) {
|
|
45
|
-
if (!(file === null || file === void 0 ? void 0 : file.endsWith('.ts')))
|
|
46
|
-
return;
|
|
47
|
-
// Register TS compiler lazily
|
|
48
|
-
require('ts-node').register({
|
|
49
|
-
project: tsConfig,
|
|
50
|
-
compilerOptions: {
|
|
51
|
-
module: 'CommonJS',
|
|
52
|
-
types: ['node'],
|
|
53
|
-
},
|
|
54
|
-
});
|
|
55
|
-
if (!tsConfig)
|
|
56
|
-
return;
|
|
57
|
-
// Register paths in tsConfig
|
|
58
|
-
const tsconfigPaths = require('tsconfig-paths');
|
|
59
|
-
const { absoluteBaseUrl: baseUrl, paths } = tsconfigPaths.loadConfig(tsConfig);
|
|
60
|
-
if (baseUrl && paths) {
|
|
61
|
-
tsconfigPaths.register({ baseUrl, paths });
|
|
62
|
-
}
|
|
63
|
-
}
|
|
@@ -13,11 +13,7 @@
|
|
|
13
13
|
},
|
|
14
14
|
{
|
|
15
15
|
"name": "Updating Project Dependencies for Buildable Library",
|
|
16
|
-
"keys": [
|
|
17
|
-
"project",
|
|
18
|
-
"updateBuildableProjectDepsInPackageJson",
|
|
19
|
-
"buildableProjectDepsInPackageJsonType"
|
|
20
|
-
]
|
|
16
|
+
"keys": ["project"]
|
|
21
17
|
}
|
|
22
18
|
],
|
|
23
19
|
"properties": {
|
|
@@ -40,13 +36,15 @@
|
|
|
40
36
|
"updateBuildableProjectDepsInPackageJson": {
|
|
41
37
|
"type": "boolean",
|
|
42
38
|
"description": "Whether to update the buildable project dependencies in the build output package.json.",
|
|
43
|
-
"default": false
|
|
39
|
+
"default": false,
|
|
40
|
+
"x-deprecated": "Configure the project to use the '@nx/dependency-checks' ESLint rule instead (https://nx.dev/packages/eslint-plugin/documents/dependency-checks). It will be removed in v17."
|
|
44
41
|
},
|
|
45
42
|
"buildableProjectDepsInPackageJsonType": {
|
|
46
43
|
"type": "string",
|
|
47
44
|
"description": "When `updateBuildableProjectDepsInPackageJson` is `true`, this adds dependencies to either `peerDependencies` or `dependencies`.",
|
|
48
45
|
"enum": ["dependencies", "peerDependencies"],
|
|
49
|
-
"default": "peerDependencies"
|
|
46
|
+
"default": "peerDependencies",
|
|
47
|
+
"x-deprecated": "Configure the '@nx/dependency-checks' ESLint rule instead (https://nx.dev/packages/eslint-plugin/documents/dependency-checks). It will be removed in v17."
|
|
50
48
|
},
|
|
51
49
|
"tailwindConfig": {
|
|
52
50
|
"type": "string",
|
|
@@ -1,8 +1,18 @@
|
|
|
1
1
|
export interface BuildAngularLibraryExecutorOptions {
|
|
2
2
|
project: string;
|
|
3
|
+
/**
|
|
4
|
+
* @deprecated Configure the project to use the `@nx/dependency-checks` ESLint
|
|
5
|
+
* rule instead (https://nx.dev/packages/eslint-plugin/documents/dependency-checks).
|
|
6
|
+
* It will be removed in v17.
|
|
7
|
+
*/
|
|
3
8
|
buildableProjectDepsInPackageJsonType?: 'dependencies' | 'peerDependencies';
|
|
4
9
|
tailwindConfig?: string;
|
|
5
10
|
tsConfig?: string;
|
|
11
|
+
/**
|
|
12
|
+
* @deprecated Configure the project to use the `@nx/dependency-checks` ESLint
|
|
13
|
+
* rule instead (https://nx.dev/packages/eslint-plugin/documents/dependency-checks).
|
|
14
|
+
* It will be removed in v17.
|
|
15
|
+
*/
|
|
6
16
|
updateBuildableProjectDepsInPackageJson?: boolean;
|
|
7
17
|
watch?: boolean;
|
|
8
18
|
}
|
|
@@ -13,11 +13,7 @@
|
|
|
13
13
|
},
|
|
14
14
|
{
|
|
15
15
|
"name": "Updating Project Dependencies for Publishable Library",
|
|
16
|
-
"keys": [
|
|
17
|
-
"project",
|
|
18
|
-
"updateBuildableProjectDepsInPackageJson",
|
|
19
|
-
"buildableProjectDepsInPackageJsonType"
|
|
20
|
-
]
|
|
16
|
+
"keys": ["project"]
|
|
21
17
|
}
|
|
22
18
|
],
|
|
23
19
|
"properties": {
|
|
@@ -40,13 +36,15 @@
|
|
|
40
36
|
"updateBuildableProjectDepsInPackageJson": {
|
|
41
37
|
"type": "boolean",
|
|
42
38
|
"description": "Whether to update the buildable project dependencies in the build output package.json.",
|
|
43
|
-
"default": false
|
|
39
|
+
"default": false,
|
|
40
|
+
"x-deprecated": "Configure the project to use the '@nx/dependency-checks' ESLint rule instead (https://nx.dev/packages/eslint-plugin/documents/dependency-checks). It will be removed in v17."
|
|
44
41
|
},
|
|
45
42
|
"buildableProjectDepsInPackageJsonType": {
|
|
46
43
|
"type": "string",
|
|
47
44
|
"description": "When `updateBuildableProjectDepsInPackageJson` is `true`, this adds dependencies to either `peerDependencies` or `dependencies`.",
|
|
48
45
|
"enum": ["dependencies", "peerDependencies"],
|
|
49
|
-
"default": "peerDependencies"
|
|
46
|
+
"default": "peerDependencies",
|
|
47
|
+
"x-deprecated": "Configure the project to use the '@nx/dependency-checks' ESLint rule instead (https://nx.dev/packages/eslint-plugin/documents/dependency-checks). It will be removed in v17."
|
|
50
48
|
},
|
|
51
49
|
"tailwindConfig": {
|
|
52
50
|
"type": "string",
|
|
@@ -8,7 +8,7 @@ const test_runners_1 = require("../../../utils/test-runners");
|
|
|
8
8
|
function addUnitTestRunner(host, options) {
|
|
9
9
|
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
10
10
|
if (options.unitTestRunner === test_runners_1.UnitTestRunner.Jest) {
|
|
11
|
-
yield (0, jest_1.
|
|
11
|
+
yield (0, jest_1.configurationGenerator)(host, {
|
|
12
12
|
project: options.name,
|
|
13
13
|
setupFile: 'angular',
|
|
14
14
|
supportTsx: false,
|
|
@@ -81,7 +81,7 @@ exports.libraryGenerator = libraryGenerator;
|
|
|
81
81
|
function addUnitTestRunner(host, options) {
|
|
82
82
|
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
83
83
|
if (options.unitTestRunner === 'jest') {
|
|
84
|
-
yield (0, jest_1.
|
|
84
|
+
yield (0, jest_1.configurationGenerator)(host, {
|
|
85
85
|
project: options.name,
|
|
86
86
|
setupFile: 'angular',
|
|
87
87
|
supportTsx: false,
|
|
@@ -14,7 +14,7 @@ function generateStorybookConfiguration(tree, options) {
|
|
|
14
14
|
linter: options.linter,
|
|
15
15
|
cypressDirectory: options.cypressDirectory,
|
|
16
16
|
tsConfiguration: options.tsConfiguration,
|
|
17
|
-
|
|
17
|
+
interactionTests: options.interactionTests,
|
|
18
18
|
configureStaticServe: options.configureStaticServe,
|
|
19
19
|
skipFormat: true,
|
|
20
20
|
});
|
|
@@ -18,12 +18,18 @@
|
|
|
18
18
|
"x-dropdown": "projects",
|
|
19
19
|
"x-priority": "important"
|
|
20
20
|
},
|
|
21
|
+
"interactionTests": {
|
|
22
|
+
"type": "boolean",
|
|
23
|
+
"description": "Set up Storybook interaction tests.",
|
|
24
|
+
"x-prompt": "Do you want to set up Storybook interaction tests?",
|
|
25
|
+
"alias": ["configureTestRunner"],
|
|
26
|
+
"x-priority": "important",
|
|
27
|
+
"default": true
|
|
28
|
+
},
|
|
21
29
|
"configureCypress": {
|
|
22
30
|
"type": "boolean",
|
|
23
31
|
"description": "Specifies whether to configure Cypress or not.",
|
|
24
|
-
"x-
|
|
25
|
-
"default": true,
|
|
26
|
-
"x-priority": "important"
|
|
32
|
+
"x-deprecated": "Please use Storybook interaction tests instead."
|
|
27
33
|
},
|
|
28
34
|
"generateStories": {
|
|
29
35
|
"type": "boolean",
|
|
@@ -35,9 +41,7 @@
|
|
|
35
41
|
"generateCypressSpecs": {
|
|
36
42
|
"type": "boolean",
|
|
37
43
|
"description": "Specifies whether to automatically generate test files in the generated Cypress e2e app.",
|
|
38
|
-
"x-
|
|
39
|
-
"default": true,
|
|
40
|
-
"x-priority": "important"
|
|
44
|
+
"x-deprecated": "Please use Storybook interaction tests instead."
|
|
41
45
|
},
|
|
42
46
|
"configureStaticServe": {
|
|
43
47
|
"type": "boolean",
|
|
@@ -48,7 +52,8 @@
|
|
|
48
52
|
},
|
|
49
53
|
"cypressDirectory": {
|
|
50
54
|
"type": "string",
|
|
51
|
-
"description": "A directory where the Cypress project will be placed. Placed at the root by default."
|
|
55
|
+
"description": "A directory where the Cypress project will be placed. Placed at the root by default.",
|
|
56
|
+
"x-deprecated": "Please use Storybook interaction tests instead."
|
|
52
57
|
},
|
|
53
58
|
"linter": {
|
|
54
59
|
"description": "The tool to use for running lint checks.",
|
|
@@ -59,7 +64,7 @@
|
|
|
59
64
|
"tsConfiguration": {
|
|
60
65
|
"type": "boolean",
|
|
61
66
|
"description": "Configure your project with TypeScript. Generate main.ts and preview.ts files, instead of main.js and preview.js.",
|
|
62
|
-
"default":
|
|
67
|
+
"default": true,
|
|
63
68
|
"x-priority": "important"
|
|
64
69
|
},
|
|
65
70
|
"skipFormat": {
|
|
@@ -82,10 +87,6 @@
|
|
|
82
87
|
"**/**/src/**/*.other.*",
|
|
83
88
|
"libs/my-lib/src/not-stories/**,**/**/src/**/*.other.*,apps/my-app/**/*.something.ts"
|
|
84
89
|
]
|
|
85
|
-
},
|
|
86
|
-
"configureTestRunner": {
|
|
87
|
-
"type": "boolean",
|
|
88
|
-
"description": "Add a Storybook Test-Runner target."
|
|
89
90
|
}
|
|
90
91
|
},
|
|
91
92
|
"additionalProperties": false,
|
|
@@ -9,26 +9,29 @@ const executors = new Set([
|
|
|
9
9
|
'@nrwl/angular:package',
|
|
10
10
|
]);
|
|
11
11
|
function default_1(tree) {
|
|
12
|
+
var _a;
|
|
13
|
+
var _b;
|
|
12
14
|
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
15
|
+
// use project graph to get the expanded target configurations
|
|
16
|
+
const projectGraph = yield (0, devkit_1.createProjectGraphAsync)();
|
|
17
|
+
for (const [projectName, { data: projectData }] of Object.entries(projectGraph.nodes)) {
|
|
18
|
+
if (projectData.projectType !== 'library') {
|
|
16
19
|
continue;
|
|
17
20
|
}
|
|
18
|
-
|
|
19
|
-
for (const [, target] of Object.entries(project.targets || {})) {
|
|
21
|
+
for (const [targetName, target] of Object.entries(projectData.targets || {})) {
|
|
20
22
|
if (!executors.has(target.executor)) {
|
|
21
23
|
continue;
|
|
22
24
|
}
|
|
23
|
-
if (target.options
|
|
25
|
+
if (!target.options ||
|
|
24
26
|
target.options.updateBuildableProjectDepsInPackageJson === undefined) {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
+
// read the project configuration to write the explicit project configuration
|
|
28
|
+
// and avoid writing the expanded target configuration
|
|
29
|
+
const project = (0, devkit_1.readProjectConfiguration)(tree, projectName);
|
|
30
|
+
(_a = (_b = project.targets[targetName]).options) !== null && _a !== void 0 ? _a : (_b.options = {});
|
|
31
|
+
project.targets[targetName].options.updateBuildableProjectDepsInPackageJson = true;
|
|
32
|
+
(0, devkit_1.updateProjectConfiguration)(tree, projectName, project);
|
|
27
33
|
}
|
|
28
34
|
}
|
|
29
|
-
if (updated) {
|
|
30
|
-
(0, devkit_1.updateProjectConfiguration)(tree, projectName, project);
|
|
31
|
-
}
|
|
32
35
|
}
|
|
33
36
|
yield (0, devkit_1.formatFiles)(tree);
|
|
34
37
|
});
|