Skip to content

Commit 8ca342f

Browse files
author
Angular Builds
committed
322f6ec refactor(@schematics/angular): use generateFromFiles helper in more cases
1 parent a0be17f commit 8ca342f

14 files changed

+12
-22
lines changed

Diff for: class/index.js

-1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,5 @@ Object.defineProperty(exports, "__esModule", { value: true });
1010
exports.default = default_1;
1111
const generate_from_files_1 = require("../utility/generate-from-files");
1212
function default_1(options) {
13-
options.type = options.type ? `.${options.type}` : '';
1413
return (0, generate_from_files_1.generateFromFiles)(options);
1514
}

Diff for: directive/index.js

-2
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,6 @@ function default_1(options) {
3636
options.path = (0, workspace_1.buildDefaultPath)(project);
3737
}
3838
options.module = (0, find_module_1.findModuleFromOptions)(host, options);
39-
// Schematic templates require a defined type value
40-
options.type ??= '';
4139
const parsedPath = (0, parse_name_1.parseName)(options.path, options.name);
4240
options.name = parsedPath.name;
4341
options.path = parsedPath.path;

Diff for: interface/index.js

-1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,5 @@ Object.defineProperty(exports, "__esModule", { value: true });
1010
exports.default = default_1;
1111
const generate_from_files_1 = require("../utility/generate-from-files");
1212
function default_1(options) {
13-
options.type = options.type ? `.${options.type}` : '';
1413
return (0, generate_from_files_1.generateFromFiles)(options);
1514
}

Diff for: package.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@schematics/angular",
3-
"version": "20.0.0-next.4+sha-bfdd8d5",
3+
"version": "20.0.0-next.4+sha-322f6ec",
44
"description": "Schematics specific to Angular",
55
"homepage": "https://github.com/angular/angular-cli",
66
"keywords": [
@@ -22,8 +22,8 @@
2222
},
2323
"schematics": "./collection.json",
2424
"dependencies": {
25-
"@angular-devkit/core": "github:angular/angular-devkit-core-builds#bfdd8d5",
26-
"@angular-devkit/schematics": "github:angular/angular-devkit-schematics-builds#bfdd8d5",
25+
"@angular-devkit/core": "github:angular/angular-devkit-core-builds#322f6ec",
26+
"@angular-devkit/schematics": "github:angular/angular-devkit-schematics-builds#322f6ec",
2727
"jsonc-parser": "3.3.1"
2828
},
2929
"repository": {

Diff for: service/index.js

+1-8
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,5 @@ Object.defineProperty(exports, "__esModule", { value: true });
1010
exports.default = default_1;
1111
const generate_from_files_1 = require("../utility/generate-from-files");
1212
function default_1(options) {
13-
// This schematic uses an older method to implement the flat option
14-
const flat = options.flat;
15-
options.flat = true;
16-
// Schematic templates require a defined type value
17-
options.type ??= '';
18-
return (0, generate_from_files_1.generateFromFiles)(options, {
19-
'if-flat': (s) => (flat ? '' : s),
20-
});
13+
return (0, generate_from_files_1.generateFromFiles)(options);
2114
}

Diff for: uniqueId

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
Thu Apr 03 2025 08:19:46 GMT+0000 (Coordinated Universal Time)
1+
Thu Apr 03 2025 10:53:07 GMT+0000 (Coordinated Universal Time)

Diff for: utility/add-declaration-to-ng-module.js

+2-3
Original file line numberDiff line numberDiff line change
@@ -57,10 +57,9 @@ function addDeclarationToNgModule(options) {
5757
const filePath = `/${options.path}/` +
5858
(options.flat ? '' : schematics_1.strings.dasherize(options.name) + '/') +
5959
schematics_1.strings.dasherize(options.name) +
60-
(options.type ? '.' : '') +
61-
schematics_1.strings.dasherize(options.type);
60+
(options.type ? '.' + schematics_1.strings.dasherize(options.type) : '');
6261
const importPath = (0, find_module_1.buildRelativePath)(modulePath, filePath);
63-
const classifiedName = schematics_1.strings.classify(options.name) + schematics_1.strings.classify(options.type);
62+
const classifiedName = schematics_1.strings.classify(options.name) + (options.type ? schematics_1.strings.classify(options.type) : '');
6463
const changes = (0, ast_utils_1.addDeclarationToModule)(source, modulePath, classifiedName, importPath);
6564
if (options.export) {
6665
changes.push(...(0, ast_utils_1.addSymbolToNgModuleMetadata)(source, modulePath, 'exports', classifiedName));

Diff for: utility/generate-from-files.js

+2
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ function generateFromFiles(options, extraTemplateValues = {}) {
1717
options.path ??= await (0, workspace_1.createDefaultPath)(host, options.project);
1818
options.prefix ??= '';
1919
options.flat ??= true;
20+
// Schematic templates require a defined type value
21+
options.type ??= '';
2022
const parsedPath = (0, parse_name_1.parseName)(options.path, options.name);
2123
options.name = parsedPath.name;
2224
options.path = parsedPath.path;

Diff for: utility/latest-versions.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ exports.latestVersions = {
1616
// As Angular CLI works with same minor versions of Angular Framework, a tilde match for the current
1717
Angular: '^20.0.0-next.0',
1818
NgPackagr: '^20.0.0-next.0',
19-
DevkitBuildAngular: '^20.0.0-next.4+sha-bfdd8d5',
20-
AngularBuild: '^20.0.0-next.4+sha-bfdd8d5',
21-
AngularSSR: '^20.0.0-next.4+sha-bfdd8d5',
19+
DevkitBuildAngular: '^20.0.0-next.4+sha-322f6ec',
20+
AngularBuild: '^20.0.0-next.4+sha-322f6ec',
21+
AngularSSR: '^20.0.0-next.4+sha-322f6ec',
2222
};

0 commit comments

Comments
 (0)