@nrwl/angular 14.0.0-beta.0 → 14.0.0-beta.3
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/.eslintrc.json +26 -0
- package/executors.json +20 -0
- package/generators.d.ts +2 -2
- package/generators.js +2 -2
- package/generators.js.map +1 -1
- package/generators.json +16 -20
- package/migrations.json +6 -0
- package/ng-package.json +2 -0
- package/package.json +9 -6
- package/src/builders/module-federation-dev-server/module-federation-dev-server.impl.d.ts +6 -0
- package/src/builders/module-federation-dev-server/module-federation-dev-server.impl.js +44 -0
- package/src/builders/module-federation-dev-server/module-federation-dev-server.impl.js.map +1 -0
- package/src/builders/module-federation-dev-server/schema.d.ts +21 -0
- package/src/builders/module-federation-dev-server/schema.json +115 -0
- package/src/executors/file-server/compat.d.ts +2 -0
- package/src/executors/file-server/compat.js +6 -0
- package/src/executors/file-server/compat.js.map +1 -0
- package/src/executors/file-server/file-server.impl.d.ts +8 -0
- package/src/executors/file-server/file-server.impl.js +161 -0
- package/src/executors/file-server/file-server.impl.js.map +1 -0
- package/src/executors/file-server/schema.d.ts +14 -0
- package/src/executors/file-server/schema.json +67 -0
- package/src/generators/application/files/tsconfig.editor.json__tpl__ +1 -7
- package/src/generators/application/lib/update-editor-tsconfig.d.ts +1 -1
- package/src/generators/application/lib/update-editor-tsconfig.js +14 -2
- package/src/generators/application/lib/update-editor-tsconfig.js.map +1 -1
- package/src/generators/application/schema.json +5 -5
- package/src/generators/convert-to-with-mf/convert-to-with-mf.js +4 -4
- package/src/generators/convert-to-with-mf/convert-to-with-mf.js.map +1 -1
- package/src/generators/convert-to-with-mf/lib/write-new-webpack-config.js +1 -1
- package/src/generators/{mfe-host/mfe-host.compat.d.ts → host/host.compat.d.ts} +0 -0
- package/src/generators/host/host.compat.js +6 -0
- package/src/generators/host/host.compat.js.map +1 -0
- package/src/generators/host/host.d.ts +3 -0
- package/src/generators/host/host.js +34 -0
- package/src/generators/host/host.js.map +1 -0
- package/src/generators/{mfe-host → host}/schema.d.ts +0 -0
- package/src/generators/{mfe-host → host}/schema.json +5 -5
- package/src/generators/karma/karma.js +1 -0
- package/src/generators/karma/karma.js.map +1 -1
- package/src/generators/library/library.js +2 -7
- package/src/generators/library/library.js.map +1 -1
- package/src/generators/ng-add/migrate-from-angular-cli.js +9 -6
- package/src/generators/ng-add/migrate-from-angular-cli.js.map +1 -1
- package/src/generators/ng-add/schema.d.ts +0 -1
- package/src/generators/ng-add/schema.json +0 -7
- package/src/generators/ng-add/utilities/app.migrator.d.ts +1 -3
- package/src/generators/ng-add/utilities/app.migrator.js +27 -58
- package/src/generators/ng-add/utilities/app.migrator.js.map +1 -1
- package/src/generators/ng-add/utilities/{e2e-project.migrator.d.ts → e2e.migrator.d.ts} +0 -0
- package/src/generators/ng-add/utilities/{e2e-project.migrator.js → e2e.migrator.js} +32 -11
- package/src/generators/ng-add/utilities/e2e.migrator.js.map +1 -0
- package/src/generators/ng-add/utilities/lib.migrator.d.ts +26 -0
- package/src/generators/ng-add/utilities/lib.migrator.js +351 -0
- package/src/generators/ng-add/utilities/lib.migrator.js.map +1 -0
- package/src/generators/ng-add/utilities/normalize-options.js +5 -2
- package/src/generators/ng-add/utilities/normalize-options.js.map +1 -1
- package/src/generators/ng-add/utilities/project.migrator.d.ts +11 -2
- package/src/generators/ng-add/utilities/project.migrator.js +82 -4
- package/src/generators/ng-add/utilities/project.migrator.js.map +1 -1
- package/src/generators/ng-add/utilities/types.d.ts +9 -1
- package/src/generators/ng-add/utilities/validate-projects.d.ts +2 -0
- package/src/generators/ng-add/utilities/validate-projects.js +46 -0
- package/src/generators/ng-add/utilities/validate-projects.js.map +1 -0
- package/src/generators/ng-add/utilities/validation-logging.d.ts +2 -0
- package/src/generators/ng-add/utilities/validation-logging.js +20 -0
- package/src/generators/ng-add/utilities/validation-logging.js.map +1 -0
- package/src/generators/ng-add/utilities/workspace.d.ts +1 -1
- package/src/generators/ng-add/utilities/workspace.js +13 -17
- package/src/generators/ng-add/utilities/workspace.js.map +1 -1
- package/src/generators/{mfe-remote/mfe-remote.compat.d.ts → remote/remote.compat.d.ts} +0 -0
- package/src/generators/remote/remote.compat.js +6 -0
- package/src/generators/remote/remote.compat.js.map +1 -0
- package/src/generators/remote/remote.d.ts +3 -0
- package/src/generators/remote/remote.js +76 -0
- package/src/generators/remote/remote.js.map +1 -0
- package/src/generators/{mfe-remote → remote}/schema.d.ts +0 -0
- package/src/generators/{mfe-remote → remote}/schema.json +5 -5
- package/src/generators/setup-mfe/files/webpack/{mfe.config.js__tmpl__ → module-federation.config.js__tmpl__} +0 -0
- package/src/generators/setup-mfe/files/webpack/webpack.config.js__tmpl__ +1 -1
- package/src/generators/setup-mfe/files/webpack/webpack.prod.config.js__tmpl__ +1 -1
- package/src/generators/setup-mfe/lib/add-remote-to-host.js +10 -10
- package/src/generators/setup-mfe/lib/add-remote-to-host.js.map +1 -1
- package/src/generators/setup-mfe/lib/fix-bootstrap.js +3 -3
- package/src/generators/setup-mfe/lib/fix-bootstrap.js.map +1 -1
- package/src/generators/setup-mfe/lib/generate-config.js +1 -1
- package/src/generators/setup-mfe/lib/generate-config.js.map +1 -1
- package/src/generators/setup-mfe/lib/setup-host-if-dynamic.js +3 -3
- package/src/generators/setup-mfe/lib/setup-host-if-dynamic.js.map +1 -1
- package/src/generators/setup-mfe/lib/setup-serve-target.js +18 -19
- package/src/generators/setup-mfe/lib/setup-serve-target.js.map +1 -1
- package/src/generators/utils/dependencies.d.ts +2 -0
- package/src/generators/utils/dependencies.js +15 -0
- package/src/generators/utils/dependencies.js.map +1 -0
- package/src/migrations/update-13-8-1/add-cypress-mfe-workaround.js +2 -2
- package/src/migrations/update-13-8-1/add-cypress-mfe-workaround.js.map +1 -1
- package/src/migrations/update-14-0-0/rename-mf-config.d.ts +2 -0
- package/src/migrations/update-14-0-0/rename-mf-config.js +27 -0
- package/src/migrations/update-14-0-0/rename-mf-config.js.map +1 -0
- package/src/utils/{get-mfe-projects.d.ts → get-mf-projects.d.ts} +1 -1
- package/src/utils/{get-mfe-projects.js → get-mf-projects.js} +4 -4
- package/src/utils/get-mf-projects.js.map +1 -0
- package/src/utils/mfe/mfe-webpack.js +45 -8
- package/src/utils/mfe/mfe-webpack.js.map +1 -1
- package/src/utils/versions.js +1 -1
- package/src/generators/mfe-host/mfe-host.compat.js +0 -6
- package/src/generators/mfe-host/mfe-host.compat.js.map +0 -1
- package/src/generators/mfe-host/mfe-host.d.ts +0 -3
- package/src/generators/mfe-host/mfe-host.js +0 -22
- package/src/generators/mfe-host/mfe-host.js.map +0 -1
- package/src/generators/mfe-remote/mfe-remote.compat.js +0 -6
- package/src/generators/mfe-remote/mfe-remote.compat.js.map +0 -1
- package/src/generators/mfe-remote/mfe-remote.d.ts +0 -3
- package/src/generators/mfe-remote/mfe-remote.js +0 -31
- package/src/generators/mfe-remote/mfe-remote.js.map +0 -1
- package/src/generators/ng-add/utilities/e2e-project.migrator.js.map +0 -1
- package/src/utils/get-mfe-projects.js.map +0 -1
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
{
|
|
2
|
+
"title": "File Server",
|
|
3
|
+
"description": "Serve a web application from a folder.",
|
|
4
|
+
"type": "object",
|
|
5
|
+
"cli": "nx",
|
|
6
|
+
"properties": {
|
|
7
|
+
"buildTarget": {
|
|
8
|
+
"type": "string",
|
|
9
|
+
"description": "Target which builds the application."
|
|
10
|
+
},
|
|
11
|
+
"parallel": {
|
|
12
|
+
"type": "boolean",
|
|
13
|
+
"description": "Build the target in parallel.",
|
|
14
|
+
"default": true
|
|
15
|
+
},
|
|
16
|
+
"maxParallel": {
|
|
17
|
+
"type": "number",
|
|
18
|
+
"description": "Max number of parallel jobs."
|
|
19
|
+
},
|
|
20
|
+
"port": {
|
|
21
|
+
"type": "number",
|
|
22
|
+
"description": "Port to listen on.",
|
|
23
|
+
"default": 4200
|
|
24
|
+
},
|
|
25
|
+
"host": {
|
|
26
|
+
"type": "string",
|
|
27
|
+
"description": "Host to listen on.",
|
|
28
|
+
"default": "localhost"
|
|
29
|
+
},
|
|
30
|
+
"ssl": {
|
|
31
|
+
"type": "boolean",
|
|
32
|
+
"description": "Serve using `HTTPS`.",
|
|
33
|
+
"default": false
|
|
34
|
+
},
|
|
35
|
+
"sslKey": {
|
|
36
|
+
"type": "string",
|
|
37
|
+
"description": "SSL key to use for serving `HTTPS`."
|
|
38
|
+
},
|
|
39
|
+
"sslCert": {
|
|
40
|
+
"type": "string",
|
|
41
|
+
"description": "SSL certificate to use for serving `HTTPS`."
|
|
42
|
+
},
|
|
43
|
+
"proxyUrl": {
|
|
44
|
+
"type": "string",
|
|
45
|
+
"description": "URL to proxy unhandled requests to."
|
|
46
|
+
},
|
|
47
|
+
"proxyOptions": {
|
|
48
|
+
"type": "object",
|
|
49
|
+
"description": "Options for the proxy used by `http-server`.",
|
|
50
|
+
"default": {},
|
|
51
|
+
"properties": {
|
|
52
|
+
"secure": {
|
|
53
|
+
"type": "boolean",
|
|
54
|
+
"default": false
|
|
55
|
+
}
|
|
56
|
+
},
|
|
57
|
+
"additionalProperties": true
|
|
58
|
+
},
|
|
59
|
+
"watch": {
|
|
60
|
+
"type": "boolean",
|
|
61
|
+
"description": "Watch for file changes.",
|
|
62
|
+
"default": false
|
|
63
|
+
}
|
|
64
|
+
},
|
|
65
|
+
"additionalProperties": false,
|
|
66
|
+
"required": ["buildTarget"]
|
|
67
|
+
}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { Tree } from '@nrwl/devkit';
|
|
2
2
|
import type { NormalizedSchema } from './normalized-schema';
|
|
3
|
-
export declare function updateEditorTsConfig(
|
|
3
|
+
export declare function updateEditorTsConfig(tree: Tree, options: NormalizedSchema): void;
|
|
@@ -2,9 +2,21 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.updateEditorTsConfig = void 0;
|
|
4
4
|
const devkit_1 = require("@nrwl/devkit");
|
|
5
|
-
function
|
|
5
|
+
function getCompilerOptionsTypes(tsConfig) {
|
|
6
|
+
var _a, _b;
|
|
7
|
+
return (_b = (_a = tsConfig === null || tsConfig === void 0 ? void 0 : tsConfig.compilerOptions) === null || _a === void 0 ? void 0 : _a.types) !== null && _b !== void 0 ? _b : [];
|
|
8
|
+
}
|
|
9
|
+
function updateEditorTsConfig(tree, options) {
|
|
10
|
+
const types = getCompilerOptionsTypes((0, devkit_1.readJson)(tree, (0, devkit_1.joinPathFragments)(options.appProjectRoot, 'tsconfig.app.json')));
|
|
11
|
+
if (options.unitTestRunner !== 'none') {
|
|
12
|
+
types.concat(getCompilerOptionsTypes((0, devkit_1.readJson)(tree, (0, devkit_1.joinPathFragments)(options.appProjectRoot, 'tsconfig.spec.json'))));
|
|
13
|
+
}
|
|
14
|
+
(0, devkit_1.updateJson)(tree, (0, devkit_1.joinPathFragments)(options.appProjectRoot, 'tsconfig.editor.json'), (json) => {
|
|
15
|
+
json.compilerOptions.types = types;
|
|
16
|
+
return json;
|
|
17
|
+
});
|
|
6
18
|
// This should be the last tsconfig references so it's not in the template
|
|
7
|
-
(0, devkit_1.updateJson)(
|
|
19
|
+
(0, devkit_1.updateJson)(tree, (0, devkit_1.joinPathFragments)(options.appProjectRoot, 'tsconfig.json'), (json) => {
|
|
8
20
|
json.references.push({
|
|
9
21
|
path: './tsconfig.editor.json',
|
|
10
22
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"update-editor-tsconfig.js","sourceRoot":"","sources":["../../../../../../../packages/angular/src/generators/application/lib/update-editor-tsconfig.ts"],"names":[],"mappings":";;;AAGA,
|
|
1
|
+
{"version":3,"file":"update-editor-tsconfig.js","sourceRoot":"","sources":["../../../../../../../packages/angular/src/generators/application/lib/update-editor-tsconfig.ts"],"names":[],"mappings":";;;AAGA,yCAAuE;AAMvE,SAAS,uBAAuB,CAAC,QAAkB;;IACjD,OAAO,MAAA,MAAA,QAAQ,aAAR,QAAQ,uBAAR,QAAQ,CAAE,eAAe,0CAAE,KAAK,mCAAI,EAAE,CAAC;AAChD,CAAC;AAED,SAAgB,oBAAoB,CAAC,IAAU,EAAE,OAAyB;IACxE,MAAM,KAAK,GAAG,uBAAuB,CACnC,IAAA,iBAAQ,EACN,IAAI,EACJ,IAAA,0BAAiB,EAAC,OAAO,CAAC,cAAc,EAAE,mBAAmB,CAAC,CAC/D,CACF,CAAC;IAEF,IAAI,OAAO,CAAC,cAAc,KAAK,MAAM,EAAE;QACrC,KAAK,CAAC,MAAM,CACV,uBAAuB,CACrB,IAAA,iBAAQ,EACN,IAAI,EACJ,IAAA,0BAAiB,EAAC,OAAO,CAAC,cAAc,EAAE,oBAAoB,CAAC,CAChE,CACF,CACF,CAAC;KACH;IAED,IAAA,mBAAU,EACR,IAAI,EACJ,IAAA,0BAAiB,EAAC,OAAO,CAAC,cAAc,EAAE,sBAAsB,CAAC,EACjE,CAAC,IAAI,EAAE,EAAE;QACP,IAAI,CAAC,eAAe,CAAC,KAAK,GAAG,KAAK,CAAC;QACnC,OAAO,IAAI,CAAC;IACd,CAAC,CACF,CAAC;IAEF,0EAA0E;IAC1E,IAAA,mBAAU,EACR,IAAI,EACJ,IAAA,0BAAiB,EAAC,OAAO,CAAC,cAAc,EAAE,eAAe,CAAC,EAC1D,CAAC,IAAI,EAAE,EAAE;QACP,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC;YACnB,IAAI,EAAE,wBAAwB;SAC/B,CAAC,CAAC;QACH,OAAO,IAAI,CAAC;IACd,CAAC,CACF,CAAC;AACJ,CAAC;AAvCD,oDAuCC"}
|
|
@@ -132,21 +132,21 @@
|
|
|
132
132
|
"description": "Generate a Module Federation configuration for the application",
|
|
133
133
|
"type": "boolean",
|
|
134
134
|
"default": false,
|
|
135
|
-
"x-deprecated": "Use the `
|
|
135
|
+
"x-deprecated": "Use the `host` or `remote` generators instead. Support for generating Module Federation applications using the application generator will be removed in an upcoming version."
|
|
136
136
|
},
|
|
137
137
|
"mfeType": {
|
|
138
138
|
"type": "string",
|
|
139
139
|
"enum": ["host", "remote"],
|
|
140
140
|
"description": "Type of application to generate the Module Federation configuration for.",
|
|
141
141
|
"default": "remote",
|
|
142
|
-
"x-deprecated": "Use the `
|
|
142
|
+
"x-deprecated": "Use the `host` or `remote` generators instead. Support for generating Module Federation applications using the application generator will be removed in an upcoming version."
|
|
143
143
|
},
|
|
144
144
|
"federationType": {
|
|
145
145
|
"type": "string",
|
|
146
146
|
"enum": ["static", "dynamic"],
|
|
147
147
|
"description": "Use either Static or Dynamic Module Federation pattern for the application.",
|
|
148
148
|
"default": "static",
|
|
149
|
-
"x-deprecated": "Use the `
|
|
149
|
+
"x-deprecated": "Use the `host` or `remote` generators instead. Support for generating Module Federation applications using the application generator will be removed in an upcoming version."
|
|
150
150
|
},
|
|
151
151
|
"port": {
|
|
152
152
|
"type": "number",
|
|
@@ -155,12 +155,12 @@
|
|
|
155
155
|
"remotes": {
|
|
156
156
|
"type": "array",
|
|
157
157
|
"description": "A list of remote application names that the host application should consume.",
|
|
158
|
-
"x-deprecated": "Use the `
|
|
158
|
+
"x-deprecated": "Use the `host` or `remote` generators instead. Support for generating Module Federation applications using the application generator will be removed in an upcoming version."
|
|
159
159
|
},
|
|
160
160
|
"host": {
|
|
161
161
|
"type": "string",
|
|
162
162
|
"description": "The name of the host application that the remote application will be consumed by.",
|
|
163
|
-
"x-deprecated": "Use the `
|
|
163
|
+
"x-deprecated": "Use the `host` or `remote` generators instead. Support for generating Module Federation applications using the application generator will be removed in an upcoming version."
|
|
164
164
|
},
|
|
165
165
|
"setParserOptionsProject": {
|
|
166
166
|
"type": "boolean",
|
|
@@ -3,11 +3,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
const tslib_1 = require("tslib");
|
|
4
4
|
const devkit_1 = require("@nrwl/devkit");
|
|
5
5
|
const devkit_2 = require("@nrwl/devkit");
|
|
6
|
-
const
|
|
6
|
+
const get_mf_projects_1 = require("../../utils/get-mf-projects");
|
|
7
7
|
const lib_1 = require("./lib");
|
|
8
8
|
function convertToWithMF(tree, schema) {
|
|
9
9
|
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
10
|
-
const projects = new Set((0,
|
|
10
|
+
const projects = new Set((0, get_mf_projects_1.getMFProjects)(tree, { legacy: true }));
|
|
11
11
|
if (!projects.has(schema.project)) {
|
|
12
12
|
throw new Error(`Could not find project "${schema.project}" with a Micro Frontend configuration in your workspace. Please check the name of the project you're wishing to convert exists.`);
|
|
13
13
|
}
|
|
@@ -23,9 +23,9 @@ function convertToWithMF(tree, schema) {
|
|
|
23
23
|
There are npm packages being shared with a custom configuration in webpack config (${pathToWebpackConfig}).`);
|
|
24
24
|
}
|
|
25
25
|
devkit_1.logger.warn(`This Micro Frontend configuration conversion will overwrite "${schema.project}"'s current webpack config. If you have anything custom that is not related to Micro Frontends, it will be lost. You should be able to see the changes in your version control system.`);
|
|
26
|
-
const [updatedWebpackConfig,
|
|
26
|
+
const [updatedWebpackConfig, mfConfig] = (0, lib_1.writeNewWebpackConfig)(webpackAst, (0, lib_1.isHostRemoteConfig)(webpackAst), schema.project);
|
|
27
27
|
tree.write(pathToWebpackConfig, updatedWebpackConfig);
|
|
28
|
-
tree.write((0, devkit_1.joinPathFragments)(project.root, '
|
|
28
|
+
tree.write((0, devkit_1.joinPathFragments)(project.root, 'module-federation.config.js'), mfConfig);
|
|
29
29
|
yield (0, devkit_2.formatFiles)(tree);
|
|
30
30
|
});
|
|
31
31
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"convert-to-with-mf.js","sourceRoot":"","sources":["../../../../../../packages/angular/src/generators/convert-to-with-mf/convert-to-with-mf.ts"],"names":[],"mappings":";;;AAAA,yCAA+D;AAG/D,yCAAqE;AACrE,
|
|
1
|
+
{"version":3,"file":"convert-to-with-mf.js","sourceRoot":"","sources":["../../../../../../packages/angular/src/generators/convert-to-with-mf/convert-to-with-mf.ts"],"names":[],"mappings":";;;AAAA,yCAA+D;AAG/D,yCAAqE;AACrE,iEAA4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KAAK,CACR,IAAA,0BAAiB,EAAC,OAAO,CAAC,IAAI,EAAE,6BAA6B,CAAC,EAC9D,QAAQ,CACT,CAAC;QAEF,MAAM,IAAA,oBAAW,EAAC,IAAI,CAAC,CAAC;IAC1B,CAAC;CAAA;AA3CD,kCA2CC"}
|
|
@@ -4,7 +4,7 @@ exports.writeNewWebpackConfig = void 0;
|
|
|
4
4
|
const is_host_remote_config_1 = require("./is-host-remote-config");
|
|
5
5
|
function writeNewWebpackConfig(ast, mfType, projectName) {
|
|
6
6
|
const webpackConfig = `const { withModuleFederation } = require('@nrwl/angular/module-federation');
|
|
7
|
-
const config = require('./
|
|
7
|
+
const config = require('./module-federation.config');
|
|
8
8
|
module.exports = withModuleFederation(config);`;
|
|
9
9
|
let mfeConfig = '';
|
|
10
10
|
if (!mfType) {
|
|
File without changes
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const devkit_1 = require("@nrwl/devkit");
|
|
4
|
+
const host_1 = require("./host");
|
|
5
|
+
exports.default = (0, devkit_1.convertNxGenerator)(host_1.default);
|
|
6
|
+
//# sourceMappingURL=host.compat.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"host.compat.js","sourceRoot":"","sources":["../../../../../../packages/angular/src/generators/host/host.compat.ts"],"names":[],"mappings":";;AAAA,yCAAkD;AAClD,iCAA0B;AAE1B,kBAAe,IAAA,2BAAkB,EAAC,cAAI,CAAC,CAAC"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
const devkit_1 = require("@nrwl/devkit");
|
|
5
|
+
const devkit_2 = require("@nrwl/devkit");
|
|
6
|
+
const application_1 = require("../application/application");
|
|
7
|
+
const remote_1 = require("../remote/remote");
|
|
8
|
+
function host(tree, options) {
|
|
9
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
10
|
+
const projects = (0, devkit_2.getProjects)(tree);
|
|
11
|
+
const remotesToGenerate = [];
|
|
12
|
+
const remotesToIntegrate = [];
|
|
13
|
+
if (options.remotes && options.remotes.length > 0) {
|
|
14
|
+
options.remotes.forEach((remote) => {
|
|
15
|
+
if (!projects.has(remote)) {
|
|
16
|
+
remotesToGenerate.push(remote);
|
|
17
|
+
}
|
|
18
|
+
else {
|
|
19
|
+
remotesToIntegrate.push(remote);
|
|
20
|
+
}
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
const installTask = yield (0, application_1.default)(tree, Object.assign(Object.assign({}, options), { mfe: true, mfeType: 'host', routing: true, remotes: remotesToIntegrate !== null && remotesToIntegrate !== void 0 ? remotesToIntegrate : [], port: 4200, federationType: options.dynamic ? 'dynamic' : 'static', skipFormat: true }));
|
|
24
|
+
for (const remote of remotesToGenerate) {
|
|
25
|
+
yield (0, remote_1.default)(tree, Object.assign(Object.assign({}, options), { name: remote, host: (0, devkit_1.names)(options.name).fileName, skipFormat: true }));
|
|
26
|
+
}
|
|
27
|
+
if (!options.skipFormat) {
|
|
28
|
+
yield (0, devkit_1.formatFiles)(tree);
|
|
29
|
+
}
|
|
30
|
+
return installTask;
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
exports.default = host;
|
|
34
|
+
//# sourceMappingURL=host.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"host.js","sourceRoot":"","sources":["../../../../../../packages/angular/src/generators/host/host.ts"],"names":[],"mappings":";;;AAAA,yCAAwD;AAGxD,yCAA2C;AAC3C,4DAA8D;AAC9D,6CAA+C;AAE/C,SAA8B,IAAI,CAAC,IAAU,EAAE,OAAe;;QAC5D,MAAM,QAAQ,GAAG,IAAA,oBAAW,EAAC,IAAI,CAAC,CAAC;QAEnC,MAAM,iBAAiB,GAAa,EAAE,CAAC;QACvC,MAAM,kBAAkB,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|
3
|
+
"$id": "NxMFHost",
|
|
4
4
|
"cli": "nx",
|
|
5
|
-
"title": "Nx
|
|
6
|
-
"description": "Create an Angular Host
|
|
5
|
+
"title": "Nx Module Federation Host Application",
|
|
6
|
+
"description": "Create an Angular Host Module Federation Application.",
|
|
7
7
|
"type": "object",
|
|
8
8
|
"examples": [
|
|
9
9
|
{
|
|
10
|
-
"command": "nx g @nrwl/angular:
|
|
11
|
-
"description": "Create an Angular application with configuration in place for
|
|
10
|
+
"command": "nx g @nrwl/angular:host appName --remotes=remote1",
|
|
11
|
+
"description": "Create an Angular application with configuration in place for Module Federation. If the `remotes` option is provided, attach the remote application to this application's configuration"
|
|
12
12
|
}
|
|
13
13
|
],
|
|
14
14
|
"properties": {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"karma.js","sourceRoot":"","sources":["../../../../../../packages/angular/src/generators/karma/karma.ts"],"names":[],"mappings":";;;AACA,yCAKsB;AAGtB,SAAgB,cAAc,CAAC,IAAU,EAAE,OAAyB;IAClE,MAAM,WAAW,GAAG,IAAA,iBAAQ,EAAC,IAAI,EAAE,cAAc,CAAC,CAAC;IAEnD,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,eAAe,CAAC,EAAE;QACjC,IAAA,sBAAa,EAAC,IAAI,EAAE,IAAA,0BAAiB,EAAC,SAAS,EAAE,OAAO,CAAC,EAAE,GAAG,EAAE;YAC9D,IAAI,EAAE,EAAE;SACT,CAAC,CAAC;KACJ;IAED,IAAI,OAAO,CAAC,eAAe,IAAI,WAAW,CAAC,eAAe,CAAC,OAAO,CAAC,EAAE;QACnE,OAAO,GAAG,EAAE,GAAE,CAAC,CAAC;KACjB;IACD,OAAO,IAAA,qCAA4B,EACjC,IAAI,EACJ,EAAE,EACF;QACE,KAAK,EAAE,QAAQ;QACf,uBAAuB,EAAE,QAAQ;QACjC,gBAAgB,EAAE,QAAQ;QAC1B,eAAe,EAAE,QAAQ;QACzB,6BAA6B,EAAE,QAAQ;QACvC,cAAc,EAAE,SAAS;QACzB,uBAAuB,EAAE,QAAQ;QACjC,gBAAgB,EAAE,QAAQ;
|
|
1
|
+
{"version":3,"file":"karma.js","sourceRoot":"","sources":["../../../../../../packages/angular/src/generators/karma/karma.ts"],"names":[],"mappings":";;;AACA,yCAKsB;AAGtB,SAAgB,cAAc,CAAC,IAAU,EAAE,OAAyB;IAClE,MAAM,WAAW,GAAG,IAAA,iBAAQ,EAAC,IAAI,EAAE,cAAc,CAAC,CAAC;IAEnD,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,eAAe,CAAC,EAAE;QACjC,IAAA,sBAAa,EAAC,IAAI,EAAE,IAAA,0BAAiB,EAAC,SAAS,EAAE,OAAO,CAAC,EAAE,GAAG,EAAE;YAC9D,IAAI,EAAE,EAAE;SACT,CAAC,CAAC;KACJ;IAED,IAAI,OAAO,CAAC,eAAe,IAAI,WAAW,CAAC,eAAe,CAAC,OAAO,CAAC,EAAE;QACnE,OAAO,GAAG,EAAE,GAAE,CAAC,CAAC;KACjB;IACD,OAAO,IAAA,qCAA4B,EACjC,IAAI,EACJ,EAAE,EACF;QACE,KAAK,EAAE,QAAQ;QACf,uBAAuB,EAAE,QAAQ;QACjC,gBAAgB,EAAE,QAAQ;QAC1B,eAAe,EAAE,QAAQ;QACzB,6BAA6B,EAAE,QAAQ;QACvC,cAAc,EAAE,SAAS;QACzB,uBAAuB,EAAE,QAAQ;QACjC,gBAAgB,EAAE,QAAQ;QAC1B,aAAa,EAAE,SAAS;KACzB,CACF,CAAC;AACJ,CAAC;AA3BD,wCA2BC;AAED,kBAAe,cAAc,CAAC"}
|
|
@@ -8,10 +8,10 @@ const jest_1 = require("@nrwl/jest");
|
|
|
8
8
|
const linter_1 = require("@nrwl/linter");
|
|
9
9
|
const generators_1 = require("@nrwl/workspace/generators");
|
|
10
10
|
const init_1 = require("../../generators/init/init");
|
|
11
|
-
const versions_1 = require("../../utils/versions");
|
|
12
11
|
const add_linting_1 = require("../add-linting/add-linting");
|
|
13
12
|
const karma_project_1 = require("../karma-project/karma-project");
|
|
14
13
|
const setup_tailwind_1 = require("../setup-tailwind/setup-tailwind");
|
|
14
|
+
const dependencies_1 = require("../utils/dependencies");
|
|
15
15
|
const add_module_1 = require("./lib/add-module");
|
|
16
16
|
const enable_strict_type_checking_1 = require("./lib/enable-strict-type-checking");
|
|
17
17
|
const normalize_options_1 = require("./lib/normalize-options");
|
|
@@ -57,12 +57,7 @@ function libraryGenerator(host, schema) {
|
|
|
57
57
|
});
|
|
58
58
|
}
|
|
59
59
|
if (options.buildable || options.publishable) {
|
|
60
|
-
(0,
|
|
61
|
-
postcss: versions_1.postcssVersion,
|
|
62
|
-
'postcss-import': '^14.0.2',
|
|
63
|
-
'postcss-preset-env': '^6.7.0',
|
|
64
|
-
'postcss-url': '^10.1.1',
|
|
65
|
-
});
|
|
60
|
+
(0, dependencies_1.addBuildableLibrariesPostCssDependencies)(host);
|
|
66
61
|
}
|
|
67
62
|
if (options.standaloneConfig) {
|
|
68
63
|
yield (0, generators_1.convertToNxProjectGenerator)(host, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"library.js","sourceRoot":"","sources":["../../../../../../packages/angular/src/generators/library/library.ts"],"names":[],"mappings":";;;;AAAA,
|
|
1
|
+
{"version":3,"file":"library.js","sourceRoot":"","sources":["../../../../../../packages/angular/src/generators/library/library.ts"],"names":[],"mappings":";;;;AAAA,yCAKsB;AACtB,8DAAwE;AACxE,qCAAkD;AAClD,yCAAsC;AACtC,2DAAyE;AACzE,qDAA8C;AAC9C,4DAA6D;AAC7D,kEAAmE;AACnE,qEAAsE;AACtE,wDAAiF;AACjF,iDAA6C;AAC7C,mFAG2C;AAC3C,+DAA2D;AAE3D,qFAA8E;AAC9E,yDAAqD;AACrD,2DAAuD;AAGvD,SAAsB,gBAAgB,CAAC,IAAU,EAAE,MAAuB;;QACxE,4BAA4B;QAC5B,IAAI,CAAC,MAAM,CAAC,OAAO,IAAI,MAAM,CAAC,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IAAI,EAAE;gBAChC,OAAO,EAAE,OAAO,CAAC,IAAI;gBACrB,UAAU,EAAE,IAAI;aACjB,CAAC,CAAC;SACJ;IACH,CAAC;CAAA;AAED,SAAS,sCAAsC,CAC7C,IAAU,EACV,OAAyB;IAEzB,IAAI,OAAO,CAAC,SAAS,IAAI,OAAO,CAAC,WAAW,EAAE;QAC5C,IAAA,uDAAwB,EAAC,IAAI,EAAE,OAAO,CAAC,CAAC;KACzC;AACH,CAAC;AAED,SAAS,aAAa,CAAC,IAAU,EAAE,OAAyB;IAC1D,IAAI,OAAO,CAAC,MAAM,EAAE;QAClB,IAAA,sDAAwB,EAAC,IAAI,EAAE,OAAO,CAAC,CAAC;KACzC;SAAM;QACL,IAAA,qDAAuB,EAAC,IAAI,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC;KAC/C;AACH,CAAC;AAED,SAAe,UAAU,CAAC,IAAU,EAAE,OAAyB;;QAC7D,IAAI,OAAO,CAAC,MAAM,KAAK,eAAM,CAAC,IAAI,EAAE;YAClC,OAAO;SACR;QACD,MAAM,IAAA,qBAAmB,EAAC,IAAI,EAAE;YAC9B,WAAW,EAAE,OAAO,CAAC,IAAI;YACzB,WAAW,EAAE,OAAO,CAAC,WAAW;YAChC,MAAM,EAAE,OAAO,CAAC,MAAM;YACtB,uBAAuB,EAAE,OAAO,CAAC,uBAAuB;YACxD,UAAU,EAAE,IAAI;SACjB,CAAC,CAAC;IACL,CAAC;CAAA;AAED,kBAAe,gBAAgB,CAAC"}
|
|
@@ -6,10 +6,13 @@ const devkit_1 = require("@nrwl/devkit");
|
|
|
6
6
|
const versions_1 = require("../../utils/versions");
|
|
7
7
|
const app_migrator_1 = require("./utilities/app.migrator");
|
|
8
8
|
const get_all_projects_1 = require("./utilities/get-all-projects");
|
|
9
|
+
const lib_migrator_1 = require("./utilities/lib.migrator");
|
|
9
10
|
const normalize_options_1 = require("./utilities/normalize-options");
|
|
11
|
+
const validate_projects_1 = require("./utilities/validate-projects");
|
|
10
12
|
const workspace_1 = require("./utilities/workspace");
|
|
11
13
|
function migrateFromAngularCli(tree, rawOptions) {
|
|
12
14
|
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
15
|
+
(0, workspace_1.validateWorkspace)(tree);
|
|
13
16
|
const projects = (0, get_all_projects_1.getAllProjects)(tree);
|
|
14
17
|
const options = (0, normalize_options_1.normalizeOptions)(tree, rawOptions, projects);
|
|
15
18
|
if (options.preserveAngularCliLayout) {
|
|
@@ -21,16 +24,16 @@ function migrateFromAngularCli(tree, rawOptions) {
|
|
|
21
24
|
(0, workspace_1.decorateAngularCli)(tree);
|
|
22
25
|
}
|
|
23
26
|
else {
|
|
24
|
-
(
|
|
27
|
+
// TODO(leo): remove when support for multiple apps is added
|
|
28
|
+
if (projects.apps.length > 2) {
|
|
29
|
+
throw new Error('Can not convert workspaces with more than 1 application.');
|
|
30
|
+
}
|
|
25
31
|
const migrators = [
|
|
26
32
|
...projects.apps.map((app) => new app_migrator_1.AppMigrator(tree, options, app)),
|
|
27
|
-
|
|
33
|
+
...projects.libs.map((lib) => new lib_migrator_1.LibMigrator(tree, options, lib)),
|
|
28
34
|
];
|
|
29
35
|
// validate all projects
|
|
30
|
-
|
|
31
|
-
// TODO: validator will throw on their own until multiple project are supported
|
|
32
|
-
migrator.validate();
|
|
33
|
-
}
|
|
36
|
+
(0, validate_projects_1.validateProjects)(migrators);
|
|
34
37
|
const workspaceCapabilities = (0, workspace_1.getWorkspaceCapabilities)(tree, projects);
|
|
35
38
|
/**
|
|
36
39
|
* Keep a copy of the root eslint config to restore it later. We need to
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"migrate-from-angular-cli.js","sourceRoot":"","sources":["../../../../../../packages/angular/src/generators/ng-add/migrate-from-angular-cli.ts"],"names":[],"mappings":";;;;AAAA,yCAOsB;AACtB,mDAAiD;AAEjD,2DAAuD;AACvD,mEAA8D;AAC9D,qEAAiE;AAEjE,qDAY+B;AAE/B,SAAsB,qBAAqB,CACzC,IAAU,EACV,UAA4B;;QAE5B,MAAM,QAAQ,GAAG,IAAA,iCAAc,EAAC,IAAI,CAAC,CAAC;QACtC,MAAM,OAAO,GAAG,IAAA,oCAAgB,EAAC,IAAI,EAAE,UAAU,EAAE,QAAQ,CAAC,CAAC;QAE7D,IAAI,OAAO,CAAC,wBAAwB,EAAE;YACpC,IAAA,qCAA4B,EAC1B,IAAI,EACJ,EAAE,EACF;gBACE,EAAE,EAAE,oBAAS;gBACb,iBAAiB,EAAE,oBAAS;aAC7B,CACF,CAAC;YACF,IAAA,wBAAY,EAAC,IAAI,EAAE,OAAO,EAAE,IAAI,CAAC,CAAC;YAClC,IAAA,8BAAkB,EAAC,IAAI,CAAC,CAAC;SAC1B;aAAM;YACL,
|
|
1
|
+
{"version":3,"file":"migrate-from-angular-cli.js","sourceRoot":"","sources":["../../../../../../packages/angular/src/generators/ng-add/migrate-from-angular-cli.ts"],"names":[],"mappings":";;;;AAAA,yCAOsB;AACtB,mDAAiD;AAEjD,2DAAuD;AACvD,mEAA8D;AAC9D,2DAAuD;AACvD,qEAAiE;AAEjE,qEAAiE;AACjE,qDAY+B;AAE/B,SAAsB,qBAAqB,CACzC,IAAU,EACV,UAA4B;;QAE5B,IAAA,6BAAiB,EAAC,IAAI,CAAC,CAAC;QACxB,MAAM,QAAQ,GAAG,IAAA,iCAAc,EAAC,IAAI,CAAC,CAAC;QACtC,MAAM,OAAO,GAAG,IAAA,oCAAgB,EAAC,IAAI,EAAE,UAAU,EAAE,QAAQ,CAAC,CAAC;QAE7D,IAAI,OAAO,CAAC,wBAAwB,EAAE;YACpC,IAAA,qCAA4B,EAC1B,IAAI,EACJ,EAAE,EACF;gBACE,EAAE,EAAE,oBAAS;gBACb,iBAAiB,EAAE,oBAAS;aAC7B,CACF,CAAC;YACF,IAAA,wBAAY,EAAC,IAAI,EAAE,OAAO,EAAE,IAAI,CAAC,CAAC;YAClC,IAAA,8BAAkB,EAAC,IAAI,CAAC,CAAC;SAC1B;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B,EAAC,IAAI,CAAC,CAAC;YAEjC,uBAAuB;YACvB,KAAK,MAAM,QAAQ,IAAI,SAAS,EAAE;gBAChC,MAAM,QAAQ,CAAC,OAAO,EAAE,CAAC;aAC1B;YAED;;;;eAIG;YACH,IAAI,qBAAqB,CAAC,KAAK,EAAE;gBAC/B,IAAA,iCAAqB,EAAC,IAAI,CAAC,CAAC;aAC7B;YACD,IAAI,qBAAqB,CAAC,MAAM,EAAE;gBAChC,IAAA,kCAAsB,EAAC,IAAI,EAAE,YAAY,CAAC,CAAC;gBAC3C,IAAA,iCAAqB,EAAC,IAAI,CAAC,CAAC;aAC7B;YAED,MAAM,IAAA,oBAAW,EAAC,IAAI,CAAC,CAAC;SACzB;QAED,IAAI,CAAC,OAAO,CAAC,WAAW,EAAE;YACxB,OAAO,GAAG,EAAE;gBACV,IAAA,4BAAmB,EAAC,IAAI,CAAC,CAAC;YAC5B,CAAC,CAAC;SACH;IACH,CAAC;CAAA;AAvFD,sDAuFC"}
|
|
@@ -24,13 +24,6 @@
|
|
|
24
24
|
"description": "Preserve the Angular CLI layout instead of moving the app into apps. NOTE: only used if running the generator in an Angular CLI workspace.",
|
|
25
25
|
"default": false
|
|
26
26
|
},
|
|
27
|
-
"name": {
|
|
28
|
-
"type": "string",
|
|
29
|
-
"description": "Project name. NOTE: only used if running the generator in an Angular CLI workspace.",
|
|
30
|
-
"$default": {
|
|
31
|
-
"$source": "projectName"
|
|
32
|
-
}
|
|
33
|
-
},
|
|
34
27
|
|
|
35
28
|
"unitTestRunner": {
|
|
36
29
|
"type": "string",
|
|
@@ -11,9 +11,7 @@ export declare class AppMigrator extends ProjectMigrator {
|
|
|
11
11
|
private updateProjectConfiguration;
|
|
12
12
|
private updateTsConfigs;
|
|
13
13
|
private updateEsLintConfig;
|
|
14
|
-
private convertEsLintConfigExtendToNewPath;
|
|
15
14
|
private convertBuildOptions;
|
|
16
15
|
private convertServerOptions;
|
|
17
|
-
private
|
|
18
|
-
private convertPath;
|
|
16
|
+
private moveFilePathsFromTargetToProjectRoot;
|
|
19
17
|
}
|
|
@@ -7,12 +7,12 @@ const linter_1 = require("@nrwl/linter");
|
|
|
7
7
|
const generators_1 = require("@nrwl/workspace/generators");
|
|
8
8
|
const typescript_1 = require("@nrwl/workspace/src/utilities/typescript");
|
|
9
9
|
const path_1 = require("path");
|
|
10
|
-
const
|
|
10
|
+
const e2e_migrator_1 = require("./e2e.migrator");
|
|
11
11
|
const project_migrator_1 = require("./project.migrator");
|
|
12
12
|
class AppMigrator extends project_migrator_1.ProjectMigrator {
|
|
13
13
|
constructor(tree, options, project) {
|
|
14
14
|
super(tree, options, project, 'apps');
|
|
15
|
-
this.e2eMigrator = new
|
|
15
|
+
this.e2eMigrator = new e2e_migrator_1.E2eProjectMigrator(tree, options, project);
|
|
16
16
|
}
|
|
17
17
|
migrate() {
|
|
18
18
|
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
@@ -24,27 +24,27 @@ class AppMigrator extends project_migrator_1.ProjectMigrator {
|
|
|
24
24
|
});
|
|
25
25
|
}
|
|
26
26
|
validate() {
|
|
27
|
-
|
|
27
|
+
var _a;
|
|
28
|
+
const result = [];
|
|
28
29
|
if (this.projectConfig.targets.lint &&
|
|
29
30
|
this.projectConfig.targets.lint.executor !==
|
|
30
31
|
'@angular-eslint/builder:lint') {
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
throw new Error(result);
|
|
32
|
+
result.push({
|
|
33
|
+
message: `The "lint" target is using an unsupported builder "${this.projectConfig.targets.lint.executor}".`,
|
|
34
|
+
hint: `The supported builder is "@angular-eslint/builder:lint".`,
|
|
35
|
+
});
|
|
36
36
|
}
|
|
37
|
-
|
|
37
|
+
result.push(...((_a = this.e2eMigrator.validate()) !== null && _a !== void 0 ? _a : []));
|
|
38
|
+
return result.length ? result : null;
|
|
38
39
|
}
|
|
39
40
|
moveProjectFiles() {
|
|
40
41
|
var _a;
|
|
41
42
|
// it is not required to have a browserslist
|
|
42
43
|
this.moveProjectRootFile((0, devkit_1.joinPathFragments)(this.project.oldRoot, 'browserslist'), false);
|
|
43
44
|
this.moveProjectRootFile((0, devkit_1.joinPathFragments)(this.project.oldRoot, '.browserslistrc'), false);
|
|
44
|
-
this.
|
|
45
|
+
this.moveFilePathsFromTargetToProjectRoot(this.projectConfig.targets.build, ['tsConfig', 'webWorkerTsConfig', 'ngswConfigPath']);
|
|
45
46
|
if (this.projectConfig.targets.test) {
|
|
46
|
-
this.
|
|
47
|
-
this.moveProjectRootFile(this.projectConfig.targets.test.options.tsConfig);
|
|
47
|
+
this.moveFilePathsFromTargetToProjectRoot(this.projectConfig.targets.test, ['karmaConfig', 'tsConfig', 'webWorkerTsConfig']);
|
|
48
48
|
}
|
|
49
49
|
else {
|
|
50
50
|
// there could still be a karma.conf.js file in the root
|
|
@@ -73,12 +73,12 @@ class AppMigrator extends project_migrator_1.ProjectMigrator {
|
|
|
73
73
|
this.moveDir(this.project.oldSourceRoot, this.project.newSourceRoot);
|
|
74
74
|
}
|
|
75
75
|
updateProjectConfiguration() {
|
|
76
|
-
var _a;
|
|
76
|
+
var _a, _b;
|
|
77
77
|
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
78
78
|
this.projectConfig.root = this.project.newRoot;
|
|
79
79
|
this.projectConfig.sourceRoot = this.project.newSourceRoot;
|
|
80
80
|
this.convertBuildOptions(this.projectConfig.targets.build.options);
|
|
81
|
-
Object.values(this.projectConfig.targets.build.configurations).forEach((config) => this.convertBuildOptions(config));
|
|
81
|
+
Object.values((_a = this.projectConfig.targets.build.configurations) !== null && _a !== void 0 ? _a : {}).forEach((config) => this.convertBuildOptions(config));
|
|
82
82
|
if (this.projectConfig.targets.test) {
|
|
83
83
|
const testOptions = this.projectConfig.targets.test.options;
|
|
84
84
|
testOptions.main =
|
|
@@ -105,8 +105,8 @@ class AppMigrator extends project_migrator_1.ProjectMigrator {
|
|
|
105
105
|
(0, devkit_1.joinPathFragments)(this.project.newRoot, (0, path_1.basename)(lintOptions.eslintConfig));
|
|
106
106
|
lintOptions.lintFilePatterns =
|
|
107
107
|
lintOptions.lintFilePatterns &&
|
|
108
|
-
lintOptions.lintFilePatterns.map((pattern) => this.
|
|
109
|
-
const eslintConfigPath = (
|
|
108
|
+
lintOptions.lintFilePatterns.map((pattern) => this.convertPath(pattern));
|
|
109
|
+
const eslintConfigPath = (_b = lintOptions.eslintConfig) !== null && _b !== void 0 ? _b : (0, devkit_1.joinPathFragments)(this.project.newRoot, '.eslintrc.json');
|
|
110
110
|
const eslintConfig = (0, devkit_1.readJson)(this.tree, eslintConfigPath);
|
|
111
111
|
if ((0, linter_1.hasRulesRequiringTypeChecking)(eslintConfig)) {
|
|
112
112
|
lintOptions.hasTypeAwareRules = true;
|
|
@@ -125,31 +125,14 @@ class AppMigrator extends project_migrator_1.ProjectMigrator {
|
|
|
125
125
|
});
|
|
126
126
|
}
|
|
127
127
|
updateTsConfigs() {
|
|
128
|
-
const
|
|
128
|
+
const rootTsConfigFile = (0, typescript_1.getRootTsConfigPathInTree)(this.tree);
|
|
129
129
|
const projectOffsetFromRoot = (0, devkit_1.offsetFromRoot)(this.projectConfig.root);
|
|
130
|
-
|
|
131
|
-
json.extends = `${projectOffsetFromRoot}${tsConfigPath}`;
|
|
132
|
-
json.compilerOptions = json.compilerOptions || {};
|
|
133
|
-
json.compilerOptions.outDir = `${projectOffsetFromRoot}dist/out-tsc`;
|
|
134
|
-
return json;
|
|
135
|
-
});
|
|
130
|
+
this.updateTsConfigFile(this.projectConfig.targets.build.options.tsConfig, rootTsConfigFile, projectOffsetFromRoot);
|
|
136
131
|
if (this.projectConfig.targets.test) {
|
|
137
|
-
|
|
138
|
-
var _a;
|
|
139
|
-
json.extends = `${projectOffsetFromRoot}${tsConfigPath}`;
|
|
140
|
-
json.compilerOptions = (_a = json.compilerOptions) !== null && _a !== void 0 ? _a : {};
|
|
141
|
-
json.compilerOptions.outDir = `${projectOffsetFromRoot}dist/out-tsc`;
|
|
142
|
-
return json;
|
|
143
|
-
});
|
|
132
|
+
this.updateTsConfigFile(this.projectConfig.targets.test.options.tsConfig, rootTsConfigFile, projectOffsetFromRoot);
|
|
144
133
|
}
|
|
145
134
|
if (this.projectConfig.targets.server) {
|
|
146
|
-
|
|
147
|
-
var _a;
|
|
148
|
-
json.extends = `${projectOffsetFromRoot}${tsConfigPath}`;
|
|
149
|
-
json.compilerOptions = (_a = json.compilerOptions) !== null && _a !== void 0 ? _a : {};
|
|
150
|
-
json.compilerOptions.outDir = `${projectOffsetFromRoot}dist/out-tsc`;
|
|
151
|
-
return json;
|
|
152
|
-
});
|
|
135
|
+
this.updateTsConfigFile(this.projectConfig.targets.server.options.tsConfig, rootTsConfigFile, projectOffsetFromRoot);
|
|
153
136
|
}
|
|
154
137
|
}
|
|
155
138
|
updateEsLintConfig() {
|
|
@@ -164,7 +147,7 @@ class AppMigrator extends project_migrator_1.ProjectMigrator {
|
|
|
164
147
|
json.ignorePatterns = ['!**/*'];
|
|
165
148
|
const rootEsLintConfigRelativePath = (0, devkit_1.joinPathFragments)((0, devkit_1.offsetFromRoot)(this.projectConfig.root), '.eslintrc.json');
|
|
166
149
|
if (Array.isArray(json.extends)) {
|
|
167
|
-
json.extends = json.extends.map((extend) => this.convertEsLintConfigExtendToNewPath(extend));
|
|
150
|
+
json.extends = json.extends.map((extend) => this.convertEsLintConfigExtendToNewPath(eslintConfigPath, extend));
|
|
168
151
|
// it might have not been extending from the root config, make sure it does
|
|
169
152
|
if (!json.extends.includes(rootEsLintConfigRelativePath)) {
|
|
170
153
|
json.extends.push(rootEsLintConfigRelativePath);
|
|
@@ -185,14 +168,6 @@ class AppMigrator extends project_migrator_1.ProjectMigrator {
|
|
|
185
168
|
return json;
|
|
186
169
|
});
|
|
187
170
|
}
|
|
188
|
-
convertEsLintConfigExtendToNewPath(pathToFile) {
|
|
189
|
-
if (!pathToFile.startsWith('..')) {
|
|
190
|
-
// we only need to adjust paths that are on a different directory,
|
|
191
|
-
// files in the same directory should be moved together
|
|
192
|
-
return pathToFile;
|
|
193
|
-
}
|
|
194
|
-
return (0, devkit_1.joinPathFragments)((0, devkit_1.offsetFromRoot)(this.projectConfig.root), (0, path_1.basename)(pathToFile));
|
|
195
|
-
}
|
|
196
171
|
convertBuildOptions(buildOptions) {
|
|
197
172
|
buildOptions.outputPath =
|
|
198
173
|
buildOptions.outputPath &&
|
|
@@ -238,18 +213,12 @@ class AppMigrator extends project_migrator_1.ProjectMigrator {
|
|
|
238
213
|
with: this.convertAsset(replacement.with),
|
|
239
214
|
}));
|
|
240
215
|
}
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
}
|
|
248
|
-
}
|
|
249
|
-
convertPath(originalPath) {
|
|
250
|
-
return (originalPath === null || originalPath === void 0 ? void 0 : originalPath.startsWith(this.project.oldSourceRoot))
|
|
251
|
-
? (0, devkit_1.joinPathFragments)(this.project.newSourceRoot, originalPath.replace(this.project.oldSourceRoot, ''))
|
|
252
|
-
: originalPath;
|
|
216
|
+
moveFilePathsFromTargetToProjectRoot(target, options) {
|
|
217
|
+
options.forEach((option) => {
|
|
218
|
+
this.getTargetValuesForOption(target, option).forEach((path) => {
|
|
219
|
+
this.moveProjectRootFile(path);
|
|
220
|
+
});
|
|
221
|
+
});
|
|
253
222
|
}
|
|
254
223
|
}
|
|
255
224
|
exports.AppMigrator = AppMigrator;
|