@nx/angular 17.0.0-rc.0 → 17.0.0-rc.1
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/generators/component/lib/component.js +1 -1
- package/src/generators/component/lib/normalize-options.js +3 -3
- package/src/generators/component/schema.d.ts +1 -1
- package/src/generators/directive/directive.js +1 -1
- package/src/generators/directive/lib/normalize-options.js +3 -3
- package/src/generators/directive/schema.d.ts +1 -1
- package/src/generators/federate-module/federate-module.js +1 -1
- package/src/generators/ng-add/schema.d.ts +0 -4
- package/src/generators/ng-add/schema.json +0 -5
- package/src/generators/pipe/lib/normalize-options.js +2 -2
- package/src/generators/pipe/pipe.js +1 -1
- package/src/generators/pipe/schema.d.ts +1 -1
- package/src/generators/remote/remote.js +5 -1
- package/src/generators/scam/lib/index.d.ts +0 -1
- package/src/generators/scam/lib/index.js +0 -1
- package/src/generators/scam/lib/normalize-options.js +2 -2
- package/src/generators/scam/scam.js +4 -4
- package/src/generators/scam/schema.d.ts +1 -1
- package/src/generators/scam-directive/lib/index.d.ts +0 -1
- package/src/generators/scam-directive/lib/index.js +0 -1
- package/src/generators/scam-directive/lib/normalize-options.js +2 -2
- package/src/generators/scam-directive/scam-directive.js +4 -4
- package/src/generators/scam-directive/schema.d.ts +1 -1
- package/src/generators/scam-pipe/lib/index.d.ts +0 -1
- package/src/generators/scam-pipe/lib/index.js +0 -1
- package/src/generators/scam-pipe/lib/normalize-options.js +2 -2
- package/src/generators/scam-pipe/scam-pipe.js +4 -4
- package/src/generators/scam-pipe/schema.d.ts +1 -1
- package/src/generators/stories/schema.json +3 -0
- package/src/generators/storybook-configuration/schema.json +3 -0
- package/src/generators/utils/export-scam.d.ts +1 -1
- package/src/generators/utils/export-scam.js +1 -1
- package/src/generators/utils/path.d.ts +0 -19
- package/src/generators/utils/path.js +1 -32
- package/src/generators/utils/project.d.ts +0 -2
- package/src/generators/utils/project.js +1 -11
- package/src/generators/utils/validations.d.ts +0 -1
- package/src/generators/utils/validations.js +1 -17
- package/src/generators/scam/lib/validate-options.d.ts +0 -3
- package/src/generators/scam/lib/validate-options.js +0 -9
- package/src/generators/scam-directive/lib/validate-options.d.ts +0 -3
- package/src/generators/scam-directive/lib/validate-options.js +0 -9
- package/src/generators/scam-pipe/lib/validate-options.d.ts +0 -3
- package/src/generators/scam-pipe/lib/validate-options.js +0 -9
- package/src/generators/utils/get-new-project-name.d.ts +0 -6
- package/src/generators/utils/get-new-project-name.js +0 -18
- package/src/generators/utils/names.d.ts +0 -5
- package/src/generators/utils/names.js +0 -11
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nx/angular",
|
|
3
|
-
"version": "17.0.0-rc.
|
|
3
|
+
"version": "17.0.0-rc.1",
|
|
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.0-rc.
|
|
83
|
-
"@nx/cypress": "17.0.0-rc.
|
|
84
|
-
"@nx/jest": "17.0.0-rc.
|
|
85
|
-
"@nx/js": "17.0.0-rc.
|
|
86
|
-
"@nx/eslint": "17.0.0-rc.
|
|
87
|
-
"@nx/webpack": "17.0.0-rc.
|
|
88
|
-
"@nx/web": "17.0.0-rc.
|
|
89
|
-
"@nx/workspace": "17.0.0-rc.
|
|
90
|
-
"@nrwl/angular": "17.0.0-rc.
|
|
82
|
+
"@nx/devkit": "17.0.0-rc.1",
|
|
83
|
+
"@nx/cypress": "17.0.0-rc.1",
|
|
84
|
+
"@nx/jest": "17.0.0-rc.1",
|
|
85
|
+
"@nx/js": "17.0.0-rc.1",
|
|
86
|
+
"@nx/eslint": "17.0.0-rc.1",
|
|
87
|
+
"@nx/webpack": "17.0.0-rc.1",
|
|
88
|
+
"@nx/web": "17.0.0-rc.1",
|
|
89
|
+
"@nx/workspace": "17.0.0-rc.1",
|
|
90
|
+
"@nrwl/angular": "17.0.0-rc.1"
|
|
91
91
|
},
|
|
92
92
|
"peerDependencies": {
|
|
93
93
|
"@angular-devkit/build-angular": ">= 14.0.0 < 17.0.0",
|
|
@@ -10,7 +10,7 @@ function exportComponentInEntryPoint(tree, schema) {
|
|
|
10
10
|
if (!schema.export || schema.skipImport) {
|
|
11
11
|
return;
|
|
12
12
|
}
|
|
13
|
-
const { root, projectType } = (0, devkit_1.readProjectConfiguration)(tree, schema.
|
|
13
|
+
const { root, projectType } = (0, devkit_1.readProjectConfiguration)(tree, schema.projectName);
|
|
14
14
|
if (projectType === 'application') {
|
|
15
15
|
return;
|
|
16
16
|
}
|
|
@@ -6,7 +6,7 @@ const artifact_name_and_directory_utils_1 = require("@nx/devkit/src/generators/a
|
|
|
6
6
|
const selector_1 = require("../../utils/selector");
|
|
7
7
|
async function normalizeOptions(tree, options) {
|
|
8
8
|
options.type ??= 'component';
|
|
9
|
-
const { artifactName: name, directory, fileName, filePath, project, } = await (0, artifact_name_and_directory_utils_1.determineArtifactNameAndDirectoryOptions)(tree, {
|
|
9
|
+
const { artifactName: name, directory, fileName, filePath, project: projectName, } = await (0, artifact_name_and_directory_utils_1.determineArtifactNameAndDirectoryOptions)(tree, {
|
|
10
10
|
artifactType: 'component',
|
|
11
11
|
callingGenerator: '@nx/angular:component',
|
|
12
12
|
name: options.name,
|
|
@@ -19,13 +19,13 @@ async function normalizeOptions(tree, options) {
|
|
|
19
19
|
const { className } = (0, devkit_1.names)(name);
|
|
20
20
|
const { className: suffixClassName } = (0, devkit_1.names)(options.type);
|
|
21
21
|
const symbolName = `${className}${suffixClassName}`;
|
|
22
|
-
const { prefix, root, sourceRoot } = (0, devkit_1.readProjectConfiguration)(tree,
|
|
22
|
+
const { prefix, root, sourceRoot } = (0, devkit_1.readProjectConfiguration)(tree, projectName);
|
|
23
23
|
const selector = options.selector ??
|
|
24
24
|
(0, selector_1.buildSelector)(tree, name, options.prefix, prefix, 'fileName');
|
|
25
25
|
return {
|
|
26
26
|
...options,
|
|
27
27
|
name,
|
|
28
|
-
|
|
28
|
+
projectName,
|
|
29
29
|
changeDetection: options.changeDetection ?? 'Default',
|
|
30
30
|
style: options.style ?? 'css',
|
|
31
31
|
directory,
|
|
@@ -20,7 +20,7 @@ async function directiveGenerator(tree, schema) {
|
|
|
20
20
|
}
|
|
21
21
|
if (!options.skipImport && !options.standalone) {
|
|
22
22
|
const modulePath = (0, utils_1.findModule)(tree, options.directory, options.module);
|
|
23
|
-
(0, utils_1.addToNgModule)(tree, options.directory, modulePath,
|
|
23
|
+
(0, utils_1.addToNgModule)(tree, options.directory, modulePath, options.name, options.symbolName, options.fileName, 'declarations', true, options.export);
|
|
24
24
|
}
|
|
25
25
|
if (!options.skipFormat) {
|
|
26
26
|
await (0, devkit_1.formatFiles)(tree);
|
|
@@ -5,7 +5,7 @@ const devkit_1 = require("@nx/devkit");
|
|
|
5
5
|
const selector_1 = require("../../utils/selector");
|
|
6
6
|
const artifact_name_and_directory_utils_1 = require("@nx/devkit/src/generators/artifact-name-and-directory-utils");
|
|
7
7
|
async function normalizeOptions(tree, options) {
|
|
8
|
-
const { artifactName: name, directory, fileName, filePath, project, } = await (0, artifact_name_and_directory_utils_1.determineArtifactNameAndDirectoryOptions)(tree, {
|
|
8
|
+
const { artifactName: name, directory, fileName, filePath, project: projectName, } = await (0, artifact_name_and_directory_utils_1.determineArtifactNameAndDirectoryOptions)(tree, {
|
|
9
9
|
artifactType: 'directive',
|
|
10
10
|
callingGenerator: '@nx/angular:directive',
|
|
11
11
|
name: options.name,
|
|
@@ -18,12 +18,12 @@ async function normalizeOptions(tree, options) {
|
|
|
18
18
|
const { className } = (0, devkit_1.names)(name);
|
|
19
19
|
const { className: suffixClassName } = (0, devkit_1.names)('directive');
|
|
20
20
|
const symbolName = `${className}${suffixClassName}`;
|
|
21
|
-
const { prefix } = (0, devkit_1.readProjectConfiguration)(tree,
|
|
21
|
+
const { prefix } = (0, devkit_1.readProjectConfiguration)(tree, projectName);
|
|
22
22
|
const selector = options.selector ??
|
|
23
23
|
(0, selector_1.buildSelector)(tree, name, options.prefix, prefix, 'propertyName');
|
|
24
24
|
return {
|
|
25
25
|
...options,
|
|
26
|
-
|
|
26
|
+
projectName,
|
|
27
27
|
name,
|
|
28
28
|
directory,
|
|
29
29
|
fileName,
|
|
@@ -5,7 +5,7 @@ const devkit_1 = require("@nx/devkit");
|
|
|
5
5
|
const lib_1 = require("./lib");
|
|
6
6
|
async function federateModuleGenerator(tree, schema) {
|
|
7
7
|
if (!tree.exists(schema.path)) {
|
|
8
|
-
throw new Error((0, devkit_1.stripIndents) `The "path" provided
|
|
8
|
+
throw new Error((0, devkit_1.stripIndents) `The "path" provided does not exist. Please verify the path is correct and pointing to a file that exists in the workspace.
|
|
9
9
|
|
|
10
10
|
Path: ${schema.path}`);
|
|
11
11
|
}
|
|
@@ -3,10 +3,6 @@ import { E2eTestRunner, UnitTestRunner } from '../../utils/test-runners';
|
|
|
3
3
|
import type { Styles } from '../utils/types';
|
|
4
4
|
|
|
5
5
|
export interface GeneratorOptions {
|
|
6
|
-
/**
|
|
7
|
-
* @deprecated This should be inferred with {@link getNpmScope}
|
|
8
|
-
*/
|
|
9
|
-
npmScope?: string;
|
|
10
6
|
defaultBase?: string;
|
|
11
7
|
|
|
12
8
|
unitTestRunner?: UnitTestRunner;
|
|
@@ -6,11 +6,6 @@
|
|
|
6
6
|
"description": "Migrates an Angular CLI workspace to Nx or adds the Angular plugin to an Nx workspace. NOTE: Does not work in the `--dry-run` mode.",
|
|
7
7
|
"type": "object",
|
|
8
8
|
"properties": {
|
|
9
|
-
"npmScope": {
|
|
10
|
-
"type": "string",
|
|
11
|
-
"description": "Npm scope for importing libs. NOTE: only used if running the generator in an Angular CLI workspace.",
|
|
12
|
-
"x-deprecated": "This will be inferred from your root package.json"
|
|
13
|
-
},
|
|
14
9
|
"defaultBase": {
|
|
15
10
|
"type": "string",
|
|
16
11
|
"description": "Default base branch for affected. NOTE: only used if running the generator in an Angular CLI workspace.",
|
|
@@ -4,7 +4,7 @@ exports.normalizeOptions = void 0;
|
|
|
4
4
|
const artifact_name_and_directory_utils_1 = require("@nx/devkit/src/generators/artifact-name-and-directory-utils");
|
|
5
5
|
const devkit_1 = require("@nx/devkit");
|
|
6
6
|
async function normalizeOptions(tree, options) {
|
|
7
|
-
const { artifactName: name, directory, fileName, filePath, project, } = await (0, artifact_name_and_directory_utils_1.determineArtifactNameAndDirectoryOptions)(tree, {
|
|
7
|
+
const { artifactName: name, directory, fileName, filePath, project: projectName, } = await (0, artifact_name_and_directory_utils_1.determineArtifactNameAndDirectoryOptions)(tree, {
|
|
8
8
|
artifactType: 'pipe',
|
|
9
9
|
callingGenerator: '@nx/angular:pipe',
|
|
10
10
|
name: options.name,
|
|
@@ -19,7 +19,7 @@ async function normalizeOptions(tree, options) {
|
|
|
19
19
|
const symbolName = `${className}${suffixClassName}`;
|
|
20
20
|
return {
|
|
21
21
|
...options,
|
|
22
|
-
|
|
22
|
+
projectName,
|
|
23
23
|
name,
|
|
24
24
|
directory,
|
|
25
25
|
fileName,
|
|
@@ -21,7 +21,7 @@ async function pipeGenerator(tree, rawOptions) {
|
|
|
21
21
|
}
|
|
22
22
|
if (!options.skipImport && !options.standalone) {
|
|
23
23
|
const modulePath = (0, utils_1.findModule)(tree, options.directory, options.module);
|
|
24
|
-
(0, utils_1.addToNgModule)(tree, options.directory, modulePath,
|
|
24
|
+
(0, utils_1.addToNgModule)(tree, options.directory, modulePath, options.name, options.symbolName, options.fileName, 'declarations', true, options.export);
|
|
25
25
|
}
|
|
26
26
|
if (!options.skipFormat) {
|
|
27
27
|
await (0, devkit_1.formatFiles)(tree);
|
|
@@ -9,6 +9,7 @@ const application_1 = require("../application/application");
|
|
|
9
9
|
const setup_mf_1 = require("../setup-mf/setup-mf");
|
|
10
10
|
const version_utils_1 = require("../utils/version-utils");
|
|
11
11
|
const lib_1 = require("./lib");
|
|
12
|
+
const versions_1 = require("@nx/js/src/utils/versions");
|
|
12
13
|
async function remote(tree, options) {
|
|
13
14
|
return await remoteInternal(tree, {
|
|
14
15
|
projectNameAndRootFormat: 'derived',
|
|
@@ -58,7 +59,10 @@ async function remoteInternal(tree, schema) {
|
|
|
58
59
|
prefix: options.prefix,
|
|
59
60
|
typescriptConfiguration,
|
|
60
61
|
});
|
|
61
|
-
|
|
62
|
+
const installSwcHelpersTask = (0, devkit_1.addDependenciesToPackageJson)(tree, {}, {
|
|
63
|
+
'@swc/helpers': versions_1.swcHelpersVersion,
|
|
64
|
+
});
|
|
65
|
+
let installTasks = [appInstallTask, installSwcHelpersTask];
|
|
62
66
|
if (options.ssr) {
|
|
63
67
|
let ssrInstallTask = await (0, lib_1.addSsr)(tree, {
|
|
64
68
|
appName: remoteProjectName,
|
|
@@ -3,4 +3,3 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
const tslib_1 = require("tslib");
|
|
4
4
|
tslib_1.__exportStar(require("./convert-component-to-scam"), exports);
|
|
5
5
|
tslib_1.__exportStar(require("./normalize-options"), exports);
|
|
6
|
-
tslib_1.__exportStar(require("./validate-options"), exports);
|
|
@@ -5,7 +5,7 @@ const artifact_name_and_directory_utils_1 = require("@nx/devkit/src/generators/a
|
|
|
5
5
|
const devkit_1 = require("@nx/devkit");
|
|
6
6
|
async function normalizeOptions(tree, options) {
|
|
7
7
|
options.type ??= 'component';
|
|
8
|
-
const { artifactName: name, directory, fileName, filePath, project, } = await (0, artifact_name_and_directory_utils_1.determineArtifactNameAndDirectoryOptions)(tree, {
|
|
8
|
+
const { artifactName: name, directory, fileName, filePath, project: projectName, } = await (0, artifact_name_and_directory_utils_1.determineArtifactNameAndDirectoryOptions)(tree, {
|
|
9
9
|
artifactType: options.type,
|
|
10
10
|
callingGenerator: '@nx/angular:scam',
|
|
11
11
|
name: options.name,
|
|
@@ -27,7 +27,7 @@ async function normalizeOptions(tree, options) {
|
|
|
27
27
|
filePath,
|
|
28
28
|
name,
|
|
29
29
|
symbolName,
|
|
30
|
-
|
|
30
|
+
projectName,
|
|
31
31
|
};
|
|
32
32
|
}
|
|
33
33
|
exports.normalizeOptions = normalizeOptions;
|
|
@@ -6,16 +6,16 @@ const component_1 = require("../component/component");
|
|
|
6
6
|
const export_scam_1 = require("../utils/export-scam");
|
|
7
7
|
const lib_1 = require("./lib");
|
|
8
8
|
async function scamGenerator(tree, rawOptions) {
|
|
9
|
-
(0, lib_1.
|
|
10
|
-
const { inlineScam, ...generatorOptions } = rawOptions;
|
|
9
|
+
const options = await (0, lib_1.normalizeOptions)(tree, rawOptions);
|
|
11
10
|
await (0, component_1.componentGenerator)(tree, {
|
|
12
|
-
...
|
|
11
|
+
...options,
|
|
13
12
|
skipImport: true,
|
|
14
13
|
export: false,
|
|
15
14
|
standalone: false,
|
|
16
15
|
skipFormat: true,
|
|
16
|
+
// options are already normalize, use them as is
|
|
17
|
+
nameAndDirectoryFormat: 'as-provided',
|
|
17
18
|
});
|
|
18
|
-
const options = await (0, lib_1.normalizeOptions)(tree, rawOptions);
|
|
19
19
|
(0, lib_1.convertComponentToScam)(tree, options);
|
|
20
20
|
(0, export_scam_1.exportScam)(tree, options);
|
|
21
21
|
if (!options.skipFormat) {
|
|
@@ -3,4 +3,3 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
const tslib_1 = require("tslib");
|
|
4
4
|
tslib_1.__exportStar(require("./convert-directive-to-scam"), exports);
|
|
5
5
|
tslib_1.__exportStar(require("./normalize-options"), exports);
|
|
6
|
-
tslib_1.__exportStar(require("./validate-options"), exports);
|
|
@@ -4,7 +4,7 @@ exports.normalizeOptions = void 0;
|
|
|
4
4
|
const artifact_name_and_directory_utils_1 = require("@nx/devkit/src/generators/artifact-name-and-directory-utils");
|
|
5
5
|
const devkit_1 = require("@nx/devkit");
|
|
6
6
|
async function normalizeOptions(tree, options) {
|
|
7
|
-
const { artifactName: name, directory, fileName, filePath, project, } = await (0, artifact_name_and_directory_utils_1.determineArtifactNameAndDirectoryOptions)(tree, {
|
|
7
|
+
const { artifactName: name, directory, fileName, filePath, project: projectName, } = await (0, artifact_name_and_directory_utils_1.determineArtifactNameAndDirectoryOptions)(tree, {
|
|
8
8
|
artifactType: 'directive',
|
|
9
9
|
callingGenerator: '@nx/angular:scam-directive',
|
|
10
10
|
name: options.name,
|
|
@@ -26,7 +26,7 @@ async function normalizeOptions(tree, options) {
|
|
|
26
26
|
filePath,
|
|
27
27
|
name,
|
|
28
28
|
symbolName,
|
|
29
|
-
|
|
29
|
+
projectName,
|
|
30
30
|
};
|
|
31
31
|
}
|
|
32
32
|
exports.normalizeOptions = normalizeOptions;
|
|
@@ -6,16 +6,16 @@ const directive_1 = require("../directive/directive");
|
|
|
6
6
|
const export_scam_1 = require("../utils/export-scam");
|
|
7
7
|
const lib_1 = require("./lib");
|
|
8
8
|
async function scamDirectiveGenerator(tree, rawOptions) {
|
|
9
|
-
(0, lib_1.
|
|
10
|
-
const { inlineScam, ...directiveOptions } = rawOptions;
|
|
9
|
+
const options = await (0, lib_1.normalizeOptions)(tree, rawOptions);
|
|
11
10
|
await (0, directive_1.directiveGenerator)(tree, {
|
|
12
|
-
...
|
|
11
|
+
...options,
|
|
13
12
|
skipImport: true,
|
|
14
13
|
export: false,
|
|
15
14
|
standalone: false,
|
|
16
15
|
skipFormat: true,
|
|
16
|
+
// options are already normalize, use them as is
|
|
17
|
+
nameAndDirectoryFormat: 'as-provided',
|
|
17
18
|
});
|
|
18
|
-
const options = await (0, lib_1.normalizeOptions)(tree, rawOptions);
|
|
19
19
|
(0, lib_1.convertDirectiveToScam)(tree, options);
|
|
20
20
|
(0, export_scam_1.exportScam)(tree, options);
|
|
21
21
|
await (0, devkit_1.formatFiles)(tree);
|
|
@@ -3,4 +3,3 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
const tslib_1 = require("tslib");
|
|
4
4
|
tslib_1.__exportStar(require("./convert-pipe-to-scam"), exports);
|
|
5
5
|
tslib_1.__exportStar(require("./normalize-options"), exports);
|
|
6
|
-
tslib_1.__exportStar(require("./validate-options"), exports);
|
|
@@ -4,7 +4,7 @@ exports.normalizeOptions = void 0;
|
|
|
4
4
|
const artifact_name_and_directory_utils_1 = require("@nx/devkit/src/generators/artifact-name-and-directory-utils");
|
|
5
5
|
const devkit_1 = require("@nx/devkit");
|
|
6
6
|
async function normalizeOptions(tree, options) {
|
|
7
|
-
const { artifactName: name, directory, fileName, filePath, project, } = await (0, artifact_name_and_directory_utils_1.determineArtifactNameAndDirectoryOptions)(tree, {
|
|
7
|
+
const { artifactName: name, directory, fileName, filePath, project: projectName, } = await (0, artifact_name_and_directory_utils_1.determineArtifactNameAndDirectoryOptions)(tree, {
|
|
8
8
|
artifactType: 'pipe',
|
|
9
9
|
callingGenerator: '@nx/angular:scam-pipe',
|
|
10
10
|
name: options.name,
|
|
@@ -26,7 +26,7 @@ async function normalizeOptions(tree, options) {
|
|
|
26
26
|
filePath,
|
|
27
27
|
name,
|
|
28
28
|
symbolName,
|
|
29
|
-
|
|
29
|
+
projectName,
|
|
30
30
|
};
|
|
31
31
|
}
|
|
32
32
|
exports.normalizeOptions = normalizeOptions;
|
|
@@ -6,16 +6,16 @@ const pipe_1 = require("../pipe/pipe");
|
|
|
6
6
|
const export_scam_1 = require("../utils/export-scam");
|
|
7
7
|
const lib_1 = require("./lib");
|
|
8
8
|
async function scamPipeGenerator(tree, rawOptions) {
|
|
9
|
-
(0, lib_1.
|
|
10
|
-
const { inlineScam, ...pipeOptions } = rawOptions;
|
|
9
|
+
const options = await (0, lib_1.normalizeOptions)(tree, rawOptions);
|
|
11
10
|
await (0, pipe_1.pipeGenerator)(tree, {
|
|
12
|
-
...
|
|
11
|
+
...options,
|
|
13
12
|
skipImport: true,
|
|
14
13
|
export: false,
|
|
15
14
|
standalone: false,
|
|
16
15
|
skipFormat: true,
|
|
16
|
+
// options are already normalize, use them as is
|
|
17
|
+
nameAndDirectoryFormat: 'as-provided',
|
|
17
18
|
});
|
|
18
|
-
const options = await (0, lib_1.normalizeOptions)(tree, rawOptions);
|
|
19
19
|
(0, lib_1.convertPipeToScam)(tree, options);
|
|
20
20
|
(0, export_scam_1.exportScam)(tree, options);
|
|
21
21
|
await (0, devkit_1.formatFiles)(tree);
|
|
@@ -8,7 +8,7 @@ function exportScam(tree, options) {
|
|
|
8
8
|
if (!options.export) {
|
|
9
9
|
return;
|
|
10
10
|
}
|
|
11
|
-
const { projectType, root, sourceRoot } = (0, devkit_1.readProjectConfiguration)(tree, options.
|
|
11
|
+
const { projectType, root, sourceRoot } = (0, devkit_1.readProjectConfiguration)(tree, options.projectName);
|
|
12
12
|
const projectSourceRoot = sourceRoot ?? (0, devkit_1.joinPathFragments)(root, 'src');
|
|
13
13
|
if (projectType === 'application') {
|
|
14
14
|
devkit_1.logger.warn('--export=true was ignored as the project the SCAM is being generated in is not a library.');
|
|
@@ -1,20 +1 @@
|
|
|
1
|
-
import type { Tree } from '@nx/devkit';
|
|
2
|
-
export declare function pathStartsWith(path1: string, path2: string): boolean;
|
|
3
1
|
export declare function getRelativeImportToFile(sourceFilePath: string, targetFilePath: string): string;
|
|
4
|
-
export type PathGenerationOptions = {
|
|
5
|
-
name: string;
|
|
6
|
-
project: string;
|
|
7
|
-
flat?: boolean;
|
|
8
|
-
path?: string;
|
|
9
|
-
type?: string;
|
|
10
|
-
};
|
|
11
|
-
export type GenerationPaths = {
|
|
12
|
-
directory: string;
|
|
13
|
-
fileName: string;
|
|
14
|
-
filePath: string;
|
|
15
|
-
name: string;
|
|
16
|
-
path: string;
|
|
17
|
-
root: string;
|
|
18
|
-
sourceRoot: string;
|
|
19
|
-
};
|
|
20
|
-
export declare function normalizeNameAndPaths(tree: Tree, options: PathGenerationOptions): GenerationPaths;
|
|
@@ -1,41 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.getRelativeImportToFile = void 0;
|
|
4
4
|
const devkit_1 = require("@nx/devkit");
|
|
5
5
|
const path_1 = require("path");
|
|
6
|
-
const names_1 = require("./names");
|
|
7
|
-
function pathStartsWith(path1, path2) {
|
|
8
|
-
const normalizedPath1 = (0, devkit_1.joinPathFragments)(devkit_1.workspaceRoot, path1);
|
|
9
|
-
const normalizedPath2 = (0, devkit_1.joinPathFragments)(devkit_1.workspaceRoot, path2);
|
|
10
|
-
return normalizedPath1.startsWith(normalizedPath2);
|
|
11
|
-
}
|
|
12
|
-
exports.pathStartsWith = pathStartsWith;
|
|
13
6
|
function getRelativeImportToFile(sourceFilePath, targetFilePath) {
|
|
14
7
|
const relativeDirToTarget = (0, path_1.relative)((0, path_1.dirname)(sourceFilePath), (0, path_1.dirname)(targetFilePath));
|
|
15
8
|
return `./${(0, devkit_1.joinPathFragments)(relativeDirToTarget, (0, path_1.basename)(targetFilePath, '.ts'))}`;
|
|
16
9
|
}
|
|
17
10
|
exports.getRelativeImportToFile = getRelativeImportToFile;
|
|
18
|
-
function normalizeNameAndPaths(tree, options) {
|
|
19
|
-
const { root, sourceRoot, projectType } = (0, devkit_1.readProjectConfiguration)(tree, options.project);
|
|
20
|
-
const projectSourceRoot = sourceRoot ?? (0, devkit_1.joinPathFragments)(root, 'src');
|
|
21
|
-
const { name, path: namePath } = (0, names_1.parseNameWithPath)(options.name);
|
|
22
|
-
const path = options.path ??
|
|
23
|
-
(0, devkit_1.joinPathFragments)(projectSourceRoot, projectType === 'application' ? 'app' : 'lib', namePath);
|
|
24
|
-
const directory = options.flat
|
|
25
|
-
? (0, devkit_1.normalizePath)(path)
|
|
26
|
-
: (0, devkit_1.joinPathFragments)(path, name);
|
|
27
|
-
const fileName = options.type
|
|
28
|
-
? `${name}.${(0, devkit_1.names)(options.type).fileName}`
|
|
29
|
-
: name;
|
|
30
|
-
const filePath = (0, devkit_1.joinPathFragments)(directory, `${fileName}.ts`);
|
|
31
|
-
return {
|
|
32
|
-
directory,
|
|
33
|
-
fileName,
|
|
34
|
-
filePath,
|
|
35
|
-
name,
|
|
36
|
-
path,
|
|
37
|
-
root,
|
|
38
|
-
sourceRoot,
|
|
39
|
-
};
|
|
40
|
-
}
|
|
41
|
-
exports.normalizeNameAndPaths = normalizeNameAndPaths;
|
|
@@ -1,5 +1,3 @@
|
|
|
1
1
|
import type { Tree } from '@nx/devkit';
|
|
2
|
-
export declare function normalizeDirectory(appName: string, directoryName: string): string;
|
|
3
|
-
export declare function normalizeProjectName(appName: string, directoryName: string): string;
|
|
4
2
|
export declare function normalizeNewProjectPrefix(prefix: string | undefined, npmScope: string | undefined, fallbackPrefix: string): string;
|
|
5
3
|
export declare function getProjectPrefix(tree: Tree, project: string): string | undefined;
|
|
@@ -1,18 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getProjectPrefix = exports.normalizeNewProjectPrefix =
|
|
3
|
+
exports.getProjectPrefix = exports.normalizeNewProjectPrefix = void 0;
|
|
4
4
|
const devkit_1 = require("@nx/devkit");
|
|
5
5
|
const get_npm_scope_1 = require("@nx/js/src/utils/package-json/get-npm-scope");
|
|
6
|
-
function normalizeDirectory(appName, directoryName) {
|
|
7
|
-
return directoryName
|
|
8
|
-
? `${(0, devkit_1.names)(directoryName).fileName}/${(0, devkit_1.names)(appName).fileName}`
|
|
9
|
-
: (0, devkit_1.names)(appName).fileName;
|
|
10
|
-
}
|
|
11
|
-
exports.normalizeDirectory = normalizeDirectory;
|
|
12
|
-
function normalizeProjectName(appName, directoryName) {
|
|
13
|
-
return normalizeDirectory(appName, directoryName).replace(/\//g, '-');
|
|
14
|
-
}
|
|
15
|
-
exports.normalizeProjectName = normalizeProjectName;
|
|
16
6
|
function normalizeNewProjectPrefix(prefix, npmScope, fallbackPrefix) {
|
|
17
7
|
// Prefix needs to be a valid html selector, if npmScope it's not valid, we don't default
|
|
18
8
|
// to it and let it fall through to the Angular schematic to handle it
|
|
@@ -1,4 +1,3 @@
|
|
|
1
1
|
import type { Tree } from '@nx/devkit';
|
|
2
2
|
export declare function validateProject(tree: Tree, projectName: string): void;
|
|
3
3
|
export declare function validateStandaloneOption(tree: Tree, standalone: boolean | undefined, angularVersion?: string): void;
|
|
4
|
-
export declare function validatePathIsUnderProjectRoot(tree: Tree, projectName: string, path: string): void;
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.validateStandaloneOption = exports.validateProject = void 0;
|
|
4
4
|
const devkit_1 = require("@nx/devkit");
|
|
5
5
|
const semver_1 = require("semver");
|
|
6
|
-
const path_1 = require("./path");
|
|
7
6
|
const version_utils_1 = require("./version-utils");
|
|
8
7
|
function validateProject(tree, projectName) {
|
|
9
8
|
const projects = (0, devkit_1.getProjects)(tree);
|
|
@@ -23,18 +22,3 @@ function validateStandaloneOption(tree, standalone, angularVersion) {
|
|
|
23
22
|
}
|
|
24
23
|
}
|
|
25
24
|
exports.validateStandaloneOption = validateStandaloneOption;
|
|
26
|
-
function validatePathIsUnderProjectRoot(tree, projectName, path) {
|
|
27
|
-
if (!path) {
|
|
28
|
-
return;
|
|
29
|
-
}
|
|
30
|
-
const { root } = (0, devkit_1.readProjectConfiguration)(tree, projectName);
|
|
31
|
-
let pathToComponent = (0, devkit_1.normalizePath)(path);
|
|
32
|
-
pathToComponent = pathToComponent.startsWith('/')
|
|
33
|
-
? pathToComponent.slice(1)
|
|
34
|
-
: pathToComponent;
|
|
35
|
-
if (!(0, path_1.pathStartsWith)(pathToComponent, root)) {
|
|
36
|
-
throw new Error(`The path provided (${path}) does not exist under the project root (${root}). ` +
|
|
37
|
-
`Please make sure to provide a path that exists under the project root.`);
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
exports.validatePathIsUnderProjectRoot = validatePathIsUnderProjectRoot;
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.validateOptions = void 0;
|
|
4
|
-
const validations_1 = require("../../utils/validations");
|
|
5
|
-
function validateOptions(tree, options) {
|
|
6
|
-
(0, validations_1.validateProject)(tree, options.project);
|
|
7
|
-
(0, validations_1.validatePathIsUnderProjectRoot)(tree, options.project, options.path);
|
|
8
|
-
}
|
|
9
|
-
exports.validateOptions = validateOptions;
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.validateOptions = void 0;
|
|
4
|
-
const validations_1 = require("../../utils/validations");
|
|
5
|
-
function validateOptions(tree, options) {
|
|
6
|
-
(0, validations_1.validateProject)(tree, options.project);
|
|
7
|
-
(0, validations_1.validatePathIsUnderProjectRoot)(tree, options.project, options.path);
|
|
8
|
-
}
|
|
9
|
-
exports.validateOptions = validateOptions;
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.validateOptions = void 0;
|
|
4
|
-
const validations_1 = require("../../utils/validations");
|
|
5
|
-
function validateOptions(tree, options) {
|
|
6
|
-
(0, validations_1.validateProject)(tree, options.project);
|
|
7
|
-
(0, validations_1.validatePathIsUnderProjectRoot)(tree, options.project, options.path);
|
|
8
|
-
}
|
|
9
|
-
exports.validateOptions = validateOptions;
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getNewProjectName = void 0;
|
|
4
|
-
const devkit_1 = require("@nx/devkit");
|
|
5
|
-
/**
|
|
6
|
-
* Joins path segments replacing slashes with dashes
|
|
7
|
-
*
|
|
8
|
-
* @param path
|
|
9
|
-
*/
|
|
10
|
-
function getNewProjectName(path) {
|
|
11
|
-
// strip leading '/' or './' or '../' and trailing '/' and replaces '/' with '-'
|
|
12
|
-
return (0, devkit_1.normalizePath)(path)
|
|
13
|
-
.replace(/(^\.{0,2}\/|\.{1,2}\/|\/$)/g, '')
|
|
14
|
-
.split('/')
|
|
15
|
-
.filter((x) => !!x)
|
|
16
|
-
.join('-');
|
|
17
|
-
}
|
|
18
|
-
exports.getNewProjectName = getNewProjectName;
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.parseNameWithPath = void 0;
|
|
4
|
-
const devkit_1 = require("@nx/devkit");
|
|
5
|
-
function parseNameWithPath(rawName) {
|
|
6
|
-
const parsedName = (0, devkit_1.normalizePath)(rawName).split('/');
|
|
7
|
-
const name = parsedName.pop();
|
|
8
|
-
const path = parsedName.join('/');
|
|
9
|
-
return { name, path };
|
|
10
|
-
}
|
|
11
|
-
exports.parseNameWithPath = parseNameWithPath;
|