@nx/angular 21.2.3 → 21.3.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 +9 -9
- package/plugins/component-testing.js +14 -6
- package/src/builders/utilities/module-federation.js +3 -4
- 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/library.js +4 -0
- package/src/generators/library/schema.json +2 -1
- 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-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-17-1-0/replace-nguniversal-engines.js +1 -2
- package/src/utils/nx-devkit/ast-utils.js +2 -3
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@nx/angular",
|
3
|
-
"version": "21.
|
3
|
+
"version": "21.3.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, Playwright 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- Single Component Application Modules (SCAMs) \n\n- NgRx helpers. \n\n- Utilities for automatic workspace refactoring.",
|
6
6
|
"repository": {
|
@@ -58,14 +58,14 @@
|
|
58
58
|
"migrations": "./migrations.json"
|
59
59
|
},
|
60
60
|
"dependencies": {
|
61
|
-
"@nx/devkit": "21.
|
62
|
-
"@nx/eslint": "21.
|
63
|
-
"@nx/js": "21.
|
64
|
-
"@nx/module-federation": "21.
|
65
|
-
"@nx/rspack": "21.
|
66
|
-
"@nx/web": "21.
|
67
|
-
"@nx/webpack": "21.
|
68
|
-
"@nx/workspace": "21.
|
61
|
+
"@nx/devkit": "21.3.0-beta.0",
|
62
|
+
"@nx/eslint": "21.3.0-beta.0",
|
63
|
+
"@nx/js": "21.3.0-beta.0",
|
64
|
+
"@nx/module-federation": "21.3.0-beta.0",
|
65
|
+
"@nx/rspack": "21.3.0-beta.0",
|
66
|
+
"@nx/web": "21.3.0-beta.0",
|
67
|
+
"@nx/webpack": "21.3.0-beta.0",
|
68
|
+
"@nx/workspace": "21.3.0-beta.0",
|
69
69
|
"@phenomnomnominal/tsquery": "~5.0.1",
|
70
70
|
"@typescript-eslint/type-utils": "^8.0.0",
|
71
71
|
"enquirer": "~2.3.6",
|
@@ -4,7 +4,6 @@ exports.nxComponentTestingPreset = nxComponentTestingPreset;
|
|
4
4
|
const cypress_preset_1 = require("@nx/cypress/plugins/cypress-preset");
|
5
5
|
const ct_helpers_1 = require("@nx/cypress/src/utils/ct-helpers");
|
6
6
|
const devkit_1 = require("@nx/devkit");
|
7
|
-
const ts_solution_setup_1 = require("@nx/js/src/utils/typescript/ts-solution-setup");
|
8
7
|
const fs_1 = require("fs");
|
9
8
|
const path_1 = require("path");
|
10
9
|
const semver_1 = require("semver");
|
@@ -116,8 +115,7 @@ function normalizeBuildTargetOptions(buildContext, ctContext, offset) {
|
|
116
115
|
configuration: buildContext.configurationName,
|
117
116
|
}, buildContext);
|
118
117
|
const project = buildContext.projectsConfigurations.projects[buildContext.projectName];
|
119
|
-
const
|
120
|
-
const buildOptions = withSchemaDefaults(options, sourceRoot, buildContext.root);
|
118
|
+
const buildOptions = withSchemaDefaults(options, project, buildContext.root);
|
121
119
|
// cypress creates a tsconfig if one isn't preset
|
122
120
|
// that contains all the support required for angular and component tests
|
123
121
|
delete buildOptions.tsConfig;
|
@@ -191,9 +189,18 @@ function normalizeBuildTargetOptions(buildContext, ctContext, offset) {
|
|
191
189
|
buildOptions.scripts = [];
|
192
190
|
buildOptions.stylePreprocessorOptions = { includePaths: [] };
|
193
191
|
}
|
192
|
+
const config = buildContext.projectGraph.nodes[buildContext.projectName]?.data;
|
193
|
+
if (!config.sourceRoot) {
|
194
|
+
devkit_1.logger.warn((0, devkit_1.stripIndents) `Unable to find the 'sourceRoot' in the project configuration.
|
195
|
+
Will set 'sourceRoot' to '${config.root}/src'
|
196
|
+
Note: this may fail, setting the correct 'sourceRoot' for ${buildContext.projectName} in the project.json file will ensure the correct value is used.`);
|
197
|
+
config.sourceRoot = (0, devkit_1.joinPathFragments)(config.root, 'src');
|
198
|
+
}
|
194
199
|
return {
|
195
|
-
root: offset ? (0, devkit_1.joinPathFragments)(offset,
|
196
|
-
sourceRoot: offset
|
200
|
+
root: offset ? (0, devkit_1.joinPathFragments)(offset, config.root) : config.root,
|
201
|
+
sourceRoot: offset
|
202
|
+
? (0, devkit_1.joinPathFragments)(offset, config.sourceRoot)
|
203
|
+
: config.sourceRoot,
|
197
204
|
buildOptions: {
|
198
205
|
...buildOptions,
|
199
206
|
// this property is only valid for cy v12.9.0+
|
@@ -201,8 +208,9 @@ function normalizeBuildTargetOptions(buildContext, ctContext, offset) {
|
|
201
208
|
},
|
202
209
|
};
|
203
210
|
}
|
204
|
-
function withSchemaDefaults(options,
|
211
|
+
function withSchemaDefaults(options, project, workspaceRoot) {
|
205
212
|
if (!options.main && !options.browser) {
|
213
|
+
const sourceRoot = project.sourceRoot ?? (0, devkit_1.joinPathFragments)(project.root, 'src');
|
206
214
|
options.browser = (0, devkit_1.joinPathFragments)(sourceRoot, 'main.ts');
|
207
215
|
if (!(0, fs_1.existsSync)((0, path_1.join)(workspaceRoot, options.browser))) {
|
208
216
|
throw new Error('Missing executor options "main" and "browser"');
|
@@ -4,11 +4,10 @@ exports.getDynamicRemotes = getDynamicRemotes;
|
|
4
4
|
exports.getStaticRemotes = getStaticRemotes;
|
5
5
|
exports.validateDevRemotes = validateDevRemotes;
|
6
6
|
exports.getDynamicMfManifestFile = getDynamicMfManifestFile;
|
7
|
+
const path_1 = require("path");
|
8
|
+
const fs_1 = require("fs");
|
7
9
|
const devkit_1 = require("@nx/devkit");
|
8
10
|
const internal_1 = require("@nx/js/src/internal");
|
9
|
-
const ts_solution_setup_1 = require("@nx/js/src/utils/typescript/ts-solution-setup");
|
10
|
-
const fs_1 = require("fs");
|
11
|
-
const path_1 = require("path");
|
12
11
|
function getDynamicRemotes(project, context, workspaceProjects, remotesToSkip, pathToManifestFile) {
|
13
12
|
pathToManifestFile ??= getDynamicMfManifestFile(project, context.workspaceRoot);
|
14
13
|
// check for dynamic remotes
|
@@ -106,6 +105,6 @@ function getDynamicMfManifestFile(project, workspaceRoot) {
|
|
106
105
|
// at the old path.
|
107
106
|
return [
|
108
107
|
(0, path_1.join)(workspaceRoot, project.root, 'public/module-federation.manifest.json'),
|
109
|
-
(0, path_1.join)(workspaceRoot,
|
108
|
+
(0, path_1.join)(workspaceRoot, project.sourceRoot, 'assets/module-federation.manifest.json'),
|
110
109
|
].find((path) => (0, fs_1.existsSync)(path));
|
111
110
|
}
|
@@ -2,16 +2,16 @@
|
|
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 version_utils_1 = require("../../utils/version-utils");
|
9
8
|
async function updateSsrSetup(tree, options, appName, typescriptConfiguration) {
|
10
9
|
const { major: angularMajorVersion } = (0, version_utils_1.getInstalledAngularVersionInfo)(tree);
|
11
10
|
let project = (0, devkit_1.readProjectConfiguration)(tree, appName);
|
12
|
-
|
13
|
-
|
14
|
-
|
11
|
+
tree.rename((0, devkit_1.joinPathFragments)(project.sourceRoot, 'main.server.ts'), (0, devkit_1.joinPathFragments)(project.sourceRoot, 'bootstrap.server.ts'));
|
12
|
+
const pathToServerEntry = (0, devkit_1.joinPathFragments)(angularMajorVersion >= 19
|
13
|
+
? project.sourceRoot ?? (0, devkit_1.joinPathFragments)(project.root, 'src')
|
14
|
+
: project.root, 'server.ts');
|
15
15
|
tree.write(pathToServerEntry, `import('./${angularMajorVersion >= 19 ? '' : 'src/'}main.server');`);
|
16
16
|
(0, devkit_1.generateFiles)(tree, (0, path_1.join)(__dirname, '../files/common'), project.root, {
|
17
17
|
appName,
|
@@ -3,7 +3,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.createFiles = createFiles;
|
4
4
|
const devkit_1 = require("@nx/devkit");
|
5
5
|
const js_1 = require("@nx/js");
|
6
|
-
const ts_solution_setup_1 = require("@nx/js/src/utils/typescript/ts-solution-setup");
|
7
6
|
const semver_1 = require("semver");
|
8
7
|
const test_runners_1 = require("../../../utils/test-runners");
|
9
8
|
const version_utils_1 = require("../../utils/version-utils");
|
@@ -51,7 +50,7 @@ function createFiles(tree, options, project) {
|
|
51
50
|
}
|
52
51
|
}
|
53
52
|
if (!options.libraryOptions.routing) {
|
54
|
-
tree.delete((0, devkit_1.joinPathFragments)(
|
53
|
+
tree.delete((0, devkit_1.joinPathFragments)(project.sourceRoot, `lib/lib.routes.ts`));
|
55
54
|
}
|
56
55
|
if (!options.libraryOptions.buildable &&
|
57
56
|
!options.libraryOptions.publishable) {
|
@@ -33,6 +33,10 @@ async function libraryGenerator(tree, schema) {
|
|
33
33
|
if (schema.publishable === true && !schema.importPath) {
|
34
34
|
throw new Error(`For publishable libs you have to provide a proper "--importPath" which needs to be a valid npm package name (e.g. my-awesome-lib or @myorg/my-lib)`);
|
35
35
|
}
|
36
|
+
if (schema.simpleName !== undefined && schema.simpleName !== false) {
|
37
|
+
// TODO(v22): Remove simpleName as user should be using name.
|
38
|
+
devkit_1.logger.warn(`The "--simpleName" option is deprecated and will be removed in Nx 22. Please use the "--name" option to provide the exact name you want for the library.`);
|
39
|
+
}
|
36
40
|
if (schema.addTailwind && !schema.buildable && !schema.publishable) {
|
37
41
|
throw new Error(`To use "--addTailwind" option, you have to set either "--buildable" or "--publishable".`);
|
38
42
|
}
|
@@ -47,7 +47,8 @@
|
|
47
47
|
"simpleName": {
|
48
48
|
"description": "Don't include the directory in the name of the module or standalone component entry of the library.",
|
49
49
|
"type": "boolean",
|
50
|
-
"default": false
|
50
|
+
"default": false,
|
51
|
+
"x-deprecated": "Use the --name option to provide the exact name instead. This option will be removed in Nx 22."
|
51
52
|
},
|
52
53
|
"addModuleSpec": {
|
53
54
|
"description": "Add a module spec file.",
|
@@ -2,7 +2,6 @@
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
exports.updateModuleName = updateModuleName;
|
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
|
/**
|
7
6
|
* Updates the Angular module name (including the spec file and index.ts)
|
8
7
|
*
|
@@ -41,15 +40,14 @@ function updateModuleName(tree, { oldProjectName, newProjectName }) {
|
|
41
40
|
to: `${unscopedNewProjectName}-module`,
|
42
41
|
},
|
43
42
|
];
|
44
|
-
const sourceRoot = (0, ts_solution_setup_1.getProjectSourceRoot)(project, tree);
|
45
43
|
const filesToRename = moduleFiles.flatMap((moduleFile) => [
|
46
44
|
{
|
47
|
-
from: `${sourceRoot}/lib/${moduleFile.from}.ts`,
|
48
|
-
to: `${sourceRoot}/lib/${moduleFile.to}.ts`,
|
45
|
+
from: `${project.sourceRoot}/lib/${moduleFile.from}.ts`,
|
46
|
+
to: `${project.sourceRoot}/lib/${moduleFile.to}.ts`,
|
49
47
|
},
|
50
48
|
{
|
51
|
-
from: `${sourceRoot}/lib/${moduleFile.from}.spec.ts`,
|
52
|
-
to: `${sourceRoot}/lib/${moduleFile.to}.spec.ts`,
|
49
|
+
from: `${project.sourceRoot}/lib/${moduleFile.from}.spec.ts`,
|
50
|
+
to: `${project.sourceRoot}/lib/${moduleFile.to}.spec.ts`,
|
53
51
|
},
|
54
52
|
].filter((rename) => rename.from !== rename.to));
|
55
53
|
if (filesToRename.length === 0) {
|
@@ -73,7 +71,7 @@ function updateModuleName(tree, { oldProjectName, newProjectName }) {
|
|
73
71
|
}
|
74
72
|
});
|
75
73
|
// update index file
|
76
|
-
const indexFile = (0, devkit_1.joinPathFragments)(sourceRoot, 'index.ts');
|
74
|
+
const indexFile = (0, devkit_1.joinPathFragments)(project.sourceRoot, 'index.ts');
|
77
75
|
if (tree.exists(indexFile)) {
|
78
76
|
updateFileContent(tree, replacements, indexFile);
|
79
77
|
}
|
@@ -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';
|
@@ -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
|
}
|
@@ -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',
|
@@ -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')) {
|
@@ -26,7 +26,6 @@ exports.getTsSourceFile = getTsSourceFile;
|
|
26
26
|
const devkit_1 = require("@nx/devkit");
|
27
27
|
const js_1 = require("@nx/js");
|
28
28
|
const ensure_typescript_1 = require("@nx/js/src/utils/typescript/ensure-typescript");
|
29
|
-
const ts_solution_setup_1 = require("@nx/js/src/utils/typescript/ts-solution-setup");
|
30
29
|
const path_1 = require("path");
|
31
30
|
const angular_version_utils_1 = require("../../executors/utilities/angular-version-utils");
|
32
31
|
const version_utils_1 = require("../../generators/utils/version-utils");
|
@@ -452,7 +451,7 @@ function isNgStandaloneApp(tree, projectName) {
|
|
452
451
|
hasMainFile = true;
|
453
452
|
}
|
454
453
|
else {
|
455
|
-
const sourceRoot = (0,
|
454
|
+
const sourceRoot = project.sourceRoot ?? (0, devkit_1.joinPathFragments)(project.root, 'src');
|
456
455
|
mainFile = (0, devkit_1.joinPathFragments)(sourceRoot, 'main.ts');
|
457
456
|
hasMainFile = tree.exists(mainFile);
|
458
457
|
}
|
@@ -561,7 +560,7 @@ function readBootstrapInfo(host, app) {
|
|
561
560
|
config.targets.build.options?.main ??
|
562
561
|
config.targets.build.options?.browser;
|
563
562
|
if (!mainPath) {
|
564
|
-
const sourceRoot = (0,
|
563
|
+
const sourceRoot = config.sourceRoot ?? (0, devkit_1.joinPathFragments)(config.root, 'src');
|
565
564
|
mainPath = (0, devkit_1.joinPathFragments)(sourceRoot, 'main.ts');
|
566
565
|
}
|
567
566
|
}
|