@nx/angular 21.3.0-beta.6 → 21.3.0-canary.20250614-db86a35
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/fesm2022/nx-angular-mf.mjs +10 -74
- package/fesm2022/nx-angular-mf.mjs.map +1 -1
- package/migrations.json +0 -74
- package/package.json +9 -9
- package/plugins/component-testing.js +14 -6
- package/src/builders/utilities/module-federation.js +3 -4
- package/src/builders/webpack-browser/schema.json +1 -1
- package/src/executors/application/schema.json +2 -4
- package/src/executors/application/utils/validate-options.js +0 -10
- package/src/executors/utilities/ng-packagr/pre-v19/stylesheet-processor.js +2 -5
- package/src/generators/application/application.js +2 -8
- package/src/generators/host/lib/update-ssr-setup.js +4 -4
- package/src/generators/library/lib/create-files.js +1 -2
- package/src/generators/library/lib/normalized-schema.d.ts +0 -1
- package/src/generators/library/lib/update-tsconfig-files.js +3 -6
- package/src/generators/library/library.js +0 -4
- package/src/generators/library/schema.d.ts +0 -1
- package/src/generators/library/schema.json +1 -2
- package/src/generators/move/lib/update-module-name.js +5 -7
- package/src/generators/ngrx/files/__directory__/__fileName__.facade.spec.ts__tmpl__ +9 -13
- package/src/generators/ngrx/lib/generate-files.js +0 -1
- package/src/generators/ngrx/lib/normalize-options.d.ts +0 -1
- package/src/generators/ngrx/lib/normalize-options.js +0 -3
- package/src/generators/ngrx-feature-store/files/__directory__/__fileName__.facade.spec.ts__tmpl__ +9 -13
- package/src/generators/ngrx-feature-store/lib/generate-files.js +0 -1
- package/src/generators/ngrx-feature-store/lib/normalize-options.d.ts +0 -1
- package/src/generators/ngrx-feature-store/lib/normalize-options.js +0 -3
- package/src/generators/ngrx-root-store/lib/normalize-options.js +4 -5
- package/src/generators/remote/lib/update-ssr-setup.js +4 -4
- package/src/generators/setup-mf/lib/add-cypress-workaround.js +1 -2
- package/src/generators/setup-mf/lib/add-remote-to-host.js +7 -9
- package/src/generators/setup-mf/lib/remove-dead-code-from-remote.js +6 -8
- package/src/generators/setup-ssr/lib/add-dependencies.js +1 -2
- package/src/generators/setup-ssr/lib/add-hydration.js +3 -5
- package/src/generators/setup-ssr/lib/add-server-file.js +1 -2
- package/src/generators/setup-ssr/lib/generate-files.js +1 -2
- package/src/generators/setup-ssr/lib/update-project-config.js +2 -3
- package/src/generators/setup-tailwind/lib/add-tailwind-config.js +1 -2
- package/src/generators/setup-tailwind/lib/update-application-styles.js +4 -6
- package/src/generators/utils/app-components-info.js +4 -6
- package/src/generators/utils/testing.js +1 -2
- package/src/migrations/update-16-2-0/switch-data-persistence-operators-imports-to-ngrx-router-store.js +2 -2
- package/src/migrations/update-17-1-0/replace-nguniversal-engines.js +3 -4
- package/src/migrations/update-17-1-0/update-zone-js-deep-import.js +3 -3
- package/src/migrations/update-20-2-0/disable-angular-eslint-prefer-standalone.js +2 -3
- package/src/migrations/update-20-2-0/remove-angular-eslint-rules.js +2 -3
- package/src/migrations/update-20-2-0/update-angular-ssr-imports-to-use-node-entry-point.js +3 -3
- package/src/migrations/update-21-0-0/change-data-persistence-operators-imports-to-ngrx-router-store-data-persistence.js +2 -2
- package/src/migrations/update-21-2-0/migrate-provide-server-rendering-import.js +3 -3
- package/src/migrations/update-21-2-0/replace-provide-server-routing.js +3 -3
- package/src/migrations/update-21-2-0/update-module-resolution.js +3 -3
- package/src/migrations/utils/projects.d.ts +5 -2
- package/src/migrations/utils/projects.js +5 -2
- package/src/utils/backward-compatible-versions.js +0 -2
- package/src/utils/nx-devkit/ast-utils.js +2 -3
- package/src/utils/versions.d.ts +4 -5
- package/src/utils/versions.js +5 -6
- package/src/migrations/update-21-3-0/update-angular-cli.d.ts +0 -3
- package/src/migrations/update-21-3-0/update-angular-cli.js +0 -23
@@ -2,11 +2,7 @@ import { NgModule } from '@angular/core';
|
|
2
2
|
import { TestBed } from '@angular/core/testing';
|
3
3
|
import { EffectsModule } from '@ngrx/effects';
|
4
4
|
import { StoreModule, Store } from '@ngrx/store';
|
5
|
-
|
6
|
-
import { firstValueFrom } from 'rxjs';
|
7
|
-
<%_ } else { _%>
|
8
|
-
import { first } from 'rxjs/operators';
|
9
|
-
<%_ } _%>
|
5
|
+
import { readFirst } from '@nx/angular/testing';
|
10
6
|
|
11
7
|
import * as <%= className %>Actions from './<%= fileName %>.actions';
|
12
8
|
import { <%= className %>Effects } from './<%= fileName %>.effects';
|
@@ -61,16 +57,16 @@ describe('<%= className %>Facade', () => {
|
|
61
57
|
* The initially generated facade::loadAll() returns empty array
|
62
58
|
*/
|
63
59
|
it('loadAll() should return empty list with loaded == true', async () => {
|
64
|
-
let list = await
|
65
|
-
let isLoaded = await
|
60
|
+
let list = await readFirst(facade.all<%= className %>$);
|
61
|
+
let isLoaded = await readFirst(facade.loaded$);
|
66
62
|
|
67
63
|
expect(list.length).toBe(0);
|
68
64
|
expect(isLoaded).toBe(false);
|
69
65
|
|
70
66
|
facade.init();
|
71
67
|
|
72
|
-
list = await
|
73
|
-
isLoaded = await
|
68
|
+
list = await readFirst(facade.all<%= className %>$);
|
69
|
+
isLoaded = await readFirst(facade.loaded$);
|
74
70
|
|
75
71
|
expect(list.length).toBe(0);
|
76
72
|
expect(isLoaded).toBe(true);
|
@@ -80,8 +76,8 @@ describe('<%= className %>Facade', () => {
|
|
80
76
|
* Use `load<%= className %>Success` to manually update list
|
81
77
|
*/
|
82
78
|
it('all<%= className %>$ should return the loaded list; and loaded flag == true', async () => {
|
83
|
-
let list = await
|
84
|
-
let isLoaded = await
|
79
|
+
let list = await readFirst(facade.all<%= className %>$);
|
80
|
+
let isLoaded = await readFirst(facade.loaded$);
|
85
81
|
|
86
82
|
expect(list.length).toBe(0);
|
87
83
|
expect(isLoaded).toBe(false);
|
@@ -93,8 +89,8 @@ describe('<%= className %>Facade', () => {
|
|
93
89
|
]})
|
94
90
|
);
|
95
91
|
|
96
|
-
list = await
|
97
|
-
isLoaded = await
|
92
|
+
list = await readFirst(facade.all<%= className %>$);
|
93
|
+
isLoaded = await readFirst(facade.loaded$);
|
98
94
|
|
99
95
|
expect(list.length).toBe(2);
|
100
96
|
expect(isLoaded).toBe(true);
|
@@ -3,6 +3,5 @@ import type { NgRxGeneratorOptions } from '../schema';
|
|
3
3
|
export type NormalizedNgRxGeneratorOptions = NgRxGeneratorOptions & {
|
4
4
|
parentDirectory: string;
|
5
5
|
rxjsVersion: string;
|
6
|
-
rxjsMajorVersion: number;
|
7
6
|
};
|
8
7
|
export declare function normalizeOptions(tree: Tree, options: NgRxGeneratorOptions): NormalizedNgRxGeneratorOptions;
|
@@ -4,7 +4,6 @@ exports.normalizeOptions = normalizeOptions;
|
|
4
4
|
const devkit_1 = require("@nx/devkit");
|
5
5
|
const semver_1 = require("@nx/devkit/src/utils/semver");
|
6
6
|
const path_1 = require("path");
|
7
|
-
const semver_2 = require("semver");
|
8
7
|
const versions_1 = require("../../../utils/versions");
|
9
8
|
function normalizeOptions(tree, options) {
|
10
9
|
let rxjsVersion;
|
@@ -14,7 +13,6 @@ function normalizeOptions(tree, options) {
|
|
14
13
|
catch {
|
15
14
|
rxjsVersion = (0, semver_1.checkAndCleanWithSemver)('rxjs', versions_1.rxjsVersion);
|
16
15
|
}
|
17
|
-
const rxjsMajorVersion = (0, semver_2.major)(rxjsVersion);
|
18
16
|
return {
|
19
17
|
...options,
|
20
18
|
parentDirectory: options.module
|
@@ -25,6 +23,5 @@ function normalizeOptions(tree, options) {
|
|
25
23
|
route: options.route === '' ? `''` : options.route ?? `''`,
|
26
24
|
directory: (0, devkit_1.names)(options.directory).fileName,
|
27
25
|
rxjsVersion,
|
28
|
-
rxjsMajorVersion,
|
29
26
|
};
|
30
27
|
}
|
package/src/generators/ngrx-feature-store/files/__directory__/__fileName__.facade.spec.ts__tmpl__
CHANGED
@@ -2,11 +2,7 @@ import { NgModule } from '@angular/core';
|
|
2
2
|
import { TestBed } from '@angular/core/testing';
|
3
3
|
import { EffectsModule } from '@ngrx/effects';
|
4
4
|
import { StoreModule, Store } from '@ngrx/store';
|
5
|
-
|
6
|
-
import { firstValueFrom } from 'rxjs';
|
7
|
-
<%_ } else { _%>
|
8
|
-
import { first } from 'rxjs/operators';
|
9
|
-
<%_ } _%>
|
5
|
+
import { readFirst } from '@nx/angular/testing';
|
10
6
|
|
11
7
|
import * as <%= className %>Actions from './<%= relativeFileName %>.actions';
|
12
8
|
import { <%= className %>Effects } from './<%= relativeFileName %>.effects';
|
@@ -61,16 +57,16 @@ describe('<%= className %>Facade', () => {
|
|
61
57
|
* The initially generated facade::loadAll() returns empty array
|
62
58
|
*/
|
63
59
|
it('loadAll() should return empty list with loaded == true', async () => {
|
64
|
-
let list = await
|
65
|
-
let isLoaded = await
|
60
|
+
let list = await readFirst(facade.all<%= className %>$);
|
61
|
+
let isLoaded = await readFirst(facade.loaded$);
|
66
62
|
|
67
63
|
expect(list.length).toBe(0);
|
68
64
|
expect(isLoaded).toBe(false);
|
69
65
|
|
70
66
|
facade.init();
|
71
67
|
|
72
|
-
list = await
|
73
|
-
isLoaded = await
|
68
|
+
list = await readFirst(facade.all<%= className %>$);
|
69
|
+
isLoaded = await readFirst(facade.loaded$);
|
74
70
|
|
75
71
|
expect(list.length).toBe(0);
|
76
72
|
expect(isLoaded).toBe(true);
|
@@ -80,8 +76,8 @@ describe('<%= className %>Facade', () => {
|
|
80
76
|
* Use `load<%= className %>Success` to manually update list
|
81
77
|
*/
|
82
78
|
it('all<%= className %>$ should return the loaded list; and loaded flag == true', async () => {
|
83
|
-
let list = await
|
84
|
-
let isLoaded = await
|
79
|
+
let list = await readFirst(facade.all<%= className %>$);
|
80
|
+
let isLoaded = await readFirst(facade.loaded$);
|
85
81
|
|
86
82
|
expect(list.length).toBe(0);
|
87
83
|
expect(isLoaded).toBe(false);
|
@@ -93,8 +89,8 @@ describe('<%= className %>Facade', () => {
|
|
93
89
|
]})
|
94
90
|
);
|
95
91
|
|
96
|
-
list = await
|
97
|
-
isLoaded = await
|
92
|
+
list = await readFirst(facade.all<%= className %>$);
|
93
|
+
isLoaded = await readFirst(facade.loaded$);
|
98
94
|
|
99
95
|
expect(list.length).toBe(2);
|
100
96
|
expect(isLoaded).toBe(true);
|
@@ -14,7 +14,6 @@ function generateFilesFromTemplates(tree, options) {
|
|
14
14
|
fileName,
|
15
15
|
relativeFileName: projectNames.fileName,
|
16
16
|
importFromOperators: (0, semver_1.lt)(options.rxjsVersion, '7.2.0'),
|
17
|
-
isRxJs7: options.rxjsMajorVersion >= 7,
|
18
17
|
tmpl: '',
|
19
18
|
});
|
20
19
|
if (!options.facade) {
|
@@ -4,6 +4,5 @@ export type NormalizedNgRxFeatureStoreGeneratorOptions = Schema & {
|
|
4
4
|
parentDirectory: string;
|
5
5
|
subdirectory: string;
|
6
6
|
rxjsVersion: string;
|
7
|
-
rxjsMajorVersion: number;
|
8
7
|
};
|
9
8
|
export declare function normalizeOptions(tree: Tree, options: Schema): NormalizedNgRxFeatureStoreGeneratorOptions;
|
@@ -4,7 +4,6 @@ exports.normalizeOptions = normalizeOptions;
|
|
4
4
|
const devkit_1 = require("@nx/devkit");
|
5
5
|
const semver_1 = require("@nx/devkit/src/utils/semver");
|
6
6
|
const path_1 = require("path");
|
7
|
-
const semver_2 = require("semver");
|
8
7
|
const versions_1 = require("../../../utils/versions");
|
9
8
|
function normalizeOptions(tree, options) {
|
10
9
|
let rxjsVersion;
|
@@ -14,7 +13,6 @@ function normalizeOptions(tree, options) {
|
|
14
13
|
catch {
|
15
14
|
rxjsVersion = (0, semver_1.checkAndCleanWithSemver)('rxjs', versions_1.rxjsVersion);
|
16
15
|
}
|
17
|
-
const rxjsMajorVersion = (0, semver_2.major)(rxjsVersion);
|
18
16
|
const { subdirectory, name } = determineSubdirectoryAndName(options.name);
|
19
17
|
return {
|
20
18
|
...options,
|
@@ -24,7 +22,6 @@ function normalizeOptions(tree, options) {
|
|
24
22
|
route: options.route === '' ? `''` : options.route ?? `''`,
|
25
23
|
directory: (0, devkit_1.names)(options.directory).fileName,
|
26
24
|
rxjsVersion,
|
27
|
-
rxjsMajorVersion,
|
28
25
|
};
|
29
26
|
}
|
30
27
|
function determineSubdirectoryAndName(name) {
|
@@ -5,7 +5,6 @@ const devkit_1 = require("@nx/devkit");
|
|
5
5
|
const semver_1 = require("@nx/devkit/src/utils/semver");
|
6
6
|
const versions_1 = require("../../../utils/versions");
|
7
7
|
const ast_utils_1 = require("../../../utils/nx-devkit/ast-utils");
|
8
|
-
const ts_solution_setup_1 = require("@nx/js/src/utils/typescript/ts-solution-setup");
|
9
8
|
function normalizeOptions(tree, options) {
|
10
9
|
let rxjsVersion;
|
11
10
|
try {
|
@@ -16,10 +15,10 @@ function normalizeOptions(tree, options) {
|
|
16
15
|
}
|
17
16
|
const project = (0, devkit_1.readProjectConfiguration)(tree, options.project);
|
18
17
|
const isStandalone = (0, ast_utils_1.isNgStandaloneApp)(tree, options.project);
|
19
|
-
const
|
20
|
-
const appConfigPath = (0, devkit_1.joinPathFragments)(sourceRoot, 'app/app.config.ts');
|
18
|
+
const appConfigPath = (0, devkit_1.joinPathFragments)(project.sourceRoot, 'app/app.config.ts');
|
21
19
|
let appMainPath = project.targets.build.options.main ?? project.targets.build.options.browser;
|
22
20
|
if (!appMainPath) {
|
21
|
+
const sourceRoot = project.sourceRoot ?? (0, devkit_1.joinPathFragments)(project.root, 'src');
|
23
22
|
appMainPath = (0, devkit_1.joinPathFragments)(sourceRoot, 'main.ts');
|
24
23
|
}
|
25
24
|
/** If NgModule App
|
@@ -29,9 +28,9 @@ function normalizeOptions(tree, options) {
|
|
29
28
|
* --> If so, use that
|
30
29
|
* --> If not, use main.ts
|
31
30
|
*/
|
32
|
-
let ngModulePath = (0, devkit_1.joinPathFragments)(sourceRoot, 'app/app.module.ts');
|
31
|
+
let ngModulePath = (0, devkit_1.joinPathFragments)(project.sourceRoot, 'app/app.module.ts');
|
33
32
|
if (!tree.exists(ngModulePath)) {
|
34
|
-
ngModulePath = (0, devkit_1.joinPathFragments)(sourceRoot, 'app/app-module.ts');
|
33
|
+
ngModulePath = (0, devkit_1.joinPathFragments)(project.sourceRoot, 'app/app-module.ts');
|
35
34
|
}
|
36
35
|
const parent = !isStandalone && tree.exists(ngModulePath)
|
37
36
|
? ngModulePath
|
@@ -2,7 +2,6 @@
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
exports.updateSsrSetup = updateSsrSetup;
|
4
4
|
const devkit_1 = require("@nx/devkit");
|
5
|
-
const ts_solution_setup_1 = require("@nx/js/src/utils/typescript/ts-solution-setup");
|
6
5
|
const path_1 = require("path");
|
7
6
|
const versions_1 = require("../../../utils/versions");
|
8
7
|
const artifact_types_1 = require("../../utils/artifact-types");
|
@@ -10,9 +9,10 @@ const version_utils_1 = require("../../utils/version-utils");
|
|
10
9
|
async function updateSsrSetup(tree, { appName, port, standalone, typescriptConfiguration, skipPackageJson, }) {
|
11
10
|
const { major: angularMajorVersion } = (0, version_utils_1.getInstalledAngularVersionInfo)(tree);
|
12
11
|
let project = (0, devkit_1.readProjectConfiguration)(tree, appName);
|
13
|
-
|
14
|
-
|
15
|
-
|
12
|
+
tree.rename((0, devkit_1.joinPathFragments)(project.sourceRoot, 'main.server.ts'), (0, devkit_1.joinPathFragments)(project.sourceRoot, 'bootstrap.server.ts'));
|
13
|
+
const pathToServerEntry = (0, devkit_1.joinPathFragments)(angularMajorVersion >= 19
|
14
|
+
? project.sourceRoot ?? (0, devkit_1.joinPathFragments)(project.root, 'src')
|
15
|
+
: project.root, 'server.ts');
|
16
16
|
tree.write(pathToServerEntry, `import('./${angularMajorVersion >= 19 ? '' : 'src/'}main.server');`);
|
17
17
|
const browserBundleOutput = project.targets.build.options.outputPath;
|
18
18
|
const serverBundleOutput = project.targets.build.options.outputPath.replace(/\/browser$/, '/server');
|
@@ -5,7 +5,6 @@
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
6
6
|
exports.addCypressOnErrorWorkaround = addCypressOnErrorWorkaround;
|
7
7
|
const devkit_1 = require("@nx/devkit");
|
8
|
-
const ts_solution_setup_1 = require("@nx/js/src/utils/typescript/ts-solution-setup");
|
9
8
|
function addCypressOnErrorWorkaround(tree, schema) {
|
10
9
|
if (!schema.e2eProjectName) {
|
11
10
|
return;
|
@@ -44,7 +43,7 @@ function addCypressOnErrorWorkaround(tree, schema) {
|
|
44
43
|
}
|
45
44
|
return true;
|
46
45
|
});`;
|
47
|
-
const pathToCommandsFile = (0, devkit_1.joinPathFragments)(
|
46
|
+
const pathToCommandsFile = (0, devkit_1.joinPathFragments)(e2eProject.sourceRoot, 'support/e2e.ts');
|
48
47
|
const commandsContent = tree.exists(pathToCommandsFile)
|
49
48
|
? tree.read(pathToCommandsFile, 'utf-8')
|
50
49
|
: '';
|
@@ -4,9 +4,8 @@ exports.checkIsCommaNeeded = checkIsCommaNeeded;
|
|
4
4
|
exports.addRemoteToHost = addRemoteToHost;
|
5
5
|
const devkit_1 = require("@nx/devkit");
|
6
6
|
const js_1 = require("@nx/js");
|
7
|
-
const ensure_typescript_1 = require("@nx/js/src/utils/typescript/ensure-typescript");
|
8
|
-
const ts_solution_setup_1 = require("@nx/js/src/utils/typescript/ts-solution-setup");
|
9
7
|
const route_utils_1 = require("../../../utils/nx-devkit/route-utils");
|
8
|
+
const ensure_typescript_1 = require("@nx/js/src/utils/typescript/ensure-typescript");
|
10
9
|
let tsModule;
|
11
10
|
function checkIsCommaNeeded(mfRemoteText) {
|
12
11
|
const remoteText = mfRemoteText.replace(/\s+/g, '');
|
@@ -26,7 +25,7 @@ function addRemoteToHost(tree, options) {
|
|
26
25
|
addRemoteToStaticHost(tree, options, hostProject, isHostUsingTypescriptConfig);
|
27
26
|
}
|
28
27
|
else if (hostFederationType === 'dynamic') {
|
29
|
-
addRemoteToDynamicHost(tree, options, pathToMFManifest,
|
28
|
+
addRemoteToDynamicHost(tree, options, pathToMFManifest, hostProject.sourceRoot);
|
30
29
|
}
|
31
30
|
addLazyLoadedRouteToHostAppModule(tree, options, hostFederationType);
|
32
31
|
}
|
@@ -40,7 +39,7 @@ function getDynamicManifestFile(tree, project) {
|
|
40
39
|
// at the old path.
|
41
40
|
return [
|
42
41
|
(0, devkit_1.joinPathFragments)(project.root, 'public/module-federation.manifest.json'),
|
43
|
-
(0, devkit_1.joinPathFragments)(
|
42
|
+
(0, devkit_1.joinPathFragments)(project.sourceRoot, 'assets/module-federation.manifest.json'),
|
44
43
|
].find((path) => tree.exists(path));
|
45
44
|
}
|
46
45
|
function addRemoteToStaticHost(tree, options, hostProject, isHostUsingTypescript) {
|
@@ -76,8 +75,7 @@ function addLazyLoadedRouteToHostAppModule(tree, options, hostFederationType) {
|
|
76
75
|
tsModule = (0, ensure_typescript_1.ensureTypescript)();
|
77
76
|
}
|
78
77
|
const hostAppConfig = (0, devkit_1.readProjectConfiguration)(tree, options.host);
|
79
|
-
const
|
80
|
-
const pathToHostRootRouting = `${sourceRoot}/app/app.routes.ts`;
|
78
|
+
const pathToHostRootRouting = `${hostAppConfig.sourceRoot}/app/app.routes.ts`;
|
81
79
|
if (!tree.exists(pathToHostRootRouting)) {
|
82
80
|
return;
|
83
81
|
}
|
@@ -86,7 +84,7 @@ function addLazyLoadedRouteToHostAppModule(tree, options, hostFederationType) {
|
|
86
84
|
// TODO(Colum): Remove for Nx 22
|
87
85
|
const usingLegacyDynamicFederation = hostFederationType === 'dynamic' &&
|
88
86
|
tree
|
89
|
-
.read(`${sourceRoot}/main.ts`, 'utf-8')
|
87
|
+
.read(`${hostAppConfig.sourceRoot}/main.ts`, 'utf-8')
|
90
88
|
.includes('setRemoteDefinitions(');
|
91
89
|
if (hostFederationType === 'dynamic') {
|
92
90
|
sourceFile = (0, js_1.insertImport)(tree, sourceFile, pathToHostRootRouting, usingLegacyDynamicFederation ? 'loadRemoteModule' : 'loadRemote', usingLegacyDynamicFederation
|
@@ -107,10 +105,10 @@ function addLazyLoadedRouteToHostAppModule(tree, options, hostFederationType) {
|
|
107
105
|
path: '${options.appName}',
|
108
106
|
loadChildren: () => ${routeToAdd}.then(m => m!.${exportedRemote})
|
109
107
|
}`);
|
110
|
-
let pathToAppComponentTemplate = (0, devkit_1.joinPathFragments)(sourceRoot, 'app/app.component.html');
|
108
|
+
let pathToAppComponentTemplate = (0, devkit_1.joinPathFragments)(hostAppConfig.sourceRoot, 'app/app.component.html');
|
111
109
|
const candidatePaths = [
|
112
110
|
pathToAppComponentTemplate,
|
113
|
-
(0, devkit_1.joinPathFragments)(sourceRoot, 'app/app.html'),
|
111
|
+
(0, devkit_1.joinPathFragments)(hostAppConfig.sourceRoot, 'app/app.html'),
|
114
112
|
];
|
115
113
|
for (const path of candidatePaths) {
|
116
114
|
if (tree.exists(path)) {
|
@@ -2,21 +2,19 @@
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
exports.removeDeadCodeFromRemote = removeDeadCodeFromRemote;
|
4
4
|
const devkit_1 = require("@nx/devkit");
|
5
|
-
const ts_solution_setup_1 = require("@nx/js/src/utils/typescript/ts-solution-setup");
|
6
5
|
function removeDeadCodeFromRemote(tree, options) {
|
7
6
|
const projectName = options.appName;
|
8
7
|
const project = (0, devkit_1.readProjectConfiguration)(tree, projectName);
|
9
|
-
const sourceRoot = (0, ts_solution_setup_1.getProjectSourceRoot)(project, tree);
|
10
8
|
const { appComponentInfo, nxWelcomeComponentInfo, entryModuleFileName } = options;
|
11
9
|
['css', 'less', 'scss', 'sass'].forEach((style) => {
|
12
|
-
const pathToComponentStyle = (0, devkit_1.joinPathFragments)(sourceRoot, `app/${appComponentInfo.extensionlessFileName}.${style}`);
|
10
|
+
const pathToComponentStyle = (0, devkit_1.joinPathFragments)(project.sourceRoot, `app/${appComponentInfo.extensionlessFileName}.${style}`);
|
13
11
|
if (tree.exists(pathToComponentStyle)) {
|
14
12
|
tree.delete(pathToComponentStyle);
|
15
13
|
}
|
16
14
|
});
|
17
|
-
tree.rename(nxWelcomeComponentInfo.path, (0, devkit_1.joinPathFragments)(sourceRoot, `app/remote-entry/${nxWelcomeComponentInfo.fileName}`));
|
18
|
-
tree.delete((0, devkit_1.joinPathFragments)(sourceRoot, `app/${appComponentInfo.extensionlessFileName}.spec.ts`));
|
19
|
-
tree.delete((0, devkit_1.joinPathFragments)(sourceRoot, `app/${appComponentInfo.extensionlessFileName}.html`));
|
15
|
+
tree.rename(nxWelcomeComponentInfo.path, (0, devkit_1.joinPathFragments)(project.sourceRoot, `app/remote-entry/${nxWelcomeComponentInfo.fileName}`));
|
16
|
+
tree.delete((0, devkit_1.joinPathFragments)(project.sourceRoot, `app/${appComponentInfo.extensionlessFileName}.spec.ts`));
|
17
|
+
tree.delete((0, devkit_1.joinPathFragments)(project.sourceRoot, `app/${appComponentInfo.extensionlessFileName}.html`));
|
20
18
|
if (!options.standalone) {
|
21
19
|
const componentContents = tree.read(appComponentInfo.path, 'utf-8');
|
22
20
|
const isInlineTemplate = !componentContents.includes('templateUrl');
|
@@ -26,9 +24,9 @@ function removeDeadCodeFromRemote(tree, options) {
|
|
26
24
|
})
|
27
25
|
export class ${appComponentInfo.symbolName} {}`;
|
28
26
|
tree.write(appComponentInfo.path, component);
|
29
|
-
let modulePath = (0, devkit_1.joinPathFragments)(sourceRoot, 'app/app.module.ts');
|
27
|
+
let modulePath = (0, devkit_1.joinPathFragments)(project.sourceRoot, 'app/app.module.ts');
|
30
28
|
if (!tree.exists(modulePath)) {
|
31
|
-
modulePath = (0, devkit_1.joinPathFragments)(sourceRoot, 'app/app-module.ts');
|
29
|
+
modulePath = (0, devkit_1.joinPathFragments)(project.sourceRoot, 'app/app-module.ts');
|
32
30
|
}
|
33
31
|
tree.write(modulePath, `import { NgModule } from '@angular/core';
|
34
32
|
import { BrowserModule } from '@angular/platform-browser';
|
@@ -12,7 +12,6 @@ function addDependencies(tree, isUsingApplicationBuilder) {
|
|
12
12
|
};
|
13
13
|
const devDependencies = {
|
14
14
|
'@types/express': pkgVersions.typesExpressVersion,
|
15
|
-
'@types/node': pkgVersions.typesNodeVersion,
|
16
15
|
};
|
17
16
|
const angularDevkitVersion = (0, version_utils_1.getInstalledAngularDevkitVersion)(tree) ?? pkgVersions.angularDevkitVersion;
|
18
17
|
dependencies['@angular/ssr'] = angularDevkitVersion;
|
@@ -25,5 +24,5 @@ function addDependencies(tree, isUsingApplicationBuilder) {
|
|
25
24
|
dependencies['@angular-devkit/build-angular'] = angularDevkitVersion;
|
26
25
|
}
|
27
26
|
}
|
28
|
-
(0, devkit_1.addDependenciesToPackageJson)(tree, dependencies, devDependencies
|
27
|
+
(0, devkit_1.addDependenciesToPackageJson)(tree, dependencies, devDependencies);
|
29
28
|
}
|
@@ -4,26 +4,24 @@ exports.addHydration = addHydration;
|
|
4
4
|
const devkit_1 = require("@nx/devkit");
|
5
5
|
const js_1 = require("@nx/js");
|
6
6
|
const ensure_typescript_1 = require("@nx/js/src/utils/typescript/ensure-typescript");
|
7
|
-
const ts_solution_setup_1 = require("@nx/js/src/utils/typescript/ts-solution-setup");
|
8
7
|
const ast_utils_1 = require("../../../utils/nx-devkit/ast-utils");
|
9
8
|
const version_utils_1 = require("../../utils/version-utils");
|
10
9
|
let tsModule;
|
11
10
|
let tsquery;
|
12
11
|
function addHydration(tree, options) {
|
13
12
|
const projectConfig = (0, devkit_1.readProjectConfiguration)(tree, options.project);
|
14
|
-
const sourceRoot = (0, ts_solution_setup_1.getProjectSourceRoot)(projectConfig, tree);
|
15
13
|
if (!tsModule) {
|
16
14
|
tsModule = (0, ensure_typescript_1.ensureTypescript)();
|
17
15
|
tsquery = require('@phenomnomnominal/tsquery').tsquery;
|
18
16
|
}
|
19
17
|
let pathToClientConfigFile;
|
20
18
|
if (options.standalone) {
|
21
|
-
pathToClientConfigFile = (0, devkit_1.joinPathFragments)(sourceRoot, 'app/app.config.ts');
|
19
|
+
pathToClientConfigFile = (0, devkit_1.joinPathFragments)(projectConfig.sourceRoot, 'app/app.config.ts');
|
22
20
|
}
|
23
21
|
else {
|
24
|
-
pathToClientConfigFile = (0, devkit_1.joinPathFragments)(sourceRoot, 'app/app.module.ts');
|
22
|
+
pathToClientConfigFile = (0, devkit_1.joinPathFragments)(projectConfig.sourceRoot, 'app/app.module.ts');
|
25
23
|
if (!tree.exists(pathToClientConfigFile)) {
|
26
|
-
pathToClientConfigFile = (0, devkit_1.joinPathFragments)(sourceRoot, 'app/app-module.ts');
|
24
|
+
pathToClientConfigFile = (0, devkit_1.joinPathFragments)(projectConfig.sourceRoot, 'app/app-module.ts');
|
27
25
|
}
|
28
26
|
}
|
29
27
|
const sourceText = tree.read(pathToClientConfigFile, 'utf-8');
|
@@ -2,7 +2,6 @@
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
exports.addServerFile = addServerFile;
|
4
4
|
const devkit_1 = require("@nx/devkit");
|
5
|
-
const ts_solution_setup_1 = require("@nx/js/src/utils/typescript/ts-solution-setup");
|
6
5
|
const path_1 = require("path");
|
7
6
|
const version_utils_1 = require("../../utils/version-utils");
|
8
7
|
const constants_1 = require("./constants");
|
@@ -31,7 +30,7 @@ function addServerFile(tree, options) {
|
|
31
30
|
? 'application-builder'
|
32
31
|
: 'server-builder');
|
33
32
|
}
|
34
|
-
const sourceRoot = (0,
|
33
|
+
const sourceRoot = project.sourceRoot ?? (0, devkit_1.joinPathFragments)(project.root, 'src');
|
35
34
|
(0, devkit_1.generateFiles)(tree, pathToFiles, angularMajorVersion >= 19 ? sourceRoot : project.root, {
|
36
35
|
...options,
|
37
36
|
browserDistDirectory,
|
@@ -2,7 +2,6 @@
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
exports.generateSSRFiles = generateSSRFiles;
|
4
4
|
const devkit_1 = require("@nx/devkit");
|
5
|
-
const ts_solution_setup_1 = require("@nx/js/src/utils/typescript/ts-solution-setup");
|
6
5
|
const path_1 = require("path");
|
7
6
|
const semver_1 = require("semver");
|
8
7
|
const app_components_info_1 = require("../../utils/app-components-info");
|
@@ -32,7 +31,7 @@ function generateSSRFiles(tree, options) {
|
|
32
31
|
else {
|
33
32
|
pathToFiles = (0, path_1.join)(baseFilesPath, 'pre-v19', options.standalone ? 'standalone-src' : 'ngmodule-src');
|
34
33
|
}
|
35
|
-
const sourceRoot = (0,
|
34
|
+
const sourceRoot = project.sourceRoot ?? (0, devkit_1.joinPathFragments)(project.root, 'src');
|
36
35
|
const ssrVersion = (0, version_utils_1.getInstalledPackageVersion)(tree, '@angular/ssr');
|
37
36
|
const cleanedSsrVersion = ssrVersion
|
38
37
|
? (0, semver_1.clean)(ssrVersion) ?? (0, semver_1.coerce)(ssrVersion).version
|
@@ -3,7 +3,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.updateProjectConfigForApplicationBuilder = updateProjectConfigForApplicationBuilder;
|
4
4
|
exports.updateProjectConfigForBrowserBuilder = updateProjectConfigForBrowserBuilder;
|
5
5
|
const devkit_1 = require("@nx/devkit");
|
6
|
-
const ts_solution_setup_1 = require("@nx/js/src/utils/typescript/ts-solution-setup");
|
7
6
|
const version_utils_1 = require("../../utils/version-utils");
|
8
7
|
const constants_1 = require("./constants");
|
9
8
|
function updateProjectConfigForApplicationBuilder(tree, options) {
|
@@ -30,7 +29,7 @@ function updateProjectConfigForApplicationBuilder(tree, options) {
|
|
30
29
|
}
|
31
30
|
}
|
32
31
|
const { major: angularMajorVersion } = (0, version_utils_1.getInstalledAngularVersionInfo)(tree);
|
33
|
-
const sourceRoot = (0,
|
32
|
+
const sourceRoot = project.sourceRoot ?? (0, devkit_1.joinPathFragments)(project.root, 'src');
|
34
33
|
buildTarget.options ??= {};
|
35
34
|
buildTarget.options.outputPath = outputPath;
|
36
35
|
buildTarget.options.server = (0, devkit_1.joinPathFragments)(sourceRoot, options.main);
|
@@ -66,7 +65,7 @@ function updateProjectConfigForBrowserBuilder(tree, options) {
|
|
66
65
|
}
|
67
66
|
}
|
68
67
|
const { major: angularMajorVersion } = (0, version_utils_1.getInstalledAngularVersionInfo)(tree);
|
69
|
-
const sourceRoot = (0,
|
68
|
+
const sourceRoot = projectConfig.sourceRoot ?? (0, devkit_1.joinPathFragments)(projectConfig.root, 'src');
|
70
69
|
projectConfig.targets.server = {
|
71
70
|
dependsOn: ['build'],
|
72
71
|
executor: buildTarget.executor.startsWith('@angular-devkit/build-angular:')
|
@@ -2,7 +2,6 @@
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
exports.addTailwindConfig = addTailwindConfig;
|
4
4
|
const devkit_1 = require("@nx/devkit");
|
5
|
-
const ts_solution_setup_1 = require("@nx/js/src/utils/typescript/ts-solution-setup");
|
6
5
|
const path_1 = require("path");
|
7
6
|
function addTailwindConfig(tree, options, project, tailwindVersion) {
|
8
7
|
if (tree.exists((0, devkit_1.joinPathFragments)(project.root, 'tailwind.config.js'))) {
|
@@ -11,7 +10,7 @@ function addTailwindConfig(tree, options, project, tailwindVersion) {
|
|
11
10
|
}
|
12
11
|
const filesDir = tailwindVersion === '3' ? 'files/v3' : 'files/v2';
|
13
12
|
(0, devkit_1.generateFiles)(tree, (0, devkit_1.joinPathFragments)(__dirname, '..', filesDir), project.root, {
|
14
|
-
relativeSourceRoot: (0, path_1.relative)(project.root,
|
13
|
+
relativeSourceRoot: (0, path_1.relative)(project.root, project.sourceRoot),
|
15
14
|
tmpl: '',
|
16
15
|
});
|
17
16
|
}
|
@@ -2,7 +2,6 @@
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
exports.updateApplicationStyles = updateApplicationStyles;
|
4
4
|
const devkit_1 = require("@nx/devkit");
|
5
|
-
const ts_solution_setup_1 = require("@nx/js/src/utils/typescript/ts-solution-setup");
|
6
5
|
function updateApplicationStyles(tree, options, project) {
|
7
6
|
let stylesEntryPoint = options.stylesEntryPoint;
|
8
7
|
if (stylesEntryPoint && !tree.exists(stylesEntryPoint)) {
|
@@ -23,13 +22,12 @@ function updateApplicationStyles(tree, options, project) {
|
|
23
22
|
${stylesEntryPointContent}`);
|
24
23
|
}
|
25
24
|
function findStylesEntryPoint(tree, options, project) {
|
26
|
-
const sourceRoot = (0, ts_solution_setup_1.getProjectSourceRoot)(project, tree);
|
27
25
|
// first check for common names
|
28
26
|
const possibleStylesEntryPoints = [
|
29
|
-
(0, devkit_1.joinPathFragments)(sourceRoot, 'styles.css'),
|
30
|
-
(0, devkit_1.joinPathFragments)(sourceRoot, 'styles.scss'),
|
31
|
-
(0, devkit_1.joinPathFragments)(sourceRoot, 'styles.sass'),
|
32
|
-
(0, devkit_1.joinPathFragments)(sourceRoot, 'styles.less'),
|
27
|
+
(0, devkit_1.joinPathFragments)(project.sourceRoot ?? project.root, 'styles.css'),
|
28
|
+
(0, devkit_1.joinPathFragments)(project.sourceRoot ?? project.root, 'styles.scss'),
|
29
|
+
(0, devkit_1.joinPathFragments)(project.sourceRoot ?? project.root, 'styles.sass'),
|
30
|
+
(0, devkit_1.joinPathFragments)(project.sourceRoot ?? project.root, 'styles.less'),
|
33
31
|
];
|
34
32
|
let stylesEntryPoint = possibleStylesEntryPoints.find((s) => tree.exists(s));
|
35
33
|
if (stylesEntryPoint) {
|
@@ -3,7 +3,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getAppComponentInfo = getAppComponentInfo;
|
4
4
|
exports.getNxWelcomeComponentInfo = getNxWelcomeComponentInfo;
|
5
5
|
const devkit_1 = require("@nx/devkit");
|
6
|
-
const ts_solution_setup_1 = require("@nx/js/src/utils/typescript/ts-solution-setup");
|
7
6
|
const node_path_1 = require("node:path");
|
8
7
|
const version_utils_1 = require("./version-utils");
|
9
8
|
function getAppComponentInfo(tree, componentFileSuffix, project) {
|
@@ -14,19 +13,18 @@ function getNxWelcomeComponentInfo(tree, componentFileSuffix, project) {
|
|
14
13
|
}
|
15
14
|
// TODO(leo): follow this up and improve it by using static analysis
|
16
15
|
function getComponentInfo(tree, component, componentFileSuffix, project) {
|
17
|
-
|
18
|
-
let componentPath = (0, devkit_1.joinPathFragments)(sourceRoot, `app/${component}.component.ts`);
|
16
|
+
let componentPath = (0, devkit_1.joinPathFragments)(project.sourceRoot, `app/${component}.component.ts`);
|
19
17
|
if (!tree.exists(componentPath)) {
|
20
|
-
componentPath = (0, devkit_1.joinPathFragments)(sourceRoot, `app/${component}.ts`);
|
18
|
+
componentPath = (0, devkit_1.joinPathFragments)(project.sourceRoot, `app/${component}.ts`);
|
21
19
|
}
|
22
20
|
if (!tree.exists(componentPath)) {
|
23
21
|
if (componentFileSuffix) {
|
24
|
-
componentPath = (0, devkit_1.joinPathFragments)(sourceRoot, `app/${component}${componentFileSuffix}.ts`);
|
22
|
+
componentPath = (0, devkit_1.joinPathFragments)(project.sourceRoot, `app/${component}${componentFileSuffix}.ts`);
|
25
23
|
}
|
26
24
|
}
|
27
25
|
if (!tree.exists(componentPath)) {
|
28
26
|
const { major: angularMajorVersion } = (0, version_utils_1.getInstalledAngularVersionInfo)(tree);
|
29
|
-
componentPath = (0, devkit_1.joinPathFragments)(sourceRoot, angularMajorVersion >= 20
|
27
|
+
componentPath = (0, devkit_1.joinPathFragments)(project.sourceRoot, angularMajorVersion >= 20
|
30
28
|
? `app/${component}.ts`
|
31
29
|
: `app/${component}.component.ts`);
|
32
30
|
}
|
@@ -7,7 +7,6 @@ exports.generateTestLibrary = generateTestLibrary;
|
|
7
7
|
exports.createStorybookTestWorkspaceForLib = createStorybookTestWorkspaceForLib;
|
8
8
|
const devkit_1 = require("@nx/devkit");
|
9
9
|
const testing_1 = require("@nx/devkit/testing");
|
10
|
-
const ts_solution_setup_1 = require("@nx/js/src/utils/typescript/ts-solution-setup");
|
11
10
|
const test_runners_1 = require("../../utils/test-runners");
|
12
11
|
const application_1 = require("../application/application");
|
13
12
|
const component_1 = require("../component/component");
|
@@ -227,7 +226,7 @@ export class StaticMemberDeclarationsModule {
|
|
227
226
|
function generateModule(tree, options) {
|
228
227
|
const project = (0, devkit_1.readProjectConfiguration)(tree, options.project);
|
229
228
|
if (options.path === undefined) {
|
230
|
-
const sourceRoot =
|
229
|
+
const sourceRoot = project.sourceRoot ?? `${project.root}/src`;
|
231
230
|
const projectDirName = project.projectType === 'application' ? 'app' : 'lib';
|
232
231
|
options.path = `${sourceRoot}/${projectDirName}`;
|
233
232
|
}
|
@@ -18,7 +18,7 @@ const dataPersistenceOperators = [
|
|
18
18
|
];
|
19
19
|
const newImportPath = '@ngrx/router-store/data-persistence';
|
20
20
|
async function default_1(tree) {
|
21
|
-
const projects = await (0, projects_1.getProjectsFilteredByDependencies)(angularPluginTargetNames);
|
21
|
+
const projects = await (0, projects_1.getProjectsFilteredByDependencies)(tree, angularPluginTargetNames);
|
22
22
|
if (!projects.length) {
|
23
23
|
return;
|
24
24
|
}
|
@@ -26,7 +26,7 @@ async function default_1(tree) {
|
|
26
26
|
tsquery = require('@phenomnomnominal/tsquery').tsquery;
|
27
27
|
const cachedFileMap = (0, nx_deps_cache_1.readFileMapCache)().fileMap.projectFileMap;
|
28
28
|
const filesWithNxAngularImports = [];
|
29
|
-
for (const graphNode of projects) {
|
29
|
+
for (const { graphNode } of projects) {
|
30
30
|
const files = filterFilesWithNxAngularDep(cachedFileMap[graphNode.name] || []);
|
31
31
|
filesWithNxAngularImports.push(...files);
|
32
32
|
}
|
@@ -6,7 +6,6 @@ const path_1 = require("path");
|
|
6
6
|
const version_utils_1 = require("../../generators/utils/version-utils");
|
7
7
|
const targets_1 = require("../../utils/targets");
|
8
8
|
const projects_1 = require("../utils/projects");
|
9
|
-
const ts_solution_setup_1 = require("@nx/js/src/utils/typescript/ts-solution-setup");
|
10
9
|
const UNIVERSAL_PACKAGES = [
|
11
10
|
'@nguniversal/common',
|
12
11
|
'@nguniversal/express-engine',
|
@@ -27,11 +26,11 @@ async function default_1(tree) {
|
|
27
26
|
if (!UNIVERSAL_PACKAGES.some((pkg) => packageJson.dependencies?.[pkg] || packageJson.devDependencies?.[pkg])) {
|
28
27
|
return;
|
29
28
|
}
|
30
|
-
const projects = await (0, projects_1.getProjectsFilteredByDependencies)([
|
29
|
+
const projects = await (0, projects_1.getProjectsFilteredByDependencies)(tree, [
|
31
30
|
'npm:@nguniversal/common',
|
32
31
|
'npm:@nguniversal/express-engine',
|
33
32
|
]);
|
34
|
-
for (const {
|
33
|
+
for (const { project } of projects) {
|
35
34
|
if (project.projectType !== 'application') {
|
36
35
|
continue;
|
37
36
|
}
|
@@ -51,7 +50,7 @@ async function default_1(tree) {
|
|
51
50
|
}
|
52
51
|
// Replace all import specifiers in all files.
|
53
52
|
let hasExpressTokens = false;
|
54
|
-
const root =
|
53
|
+
const root = project.sourceRoot ?? `${project.root}/src`;
|
55
54
|
const tokensFilePath = `${root}/express.tokens.ts`;
|
56
55
|
(0, devkit_1.visitNotIgnoredFiles)(tree, root, (path) => {
|
57
56
|
if (!path.endsWith('.ts') || path.endsWith('.d.ts')) {
|