@nrwl/angular 14.6.0-beta.7 → 14.6.0-beta.8
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/CHANGELOG.md +1 -1
- package/package.json +9 -9
- package/src/executors/delegate-build/schema.json +5 -2
- package/src/executors/ng-packagr-lite/schema.json +3 -1
- package/src/executors/package/schema.json +6 -2
- package/src/generators/application/application.js +3 -3
- package/src/generators/application/application.js.map +1 -1
- package/src/generators/application/schema.d.ts +15 -0
- package/src/generators/component/schema.json +1 -3
- package/src/generators/host/host.js +31 -7
- package/src/generators/host/host.js.map +1 -1
- package/src/generators/host/schema.d.ts +1 -0
- package/src/generators/host/schema.json +5 -0
- package/src/generators/karma-project/schema.json +1 -3
- package/src/generators/library-secondary-entry-point/schema.json +1 -3
- package/src/generators/remote/remote.js +28 -6
- package/src/generators/remote/remote.js.map +1 -1
- package/src/generators/remote/schema.d.ts +1 -0
- package/src/generators/remote/schema.json +6 -3
- package/src/generators/scam/schema.json +1 -3
- package/src/generators/scam-directive/schema.json +1 -3
- package/src/generators/scam-pipe/schema.json +1 -3
- package/src/generators/setup-mf/files/entry-module-files/entry.component.ts__tmpl__ +1 -1
- package/src/generators/setup-mf/files/standalone-entry-component-files/entry.component.ts__tmpl__ +13 -0
- package/src/generators/setup-mf/files/standalone-entry-component-files/routes.ts__tmpl__ +4 -0
- package/src/generators/setup-mf/files/webpack/module-federation.config.js__tmpl__ +3 -2
- package/src/generators/setup-mf/lib/add-cypress-workaround.js +10 -5
- package/src/generators/setup-mf/lib/add-cypress-workaround.js.map +1 -1
- package/src/generators/setup-mf/lib/add-remote-entry.d.ts +3 -0
- package/src/generators/setup-mf/lib/add-remote-entry.js +28 -0
- package/src/generators/setup-mf/lib/add-remote-entry.js.map +1 -0
- package/src/generators/setup-mf/lib/add-remote-to-host.js +26 -10
- package/src/generators/setup-mf/lib/add-remote-to-host.js.map +1 -1
- package/src/generators/setup-mf/lib/fix-bootstrap.js +24 -1
- package/src/generators/setup-mf/lib/fix-bootstrap.js.map +1 -1
- package/src/generators/setup-mf/lib/generate-config.js +1 -0
- package/src/generators/setup-mf/lib/generate-config.js.map +1 -1
- package/src/generators/setup-mf/lib/index.d.ts +1 -1
- package/src/generators/setup-mf/lib/index.js +1 -1
- package/src/generators/setup-mf/schema.d.ts +1 -0
- package/src/generators/setup-mf/schema.json +5 -0
- package/src/generators/setup-mf/setup-mf.js +1 -1
- package/src/generators/setup-mf/setup-mf.js.map +1 -1
- package/src/generators/web-worker/schema.json +1 -3
- package/src/generators/setup-mf/lib/add-entry-module.d.ts +0 -3
- package/src/generators/setup-mf/lib/add-entry-module.js +0 -23
- package/src/generators/setup-mf/lib/add-entry-module.js.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,6 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
-
# [14.6.0-beta.
|
|
6
|
+
# [14.6.0-beta.8](https://github.com/nrwl/nx/compare/14.5.7...14.6.0-beta.8) (2022-08-26)
|
|
7
7
|
|
|
8
8
|
**Note:** Version bump only for package @nrwl/angular
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nrwl/angular",
|
|
3
|
-
"version": "14.6.0-beta.
|
|
3
|
+
"version": "14.6.0-beta.8",
|
|
4
4
|
"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, Cypress, Karma, and Protractor. \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.",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -65,13 +65,13 @@
|
|
|
65
65
|
},
|
|
66
66
|
"dependencies": {
|
|
67
67
|
"@angular-devkit/schematics": "~14.1.1",
|
|
68
|
-
"@nrwl/cypress": "14.6.0-beta.
|
|
69
|
-
"@nrwl/devkit": "14.6.0-beta.
|
|
70
|
-
"@nrwl/jest": "14.6.0-beta.
|
|
71
|
-
"@nrwl/linter": "14.6.0-beta.
|
|
72
|
-
"@nrwl/storybook": "14.6.0-beta.
|
|
73
|
-
"@nrwl/web": "14.6.0-beta.
|
|
74
|
-
"@nrwl/workspace": "14.6.0-beta.
|
|
68
|
+
"@nrwl/cypress": "14.6.0-beta.8",
|
|
69
|
+
"@nrwl/devkit": "14.6.0-beta.8",
|
|
70
|
+
"@nrwl/jest": "14.6.0-beta.8",
|
|
71
|
+
"@nrwl/linter": "14.6.0-beta.8",
|
|
72
|
+
"@nrwl/storybook": "14.6.0-beta.8",
|
|
73
|
+
"@nrwl/web": "14.6.0-beta.8",
|
|
74
|
+
"@nrwl/workspace": "14.6.0-beta.8",
|
|
75
75
|
"@phenomnomnominal/tsquery": "4.1.1",
|
|
76
76
|
"@schematics/angular": "~14.1.0",
|
|
77
77
|
"chalk": "4.1.0",
|
|
@@ -95,5 +95,5 @@
|
|
|
95
95
|
"fesm2015": "fesm2015/nrwl-angular.mjs",
|
|
96
96
|
"typings": "index.d.ts",
|
|
97
97
|
"sideEffects": false,
|
|
98
|
-
"gitHead": "
|
|
98
|
+
"gitHead": "8b02670a3962710a929ad048d40ab7470a7a94a4"
|
|
99
99
|
}
|
|
@@ -11,11 +11,14 @@
|
|
|
11
11
|
},
|
|
12
12
|
"outputPath": {
|
|
13
13
|
"type": "string",
|
|
14
|
-
"description": "The full path for the output directory, relative to the workspace root."
|
|
14
|
+
"description": "The full path for the output directory, relative to the workspace root.",
|
|
15
|
+
"x-completion-type": "directory"
|
|
15
16
|
},
|
|
16
17
|
"tsConfig": {
|
|
17
18
|
"type": "string",
|
|
18
|
-
"description": "The full path for the TypeScript configuration file, relative to the workspace root."
|
|
19
|
+
"description": "The full path for the TypeScript configuration file, relative to the workspace root.",
|
|
20
|
+
"x-completion-type": "file",
|
|
21
|
+
"x-completion-glob": "tsconfig.*.json"
|
|
19
22
|
},
|
|
20
23
|
"watch": {
|
|
21
24
|
"type": "boolean",
|
|
@@ -25,7 +25,9 @@
|
|
|
25
25
|
},
|
|
26
26
|
"tsConfig": {
|
|
27
27
|
"type": "string",
|
|
28
|
-
"description": "The full path for the TypeScript configuration file, relative to the workspace root."
|
|
28
|
+
"description": "The full path for the TypeScript configuration file, relative to the workspace root.",
|
|
29
|
+
"x-completion-type": "file",
|
|
30
|
+
"x-completion-glob": "tsconfig.*.json"
|
|
29
31
|
},
|
|
30
32
|
"watch": {
|
|
31
33
|
"type": "boolean",
|
|
@@ -25,7 +25,9 @@
|
|
|
25
25
|
},
|
|
26
26
|
"tsConfig": {
|
|
27
27
|
"type": "string",
|
|
28
|
-
"description": "The full path for the TypeScript configuration file, relative to the workspace root."
|
|
28
|
+
"description": "The full path for the TypeScript configuration file, relative to the workspace root.",
|
|
29
|
+
"x-completion-type": "file",
|
|
30
|
+
"x-completion-glob": "tsconfig.*.json"
|
|
29
31
|
},
|
|
30
32
|
"watch": {
|
|
31
33
|
"type": "boolean",
|
|
@@ -45,7 +47,9 @@
|
|
|
45
47
|
},
|
|
46
48
|
"tailwindConfig": {
|
|
47
49
|
"type": "string",
|
|
48
|
-
"description": "The full path for the Tailwind configuration file, relative to the workspace root. If not provided and a `tailwind.config.js` file exists in the project or workspace root, it will be used. Otherwise, Tailwind will not be configured."
|
|
50
|
+
"description": "The full path for the Tailwind configuration file, relative to the workspace root. If not provided and a `tailwind.config.js` file exists in the project or workspace root, it will be used. Otherwise, Tailwind will not be configured.",
|
|
51
|
+
"x-completion-type": "file",
|
|
52
|
+
"x-completion-glob": "tailwind.config.js"
|
|
49
53
|
}
|
|
50
54
|
},
|
|
51
55
|
"additionalProperties": false,
|
|
@@ -82,12 +82,12 @@ function applicationGenerator(host, schema) {
|
|
|
82
82
|
all: false,
|
|
83
83
|
});
|
|
84
84
|
}
|
|
85
|
-
if (options.mf) {
|
|
86
|
-
yield (0, lib_1.addMf)(host, options);
|
|
87
|
-
}
|
|
88
85
|
if (options.standalone) {
|
|
89
86
|
(0, lib_1.convertToStandaloneApp)(host, options);
|
|
90
87
|
}
|
|
88
|
+
if (options.mf) {
|
|
89
|
+
yield (0, lib_1.addMf)(host, options);
|
|
90
|
+
}
|
|
91
91
|
if (!options.skipFormat) {
|
|
92
92
|
yield (0, devkit_1.formatFiles)(host);
|
|
93
93
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"application.js","sourceRoot":"","sources":["../../../../../../packages/angular/src/generators/application/application.ts"],"names":[],"mappings":";;;;AAAA,yCAKsB;AACtB,8DAAwE;AACxE,2DAAyE;AACzE,2DAA0D;AAC1D,uCAAoD;AACpD,qEAA0E;AAC1E,+BAkBe;AAGf,SAAsB,oBAAoB,CACxC,IAAU,EACV,MAAuB;;QAEvB,MAAM,OAAO,GAAG,IAAA,sBAAgB,EAAC,IAAI,EAAE,MAAM,CAAC,CAAC;QAE/C,MAAM,IAAA,2BAAoB,EAAC,IAAI,kCAC1B,OAAO,KACV,UAAU,EAAE,IAAI,IAChB,CAAC;QAEH,MAAM,mBAAmB,GAAG,IAAA,0CAA0B,EACpD,qBAAqB,EACrB,aAAa,CACd,CAAC;QACF,MAAM,mBAAmB,CAAC,IAAI,EAAE;YAC9B,IAAI,EAAE,OAAO,CAAC,IAAI;YAClB,WAAW,EAAE,OAAO,CAAC,WAAW;YAChC,cAAc,EAAE,OAAO,CAAC,cAAc;YACtC,MAAM,EAAE,OAAO,CAAC,MAAM;YACtB,SAAS,EAAE,OAAO,CAAC,SAAS;YAC5B,KAAK,EAAE,OAAO,CAAC,KAAK;YACpB,iBAAiB,EAAE,OAAO,CAAC,iBAAiB;YAC5C,OAAO,EAAE,KAAK;YACd,WAAW,EAAE,IAAI;YACjB,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AO,EAAE;YACnB,IAAA,gCAA0B,EAAC,IAAI,EAAE,OAAO,CAAC,CAAC;SAC3C;QAED,IAAA,gBAAU,EAAC,IAAI,EAAE,OAAO,CAAC,CAAC;QAC1B,MAAM,IAAA,uBAAiB,EAAC,IAAI,EAAE,OAAO,CAAC,CAAC;QACvC,MAAM,IAAA,YAAM,EAAC,IAAI,EAAE,OAAO,CAAC,CAAC;QAC5B,IAAA,0BAAoB,EAAC,IAAI,EAAE,OAAO,CAAC,CAAC;QAEpC,IAAI,CAAC,OAAO,CAAC,kBAAkB,EAAE;YAC/B,IAAA,uBAAiB,EAAC,IAAI,EAAE,OAAO,CAAC,CAAC;SAClC;QAED,IAAI,OAAO,CAAC,cAAc,EAAE;YAC1B,IAAA,oBAAc,EAAC,IAAI,EAAE,OAAO,CAAC,CAAC;SAC/B;QAED,IAAI,OAAO,CAAC,MAAM,EAAE;YAClB,IAAA,8BAAwB,EAAC,IAAI,EAAE,OAAO,CAAC,CAAC;SACzC;aAAM;YACL,IAAA,iCAA2B,EAAC,IAAI,EAAE,KAAK,CAAC,CAAC;SAC1C;QAED,IAAI,OAAO,CAAC,gBAAgB,EAAE;YAC5B,MAAM,IAAA,wCAA2B,EAAC,IAAI,EAAE;gBACtC,OAAO,EAAE,OAAO,CAAC,IAAI;gBACrB,GAAG,EAAE,KAAK;aACX,CAAC,CAAC;SACJ;QAED,IAAI,OAAO,CAAC,
|
|
1
|
+
{"version":3,"file":"application.js","sourceRoot":"","sources":["../../../../../../packages/angular/src/generators/application/application.ts"],"names":[],"mappings":";;;;AAAA,yCAKsB;AACtB,8DAAwE;AACxE,2DAAyE;AACzE,2DAA0D;AAC1D,uCAAoD;AACpD,qEAA0E;AAC1E,+BAkBe;AAGf,SAAsB,oBAAoB,CACxC,IAAU,EACV,MAAuB;;QAEvB,MAAM,OAAO,GAAG,IAAA,sBAAgB,EAAC,IAAI,EAAE,MAAM,CAAC,CAAC;QAE/C,MAAM,IAAA,2BAAoB,EAAC,IAAI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C,IAAI,EAAE;gBACtC,OAAO,EAAE,OAAO,CAAC,IAAI;gBACrB,GAAG,EAAE,KAAK;aACX,CAAC,CAAC;SACJ;QAED,IAAI,OAAO,CAAC,UAAU,EAAE;YACtB,IAAA,4BAAsB,EAAC,IAAI,EAAE,OAAO,CAAC,CAAC;SACvC;QAED,IAAI,OAAO,CAAC,EAAE,EAAE;YACd,MAAM,IAAA,WAAK,EAAC,IAAI,EAAE,OAAO,CAAC,CAAC;SAC5B;QAED,IAAI,CAAC,OAAO,CAAC,UAAU,EAAE;YACvB,MAAM,IAAA,oBAAW,EAAC,IAAI,CAAC,CAAC;SACzB;QAED,OAAO,GAAG,EAAE;YACV,IAAA,4BAAmB,EAAC,IAAI,CAAC,CAAC;QAC5B,CAAC,CAAC;IACJ,CAAC;CAAA;AApHD,oDAoHC;AAED,kBAAe,oBAAoB,CAAC"}
|
|
@@ -23,14 +23,29 @@ export interface Schema {
|
|
|
23
23
|
backendProject?: string;
|
|
24
24
|
strict?: boolean;
|
|
25
25
|
standaloneConfig?: boolean;
|
|
26
|
+
/**
|
|
27
|
+
* @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.
|
|
28
|
+
*/
|
|
26
29
|
mf?: boolean;
|
|
30
|
+
/**
|
|
31
|
+
* @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.
|
|
32
|
+
*/
|
|
27
33
|
mfType?: 'host' | 'remote';
|
|
34
|
+
/**
|
|
35
|
+
* @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.
|
|
36
|
+
*/
|
|
28
37
|
remotes?: string[];
|
|
29
38
|
port?: number;
|
|
39
|
+
/**
|
|
40
|
+
* @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.
|
|
41
|
+
*/
|
|
30
42
|
host?: string;
|
|
31
43
|
setParserOptionsProject?: boolean;
|
|
32
44
|
skipPackageJson?: boolean;
|
|
33
45
|
skipPostInstall?: boolean;
|
|
46
|
+
/**
|
|
47
|
+
* @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.
|
|
48
|
+
*/
|
|
34
49
|
federationType?: 'static' | 'dynamic';
|
|
35
50
|
skipDefaultProject?: boolean;
|
|
36
51
|
standalone?: boolean;
|
|
@@ -7,6 +7,8 @@ const remote_1 = require("../remote/remote");
|
|
|
7
7
|
const project_1 = require("../utils/project");
|
|
8
8
|
const ts = require("typescript");
|
|
9
9
|
const ast_utils_1 = require("../../utils/nx-devkit/ast-utils");
|
|
10
|
+
const standalone_utils_1 = require("../../utils/nx-devkit/standalone-utils");
|
|
11
|
+
const setup_mf_1 = require("../setup-mf/setup-mf");
|
|
10
12
|
function host(tree, options) {
|
|
11
13
|
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
12
14
|
const projects = (0, devkit_1.getProjects)(tree);
|
|
@@ -22,9 +24,21 @@ function host(tree, options) {
|
|
|
22
24
|
}
|
|
23
25
|
});
|
|
24
26
|
}
|
|
25
|
-
const
|
|
27
|
+
const appName = (0, project_1.normalizeProjectName)(options.name, options.directory);
|
|
28
|
+
const installTask = yield (0, application_1.default)(tree, Object.assign(Object.assign({}, options), { routing: true, port: 4200, skipFormat: true }));
|
|
29
|
+
yield (0, setup_mf_1.setupMf)(tree, {
|
|
30
|
+
appName,
|
|
31
|
+
mfType: 'host',
|
|
32
|
+
routing: true,
|
|
33
|
+
port: 4200,
|
|
34
|
+
remotes: remotesToIntegrate !== null && remotesToIntegrate !== void 0 ? remotesToIntegrate : [],
|
|
35
|
+
federationType: options.dynamic ? 'dynamic' : 'static',
|
|
36
|
+
skipPackageJson: options.skipPackageJson,
|
|
37
|
+
skipFormat: true,
|
|
38
|
+
e2eProjectName: `${appName}-e2e`,
|
|
39
|
+
});
|
|
26
40
|
for (const remote of remotesToGenerate) {
|
|
27
|
-
yield (0, remote_1.default)(tree, Object.assign(Object.assign({}, options), { name: remote, host:
|
|
41
|
+
yield (0, remote_1.default)(tree, Object.assign(Object.assign({}, options), { name: remote, host: appName, skipFormat: true, standalone: options.standalone }));
|
|
28
42
|
}
|
|
29
43
|
routeToNxWelcome(tree, options);
|
|
30
44
|
if (!options.skipFormat) {
|
|
@@ -45,15 +59,25 @@ ${remoteRoutes}
|
|
|
45
59
|
</ul>
|
|
46
60
|
<router-outlet></router-outlet>
|
|
47
61
|
`);
|
|
48
|
-
const
|
|
49
|
-
const
|
|
50
|
-
if (!
|
|
62
|
+
const pathToHostRootRoutingFile = (0, devkit_1.joinPathFragments)(sourceRoot, options.standalone ? 'bootstrap.ts' : 'app/app.module.ts');
|
|
63
|
+
const hostRootRoutingFile = tree.read(pathToHostRootRoutingFile, 'utf-8');
|
|
64
|
+
if (!hostRootRoutingFile.includes('RouterModule.forRoot(')) {
|
|
51
65
|
return;
|
|
52
66
|
}
|
|
53
|
-
let sourceFile = ts.createSourceFile(
|
|
54
|
-
|
|
67
|
+
let sourceFile = ts.createSourceFile(pathToHostRootRoutingFile, hostRootRoutingFile, ts.ScriptTarget.Latest, true);
|
|
68
|
+
if (hostRootRoutingFile.includes('@NgModule')) {
|
|
69
|
+
sourceFile = (0, ast_utils_1.addRoute)(tree, pathToHostRootRoutingFile, sourceFile, `{
|
|
55
70
|
path: '',
|
|
56
71
|
component: NxWelcomeComponent
|
|
57
72
|
}`);
|
|
73
|
+
}
|
|
74
|
+
else {
|
|
75
|
+
(0, standalone_utils_1.addStandaloneRoute)(tree, pathToHostRootRoutingFile, `{
|
|
76
|
+
path: '',
|
|
77
|
+
component: NxWelcomeComponent
|
|
78
|
+
}`);
|
|
79
|
+
tree.write(pathToHostRootRoutingFile, `import { NxWelcomeComponent } from './app/nx-welcome.component';
|
|
80
|
+
${tree.read(pathToHostRootRoutingFile, 'utf-8')}`);
|
|
81
|
+
}
|
|
58
82
|
}
|
|
59
83
|
//# sourceMappingURL=host.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"host.js","sourceRoot":"","sources":["../../../../../../packages/angular/src/generators/host/host.ts"],"names":[],"mappings":";;;AAAA,yCAOsB;AAEtB,4DAA8D;AAC9D,6CAA+C;AAC/C,8CAAwD;AACxD,iCAAiC;AACjC,+DAA2D;
|
|
1
|
+
{"version":3,"file":"host.js","sourceRoot":"","sources":["../../../../../../packages/angular/src/generators/host/host.ts"],"names":[],"mappings":";;;AAAA,yCAOsB;AAEtB,4DAA8D;AAC9D,6CAA+C;AAC/C,8CAAwD;AACxD,iCAAiC;AACjC,+DAA2D;AAC3D,6EAA4E;AAC5E,mDAA+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,GAAa,EAAE,CAAC;QAExC,IAAI,OAAO,CAAC,OAAO,IAAI,OAAO,CAAC,OAAO,CAAC,MAAM,GAAG,CAAC,EAAE;YACjD,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,MAAM,EAAE,EAAE;gBACjC,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE;oBACzB,iBAAiB,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;iBAChC;qBAAM;oBACL,kBAAkB,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;iBACjC;YACH,CAAC,CAAC,CAAC;SACJ;QAED,MAAM,OAAO,GAAG,IAAA,8BAAoB,EAAC,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC,SAAS,CAAC,CAAC;QAEtE,MAAM,WAAW,GAAG,MAAM,IAAA,qBAAoB,EAAC,IAAI,kCAC9C,OAAO,KACV,OAAO,EAAE,IAAI,EACb,IAAI,EAAE,IAAI,EACV,UAAU,EAAE,IAAI,IAChB,CAAC;QAEH,MAAM,IAAA,kBAAO,EAAC,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AAC,SAAS,CAClB,KAAK,IAAA,cAAK,EAAC,MAAM,CAAC,CAAC,SAAS,WAAW,EAC1C,EAAE,CACH;QACH,CAAC,CAAC,EAAE,CAAC;IAET,IAAI,CAAC,KAAK,CACR,IAAA,0BAAiB,EAAC,UAAU,EAAE,wBAAwB,CAAC,EACvD;;EAEF,YAAY;;;CAGb,CACE,CAAC;IAEF,MAAM,yBAAyB,GAAG,IAAA,0BAAiB,EACjD,UAAU,EACV,OAAO,CAAC,UAAU,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,mBAAmB,CAC1D,CAAC;IACF,MAAM,mBAAmB,GAAG,IAAI,CAAC,IAAI,CAAC,yBAAyB,EAAE,OAAO,CAAC,CAAC;IAE1E,IAAI,CAAC,mBAAmB,CAAC,QAAQ,CAAC,uBAAuB,CAAC,EAAE;QAC1D,OAAO;KACR;IAED,IAAI,UAAU,GAAG,EAAE,CAAC,gBAAgB,CAClC,yBAAyB,EACzB,mBAAmB,EACnB,EAAE,CAAC,YAAY,CAAC,MAAM,EACtB,IAAI,CACL,CAAC;IAEF,IAAI,mBAAmB,CAAC,QAAQ,CAAC,WAAW,CAAC,EAAE;QAC7C,UAAU,GAAG,IAAA,oBAAQ,EACnB,IAAI,EACJ,yBAAyB,EACzB,UAAU,EACV;;;OAGC,CACF,CAAC;KACH;SAAM;QACL,IAAA,qCAAkB,EAChB,IAAI,EACJ,yBAAyB,EACzB;;;MAGA,CACD,CAAC;QAEF,IAAI,CAAC,KAAK,CACR,yBAAyB,EACzB;MACA,IAAI,CAAC,IAAI,CAAC,yBAAyB,EAAE,OAAO,CAAC,EAAE,CAChD,CAAC;KACH;AACH,CAAC"}
|
|
@@ -149,6 +149,11 @@
|
|
|
149
149
|
"description": "Skip formatting files.",
|
|
150
150
|
"type": "boolean",
|
|
151
151
|
"default": false
|
|
152
|
+
},
|
|
153
|
+
"standalone": {
|
|
154
|
+
"type": "boolean",
|
|
155
|
+
"description": "Whether to generate a host application that uses standalone components.",
|
|
156
|
+
"default": false
|
|
152
157
|
}
|
|
153
158
|
},
|
|
154
159
|
"additionalProperties": false,
|
|
@@ -21,9 +21,7 @@
|
|
|
21
21
|
"description": "The name of the library to create the secondary entry point for.",
|
|
22
22
|
"x-prompt": "What library would you like to create the secondary entry point for?",
|
|
23
23
|
"pattern": "^[a-zA-Z].*$",
|
|
24
|
-
"
|
|
25
|
-
"$source": "projectName"
|
|
26
|
-
}
|
|
24
|
+
"x-dropdown": "projects"
|
|
27
25
|
},
|
|
28
26
|
"skipModule": {
|
|
29
27
|
"type": "boolean",
|
|
@@ -5,6 +5,7 @@ const devkit_1 = require("@nrwl/devkit");
|
|
|
5
5
|
const application_1 = require("../application/application");
|
|
6
6
|
const get_mf_projects_1 = require("../../utils/get-mf-projects");
|
|
7
7
|
const project_1 = require("../utils/project");
|
|
8
|
+
const setup_mf_1 = require("../setup-mf/setup-mf");
|
|
8
9
|
function findNextAvailablePort(tree) {
|
|
9
10
|
var _a, _b, _c;
|
|
10
11
|
const mfProjects = (0, get_mf_projects_1.getMFProjects)(tree);
|
|
@@ -24,8 +25,24 @@ function remote(tree, options) {
|
|
|
24
25
|
if (options.host && !projects.has(options.host)) {
|
|
25
26
|
throw new Error(`The name of the application to be used as the host app does not exist. (${options.host})`);
|
|
26
27
|
}
|
|
27
|
-
const
|
|
28
|
+
const appName = (0, project_1.normalizeProjectName)(options.name, options.directory);
|
|
29
|
+
const port = (_a = options.port) !== null && _a !== void 0 ? _a : findNextAvailablePort(tree);
|
|
30
|
+
const installTask = yield (0, application_1.default)(tree, Object.assign(Object.assign({}, options), { routing: true, skipDefaultProject: true, port }));
|
|
31
|
+
yield (0, setup_mf_1.setupMf)(tree, {
|
|
32
|
+
appName,
|
|
33
|
+
mfType: 'remote',
|
|
34
|
+
routing: true,
|
|
35
|
+
host: options.host,
|
|
36
|
+
port,
|
|
37
|
+
skipPackageJson: options.skipPackageJson,
|
|
38
|
+
skipFormat: true,
|
|
39
|
+
e2eProjectName: `${appName}-e2e`,
|
|
40
|
+
standalone: options.standalone,
|
|
41
|
+
});
|
|
28
42
|
removeDeadCode(tree, options);
|
|
43
|
+
if (!options.skipFormat) {
|
|
44
|
+
yield (0, devkit_1.formatFiles)(tree);
|
|
45
|
+
}
|
|
29
46
|
return installTask;
|
|
30
47
|
});
|
|
31
48
|
}
|
|
@@ -42,13 +59,14 @@ function removeDeadCode(tree, options) {
|
|
|
42
59
|
tree.rename((0, devkit_1.joinPathFragments)(project.sourceRoot, 'app/nx-welcome.component.ts'), (0, devkit_1.joinPathFragments)(project.sourceRoot, 'app/remote-entry/nx-welcome.component.ts'));
|
|
43
60
|
tree.delete((0, devkit_1.joinPathFragments)(project.sourceRoot, 'app/app.component.spec.ts'));
|
|
44
61
|
tree.delete((0, devkit_1.joinPathFragments)(project.sourceRoot, 'app/app.component.html'));
|
|
45
|
-
const
|
|
46
|
-
|
|
47
|
-
|
|
62
|
+
const pathToAppComponent = (0, devkit_1.joinPathFragments)(project.sourceRoot, 'app/app.component.ts');
|
|
63
|
+
if (!options.standalone) {
|
|
64
|
+
const component = tree.read(pathToAppComponent, 'utf-8').split('templateUrl')[0] +
|
|
65
|
+
`template: '<router-outlet></router-outlet>'
|
|
48
66
|
})
|
|
49
67
|
export class AppComponent {}`;
|
|
50
|
-
|
|
51
|
-
|
|
68
|
+
tree.write(pathToAppComponent, component);
|
|
69
|
+
tree.write((0, devkit_1.joinPathFragments)(project.sourceRoot, 'app/app.module.ts'), `import { NgModule } from '@angular/core';
|
|
52
70
|
import { BrowserModule } from '@angular/platform-browser';
|
|
53
71
|
import { RouterModule } from '@angular/router';
|
|
54
72
|
import { AppComponent } from './app.component';
|
|
@@ -66,5 +84,9 @@ import { AppComponent } from './app.component';
|
|
|
66
84
|
bootstrap: [AppComponent],
|
|
67
85
|
})
|
|
68
86
|
export class AppModule {}`);
|
|
87
|
+
}
|
|
88
|
+
else {
|
|
89
|
+
tree.delete(pathToAppComponent);
|
|
90
|
+
}
|
|
69
91
|
}
|
|
70
92
|
//# sourceMappingURL=remote.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"remote.js","sourceRoot":"","sources":["../../../../../../packages/angular/src/generators/remote/remote.ts"],"names":[],"mappings":";;;AAAA,
|
|
1
|
+
{"version":3,"file":"remote.js","sourceRoot":"","sources":["../../../../../../packages/angular/src/generators/remote/remote.ts"],"names":[],"mappings":";;;AAAA,yCAMsB;AAEtB,4DAA8D;AAC9D,iEAA4D;AAC5D,8CAAwD;AACxD,mDAA+C;AAE/C,SAAS,qBAAqB,CAAC,IAAU;;IACvC,MAAM,UAAU,GAAG,IAAA,+BAAa,EAAC,IAAI,CAAC,CAAC;IAEvC,MAAM,KAAK,GAAG,IAAI,GAAG,CAAS,CAAC,IAAI,CAAC,CAAC,CAAC;IACtC,KAAK,MAAM,SAAS,IAAI,UAAU,EAAE;QAClC,MAAM,EAAE,OAAO,EAAE,GAAG,IAAA,iCAAwB,EAAC,IAAI,EAAE,SAAS,CAAC,CAAC;QAC9D,MAAM,IAAI,GAAG,MAAA,MAAA,MAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,KAAK,0CAAE,OAAO,0CAAE,IAAI,mCAAI,IAAI,CAAC;QACnD,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;KACjB;IAED,MAAM,iBAAiB,GAAG,IAAI,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC,GAAG,CAAC,CAAC;IAEjD,OAAO,iBAAiB,CAAC;AAC3B,CAAC;AAED,SAA8B,MAAM,CAAC,IAAU,EAAE,OAAe;;;QAC9D,MAAM,QAAQ,GAAG,IAAA,oBAAW,EAAC,IAAI,CAAC,CAAC;QACnC,IAAI,OAAO,CAAC,IAAI,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE;YAC/C,MAAM,IAAI,KAAK,CACb,2EAA2E,OAAO,CAAC,IAAI,GAAG,CAC3F,CAAC;SACH;QAED,MA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B,CAAC;QACF,IAAI,IAAI,CAAC,MAAM,CAAC,oBAAoB,CAAC,EAAE;YACrC,IAAI,CAAC,MAAM,CAAC,oBAAoB,CAAC,CAAC;SACnC;IACH,CAAC,CAAC,CAAC;IAEH,IAAI,CAAC,MAAM,CACT,IAAA,0BAAiB,EAAC,OAAO,CAAC,UAAU,EAAE,6BAA6B,CAAC,EACpE,IAAA,0BAAiB,EACf,OAAO,CAAC,UAAU,EAClB,0CAA0C,CAC3C,CACF,CAAC;IACF,IAAI,CAAC,MAAM,CACT,IAAA,0BAAiB,EAAC,OAAO,CAAC,UAAU,EAAE,2BAA2B,CAAC,CACnE,CAAC;IACF,IAAI,CAAC,MAAM,CAAC,IAAA,0BAAiB,EAAC,OAAO,CAAC,UAAU,EAAE,wBAAwB,CAAC,CAAC,CAAC;IAE7E,MAAM,kBAAkB,GAAG,IAAA,0BAAiB,EAC1C,OAAO,CAAC,UAAU,EAClB,sBAAsB,CACvB,CAAC;IACF,IAAI,CAAC,OAAO,CAAC,UAAU,EAAE;QACvB,MAAM,SAAS,GACb,IAAI,CAAC,IAAI,CAAC,kBAAkB,EAAE,OAAO,CAAC,CAAC,KAAK,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC;YAC9D;;6BAEuB,CAAC;QAE1B,IAAI,CAAC,KAAK,CAAC,kBAAkB,EAAE,SAAS,CAAC,CAAC;QAE1C,IAAI,CAAC,KAAK,CACR,IAAA,0BAAiB,EAAC,OAAO,CAAC,UAAU,EAAE,mBAAmB,CAAC,EAC1D;;;;;;;;;;;;;;;;;0BAiBoB,CACrB,CAAC;KACH;SAAM;QACL,IAAI,CAAC,MAAM,CAAC,kBAAkB,CAAC,CAAC;KACjC;AACH,CAAC"}
|
|
@@ -23,9 +23,7 @@
|
|
|
23
23
|
"host": {
|
|
24
24
|
"type": "string",
|
|
25
25
|
"description": "The name of the host app to attach this remote app to.",
|
|
26
|
-
"
|
|
27
|
-
"$source": "projectName"
|
|
28
|
-
}
|
|
26
|
+
"x-dropdown": "projects"
|
|
29
27
|
},
|
|
30
28
|
"port": {
|
|
31
29
|
"type": "number",
|
|
@@ -146,6 +144,11 @@
|
|
|
146
144
|
"description": "Skip formatting files.",
|
|
147
145
|
"type": "boolean",
|
|
148
146
|
"default": false
|
|
147
|
+
},
|
|
148
|
+
"standalone": {
|
|
149
|
+
"description": "Whether to generate a remote application with standalone components.",
|
|
150
|
+
"type": "boolean",
|
|
151
|
+
"default": false
|
|
149
152
|
}
|
|
150
153
|
},
|
|
151
154
|
"additionalProperties": false,
|
|
@@ -4,6 +4,6 @@ import { Component } from '@angular/core';
|
|
|
4
4
|
selector: '<%= prefix %>-<%= appName %>-entry',
|
|
5
5
|
template: `<<%= prefix %>-nx-welcome></<%= prefix %>-nx-welcome>`<% } else { %>
|
|
6
6
|
selector: '<%= appName %>-entry',
|
|
7
|
-
template:
|
|
7
|
+
template: `<nx-welcome></nx-welcome>`<% } %>
|
|
8
8
|
})
|
|
9
9
|
export class RemoteEntryComponent {}
|
package/src/generators/setup-mf/files/standalone-entry-component-files/entry.component.ts__tmpl__
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Component } from '@angular/core';
|
|
2
|
+
import { CommonModule } from '@angular/common';
|
|
3
|
+
import { NxWelcomeComponent } from './nx-welcome.component';
|
|
4
|
+
|
|
5
|
+
@Component({
|
|
6
|
+
standalone: true,
|
|
7
|
+
imports: [CommonModule, NxWelcomeComponent],<% if (prefix) { %>
|
|
8
|
+
selector: '<%= prefix %>-<%= appName %>-entry',
|
|
9
|
+
template: `<<%= prefix %>-nx-welcome></<%= prefix %>-nx-welcome>`<% } else { %>
|
|
10
|
+
selector: '<%= appName %>-entry',
|
|
11
|
+
template: `<nx-welcome></nx-welcome>`<% } %>
|
|
12
|
+
})
|
|
13
|
+
export class RemoteEntryComponent {}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
module.exports = {
|
|
2
2
|
name: '<%= name %>',<% if(type === 'host') { %>
|
|
3
3
|
remotes: [<% remotes.forEach(function(remote) { %>'<%= remote.remoteName %>',<% }); %>]<% } %><% if(type === 'remote') { %>
|
|
4
|
-
exposes: {
|
|
5
|
-
'./
|
|
4
|
+
exposes: {<% if(standalone) { %>
|
|
5
|
+
'./Routes': '<%= projectRoot %>/src/app/remote-entry/routes.ts',<% } else { %>
|
|
6
|
+
'./Module': '<%= projectRoot %>/src/app/remote-entry/entry.module.ts',<% } %>
|
|
6
7
|
},<% } %>
|
|
7
8
|
}
|
|
@@ -6,15 +6,20 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.addCypressOnErrorWorkaround = void 0;
|
|
7
7
|
const devkit_1 = require("@nrwl/devkit");
|
|
8
8
|
function addCypressOnErrorWorkaround(tree, schema) {
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
if (!schema.e2eProjectName) {
|
|
10
|
+
return;
|
|
11
|
+
}
|
|
12
|
+
const e2eProjectName = schema.e2eProjectName;
|
|
11
13
|
let e2eProject;
|
|
12
14
|
try {
|
|
13
15
|
e2eProject = (0, devkit_1.readProjectConfiguration)(tree, e2eProjectName);
|
|
14
16
|
}
|
|
15
|
-
catch (
|
|
16
|
-
devkit_1.logger.warn(`Could not find an associated e2e project for ${schema.appName} with name ${e2eProjectName}.
|
|
17
|
-
If
|
|
17
|
+
catch (_a) {
|
|
18
|
+
devkit_1.logger.warn(`Could not find an associated e2e project for ${schema.appName} with name ${e2eProjectName}.
|
|
19
|
+
If there is an associated e2e project for this application, and it uses Cypress, you will need to add a workaround to allow Cypress to test correctly.
|
|
20
|
+
An error will be thrown in the console when you serve the application, coming from styles.js. It is an error that can be safely ignored and will not reach production due to how production builds of Angular are created.
|
|
21
|
+
You can find how to implement that workaround here: https://docs.cypress.io/api/events/catalog-of-events#Uncaught-Exceptions
|
|
22
|
+
`);
|
|
18
23
|
return;
|
|
19
24
|
}
|
|
20
25
|
if (e2eProject.targets.e2e.executor !== '@nrwl/cypress:cypress') {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"add-cypress-workaround.js","sourceRoot":"","sources":["../../../../../../../packages/angular/src/generators/setup-mf/lib/add-cypress-workaround.ts"],"names":[],"mappings":";AAAA,6DAA6D;AAC7D,iEAAiE;AACjE,iDAAiD;;;
|
|
1
|
+
{"version":3,"file":"add-cypress-workaround.js","sourceRoot":"","sources":["../../../../../../../packages/angular/src/generators/setup-mf/lib/add-cypress-workaround.ts"],"names":[],"mappings":";AAAA,6DAA6D;AAC7D,iEAAiE;AACjE,iDAAiD;;;AAGjD,yCAIsB;AAGtB,SAAgB,2BAA2B,CAAC,IAAU,EAAE,MAAc;IACpE,IAAI,CAAC,MAAM,CAAC,cAAc,EAAE;QAC1B,OAAO;KACR;IAED,MAAM,cAAc,GAAG,MAAM,CAAC,cAAc,CAAC;IAC7C,IAAI,UAAgC,CAAC;IAErC,IAAI;QACF,UAAU,GAAG,IAAA,iCAAwB,EAAC,IAAI,EAAE,cAAc,CAAC,CAAC;KAC7D;IAAC,WAAM;QACN,eAAM,CAAC,IAAI,CAAC,gDAAgD,MAAM,CAAC,OAAO,cAAc,cAAc;;;;KAIrG,CAAC,CAAC;QACH,OAAO;KACR;IAED,IAAI,UAAU,CAAC,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,uBAAuB,EAAE;QAC/D,kCAAkC;QAClC,OAAO;KACR;IAED,MAAM,YAAY,GAAG;;;;;MAKjB,CAAC;IAEL,MAAM,kBAAkB,GAAG,IAAA,0BAAiB,EAC1C,UAAU,CAAC,UAAU,EACrB,kBAAkB,CACnB,CAAC;IAEF,MAAM,eAAe,GAAG,IAAI,CAAC,MAAM,CAAC,kBAAkB,CAAC;QACrD,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,kBAAkB,EAAE,OAAO,CAAC;QACxC,CAAC,CAAC,EAAE,CAAC;IACP,IAAI,CAAC,KAAK,CAAC,kBAAkB,EAAE,GAAG,eAAe,KAAK,YAAY,EAAE,CAAC,CAAC;AACxE,CAAC;AAxCD,kEAwCC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.addRemoteEntry = void 0;
|
|
4
|
+
const devkit_1 = require("@nrwl/devkit");
|
|
5
|
+
function addRemoteEntry(tree, { appName, routing, mfType, prefix, standalone }, appRoot) {
|
|
6
|
+
if (mfType === 'remote') {
|
|
7
|
+
prefix = prefix !== null && prefix !== void 0 ? prefix : (0, devkit_1.readWorkspaceConfiguration)(tree).npmScope;
|
|
8
|
+
(0, devkit_1.generateFiles)(tree, standalone
|
|
9
|
+
? (0, devkit_1.joinPathFragments)(__dirname, '../files/standalone-entry-component-files')
|
|
10
|
+
: (0, devkit_1.joinPathFragments)(__dirname, '../files/entry-module-files'), `${appRoot}/src/app/remote-entry`, {
|
|
11
|
+
tmpl: '',
|
|
12
|
+
appName,
|
|
13
|
+
routing,
|
|
14
|
+
prefix,
|
|
15
|
+
});
|
|
16
|
+
if (!standalone) {
|
|
17
|
+
tree.write(`${appRoot}/src/app/app.module.ts`, `/*
|
|
18
|
+
* This RemoteEntryModule is imported here to allow TS to find the Module during
|
|
19
|
+
* compilation, allowing it to be included in the built bundle. This is required
|
|
20
|
+
* for the Module Federation Plugin to expose the Module correctly.
|
|
21
|
+
* */
|
|
22
|
+
import { RemoteEntryModule } from './remote-entry/entry.module';
|
|
23
|
+
${tree.read(`${appRoot}/src/app/app.module.ts`, 'utf-8')}`);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
exports.addRemoteEntry = addRemoteEntry;
|
|
28
|
+
//# sourceMappingURL=add-remote-entry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"add-remote-entry.js","sourceRoot":"","sources":["../../../../../../../packages/angular/src/generators/setup-mf/lib/add-remote-entry.ts"],"names":[],"mappings":";;;AACA,yCAIsB;AAGtB,SAAgB,cAAc,CAC5B,IAAU,EACV,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,UAAU,EAAU,EACxD,OAAe;IAEf,IAAI,MAAM,KAAK,QAAQ,EAAE;QACvB,MAAM,GAAG,MAAM,aAAN,MAAM,cAAN,MAAM,GAAI,IAAA,mCAA0B,EAAC,IAAI,CAAC,CAAC,QAAQ,CAAC;QAC7D,IAAA,sBAAa,EACX,IAAI,EACJ,UAAU;YACR,CAAC,CAAC,IAAA,0BAAiB,EACf,SAAS,EACT,2CAA2C,CAC5C;YACH,CAAC,CAAC,IAAA,0BAAiB,EAAC,SAAS,EAAE,6BAA6B,CAAC,EAC/D,GAAG,OAAO,uBAAuB,EACjC;YACE,IAAI,EAAE,EAAE;YACR,OAAO;YACP,OAAO;YACP,MAAM;SACP,CACF,CAAC;QAEF,IAAI,CAAC,UAAU,EAAE;YACf,IAAI,CAAC,KAAK,CACR,GAAG,OAAO,wBAAwB,EAClC;;;;;;EAMN,IAAI,CAAC,IAAI,CAAC,GAAG,OAAO,wBAAwB,EAAE,OAAO,CAAC,EAAE,CACnD,CAAC;SACH;KACF;AACH,CAAC;AArCD,wCAqCC"}
|
|
@@ -6,6 +6,7 @@ const tsquery_1 = require("@phenomnomnominal/tsquery");
|
|
|
6
6
|
const ts = require("typescript");
|
|
7
7
|
const ast_utils_1 = require("../../../utils/nx-devkit/ast-utils");
|
|
8
8
|
const ast_utils_2 = require("@nrwl/workspace/src/utilities/ast-utils");
|
|
9
|
+
const standalone_utils_1 = require("../../../utils/nx-devkit/standalone-utils");
|
|
9
10
|
function checkIsCommaNeeded(mfRemoteText) {
|
|
10
11
|
const remoteText = mfRemoteText.replace(/\s+/g, '');
|
|
11
12
|
return !remoteText.endsWith(',]')
|
|
@@ -29,7 +30,8 @@ function addRemoteToHost(tree, options) {
|
|
|
29
30
|
const declarationFilePath = (0, devkit_1.joinPathFragments)(hostProject.sourceRoot, 'remotes.d.ts');
|
|
30
31
|
const declarationFileContent = (tree.exists(declarationFilePath)
|
|
31
32
|
? tree.read(declarationFilePath, 'utf-8')
|
|
32
|
-
: '') +
|
|
33
|
+
: '') +
|
|
34
|
+
`\ndeclare module '${options.appName}/${options.standalone ? `Routes` : `Module`}';`;
|
|
33
35
|
tree.write(declarationFilePath, declarationFileContent);
|
|
34
36
|
addLazyLoadedRouteToHostAppModule(tree, options, hostFederationType);
|
|
35
37
|
}
|
|
@@ -59,25 +61,39 @@ function addRemoteToDynamicHost(tree, options, pathToMfManifest) {
|
|
|
59
61
|
// TODO(colum): future work: allow dev to pass to path to routing module
|
|
60
62
|
function addLazyLoadedRouteToHostAppModule(tree, options, hostFederationType) {
|
|
61
63
|
const hostAppConfig = (0, devkit_1.readProjectConfiguration)(tree, options.host);
|
|
62
|
-
const
|
|
63
|
-
|
|
64
|
+
const isHostStandalone = !tree
|
|
65
|
+
.read((0, devkit_1.joinPathFragments)(hostAppConfig.sourceRoot, 'bootstrap.ts'), 'utf-8')
|
|
66
|
+
.includes('bootstrapModule');
|
|
67
|
+
const pathToHostRootRouting = isHostStandalone
|
|
68
|
+
? `${hostAppConfig.sourceRoot}/bootstrap.ts`
|
|
69
|
+
: `${hostAppConfig.sourceRoot}/app/app.module.ts`;
|
|
70
|
+
if (!tree.exists(pathToHostRootRouting)) {
|
|
64
71
|
return;
|
|
65
72
|
}
|
|
66
|
-
const
|
|
67
|
-
if (!
|
|
73
|
+
const hostRootRoutingFile = tree.read(pathToHostRootRouting, 'utf-8');
|
|
74
|
+
if (!hostRootRoutingFile.includes('RouterModule.forRoot(')) {
|
|
68
75
|
return;
|
|
69
76
|
}
|
|
70
|
-
let sourceFile = ts.createSourceFile(
|
|
77
|
+
let sourceFile = ts.createSourceFile(pathToHostRootRouting, hostRootRoutingFile, ts.ScriptTarget.Latest, true);
|
|
71
78
|
if (hostFederationType === 'dynamic') {
|
|
72
|
-
sourceFile = (0, ast_utils_2.insertImport)(tree, sourceFile,
|
|
79
|
+
sourceFile = (0, ast_utils_2.insertImport)(tree, sourceFile, pathToHostRootRouting, 'loadRemoteModule', '@nrwl/angular/mf');
|
|
73
80
|
}
|
|
81
|
+
const routePathName = options.standalone ? 'Routes' : 'Module';
|
|
74
82
|
const routeToAdd = hostFederationType === 'dynamic'
|
|
75
|
-
? `loadRemoteModule('${options.appName}', '
|
|
76
|
-
: `import('${options.appName}
|
|
77
|
-
|
|
83
|
+
? `loadRemoteModule('${options.appName}', './${routePathName}')`
|
|
84
|
+
: `import('${options.appName}/${routePathName}')`;
|
|
85
|
+
if (hostRootRoutingFile.includes('@NgModule')) {
|
|
86
|
+
sourceFile = (0, ast_utils_1.addRoute)(tree, pathToHostRootRouting, sourceFile, `{
|
|
78
87
|
path: '${options.appName}',
|
|
79
88
|
loadChildren: () => ${routeToAdd}.then(m => m.RemoteEntryModule)
|
|
80
89
|
}`);
|
|
90
|
+
}
|
|
91
|
+
else {
|
|
92
|
+
(0, standalone_utils_1.addStandaloneRoute)(tree, pathToHostRootRouting, `{
|
|
93
|
+
path: '${options.appName}',
|
|
94
|
+
loadChildren: () => ${routeToAdd}.then(m => m.RemoteRoutes)
|
|
95
|
+
}`);
|
|
96
|
+
}
|
|
81
97
|
const pathToAppComponentTemplate = (0, devkit_1.joinPathFragments)(hostAppConfig.sourceRoot, 'app/app.component.html');
|
|
82
98
|
const appComponent = tree.read(pathToAppComponentTemplate, 'utf-8');
|
|
83
99
|
if (appComponent.includes(`<ul class="remote-menu">`) &&
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"add-remote-to-host.js","sourceRoot":"","sources":["../../../../../../../packages/angular/src/generators/setup-mf/lib/add-remote-to-host.ts"],"names":[],"mappings":";;;AAAA,yCAOsB;AAEtB,uDAAoD;AACpD,iCAAiC;AAEjC,kEAA8D;AAC9D,uEAAuE;
|
|
1
|
+
{"version":3,"file":"add-remote-to-host.js","sourceRoot":"","sources":["../../../../../../../packages/angular/src/generators/setup-mf/lib/add-remote-to-host.ts"],"names":[],"mappings":";;;AAAA,yCAOsB;AAEtB,u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AY,CAAC,KAAK,CAC3C,CAAC,EACD,qBAAqB,CACtB,sBAAsB,OAAO,CAAC,OAAO,KACpC,IAAA,cAAK,EAAC,OAAO,CAAC,OAAO,CAAC,CAAC,SACzB,cAAc,YAAY,CAAC,KAAK,CAAC,qBAAqB,CAAC,EAAE,CAAC;QAC1D,IAAI,CAAC,KAAK,CAAC,0BAA0B,EAAE,eAAe,CAAC,CAAC;KACzD;AACH,CAAC"}
|
|
@@ -5,7 +5,12 @@ const devkit_1 = require("@nrwl/devkit");
|
|
|
5
5
|
function fixBootstrap(tree, appRoot, options) {
|
|
6
6
|
const mainFilePath = (0, devkit_1.joinPathFragments)(appRoot, 'src/main.ts');
|
|
7
7
|
const bootstrapCode = tree.read(mainFilePath, 'utf-8');
|
|
8
|
-
|
|
8
|
+
if (options.standalone) {
|
|
9
|
+
tree.write(`${appRoot}/src/bootstrap.ts`, standaloneBootstrapCode);
|
|
10
|
+
}
|
|
11
|
+
else {
|
|
12
|
+
tree.write((0, devkit_1.joinPathFragments)(appRoot, 'src/bootstrap.ts'), bootstrapCode);
|
|
13
|
+
}
|
|
9
14
|
const bootstrapImportCode = `import('./bootstrap').catch(err => console.error(err))`;
|
|
10
15
|
const fetchMFManifestCode = `import { setRemoteDefinitions } from '@nrwl/angular/mf';
|
|
11
16
|
|
|
@@ -18,4 +23,22 @@ function fixBootstrap(tree, appRoot, options) {
|
|
|
18
23
|
: bootstrapImportCode);
|
|
19
24
|
}
|
|
20
25
|
exports.fixBootstrap = fixBootstrap;
|
|
26
|
+
const standaloneBootstrapCode = `import {environment} from "./environments/environment";
|
|
27
|
+
import {enableProdMode, importProvidersFrom} from "@angular/core";
|
|
28
|
+
import {bootstrapApplication} from "@angular/platform-browser";
|
|
29
|
+
import {RouterModule} from "@angular/router";
|
|
30
|
+
import {RemoteEntryComponent} from "./app/remote-entry/entry.component";
|
|
31
|
+
import {RemoteRoutes} from "./app/remote-entry/routes";
|
|
32
|
+
|
|
33
|
+
if (environment.production) {
|
|
34
|
+
enableProdMode();
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
bootstrapApplication(RemoteEntryComponent, {
|
|
38
|
+
providers: [
|
|
39
|
+
importProvidersFrom(
|
|
40
|
+
RouterModule.forRoot(RemoteRoutes, {initialNavigation: 'enabledBlocking'})
|
|
41
|
+
)
|
|
42
|
+
]
|
|
43
|
+
});`;
|
|
21
44
|
//# sourceMappingURL=fix-bootstrap.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fix-bootstrap.js","sourceRoot":"","sources":["../../../../../../../packages/angular/src/generators/setup-mf/lib/fix-bootstrap.ts"],"names":[],"mappings":";;;AACA,yCAAiD;AAGjD,SAAgB,YAAY,CAAC,IAAU,EAAE,OAAe,EAAE,OAAe;IACvE,MAAM,YAAY,GAAG,IAAA,0BAAiB,EAAC,OAAO,EAAE,aAAa,CAAC,CAAC;IAC/D,MAAM,aAAa,GAAG,IAAI,CAAC,IAAI,CAAC,YAAY,EAAE,OAAO,CAAC,CAAC;IACvD,IAAI,CAAC,KAAK,CAAC,IAAA,0BAAiB,EAAC,OAAO,EAAE,kBAAkB,CAAC,EAAE,aAAa,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"fix-bootstrap.js","sourceRoot":"","sources":["../../../../../../../packages/angular/src/generators/setup-mf/lib/fix-bootstrap.ts"],"names":[],"mappings":";;;AACA,yCAAiD;AAGjD,SAAgB,YAAY,CAAC,IAAU,EAAE,OAAe,EAAE,OAAe;IACvE,MAAM,YAAY,GAAG,IAAA,0BAAiB,EAAC,OAAO,EAAE,aAAa,CAAC,CAAC;IAC/D,MAAM,aAAa,GAAG,IAAI,CAAC,IAAI,CAAC,YAAY,EAAE,OAAO,CAAC,CAAC;IACvD,IAAI,OAAO,CAAC,UAAU,EAAE;QACtB,IAAI,CAAC,KAAK,CAAC,GAAG,OAAO,mBAAmB,EAAE,uBAAuB,CAAC,CAAC;KACpE;SAAM;QACL,IAAI,CAAC,KAAK,CAAC,IAAA,0BAAiB,EAAC,OAAO,EAAE,kBAAkB,CAAC,EAAE,aAAa,CAAC,CAAC;KAC3E;IAED,MAAM,mBAAmB,GAAG,wDAAwD,CAAC;IAErF,MAAM,mBAAmB,GAAG;;;;;gBAKd,mBAAmB,GAAG,CAAC;IAErC,IAAI,CAAC,KAAK,CACR,YAAY,EACZ,OAAO,CAAC,MAAM,KAAK,MAAM,IAAI,OAAO,CAAC,cAAc,KAAK,SAAS;QAC/D,CAAC,CAAC,mBAAmB;QACrB,CAAC,CAAC,mBAAmB,CACxB,CAAC;AACJ,CAAC;AAxBD,oCAwBC;AAED,MAAM,uBAAuB,GAAG;;;;;;;;;;;;;;;;;IAiB5B,CAAC"}
|
|
@@ -15,6 +15,7 @@ function generateWebpackConfig(host, options, appRoot, remotesWithPorts) {
|
|
|
15
15
|
name: options.appName,
|
|
16
16
|
remotes: remotesWithPorts !== null && remotesWithPorts !== void 0 ? remotesWithPorts : [],
|
|
17
17
|
projectRoot: appRoot,
|
|
18
|
+
standalone: options.standalone,
|
|
18
19
|
});
|
|
19
20
|
}
|
|
20
21
|
exports.generateWebpackConfig = generateWebpackConfig;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generate-config.js","sourceRoot":"","sources":["../../../../../../../packages/angular/src/generators/setup-mf/lib/generate-config.ts"],"names":[],"mappings":";;;AACA,yCAAwE;AAGxE,SAAgB,qBAAqB,CACnC,IAAU,EACV,OAAe,EACf,OAAe,EACf,gBAAwD;IAExD,IACE,IAAI,CAAC,MAAM,CAAC,GAAG,OAAO,8BAA8B,CAAC;QACrD,IAAI,CAAC,MAAM,CAAC,GAAG,OAAO,oBAAoB,CAAC;QAC3C,IAAI,CAAC,MAAM,CAAC,GAAG,OAAO,yBAAyB,CAAC,EAChD;QACA,eAAM,CAAC,IAAI,CACT,+DAA+D,OAAO,CAAC,OAAO;qKACiF,CAChK,CAAC;KACH;IAED,IAAA,sBAAa,EACX,IAAI,EACJ,IAAA,0BAAiB,EAAC,SAAS,EAAE,kBAAkB,CAAC,EAChD,OAAO,EACP;QACE,IAAI,EAAE,EAAE;QACR,IAAI,EAAE,OAAO,CAAC,MAAM;QACpB,IAAI,EAAE,OAAO,CAAC,OAAO;QACrB,OAAO,EAAE,gBAAgB,aAAhB,gBAAgB,cAAhB,gBAAgB,GAAI,EAAE;QAC/B,WAAW,EAAE,OAAO;
|
|
1
|
+
{"version":3,"file":"generate-config.js","sourceRoot":"","sources":["../../../../../../../packages/angular/src/generators/setup-mf/lib/generate-config.ts"],"names":[],"mappings":";;;AACA,yCAAwE;AAGxE,SAAgB,qBAAqB,CACnC,IAAU,EACV,OAAe,EACf,OAAe,EACf,gBAAwD;IAExD,IACE,IAAI,CAAC,MAAM,CAAC,GAAG,OAAO,8BAA8B,CAAC;QACrD,IAAI,CAAC,MAAM,CAAC,GAAG,OAAO,oBAAoB,CAAC;QAC3C,IAAI,CAAC,MAAM,CAAC,GAAG,OAAO,yBAAyB,CAAC,EAChD;QACA,eAAM,CAAC,IAAI,CACT,+DAA+D,OAAO,CAAC,OAAO;qKACiF,CAChK,CAAC;KACH;IAED,IAAA,sBAAa,EACX,IAAI,EACJ,IAAA,0BAAiB,EAAC,SAAS,EAAE,kBAAkB,CAAC,EAChD,OAAO,EACP;QACE,IAAI,EAAE,EAAE;QACR,IAAI,EAAE,OAAO,CAAC,MAAM;QACpB,IAAI,EAAE,OAAO,CAAC,OAAO;QACrB,OAAO,EAAE,gBAAgB,aAAhB,gBAAgB,cAAhB,gBAAgB,GAAI,EAAE;QAC/B,WAAW,EAAE,OAAO;QACpB,UAAU,EAAE,OAAO,CAAC,UAAU;KAC/B,CACF,CAAC;AACJ,CAAC;AA9BD,sDA8BC"}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const tslib_1 = require("tslib");
|
|
4
4
|
tslib_1.__exportStar(require("./add-cypress-workaround"), exports);
|
|
5
|
-
tslib_1.__exportStar(require("./add-entry
|
|
5
|
+
tslib_1.__exportStar(require("./add-remote-entry"), exports);
|
|
6
6
|
tslib_1.__exportStar(require("./add-remote-to-host"), exports);
|
|
7
7
|
tslib_1.__exportStar(require("./change-build-target"), exports);
|
|
8
8
|
tslib_1.__exportStar(require("./fix-bootstrap"), exports);
|
|
@@ -60,6 +60,11 @@
|
|
|
60
60
|
"prefix": {
|
|
61
61
|
"type": "string",
|
|
62
62
|
"description": "The prefix to use for any generated component."
|
|
63
|
+
},
|
|
64
|
+
"standalone": {
|
|
65
|
+
"type": "boolean",
|
|
66
|
+
"description": "Whether the application is a standalone application.",
|
|
67
|
+
"default": false
|
|
63
68
|
}
|
|
64
69
|
},
|
|
65
70
|
"required": ["appName", "mfType"],
|
|
@@ -13,7 +13,7 @@ function setupMf(tree, options) {
|
|
|
13
13
|
const remotesWithPorts = (0, lib_1.getRemotesWithPorts)(tree, options);
|
|
14
14
|
(0, lib_1.addRemoteToHost)(tree, options);
|
|
15
15
|
(0, lib_1.generateWebpackConfig)(tree, options, projectConfig.root, remotesWithPorts);
|
|
16
|
-
(0, lib_1.
|
|
16
|
+
(0, lib_1.addRemoteEntry)(tree, options, projectConfig.root);
|
|
17
17
|
(0, lib_1.changeBuildTarget)(tree, options);
|
|
18
18
|
(0, lib_1.updateTsConfigTarget)(tree, options);
|
|
19
19
|
(0, lib_1.setupServeTarget)(tree, options);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"setup-mf.js","sourceRoot":"","sources":["../../../../../../packages/angular/src/generators/setup-mf/setup-mf.ts"],"names":[],"mappings":";;;;AACA,yCAAqE;AAGrE,+BAWe;AAEf,SAAsB,OAAO,CAAC,IAAU,EAAE,OAAe;;;QACvD,MAAM,aAAa,GAAG,IAAA,iCAAwB,EAAC,IAAI,EAAE,OAAO,CAAC,OAAO,CAAC,CAAC;QAEtE,OAAO,CAAC,cAAc,GAAG,MAAA,OAAO,CAAC,cAAc,mCAAI,QAAQ,CAAC;QAE5D,I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C,CAAC;QAEhC,IAAA,kBAAY,EAAC,IAAI,EAAE,aAAa,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;QAEhD,IAAA,iCAA2B,EAAC,IAAI,EAAE,OAAO,CAAC,CAAC;QAE3C,eAAe;QACf,IAAI,CAAC,OAAO,CAAC,UAAU,EAAE;YACvB,MAAM,IAAA,oBAAW,EAAC,IAAI,CAAC,CAAC;SACzB;;CACF;AA1BD,0BA0BC;AAED,kBAAe,OAAO,CAAC"}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.addEntryModule = void 0;
|
|
4
|
-
const devkit_1 = require("@nrwl/devkit");
|
|
5
|
-
function addEntryModule(host, { appName, routing, mfType, prefix }, appRoot) {
|
|
6
|
-
if (mfType === 'remote') {
|
|
7
|
-
(0, devkit_1.generateFiles)(host, (0, devkit_1.joinPathFragments)(__dirname, '../files/entry-module-files'), `${appRoot}/src/app/remote-entry`, {
|
|
8
|
-
tmpl: '',
|
|
9
|
-
appName,
|
|
10
|
-
routing,
|
|
11
|
-
prefix,
|
|
12
|
-
});
|
|
13
|
-
host.write(`${appRoot}/src/app/app.module.ts`, `/*
|
|
14
|
-
* This RemoteEntryModule is imported here to allow TS to find the Module during
|
|
15
|
-
* compilation, allowing it to be included in the built bundle. This is required
|
|
16
|
-
* for the Module Federation Plugin to expose the Module correctly.
|
|
17
|
-
* */
|
|
18
|
-
import { RemoteEntryModule } from './remote-entry/entry.module';
|
|
19
|
-
${host.read(`${appRoot}/src/app/app.module.ts`, 'utf-8')}`);
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
exports.addEntryModule = addEntryModule;
|
|
23
|
-
//# sourceMappingURL=add-entry-module.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"add-entry-module.js","sourceRoot":"","sources":["../../../../../../../packages/angular/src/generators/setup-mf/lib/add-entry-module.ts"],"names":[],"mappings":";;;AACA,yCAAgE;AAGhE,SAAgB,cAAc,CAC5B,IAAU,EACV,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAU,EAC5C,OAAe;IAEf,IAAI,MAAM,KAAK,QAAQ,EAAE;QACvB,IAAA,sBAAa,EACX,IAAI,EACJ,IAAA,0BAAiB,EAAC,SAAS,EAAE,6BAA6B,CAAC,EAC3D,GAAG,OAAO,uBAAuB,EACjC;YACE,IAAI,EAAE,EAAE;YACR,OAAO;YACP,OAAO;YACP,MAAM;SACP,CACF,CAAC;QAEF,IAAI,CAAC,KAAK,CACR,GAAG,OAAO,wBAAwB,EAClC;;;;;;EAMJ,IAAI,CAAC,IAAI,CAAC,GAAG,OAAO,wBAAwB,EAAE,OAAO,CAAC,EAAE,CACrD,CAAC;KACH;AACH,CAAC;AA7BD,wCA6BC"}
|