@nx/angular 17.0.1 → 17.1.0-beta.0
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/package.json +10 -10
- package/src/builders/module-federation-dev-server/module-federation-dev-server.impl.js +2 -1
- package/src/builders/utilities/webpack.js +3 -1
- package/src/generators/application/files/ng-module/src/app/nx-welcome.component.ts__tpl__ +30 -10
- package/src/generators/application/files/standalone-components/src/app/app.config.ts__tpl__ +1 -1
- package/src/generators/application/files/standalone-components/src/app/nx-welcome.component.ts__tpl__ +30 -10
- package/src/generators/application/files/standalone-components/src/main.ts__tpl__ +7 -1
- package/src/generators/application/lib/add-e2e.js +15 -7
- package/src/generators/ng-add/migrators/projects/e2e.migrator.js +13 -25
- package/src/generators/setup-mf/files/host-files/app.component.spec.ts__tmpl__ +6 -4
- package/src/generators/setup-mf/lib/fix-bootstrap.js +1 -1
- package/src/generators/setup-mf/lib/update-host-app-routes.js +1 -0
- package/src/utils/mf/utils.js +7 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nx/angular",
|
|
3
|
-
"version": "17.0.
|
|
3
|
+
"version": "17.1.0-beta.0",
|
|
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": {
|
|
@@ -79,15 +79,15 @@
|
|
|
79
79
|
"webpack": "^5.80.0",
|
|
80
80
|
"webpack-merge": "^5.8.0",
|
|
81
81
|
"enquirer": "^2.3.6",
|
|
82
|
-
"@nx/devkit": "17.0.
|
|
83
|
-
"@nx/cypress": "17.0.
|
|
84
|
-
"@nx/jest": "17.0.
|
|
85
|
-
"@nx/js": "17.0.
|
|
86
|
-
"@nx/eslint": "17.0.
|
|
87
|
-
"@nx/webpack": "17.0.
|
|
88
|
-
"@nx/web": "17.0.
|
|
89
|
-
"@nx/workspace": "17.0.
|
|
90
|
-
"@nrwl/angular": "17.0.
|
|
82
|
+
"@nx/devkit": "17.1.0-beta.0",
|
|
83
|
+
"@nx/cypress": "17.1.0-beta.0",
|
|
84
|
+
"@nx/jest": "17.1.0-beta.0",
|
|
85
|
+
"@nx/js": "17.1.0-beta.0",
|
|
86
|
+
"@nx/eslint": "17.1.0-beta.0",
|
|
87
|
+
"@nx/webpack": "17.1.0-beta.0",
|
|
88
|
+
"@nx/web": "17.1.0-beta.0",
|
|
89
|
+
"@nx/workspace": "17.1.0-beta.0",
|
|
90
|
+
"@nrwl/angular": "17.1.0-beta.0"
|
|
91
91
|
},
|
|
92
92
|
"peerDependencies": {
|
|
93
93
|
"@angular-devkit/build-angular": ">= 14.0.0 < 17.0.0",
|
|
@@ -13,7 +13,8 @@ const module_federation_2 = require("@nx/webpack/src/utils/module-federation");
|
|
|
13
13
|
const child_process_1 = require("child_process");
|
|
14
14
|
const rxjs_1 = require("rxjs");
|
|
15
15
|
function executeModuleFederationDevServerBuilder(schema, context) {
|
|
16
|
-
|
|
16
|
+
// Force Node to resolve to look for the nx binary that is inside node_modules
|
|
17
|
+
const nxBin = require.resolve('nx/bin/nx');
|
|
17
18
|
const { ...options } = schema;
|
|
18
19
|
const projectGraph = (0, devkit_1.readCachedProjectGraph)();
|
|
19
20
|
const { projects: workspaceProjects } = (0, project_graph_1.readProjectsConfigurationFromProjectGraph)(projectGraph);
|
|
@@ -6,7 +6,9 @@ const internal_1 = require("@nx/js/src/internal");
|
|
|
6
6
|
const devkit_1 = require("@nx/devkit");
|
|
7
7
|
const path_1 = require("path");
|
|
8
8
|
async function mergeCustomWebpackConfig(baseWebpackConfig, pathToWebpackConfig, options, target) {
|
|
9
|
-
const customWebpackConfiguration = resolveCustomWebpackConfig(pathToWebpackConfig,
|
|
9
|
+
const customWebpackConfiguration = resolveCustomWebpackConfig(pathToWebpackConfig, options.tsConfig.startsWith(devkit_1.workspaceRoot)
|
|
10
|
+
? options.tsConfig
|
|
11
|
+
: (0, path_1.join)(devkit_1.workspaceRoot, options.tsConfig));
|
|
10
12
|
// The extra Webpack configuration file can also export a Promise, for instance:
|
|
11
13
|
// `module.exports = new Promise(...)`. If it exports a single object, but not a Promise,
|
|
12
14
|
// then await will just resolve that object.
|
|
@@ -283,6 +283,15 @@ import { Component, ViewEncapsulation } from '@angular/core';
|
|
|
283
283
|
.nx-console svg {
|
|
284
284
|
color: rgba(0, 122, 204, 1);
|
|
285
285
|
}
|
|
286
|
+
.nx-console-jetbrains {
|
|
287
|
+
margin-top: 2rem;
|
|
288
|
+
}
|
|
289
|
+
.nx-console-jetbrains:hover {
|
|
290
|
+
background-color: rgba(255, 49, 140, 1);
|
|
291
|
+
}
|
|
292
|
+
.nx-console-jetbrains svg {
|
|
293
|
+
color: rgba(255, 49, 140, 1);
|
|
294
|
+
}
|
|
286
295
|
#nx-repo:hover {
|
|
287
296
|
background-color: rgba(24, 23, 23, 1);
|
|
288
297
|
}
|
|
@@ -639,24 +648,35 @@ import { Component, ViewEncapsulation } from '@angular/core';
|
|
|
639
648
|
</svg>
|
|
640
649
|
<span>
|
|
641
650
|
Install Nx Console for VSCode
|
|
642
|
-
<span>The official VSCode
|
|
651
|
+
<span>The official VSCode extension for Nx.</span>
|
|
643
652
|
</span>
|
|
644
653
|
</a>
|
|
645
654
|
<a
|
|
646
|
-
class="button-pill rounded shadow nx-console"
|
|
655
|
+
class="button-pill rounded shadow nx-console-jetbrains"
|
|
647
656
|
href="https://plugins.jetbrains.com/plugin/21060-nx-console"
|
|
648
657
|
target="_blank"
|
|
649
658
|
rel="noreferrer"
|
|
650
659
|
>
|
|
651
660
|
<svg
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
661
|
+
height="48"
|
|
662
|
+
width="48"
|
|
663
|
+
viewBox="20 20 60 60"
|
|
664
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
665
|
+
>
|
|
666
|
+
<path d="m22.5 22.5h60v60h-60z" />
|
|
667
|
+
<g fill="#fff">
|
|
668
|
+
<path d="m29.03 71.25h22.5v3.75h-22.5z" />
|
|
669
|
+
<path d="m28.09 38 1.67-1.58a1.88 1.88 0 0 0 1.47.87c.64 0 1.06-.44 1.06-1.31v-5.98h2.58v6a3.48 3.48 0 0 1 -.87 2.6 3.56 3.56 0 0 1 -2.57.95 3.84 3.84 0 0 1 -3.34-1.55z" />
|
|
670
|
+
<path d="m36 30h7.53v2.19h-5v1.44h4.49v2h-4.42v1.49h5v2.21h-7.6z" />
|
|
671
|
+
<path d="m47.23 32.29h-2.8v-2.29h8.21v2.27h-2.81v7.1h-2.6z" />
|
|
672
|
+
<path d="m29.13 43.08h4.42a3.53 3.53 0 0 1 2.55.83 2.09 2.09 0 0 1 .6 1.53 2.16 2.16 0 0 1 -1.44 2.09 2.27 2.27 0 0 1 1.86 2.29c0 1.61-1.31 2.59-3.55 2.59h-4.44zm5 2.89c0-.52-.42-.8-1.18-.8h-1.29v1.64h1.24c.79 0 1.25-.26 1.25-.81zm-.9 2.66h-1.57v1.73h1.62c.8 0 1.24-.31 1.24-.86 0-.5-.4-.87-1.27-.87z" />
|
|
673
|
+
<path d="m38 43.08h4.1a4.19 4.19 0 0 1 3 1 2.93 2.93 0 0 1 .9 2.19 3 3 0 0 1 -1.93 2.89l2.24 3.27h-3l-1.88-2.84h-.87v2.84h-2.56zm4 4.5c.87 0 1.39-.43 1.39-1.11 0-.75-.54-1.12-1.4-1.12h-1.44v2.26z" />
|
|
674
|
+
<path d="m49.59 43h2.5l4 9.44h-2.79l-.67-1.69h-3.63l-.67 1.69h-2.71zm2.27 5.73-1-2.65-1.06 2.65z" />
|
|
675
|
+
<path d="m56.46 43.05h2.6v9.37h-2.6z" />
|
|
676
|
+
<path d="m60.06 43.05h2.42l3.37 5v-5h2.57v9.37h-2.26l-3.53-5.14v5.14h-2.57z" />
|
|
677
|
+
<path d="m68.86 51 1.45-1.73a4.84 4.84 0 0 0 3 1.13c.71 0 1.08-.24 1.08-.65 0-.4-.31-.6-1.59-.91-2-.46-3.53-1-3.53-2.93 0-1.74 1.37-3 3.62-3a5.89 5.89 0 0 1 3.86 1.25l-1.26 1.84a4.63 4.63 0 0 0 -2.62-.92c-.63 0-.94.25-.94.6 0 .42.32.61 1.63.91 2.14.46 3.44 1.16 3.44 2.91 0 1.91-1.51 3-3.79 3a6.58 6.58 0 0 1 -4.35-1.5z" />
|
|
678
|
+
</g>
|
|
679
|
+
</svg>
|
|
660
680
|
<span>
|
|
661
681
|
Install Nx Console for JetBrains
|
|
662
682
|
<span>Available for WebStorm, Intellij IDEA Ultimate and more!</span>
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ApplicationConfig } from '@angular/core';<% if (routing) { %>
|
|
1
|
+
import { ApplicationConfig } from <% if (installedAngularInfo.major >= 16) { %>'@angular/core';<% } else { %>'@angular/platform-browser';<% } %><% if (routing) { %>
|
|
2
2
|
import { provideRouter, withEnabledBlockingInitialNavigation } from '@angular/router';
|
|
3
3
|
import { appRoutes } from './app.routes';<% } %>
|
|
4
4
|
|
|
@@ -286,6 +286,15 @@ import { CommonModule } from '@angular/common';
|
|
|
286
286
|
.nx-console svg {
|
|
287
287
|
color: rgba(0, 122, 204, 1);
|
|
288
288
|
}
|
|
289
|
+
.nx-console-jetbrains {
|
|
290
|
+
margin-top: 2rem;
|
|
291
|
+
}
|
|
292
|
+
.nx-console-jetbrains:hover {
|
|
293
|
+
background-color: rgba(255, 49, 140, 1);
|
|
294
|
+
}
|
|
295
|
+
.nx-console-jetbrains svg {
|
|
296
|
+
color: rgba(255, 49, 140, 1);
|
|
297
|
+
}
|
|
289
298
|
#nx-repo:hover {
|
|
290
299
|
background-color: rgba(24, 23, 23, 1);
|
|
291
300
|
}
|
|
@@ -642,24 +651,35 @@ import { CommonModule } from '@angular/common';
|
|
|
642
651
|
</svg>
|
|
643
652
|
<span>
|
|
644
653
|
Install Nx Console for VSCode
|
|
645
|
-
<span>The official VSCode
|
|
654
|
+
<span>The official VSCode extension for Nx.</span>
|
|
646
655
|
</span>
|
|
647
656
|
</a>
|
|
648
657
|
<a
|
|
649
|
-
class="button-pill rounded shadow nx-console"
|
|
658
|
+
class="button-pill rounded shadow nx-console-jetbrains"
|
|
650
659
|
href="https://plugins.jetbrains.com/plugin/21060-nx-console"
|
|
651
660
|
target="_blank"
|
|
652
661
|
rel="noreferrer"
|
|
653
662
|
>
|
|
654
663
|
<svg
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
664
|
+
height="48"
|
|
665
|
+
width="48"
|
|
666
|
+
viewBox="20 20 60 60"
|
|
667
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
668
|
+
>
|
|
669
|
+
<path d="m22.5 22.5h60v60h-60z" />
|
|
670
|
+
<g fill="#fff">
|
|
671
|
+
<path d="m29.03 71.25h22.5v3.75h-22.5z" />
|
|
672
|
+
<path d="m28.09 38 1.67-1.58a1.88 1.88 0 0 0 1.47.87c.64 0 1.06-.44 1.06-1.31v-5.98h2.58v6a3.48 3.48 0 0 1 -.87 2.6 3.56 3.56 0 0 1 -2.57.95 3.84 3.84 0 0 1 -3.34-1.55z" />
|
|
673
|
+
<path d="m36 30h7.53v2.19h-5v1.44h4.49v2h-4.42v1.49h5v2.21h-7.6z" />
|
|
674
|
+
<path d="m47.23 32.29h-2.8v-2.29h8.21v2.27h-2.81v7.1h-2.6z" />
|
|
675
|
+
<path d="m29.13 43.08h4.42a3.53 3.53 0 0 1 2.55.83 2.09 2.09 0 0 1 .6 1.53 2.16 2.16 0 0 1 -1.44 2.09 2.27 2.27 0 0 1 1.86 2.29c0 1.61-1.31 2.59-3.55 2.59h-4.44zm5 2.89c0-.52-.42-.8-1.18-.8h-1.29v1.64h1.24c.79 0 1.25-.26 1.25-.81zm-.9 2.66h-1.57v1.73h1.62c.8 0 1.24-.31 1.24-.86 0-.5-.4-.87-1.27-.87z" />
|
|
676
|
+
<path d="m38 43.08h4.1a4.19 4.19 0 0 1 3 1 2.93 2.93 0 0 1 .9 2.19 3 3 0 0 1 -1.93 2.89l2.24 3.27h-3l-1.88-2.84h-.87v2.84h-2.56zm4 4.5c.87 0 1.39-.43 1.39-1.11 0-.75-.54-1.12-1.4-1.12h-1.44v2.26z" />
|
|
677
|
+
<path d="m49.59 43h2.5l4 9.44h-2.79l-.67-1.69h-3.63l-.67 1.69h-2.71zm2.27 5.73-1-2.65-1.06 2.65z" />
|
|
678
|
+
<path d="m56.46 43.05h2.6v9.37h-2.6z" />
|
|
679
|
+
<path d="m60.06 43.05h2.42l3.37 5v-5h2.57v9.37h-2.26l-3.53-5.14v5.14h-2.57z" />
|
|
680
|
+
<path d="m68.86 51 1.45-1.73a4.84 4.84 0 0 0 3 1.13c.71 0 1.08-.24 1.08-.65 0-.4-.31-.6-1.59-.91-2-.46-3.53-1-3.53-2.93 0-1.74 1.37-3 3.62-3a5.89 5.89 0 0 1 3.86 1.25l-1.26 1.84a4.63 4.63 0 0 0 -2.62-.92c-.63 0-.94.25-.94.6 0 .42.32.61 1.63.91 2.14.46 3.44 1.16 3.44 2.91 0 1.91-1.51 3-3.79 3a6.58 6.58 0 0 1 -4.35-1.5z" />
|
|
681
|
+
</g>
|
|
682
|
+
</svg>
|
|
663
683
|
<span>
|
|
664
684
|
Install Nx Console for JetBrains
|
|
665
685
|
<span>Available for WebStorm, Intellij IDEA Ultimate and more!</span>
|
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
import { bootstrapApplication } from '@angular/platform-browser';
|
|
2
2
|
import { appConfig } from './app/app.config';
|
|
3
|
-
import { AppComponent } from './app/app.component'
|
|
3
|
+
import { AppComponent } from './app/app.component';<% if(installedAngularInfo.major === 14) { %>
|
|
4
|
+
import { enableProdMode } from '@angular/core';
|
|
5
|
+
import { environment } from './environments/environment';
|
|
6
|
+
|
|
7
|
+
if(environment.production) {
|
|
8
|
+
enableProdMode();
|
|
9
|
+
}<% } %>
|
|
4
10
|
|
|
5
11
|
bootstrapApplication(AppComponent, appConfig).catch((err) => console.error(err));
|
|
@@ -8,21 +8,28 @@ async function addE2e(tree, options) {
|
|
|
8
8
|
if (options.e2eTestRunner === 'cypress') {
|
|
9
9
|
// TODO: This can call `@nx/web:static-config` generator when ready
|
|
10
10
|
addFileServerTarget(tree, options, 'serve-static');
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
11
|
+
(0, devkit_1.addProjectConfiguration)(tree, options.e2eProjectName, {
|
|
12
|
+
projectType: 'application',
|
|
13
|
+
root: options.e2eProjectRoot,
|
|
14
|
+
sourceRoot: (0, devkit_1.joinPathFragments)(options.e2eProjectRoot, 'src'),
|
|
15
|
+
targets: {},
|
|
16
|
+
tags: [],
|
|
17
|
+
implicitDependencies: [options.name],
|
|
18
|
+
});
|
|
19
|
+
await (0, cypress_1.configurationGenerator)(tree, {
|
|
20
|
+
project: options.e2eProjectName,
|
|
21
|
+
directory: 'src',
|
|
17
22
|
linter: options.linter,
|
|
18
|
-
standaloneConfig: options.standaloneConfig,
|
|
19
23
|
skipPackageJson: options.skipPackageJson,
|
|
20
24
|
skipFormat: true,
|
|
25
|
+
devServerTarget: `${options.name}:serve:development`,
|
|
26
|
+
rootProject: options.rootProject,
|
|
21
27
|
});
|
|
22
28
|
}
|
|
23
29
|
else if (options.e2eTestRunner === 'playwright') {
|
|
24
30
|
const { configurationGenerator: playwrightConfigurationGenerator } = (0, devkit_1.ensurePackage)('@nx/playwright', versions_1.nxVersion);
|
|
25
31
|
(0, devkit_1.addProjectConfiguration)(tree, options.e2eProjectName, {
|
|
32
|
+
projectType: 'application',
|
|
26
33
|
root: options.e2eProjectRoot,
|
|
27
34
|
sourceRoot: (0, devkit_1.joinPathFragments)(options.e2eProjectRoot, 'src'),
|
|
28
35
|
targets: {},
|
|
@@ -38,6 +45,7 @@ async function addE2e(tree, options) {
|
|
|
38
45
|
setParserOptionsProject: options.setParserOptionsProject,
|
|
39
46
|
webServerCommand: `${(0, devkit_1.getPackageManagerCommand)().exec} nx serve ${options.name}`,
|
|
40
47
|
webServerAddress: `http://localhost:${options.port ?? 4200}`,
|
|
48
|
+
rootProject: options.rootProject,
|
|
41
49
|
});
|
|
42
50
|
}
|
|
43
51
|
}
|
|
@@ -228,12 +228,20 @@ class E2eMigrator extends project_migrator_1.ProjectMigrator {
|
|
|
228
228
|
}
|
|
229
229
|
async migrateCypressE2eProject() {
|
|
230
230
|
const oldCypressConfigFilePath = this.getOldCypressConfigFilePath();
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
231
|
+
(0, devkit_1.addProjectConfiguration)(this.tree, this.project.name, {
|
|
232
|
+
projectType: 'application',
|
|
233
|
+
root: this.project.newRoot,
|
|
234
|
+
sourceRoot: this.project.newSourceRoot,
|
|
235
|
+
targets: {},
|
|
236
|
+
tags: [],
|
|
237
|
+
implicitDependencies: [this.appName],
|
|
238
|
+
});
|
|
239
|
+
await (0, cypress_1.configurationGenerator)(this.tree, {
|
|
240
|
+
project: this.project.name,
|
|
234
241
|
linter: this.isProjectUsingEsLint ? eslint_1.Linter.EsLint : eslint_1.Linter.None,
|
|
235
|
-
standaloneConfig: true,
|
|
236
242
|
skipFormat: true,
|
|
243
|
+
// any target would do, we replace it later with the target existing in the project being migrated
|
|
244
|
+
devServerTarget: `${this.appName}:serve`,
|
|
237
245
|
});
|
|
238
246
|
const cypressConfigFilePath = this.updateOrCreateCypressConfigFile(oldCypressConfigFilePath);
|
|
239
247
|
this.updateCypressProjectConfiguration(cypressConfigFilePath);
|
|
@@ -258,34 +266,14 @@ class E2eMigrator extends project_migrator_1.ProjectMigrator {
|
|
|
258
266
|
return cypressConfigFilePath;
|
|
259
267
|
}
|
|
260
268
|
updateCypressProjectConfiguration(cypressConfigPath) {
|
|
261
|
-
|
|
262
|
-
* The `cypressProjectGenerator` function normalizes the project name. The
|
|
263
|
-
* migration keeps the names for existing projects as-is to avoid any
|
|
264
|
-
* confusion. The e2e project is technically new, but it's associated
|
|
265
|
-
* to an existing application, so we keep it familiar.
|
|
266
|
-
*/
|
|
267
|
-
const generatedProjectName = (0, devkit_1.names)(this.project.name).fileName;
|
|
268
|
-
if (this.project.name !== generatedProjectName) {
|
|
269
|
-
// If the names are different, we "rename" the newly added project.
|
|
270
|
-
this.projectConfig = (0, devkit_1.readProjectConfiguration)(this.tree, generatedProjectName);
|
|
271
|
-
this.projectConfig.root = this.project.newRoot;
|
|
272
|
-
this.projectConfig.sourceRoot = this.project.newSourceRoot;
|
|
273
|
-
(0, devkit_1.removeProjectConfiguration)(this.tree, generatedProjectName);
|
|
274
|
-
(0, devkit_1.addProjectConfiguration)(this.tree, this.project.name, { ...this.projectConfig }, true);
|
|
275
|
-
}
|
|
276
|
-
else {
|
|
277
|
-
this.projectConfig = (0, devkit_1.readProjectConfiguration)(this.tree, this.project.name);
|
|
278
|
-
}
|
|
269
|
+
this.projectConfig = (0, devkit_1.readProjectConfiguration)(this.tree, this.project.name);
|
|
279
270
|
if (this.isProjectUsingEsLint) {
|
|
280
271
|
// the generated cypress project always generates a "lint" target,
|
|
281
272
|
// in case the app was using a different name for it, we use it
|
|
282
|
-
const lintTarget = this.projectConfig.targets.lint;
|
|
283
273
|
if (this.lintTargetName && this.lintTargetName !== 'lint') {
|
|
284
274
|
this.projectConfig.targets[this.lintTargetName] =
|
|
285
275
|
this.projectConfig.targets.lint;
|
|
286
276
|
}
|
|
287
|
-
lintTarget.options.lintFilePatterns =
|
|
288
|
-
lintTarget.options.lintFilePatterns.map((pattern) => pattern.replace(`apps/${generatedProjectName}`, this.project.newRoot));
|
|
289
277
|
}
|
|
290
278
|
[this.targetNames.e2e, 'cypress-run', 'cypress-open'].forEach((target) => {
|
|
291
279
|
if (this.appConfig.targets[target]) {
|
|
@@ -10,9 +10,11 @@ describe('AppComponent', () => {
|
|
|
10
10
|
imports: [
|
|
11
11
|
RouterTestingModule.withRoutes([
|
|
12
12
|
{ path: '', component: NxWelcomeComponent },
|
|
13
|
-
])
|
|
14
|
-
|
|
15
|
-
|
|
13
|
+
]),<% if (standalone) { %>
|
|
14
|
+
AppComponent,
|
|
15
|
+
NxWelcomeComponent,<% } %>
|
|
16
|
+
],<% if (!standalone) { %>
|
|
17
|
+
declarations: [AppComponent, NxWelcomeComponent],<% } %>
|
|
16
18
|
}).compileComponents();
|
|
17
19
|
});
|
|
18
20
|
|
|
@@ -37,4 +39,4 @@ describe('AppComponent', () => {
|
|
|
37
39
|
const compiled = fixture.nativeElement as HTMLElement;
|
|
38
40
|
expect(compiled.querySelector('h1')?.textContent).toContain('Welcome <%= appName %>');
|
|
39
41
|
}));
|
|
40
|
-
});
|
|
42
|
+
});
|
|
@@ -7,7 +7,7 @@ function fixBootstrap(tree, appRoot, options) {
|
|
|
7
7
|
const mainFilePath = (0, devkit_1.joinPathFragments)(appRoot, 'src/main.ts');
|
|
8
8
|
const bootstrapCode = tree.read(mainFilePath, 'utf-8');
|
|
9
9
|
const installedAngularMajor = (0, version_utils_1.getInstalledAngularMajorVersion)(tree);
|
|
10
|
-
if (options.standalone) {
|
|
10
|
+
if (options.standalone && options.mfType === 'remote') {
|
|
11
11
|
tree.write(`${appRoot}/src/bootstrap.ts`, standaloneBootstrapCode(installedAngularMajor === 14));
|
|
12
12
|
}
|
|
13
13
|
else {
|
|
@@ -34,6 +34,7 @@ function updateHostAppRoutes(tree, options) {
|
|
|
34
34
|
${tree.read(pathToHostRootRoutingFile, 'utf-8')}`);
|
|
35
35
|
(0, devkit_1.generateFiles)(tree, (0, devkit_1.joinPathFragments)(__dirname, '../files/host-files'), (0, devkit_1.joinPathFragments)(sourceRoot, 'app'), {
|
|
36
36
|
appName: options.appName,
|
|
37
|
+
standalone: options.standalone,
|
|
37
38
|
tmpl: '',
|
|
38
39
|
});
|
|
39
40
|
}
|
package/src/utils/mf/utils.js
CHANGED
|
@@ -30,7 +30,13 @@ function getFunctionDeterminateRemoteUrl(isServer = false) {
|
|
|
30
30
|
const target = 'serve';
|
|
31
31
|
const remoteEntry = isServer ? 'server/remoteEntry.js' : 'remoteEntry.mjs';
|
|
32
32
|
return function (remote) {
|
|
33
|
-
|
|
33
|
+
let remoteConfiguration = null;
|
|
34
|
+
try {
|
|
35
|
+
remoteConfiguration = (0, project_graph_1.readCachedProjectConfiguration)(remote);
|
|
36
|
+
}
|
|
37
|
+
catch (e) {
|
|
38
|
+
throw new Error(`Cannot find remote "${remote}". Check that the remote name is correct in your module federation config file.\n`);
|
|
39
|
+
}
|
|
34
40
|
const serveTarget = remoteConfiguration?.targets?.[target];
|
|
35
41
|
if (!serveTarget) {
|
|
36
42
|
throw new Error(`Cannot automatically determine URL of remote (${remote}). Looked for property "host" in the project's "serve" target.\n
|