@angular/cli 18.1.0-rc.0 → 18.1.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 +14 -14
- package/src/command-builder/architect-command-module.d.ts +3 -0
- package/src/command-builder/architect-command-module.js +18 -1
- package/src/commands/extract-i18n/cli.d.ts +2 -0
- package/src/commands/extract-i18n/cli.js +30 -0
- package/src/commands/update/schematic/index.js +6 -4
- package/src/utilities/version.js +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@angular/cli",
|
|
3
|
-
"version": "18.1.0
|
|
3
|
+
"version": "18.1.0",
|
|
4
4
|
"description": "CLI tool for Angular",
|
|
5
5
|
"main": "lib/cli/index.js",
|
|
6
6
|
"bin": {
|
|
@@ -25,12 +25,12 @@
|
|
|
25
25
|
},
|
|
26
26
|
"homepage": "https://github.com/angular/angular-cli",
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@angular-devkit/architect": "0.1801.0
|
|
29
|
-
"@angular-devkit/core": "18.1.0
|
|
30
|
-
"@angular-devkit/schematics": "18.1.0
|
|
31
|
-
"@inquirer/prompts": "5.0.
|
|
28
|
+
"@angular-devkit/architect": "0.1801.0",
|
|
29
|
+
"@angular-devkit/core": "18.1.0",
|
|
30
|
+
"@angular-devkit/schematics": "18.1.0",
|
|
31
|
+
"@inquirer/prompts": "5.0.7",
|
|
32
32
|
"@listr2/prompt-adapter-inquirer": "2.0.13",
|
|
33
|
-
"@schematics/angular": "18.1.0
|
|
33
|
+
"@schematics/angular": "18.1.0",
|
|
34
34
|
"@yarnpkg/lockfile": "1.1.0",
|
|
35
35
|
"ini": "4.1.3",
|
|
36
36
|
"jsonc-parser": "3.3.1",
|
|
@@ -46,14 +46,14 @@
|
|
|
46
46
|
"ng-update": {
|
|
47
47
|
"migrations": "@schematics/angular/migrations/migration-collection.json",
|
|
48
48
|
"packageGroup": {
|
|
49
|
-
"@angular/cli": "18.1.0
|
|
50
|
-
"@angular/build": "18.1.0
|
|
51
|
-
"@angular/ssr": "18.1.0
|
|
52
|
-
"@angular-devkit/architect": "0.1801.0
|
|
53
|
-
"@angular-devkit/build-angular": "18.1.0
|
|
54
|
-
"@angular-devkit/build-webpack": "0.1801.0
|
|
55
|
-
"@angular-devkit/core": "18.1.0
|
|
56
|
-
"@angular-devkit/schematics": "18.1.0
|
|
49
|
+
"@angular/cli": "18.1.0",
|
|
50
|
+
"@angular/build": "18.1.0",
|
|
51
|
+
"@angular/ssr": "18.1.0",
|
|
52
|
+
"@angular-devkit/architect": "0.1801.0",
|
|
53
|
+
"@angular-devkit/build-angular": "18.1.0",
|
|
54
|
+
"@angular-devkit/build-webpack": "0.1801.0",
|
|
55
|
+
"@angular-devkit/core": "18.1.0",
|
|
56
|
+
"@angular-devkit/schematics": "18.1.0"
|
|
57
57
|
}
|
|
58
58
|
},
|
|
59
59
|
"packageManager": "yarn@4.3.0",
|
|
@@ -5,6 +5,8 @@
|
|
|
5
5
|
* Use of this source code is governed by an MIT-style license that can be
|
|
6
6
|
* found in the LICENSE file at https://angular.dev/license
|
|
7
7
|
*/
|
|
8
|
+
import { Target } from '@angular-devkit/architect';
|
|
9
|
+
import { workspaces } from '@angular-devkit/core';
|
|
8
10
|
import { Argv } from 'yargs';
|
|
9
11
|
import { ArchitectBaseCommandModule } from './architect-base-command-module';
|
|
10
12
|
import { CommandModuleImplementation, Options, OtherOptions } from './command-module';
|
|
@@ -14,6 +16,7 @@ export interface ArchitectCommandArgs {
|
|
|
14
16
|
}
|
|
15
17
|
export declare abstract class ArchitectCommandModule extends ArchitectBaseCommandModule<ArchitectCommandArgs> implements CommandModuleImplementation<ArchitectCommandArgs> {
|
|
16
18
|
abstract readonly multiTarget: boolean;
|
|
19
|
+
findDefaultBuilderName?(project: workspaces.ProjectDefinition, target: Target): Promise<string | undefined>;
|
|
17
20
|
builder(argv: Argv): Promise<Argv<ArchitectCommandArgs>>;
|
|
18
21
|
run(options: Options<ArchitectCommandArgs> & OtherOptions): Promise<number | void>;
|
|
19
22
|
private getArchitectProject;
|
|
@@ -58,6 +58,24 @@ let ArchitectCommandModule = (() => {
|
|
|
58
58
|
if (_metadata) Object.defineProperty(this, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
59
59
|
}
|
|
60
60
|
async builder(argv) {
|
|
61
|
+
const target = this.getArchitectTarget();
|
|
62
|
+
// Add default builder if target is not in project and a command default is provided
|
|
63
|
+
if (this.findDefaultBuilderName && this.context.workspace) {
|
|
64
|
+
for (const [project, projectDefinition] of this.context.workspace.projects) {
|
|
65
|
+
if (projectDefinition.targets.has(target)) {
|
|
66
|
+
continue;
|
|
67
|
+
}
|
|
68
|
+
const defaultBuilder = await this.findDefaultBuilderName(projectDefinition, {
|
|
69
|
+
project,
|
|
70
|
+
target,
|
|
71
|
+
});
|
|
72
|
+
if (defaultBuilder) {
|
|
73
|
+
projectDefinition.targets.set(target, {
|
|
74
|
+
builder: defaultBuilder,
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
}
|
|
61
79
|
const project = this.getArchitectProject();
|
|
62
80
|
const { jsonHelp, getYargsCompletions, help } = this.context.args.options;
|
|
63
81
|
const localYargs = argv
|
|
@@ -84,7 +102,6 @@ let ArchitectCommandModule = (() => {
|
|
|
84
102
|
if (!project) {
|
|
85
103
|
return localYargs;
|
|
86
104
|
}
|
|
87
|
-
const target = this.getArchitectTarget();
|
|
88
105
|
const schemaOptions = await this.getArchitectTargetOptions({
|
|
89
106
|
project,
|
|
90
107
|
target,
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
* Use of this source code is governed by an MIT-style license that can be
|
|
6
6
|
* found in the LICENSE file at https://angular.dev/license
|
|
7
7
|
*/
|
|
8
|
+
import { workspaces } from '@angular-devkit/core';
|
|
8
9
|
import { ArchitectCommandModule } from '../../command-builder/architect-command-module';
|
|
9
10
|
import { CommandModuleImplementation } from '../../command-builder/command-module';
|
|
10
11
|
export default class ExtractI18nCommandModule extends ArchitectCommandModule implements CommandModuleImplementation {
|
|
@@ -12,4 +13,5 @@ export default class ExtractI18nCommandModule extends ArchitectCommandModule imp
|
|
|
12
13
|
command: string;
|
|
13
14
|
describe: string;
|
|
14
15
|
longDescriptionPath?: string | undefined;
|
|
16
|
+
findDefaultBuilderName(project: workspaces.ProjectDefinition): Promise<string | undefined>;
|
|
15
17
|
}
|
|
@@ -7,11 +7,41 @@
|
|
|
7
7
|
* found in the LICENSE file at https://angular.dev/license
|
|
8
8
|
*/
|
|
9
9
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
const node_module_1 = require("node:module");
|
|
11
|
+
const node_path_1 = require("node:path");
|
|
10
12
|
const architect_command_module_1 = require("../../command-builder/architect-command-module");
|
|
11
13
|
class ExtractI18nCommandModule extends architect_command_module_1.ArchitectCommandModule {
|
|
12
14
|
multiTarget = false;
|
|
13
15
|
command = 'extract-i18n [project]';
|
|
14
16
|
describe = 'Extracts i18n messages from source code.';
|
|
15
17
|
longDescriptionPath;
|
|
18
|
+
async findDefaultBuilderName(project) {
|
|
19
|
+
// Only application type projects have a default i18n extraction target
|
|
20
|
+
if (project.extensions['projectType'] !== 'application') {
|
|
21
|
+
return;
|
|
22
|
+
}
|
|
23
|
+
const buildTarget = project.targets.get('build');
|
|
24
|
+
if (!buildTarget) {
|
|
25
|
+
// No default if there is no build target
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
// Provide a default based on the defined builder for the 'build' target
|
|
29
|
+
switch (buildTarget.builder) {
|
|
30
|
+
case '@angular-devkit/build-angular:application':
|
|
31
|
+
case '@angular-devkit/build-angular:browser-esbuild':
|
|
32
|
+
case '@angular-devkit/build-angular:browser':
|
|
33
|
+
return '@angular-devkit/build-angular:extract-i18n';
|
|
34
|
+
case '@angular/build:application':
|
|
35
|
+
return '@angular/build:extract-i18n';
|
|
36
|
+
}
|
|
37
|
+
// For other builders, check for `@angular-devkit/build-angular` and use if found.
|
|
38
|
+
// This package is safer to use since it supports both application builder types.
|
|
39
|
+
try {
|
|
40
|
+
const projectRequire = (0, node_module_1.createRequire)((0, node_path_1.join)(this.context.root, project.root) + '/');
|
|
41
|
+
projectRequire.resolve('@angular-devkit/build-angular');
|
|
42
|
+
return '@angular-devkit/build-angular:extract-i18n';
|
|
43
|
+
}
|
|
44
|
+
catch { }
|
|
45
|
+
}
|
|
16
46
|
}
|
|
17
47
|
exports.default = ExtractI18nCommandModule;
|
|
@@ -191,7 +191,7 @@ function _validateUpdatePackages(infoMap, force, next, logger) {
|
|
|
191
191
|
}
|
|
192
192
|
}
|
|
193
193
|
function _performUpdate(tree, context, infoMap, logger, migrateOnly) {
|
|
194
|
-
const packageJsonContent = tree.read('/package.json');
|
|
194
|
+
const packageJsonContent = tree.read('/package.json')?.toString();
|
|
195
195
|
if (!packageJsonContent) {
|
|
196
196
|
throw new schematics_1.SchematicsException('Could not find a package.json. Are you in a Node project?');
|
|
197
197
|
}
|
|
@@ -232,10 +232,12 @@ function _performUpdate(tree, context, infoMap, logger, migrateOnly) {
|
|
|
232
232
|
logger.warn(`Package ${name} was not found in dependencies.`);
|
|
233
233
|
}
|
|
234
234
|
});
|
|
235
|
-
const
|
|
236
|
-
|
|
235
|
+
const eofMatches = packageJsonContent.match(/\r?\n$/);
|
|
236
|
+
const eof = eofMatches?.[0] ?? '';
|
|
237
|
+
const newContent = JSON.stringify(packageJson, null, 2) + eof;
|
|
238
|
+
if (packageJsonContent != newContent || migrateOnly) {
|
|
237
239
|
if (!migrateOnly) {
|
|
238
|
-
tree.overwrite('/package.json',
|
|
240
|
+
tree.overwrite('/package.json', newContent);
|
|
239
241
|
}
|
|
240
242
|
const externalMigrations = [];
|
|
241
243
|
// Run the migrate schematics with the list of packages to use. The collection contains
|
package/src/utilities/version.js
CHANGED
|
@@ -25,5 +25,5 @@ class Version {
|
|
|
25
25
|
}
|
|
26
26
|
}
|
|
27
27
|
// TODO(bazel): Convert this to use build-time version stamping after flipping the build script to use bazel
|
|
28
|
-
// export const VERSION = new Version('18.1.0
|
|
28
|
+
// export const VERSION = new Version('18.1.0');
|
|
29
29
|
exports.VERSION = new Version(JSON.parse((0, fs_1.readFileSync)((0, path_1.resolve)(__dirname, '../../package.json'), 'utf-8')).version);
|