Deployed the page to Github Pages.
This commit is contained in:
parent
1d79754e93
commit
2c89899458
62797 changed files with 6551425 additions and 15279 deletions
21
node_modules/@angular/cli/LICENSE
generated
vendored
Executable file
21
node_modules/@angular/cli/LICENSE
generated
vendored
Executable file
|
|
@ -0,0 +1,21 @@
|
|||
The MIT License
|
||||
|
||||
Copyright (c) 2010-2024 Google LLC. https://angular.dev/license
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
5
node_modules/@angular/cli/README.md
generated
vendored
Executable file
5
node_modules/@angular/cli/README.md
generated
vendored
Executable file
|
|
@ -0,0 +1,5 @@
|
|||
# Angular CLI - The CLI tool for Angular.
|
||||
|
||||
The sources for this package are in the [Angular CLI](https://github.com/angular/angular-cli) repository. Please file issues and pull requests against that repository.
|
||||
|
||||
Usage information and reference details can be found in repository [README](../../../README.md) file.
|
||||
21
node_modules/@angular/cli/bin/bootstrap.js
generated
vendored
Executable file
21
node_modules/@angular/cli/bin/bootstrap.js
generated
vendored
Executable file
|
|
@ -0,0 +1,21 @@
|
|||
/**
|
||||
* @license
|
||||
* Copyright Google LLC All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by an MIT-style license that can be
|
||||
* found in the LICENSE file at https://angular.dev/license
|
||||
*/
|
||||
|
||||
/**
|
||||
* @fileoverview
|
||||
*
|
||||
* This file is used to bootstrap the CLI process by dynamically importing the main initialization code.
|
||||
* This is done to allow the main bin file (`ng`) to remain CommonJS so that older versions of Node.js
|
||||
* can be checked and validated prior to the execution of the CLI. This separate bootstrap file is
|
||||
* needed to allow the use of a dynamic import expression without crashing older versions of Node.js that
|
||||
* do not support dynamic import expressions and would otherwise throw a syntax error. This bootstrap file
|
||||
* is required from the main bin file only after the Node.js version is determined to be in the supported
|
||||
* range.
|
||||
*/
|
||||
|
||||
import('../lib/init.js');
|
||||
71
node_modules/@angular/cli/bin/ng.js
generated
vendored
Executable file
71
node_modules/@angular/cli/bin/ng.js
generated
vendored
Executable file
|
|
@ -0,0 +1,71 @@
|
|||
#!/usr/bin/env node
|
||||
/**
|
||||
* @license
|
||||
* Copyright Google LLC All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by an MIT-style license that can be
|
||||
* found in the LICENSE file at https://angular.dev/license
|
||||
*/
|
||||
|
||||
/* eslint-disable no-console */
|
||||
/* eslint-disable import/no-unassigned-import */
|
||||
'use strict';
|
||||
|
||||
const path = require('path');
|
||||
|
||||
// Error if the external CLI appears to be used inside a google3 context.
|
||||
if (process.cwd().split(path.sep).includes('google3')) {
|
||||
console.error(
|
||||
'This is the external Angular CLI, but you appear to be running in google3. There is a separate, internal version of the CLI which should be used instead. See http://go/angular/cli.',
|
||||
);
|
||||
process.exit();
|
||||
}
|
||||
|
||||
// Provide a title to the process in `ps`.
|
||||
// Due to an obscure Mac bug, do not start this title with any symbol.
|
||||
try {
|
||||
process.title = 'ng ' + Array.from(process.argv).slice(2).join(' ');
|
||||
} catch (_) {
|
||||
// If an error happened above, use the most basic title.
|
||||
process.title = 'ng';
|
||||
}
|
||||
|
||||
const rawCommandName = process.argv[2];
|
||||
|
||||
if (rawCommandName === '--get-yargs-completions' || rawCommandName === 'completion') {
|
||||
// Skip Node.js supported checks when running ng completion.
|
||||
// A warning at this stage could cause a broken source action (`source <(ng completion script)`) when in the shell init script.
|
||||
require('./bootstrap');
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
// This node version check ensures that extremely old versions of node are not used.
|
||||
// These may not support ES2015 features such as const/let/async/await/etc.
|
||||
// These would then crash with a hard to diagnose error message.
|
||||
var version = process.versions.node.split('.').map((part) => Number(part));
|
||||
if (version[0] % 2 === 1) {
|
||||
// Allow new odd numbered releases with a warning (currently v17+)
|
||||
console.warn(
|
||||
'Node.js version ' +
|
||||
process.version +
|
||||
' detected.\n' +
|
||||
'Odd numbered Node.js versions will not enter LTS status and should not be used for production.' +
|
||||
' For more information, please see https://nodejs.org/en/about/previous-releases/.',
|
||||
);
|
||||
|
||||
require('./bootstrap');
|
||||
} else if (version[0] < 18 || (version[0] === 18 && version[1] < 19)) {
|
||||
// Error and exit if less than 18.19
|
||||
console.error(
|
||||
'Node.js version ' +
|
||||
process.version +
|
||||
' detected.\n' +
|
||||
'The Angular CLI requires a minimum Node.js version of v18.19.\n\n' +
|
||||
'Please update your Node.js version or visit https://nodejs.org/ for additional instructions.\n',
|
||||
);
|
||||
|
||||
process.exitCode = 3;
|
||||
} else {
|
||||
require('./bootstrap');
|
||||
}
|
||||
3
node_modules/@angular/cli/bin/package.json
generated
vendored
Executable file
3
node_modules/@angular/cli/bin/package.json
generated
vendored
Executable file
|
|
@ -0,0 +1,3 @@
|
|||
{
|
||||
"type": "commonjs"
|
||||
}
|
||||
11
node_modules/@angular/cli/lib/cli/index.d.ts
generated
vendored
Executable file
11
node_modules/@angular/cli/lib/cli/index.d.ts
generated
vendored
Executable file
|
|
@ -0,0 +1,11 @@
|
|||
/**
|
||||
* @license
|
||||
* Copyright Google LLC All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by an MIT-style license that can be
|
||||
* found in the LICENSE file at https://angular.dev/license
|
||||
*/
|
||||
export { VERSION } from '../../src/utilities/version';
|
||||
export default function (options: {
|
||||
cliArgs: string[];
|
||||
}): Promise<number>;
|
||||
108
node_modules/@angular/cli/lib/cli/index.js
generated
vendored
Executable file
108
node_modules/@angular/cli/lib/cli/index.js
generated
vendored
Executable file
|
|
@ -0,0 +1,108 @@
|
|||
"use strict";
|
||||
/**
|
||||
* @license
|
||||
* Copyright Google LLC All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by an MIT-style license that can be
|
||||
* found in the LICENSE file at https://angular.dev/license
|
||||
*/
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.VERSION = void 0;
|
||||
exports.default = default_1;
|
||||
const core_1 = require("@angular-devkit/core");
|
||||
const node_util_1 = require("node:util");
|
||||
const command_module_1 = require("../../src/command-builder/command-module");
|
||||
const command_runner_1 = require("../../src/command-builder/command-runner");
|
||||
const color_1 = require("../../src/utilities/color");
|
||||
const environment_options_1 = require("../../src/utilities/environment-options");
|
||||
const log_file_1 = require("../../src/utilities/log-file");
|
||||
var version_1 = require("../../src/utilities/version");
|
||||
Object.defineProperty(exports, "VERSION", { enumerable: true, get: function () { return version_1.VERSION; } });
|
||||
const MIN_NODEJS_VERSION = [18, 13];
|
||||
/* eslint-disable no-console */
|
||||
async function default_1(options) {
|
||||
// This node version check ensures that the requirements of the project instance of the CLI are met
|
||||
const [major, minor] = process.versions.node.split('.').map((part) => Number(part));
|
||||
if (major < MIN_NODEJS_VERSION[0] ||
|
||||
(major === MIN_NODEJS_VERSION[0] && minor < MIN_NODEJS_VERSION[1])) {
|
||||
process.stderr.write(`Node.js version ${process.version} detected.\n` +
|
||||
`The Angular CLI requires a minimum of v${MIN_NODEJS_VERSION[0]}.${MIN_NODEJS_VERSION[1]}.\n\n` +
|
||||
'Please update your Node.js version or visit https://nodejs.org/ for additional instructions.\n');
|
||||
return 3;
|
||||
}
|
||||
const colorLevels = {
|
||||
info: (s) => s,
|
||||
debug: (s) => s,
|
||||
warn: (s) => color_1.colors.bold(color_1.colors.yellow(s)),
|
||||
error: (s) => color_1.colors.bold(color_1.colors.red(s)),
|
||||
fatal: (s) => color_1.colors.bold(color_1.colors.red(s)),
|
||||
};
|
||||
const logger = new core_1.logging.IndentLogger('cli-main-logger');
|
||||
const logInfo = console.log;
|
||||
const logError = console.error;
|
||||
const useColor = (0, color_1.supportColor)();
|
||||
const loggerFinished = logger.forEach((entry) => {
|
||||
if (!environment_options_1.ngDebug && entry.level === 'debug') {
|
||||
return;
|
||||
}
|
||||
const color = useColor ? colorLevels[entry.level] : node_util_1.stripVTControlCharacters;
|
||||
const message = color(entry.message);
|
||||
switch (entry.level) {
|
||||
case 'warn':
|
||||
case 'fatal':
|
||||
case 'error':
|
||||
logError(message);
|
||||
break;
|
||||
default:
|
||||
logInfo(message);
|
||||
break;
|
||||
}
|
||||
});
|
||||
// Redirect console to logger
|
||||
console.info = console.log = function (...args) {
|
||||
logger.info((0, node_util_1.format)(...args));
|
||||
};
|
||||
console.warn = function (...args) {
|
||||
logger.warn((0, node_util_1.format)(...args));
|
||||
};
|
||||
console.error = function (...args) {
|
||||
logger.error((0, node_util_1.format)(...args));
|
||||
};
|
||||
try {
|
||||
return await (0, command_runner_1.runCommand)(options.cliArgs, logger);
|
||||
}
|
||||
catch (err) {
|
||||
if (err instanceof command_module_1.CommandModuleError) {
|
||||
logger.fatal(`Error: ${err.message}`);
|
||||
}
|
||||
else if (err instanceof Error) {
|
||||
try {
|
||||
const logPath = (0, log_file_1.writeErrorToLogFile)(err);
|
||||
logger.fatal(`An unhandled exception occurred: ${err.message}\n` +
|
||||
`See "${logPath}" for further details.`);
|
||||
}
|
||||
catch (e) {
|
||||
logger.fatal(`An unhandled exception occurred: ${err.message}\n` +
|
||||
`Fatal error writing debug log file: ${e}`);
|
||||
if (err.stack) {
|
||||
logger.fatal(err.stack);
|
||||
}
|
||||
}
|
||||
return 127;
|
||||
}
|
||||
else if (typeof err === 'string') {
|
||||
logger.fatal(err);
|
||||
}
|
||||
else if (typeof err === 'number') {
|
||||
// Log nothing.
|
||||
}
|
||||
else {
|
||||
logger.fatal(`An unexpected error occurred: ${err}`);
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
finally {
|
||||
logger.complete();
|
||||
await loggerFinished;
|
||||
}
|
||||
}
|
||||
5114
node_modules/@angular/cli/lib/config/schema.json
generated
vendored
Executable file
5114
node_modules/@angular/cli/lib/config/schema.json
generated
vendored
Executable file
File diff suppressed because it is too large
Load diff
744
node_modules/@angular/cli/lib/config/workspace-schema.d.ts
generated
vendored
Executable file
744
node_modules/@angular/cli/lib/config/workspace-schema.d.ts
generated
vendored
Executable file
|
|
@ -0,0 +1,744 @@
|
|||
export interface Schema {
|
||||
$schema?: string;
|
||||
cli?: CliOptions;
|
||||
/**
|
||||
* Path where new projects will be created.
|
||||
*/
|
||||
newProjectRoot?: string;
|
||||
projects?: Projects;
|
||||
schematics?: SchematicOptions;
|
||||
version: number;
|
||||
}
|
||||
export interface CliOptions {
|
||||
/**
|
||||
* Share pseudonymous usage data with the Angular Team at Google.
|
||||
*/
|
||||
analytics?: Analytics;
|
||||
/**
|
||||
* Control disk cache.
|
||||
*/
|
||||
cache?: Cache;
|
||||
/**
|
||||
* Specify which package manager tool to use.
|
||||
*/
|
||||
packageManager?: PackageManager;
|
||||
/**
|
||||
* The list of schematic collections to use.
|
||||
*/
|
||||
schematicCollections?: string[];
|
||||
/**
|
||||
* Control CLI specific console warnings
|
||||
*/
|
||||
warnings?: Warnings;
|
||||
}
|
||||
/**
|
||||
* Share pseudonymous usage data with the Angular Team at Google.
|
||||
*/
|
||||
export type Analytics = boolean | string;
|
||||
/**
|
||||
* Control disk cache.
|
||||
*/
|
||||
export interface Cache {
|
||||
/**
|
||||
* Configure whether disk caching is enabled.
|
||||
*/
|
||||
enabled?: boolean;
|
||||
/**
|
||||
* Configure in which environment disk cache is enabled.
|
||||
*/
|
||||
environment?: Environment;
|
||||
/**
|
||||
* Cache base path.
|
||||
*/
|
||||
path?: string;
|
||||
}
|
||||
/**
|
||||
* Configure in which environment disk cache is enabled.
|
||||
*/
|
||||
export declare enum Environment {
|
||||
All = "all",
|
||||
Ci = "ci",
|
||||
Local = "local"
|
||||
}
|
||||
/**
|
||||
* Specify which package manager tool to use.
|
||||
*
|
||||
* The package manager used to install dependencies.
|
||||
*/
|
||||
export declare enum PackageManager {
|
||||
Bun = "bun",
|
||||
Cnpm = "cnpm",
|
||||
Npm = "npm",
|
||||
Pnpm = "pnpm",
|
||||
Yarn = "yarn"
|
||||
}
|
||||
/**
|
||||
* Control CLI specific console warnings
|
||||
*/
|
||||
export interface Warnings {
|
||||
/**
|
||||
* Show a warning when the global version is newer than the local one.
|
||||
*/
|
||||
versionMismatch?: boolean;
|
||||
}
|
||||
export interface Projects {
|
||||
}
|
||||
export interface SchematicOptions {
|
||||
"@schematics/angular:application"?: AngularApplicationOptionsSchema;
|
||||
"@schematics/angular:class"?: AngularClassOptionsSchema;
|
||||
"@schematics/angular:component"?: AngularComponentOptionsSchema;
|
||||
"@schematics/angular:directive"?: AngularDirectiveOptionsSchema;
|
||||
"@schematics/angular:enum"?: AngularEnumOptionsSchema;
|
||||
"@schematics/angular:guard"?: AngularGuardOptionsSchema;
|
||||
"@schematics/angular:interceptor"?: AngularInterceptorOptionsSchema;
|
||||
"@schematics/angular:interface"?: AngularInterfaceOptionsSchema;
|
||||
"@schematics/angular:library"?: LibraryOptionsSchema;
|
||||
"@schematics/angular:ng-new"?: AngularNgNewOptionsSchema;
|
||||
"@schematics/angular:pipe"?: AngularPipeOptionsSchema;
|
||||
"@schematics/angular:resolver"?: AngularResolverOptionsSchema;
|
||||
"@schematics/angular:service"?: AngularServiceOptionsSchema;
|
||||
"@schematics/angular:web-worker"?: AngularWebWorkerOptionsSchema;
|
||||
[property: string]: any;
|
||||
}
|
||||
/**
|
||||
* Generates a new basic application definition in the "projects" subfolder of the workspace.
|
||||
*/
|
||||
export interface AngularApplicationOptionsSchema {
|
||||
/**
|
||||
* Include styles inline in the root component.ts file. Only CSS styles can be included
|
||||
* inline. Default is false, meaning that an external styles file is created and referenced
|
||||
* in the root component.ts file.
|
||||
*/
|
||||
inlineStyle?: boolean;
|
||||
/**
|
||||
* Include template inline in the root component.ts file. Default is false, meaning that an
|
||||
* external template file is created and referenced in the root component.ts file.
|
||||
*/
|
||||
inlineTemplate?: boolean;
|
||||
/**
|
||||
* Create a bare-bones project without any testing frameworks. (Use for learning purposes
|
||||
* only.)
|
||||
*/
|
||||
minimal?: boolean;
|
||||
/**
|
||||
* The name of the new application.
|
||||
*/
|
||||
name: string;
|
||||
/**
|
||||
* A prefix to apply to generated selectors.
|
||||
*/
|
||||
prefix?: string;
|
||||
/**
|
||||
* The root directory of the new application.
|
||||
*/
|
||||
projectRoot?: string;
|
||||
/**
|
||||
* Creates an application with routing enabled.
|
||||
*/
|
||||
routing?: boolean;
|
||||
/**
|
||||
* Skip installing dependency packages.
|
||||
*/
|
||||
skipInstall?: boolean;
|
||||
/**
|
||||
* Do not add dependencies to the "package.json" file.
|
||||
*/
|
||||
skipPackageJson?: boolean;
|
||||
/**
|
||||
* Do not create "spec.ts" test files for the application.
|
||||
*/
|
||||
skipTests?: boolean;
|
||||
/**
|
||||
* Creates an application with Server-Side Rendering (SSR) and Static Site Generation
|
||||
* (SSG/Prerendering) enabled.
|
||||
*/
|
||||
ssr?: boolean;
|
||||
/**
|
||||
* Creates an application based upon the standalone API, without NgModules.
|
||||
*/
|
||||
standalone?: boolean;
|
||||
/**
|
||||
* Creates an application with stricter bundle budgets settings.
|
||||
*/
|
||||
strict?: boolean;
|
||||
/**
|
||||
* The file extension or preprocessor to use for style files.
|
||||
*/
|
||||
style?: SchematicsAngularApplicationStyle;
|
||||
/**
|
||||
* The view encapsulation strategy to use in the new application.
|
||||
*/
|
||||
viewEncapsulation?: ViewEncapsulation;
|
||||
}
|
||||
/**
|
||||
* The file extension or preprocessor to use for style files.
|
||||
*/
|
||||
export declare enum SchematicsAngularApplicationStyle {
|
||||
Css = "css",
|
||||
Less = "less",
|
||||
Sass = "sass",
|
||||
Scss = "scss"
|
||||
}
|
||||
/**
|
||||
* The view encapsulation strategy to use in the new application.
|
||||
*
|
||||
* The view encapsulation strategy to use in the new component.
|
||||
*
|
||||
* The view encapsulation strategy to use in the initial project.
|
||||
*/
|
||||
export declare enum ViewEncapsulation {
|
||||
Emulated = "Emulated",
|
||||
None = "None",
|
||||
ShadowDom = "ShadowDom"
|
||||
}
|
||||
/**
|
||||
* Creates a new, generic class definition in the given project.
|
||||
*/
|
||||
export interface AngularClassOptionsSchema {
|
||||
/**
|
||||
* The name of the new class.
|
||||
*/
|
||||
name: string;
|
||||
/**
|
||||
* The path at which to create the class, relative to the workspace root.
|
||||
*/
|
||||
path?: string;
|
||||
/**
|
||||
* The name of the project.
|
||||
*/
|
||||
project: string;
|
||||
/**
|
||||
* Do not create "spec.ts" test files for the new class.
|
||||
*/
|
||||
skipTests?: boolean;
|
||||
/**
|
||||
* Adds a developer-defined type to the filename, in the format "name.type.ts".
|
||||
*/
|
||||
type?: string;
|
||||
}
|
||||
/**
|
||||
* Creates a new, generic component definition in the given project.
|
||||
*/
|
||||
export interface AngularComponentOptionsSchema {
|
||||
/**
|
||||
* The change detection strategy to use in the new component.
|
||||
*/
|
||||
changeDetection?: ChangeDetection;
|
||||
/**
|
||||
* Specifies if the style will contain `:host { display: block; }`.
|
||||
*/
|
||||
displayBlock?: boolean;
|
||||
/**
|
||||
* The declaring NgModule exports this component.
|
||||
*/
|
||||
export?: boolean;
|
||||
/**
|
||||
* Create the new files at the top level of the current project.
|
||||
*/
|
||||
flat?: boolean;
|
||||
/**
|
||||
* Include styles inline in the component.ts file. Only CSS styles can be included inline.
|
||||
* By default, an external styles file is created and referenced in the component.ts file.
|
||||
*/
|
||||
inlineStyle?: boolean;
|
||||
/**
|
||||
* Include template inline in the component.ts file. By default, an external template file
|
||||
* is created and referenced in the component.ts file.
|
||||
*/
|
||||
inlineTemplate?: boolean;
|
||||
/**
|
||||
* The declaring NgModule.
|
||||
*/
|
||||
module?: string;
|
||||
/**
|
||||
* The name of the component.
|
||||
*/
|
||||
name: string;
|
||||
/**
|
||||
* The path at which to create the component file, relative to the current workspace.
|
||||
* Default is a folder with the same name as the component in the project root.
|
||||
*/
|
||||
path?: string;
|
||||
/**
|
||||
* The prefix to apply to the generated component selector.
|
||||
*/
|
||||
prefix?: string;
|
||||
/**
|
||||
* The name of the project.
|
||||
*/
|
||||
project: string;
|
||||
/**
|
||||
* The HTML selector to use for this component.
|
||||
*/
|
||||
selector?: string;
|
||||
/**
|
||||
* Do not import this component into the owning NgModule.
|
||||
*/
|
||||
skipImport?: boolean;
|
||||
/**
|
||||
* Specifies if the component should have a selector or not.
|
||||
*/
|
||||
skipSelector?: boolean;
|
||||
/**
|
||||
* Do not create "spec.ts" test files for the new component.
|
||||
*/
|
||||
skipTests?: boolean;
|
||||
/**
|
||||
* Whether the generated component is standalone.
|
||||
*/
|
||||
standalone?: boolean;
|
||||
/**
|
||||
* The file extension or preprocessor to use for style files, or 'none' to skip generating
|
||||
* the style file.
|
||||
*/
|
||||
style?: SchematicsAngularComponentStyle;
|
||||
/**
|
||||
* Adds a developer-defined type to the filename, in the format "name.type.ts".
|
||||
*/
|
||||
type?: string;
|
||||
/**
|
||||
* The view encapsulation strategy to use in the new component.
|
||||
*/
|
||||
viewEncapsulation?: ViewEncapsulation;
|
||||
}
|
||||
/**
|
||||
* The change detection strategy to use in the new component.
|
||||
*/
|
||||
export declare enum ChangeDetection {
|
||||
Default = "Default",
|
||||
OnPush = "OnPush"
|
||||
}
|
||||
/**
|
||||
* The file extension or preprocessor to use for style files, or 'none' to skip generating
|
||||
* the style file.
|
||||
*/
|
||||
export declare enum SchematicsAngularComponentStyle {
|
||||
Css = "css",
|
||||
Less = "less",
|
||||
None = "none",
|
||||
Sass = "sass",
|
||||
Scss = "scss"
|
||||
}
|
||||
/**
|
||||
* Creates a new, generic directive definition in the given project.
|
||||
*/
|
||||
export interface AngularDirectiveOptionsSchema {
|
||||
/**
|
||||
* The declaring NgModule exports this directive.
|
||||
*/
|
||||
export?: boolean;
|
||||
/**
|
||||
* When true (the default), creates the new files at the top level of the current project.
|
||||
*/
|
||||
flat?: boolean;
|
||||
/**
|
||||
* The declaring NgModule.
|
||||
*/
|
||||
module?: string;
|
||||
/**
|
||||
* The name of the new directive.
|
||||
*/
|
||||
name: string;
|
||||
/**
|
||||
* The path at which to create the interface that defines the directive, relative to the
|
||||
* workspace root.
|
||||
*/
|
||||
path?: string;
|
||||
/**
|
||||
* A prefix to apply to generated selectors.
|
||||
*/
|
||||
prefix?: string;
|
||||
/**
|
||||
* The name of the project.
|
||||
*/
|
||||
project: string;
|
||||
/**
|
||||
* The HTML selector to use for this directive.
|
||||
*/
|
||||
selector?: string;
|
||||
/**
|
||||
* Do not import this directive into the owning NgModule.
|
||||
*/
|
||||
skipImport?: boolean;
|
||||
/**
|
||||
* Do not create "spec.ts" test files for the new class.
|
||||
*/
|
||||
skipTests?: boolean;
|
||||
/**
|
||||
* Whether the generated directive is standalone.
|
||||
*/
|
||||
standalone?: boolean;
|
||||
}
|
||||
/**
|
||||
* Generates a new, generic enum definition in the given project.
|
||||
*/
|
||||
export interface AngularEnumOptionsSchema {
|
||||
/**
|
||||
* The name of the enum.
|
||||
*/
|
||||
name: string;
|
||||
/**
|
||||
* The path at which to create the enum definition, relative to the current workspace.
|
||||
*/
|
||||
path?: string;
|
||||
/**
|
||||
* The name of the project in which to create the enum. Default is the configured default
|
||||
* project for the workspace.
|
||||
*/
|
||||
project: string;
|
||||
/**
|
||||
* Adds a developer-defined type to the filename, in the format "name.type.ts".
|
||||
*/
|
||||
type?: string;
|
||||
}
|
||||
/**
|
||||
* Generates a new, generic route guard definition in the given project.
|
||||
*/
|
||||
export interface AngularGuardOptionsSchema {
|
||||
/**
|
||||
* When true (the default), creates the new files at the top level of the current project.
|
||||
*/
|
||||
flat?: boolean;
|
||||
/**
|
||||
* Specifies whether to generate a guard as a function.
|
||||
*/
|
||||
functional?: boolean;
|
||||
/**
|
||||
* Specifies which type of guard to create.
|
||||
*/
|
||||
implements?: Implement[];
|
||||
/**
|
||||
* The name of the new route guard.
|
||||
*/
|
||||
name: string;
|
||||
/**
|
||||
* The path at which to create the interface that defines the guard, relative to the current
|
||||
* workspace.
|
||||
*/
|
||||
path?: string;
|
||||
/**
|
||||
* The name of the project.
|
||||
*/
|
||||
project: string;
|
||||
/**
|
||||
* Do not create "spec.ts" test files for the new guard.
|
||||
*/
|
||||
skipTests?: boolean;
|
||||
}
|
||||
export declare enum Implement {
|
||||
CanActivate = "CanActivate",
|
||||
CanActivateChild = "CanActivateChild",
|
||||
CanDeactivate = "CanDeactivate",
|
||||
CanMatch = "CanMatch"
|
||||
}
|
||||
/**
|
||||
* Creates a new, generic interceptor definition in the given project.
|
||||
*/
|
||||
export interface AngularInterceptorOptionsSchema {
|
||||
/**
|
||||
* When true (the default), creates files at the top level of the project.
|
||||
*/
|
||||
flat?: boolean;
|
||||
/**
|
||||
* Creates the interceptor as a `HttpInterceptorFn`.
|
||||
*/
|
||||
functional?: boolean;
|
||||
/**
|
||||
* The name of the interceptor.
|
||||
*/
|
||||
name: string;
|
||||
/**
|
||||
* The path at which to create the interceptor, relative to the workspace root.
|
||||
*/
|
||||
path?: string;
|
||||
/**
|
||||
* The name of the project.
|
||||
*/
|
||||
project: string;
|
||||
/**
|
||||
* Do not create "spec.ts" test files for the new interceptor.
|
||||
*/
|
||||
skipTests?: boolean;
|
||||
}
|
||||
/**
|
||||
* Creates a new, generic interface definition in the given project.
|
||||
*/
|
||||
export interface AngularInterfaceOptionsSchema {
|
||||
/**
|
||||
* The name of the interface.
|
||||
*/
|
||||
name: string;
|
||||
/**
|
||||
* The path at which to create the interface, relative to the workspace root.
|
||||
*/
|
||||
path?: string;
|
||||
/**
|
||||
* A prefix to apply to generated selectors.
|
||||
*/
|
||||
prefix?: string;
|
||||
/**
|
||||
* The name of the project.
|
||||
*/
|
||||
project: string;
|
||||
/**
|
||||
* Adds a developer-defined type to the filename, in the format "name.type.ts".
|
||||
*/
|
||||
type?: string;
|
||||
}
|
||||
/**
|
||||
* Creates a new, generic library project in the current workspace.
|
||||
*/
|
||||
export interface LibraryOptionsSchema {
|
||||
/**
|
||||
* The path at which to create the library's public API file, relative to the workspace root.
|
||||
*/
|
||||
entryFile?: string;
|
||||
/**
|
||||
* The name of the library.
|
||||
*/
|
||||
name: string;
|
||||
/**
|
||||
* A prefix to apply to generated selectors.
|
||||
*/
|
||||
prefix?: string;
|
||||
/**
|
||||
* The root directory of the new library.
|
||||
*/
|
||||
projectRoot?: string;
|
||||
/**
|
||||
* Do not install dependency packages.
|
||||
*/
|
||||
skipInstall?: boolean;
|
||||
/**
|
||||
* Do not add dependencies to the "package.json" file.
|
||||
*/
|
||||
skipPackageJson?: boolean;
|
||||
/**
|
||||
* Do not update "tsconfig.json" to add a path mapping for the new library. The path mapping
|
||||
* is needed to use the library in an app, but can be disabled here to simplify development.
|
||||
*/
|
||||
skipTsConfig?: boolean;
|
||||
/**
|
||||
* Creates a library based upon the standalone API, without NgModules.
|
||||
*/
|
||||
standalone?: boolean;
|
||||
}
|
||||
/**
|
||||
* Creates a new project by combining the workspace and application schematics.
|
||||
*/
|
||||
export interface AngularNgNewOptionsSchema {
|
||||
/**
|
||||
* Initial git repository commit information.
|
||||
*/
|
||||
commit?: CommitUnion;
|
||||
/**
|
||||
* Create a new initial application project in the 'src' folder of the new workspace. When
|
||||
* false, creates an empty workspace with no initial application. You can then use the
|
||||
* generate application command so that all applications are created in the projects folder.
|
||||
*/
|
||||
createApplication?: boolean;
|
||||
/**
|
||||
* The directory name to create the workspace in.
|
||||
*/
|
||||
directory?: string;
|
||||
/**
|
||||
* Include styles inline in the component TS file. By default, an external styles file is
|
||||
* created and referenced in the component TypeScript file.
|
||||
*/
|
||||
inlineStyle?: boolean;
|
||||
/**
|
||||
* Include template inline in the component TS file. By default, an external template file
|
||||
* is created and referenced in the component TypeScript file.
|
||||
*/
|
||||
inlineTemplate?: boolean;
|
||||
/**
|
||||
* Create a workspace without any testing frameworks. (Use for learning purposes only.)
|
||||
*/
|
||||
minimal?: boolean;
|
||||
/**
|
||||
* The name of the new workspace and initial project.
|
||||
*/
|
||||
name: string;
|
||||
/**
|
||||
* The path where new projects will be created, relative to the new workspace root.
|
||||
*/
|
||||
newProjectRoot?: string;
|
||||
/**
|
||||
* The package manager used to install dependencies.
|
||||
*/
|
||||
packageManager?: PackageManager;
|
||||
/**
|
||||
* The prefix to apply to generated selectors for the initial project.
|
||||
*/
|
||||
prefix?: string;
|
||||
/**
|
||||
* Enable routing in the initial project.
|
||||
*/
|
||||
routing?: boolean;
|
||||
/**
|
||||
* Do not initialize a git repository.
|
||||
*/
|
||||
skipGit?: boolean;
|
||||
/**
|
||||
* Do not install dependency packages.
|
||||
*/
|
||||
skipInstall?: boolean;
|
||||
/**
|
||||
* Do not generate "spec.ts" test files for the new project.
|
||||
*/
|
||||
skipTests?: boolean;
|
||||
/**
|
||||
* Creates an application with Server-Side Rendering (SSR) and Static Site Generation
|
||||
* (SSG/Prerendering) enabled.
|
||||
*/
|
||||
ssr?: boolean;
|
||||
/**
|
||||
* Creates an application based upon the standalone API, without NgModules.
|
||||
*/
|
||||
standalone?: boolean;
|
||||
/**
|
||||
* Creates a workspace with stricter type checking and stricter bundle budgets settings.
|
||||
* This setting helps improve maintainability and catch bugs ahead of time. For more
|
||||
* information, see https://angular.dev/tools/cli/template-typecheck#strict-mode
|
||||
*/
|
||||
strict?: boolean;
|
||||
/**
|
||||
* The file extension or preprocessor to use for style files.
|
||||
*/
|
||||
style?: SchematicsAngularApplicationStyle;
|
||||
/**
|
||||
* The version of the Angular CLI to use.
|
||||
*/
|
||||
version: string;
|
||||
/**
|
||||
* The view encapsulation strategy to use in the initial project.
|
||||
*/
|
||||
viewEncapsulation?: ViewEncapsulation;
|
||||
}
|
||||
/**
|
||||
* Initial git repository commit information.
|
||||
*/
|
||||
export type CommitUnion = boolean | CommitObject;
|
||||
export interface CommitObject {
|
||||
email: string;
|
||||
message?: string;
|
||||
name: string;
|
||||
[property: string]: any;
|
||||
}
|
||||
/**
|
||||
* Creates a new, generic pipe definition in the given project.
|
||||
*/
|
||||
export interface AngularPipeOptionsSchema {
|
||||
/**
|
||||
* The declaring NgModule exports this pipe.
|
||||
*/
|
||||
export?: boolean;
|
||||
/**
|
||||
* When true (the default) creates files at the top level of the project.
|
||||
*/
|
||||
flat?: boolean;
|
||||
/**
|
||||
* The declaring NgModule.
|
||||
*/
|
||||
module?: string;
|
||||
/**
|
||||
* The name of the pipe.
|
||||
*/
|
||||
name: string;
|
||||
/**
|
||||
* The path at which to create the pipe, relative to the workspace root.
|
||||
*/
|
||||
path?: string;
|
||||
/**
|
||||
* The name of the project.
|
||||
*/
|
||||
project: string;
|
||||
/**
|
||||
* Do not import this pipe into the owning NgModule.
|
||||
*/
|
||||
skipImport?: boolean;
|
||||
/**
|
||||
* Do not create "spec.ts" test files for the new pipe.
|
||||
*/
|
||||
skipTests?: boolean;
|
||||
/**
|
||||
* Whether the generated pipe is standalone.
|
||||
*/
|
||||
standalone?: boolean;
|
||||
}
|
||||
/**
|
||||
* Generates a new, generic resolver definition in the given project.
|
||||
*/
|
||||
export interface AngularResolverOptionsSchema {
|
||||
/**
|
||||
* When true (the default), creates the new files at the top level of the current project.
|
||||
*/
|
||||
flat?: boolean;
|
||||
/**
|
||||
* Creates the resolver as a `ResolveFn`.
|
||||
*/
|
||||
functional?: boolean;
|
||||
/**
|
||||
* The name of the new resolver.
|
||||
*/
|
||||
name: string;
|
||||
/**
|
||||
* The path at which to create the interface that defines the resolver, relative to the
|
||||
* current workspace.
|
||||
*/
|
||||
path?: string;
|
||||
/**
|
||||
* The name of the project.
|
||||
*/
|
||||
project: string;
|
||||
/**
|
||||
* Do not create "spec.ts" test files for the new resolver.
|
||||
*/
|
||||
skipTests?: boolean;
|
||||
}
|
||||
/**
|
||||
* Creates a new, generic service definition in the given project.
|
||||
*/
|
||||
export interface AngularServiceOptionsSchema {
|
||||
/**
|
||||
* When true (the default), creates files at the top level of the project.
|
||||
*/
|
||||
flat?: boolean;
|
||||
/**
|
||||
* The name of the service.
|
||||
*/
|
||||
name: string;
|
||||
/**
|
||||
* The path at which to create the service, relative to the workspace root.
|
||||
*/
|
||||
path?: string;
|
||||
/**
|
||||
* The name of the project.
|
||||
*/
|
||||
project: string;
|
||||
/**
|
||||
* Do not create "spec.ts" test files for the new service.
|
||||
*/
|
||||
skipTests?: boolean;
|
||||
}
|
||||
/**
|
||||
* Creates a new, generic web worker definition in the given project.
|
||||
*/
|
||||
export interface AngularWebWorkerOptionsSchema {
|
||||
/**
|
||||
* The name of the worker.
|
||||
*/
|
||||
name: string;
|
||||
/**
|
||||
* The path at which to create the worker file, relative to the current workspace.
|
||||
*/
|
||||
path?: string;
|
||||
/**
|
||||
* The name of the project.
|
||||
*/
|
||||
project: string;
|
||||
/**
|
||||
* Add a worker creation snippet in a sibling file of the same name.
|
||||
*/
|
||||
snippet?: boolean;
|
||||
}
|
||||
77
node_modules/@angular/cli/lib/config/workspace-schema.js
generated
vendored
Executable file
77
node_modules/@angular/cli/lib/config/workspace-schema.js
generated
vendored
Executable file
|
|
@ -0,0 +1,77 @@
|
|||
"use strict";
|
||||
// THIS FILE IS AUTOMATICALLY GENERATED. TO UPDATE THIS FILE YOU NEED TO CHANGE THE
|
||||
// CORRESPONDING JSON SCHEMA FILE, THEN RUN devkit-admin build (or bazel build ...).
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.Implement = exports.SchematicsAngularComponentStyle = exports.ChangeDetection = exports.ViewEncapsulation = exports.SchematicsAngularApplicationStyle = exports.PackageManager = exports.Environment = void 0;
|
||||
/**
|
||||
* Configure in which environment disk cache is enabled.
|
||||
*/
|
||||
var Environment;
|
||||
(function (Environment) {
|
||||
Environment["All"] = "all";
|
||||
Environment["Ci"] = "ci";
|
||||
Environment["Local"] = "local";
|
||||
})(Environment || (exports.Environment = Environment = {}));
|
||||
/**
|
||||
* Specify which package manager tool to use.
|
||||
*
|
||||
* The package manager used to install dependencies.
|
||||
*/
|
||||
var PackageManager;
|
||||
(function (PackageManager) {
|
||||
PackageManager["Bun"] = "bun";
|
||||
PackageManager["Cnpm"] = "cnpm";
|
||||
PackageManager["Npm"] = "npm";
|
||||
PackageManager["Pnpm"] = "pnpm";
|
||||
PackageManager["Yarn"] = "yarn";
|
||||
})(PackageManager || (exports.PackageManager = PackageManager = {}));
|
||||
/**
|
||||
* The file extension or preprocessor to use for style files.
|
||||
*/
|
||||
var SchematicsAngularApplicationStyle;
|
||||
(function (SchematicsAngularApplicationStyle) {
|
||||
SchematicsAngularApplicationStyle["Css"] = "css";
|
||||
SchematicsAngularApplicationStyle["Less"] = "less";
|
||||
SchematicsAngularApplicationStyle["Sass"] = "sass";
|
||||
SchematicsAngularApplicationStyle["Scss"] = "scss";
|
||||
})(SchematicsAngularApplicationStyle || (exports.SchematicsAngularApplicationStyle = SchematicsAngularApplicationStyle = {}));
|
||||
/**
|
||||
* The view encapsulation strategy to use in the new application.
|
||||
*
|
||||
* The view encapsulation strategy to use in the new component.
|
||||
*
|
||||
* The view encapsulation strategy to use in the initial project.
|
||||
*/
|
||||
var ViewEncapsulation;
|
||||
(function (ViewEncapsulation) {
|
||||
ViewEncapsulation["Emulated"] = "Emulated";
|
||||
ViewEncapsulation["None"] = "None";
|
||||
ViewEncapsulation["ShadowDom"] = "ShadowDom";
|
||||
})(ViewEncapsulation || (exports.ViewEncapsulation = ViewEncapsulation = {}));
|
||||
/**
|
||||
* The change detection strategy to use in the new component.
|
||||
*/
|
||||
var ChangeDetection;
|
||||
(function (ChangeDetection) {
|
||||
ChangeDetection["Default"] = "Default";
|
||||
ChangeDetection["OnPush"] = "OnPush";
|
||||
})(ChangeDetection || (exports.ChangeDetection = ChangeDetection = {}));
|
||||
/**
|
||||
* The file extension or preprocessor to use for style files, or 'none' to skip generating
|
||||
* the style file.
|
||||
*/
|
||||
var SchematicsAngularComponentStyle;
|
||||
(function (SchematicsAngularComponentStyle) {
|
||||
SchematicsAngularComponentStyle["Css"] = "css";
|
||||
SchematicsAngularComponentStyle["Less"] = "less";
|
||||
SchematicsAngularComponentStyle["None"] = "none";
|
||||
SchematicsAngularComponentStyle["Sass"] = "sass";
|
||||
SchematicsAngularComponentStyle["Scss"] = "scss";
|
||||
})(SchematicsAngularComponentStyle || (exports.SchematicsAngularComponentStyle = SchematicsAngularComponentStyle = {}));
|
||||
var Implement;
|
||||
(function (Implement) {
|
||||
Implement["CanActivate"] = "CanActivate";
|
||||
Implement["CanActivateChild"] = "CanActivateChild";
|
||||
Implement["CanDeactivate"] = "CanDeactivate";
|
||||
Implement["CanMatch"] = "CanMatch";
|
||||
})(Implement || (exports.Implement = Implement = {}));
|
||||
8
node_modules/@angular/cli/lib/init.d.ts
generated
vendored
Executable file
8
node_modules/@angular/cli/lib/init.d.ts
generated
vendored
Executable file
|
|
@ -0,0 +1,8 @@
|
|||
/**
|
||||
* @license
|
||||
* Copyright Google LLC All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by an MIT-style license that can be
|
||||
* found in the LICENSE file at https://angular.dev/license
|
||||
*/
|
||||
import 'symbol-observable';
|
||||
153
node_modules/@angular/cli/lib/init.js
generated
vendored
Executable file
153
node_modules/@angular/cli/lib/init.js
generated
vendored
Executable file
|
|
@ -0,0 +1,153 @@
|
|||
"use strict";
|
||||
/**
|
||||
* @license
|
||||
* Copyright Google LLC All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by an MIT-style license that can be
|
||||
* found in the LICENSE file at https://angular.dev/license
|
||||
*/
|
||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
var desc = Object.getOwnPropertyDescriptor(m, k);
|
||||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
||||
desc = { enumerable: true, get: function() { return m[k]; } };
|
||||
}
|
||||
Object.defineProperty(o, k2, desc);
|
||||
}) : (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
o[k2] = m[k];
|
||||
}));
|
||||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
||||
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
||||
}) : function(o, v) {
|
||||
o["default"] = v;
|
||||
});
|
||||
var __importStar = (this && this.__importStar) || function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
||||
__setModuleDefault(result, mod);
|
||||
return result;
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
require("symbol-observable");
|
||||
// symbol polyfill must go first
|
||||
const fs_1 = require("fs");
|
||||
const module_1 = require("module");
|
||||
const path = __importStar(require("path"));
|
||||
const semver_1 = require("semver");
|
||||
const color_1 = require("../src/utilities/color");
|
||||
const config_1 = require("../src/utilities/config");
|
||||
const environment_options_1 = require("../src/utilities/environment-options");
|
||||
const version_1 = require("../src/utilities/version");
|
||||
/**
|
||||
* Angular CLI versions prior to v14 may not exit correctly if not forcibly exited
|
||||
* via `process.exit()`. When bootstrapping, `forceExit` will be set to `true`
|
||||
* if the local CLI version is less than v14 to prevent the CLI from hanging on
|
||||
* exit in those cases.
|
||||
*/
|
||||
let forceExit = false;
|
||||
(async () => {
|
||||
/**
|
||||
* Disable Browserslist old data warning as otherwise with every release we'd need to update this dependency
|
||||
* which is cumbersome considering we pin versions and the warning is not user actionable.
|
||||
* `Browserslist: caniuse-lite is outdated. Please run next command `npm update`
|
||||
* See: https://github.com/browserslist/browserslist/blob/819c4337456996d19db6ba953014579329e9c6e1/node.js#L324
|
||||
*/
|
||||
process.env.BROWSERSLIST_IGNORE_OLD_DATA = '1';
|
||||
const rawCommandName = process.argv[2];
|
||||
/**
|
||||
* Disable CLI version mismatch checks and forces usage of the invoked CLI
|
||||
* instead of invoking the local installed version.
|
||||
*
|
||||
* When running `ng new` always favor the global version. As in some
|
||||
* cases orphan `node_modules` would cause the non global CLI to be used.
|
||||
* @see: https://github.com/angular/angular-cli/issues/14603
|
||||
*/
|
||||
if (environment_options_1.disableVersionCheck || rawCommandName === 'new') {
|
||||
return (await Promise.resolve().then(() => __importStar(require('./cli')))).default;
|
||||
}
|
||||
let cli;
|
||||
try {
|
||||
// No error implies a projectLocalCli, which will load whatever
|
||||
// version of ng-cli you have installed in a local package.json
|
||||
const cwdRequire = (0, module_1.createRequire)(process.cwd() + '/');
|
||||
const projectLocalCli = cwdRequire.resolve('@angular/cli');
|
||||
cli = await Promise.resolve(`${projectLocalCli}`).then(s => __importStar(require(s)));
|
||||
const globalVersion = new semver_1.SemVer(version_1.VERSION.full);
|
||||
// Older versions might not have the VERSION export
|
||||
let localVersion = cli.VERSION?.full;
|
||||
if (!localVersion) {
|
||||
try {
|
||||
const localPackageJson = await fs_1.promises.readFile(path.join(path.dirname(projectLocalCli), '../../package.json'), 'utf-8');
|
||||
localVersion = JSON.parse(localPackageJson).version;
|
||||
}
|
||||
catch (error) {
|
||||
// eslint-disable-next-line no-console
|
||||
console.error('Version mismatch check skipped. Unable to retrieve local version: ' + error);
|
||||
}
|
||||
}
|
||||
// Ensure older versions of the CLI fully exit
|
||||
const localMajorVersion = (0, semver_1.major)(localVersion);
|
||||
if (localMajorVersion > 0 && localMajorVersion < 14) {
|
||||
forceExit = true;
|
||||
// Versions prior to 14 didn't implement completion command.
|
||||
if (rawCommandName === 'completion') {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
let isGlobalGreater = false;
|
||||
try {
|
||||
isGlobalGreater = localVersion > 0 && globalVersion.compare(localVersion) > 0;
|
||||
}
|
||||
catch (error) {
|
||||
// eslint-disable-next-line no-console
|
||||
console.error('Version mismatch check skipped. Unable to compare local version: ' + error);
|
||||
}
|
||||
// When using the completion command, don't show the warning as otherwise this will break completion.
|
||||
if (isGlobalGreater &&
|
||||
rawCommandName !== '--get-yargs-completions' &&
|
||||
rawCommandName !== 'completion') {
|
||||
// If using the update command and the global version is greater, use the newer update command
|
||||
// This allows improvements in update to be used in older versions that do not have bootstrapping
|
||||
if (rawCommandName === 'update' &&
|
||||
cli.VERSION &&
|
||||
cli.VERSION.major - globalVersion.major <= 1) {
|
||||
cli = await Promise.resolve().then(() => __importStar(require('./cli')));
|
||||
}
|
||||
else if (await (0, config_1.isWarningEnabled)('versionMismatch')) {
|
||||
// Otherwise, use local version and warn if global is newer than local
|
||||
const warning = `Your global Angular CLI version (${globalVersion}) is greater than your local ` +
|
||||
`version (${localVersion}). The local Angular CLI version is used.\n\n` +
|
||||
'To disable this warning use "ng config -g cli.warnings.versionMismatch false".';
|
||||
// eslint-disable-next-line no-console
|
||||
console.error(color_1.colors.yellow(warning));
|
||||
}
|
||||
}
|
||||
}
|
||||
catch {
|
||||
// If there is an error, resolve could not find the ng-cli
|
||||
// library from a package.json. Instead, include it from a relative
|
||||
// path to this script file (which is likely a globally installed
|
||||
// npm package). Most common cause for hitting this is `ng new`
|
||||
cli = await Promise.resolve().then(() => __importStar(require('./cli')));
|
||||
}
|
||||
if ('default' in cli) {
|
||||
cli = cli['default'];
|
||||
}
|
||||
return cli;
|
||||
})()
|
||||
.then((cli) => cli?.({
|
||||
cliArgs: process.argv.slice(2),
|
||||
}))
|
||||
.then((exitCode = 0) => {
|
||||
if (forceExit) {
|
||||
process.exit(exitCode);
|
||||
}
|
||||
process.exitCode = exitCode;
|
||||
})
|
||||
.catch((err) => {
|
||||
// eslint-disable-next-line no-console
|
||||
console.error('Unknown error: ' + err.toString());
|
||||
process.exit(127);
|
||||
});
|
||||
73
node_modules/@angular/cli/package.json
generated
vendored
Executable file
73
node_modules/@angular/cli/package.json
generated
vendored
Executable file
|
|
@ -0,0 +1,73 @@
|
|||
{
|
||||
"name": "@angular/cli",
|
||||
"version": "18.2.11",
|
||||
"description": "CLI tool for Angular",
|
||||
"main": "lib/cli/index.js",
|
||||
"bin": {
|
||||
"ng": "./bin/ng.js"
|
||||
},
|
||||
"keywords": [
|
||||
"Angular CLI",
|
||||
"Angular DevKit",
|
||||
"angular",
|
||||
"angular-cli",
|
||||
"devkit",
|
||||
"sdk"
|
||||
],
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/angular/angular-cli.git"
|
||||
},
|
||||
"author": "Angular Authors",
|
||||
"license": "MIT",
|
||||
"bugs": {
|
||||
"url": "https://github.com/angular/angular-cli/issues"
|
||||
},
|
||||
"homepage": "https://github.com/angular/angular-cli",
|
||||
"dependencies": {
|
||||
"@angular-devkit/architect": "0.1802.11",
|
||||
"@angular-devkit/core": "18.2.11",
|
||||
"@angular-devkit/schematics": "18.2.11",
|
||||
"@inquirer/prompts": "5.3.8",
|
||||
"@listr2/prompt-adapter-inquirer": "2.0.15",
|
||||
"@schematics/angular": "18.2.11",
|
||||
"@yarnpkg/lockfile": "1.1.0",
|
||||
"ini": "4.1.3",
|
||||
"jsonc-parser": "3.3.1",
|
||||
"listr2": "8.2.4",
|
||||
"npm-package-arg": "11.0.3",
|
||||
"npm-pick-manifest": "9.1.0",
|
||||
"pacote": "18.0.6",
|
||||
"resolve": "1.22.8",
|
||||
"semver": "7.6.3",
|
||||
"symbol-observable": "4.0.0",
|
||||
"yargs": "17.7.2"
|
||||
},
|
||||
"ng-update": {
|
||||
"migrations": "@schematics/angular/migrations/migration-collection.json",
|
||||
"packageGroup": {
|
||||
"@angular/cli": "18.2.11",
|
||||
"@angular/build": "18.2.11",
|
||||
"@angular/ssr": "18.2.11",
|
||||
"@angular-devkit/architect": "0.1802.11",
|
||||
"@angular-devkit/build-angular": "18.2.11",
|
||||
"@angular-devkit/build-webpack": "0.1802.11",
|
||||
"@angular-devkit/core": "18.2.11",
|
||||
"@angular-devkit/schematics": "18.2.11"
|
||||
}
|
||||
},
|
||||
"packageManager": "yarn@4.4.0",
|
||||
"engines": {
|
||||
"node": "^18.19.1 || ^20.11.1 || >=22.0.0",
|
||||
"npm": "^6.11.0 || ^7.5.6 || >=8.0.0",
|
||||
"yarn": ">= 1.13.0"
|
||||
},
|
||||
"dependenciesMeta": {
|
||||
"esbuild": {
|
||||
"built": true
|
||||
},
|
||||
"puppeteer": {
|
||||
"built": true
|
||||
}
|
||||
}
|
||||
}
|
||||
32
node_modules/@angular/cli/src/analytics/analytics-collector.d.ts
generated
vendored
Executable file
32
node_modules/@angular/cli/src/analytics/analytics-collector.d.ts
generated
vendored
Executable file
|
|
@ -0,0 +1,32 @@
|
|||
/**
|
||||
* @license
|
||||
* Copyright Google LLC All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by an MIT-style license that can be
|
||||
* found in the LICENSE file at https://angular.dev/license
|
||||
*/
|
||||
import type { CommandContext } from '../command-builder/command-module';
|
||||
import { EventCustomDimension, EventCustomMetric, PrimitiveTypes } from './analytics-parameters';
|
||||
export declare class AnalyticsCollector {
|
||||
private context;
|
||||
private trackingEventsQueue;
|
||||
private readonly requestParameterStringified;
|
||||
private readonly userParameters;
|
||||
constructor(context: CommandContext, userId: string);
|
||||
reportWorkspaceInfoEvent(parameters: Partial<Record<EventCustomMetric, string | boolean | number | undefined>>): void;
|
||||
reportRebuildRunEvent(parameters: Partial<Record<EventCustomMetric & EventCustomDimension, string | boolean | number | undefined>>): void;
|
||||
reportBuildRunEvent(parameters: Partial<Record<EventCustomMetric & EventCustomDimension, string | boolean | number | undefined>>): void;
|
||||
reportArchitectRunEvent(parameters: Partial<Record<EventCustomDimension, PrimitiveTypes>>): void;
|
||||
reportSchematicRunEvent(parameters: Partial<Record<EventCustomDimension, PrimitiveTypes>>): void;
|
||||
reportCommandRunEvent(command: string): void;
|
||||
private event;
|
||||
/**
|
||||
* Flush on an interval (if the event loop is waiting).
|
||||
*
|
||||
* @returns a method that when called will terminate the periodic
|
||||
* flush and call flush one last time.
|
||||
*/
|
||||
periodFlush(): () => Promise<void>;
|
||||
flush(): Promise<void>;
|
||||
private send;
|
||||
}
|
||||
184
node_modules/@angular/cli/src/analytics/analytics-collector.js
generated
vendored
Executable file
184
node_modules/@angular/cli/src/analytics/analytics-collector.js
generated
vendored
Executable file
|
|
@ -0,0 +1,184 @@
|
|||
"use strict";
|
||||
/**
|
||||
* @license
|
||||
* Copyright Google LLC All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by an MIT-style license that can be
|
||||
* found in the LICENSE file at https://angular.dev/license
|
||||
*/
|
||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
var desc = Object.getOwnPropertyDescriptor(m, k);
|
||||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
||||
desc = { enumerable: true, get: function() { return m[k]; } };
|
||||
}
|
||||
Object.defineProperty(o, k2, desc);
|
||||
}) : (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
o[k2] = m[k];
|
||||
}));
|
||||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
||||
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
||||
}) : function(o, v) {
|
||||
o["default"] = v;
|
||||
});
|
||||
var __importStar = (this && this.__importStar) || function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
||||
__setModuleDefault(result, mod);
|
||||
return result;
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.AnalyticsCollector = void 0;
|
||||
const crypto_1 = require("crypto");
|
||||
const https = __importStar(require("https"));
|
||||
const os = __importStar(require("os"));
|
||||
const querystring = __importStar(require("querystring"));
|
||||
const semver = __importStar(require("semver"));
|
||||
const environment_options_1 = require("../utilities/environment-options");
|
||||
const error_1 = require("../utilities/error");
|
||||
const version_1 = require("../utilities/version");
|
||||
const analytics_parameters_1 = require("./analytics-parameters");
|
||||
const TRACKING_ID_PROD = 'G-VETNJBW8L4';
|
||||
const TRACKING_ID_STAGING = 'G-TBMPRL1BTM';
|
||||
class AnalyticsCollector {
|
||||
context;
|
||||
trackingEventsQueue;
|
||||
requestParameterStringified;
|
||||
userParameters;
|
||||
constructor(context, userId) {
|
||||
this.context = context;
|
||||
const requestParameters = {
|
||||
[analytics_parameters_1.RequestParameter.ProtocolVersion]: 2,
|
||||
[analytics_parameters_1.RequestParameter.ClientId]: userId,
|
||||
[analytics_parameters_1.RequestParameter.UserId]: userId,
|
||||
[analytics_parameters_1.RequestParameter.TrackingId]: /^\d+\.\d+\.\d+$/.test(version_1.VERSION.full) && version_1.VERSION.full !== '0.0.0'
|
||||
? TRACKING_ID_PROD
|
||||
: TRACKING_ID_STAGING,
|
||||
// Built-in user properties
|
||||
[analytics_parameters_1.RequestParameter.SessionId]: (0, crypto_1.randomUUID)(),
|
||||
[analytics_parameters_1.RequestParameter.UserAgentArchitecture]: os.arch(),
|
||||
[analytics_parameters_1.RequestParameter.UserAgentPlatform]: os.platform(),
|
||||
[analytics_parameters_1.RequestParameter.UserAgentPlatformVersion]: os.release(),
|
||||
[analytics_parameters_1.RequestParameter.UserAgentMobile]: 0,
|
||||
[analytics_parameters_1.RequestParameter.SessionEngaged]: 1,
|
||||
// The below is needed for tech details to be collected.
|
||||
[analytics_parameters_1.RequestParameter.UserAgentFullVersionList]: 'Google%20Chrome;111.0.5563.64|Not(A%3ABrand;8.0.0.0|Chromium;111.0.5563.64',
|
||||
};
|
||||
if (environment_options_1.ngDebug) {
|
||||
requestParameters[analytics_parameters_1.RequestParameter.DebugView] = 1;
|
||||
}
|
||||
this.requestParameterStringified = querystring.stringify(requestParameters);
|
||||
const parsedVersion = semver.parse(process.version);
|
||||
const packageManagerVersion = context.packageManager.version;
|
||||
this.userParameters = {
|
||||
// While architecture is being collect by GA as UserAgentArchitecture.
|
||||
// It doesn't look like there is a way to query this. Therefore we collect this as a custom user dimension too.
|
||||
[analytics_parameters_1.UserCustomDimension.OsArchitecture]: os.arch(),
|
||||
// While User ID is being collected by GA, this is not visible in reports/for filtering.
|
||||
[analytics_parameters_1.UserCustomDimension.UserId]: userId,
|
||||
[analytics_parameters_1.UserCustomDimension.NodeVersion]: parsedVersion
|
||||
? `${parsedVersion.major}.${parsedVersion.minor}.${parsedVersion.patch}`
|
||||
: 'other',
|
||||
[analytics_parameters_1.UserCustomDimension.NodeMajorVersion]: parsedVersion?.major,
|
||||
[analytics_parameters_1.UserCustomDimension.PackageManager]: context.packageManager.name,
|
||||
[analytics_parameters_1.UserCustomDimension.PackageManagerVersion]: packageManagerVersion,
|
||||
[analytics_parameters_1.UserCustomDimension.PackageManagerMajorVersion]: packageManagerVersion
|
||||
? +packageManagerVersion.split('.', 1)[0]
|
||||
: undefined,
|
||||
[analytics_parameters_1.UserCustomDimension.AngularCLIVersion]: version_1.VERSION.full,
|
||||
[analytics_parameters_1.UserCustomDimension.AngularCLIMajorVersion]: version_1.VERSION.major,
|
||||
};
|
||||
}
|
||||
reportWorkspaceInfoEvent(parameters) {
|
||||
this.event('workspace_info', parameters);
|
||||
}
|
||||
reportRebuildRunEvent(parameters) {
|
||||
this.event('run_rebuild', parameters);
|
||||
}
|
||||
reportBuildRunEvent(parameters) {
|
||||
this.event('run_build', parameters);
|
||||
}
|
||||
reportArchitectRunEvent(parameters) {
|
||||
this.event('run_architect', parameters);
|
||||
}
|
||||
reportSchematicRunEvent(parameters) {
|
||||
this.event('run_schematic', parameters);
|
||||
}
|
||||
reportCommandRunEvent(command) {
|
||||
this.event('run_command', { [analytics_parameters_1.EventCustomDimension.Command]: command });
|
||||
}
|
||||
event(eventName, parameters) {
|
||||
this.trackingEventsQueue ??= [];
|
||||
this.trackingEventsQueue.push({
|
||||
...this.userParameters,
|
||||
...parameters,
|
||||
'en': eventName,
|
||||
});
|
||||
}
|
||||
/**
|
||||
* Flush on an interval (if the event loop is waiting).
|
||||
*
|
||||
* @returns a method that when called will terminate the periodic
|
||||
* flush and call flush one last time.
|
||||
*/
|
||||
periodFlush() {
|
||||
let analyticsFlushPromise = Promise.resolve();
|
||||
const analyticsFlushInterval = setInterval(() => {
|
||||
if (this.trackingEventsQueue?.length) {
|
||||
analyticsFlushPromise = analyticsFlushPromise.then(() => this.flush());
|
||||
}
|
||||
}, 4000);
|
||||
return () => {
|
||||
clearInterval(analyticsFlushInterval);
|
||||
// Flush one last time.
|
||||
return analyticsFlushPromise.then(() => this.flush());
|
||||
};
|
||||
}
|
||||
async flush() {
|
||||
const pendingTrackingEvents = this.trackingEventsQueue;
|
||||
this.context.logger.debug(`Analytics flush size. ${pendingTrackingEvents?.length}.`);
|
||||
if (!pendingTrackingEvents?.length) {
|
||||
return;
|
||||
}
|
||||
// The below is needed so that if flush is called multiple times,
|
||||
// we don't report the same event multiple times.
|
||||
this.trackingEventsQueue = undefined;
|
||||
try {
|
||||
await this.send(pendingTrackingEvents);
|
||||
}
|
||||
catch (error) {
|
||||
// Failure to report analytics shouldn't crash the CLI.
|
||||
(0, error_1.assertIsError)(error);
|
||||
this.context.logger.debug(`Send analytics error. ${error.message}.`);
|
||||
}
|
||||
}
|
||||
async send(data) {
|
||||
return new Promise((resolve, reject) => {
|
||||
const request = https.request({
|
||||
host: 'www.google-analytics.com',
|
||||
method: 'POST',
|
||||
path: '/g/collect?' + this.requestParameterStringified,
|
||||
headers: {
|
||||
// The below is needed for tech details to be collected even though we provide our own information from the OS Node.js module
|
||||
'user-agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/111.0.0.0 Safari/537.36',
|
||||
},
|
||||
}, (response) => {
|
||||
// The below is needed as otherwise the response will never close which will cause the CLI not to terminate.
|
||||
response.on('data', () => { });
|
||||
if (response.statusCode !== 200 && response.statusCode !== 204) {
|
||||
reject(new Error(`Analytics reporting failed with status code: ${response.statusCode}.`));
|
||||
}
|
||||
else {
|
||||
resolve();
|
||||
}
|
||||
});
|
||||
request.on('error', reject);
|
||||
const queryParameters = data.map((p) => querystring.stringify(p)).join('\n');
|
||||
request.write(queryParameters);
|
||||
request.end();
|
||||
});
|
||||
}
|
||||
}
|
||||
exports.AnalyticsCollector = AnalyticsCollector;
|
||||
101
node_modules/@angular/cli/src/analytics/analytics-parameters.d.ts
generated
vendored
Executable file
101
node_modules/@angular/cli/src/analytics/analytics-parameters.d.ts
generated
vendored
Executable file
|
|
@ -0,0 +1,101 @@
|
|||
/**
|
||||
* @license
|
||||
* Copyright Google LLC All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by an MIT-style license that can be
|
||||
* found in the LICENSE file at https://angular.dev/license
|
||||
*/
|
||||
/** Any changes in this file needs to be done in the mts version. */
|
||||
export type PrimitiveTypes = string | number | boolean;
|
||||
/**
|
||||
* GA built-in request parameters
|
||||
* @see https://www.thyngster.com/ga4-measurement-protocol-cheatsheet
|
||||
* @see http://go/depot/google3/analytics/container_tag/templates/common/gold/mpv2_schema.js
|
||||
*/
|
||||
export declare enum RequestParameter {
|
||||
ClientId = "cid",
|
||||
DebugView = "_dbg",
|
||||
GtmVersion = "gtm",
|
||||
Language = "ul",
|
||||
NewToSite = "_nsi",
|
||||
NonInteraction = "ni",
|
||||
PageLocation = "dl",
|
||||
PageTitle = "dt",
|
||||
ProtocolVersion = "v",
|
||||
SessionEngaged = "seg",
|
||||
SessionId = "sid",
|
||||
SessionNumber = "sct",
|
||||
SessionStart = "_ss",
|
||||
TrackingId = "tid",
|
||||
TrafficType = "tt",
|
||||
UserAgentArchitecture = "uaa",
|
||||
UserAgentBitness = "uab",
|
||||
UserAgentFullVersionList = "uafvl",
|
||||
UserAgentMobile = "uamb",
|
||||
UserAgentModel = "uam",
|
||||
UserAgentPlatform = "uap",
|
||||
UserAgentPlatformVersion = "uapv",
|
||||
UserId = "uid"
|
||||
}
|
||||
/**
|
||||
* User scoped custom dimensions.
|
||||
* @notes
|
||||
* - User custom dimensions limit is 25.
|
||||
* - `up.*` string type.
|
||||
* - `upn.*` number type.
|
||||
* @see https://support.google.com/analytics/answer/10075209?hl=en
|
||||
*/
|
||||
export declare enum UserCustomDimension {
|
||||
UserId = "up.ng_user_id",
|
||||
OsArchitecture = "up.ng_os_architecture",
|
||||
NodeVersion = "up.ng_node_version",
|
||||
NodeMajorVersion = "upn.ng_node_major_version",
|
||||
AngularCLIVersion = "up.ng_cli_version",
|
||||
AngularCLIMajorVersion = "upn.ng_cli_major_version",
|
||||
PackageManager = "up.ng_package_manager",
|
||||
PackageManagerVersion = "up.ng_pkg_manager_version",
|
||||
PackageManagerMajorVersion = "upn.ng_pkg_manager_major_v"
|
||||
}
|
||||
/**
|
||||
* Event scoped custom dimensions.
|
||||
* @notes
|
||||
* - Event custom dimensions limit is 50.
|
||||
* - `ep.*` string type.
|
||||
* - `epn.*` number type.
|
||||
* @see https://support.google.com/analytics/answer/10075209?hl=en
|
||||
*/
|
||||
export declare enum EventCustomDimension {
|
||||
Command = "ep.ng_command",
|
||||
SchematicCollectionName = "ep.ng_schematic_collection_name",
|
||||
SchematicName = "ep.ng_schematic_name",
|
||||
Standalone = "ep.ng_standalone",
|
||||
SSR = "ep.ng_ssr",
|
||||
Style = "ep.ng_style",
|
||||
Routing = "ep.ng_routing",
|
||||
InlineTemplate = "ep.ng_inline_template",
|
||||
InlineStyle = "ep.ng_inline_style",
|
||||
BuilderTarget = "ep.ng_builder_target",
|
||||
Aot = "ep.ng_aot",
|
||||
Optimization = "ep.ng_optimization"
|
||||
}
|
||||
/**
|
||||
* Event scoped custom mertics.
|
||||
* @notes
|
||||
* - Event scoped custom mertics limit is 50.
|
||||
* - `ep.*` string type.
|
||||
* - `epn.*` number type.
|
||||
* @see https://support.google.com/analytics/answer/10075209?hl=en
|
||||
*/
|
||||
export declare enum EventCustomMetric {
|
||||
AllChunksCount = "epn.ng_all_chunks_count",
|
||||
LazyChunksCount = "epn.ng_lazy_chunks_count",
|
||||
InitialChunksCount = "epn.ng_initial_chunks_count",
|
||||
ChangedChunksCount = "epn.ng_changed_chunks_count",
|
||||
DurationInMs = "epn.ng_duration_ms",
|
||||
CssSizeInBytes = "epn.ng_css_size_bytes",
|
||||
JsSizeInBytes = "epn.ng_js_size_bytes",
|
||||
NgComponentCount = "epn.ng_component_count",
|
||||
AllProjectsCount = "epn.all_projects_count",
|
||||
LibraryProjectsCount = "epn.libs_projects_count",
|
||||
ApplicationProjectsCount = "epn.apps_projects_count"
|
||||
}
|
||||
106
node_modules/@angular/cli/src/analytics/analytics-parameters.js
generated
vendored
Executable file
106
node_modules/@angular/cli/src/analytics/analytics-parameters.js
generated
vendored
Executable file
|
|
@ -0,0 +1,106 @@
|
|||
"use strict";
|
||||
/**
|
||||
* @license
|
||||
* Copyright Google LLC All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by an MIT-style license that can be
|
||||
* found in the LICENSE file at https://angular.dev/license
|
||||
*/
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.EventCustomMetric = exports.EventCustomDimension = exports.UserCustomDimension = exports.RequestParameter = void 0;
|
||||
/**
|
||||
* GA built-in request parameters
|
||||
* @see https://www.thyngster.com/ga4-measurement-protocol-cheatsheet
|
||||
* @see http://go/depot/google3/analytics/container_tag/templates/common/gold/mpv2_schema.js
|
||||
*/
|
||||
var RequestParameter;
|
||||
(function (RequestParameter) {
|
||||
RequestParameter["ClientId"] = "cid";
|
||||
RequestParameter["DebugView"] = "_dbg";
|
||||
RequestParameter["GtmVersion"] = "gtm";
|
||||
RequestParameter["Language"] = "ul";
|
||||
RequestParameter["NewToSite"] = "_nsi";
|
||||
RequestParameter["NonInteraction"] = "ni";
|
||||
RequestParameter["PageLocation"] = "dl";
|
||||
RequestParameter["PageTitle"] = "dt";
|
||||
RequestParameter["ProtocolVersion"] = "v";
|
||||
RequestParameter["SessionEngaged"] = "seg";
|
||||
RequestParameter["SessionId"] = "sid";
|
||||
RequestParameter["SessionNumber"] = "sct";
|
||||
RequestParameter["SessionStart"] = "_ss";
|
||||
RequestParameter["TrackingId"] = "tid";
|
||||
RequestParameter["TrafficType"] = "tt";
|
||||
RequestParameter["UserAgentArchitecture"] = "uaa";
|
||||
RequestParameter["UserAgentBitness"] = "uab";
|
||||
RequestParameter["UserAgentFullVersionList"] = "uafvl";
|
||||
RequestParameter["UserAgentMobile"] = "uamb";
|
||||
RequestParameter["UserAgentModel"] = "uam";
|
||||
RequestParameter["UserAgentPlatform"] = "uap";
|
||||
RequestParameter["UserAgentPlatformVersion"] = "uapv";
|
||||
RequestParameter["UserId"] = "uid";
|
||||
})(RequestParameter || (exports.RequestParameter = RequestParameter = {}));
|
||||
/**
|
||||
* User scoped custom dimensions.
|
||||
* @notes
|
||||
* - User custom dimensions limit is 25.
|
||||
* - `up.*` string type.
|
||||
* - `upn.*` number type.
|
||||
* @see https://support.google.com/analytics/answer/10075209?hl=en
|
||||
*/
|
||||
var UserCustomDimension;
|
||||
(function (UserCustomDimension) {
|
||||
UserCustomDimension["UserId"] = "up.ng_user_id";
|
||||
UserCustomDimension["OsArchitecture"] = "up.ng_os_architecture";
|
||||
UserCustomDimension["NodeVersion"] = "up.ng_node_version";
|
||||
UserCustomDimension["NodeMajorVersion"] = "upn.ng_node_major_version";
|
||||
UserCustomDimension["AngularCLIVersion"] = "up.ng_cli_version";
|
||||
UserCustomDimension["AngularCLIMajorVersion"] = "upn.ng_cli_major_version";
|
||||
UserCustomDimension["PackageManager"] = "up.ng_package_manager";
|
||||
UserCustomDimension["PackageManagerVersion"] = "up.ng_pkg_manager_version";
|
||||
UserCustomDimension["PackageManagerMajorVersion"] = "upn.ng_pkg_manager_major_v";
|
||||
})(UserCustomDimension || (exports.UserCustomDimension = UserCustomDimension = {}));
|
||||
/**
|
||||
* Event scoped custom dimensions.
|
||||
* @notes
|
||||
* - Event custom dimensions limit is 50.
|
||||
* - `ep.*` string type.
|
||||
* - `epn.*` number type.
|
||||
* @see https://support.google.com/analytics/answer/10075209?hl=en
|
||||
*/
|
||||
var EventCustomDimension;
|
||||
(function (EventCustomDimension) {
|
||||
EventCustomDimension["Command"] = "ep.ng_command";
|
||||
EventCustomDimension["SchematicCollectionName"] = "ep.ng_schematic_collection_name";
|
||||
EventCustomDimension["SchematicName"] = "ep.ng_schematic_name";
|
||||
EventCustomDimension["Standalone"] = "ep.ng_standalone";
|
||||
EventCustomDimension["SSR"] = "ep.ng_ssr";
|
||||
EventCustomDimension["Style"] = "ep.ng_style";
|
||||
EventCustomDimension["Routing"] = "ep.ng_routing";
|
||||
EventCustomDimension["InlineTemplate"] = "ep.ng_inline_template";
|
||||
EventCustomDimension["InlineStyle"] = "ep.ng_inline_style";
|
||||
EventCustomDimension["BuilderTarget"] = "ep.ng_builder_target";
|
||||
EventCustomDimension["Aot"] = "ep.ng_aot";
|
||||
EventCustomDimension["Optimization"] = "ep.ng_optimization";
|
||||
})(EventCustomDimension || (exports.EventCustomDimension = EventCustomDimension = {}));
|
||||
/**
|
||||
* Event scoped custom mertics.
|
||||
* @notes
|
||||
* - Event scoped custom mertics limit is 50.
|
||||
* - `ep.*` string type.
|
||||
* - `epn.*` number type.
|
||||
* @see https://support.google.com/analytics/answer/10075209?hl=en
|
||||
*/
|
||||
var EventCustomMetric;
|
||||
(function (EventCustomMetric) {
|
||||
EventCustomMetric["AllChunksCount"] = "epn.ng_all_chunks_count";
|
||||
EventCustomMetric["LazyChunksCount"] = "epn.ng_lazy_chunks_count";
|
||||
EventCustomMetric["InitialChunksCount"] = "epn.ng_initial_chunks_count";
|
||||
EventCustomMetric["ChangedChunksCount"] = "epn.ng_changed_chunks_count";
|
||||
EventCustomMetric["DurationInMs"] = "epn.ng_duration_ms";
|
||||
EventCustomMetric["CssSizeInBytes"] = "epn.ng_css_size_bytes";
|
||||
EventCustomMetric["JsSizeInBytes"] = "epn.ng_js_size_bytes";
|
||||
EventCustomMetric["NgComponentCount"] = "epn.ng_component_count";
|
||||
EventCustomMetric["AllProjectsCount"] = "epn.all_projects_count";
|
||||
EventCustomMetric["LibraryProjectsCount"] = "epn.libs_projects_count";
|
||||
EventCustomMetric["ApplicationProjectsCount"] = "epn.apps_projects_count";
|
||||
})(EventCustomMetric || (exports.EventCustomMetric = EventCustomMetric = {}));
|
||||
27
node_modules/@angular/cli/src/analytics/analytics.d.ts
generated
vendored
Executable file
27
node_modules/@angular/cli/src/analytics/analytics.d.ts
generated
vendored
Executable file
|
|
@ -0,0 +1,27 @@
|
|||
/**
|
||||
* @license
|
||||
* Copyright Google LLC All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by an MIT-style license that can be
|
||||
* found in the LICENSE file at https://angular.dev/license
|
||||
*/
|
||||
import type { CommandContext } from '../command-builder/command-module';
|
||||
/**
|
||||
* This is the ultimate safelist for checking if a package name is safe to report to analytics.
|
||||
*/
|
||||
export declare const analyticsPackageSafelist: (string | RegExp)[];
|
||||
export declare function isPackageNameSafeForAnalytics(name: string): boolean;
|
||||
/**
|
||||
* Set analytics settings. This does not work if the user is not inside a project.
|
||||
* @param global Which config to use. "global" for user-level, and "local" for project-level.
|
||||
* @param value Either a user ID, true to generate a new User ID, or false to disable analytics.
|
||||
*/
|
||||
export declare function setAnalyticsConfig(global: boolean, value: string | boolean): Promise<void>;
|
||||
/**
|
||||
* Prompt the user for usage gathering permission.
|
||||
* @param force Whether to ask regardless of whether or not the user is using an interactive shell.
|
||||
* @return Whether or not the user was shown a prompt.
|
||||
*/
|
||||
export declare function promptAnalytics(context: CommandContext, global: boolean, force?: boolean): Promise<boolean>;
|
||||
export declare function getAnalyticsUserId(context: CommandContext, skipPrompt?: boolean): Promise<string | undefined>;
|
||||
export declare function getAnalyticsInfoString(context: CommandContext): Promise<string>;
|
||||
182
node_modules/@angular/cli/src/analytics/analytics.js
generated
vendored
Executable file
182
node_modules/@angular/cli/src/analytics/analytics.js
generated
vendored
Executable file
|
|
@ -0,0 +1,182 @@
|
|||
"use strict";
|
||||
/**
|
||||
* @license
|
||||
* Copyright Google LLC All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by an MIT-style license that can be
|
||||
* found in the LICENSE file at https://angular.dev/license
|
||||
*/
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.analyticsPackageSafelist = void 0;
|
||||
exports.isPackageNameSafeForAnalytics = isPackageNameSafeForAnalytics;
|
||||
exports.setAnalyticsConfig = setAnalyticsConfig;
|
||||
exports.promptAnalytics = promptAnalytics;
|
||||
exports.getAnalyticsUserId = getAnalyticsUserId;
|
||||
exports.getAnalyticsInfoString = getAnalyticsInfoString;
|
||||
const core_1 = require("@angular-devkit/core");
|
||||
const crypto_1 = require("crypto");
|
||||
const color_1 = require("../utilities/color");
|
||||
const config_1 = require("../utilities/config");
|
||||
const environment_options_1 = require("../utilities/environment-options");
|
||||
const prompt_1 = require("../utilities/prompt");
|
||||
const tty_1 = require("../utilities/tty");
|
||||
/* eslint-disable no-console */
|
||||
/**
|
||||
* This is the ultimate safelist for checking if a package name is safe to report to analytics.
|
||||
*/
|
||||
exports.analyticsPackageSafelist = [
|
||||
/^@angular\//,
|
||||
/^@angular-devkit\//,
|
||||
/^@nguniversal\//,
|
||||
'@schematics/angular',
|
||||
];
|
||||
function isPackageNameSafeForAnalytics(name) {
|
||||
return exports.analyticsPackageSafelist.some((pattern) => {
|
||||
if (typeof pattern == 'string') {
|
||||
return pattern === name;
|
||||
}
|
||||
else {
|
||||
return pattern.test(name);
|
||||
}
|
||||
});
|
||||
}
|
||||
/**
|
||||
* Set analytics settings. This does not work if the user is not inside a project.
|
||||
* @param global Which config to use. "global" for user-level, and "local" for project-level.
|
||||
* @param value Either a user ID, true to generate a new User ID, or false to disable analytics.
|
||||
*/
|
||||
async function setAnalyticsConfig(global, value) {
|
||||
const level = global ? 'global' : 'local';
|
||||
const workspace = await (0, config_1.getWorkspace)(level);
|
||||
if (!workspace) {
|
||||
throw new Error(`Could not find ${level} workspace.`);
|
||||
}
|
||||
const cli = (workspace.extensions['cli'] ??= {});
|
||||
if (!workspace || !core_1.json.isJsonObject(cli)) {
|
||||
throw new Error(`Invalid config found at ${workspace.filePath}. CLI should be an object.`);
|
||||
}
|
||||
cli.analytics = value === true ? (0, crypto_1.randomUUID)() : value;
|
||||
await workspace.save();
|
||||
}
|
||||
/**
|
||||
* Prompt the user for usage gathering permission.
|
||||
* @param force Whether to ask regardless of whether or not the user is using an interactive shell.
|
||||
* @return Whether or not the user was shown a prompt.
|
||||
*/
|
||||
async function promptAnalytics(context, global, force = false) {
|
||||
const level = global ? 'global' : 'local';
|
||||
const workspace = await (0, config_1.getWorkspace)(level);
|
||||
if (!workspace) {
|
||||
throw new Error(`Could not find a ${level} workspace. Are you in a project?`);
|
||||
}
|
||||
if (force || (0, tty_1.isTTY)()) {
|
||||
const answer = await (0, prompt_1.askConfirmation)(`
|
||||
Would you like to share pseudonymous usage data about this project with the Angular Team
|
||||
at Google under Google's Privacy Policy at https://policies.google.com/privacy. For more
|
||||
details and how to change this setting, see https://angular.dev/cli/analytics.
|
||||
|
||||
`, false);
|
||||
await setAnalyticsConfig(global, answer);
|
||||
if (answer) {
|
||||
console.log('');
|
||||
console.log(core_1.tags.stripIndent `
|
||||
Thank you for sharing pseudonymous usage data. Should you change your mind, the following
|
||||
command will disable this feature entirely:
|
||||
|
||||
${color_1.colors.yellow(`ng analytics disable${global ? ' --global' : ''}`)}
|
||||
`);
|
||||
console.log('');
|
||||
}
|
||||
process.stderr.write(await getAnalyticsInfoString(context));
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
/**
|
||||
* Get the analytics user id.
|
||||
*
|
||||
* @returns
|
||||
* - `string` user id.
|
||||
* - `false` when disabled.
|
||||
* - `undefined` when not configured.
|
||||
*/
|
||||
async function getAnalyticsUserIdForLevel(level) {
|
||||
if (environment_options_1.analyticsDisabled) {
|
||||
return false;
|
||||
}
|
||||
const workspace = await (0, config_1.getWorkspace)(level);
|
||||
const analyticsConfig = workspace?.getCli()?.['analytics'];
|
||||
if (analyticsConfig === false) {
|
||||
return false;
|
||||
}
|
||||
else if (analyticsConfig === undefined || analyticsConfig === null) {
|
||||
return undefined;
|
||||
}
|
||||
else {
|
||||
if (typeof analyticsConfig == 'string') {
|
||||
return analyticsConfig;
|
||||
}
|
||||
else if (typeof analyticsConfig == 'object' && typeof analyticsConfig['uid'] == 'string') {
|
||||
return analyticsConfig['uid'];
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
}
|
||||
async function getAnalyticsUserId(context, skipPrompt = false) {
|
||||
const { workspace } = context;
|
||||
// Global config takes precedence over local config only for the disabled check.
|
||||
// IE:
|
||||
// global: disabled & local: enabled = disabled
|
||||
// global: id: 123 & local: id: 456 = 456
|
||||
// check global
|
||||
const globalConfig = await getAnalyticsUserIdForLevel('global');
|
||||
if (globalConfig === false) {
|
||||
return undefined;
|
||||
}
|
||||
// Not disabled globally, check locally or not set globally and command is run outside of workspace example: `ng new`
|
||||
if (workspace || globalConfig === undefined) {
|
||||
const level = workspace ? 'local' : 'global';
|
||||
let localOrGlobalConfig = await getAnalyticsUserIdForLevel(level);
|
||||
if (localOrGlobalConfig === undefined) {
|
||||
if (!skipPrompt) {
|
||||
// config is unset, prompt user.
|
||||
// TODO: This should honor the `no-interactive` option.
|
||||
// It is currently not an `ng` option but rather only an option for specific commands.
|
||||
// The concept of `ng`-wide options are needed to cleanly handle this.
|
||||
await promptAnalytics(context, !workspace /** global */);
|
||||
localOrGlobalConfig = await getAnalyticsUserIdForLevel(level);
|
||||
}
|
||||
}
|
||||
if (localOrGlobalConfig === false) {
|
||||
return undefined;
|
||||
}
|
||||
else if (typeof localOrGlobalConfig === 'string') {
|
||||
return localOrGlobalConfig;
|
||||
}
|
||||
}
|
||||
return globalConfig;
|
||||
}
|
||||
function analyticsConfigValueToHumanFormat(value) {
|
||||
if (value === false) {
|
||||
return 'disabled';
|
||||
}
|
||||
else if (typeof value === 'string' || value === true) {
|
||||
return 'enabled';
|
||||
}
|
||||
else {
|
||||
return 'not set';
|
||||
}
|
||||
}
|
||||
async function getAnalyticsInfoString(context) {
|
||||
const analyticsInstance = await getAnalyticsUserId(context, true /** skipPrompt */);
|
||||
const { globalConfiguration, workspace: localWorkspace } = context;
|
||||
const globalSetting = globalConfiguration?.getCli()?.['analytics'];
|
||||
const localSetting = localWorkspace?.getCli()?.['analytics'];
|
||||
return (core_1.tags.stripIndents `
|
||||
Global setting: ${analyticsConfigValueToHumanFormat(globalSetting)}
|
||||
Local setting: ${localWorkspace
|
||||
? analyticsConfigValueToHumanFormat(localSetting)
|
||||
: 'No local workspace configuration file.'}
|
||||
Effective status: ${analyticsInstance ? 'enabled' : 'disabled'}
|
||||
` + '\n');
|
||||
}
|
||||
30
node_modules/@angular/cli/src/command-builder/architect-base-command-module.d.ts
generated
vendored
Executable file
30
node_modules/@angular/cli/src/command-builder/architect-base-command-module.d.ts
generated
vendored
Executable file
|
|
@ -0,0 +1,30 @@
|
|||
/**
|
||||
* @license
|
||||
* Copyright Google LLC All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by an MIT-style license that can be
|
||||
* found in the LICENSE file at https://angular.dev/license
|
||||
*/
|
||||
import { Architect, Target } from '@angular-devkit/architect';
|
||||
import { WorkspaceNodeModulesArchitectHost } from '@angular-devkit/architect/node';
|
||||
import { CommandModule, CommandModuleImplementation, CommandScope, OtherOptions } from './command-module';
|
||||
import { Option } from './utilities/json-schema';
|
||||
export interface MissingTargetChoice {
|
||||
name: string;
|
||||
value: string;
|
||||
}
|
||||
export declare abstract class ArchitectBaseCommandModule<T extends object> extends CommandModule<T> implements CommandModuleImplementation<T> {
|
||||
scope: CommandScope;
|
||||
protected readonly missingTargetChoices: MissingTargetChoice[] | undefined;
|
||||
protected runSingleTarget(target: Target, options: OtherOptions): Promise<number>;
|
||||
private builderStatsToAnalyticsParameters;
|
||||
private _architectHost;
|
||||
protected getArchitectHost(): WorkspaceNodeModulesArchitectHost;
|
||||
private _architect;
|
||||
protected getArchitect(): Architect;
|
||||
protected getArchitectTargetOptions(target: Target): Promise<Option[]>;
|
||||
private warnOnMissingNodeModules;
|
||||
protected getArchitectTarget(): string;
|
||||
protected onMissingTarget(defaultMessage: string): Promise<1>;
|
||||
private getMissingTargetPackageToInstall;
|
||||
}
|
||||
230
node_modules/@angular/cli/src/command-builder/architect-base-command-module.js
generated
vendored
Executable file
230
node_modules/@angular/cli/src/command-builder/architect-base-command-module.js
generated
vendored
Executable file
|
|
@ -0,0 +1,230 @@
|
|||
"use strict";
|
||||
/**
|
||||
* @license
|
||||
* Copyright Google LLC All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by an MIT-style license that can be
|
||||
* found in the LICENSE file at https://angular.dev/license
|
||||
*/
|
||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
var desc = Object.getOwnPropertyDescriptor(m, k);
|
||||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
||||
desc = { enumerable: true, get: function() { return m[k]; } };
|
||||
}
|
||||
Object.defineProperty(o, k2, desc);
|
||||
}) : (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
o[k2] = m[k];
|
||||
}));
|
||||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
||||
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
||||
}) : function(o, v) {
|
||||
o["default"] = v;
|
||||
});
|
||||
var __importStar = (this && this.__importStar) || function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
||||
__setModuleDefault(result, mod);
|
||||
return result;
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.ArchitectBaseCommandModule = void 0;
|
||||
const architect_1 = require("@angular-devkit/architect");
|
||||
const node_1 = require("@angular-devkit/architect/node");
|
||||
const core_1 = require("@angular-devkit/core");
|
||||
const node_fs_1 = require("node:fs");
|
||||
const node_path_1 = require("node:path");
|
||||
const analytics_1 = require("../analytics/analytics");
|
||||
const analytics_parameters_1 = require("../analytics/analytics-parameters");
|
||||
const error_1 = require("../utilities/error");
|
||||
const prompt_1 = require("../utilities/prompt");
|
||||
const tty_1 = require("../utilities/tty");
|
||||
const command_module_1 = require("./command-module");
|
||||
const json_schema_1 = require("./utilities/json-schema");
|
||||
class ArchitectBaseCommandModule extends command_module_1.CommandModule {
|
||||
scope = command_module_1.CommandScope.In;
|
||||
missingTargetChoices;
|
||||
async runSingleTarget(target, options) {
|
||||
const architectHost = this.getArchitectHost();
|
||||
let builderName;
|
||||
try {
|
||||
builderName = await architectHost.getBuilderNameForTarget(target);
|
||||
}
|
||||
catch (e) {
|
||||
(0, error_1.assertIsError)(e);
|
||||
return this.onMissingTarget(e.message);
|
||||
}
|
||||
const { logger } = this.context;
|
||||
const run = await this.getArchitect().scheduleTarget(target, options, {
|
||||
logger,
|
||||
});
|
||||
const analytics = (0, analytics_1.isPackageNameSafeForAnalytics)(builderName)
|
||||
? await this.getAnalytics()
|
||||
: undefined;
|
||||
let outputSubscription;
|
||||
if (analytics) {
|
||||
analytics.reportArchitectRunEvent({
|
||||
[analytics_parameters_1.EventCustomDimension.BuilderTarget]: builderName,
|
||||
});
|
||||
let firstRun = true;
|
||||
outputSubscription = run.output.subscribe(({ stats }) => {
|
||||
const parameters = this.builderStatsToAnalyticsParameters(stats, builderName);
|
||||
if (!parameters) {
|
||||
return;
|
||||
}
|
||||
if (firstRun) {
|
||||
firstRun = false;
|
||||
analytics.reportBuildRunEvent(parameters);
|
||||
}
|
||||
else {
|
||||
analytics.reportRebuildRunEvent(parameters);
|
||||
}
|
||||
});
|
||||
}
|
||||
try {
|
||||
const { error, success } = await run.lastOutput;
|
||||
if (error) {
|
||||
logger.error(error);
|
||||
}
|
||||
return success ? 0 : 1;
|
||||
}
|
||||
finally {
|
||||
await run.stop();
|
||||
outputSubscription?.unsubscribe();
|
||||
}
|
||||
}
|
||||
builderStatsToAnalyticsParameters(stats, builderName) {
|
||||
if (!stats || typeof stats !== 'object' || !('durationInMs' in stats)) {
|
||||
return undefined;
|
||||
}
|
||||
const { optimization, allChunksCount, aot, lazyChunksCount, initialChunksCount, durationInMs, changedChunksCount, cssSizeInBytes, jsSizeInBytes, ngComponentCount, } = stats;
|
||||
return {
|
||||
[analytics_parameters_1.EventCustomDimension.BuilderTarget]: builderName,
|
||||
[analytics_parameters_1.EventCustomDimension.Aot]: aot,
|
||||
[analytics_parameters_1.EventCustomDimension.Optimization]: optimization,
|
||||
[analytics_parameters_1.EventCustomMetric.AllChunksCount]: allChunksCount,
|
||||
[analytics_parameters_1.EventCustomMetric.LazyChunksCount]: lazyChunksCount,
|
||||
[analytics_parameters_1.EventCustomMetric.InitialChunksCount]: initialChunksCount,
|
||||
[analytics_parameters_1.EventCustomMetric.ChangedChunksCount]: changedChunksCount,
|
||||
[analytics_parameters_1.EventCustomMetric.DurationInMs]: durationInMs,
|
||||
[analytics_parameters_1.EventCustomMetric.JsSizeInBytes]: jsSizeInBytes,
|
||||
[analytics_parameters_1.EventCustomMetric.CssSizeInBytes]: cssSizeInBytes,
|
||||
[analytics_parameters_1.EventCustomMetric.NgComponentCount]: ngComponentCount,
|
||||
};
|
||||
}
|
||||
_architectHost;
|
||||
getArchitectHost() {
|
||||
if (this._architectHost) {
|
||||
return this._architectHost;
|
||||
}
|
||||
const workspace = this.getWorkspaceOrThrow();
|
||||
return (this._architectHost = new node_1.WorkspaceNodeModulesArchitectHost(workspace, workspace.basePath));
|
||||
}
|
||||
_architect;
|
||||
getArchitect() {
|
||||
if (this._architect) {
|
||||
return this._architect;
|
||||
}
|
||||
const registry = new core_1.json.schema.CoreSchemaRegistry();
|
||||
registry.addPostTransform(core_1.json.schema.transforms.addUndefinedDefaults);
|
||||
registry.useXDeprecatedProvider((msg) => this.context.logger.warn(msg));
|
||||
const architectHost = this.getArchitectHost();
|
||||
return (this._architect = new architect_1.Architect(architectHost, registry));
|
||||
}
|
||||
async getArchitectTargetOptions(target) {
|
||||
const architectHost = this.getArchitectHost();
|
||||
let builderConf;
|
||||
try {
|
||||
builderConf = await architectHost.getBuilderNameForTarget(target);
|
||||
}
|
||||
catch {
|
||||
return [];
|
||||
}
|
||||
let builderDesc;
|
||||
try {
|
||||
builderDesc = await architectHost.resolveBuilder(builderConf);
|
||||
}
|
||||
catch (e) {
|
||||
(0, error_1.assertIsError)(e);
|
||||
if (e.code === 'MODULE_NOT_FOUND') {
|
||||
this.warnOnMissingNodeModules();
|
||||
throw new command_module_1.CommandModuleError(`Could not find the '${builderConf}' builder's node package.`);
|
||||
}
|
||||
throw e;
|
||||
}
|
||||
return (0, json_schema_1.parseJsonSchemaToOptions)(new core_1.json.schema.CoreSchemaRegistry(), builderDesc.optionSchema, true);
|
||||
}
|
||||
warnOnMissingNodeModules() {
|
||||
const basePath = this.context.workspace?.basePath;
|
||||
if (!basePath) {
|
||||
return;
|
||||
}
|
||||
// Check if yarn PnP is used. https://yarnpkg.com/advanced/pnpapi#processversionspnp
|
||||
if (process.versions.pnp) {
|
||||
return;
|
||||
}
|
||||
// Check for a `node_modules` directory (npm, yarn non-PnP, etc.)
|
||||
if ((0, node_fs_1.existsSync)((0, node_path_1.resolve)(basePath, 'node_modules'))) {
|
||||
return;
|
||||
}
|
||||
this.context.logger.warn(`Node packages may not be installed. Try installing with '${this.context.packageManager.name} install'.`);
|
||||
}
|
||||
getArchitectTarget() {
|
||||
return this.commandName;
|
||||
}
|
||||
async onMissingTarget(defaultMessage) {
|
||||
const { logger } = this.context;
|
||||
const choices = this.missingTargetChoices;
|
||||
if (!choices?.length) {
|
||||
logger.error(defaultMessage);
|
||||
return 1;
|
||||
}
|
||||
const missingTargetMessage = `Cannot find "${this.getArchitectTarget()}" target for the specified project.\n` +
|
||||
`You can add a package that implements these capabilities.\n\n` +
|
||||
`For example:\n` +
|
||||
choices.map(({ name, value }) => ` ${name}: ng add ${value}`).join('\n') +
|
||||
'\n';
|
||||
if ((0, tty_1.isTTY)()) {
|
||||
// Use prompts to ask the user if they'd like to install a package.
|
||||
logger.warn(missingTargetMessage);
|
||||
const packageToInstall = await this.getMissingTargetPackageToInstall(choices);
|
||||
if (packageToInstall) {
|
||||
// Example run: `ng add @angular-eslint/schematics`.
|
||||
const AddCommandModule = (await Promise.resolve().then(() => __importStar(require('../commands/add/cli')))).default;
|
||||
await new AddCommandModule(this.context).run({
|
||||
interactive: true,
|
||||
force: false,
|
||||
dryRun: false,
|
||||
defaults: false,
|
||||
collection: packageToInstall,
|
||||
});
|
||||
}
|
||||
}
|
||||
else {
|
||||
// Non TTY display error message.
|
||||
logger.error(missingTargetMessage);
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
async getMissingTargetPackageToInstall(choices) {
|
||||
if (choices.length === 1) {
|
||||
// Single choice
|
||||
const { name, value } = choices[0];
|
||||
if (await (0, prompt_1.askConfirmation)(`Would you like to add ${name} now?`, true, false)) {
|
||||
return value;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
// Multiple choice
|
||||
return (0, prompt_1.askQuestion)(`Would you like to add a package with "${this.getArchitectTarget()}" capabilities now?`, [
|
||||
{
|
||||
name: 'No',
|
||||
value: null,
|
||||
},
|
||||
...choices,
|
||||
], 0, null);
|
||||
}
|
||||
}
|
||||
exports.ArchitectBaseCommandModule = ArchitectBaseCommandModule;
|
||||
28
node_modules/@angular/cli/src/command-builder/architect-command-module.d.ts
generated
vendored
Executable file
28
node_modules/@angular/cli/src/command-builder/architect-command-module.d.ts
generated
vendored
Executable file
|
|
@ -0,0 +1,28 @@
|
|||
/**
|
||||
* @license
|
||||
* Copyright Google LLC All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by an MIT-style license that can be
|
||||
* found in the LICENSE file at https://angular.dev/license
|
||||
*/
|
||||
import { Target } from '@angular-devkit/architect';
|
||||
import { workspaces } from '@angular-devkit/core';
|
||||
import { Argv } from 'yargs';
|
||||
import { ArchitectBaseCommandModule } from './architect-base-command-module';
|
||||
import { CommandModuleImplementation, Options, OtherOptions } from './command-module';
|
||||
export interface ArchitectCommandArgs {
|
||||
configuration?: string;
|
||||
project?: string;
|
||||
}
|
||||
export declare abstract class ArchitectCommandModule extends ArchitectBaseCommandModule<ArchitectCommandArgs> implements CommandModuleImplementation<ArchitectCommandArgs> {
|
||||
abstract readonly multiTarget: boolean;
|
||||
findDefaultBuilderName?(project: workspaces.ProjectDefinition, target: Target): Promise<string | undefined>;
|
||||
builder(argv: Argv): Promise<Argv<ArchitectCommandArgs>>;
|
||||
run(options: Options<ArchitectCommandArgs> & OtherOptions): Promise<number | void>;
|
||||
private getArchitectProject;
|
||||
private getProjectNamesByTarget;
|
||||
/** @returns a sorted list of project names to be used for auto completion. */
|
||||
private getProjectChoices;
|
||||
/** @returns a sorted list of configuration names to be used for auto completion. */
|
||||
private getConfigurationChoices;
|
||||
}
|
||||
204
node_modules/@angular/cli/src/command-builder/architect-command-module.js
generated
vendored
Executable file
204
node_modules/@angular/cli/src/command-builder/architect-command-module.js
generated
vendored
Executable file
|
|
@ -0,0 +1,204 @@
|
|||
"use strict";
|
||||
/**
|
||||
* @license
|
||||
* Copyright Google LLC All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by an MIT-style license that can be
|
||||
* found in the LICENSE file at https://angular.dev/license
|
||||
*/
|
||||
var __runInitializers = (this && this.__runInitializers) || function (thisArg, initializers, value) {
|
||||
var useValue = arguments.length > 2;
|
||||
for (var i = 0; i < initializers.length; i++) {
|
||||
value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);
|
||||
}
|
||||
return useValue ? value : void 0;
|
||||
};
|
||||
var __esDecorate = (this && this.__esDecorate) || function (ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
|
||||
function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; }
|
||||
var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value";
|
||||
var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null;
|
||||
var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});
|
||||
var _, done = false;
|
||||
for (var i = decorators.length - 1; i >= 0; i--) {
|
||||
var context = {};
|
||||
for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p];
|
||||
for (var p in contextIn.access) context.access[p] = contextIn.access[p];
|
||||
context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); };
|
||||
var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);
|
||||
if (kind === "accessor") {
|
||||
if (result === void 0) continue;
|
||||
if (result === null || typeof result !== "object") throw new TypeError("Object expected");
|
||||
if (_ = accept(result.get)) descriptor.get = _;
|
||||
if (_ = accept(result.set)) descriptor.set = _;
|
||||
if (_ = accept(result.init)) initializers.unshift(_);
|
||||
}
|
||||
else if (_ = accept(result)) {
|
||||
if (kind === "field") initializers.unshift(_);
|
||||
else descriptor[key] = _;
|
||||
}
|
||||
}
|
||||
if (target) Object.defineProperty(target, contextIn.name, descriptor);
|
||||
done = true;
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.ArchitectCommandModule = void 0;
|
||||
const config_1 = require("../utilities/config");
|
||||
const memoize_1 = require("../utilities/memoize");
|
||||
const architect_base_command_module_1 = require("./architect-base-command-module");
|
||||
const command_module_1 = require("./command-module");
|
||||
let ArchitectCommandModule = (() => {
|
||||
let _classSuper = architect_base_command_module_1.ArchitectBaseCommandModule;
|
||||
let _instanceExtraInitializers = [];
|
||||
let _getProjectNamesByTarget_decorators;
|
||||
return class ArchitectCommandModule extends _classSuper {
|
||||
static {
|
||||
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
|
||||
_getProjectNamesByTarget_decorators = [memoize_1.memoize];
|
||||
__esDecorate(this, null, _getProjectNamesByTarget_decorators, { kind: "method", name: "getProjectNamesByTarget", static: false, private: false, access: { has: obj => "getProjectNamesByTarget" in obj, get: obj => obj.getProjectNamesByTarget }, metadata: _metadata }, null, _instanceExtraInitializers);
|
||||
if (_metadata) Object.defineProperty(this, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
||||
}
|
||||
async builder(argv) {
|
||||
const target = this.getArchitectTarget();
|
||||
// Add default builder if target is not in project and a command default is provided
|
||||
if (this.findDefaultBuilderName && this.context.workspace) {
|
||||
for (const [project, projectDefinition] of this.context.workspace.projects) {
|
||||
if (projectDefinition.targets.has(target)) {
|
||||
continue;
|
||||
}
|
||||
const defaultBuilder = await this.findDefaultBuilderName(projectDefinition, {
|
||||
project,
|
||||
target,
|
||||
});
|
||||
if (defaultBuilder) {
|
||||
projectDefinition.targets.set(target, {
|
||||
builder: defaultBuilder,
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
const project = this.getArchitectProject();
|
||||
const { jsonHelp, getYargsCompletions, help } = this.context.args.options;
|
||||
const localYargs = argv
|
||||
.positional('project', {
|
||||
describe: 'The name of the project to build. Can be an application or a library.',
|
||||
type: 'string',
|
||||
// Hide choices from JSON help so that we don't display them in AIO.
|
||||
choices: jsonHelp ? undefined : this.getProjectChoices(),
|
||||
})
|
||||
.option('configuration', {
|
||||
describe: `One or more named builder configurations as a comma-separated ` +
|
||||
`list as specified in the "configurations" section in angular.json.\n` +
|
||||
`The builder uses the named configurations to run the given target.\n` +
|
||||
`For more information, see https://angular.dev/reference/configs/workspace-config#alternate-build-configurations.`,
|
||||
alias: 'c',
|
||||
type: 'string',
|
||||
// Show only in when using --help and auto completion because otherwise comma seperated configuration values will be invalid.
|
||||
// Also, hide choices from JSON help so that we don't display them in AIO.
|
||||
choices: (getYargsCompletions || help) && !jsonHelp && project
|
||||
? this.getConfigurationChoices(project)
|
||||
: undefined,
|
||||
})
|
||||
.strict();
|
||||
if (!project) {
|
||||
return localYargs;
|
||||
}
|
||||
const schemaOptions = await this.getArchitectTargetOptions({
|
||||
project,
|
||||
target,
|
||||
});
|
||||
return this.addSchemaOptionsToCommand(localYargs, schemaOptions);
|
||||
}
|
||||
async run(options) {
|
||||
const target = this.getArchitectTarget();
|
||||
const { configuration = '', project, ...architectOptions } = options;
|
||||
if (!project) {
|
||||
// This runs each target sequentially.
|
||||
// Running them in parallel would jumble the log messages.
|
||||
let result = 0;
|
||||
const projectNames = this.getProjectNamesByTarget(target);
|
||||
if (!projectNames) {
|
||||
return this.onMissingTarget('Cannot determine project or target for command.');
|
||||
}
|
||||
for (const project of projectNames) {
|
||||
result |= await this.runSingleTarget({ configuration, target, project }, architectOptions);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
else {
|
||||
return await this.runSingleTarget({ configuration, target, project }, architectOptions);
|
||||
}
|
||||
}
|
||||
getArchitectProject() {
|
||||
const { options, positional } = this.context.args;
|
||||
const [, projectName] = positional;
|
||||
if (projectName) {
|
||||
return projectName;
|
||||
}
|
||||
// Yargs allows positional args to be used as flags.
|
||||
if (typeof options['project'] === 'string') {
|
||||
return options['project'];
|
||||
}
|
||||
const target = this.getArchitectTarget();
|
||||
const projectFromTarget = this.getProjectNamesByTarget(target);
|
||||
return projectFromTarget?.length ? projectFromTarget[0] : undefined;
|
||||
}
|
||||
getProjectNamesByTarget(target) {
|
||||
const workspace = this.getWorkspaceOrThrow();
|
||||
const allProjectsForTargetName = [];
|
||||
for (const [name, project] of workspace.projects) {
|
||||
if (project.targets.has(target)) {
|
||||
allProjectsForTargetName.push(name);
|
||||
}
|
||||
}
|
||||
if (allProjectsForTargetName.length === 0) {
|
||||
return undefined;
|
||||
}
|
||||
if (this.multiTarget) {
|
||||
// For multi target commands, we always list all projects that have the target.
|
||||
return allProjectsForTargetName;
|
||||
}
|
||||
else {
|
||||
if (allProjectsForTargetName.length === 1) {
|
||||
return allProjectsForTargetName;
|
||||
}
|
||||
const maybeProject = (0, config_1.getProjectByCwd)(workspace);
|
||||
if (maybeProject) {
|
||||
return allProjectsForTargetName.includes(maybeProject) ? [maybeProject] : undefined;
|
||||
}
|
||||
const { getYargsCompletions, help } = this.context.args.options;
|
||||
if (!getYargsCompletions && !help) {
|
||||
// Only issue the below error when not in help / completion mode.
|
||||
throw new command_module_1.CommandModuleError('Cannot determine project for command.\n' +
|
||||
'This is a multi-project workspace and more than one project supports this command. ' +
|
||||
`Run "ng ${this.command}" to execute the command for a specific project or change the current ` +
|
||||
'working directory to a project directory.\n\n' +
|
||||
`Available projects are:\n${allProjectsForTargetName
|
||||
.sort()
|
||||
.map((p) => `- ${p}`)
|
||||
.join('\n')}`);
|
||||
}
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
/** @returns a sorted list of project names to be used for auto completion. */
|
||||
getProjectChoices() {
|
||||
const { workspace } = this.context;
|
||||
return workspace ? [...workspace.projects.keys()].sort() : undefined;
|
||||
}
|
||||
/** @returns a sorted list of configuration names to be used for auto completion. */
|
||||
getConfigurationChoices(project) {
|
||||
const projectDefinition = this.context.workspace?.projects.get(project);
|
||||
if (!projectDefinition) {
|
||||
return undefined;
|
||||
}
|
||||
const target = this.getArchitectTarget();
|
||||
const configurations = projectDefinition.targets.get(target)?.configurations;
|
||||
return configurations ? Object.keys(configurations).sort() : undefined;
|
||||
}
|
||||
constructor() {
|
||||
super(...arguments);
|
||||
__runInitializers(this, _instanceExtraInitializers);
|
||||
}
|
||||
};
|
||||
})();
|
||||
exports.ArchitectCommandModule = ArchitectCommandModule;
|
||||
101
node_modules/@angular/cli/src/command-builder/command-module.d.ts
generated
vendored
Executable file
101
node_modules/@angular/cli/src/command-builder/command-module.d.ts
generated
vendored
Executable file
|
|
@ -0,0 +1,101 @@
|
|||
/**
|
||||
* @license
|
||||
* Copyright Google LLC All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by an MIT-style license that can be
|
||||
* found in the LICENSE file at https://angular.dev/license
|
||||
*/
|
||||
import { logging } from '@angular-devkit/core';
|
||||
import { ArgumentsCamelCase, Argv, CamelCaseKey, CommandModule as YargsCommandModule } from 'yargs';
|
||||
import { AnalyticsCollector } from '../analytics/analytics-collector';
|
||||
import { EventCustomDimension, EventCustomMetric } from '../analytics/analytics-parameters';
|
||||
import { AngularWorkspace } from '../utilities/config';
|
||||
import { PackageManagerUtils } from '../utilities/package-manager';
|
||||
import { Option } from './utilities/json-schema';
|
||||
export type Options<T> = {
|
||||
[key in keyof T as CamelCaseKey<key>]: T[key];
|
||||
};
|
||||
export declare enum CommandScope {
|
||||
/** Command can only run inside an Angular workspace. */
|
||||
In = 0,
|
||||
/** Command can only run outside an Angular workspace. */
|
||||
Out = 1,
|
||||
/** Command can run inside and outside an Angular workspace. */
|
||||
Both = 2
|
||||
}
|
||||
export interface CommandContext {
|
||||
currentDirectory: string;
|
||||
root: string;
|
||||
workspace?: AngularWorkspace;
|
||||
globalConfiguration: AngularWorkspace;
|
||||
logger: logging.Logger;
|
||||
packageManager: PackageManagerUtils;
|
||||
/** Arguments parsed in free-from without parser configuration. */
|
||||
args: {
|
||||
positional: string[];
|
||||
options: {
|
||||
help: boolean;
|
||||
jsonHelp: boolean;
|
||||
getYargsCompletions: boolean;
|
||||
} & Record<string, unknown>;
|
||||
};
|
||||
}
|
||||
export type OtherOptions = Record<string, unknown>;
|
||||
export interface CommandModuleImplementation<T extends {} = {}> extends Omit<YargsCommandModule<{}, T>, 'builder' | 'handler'> {
|
||||
/** Scope in which the command can be executed in. */
|
||||
scope: CommandScope;
|
||||
/** Path used to load the long description for the command in JSON help text. */
|
||||
longDescriptionPath?: string;
|
||||
/** Object declaring the options the command accepts, or a function accepting and returning a yargs instance. */
|
||||
builder(argv: Argv): Promise<Argv<T>> | Argv<T>;
|
||||
/** A function which will be passed the parsed argv. */
|
||||
run(options: Options<T> & OtherOptions): Promise<number | void> | number | void;
|
||||
}
|
||||
export interface FullDescribe {
|
||||
describe?: string;
|
||||
longDescription?: string;
|
||||
longDescriptionRelativePath?: string;
|
||||
}
|
||||
export declare abstract class CommandModule<T extends {} = {}> implements CommandModuleImplementation<T> {
|
||||
protected readonly context: CommandContext;
|
||||
abstract readonly command: string;
|
||||
abstract readonly describe: string | false;
|
||||
abstract readonly longDescriptionPath?: string;
|
||||
protected readonly shouldReportAnalytics: boolean;
|
||||
readonly scope: CommandScope;
|
||||
private readonly optionsWithAnalytics;
|
||||
constructor(context: CommandContext);
|
||||
/**
|
||||
* Description object which contains the long command descroption.
|
||||
* This is used to generate JSON help wich is used in AIO.
|
||||
*
|
||||
* `false` will result in a hidden command.
|
||||
*/
|
||||
get fullDescribe(): FullDescribe | false;
|
||||
protected get commandName(): string;
|
||||
abstract builder(argv: Argv): Promise<Argv<T>> | Argv<T>;
|
||||
abstract run(options: Options<T> & OtherOptions): Promise<number | void> | number | void;
|
||||
handler(args: ArgumentsCamelCase<T> & OtherOptions): Promise<void>;
|
||||
protected getAnalytics(): Promise<AnalyticsCollector | undefined>;
|
||||
/**
|
||||
* Adds schema options to a command also this keeps track of options that are required for analytics.
|
||||
* **Note:** This method should be called from the command bundler method.
|
||||
*/
|
||||
protected addSchemaOptionsToCommand<T>(localYargs: Argv<T>, options: Option[]): Argv<T>;
|
||||
protected getWorkspaceOrThrow(): AngularWorkspace;
|
||||
/**
|
||||
* Flush on an interval (if the event loop is waiting).
|
||||
*
|
||||
* @returns a method that when called will terminate the periodic
|
||||
* flush and call flush one last time.
|
||||
*/
|
||||
protected getAnalyticsParameters(options: (Options<T> & OtherOptions) | OtherOptions): Partial<Record<EventCustomDimension | EventCustomMetric, string | boolean | number>>;
|
||||
private reportCommandRunAnalytics;
|
||||
private reportWorkspaceInfoAnalytics;
|
||||
}
|
||||
/**
|
||||
* Creates an known command module error.
|
||||
* This is used so during executation we can filter between known validation error and real non handled errors.
|
||||
*/
|
||||
export declare class CommandModuleError extends Error {
|
||||
}
|
||||
307
node_modules/@angular/cli/src/command-builder/command-module.js
generated
vendored
Executable file
307
node_modules/@angular/cli/src/command-builder/command-module.js
generated
vendored
Executable file
|
|
@ -0,0 +1,307 @@
|
|||
"use strict";
|
||||
/**
|
||||
* @license
|
||||
* Copyright Google LLC All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by an MIT-style license that can be
|
||||
* found in the LICENSE file at https://angular.dev/license
|
||||
*/
|
||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
var desc = Object.getOwnPropertyDescriptor(m, k);
|
||||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
||||
desc = { enumerable: true, get: function() { return m[k]; } };
|
||||
}
|
||||
Object.defineProperty(o, k2, desc);
|
||||
}) : (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
o[k2] = m[k];
|
||||
}));
|
||||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
||||
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
||||
}) : function(o, v) {
|
||||
o["default"] = v;
|
||||
});
|
||||
var __runInitializers = (this && this.__runInitializers) || function (thisArg, initializers, value) {
|
||||
var useValue = arguments.length > 2;
|
||||
for (var i = 0; i < initializers.length; i++) {
|
||||
value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);
|
||||
}
|
||||
return useValue ? value : void 0;
|
||||
};
|
||||
var __esDecorate = (this && this.__esDecorate) || function (ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
|
||||
function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; }
|
||||
var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value";
|
||||
var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null;
|
||||
var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});
|
||||
var _, done = false;
|
||||
for (var i = decorators.length - 1; i >= 0; i--) {
|
||||
var context = {};
|
||||
for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p];
|
||||
for (var p in contextIn.access) context.access[p] = contextIn.access[p];
|
||||
context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); };
|
||||
var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);
|
||||
if (kind === "accessor") {
|
||||
if (result === void 0) continue;
|
||||
if (result === null || typeof result !== "object") throw new TypeError("Object expected");
|
||||
if (_ = accept(result.get)) descriptor.get = _;
|
||||
if (_ = accept(result.set)) descriptor.set = _;
|
||||
if (_ = accept(result.init)) initializers.unshift(_);
|
||||
}
|
||||
else if (_ = accept(result)) {
|
||||
if (kind === "field") initializers.unshift(_);
|
||||
else descriptor[key] = _;
|
||||
}
|
||||
}
|
||||
if (target) Object.defineProperty(target, contextIn.name, descriptor);
|
||||
done = true;
|
||||
};
|
||||
var __importStar = (this && this.__importStar) || function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
||||
__setModuleDefault(result, mod);
|
||||
return result;
|
||||
};
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.CommandModuleError = exports.CommandModule = exports.CommandScope = void 0;
|
||||
const core_1 = require("@angular-devkit/core");
|
||||
const fs_1 = require("fs");
|
||||
const path = __importStar(require("path"));
|
||||
const yargs_1 = __importDefault(require("yargs"));
|
||||
const helpers_1 = require("yargs/helpers");
|
||||
const analytics_1 = require("../analytics/analytics");
|
||||
const analytics_collector_1 = require("../analytics/analytics-collector");
|
||||
const analytics_parameters_1 = require("../analytics/analytics-parameters");
|
||||
const completion_1 = require("../utilities/completion");
|
||||
const memoize_1 = require("../utilities/memoize");
|
||||
var CommandScope;
|
||||
(function (CommandScope) {
|
||||
/** Command can only run inside an Angular workspace. */
|
||||
CommandScope[CommandScope["In"] = 0] = "In";
|
||||
/** Command can only run outside an Angular workspace. */
|
||||
CommandScope[CommandScope["Out"] = 1] = "Out";
|
||||
/** Command can run inside and outside an Angular workspace. */
|
||||
CommandScope[CommandScope["Both"] = 2] = "Both";
|
||||
})(CommandScope || (exports.CommandScope = CommandScope = {}));
|
||||
let CommandModule = (() => {
|
||||
let _instanceExtraInitializers = [];
|
||||
let _getAnalytics_decorators;
|
||||
return class CommandModule {
|
||||
static {
|
||||
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(null) : void 0;
|
||||
_getAnalytics_decorators = [memoize_1.memoize];
|
||||
__esDecorate(this, null, _getAnalytics_decorators, { kind: "method", name: "getAnalytics", static: false, private: false, access: { has: obj => "getAnalytics" in obj, get: obj => obj.getAnalytics }, metadata: _metadata }, null, _instanceExtraInitializers);
|
||||
if (_metadata) Object.defineProperty(this, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
||||
}
|
||||
context = __runInitializers(this, _instanceExtraInitializers);
|
||||
shouldReportAnalytics = true;
|
||||
scope = CommandScope.Both;
|
||||
optionsWithAnalytics = new Map();
|
||||
constructor(context) {
|
||||
this.context = context;
|
||||
}
|
||||
/**
|
||||
* Description object which contains the long command descroption.
|
||||
* This is used to generate JSON help wich is used in AIO.
|
||||
*
|
||||
* `false` will result in a hidden command.
|
||||
*/
|
||||
get fullDescribe() {
|
||||
return this.describe === false
|
||||
? false
|
||||
: {
|
||||
describe: this.describe,
|
||||
...(this.longDescriptionPath
|
||||
? {
|
||||
longDescriptionRelativePath: path
|
||||
.relative(path.join(__dirname, '../../../../'), this.longDescriptionPath)
|
||||
.replace(/\\/g, path.posix.sep),
|
||||
longDescription: (0, fs_1.readFileSync)(this.longDescriptionPath, 'utf8').replace(/\r\n/g, '\n'),
|
||||
}
|
||||
: {}),
|
||||
};
|
||||
}
|
||||
get commandName() {
|
||||
return this.command.split(' ', 1)[0];
|
||||
}
|
||||
async handler(args) {
|
||||
const { _, $0, ...options } = args;
|
||||
// Camelize options as yargs will return the object in kebab-case when camel casing is disabled.
|
||||
const camelCasedOptions = {};
|
||||
for (const [key, value] of Object.entries(options)) {
|
||||
camelCasedOptions[helpers_1.Parser.camelCase(key)] = value;
|
||||
}
|
||||
// Set up autocompletion if appropriate.
|
||||
const autocompletionExitCode = await (0, completion_1.considerSettingUpAutocompletion)(this.commandName, this.context.logger);
|
||||
if (autocompletionExitCode !== undefined) {
|
||||
process.exitCode = autocompletionExitCode;
|
||||
return;
|
||||
}
|
||||
// Gather and report analytics.
|
||||
const analytics = await this.getAnalytics();
|
||||
const stopPeriodicFlushes = analytics && analytics.periodFlush();
|
||||
let exitCode;
|
||||
try {
|
||||
if (analytics) {
|
||||
this.reportCommandRunAnalytics(analytics);
|
||||
this.reportWorkspaceInfoAnalytics(analytics);
|
||||
}
|
||||
exitCode = await this.run(camelCasedOptions);
|
||||
}
|
||||
catch (e) {
|
||||
if (e instanceof core_1.schema.SchemaValidationException) {
|
||||
this.context.logger.fatal(`Error: ${e.message}`);
|
||||
exitCode = 1;
|
||||
}
|
||||
else {
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
finally {
|
||||
await stopPeriodicFlushes?.();
|
||||
if (typeof exitCode === 'number' && exitCode > 0) {
|
||||
process.exitCode = exitCode;
|
||||
}
|
||||
}
|
||||
}
|
||||
async getAnalytics() {
|
||||
if (!this.shouldReportAnalytics) {
|
||||
return undefined;
|
||||
}
|
||||
const userId = await (0, analytics_1.getAnalyticsUserId)(this.context,
|
||||
// Don't prompt on `ng update`, 'ng version' or `ng analytics`.
|
||||
['version', 'update', 'analytics'].includes(this.commandName));
|
||||
return userId ? new analytics_collector_1.AnalyticsCollector(this.context, userId) : undefined;
|
||||
}
|
||||
/**
|
||||
* Adds schema options to a command also this keeps track of options that are required for analytics.
|
||||
* **Note:** This method should be called from the command bundler method.
|
||||
*/
|
||||
addSchemaOptionsToCommand(localYargs, options) {
|
||||
const booleanOptionsWithNoPrefix = new Set();
|
||||
for (const option of options) {
|
||||
const { default: defaultVal, positional, deprecated, description, alias, userAnalytics, type, hidden, name, choices, } = option;
|
||||
const sharedOptions = {
|
||||
alias,
|
||||
hidden,
|
||||
description,
|
||||
deprecated,
|
||||
choices,
|
||||
// This should only be done when `--help` is used otherwise default will override options set in angular.json.
|
||||
...(this.context.args.options.help ? { default: defaultVal } : {}),
|
||||
};
|
||||
let dashedName = core_1.strings.dasherize(name);
|
||||
// Handle options which have been defined in the schema with `no` prefix.
|
||||
if (type === 'boolean' && dashedName.startsWith('no-')) {
|
||||
dashedName = dashedName.slice(3);
|
||||
booleanOptionsWithNoPrefix.add(dashedName);
|
||||
}
|
||||
if (positional === undefined) {
|
||||
localYargs = localYargs.option(dashedName, {
|
||||
type,
|
||||
...sharedOptions,
|
||||
});
|
||||
}
|
||||
else {
|
||||
localYargs = localYargs.positional(dashedName, {
|
||||
type: type === 'array' || type === 'count' ? 'string' : type,
|
||||
...sharedOptions,
|
||||
});
|
||||
}
|
||||
// Record option of analytics.
|
||||
if (userAnalytics !== undefined) {
|
||||
this.optionsWithAnalytics.set(name, userAnalytics);
|
||||
}
|
||||
}
|
||||
// Handle options which have been defined in the schema with `no` prefix.
|
||||
if (booleanOptionsWithNoPrefix.size) {
|
||||
localYargs.middleware((options) => {
|
||||
for (const key of booleanOptionsWithNoPrefix) {
|
||||
if (key in options) {
|
||||
options[`no-${key}`] = !options[key];
|
||||
delete options[key];
|
||||
}
|
||||
}
|
||||
}, false);
|
||||
}
|
||||
return localYargs;
|
||||
}
|
||||
getWorkspaceOrThrow() {
|
||||
const { workspace } = this.context;
|
||||
if (!workspace) {
|
||||
throw new CommandModuleError('A workspace is required for this command.');
|
||||
}
|
||||
return workspace;
|
||||
}
|
||||
/**
|
||||
* Flush on an interval (if the event loop is waiting).
|
||||
*
|
||||
* @returns a method that when called will terminate the periodic
|
||||
* flush and call flush one last time.
|
||||
*/
|
||||
getAnalyticsParameters(options) {
|
||||
const parameters = {};
|
||||
const validEventCustomDimensionAndMetrics = new Set([
|
||||
...Object.values(analytics_parameters_1.EventCustomDimension),
|
||||
...Object.values(analytics_parameters_1.EventCustomMetric),
|
||||
]);
|
||||
for (const [name, ua] of this.optionsWithAnalytics) {
|
||||
const value = options[name];
|
||||
if ((typeof value === 'string' || typeof value === 'number' || typeof value === 'boolean') &&
|
||||
validEventCustomDimensionAndMetrics.has(ua)) {
|
||||
parameters[ua] = value;
|
||||
}
|
||||
}
|
||||
return parameters;
|
||||
}
|
||||
reportCommandRunAnalytics(analytics) {
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
const internalMethods = yargs_1.default.getInternalMethods();
|
||||
// $0 generate component [name] -> generate_component
|
||||
// $0 add <collection> -> add
|
||||
const fullCommand = internalMethods.getUsageInstance().getUsage()[0][0]
|
||||
.split(' ')
|
||||
.filter((x) => {
|
||||
const code = x.charCodeAt(0);
|
||||
return code >= 97 && code <= 122;
|
||||
})
|
||||
.join('_');
|
||||
analytics.reportCommandRunEvent(fullCommand);
|
||||
}
|
||||
reportWorkspaceInfoAnalytics(analytics) {
|
||||
const { workspace } = this.context;
|
||||
if (!workspace) {
|
||||
return;
|
||||
}
|
||||
let applicationProjectsCount = 0;
|
||||
let librariesProjectsCount = 0;
|
||||
for (const project of workspace.projects.values()) {
|
||||
switch (project.extensions['projectType']) {
|
||||
case 'application':
|
||||
applicationProjectsCount++;
|
||||
break;
|
||||
case 'library':
|
||||
librariesProjectsCount++;
|
||||
break;
|
||||
}
|
||||
}
|
||||
analytics.reportWorkspaceInfoEvent({
|
||||
[analytics_parameters_1.EventCustomMetric.AllProjectsCount]: librariesProjectsCount + applicationProjectsCount,
|
||||
[analytics_parameters_1.EventCustomMetric.ApplicationProjectsCount]: applicationProjectsCount,
|
||||
[analytics_parameters_1.EventCustomMetric.LibraryProjectsCount]: librariesProjectsCount,
|
||||
});
|
||||
}
|
||||
};
|
||||
})();
|
||||
exports.CommandModule = CommandModule;
|
||||
/**
|
||||
* Creates an known command module error.
|
||||
* This is used so during executation we can filter between known validation error and real non handled errors.
|
||||
*/
|
||||
class CommandModuleError extends Error {
|
||||
}
|
||||
exports.CommandModuleError = CommandModuleError;
|
||||
9
node_modules/@angular/cli/src/command-builder/command-runner.d.ts
generated
vendored
Executable file
9
node_modules/@angular/cli/src/command-builder/command-runner.d.ts
generated
vendored
Executable file
|
|
@ -0,0 +1,9 @@
|
|||
/**
|
||||
* @license
|
||||
* Copyright Google LLC All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by an MIT-style license that can be
|
||||
* found in the LICENSE file at https://angular.dev/license
|
||||
*/
|
||||
import { logging } from '@angular-devkit/core';
|
||||
export declare function runCommand(args: string[], logger: logging.Logger): Promise<number>;
|
||||
139
node_modules/@angular/cli/src/command-builder/command-runner.js
generated
vendored
Executable file
139
node_modules/@angular/cli/src/command-builder/command-runner.js
generated
vendored
Executable file
|
|
@ -0,0 +1,139 @@
|
|||
"use strict";
|
||||
/**
|
||||
* @license
|
||||
* Copyright Google LLC All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by an MIT-style license that can be
|
||||
* found in the LICENSE file at https://angular.dev/license
|
||||
*/
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.runCommand = runCommand;
|
||||
const yargs_1 = __importDefault(require("yargs"));
|
||||
const helpers_1 = require("yargs/helpers");
|
||||
const command_config_1 = require("../commands/command-config");
|
||||
const color_1 = require("../utilities/color");
|
||||
const config_1 = require("../utilities/config");
|
||||
const error_1 = require("../utilities/error");
|
||||
const package_manager_1 = require("../utilities/package-manager");
|
||||
const version_1 = require("../utilities/version");
|
||||
const command_module_1 = require("./command-module");
|
||||
const command_1 = require("./utilities/command");
|
||||
const json_help_1 = require("./utilities/json-help");
|
||||
const normalize_options_middleware_1 = require("./utilities/normalize-options-middleware");
|
||||
const yargsParser = helpers_1.Parser;
|
||||
async function runCommand(args, logger) {
|
||||
const { $0, _, help = false, jsonHelp = false, getYargsCompletions = false, ...rest } = yargsParser(args, {
|
||||
boolean: ['help', 'json-help', 'get-yargs-completions'],
|
||||
alias: { 'collection': 'c' },
|
||||
});
|
||||
// When `getYargsCompletions` is true the scriptName 'ng' at index 0 is not removed.
|
||||
const positional = getYargsCompletions ? _.slice(1) : _;
|
||||
let workspace;
|
||||
let globalConfiguration;
|
||||
try {
|
||||
[workspace, globalConfiguration] = await Promise.all([
|
||||
(0, config_1.getWorkspace)('local'),
|
||||
(0, config_1.getWorkspace)('global'),
|
||||
]);
|
||||
}
|
||||
catch (e) {
|
||||
(0, error_1.assertIsError)(e);
|
||||
logger.fatal(e.message);
|
||||
return 1;
|
||||
}
|
||||
const root = workspace?.basePath ?? process.cwd();
|
||||
const context = {
|
||||
globalConfiguration,
|
||||
workspace,
|
||||
logger,
|
||||
currentDirectory: process.cwd(),
|
||||
root,
|
||||
packageManager: new package_manager_1.PackageManagerUtils({ globalConfiguration, workspace, root }),
|
||||
args: {
|
||||
positional: positional.map((v) => v.toString()),
|
||||
options: {
|
||||
help,
|
||||
jsonHelp,
|
||||
getYargsCompletions,
|
||||
...rest,
|
||||
},
|
||||
},
|
||||
};
|
||||
let localYargs = (0, yargs_1.default)(args);
|
||||
for (const CommandModule of await getCommandsToRegister(positional[0])) {
|
||||
localYargs = (0, command_1.addCommandModuleToYargs)(localYargs, CommandModule, context);
|
||||
}
|
||||
if (jsonHelp) {
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
const usageInstance = localYargs.getInternalMethods().getUsageInstance();
|
||||
usageInstance.help = () => (0, json_help_1.jsonHelpUsage)();
|
||||
}
|
||||
// Add default command to support version option when no subcommand is specified
|
||||
localYargs.command('*', false, (builder) => builder.version('version', 'Show Angular CLI version.', version_1.VERSION.full));
|
||||
await localYargs
|
||||
.scriptName('ng')
|
||||
// https://github.com/yargs/yargs/blob/main/docs/advanced.md#customizing-yargs-parser
|
||||
.parserConfiguration({
|
||||
'populate--': true,
|
||||
'unknown-options-as-args': false,
|
||||
'dot-notation': false,
|
||||
'boolean-negation': true,
|
||||
'strip-aliased': true,
|
||||
'strip-dashed': true,
|
||||
'camel-case-expansion': false,
|
||||
})
|
||||
.option('json-help', {
|
||||
describe: 'Show help in JSON format.',
|
||||
implies: ['help'],
|
||||
hidden: true,
|
||||
type: 'boolean',
|
||||
})
|
||||
.help('help', 'Shows a help message for this command in the console.')
|
||||
// A complete list of strings can be found: https://github.com/yargs/yargs/blob/main/locales/en.json
|
||||
.updateStrings({
|
||||
'Commands:': color_1.colors.cyan('Commands:'),
|
||||
'Options:': color_1.colors.cyan('Options:'),
|
||||
'Positionals:': color_1.colors.cyan('Arguments:'),
|
||||
'deprecated': color_1.colors.yellow('deprecated'),
|
||||
'deprecated: %s': color_1.colors.yellow('deprecated:') + ' %s',
|
||||
'Did you mean %s?': 'Unknown command. Did you mean %s?',
|
||||
})
|
||||
.epilogue('For more information, see https://angular.dev/cli/.\n')
|
||||
.demandCommand(1, command_1.demandCommandFailureMessage)
|
||||
.recommendCommands()
|
||||
.middleware(normalize_options_middleware_1.normalizeOptionsMiddleware)
|
||||
.version(false)
|
||||
.showHelpOnFail(false)
|
||||
.strict()
|
||||
.fail((msg, err) => {
|
||||
throw msg
|
||||
? // Validation failed example: `Unknown argument:`
|
||||
new command_module_1.CommandModuleError(msg)
|
||||
: // Unknown exception, re-throw.
|
||||
err;
|
||||
})
|
||||
.wrap(yargs_1.default.terminalWidth())
|
||||
.parseAsync();
|
||||
return process.exitCode ?? 0;
|
||||
}
|
||||
/**
|
||||
* Get the commands that need to be registered.
|
||||
* @returns One or more command factories that needs to be registered.
|
||||
*/
|
||||
async function getCommandsToRegister(commandName) {
|
||||
const commands = [];
|
||||
if (commandName in command_config_1.RootCommands) {
|
||||
commands.push(command_config_1.RootCommands[commandName]);
|
||||
}
|
||||
else if (commandName in command_config_1.RootCommandsAliases) {
|
||||
commands.push(command_config_1.RootCommandsAliases[commandName]);
|
||||
}
|
||||
else {
|
||||
// Unknown command, register every possible command.
|
||||
Object.values(command_config_1.RootCommands).forEach((c) => commands.push(c));
|
||||
}
|
||||
return Promise.all(commands.map((command) => command.factory().then((m) => m.default)));
|
||||
}
|
||||
41
node_modules/@angular/cli/src/command-builder/schematics-command-module.d.ts
generated
vendored
Executable file
41
node_modules/@angular/cli/src/command-builder/schematics-command-module.d.ts
generated
vendored
Executable file
|
|
@ -0,0 +1,41 @@
|
|||
/**
|
||||
* @license
|
||||
* Copyright Google LLC All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by an MIT-style license that can be
|
||||
* found in the LICENSE file at https://angular.dev/license
|
||||
*/
|
||||
import { Collection } from '@angular-devkit/schematics';
|
||||
import { FileSystemCollectionDescription, FileSystemSchematicDescription, NodeWorkflow } from '@angular-devkit/schematics/tools';
|
||||
import { Argv } from 'yargs';
|
||||
import { CommandModule, CommandModuleImplementation, CommandScope, Options, OtherOptions } from './command-module';
|
||||
import { Option } from './utilities/json-schema';
|
||||
export declare const DEFAULT_SCHEMATICS_COLLECTION = "@schematics/angular";
|
||||
export interface SchematicsCommandArgs {
|
||||
interactive: boolean;
|
||||
force: boolean;
|
||||
'dry-run': boolean;
|
||||
defaults: boolean;
|
||||
}
|
||||
export interface SchematicsExecutionOptions extends Options<SchematicsCommandArgs> {
|
||||
packageRegistry?: string;
|
||||
}
|
||||
export declare abstract class SchematicsCommandModule extends CommandModule<SchematicsCommandArgs> implements CommandModuleImplementation<SchematicsCommandArgs> {
|
||||
scope: CommandScope;
|
||||
protected readonly allowPrivateSchematics: boolean;
|
||||
builder(argv: Argv): Promise<Argv<SchematicsCommandArgs>>;
|
||||
/** Get schematic schema options.*/
|
||||
protected getSchematicOptions(collection: Collection<FileSystemCollectionDescription, FileSystemSchematicDescription>, schematicName: string, workflow: NodeWorkflow): Promise<Option[]>;
|
||||
protected getOrCreateWorkflowForBuilder(collectionName: string): NodeWorkflow;
|
||||
protected getOrCreateWorkflowForExecution(collectionName: string, options: SchematicsExecutionOptions): Promise<NodeWorkflow>;
|
||||
protected getSchematicCollections(): Promise<Set<string>>;
|
||||
protected parseSchematicInfo(schematic: string | undefined): [collectionName: string | undefined, schematicName: string | undefined];
|
||||
protected runSchematic(options: {
|
||||
executionOptions: SchematicsExecutionOptions;
|
||||
schematicOptions: OtherOptions;
|
||||
collectionName: string;
|
||||
schematicName: string;
|
||||
}): Promise<number>;
|
||||
private getProjectName;
|
||||
private getResolvePaths;
|
||||
}
|
||||
382
node_modules/@angular/cli/src/command-builder/schematics-command-module.js
generated
vendored
Executable file
382
node_modules/@angular/cli/src/command-builder/schematics-command-module.js
generated
vendored
Executable file
|
|
@ -0,0 +1,382 @@
|
|||
"use strict";
|
||||
/**
|
||||
* @license
|
||||
* Copyright Google LLC All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by an MIT-style license that can be
|
||||
* found in the LICENSE file at https://angular.dev/license
|
||||
*/
|
||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
var desc = Object.getOwnPropertyDescriptor(m, k);
|
||||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
||||
desc = { enumerable: true, get: function() { return m[k]; } };
|
||||
}
|
||||
Object.defineProperty(o, k2, desc);
|
||||
}) : (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
o[k2] = m[k];
|
||||
}));
|
||||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
||||
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
||||
}) : function(o, v) {
|
||||
o["default"] = v;
|
||||
});
|
||||
var __runInitializers = (this && this.__runInitializers) || function (thisArg, initializers, value) {
|
||||
var useValue = arguments.length > 2;
|
||||
for (var i = 0; i < initializers.length; i++) {
|
||||
value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);
|
||||
}
|
||||
return useValue ? value : void 0;
|
||||
};
|
||||
var __esDecorate = (this && this.__esDecorate) || function (ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
|
||||
function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; }
|
||||
var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value";
|
||||
var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null;
|
||||
var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});
|
||||
var _, done = false;
|
||||
for (var i = decorators.length - 1; i >= 0; i--) {
|
||||
var context = {};
|
||||
for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p];
|
||||
for (var p in contextIn.access) context.access[p] = contextIn.access[p];
|
||||
context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); };
|
||||
var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);
|
||||
if (kind === "accessor") {
|
||||
if (result === void 0) continue;
|
||||
if (result === null || typeof result !== "object") throw new TypeError("Object expected");
|
||||
if (_ = accept(result.get)) descriptor.get = _;
|
||||
if (_ = accept(result.set)) descriptor.set = _;
|
||||
if (_ = accept(result.init)) initializers.unshift(_);
|
||||
}
|
||||
else if (_ = accept(result)) {
|
||||
if (kind === "field") initializers.unshift(_);
|
||||
else descriptor[key] = _;
|
||||
}
|
||||
}
|
||||
if (target) Object.defineProperty(target, contextIn.name, descriptor);
|
||||
done = true;
|
||||
};
|
||||
var __importStar = (this && this.__importStar) || function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
||||
__setModuleDefault(result, mod);
|
||||
return result;
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.SchematicsCommandModule = exports.DEFAULT_SCHEMATICS_COLLECTION = void 0;
|
||||
const core_1 = require("@angular-devkit/core");
|
||||
const schematics_1 = require("@angular-devkit/schematics");
|
||||
const tools_1 = require("@angular-devkit/schematics/tools");
|
||||
const path_1 = require("path");
|
||||
const analytics_1 = require("../analytics/analytics");
|
||||
const analytics_parameters_1 = require("../analytics/analytics-parameters");
|
||||
const config_1 = require("../utilities/config");
|
||||
const error_1 = require("../utilities/error");
|
||||
const memoize_1 = require("../utilities/memoize");
|
||||
const tty_1 = require("../utilities/tty");
|
||||
const command_module_1 = require("./command-module");
|
||||
const json_schema_1 = require("./utilities/json-schema");
|
||||
const schematic_engine_host_1 = require("./utilities/schematic-engine-host");
|
||||
const schematic_workflow_1 = require("./utilities/schematic-workflow");
|
||||
exports.DEFAULT_SCHEMATICS_COLLECTION = '@schematics/angular';
|
||||
let SchematicsCommandModule = (() => {
|
||||
let _classSuper = command_module_1.CommandModule;
|
||||
let _instanceExtraInitializers = [];
|
||||
let _getOrCreateWorkflowForBuilder_decorators;
|
||||
let _getOrCreateWorkflowForExecution_decorators;
|
||||
let _getSchematicCollections_decorators;
|
||||
return class SchematicsCommandModule extends _classSuper {
|
||||
static {
|
||||
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
|
||||
_getOrCreateWorkflowForBuilder_decorators = [memoize_1.memoize];
|
||||
_getOrCreateWorkflowForExecution_decorators = [memoize_1.memoize];
|
||||
_getSchematicCollections_decorators = [memoize_1.memoize];
|
||||
__esDecorate(this, null, _getOrCreateWorkflowForBuilder_decorators, { kind: "method", name: "getOrCreateWorkflowForBuilder", static: false, private: false, access: { has: obj => "getOrCreateWorkflowForBuilder" in obj, get: obj => obj.getOrCreateWorkflowForBuilder }, metadata: _metadata }, null, _instanceExtraInitializers);
|
||||
__esDecorate(this, null, _getOrCreateWorkflowForExecution_decorators, { kind: "method", name: "getOrCreateWorkflowForExecution", static: false, private: false, access: { has: obj => "getOrCreateWorkflowForExecution" in obj, get: obj => obj.getOrCreateWorkflowForExecution }, metadata: _metadata }, null, _instanceExtraInitializers);
|
||||
__esDecorate(this, null, _getSchematicCollections_decorators, { kind: "method", name: "getSchematicCollections", static: false, private: false, access: { has: obj => "getSchematicCollections" in obj, get: obj => obj.getSchematicCollections }, metadata: _metadata }, null, _instanceExtraInitializers);
|
||||
if (_metadata) Object.defineProperty(this, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
||||
}
|
||||
scope = (__runInitializers(this, _instanceExtraInitializers), command_module_1.CommandScope.In);
|
||||
allowPrivateSchematics = false;
|
||||
async builder(argv) {
|
||||
return argv
|
||||
.option('interactive', {
|
||||
describe: 'Enable interactive input prompts.',
|
||||
type: 'boolean',
|
||||
default: true,
|
||||
})
|
||||
.option('dry-run', {
|
||||
describe: 'Run through and reports activity without writing out results.',
|
||||
type: 'boolean',
|
||||
alias: ['d'],
|
||||
default: false,
|
||||
})
|
||||
.option('defaults', {
|
||||
describe: 'Disable interactive input prompts for options with a default.',
|
||||
type: 'boolean',
|
||||
default: false,
|
||||
})
|
||||
.option('force', {
|
||||
describe: 'Force overwriting of existing files.',
|
||||
type: 'boolean',
|
||||
default: false,
|
||||
})
|
||||
.strict();
|
||||
}
|
||||
/** Get schematic schema options.*/
|
||||
async getSchematicOptions(collection, schematicName, workflow) {
|
||||
const schematic = collection.createSchematic(schematicName, true);
|
||||
const { schemaJson } = schematic.description;
|
||||
if (!schemaJson) {
|
||||
return [];
|
||||
}
|
||||
return (0, json_schema_1.parseJsonSchemaToOptions)(workflow.registry, schemaJson);
|
||||
}
|
||||
getOrCreateWorkflowForBuilder(collectionName) {
|
||||
return new tools_1.NodeWorkflow(this.context.root, {
|
||||
resolvePaths: this.getResolvePaths(collectionName),
|
||||
engineHostCreator: (options) => new schematic_engine_host_1.SchematicEngineHost(options.resolvePaths),
|
||||
});
|
||||
}
|
||||
async getOrCreateWorkflowForExecution(collectionName, options) {
|
||||
const { logger, root, packageManager } = this.context;
|
||||
const { force, dryRun, packageRegistry } = options;
|
||||
const workflow = new tools_1.NodeWorkflow(root, {
|
||||
force,
|
||||
dryRun,
|
||||
packageManager: packageManager.name,
|
||||
// A schema registry is required to allow customizing addUndefinedDefaults
|
||||
registry: new core_1.schema.CoreSchemaRegistry(schematics_1.formats.standardFormats),
|
||||
packageRegistry,
|
||||
resolvePaths: this.getResolvePaths(collectionName),
|
||||
schemaValidation: true,
|
||||
optionTransforms: [
|
||||
// Add configuration file defaults
|
||||
async (schematic, current) => {
|
||||
const projectName = typeof current?.project === 'string' ? current.project : this.getProjectName();
|
||||
return {
|
||||
...(await (0, config_1.getSchematicDefaults)(schematic.collection.name, schematic.name, projectName)),
|
||||
...current,
|
||||
};
|
||||
},
|
||||
],
|
||||
engineHostCreator: (options) => new schematic_engine_host_1.SchematicEngineHost(options.resolvePaths),
|
||||
});
|
||||
workflow.registry.addPostTransform(core_1.schema.transforms.addUndefinedDefaults);
|
||||
workflow.registry.useXDeprecatedProvider((msg) => logger.warn(msg));
|
||||
workflow.registry.addSmartDefaultProvider('projectName', () => this.getProjectName());
|
||||
const workingDir = (0, core_1.normalize)((0, path_1.relative)(this.context.root, process.cwd()));
|
||||
workflow.registry.addSmartDefaultProvider('workingDirectory', () => workingDir === '' ? undefined : workingDir);
|
||||
let shouldReportAnalytics = true;
|
||||
workflow.engineHost.registerOptionsTransform(async (schematic, options) => {
|
||||
// Report analytics
|
||||
if (shouldReportAnalytics) {
|
||||
shouldReportAnalytics = false;
|
||||
const { collection: { name: collectionName }, name: schematicName, } = schematic;
|
||||
const analytics = (0, analytics_1.isPackageNameSafeForAnalytics)(collectionName)
|
||||
? await this.getAnalytics()
|
||||
: undefined;
|
||||
analytics?.reportSchematicRunEvent({
|
||||
[analytics_parameters_1.EventCustomDimension.SchematicCollectionName]: collectionName,
|
||||
[analytics_parameters_1.EventCustomDimension.SchematicName]: schematicName,
|
||||
...this.getAnalyticsParameters(options),
|
||||
});
|
||||
}
|
||||
return options;
|
||||
});
|
||||
if (options.interactive !== false && (0, tty_1.isTTY)()) {
|
||||
workflow.registry.usePromptProvider(async (definitions) => {
|
||||
let prompts;
|
||||
const answers = {};
|
||||
for (const definition of definitions) {
|
||||
if (options.defaults && definition.default !== undefined) {
|
||||
continue;
|
||||
}
|
||||
// Only load prompt package if needed
|
||||
prompts ??= await Promise.resolve().then(() => __importStar(require('@inquirer/prompts')));
|
||||
switch (definition.type) {
|
||||
case 'confirmation':
|
||||
answers[definition.id] = await prompts.confirm({
|
||||
message: definition.message,
|
||||
default: definition.default,
|
||||
});
|
||||
break;
|
||||
case 'list':
|
||||
if (!definition.items?.length) {
|
||||
continue;
|
||||
}
|
||||
answers[definition.id] = await (definition.multiselect ? prompts.checkbox : prompts.select)({
|
||||
message: definition.message,
|
||||
validate: (values) => {
|
||||
if (!definition.validator) {
|
||||
return true;
|
||||
}
|
||||
return definition.validator(Object.values(values).map(({ value }) => value));
|
||||
},
|
||||
default: definition.default,
|
||||
choices: definition.items?.map((item) => typeof item == 'string'
|
||||
? {
|
||||
name: item,
|
||||
value: item,
|
||||
}
|
||||
: {
|
||||
name: item.label,
|
||||
value: item.value,
|
||||
}),
|
||||
});
|
||||
break;
|
||||
case 'input': {
|
||||
let finalValue;
|
||||
answers[definition.id] = await prompts.input({
|
||||
message: definition.message,
|
||||
default: definition.default,
|
||||
async validate(value) {
|
||||
if (definition.validator === undefined) {
|
||||
return true;
|
||||
}
|
||||
let lastValidation = false;
|
||||
for (const type of definition.propertyTypes) {
|
||||
let potential;
|
||||
switch (type) {
|
||||
case 'string':
|
||||
potential = String(value);
|
||||
break;
|
||||
case 'integer':
|
||||
case 'number':
|
||||
potential = Number(value);
|
||||
break;
|
||||
default:
|
||||
potential = value;
|
||||
break;
|
||||
}
|
||||
lastValidation = await definition.validator(potential);
|
||||
// Can be a string if validation fails
|
||||
if (lastValidation === true) {
|
||||
finalValue = potential;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return lastValidation;
|
||||
},
|
||||
});
|
||||
// Use validated value if present.
|
||||
// This ensures the correct type is inserted into the final schema options.
|
||||
if (finalValue !== undefined) {
|
||||
answers[definition.id] = finalValue;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return answers;
|
||||
});
|
||||
}
|
||||
return workflow;
|
||||
}
|
||||
async getSchematicCollections() {
|
||||
// Resolve relative collections from the location of `angular.json`
|
||||
const resolveRelativeCollection = (collectionName) => collectionName.charAt(0) === '.'
|
||||
? (0, path_1.resolve)(this.context.root, collectionName)
|
||||
: collectionName;
|
||||
const getSchematicCollections = (configSection) => {
|
||||
if (!configSection) {
|
||||
return undefined;
|
||||
}
|
||||
const { schematicCollections } = configSection;
|
||||
if (Array.isArray(schematicCollections)) {
|
||||
return new Set(schematicCollections.map((c) => resolveRelativeCollection(c)));
|
||||
}
|
||||
return undefined;
|
||||
};
|
||||
const { workspace, globalConfiguration } = this.context;
|
||||
if (workspace) {
|
||||
const project = (0, config_1.getProjectByCwd)(workspace);
|
||||
if (project) {
|
||||
const value = getSchematicCollections(workspace.getProjectCli(project));
|
||||
if (value) {
|
||||
return value;
|
||||
}
|
||||
}
|
||||
}
|
||||
const value = getSchematicCollections(workspace?.getCli()) ??
|
||||
getSchematicCollections(globalConfiguration.getCli());
|
||||
if (value) {
|
||||
return value;
|
||||
}
|
||||
return new Set([exports.DEFAULT_SCHEMATICS_COLLECTION]);
|
||||
}
|
||||
parseSchematicInfo(schematic) {
|
||||
if (schematic?.includes(':')) {
|
||||
const [collectionName, schematicName] = schematic.split(':', 2);
|
||||
return [collectionName, schematicName];
|
||||
}
|
||||
return [undefined, schematic];
|
||||
}
|
||||
async runSchematic(options) {
|
||||
const { logger } = this.context;
|
||||
const { schematicOptions, executionOptions, collectionName, schematicName } = options;
|
||||
const workflow = await this.getOrCreateWorkflowForExecution(collectionName, executionOptions);
|
||||
if (!schematicName) {
|
||||
throw new Error('schematicName cannot be undefined.');
|
||||
}
|
||||
const { unsubscribe, files } = (0, schematic_workflow_1.subscribeToWorkflow)(workflow, logger);
|
||||
try {
|
||||
await workflow
|
||||
.execute({
|
||||
collection: collectionName,
|
||||
schematic: schematicName,
|
||||
options: schematicOptions,
|
||||
logger,
|
||||
allowPrivate: this.allowPrivateSchematics,
|
||||
})
|
||||
.toPromise();
|
||||
if (!files.size) {
|
||||
logger.info('Nothing to be done.');
|
||||
}
|
||||
if (executionOptions.dryRun) {
|
||||
logger.warn(`\nNOTE: The "--dry-run" option means no changes were made.`);
|
||||
}
|
||||
}
|
||||
catch (err) {
|
||||
// In case the workflow was not successful, show an appropriate error message.
|
||||
if (err instanceof schematics_1.UnsuccessfulWorkflowExecution) {
|
||||
// "See above" because we already printed the error.
|
||||
logger.fatal('The Schematic workflow failed. See above.');
|
||||
}
|
||||
else {
|
||||
(0, error_1.assertIsError)(err);
|
||||
logger.fatal(err.message);
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
finally {
|
||||
unsubscribe();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
getProjectName() {
|
||||
const { workspace, logger } = this.context;
|
||||
if (!workspace) {
|
||||
return undefined;
|
||||
}
|
||||
const projectName = (0, config_1.getProjectByCwd)(workspace);
|
||||
if (projectName) {
|
||||
return projectName;
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
getResolvePaths(collectionName) {
|
||||
const { workspace, root } = this.context;
|
||||
return workspace
|
||||
? // Workspace
|
||||
collectionName === exports.DEFAULT_SCHEMATICS_COLLECTION
|
||||
? // Favor __dirname for @schematics/angular to use the build-in version
|
||||
[__dirname, process.cwd(), root]
|
||||
: [process.cwd(), root, __dirname]
|
||||
: // Global
|
||||
[__dirname, process.cwd()];
|
||||
}
|
||||
};
|
||||
})();
|
||||
exports.SchematicsCommandModule = SchematicsCommandModule;
|
||||
14
node_modules/@angular/cli/src/command-builder/utilities/command.d.ts
generated
vendored
Executable file
14
node_modules/@angular/cli/src/command-builder/utilities/command.d.ts
generated
vendored
Executable file
|
|
@ -0,0 +1,14 @@
|
|||
/**
|
||||
* @license
|
||||
* Copyright Google LLC All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by an MIT-style license that can be
|
||||
* found in the LICENSE file at https://angular.dev/license
|
||||
*/
|
||||
import { Argv } from 'yargs';
|
||||
import { CommandContext, CommandModule, CommandModuleImplementation } from '../command-module';
|
||||
export declare const demandCommandFailureMessage = "You need to specify a command before moving on. Use '--help' to view the available commands.";
|
||||
export type CommandModuleConstructor = Partial<CommandModuleImplementation> & {
|
||||
new (context: CommandContext): Partial<CommandModuleImplementation> & CommandModule;
|
||||
};
|
||||
export declare function addCommandModuleToYargs<T extends object, U extends CommandModuleConstructor>(localYargs: Argv<T>, commandModule: U, context: CommandContext): Argv<T>;
|
||||
38
node_modules/@angular/cli/src/command-builder/utilities/command.js
generated
vendored
Executable file
38
node_modules/@angular/cli/src/command-builder/utilities/command.js
generated
vendored
Executable file
|
|
@ -0,0 +1,38 @@
|
|||
"use strict";
|
||||
/**
|
||||
* @license
|
||||
* Copyright Google LLC All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by an MIT-style license that can be
|
||||
* found in the LICENSE file at https://angular.dev/license
|
||||
*/
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.demandCommandFailureMessage = void 0;
|
||||
exports.addCommandModuleToYargs = addCommandModuleToYargs;
|
||||
const command_module_1 = require("../command-module");
|
||||
exports.demandCommandFailureMessage = `You need to specify a command before moving on. Use '--help' to view the available commands.`;
|
||||
function addCommandModuleToYargs(localYargs, commandModule, context) {
|
||||
const cmd = new commandModule(context);
|
||||
const { args: { options: { jsonHelp }, }, workspace, } = context;
|
||||
const describe = jsonHelp ? cmd.fullDescribe : cmd.describe;
|
||||
return localYargs.command({
|
||||
command: cmd.command,
|
||||
aliases: cmd.aliases,
|
||||
describe:
|
||||
// We cannot add custom fields in help, such as long command description which is used in AIO.
|
||||
// Therefore, we get around this by adding a complex object as a string which we later parse when generating the help files.
|
||||
typeof describe === 'object' ? JSON.stringify(describe) : describe,
|
||||
deprecated: cmd.deprecated,
|
||||
builder: (argv) => {
|
||||
// Skip scope validation when running with '--json-help' since it's easier to generate the output for all commands this way.
|
||||
const isInvalidScope = !jsonHelp &&
|
||||
((cmd.scope === command_module_1.CommandScope.In && !workspace) ||
|
||||
(cmd.scope === command_module_1.CommandScope.Out && workspace));
|
||||
if (isInvalidScope) {
|
||||
throw new command_module_1.CommandModuleError(`This command is not available when running the Angular CLI ${workspace ? 'inside' : 'outside'} a workspace.`);
|
||||
}
|
||||
return cmd.builder(argv);
|
||||
},
|
||||
handler: (args) => cmd.handler(args),
|
||||
});
|
||||
}
|
||||
36
node_modules/@angular/cli/src/command-builder/utilities/json-help.d.ts
generated
vendored
Executable file
36
node_modules/@angular/cli/src/command-builder/utilities/json-help.d.ts
generated
vendored
Executable file
|
|
@ -0,0 +1,36 @@
|
|||
/**
|
||||
* @license
|
||||
* Copyright Google LLC All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by an MIT-style license that can be
|
||||
* found in the LICENSE file at https://angular.dev/license
|
||||
*/
|
||||
interface JsonHelpOption {
|
||||
name: string;
|
||||
type?: string;
|
||||
deprecated: boolean | string;
|
||||
aliases?: string[];
|
||||
default?: string;
|
||||
required?: boolean;
|
||||
positional?: number;
|
||||
enum?: string[];
|
||||
description?: string;
|
||||
}
|
||||
interface JsonHelpDescription {
|
||||
shortDescription?: string;
|
||||
longDescription?: string;
|
||||
longDescriptionRelativePath?: string;
|
||||
}
|
||||
interface JsonHelpSubcommand extends JsonHelpDescription {
|
||||
name: string;
|
||||
aliases: string[];
|
||||
deprecated: string | boolean;
|
||||
}
|
||||
export interface JsonHelp extends JsonHelpDescription {
|
||||
name: string;
|
||||
command: string;
|
||||
options: JsonHelpOption[];
|
||||
subcommands?: JsonHelpSubcommand[];
|
||||
}
|
||||
export declare function jsonHelpUsage(): string;
|
||||
export {};
|
||||
92
node_modules/@angular/cli/src/command-builder/utilities/json-help.js
generated
vendored
Executable file
92
node_modules/@angular/cli/src/command-builder/utilities/json-help.js
generated
vendored
Executable file
|
|
@ -0,0 +1,92 @@
|
|||
"use strict";
|
||||
/**
|
||||
* @license
|
||||
* Copyright Google LLC All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by an MIT-style license that can be
|
||||
* found in the LICENSE file at https://angular.dev/license
|
||||
*/
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.jsonHelpUsage = jsonHelpUsage;
|
||||
const yargs_1 = __importDefault(require("yargs"));
|
||||
const yargsDefaultCommandRegExp = /^\$0|\*/;
|
||||
function jsonHelpUsage() {
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
const localYargs = yargs_1.default;
|
||||
const { deprecatedOptions, alias: aliases, array, string, boolean, number, choices, demandedOptions, default: defaultVal, hiddenOptions = [], } = localYargs.getOptions();
|
||||
const internalMethods = localYargs.getInternalMethods();
|
||||
const usageInstance = internalMethods.getUsageInstance();
|
||||
const context = internalMethods.getContext();
|
||||
const descriptions = usageInstance.getDescriptions();
|
||||
const groups = localYargs.getGroups();
|
||||
const positional = groups[usageInstance.getPositionalGroupName()];
|
||||
const hidden = new Set(hiddenOptions);
|
||||
const normalizeOptions = [];
|
||||
const allAliases = new Set([...Object.values(aliases).flat()]);
|
||||
for (const [names, type] of [
|
||||
[array, 'array'],
|
||||
[string, 'string'],
|
||||
[boolean, 'boolean'],
|
||||
[number, 'number'],
|
||||
]) {
|
||||
for (const name of names) {
|
||||
if (allAliases.has(name) || hidden.has(name)) {
|
||||
// Ignore hidden, aliases and already visited option.
|
||||
continue;
|
||||
}
|
||||
const positionalIndex = positional?.indexOf(name) ?? -1;
|
||||
const alias = aliases[name];
|
||||
normalizeOptions.push({
|
||||
name,
|
||||
type,
|
||||
deprecated: deprecatedOptions[name],
|
||||
aliases: alias?.length > 0 ? alias : undefined,
|
||||
default: defaultVal[name],
|
||||
required: demandedOptions[name],
|
||||
enum: choices[name],
|
||||
description: descriptions[name]?.replace('__yargsString__:', ''),
|
||||
positional: positionalIndex >= 0 ? positionalIndex : undefined,
|
||||
});
|
||||
}
|
||||
}
|
||||
// https://github.com/yargs/yargs/blob/00e4ebbe3acd438e73fdb101e75b4f879eb6d345/lib/usage.ts#L124
|
||||
const subcommands = usageInstance.getCommands()
|
||||
.map(([name, rawDescription, isDefault, aliases, deprecated]) => ({
|
||||
name: name.split(' ', 1)[0].replace(yargsDefaultCommandRegExp, ''),
|
||||
command: name.replace(yargsDefaultCommandRegExp, ''),
|
||||
default: isDefault || undefined,
|
||||
...parseDescription(rawDescription),
|
||||
aliases,
|
||||
deprecated,
|
||||
}))
|
||||
.sort((a, b) => a.name.localeCompare(b.name));
|
||||
const [command, rawDescription] = usageInstance.getUsage()[0] ?? [];
|
||||
const defaultSubCommand = subcommands.find((x) => x.default)?.command ?? '';
|
||||
const otherSubcommands = subcommands.filter((s) => !s.default);
|
||||
const output = {
|
||||
name: [...context.commands].pop(),
|
||||
command: `${command?.replace(yargsDefaultCommandRegExp, localYargs['$0'])}${defaultSubCommand}`,
|
||||
...parseDescription(rawDescription),
|
||||
options: normalizeOptions.sort((a, b) => a.name.localeCompare(b.name)),
|
||||
subcommands: otherSubcommands.length ? otherSubcommands : undefined,
|
||||
};
|
||||
return JSON.stringify(output, undefined, 2);
|
||||
}
|
||||
function parseDescription(rawDescription) {
|
||||
try {
|
||||
const { longDescription, describe: shortDescription, longDescriptionRelativePath, } = JSON.parse(rawDescription);
|
||||
return {
|
||||
shortDescription,
|
||||
longDescriptionRelativePath,
|
||||
longDescription,
|
||||
};
|
||||
}
|
||||
catch {
|
||||
return {
|
||||
shortDescription: rawDescription,
|
||||
};
|
||||
}
|
||||
}
|
||||
40
node_modules/@angular/cli/src/command-builder/utilities/json-schema.d.ts
generated
vendored
Executable file
40
node_modules/@angular/cli/src/command-builder/utilities/json-schema.d.ts
generated
vendored
Executable file
|
|
@ -0,0 +1,40 @@
|
|||
/**
|
||||
* @license
|
||||
* Copyright Google LLC All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by an MIT-style license that can be
|
||||
* found in the LICENSE file at https://angular.dev/license
|
||||
*/
|
||||
import { json } from '@angular-devkit/core';
|
||||
import yargs from 'yargs';
|
||||
/**
|
||||
* An option description.
|
||||
*/
|
||||
export interface Option extends yargs.Options {
|
||||
/**
|
||||
* The name of the option.
|
||||
*/
|
||||
name: string;
|
||||
/**
|
||||
* Whether this option is required or not.
|
||||
*/
|
||||
required?: boolean;
|
||||
/**
|
||||
* Format field of this option.
|
||||
*/
|
||||
format?: string;
|
||||
/**
|
||||
* Whether this option should be hidden from the help output. It will still show up in JSON help.
|
||||
*/
|
||||
hidden?: boolean;
|
||||
/**
|
||||
* If this option can be used as an argument, the position of the argument. Otherwise omitted.
|
||||
*/
|
||||
positional?: number;
|
||||
/**
|
||||
* Whether or not to report this option to the Angular Team, and which custom field to use.
|
||||
* If this is falsey, do not report this option.
|
||||
*/
|
||||
userAnalytics?: string;
|
||||
}
|
||||
export declare function parseJsonSchemaToOptions(registry: json.schema.SchemaRegistry, schema: json.JsonObject, interactive?: boolean): Promise<Option[]>;
|
||||
143
node_modules/@angular/cli/src/command-builder/utilities/json-schema.js
generated
vendored
Executable file
143
node_modules/@angular/cli/src/command-builder/utilities/json-schema.js
generated
vendored
Executable file
|
|
@ -0,0 +1,143 @@
|
|||
"use strict";
|
||||
/**
|
||||
* @license
|
||||
* Copyright Google LLC All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by an MIT-style license that can be
|
||||
* found in the LICENSE file at https://angular.dev/license
|
||||
*/
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.parseJsonSchemaToOptions = parseJsonSchemaToOptions;
|
||||
const core_1 = require("@angular-devkit/core");
|
||||
async function parseJsonSchemaToOptions(registry, schema, interactive = true) {
|
||||
const options = [];
|
||||
function visitor(current, pointer, parentSchema) {
|
||||
if (!parentSchema) {
|
||||
// Ignore root.
|
||||
return;
|
||||
}
|
||||
else if (pointer.split(/\/(?:properties|items|definitions)\//g).length > 2) {
|
||||
// Ignore subitems (objects or arrays).
|
||||
return;
|
||||
}
|
||||
else if (core_1.json.isJsonArray(current)) {
|
||||
return;
|
||||
}
|
||||
if (pointer.indexOf('/not/') != -1) {
|
||||
// We don't support anyOf/not.
|
||||
throw new Error('The "not" keyword is not supported in JSON Schema.');
|
||||
}
|
||||
const ptr = core_1.json.schema.parseJsonPointer(pointer);
|
||||
const name = ptr[ptr.length - 1];
|
||||
if (ptr[ptr.length - 2] != 'properties') {
|
||||
// Skip any non-property items.
|
||||
return;
|
||||
}
|
||||
const typeSet = core_1.json.schema.getTypesOfSchema(current);
|
||||
if (typeSet.size == 0) {
|
||||
throw new Error('Cannot find type of schema.');
|
||||
}
|
||||
// We only support number, string or boolean (or array of those), so remove everything else.
|
||||
const types = [...typeSet].filter((x) => {
|
||||
switch (x) {
|
||||
case 'boolean':
|
||||
case 'number':
|
||||
case 'string':
|
||||
return true;
|
||||
case 'array':
|
||||
// Only include arrays if they're boolean, string or number.
|
||||
if (core_1.json.isJsonObject(current.items) &&
|
||||
typeof current.items.type == 'string' &&
|
||||
['boolean', 'number', 'string'].includes(current.items.type)) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
});
|
||||
if (types.length == 0) {
|
||||
// This means it's not usable on the command line. e.g. an Object.
|
||||
return;
|
||||
}
|
||||
// Only keep enum values we support (booleans, numbers and strings).
|
||||
const enumValues = ((core_1.json.isJsonArray(current.enum) && current.enum) || []).filter((x) => {
|
||||
switch (typeof x) {
|
||||
case 'boolean':
|
||||
case 'number':
|
||||
case 'string':
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
});
|
||||
let defaultValue = undefined;
|
||||
if (current.default !== undefined) {
|
||||
switch (types[0]) {
|
||||
case 'string':
|
||||
if (typeof current.default == 'string') {
|
||||
defaultValue = current.default;
|
||||
}
|
||||
break;
|
||||
case 'number':
|
||||
if (typeof current.default == 'number') {
|
||||
defaultValue = current.default;
|
||||
}
|
||||
break;
|
||||
case 'boolean':
|
||||
if (typeof current.default == 'boolean') {
|
||||
defaultValue = current.default;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
const type = types[0];
|
||||
const $default = current.$default;
|
||||
const $defaultIndex = core_1.json.isJsonObject($default) && $default['$source'] == 'argv' ? $default['index'] : undefined;
|
||||
const positional = typeof $defaultIndex == 'number' ? $defaultIndex : undefined;
|
||||
let required = core_1.json.isJsonArray(schema.required) ? schema.required.includes(name) : false;
|
||||
if (required && interactive && current['x-prompt']) {
|
||||
required = false;
|
||||
}
|
||||
const alias = core_1.json.isJsonArray(current.aliases)
|
||||
? [...current.aliases].map((x) => '' + x)
|
||||
: current.alias
|
||||
? ['' + current.alias]
|
||||
: [];
|
||||
const format = typeof current.format == 'string' ? current.format : undefined;
|
||||
const visible = current.visible === undefined || current.visible === true;
|
||||
const hidden = !!current.hidden || !visible;
|
||||
const xUserAnalytics = current['x-user-analytics'];
|
||||
const userAnalytics = typeof xUserAnalytics === 'string' ? xUserAnalytics : undefined;
|
||||
// Deprecated is set only if it's true or a string.
|
||||
const xDeprecated = current['x-deprecated'];
|
||||
const deprecated = xDeprecated === true || typeof xDeprecated === 'string' ? xDeprecated : undefined;
|
||||
const option = {
|
||||
name,
|
||||
description: '' + (current.description === undefined ? '' : current.description),
|
||||
type,
|
||||
default: defaultValue,
|
||||
choices: enumValues.length ? enumValues : undefined,
|
||||
required,
|
||||
alias,
|
||||
format,
|
||||
hidden,
|
||||
userAnalytics,
|
||||
deprecated,
|
||||
positional,
|
||||
};
|
||||
options.push(option);
|
||||
}
|
||||
const flattenedSchema = await registry.ɵflatten(schema);
|
||||
core_1.json.schema.visitJsonSchema(flattenedSchema, visitor);
|
||||
// Sort by positional and name.
|
||||
return options.sort((a, b) => {
|
||||
if (a.positional) {
|
||||
return b.positional ? a.positional - b.positional : a.name.localeCompare(b.name);
|
||||
}
|
||||
else if (b.positional) {
|
||||
return -1;
|
||||
}
|
||||
return a.name.localeCompare(b.name);
|
||||
});
|
||||
}
|
||||
18
node_modules/@angular/cli/src/command-builder/utilities/normalize-options-middleware.d.ts
generated
vendored
Executable file
18
node_modules/@angular/cli/src/command-builder/utilities/normalize-options-middleware.d.ts
generated
vendored
Executable file
|
|
@ -0,0 +1,18 @@
|
|||
/**
|
||||
* @license
|
||||
* Copyright Google LLC All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by an MIT-style license that can be
|
||||
* found in the LICENSE file at https://angular.dev/license
|
||||
*/
|
||||
import * as yargs from 'yargs';
|
||||
/**
|
||||
* A Yargs middleware that normalizes non Array options when the argument has been provided multiple times.
|
||||
*
|
||||
* By default, when an option is non array and it is provided multiple times in the command line, yargs
|
||||
* will not override it's value but instead it will be changed to an array unless `duplicate-arguments-array` is disabled.
|
||||
* But this option also have an effect on real array options which isn't desired.
|
||||
*
|
||||
* See: https://github.com/yargs/yargs-parser/pull/163#issuecomment-516566614
|
||||
*/
|
||||
export declare function normalizeOptionsMiddleware(args: yargs.Arguments): void;
|
||||
58
node_modules/@angular/cli/src/command-builder/utilities/normalize-options-middleware.js
generated
vendored
Executable file
58
node_modules/@angular/cli/src/command-builder/utilities/normalize-options-middleware.js
generated
vendored
Executable file
|
|
@ -0,0 +1,58 @@
|
|||
"use strict";
|
||||
/**
|
||||
* @license
|
||||
* Copyright Google LLC All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by an MIT-style license that can be
|
||||
* found in the LICENSE file at https://angular.dev/license
|
||||
*/
|
||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
var desc = Object.getOwnPropertyDescriptor(m, k);
|
||||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
||||
desc = { enumerable: true, get: function() { return m[k]; } };
|
||||
}
|
||||
Object.defineProperty(o, k2, desc);
|
||||
}) : (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
o[k2] = m[k];
|
||||
}));
|
||||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
||||
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
||||
}) : function(o, v) {
|
||||
o["default"] = v;
|
||||
});
|
||||
var __importStar = (this && this.__importStar) || function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
||||
__setModuleDefault(result, mod);
|
||||
return result;
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.normalizeOptionsMiddleware = normalizeOptionsMiddleware;
|
||||
const yargs = __importStar(require("yargs"));
|
||||
/**
|
||||
* A Yargs middleware that normalizes non Array options when the argument has been provided multiple times.
|
||||
*
|
||||
* By default, when an option is non array and it is provided multiple times in the command line, yargs
|
||||
* will not override it's value but instead it will be changed to an array unless `duplicate-arguments-array` is disabled.
|
||||
* But this option also have an effect on real array options which isn't desired.
|
||||
*
|
||||
* See: https://github.com/yargs/yargs-parser/pull/163#issuecomment-516566614
|
||||
*/
|
||||
function normalizeOptionsMiddleware(args) {
|
||||
// `getOptions` is not included in the types even though it's public API.
|
||||
// https://github.com/yargs/yargs/issues/2098
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
const { array } = yargs.getOptions();
|
||||
const arrayOptions = new Set(array);
|
||||
for (const [key, value] of Object.entries(args)) {
|
||||
if (key !== '_' && Array.isArray(value) && !arrayOptions.has(key)) {
|
||||
const newValue = value.pop();
|
||||
// eslint-disable-next-line no-console
|
||||
console.warn(`Option '${key}' has been specified multiple times. The value '${newValue}' will be used.`);
|
||||
args[key] = newValue;
|
||||
}
|
||||
}
|
||||
}
|
||||
15
node_modules/@angular/cli/src/command-builder/utilities/schematic-engine-host.d.ts
generated
vendored
Executable file
15
node_modules/@angular/cli/src/command-builder/utilities/schematic-engine-host.d.ts
generated
vendored
Executable file
|
|
@ -0,0 +1,15 @@
|
|||
/**
|
||||
* @license
|
||||
* Copyright Google LLC All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by an MIT-style license that can be
|
||||
* found in the LICENSE file at https://angular.dev/license
|
||||
*/
|
||||
import { RuleFactory } from '@angular-devkit/schematics';
|
||||
import { FileSystemCollectionDesc, NodeModulesEngineHost } from '@angular-devkit/schematics/tools';
|
||||
export declare class SchematicEngineHost extends NodeModulesEngineHost {
|
||||
protected _resolveReferenceString(refString: string, parentPath: string, collectionDescription?: FileSystemCollectionDesc): {
|
||||
ref: RuleFactory<{}>;
|
||||
path: string;
|
||||
} | null;
|
||||
}
|
||||
180
node_modules/@angular/cli/src/command-builder/utilities/schematic-engine-host.js
generated
vendored
Executable file
180
node_modules/@angular/cli/src/command-builder/utilities/schematic-engine-host.js
generated
vendored
Executable file
|
|
@ -0,0 +1,180 @@
|
|||
"use strict";
|
||||
/**
|
||||
* @license
|
||||
* Copyright Google LLC All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by an MIT-style license that can be
|
||||
* found in the LICENSE file at https://angular.dev/license
|
||||
*/
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.SchematicEngineHost = void 0;
|
||||
const schematics_1 = require("@angular-devkit/schematics");
|
||||
const tools_1 = require("@angular-devkit/schematics/tools");
|
||||
const fs_1 = require("fs");
|
||||
const jsonc_parser_1 = require("jsonc-parser");
|
||||
const module_1 = require("module");
|
||||
const path_1 = require("path");
|
||||
const vm_1 = require("vm");
|
||||
const error_1 = require("../../utilities/error");
|
||||
/**
|
||||
* Environment variable to control schematic package redirection
|
||||
*/
|
||||
const schematicRedirectVariable = process.env['NG_SCHEMATIC_REDIRECT']?.toLowerCase();
|
||||
function shouldWrapSchematic(schematicFile, schematicEncapsulation) {
|
||||
// Check environment variable if present
|
||||
switch (schematicRedirectVariable) {
|
||||
case '0':
|
||||
case 'false':
|
||||
case 'off':
|
||||
case 'none':
|
||||
return false;
|
||||
case 'all':
|
||||
return true;
|
||||
}
|
||||
const normalizedSchematicFile = schematicFile.replace(/\\/g, '/');
|
||||
// Never wrap the internal update schematic when executed directly
|
||||
// It communicates with the update command via `global`
|
||||
// But we still want to redirect schematics located in `@angular/cli/node_modules`.
|
||||
if (normalizedSchematicFile.includes('node_modules/@angular/cli/') &&
|
||||
!normalizedSchematicFile.includes('node_modules/@angular/cli/node_modules/')) {
|
||||
return false;
|
||||
}
|
||||
// @angular/pwa uses dynamic imports which causes `[1] 2468039 segmentation fault` when wrapped.
|
||||
// We should remove this when make `importModuleDynamically` work.
|
||||
// See: https://nodejs.org/docs/latest-v14.x/api/vm.html
|
||||
if (normalizedSchematicFile.includes('@angular/pwa')) {
|
||||
return false;
|
||||
}
|
||||
// Check for first-party Angular schematic packages
|
||||
// Angular schematics are safe to use in the wrapped VM context
|
||||
if (/\/node_modules\/@(?:angular|schematics|nguniversal)\//.test(normalizedSchematicFile)) {
|
||||
return true;
|
||||
}
|
||||
// Otherwise use the value of the schematic collection's encapsulation option (current default of false)
|
||||
return schematicEncapsulation;
|
||||
}
|
||||
class SchematicEngineHost extends tools_1.NodeModulesEngineHost {
|
||||
_resolveReferenceString(refString, parentPath, collectionDescription) {
|
||||
const [path, name] = refString.split('#', 2);
|
||||
// Mimic behavior of ExportStringRef class used in default behavior
|
||||
const fullPath = path[0] === '.' ? (0, path_1.resolve)(parentPath ?? process.cwd(), path) : path;
|
||||
const referenceRequire = (0, module_1.createRequire)(__filename);
|
||||
const schematicFile = referenceRequire.resolve(fullPath, { paths: [parentPath] });
|
||||
if (shouldWrapSchematic(schematicFile, !!collectionDescription?.encapsulation)) {
|
||||
const schematicPath = (0, path_1.dirname)(schematicFile);
|
||||
const moduleCache = new Map();
|
||||
const factoryInitializer = wrap(schematicFile, schematicPath, moduleCache, name || 'default');
|
||||
const factory = factoryInitializer();
|
||||
if (!factory || typeof factory !== 'function') {
|
||||
return null;
|
||||
}
|
||||
return { ref: factory, path: schematicPath };
|
||||
}
|
||||
// All other schematics use default behavior
|
||||
return super._resolveReferenceString(refString, parentPath, collectionDescription);
|
||||
}
|
||||
}
|
||||
exports.SchematicEngineHost = SchematicEngineHost;
|
||||
/**
|
||||
* Minimal shim modules for legacy deep imports of `@schematics/angular`
|
||||
*/
|
||||
const legacyModules = {
|
||||
'@schematics/angular/utility/config': {
|
||||
getWorkspace(host) {
|
||||
const path = '/.angular.json';
|
||||
const data = host.read(path);
|
||||
if (!data) {
|
||||
throw new schematics_1.SchematicsException(`Could not find (${path})`);
|
||||
}
|
||||
return (0, jsonc_parser_1.parse)(data.toString(), [], { allowTrailingComma: true });
|
||||
},
|
||||
},
|
||||
'@schematics/angular/utility/project': {
|
||||
buildDefaultPath(project) {
|
||||
const root = project.sourceRoot ? `/${project.sourceRoot}/` : `/${project.root}/src/`;
|
||||
return `${root}${project.projectType === 'application' ? 'app' : 'lib'}`;
|
||||
},
|
||||
},
|
||||
};
|
||||
/**
|
||||
* Wrap a JavaScript file in a VM context to allow specific Angular dependencies to be redirected.
|
||||
* This VM setup is ONLY intended to redirect dependencies.
|
||||
*
|
||||
* @param schematicFile A JavaScript schematic file path that should be wrapped.
|
||||
* @param schematicDirectory A directory that will be used as the location of the JavaScript file.
|
||||
* @param moduleCache A map to use for caching repeat module usage and proper `instanceof` support.
|
||||
* @param exportName An optional name of a specific export to return. Otherwise, return all exports.
|
||||
*/
|
||||
function wrap(schematicFile, schematicDirectory, moduleCache, exportName) {
|
||||
const hostRequire = (0, module_1.createRequire)(__filename);
|
||||
const schematicRequire = (0, module_1.createRequire)(schematicFile);
|
||||
const customRequire = function (id) {
|
||||
if (legacyModules[id]) {
|
||||
// Provide compatibility modules for older versions of @angular/cdk
|
||||
return legacyModules[id];
|
||||
}
|
||||
else if (id.startsWith('schematics:')) {
|
||||
// Schematics built-in modules use the `schematics` scheme (similar to the Node.js `node` scheme)
|
||||
const builtinId = id.slice(11);
|
||||
const builtinModule = loadBuiltinModule(builtinId);
|
||||
if (!builtinModule) {
|
||||
throw new Error(`Unknown schematics built-in module '${id}' requested from schematic '${schematicFile}'`);
|
||||
}
|
||||
return builtinModule;
|
||||
}
|
||||
else if (id.startsWith('@angular-devkit/') || id.startsWith('@schematics/')) {
|
||||
// Files should not redirect `@angular/core` and instead use the direct
|
||||
// dependency if available. This allows old major version migrations to continue to function
|
||||
// even though the latest major version may have breaking changes in `@angular/core`.
|
||||
if (id.startsWith('@angular-devkit/core')) {
|
||||
try {
|
||||
return schematicRequire(id);
|
||||
}
|
||||
catch (e) {
|
||||
(0, error_1.assertIsError)(e);
|
||||
if (e.code !== 'MODULE_NOT_FOUND') {
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
}
|
||||
// Resolve from inside the `@angular/cli` project
|
||||
return hostRequire(id);
|
||||
}
|
||||
else if (id.startsWith('.') || id.startsWith('@angular/cdk')) {
|
||||
// Wrap relative files inside the schematic collection
|
||||
// Also wrap `@angular/cdk`, it contains helper utilities that import core schematic packages
|
||||
// Resolve from the original file
|
||||
const modulePath = schematicRequire.resolve(id);
|
||||
// Use cached module if available
|
||||
const cachedModule = moduleCache.get(modulePath);
|
||||
if (cachedModule) {
|
||||
return cachedModule;
|
||||
}
|
||||
// Do not wrap vendored third-party packages or JSON files
|
||||
if (!/[/\\]node_modules[/\\]@schematics[/\\]angular[/\\]third_party[/\\]/.test(modulePath) &&
|
||||
!modulePath.endsWith('.json')) {
|
||||
// Wrap module and save in cache
|
||||
const wrappedModule = wrap(modulePath, (0, path_1.dirname)(modulePath), moduleCache)();
|
||||
moduleCache.set(modulePath, wrappedModule);
|
||||
return wrappedModule;
|
||||
}
|
||||
}
|
||||
// All others are required directly from the original file
|
||||
return schematicRequire(id);
|
||||
};
|
||||
// Setup a wrapper function to capture the module's exports
|
||||
const schematicCode = (0, fs_1.readFileSync)(schematicFile, 'utf8');
|
||||
const script = new vm_1.Script(module_1.Module.wrap(schematicCode), {
|
||||
filename: schematicFile,
|
||||
lineOffset: 1,
|
||||
});
|
||||
const schematicModule = new module_1.Module(schematicFile);
|
||||
const moduleFactory = script.runInThisContext();
|
||||
return () => {
|
||||
moduleFactory(schematicModule.exports, customRequire, schematicModule, schematicFile, schematicDirectory);
|
||||
return exportName ? schematicModule.exports[exportName] : schematicModule.exports;
|
||||
};
|
||||
}
|
||||
function loadBuiltinModule(id) {
|
||||
return undefined;
|
||||
}
|
||||
14
node_modules/@angular/cli/src/command-builder/utilities/schematic-workflow.d.ts
generated
vendored
Executable file
14
node_modules/@angular/cli/src/command-builder/utilities/schematic-workflow.d.ts
generated
vendored
Executable file
|
|
@ -0,0 +1,14 @@
|
|||
/**
|
||||
* @license
|
||||
* Copyright Google LLC All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by an MIT-style license that can be
|
||||
* found in the LICENSE file at https://angular.dev/license
|
||||
*/
|
||||
import { logging } from '@angular-devkit/core';
|
||||
import { NodeWorkflow } from '@angular-devkit/schematics/tools';
|
||||
export declare function subscribeToWorkflow(workflow: NodeWorkflow, logger: logging.LoggerApi): {
|
||||
files: Set<string>;
|
||||
error: boolean;
|
||||
unsubscribe: () => void;
|
||||
};
|
||||
63
node_modules/@angular/cli/src/command-builder/utilities/schematic-workflow.js
generated
vendored
Executable file
63
node_modules/@angular/cli/src/command-builder/utilities/schematic-workflow.js
generated
vendored
Executable file
|
|
@ -0,0 +1,63 @@
|
|||
"use strict";
|
||||
/**
|
||||
* @license
|
||||
* Copyright Google LLC All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by an MIT-style license that can be
|
||||
* found in the LICENSE file at https://angular.dev/license
|
||||
*/
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.subscribeToWorkflow = subscribeToWorkflow;
|
||||
const color_1 = require("../../utilities/color");
|
||||
function removeLeadingSlash(value) {
|
||||
return value[0] === '/' ? value.slice(1) : value;
|
||||
}
|
||||
function subscribeToWorkflow(workflow, logger) {
|
||||
const files = new Set();
|
||||
let error = false;
|
||||
let logs = [];
|
||||
const reporterSubscription = workflow.reporter.subscribe((event) => {
|
||||
// Strip leading slash to prevent confusion.
|
||||
const eventPath = removeLeadingSlash(event.path);
|
||||
switch (event.kind) {
|
||||
case 'error':
|
||||
error = true;
|
||||
logger.error(`ERROR! ${eventPath} ${event.description == 'alreadyExist' ? 'already exists' : 'does not exist'}.`);
|
||||
break;
|
||||
case 'update':
|
||||
logs.push(`${color_1.colors.cyan('UPDATE')} ${eventPath} (${event.content.length} bytes)`);
|
||||
files.add(eventPath);
|
||||
break;
|
||||
case 'create':
|
||||
logs.push(`${color_1.colors.green('CREATE')} ${eventPath} (${event.content.length} bytes)`);
|
||||
files.add(eventPath);
|
||||
break;
|
||||
case 'delete':
|
||||
logs.push(`${color_1.colors.yellow('DELETE')} ${eventPath}`);
|
||||
files.add(eventPath);
|
||||
break;
|
||||
case 'rename':
|
||||
logs.push(`${color_1.colors.blue('RENAME')} ${eventPath} => ${removeLeadingSlash(event.to)}`);
|
||||
files.add(eventPath);
|
||||
break;
|
||||
}
|
||||
});
|
||||
const lifecycleSubscription = workflow.lifeCycle.subscribe((event) => {
|
||||
if (event.kind == 'end' || event.kind == 'post-tasks-start') {
|
||||
if (!error) {
|
||||
// Output the logging queue, no error happened.
|
||||
logs.forEach((log) => logger.info(log));
|
||||
}
|
||||
logs = [];
|
||||
error = false;
|
||||
}
|
||||
});
|
||||
return {
|
||||
files,
|
||||
error,
|
||||
unsubscribe: () => {
|
||||
reporterSubscription.unsubscribe();
|
||||
lifecycleSubscription.unsubscribe();
|
||||
},
|
||||
};
|
||||
}
|
||||
33
node_modules/@angular/cli/src/commands/add/cli.d.ts
generated
vendored
Executable file
33
node_modules/@angular/cli/src/commands/add/cli.d.ts
generated
vendored
Executable file
|
|
@ -0,0 +1,33 @@
|
|||
/**
|
||||
* @license
|
||||
* Copyright Google LLC All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by an MIT-style license that can be
|
||||
* found in the LICENSE file at https://angular.dev/license
|
||||
*/
|
||||
import { Argv } from 'yargs';
|
||||
import { CommandModuleImplementation, Options, OtherOptions } from '../../command-builder/command-module';
|
||||
import { SchematicsCommandArgs, SchematicsCommandModule } from '../../command-builder/schematics-command-module';
|
||||
interface AddCommandArgs extends SchematicsCommandArgs {
|
||||
collection: string;
|
||||
verbose?: boolean;
|
||||
registry?: string;
|
||||
'skip-confirmation'?: boolean;
|
||||
}
|
||||
export default class AddCommandModule extends SchematicsCommandModule implements CommandModuleImplementation<AddCommandArgs> {
|
||||
command: string;
|
||||
describe: string;
|
||||
longDescriptionPath: string;
|
||||
protected allowPrivateSchematics: boolean;
|
||||
private readonly schematicName;
|
||||
private rootRequire;
|
||||
builder(argv: Argv): Promise<Argv<AddCommandArgs>>;
|
||||
run(options: Options<AddCommandArgs> & OtherOptions): Promise<number | void>;
|
||||
private isProjectVersionValid;
|
||||
private getCollectionName;
|
||||
private isPackageInstalled;
|
||||
private executeSchematic;
|
||||
private findProjectVersion;
|
||||
private hasMismatchedPeer;
|
||||
}
|
||||
export {};
|
||||
442
node_modules/@angular/cli/src/commands/add/cli.js
generated
vendored
Executable file
442
node_modules/@angular/cli/src/commands/add/cli.js
generated
vendored
Executable file
|
|
@ -0,0 +1,442 @@
|
|||
"use strict";
|
||||
/**
|
||||
* @license
|
||||
* Copyright Google LLC All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by an MIT-style license that can be
|
||||
* found in the LICENSE file at https://angular.dev/license
|
||||
*/
|
||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
var desc = Object.getOwnPropertyDescriptor(m, k);
|
||||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
||||
desc = { enumerable: true, get: function() { return m[k]; } };
|
||||
}
|
||||
Object.defineProperty(o, k2, desc);
|
||||
}) : (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
o[k2] = m[k];
|
||||
}));
|
||||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
||||
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
||||
}) : function(o, v) {
|
||||
o["default"] = v;
|
||||
});
|
||||
var __importStar = (this && this.__importStar) || function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
||||
__setModuleDefault(result, mod);
|
||||
return result;
|
||||
};
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const tools_1 = require("@angular-devkit/schematics/tools");
|
||||
const listr2_1 = require("listr2");
|
||||
const module_1 = require("module");
|
||||
const node_assert_1 = __importDefault(require("node:assert"));
|
||||
const npm_package_arg_1 = __importDefault(require("npm-package-arg"));
|
||||
const path_1 = require("path");
|
||||
const semver_1 = require("semver");
|
||||
const workspace_schema_1 = require("../../../lib/config/workspace-schema");
|
||||
const schematics_command_module_1 = require("../../command-builder/schematics-command-module");
|
||||
const error_1 = require("../../utilities/error");
|
||||
const package_metadata_1 = require("../../utilities/package-metadata");
|
||||
const tty_1 = require("../../utilities/tty");
|
||||
const version_1 = require("../../utilities/version");
|
||||
class CommandError extends Error {
|
||||
}
|
||||
/**
|
||||
* The set of packages that should have certain versions excluded from consideration
|
||||
* when attempting to find a compatible version for a package.
|
||||
* The key is a package name and the value is a SemVer range of versions to exclude.
|
||||
*/
|
||||
const packageVersionExclusions = {
|
||||
// @angular/localize@9.x and earlier versions as well as @angular/localize@10.0 prereleases do not have peer dependencies setup.
|
||||
'@angular/localize': '<10.0.0',
|
||||
// @angular/material@7.x versions have unbounded peer dependency ranges (>=7.0.0).
|
||||
'@angular/material': '7.x',
|
||||
};
|
||||
class AddCommandModule extends schematics_command_module_1.SchematicsCommandModule {
|
||||
command = 'add <collection>';
|
||||
describe = 'Adds support for an external library to your project.';
|
||||
longDescriptionPath = (0, path_1.join)(__dirname, 'long-description.md');
|
||||
allowPrivateSchematics = true;
|
||||
schematicName = 'ng-add';
|
||||
rootRequire = (0, module_1.createRequire)(this.context.root + '/');
|
||||
async builder(argv) {
|
||||
const localYargs = (await super.builder(argv))
|
||||
.positional('collection', {
|
||||
description: 'The package to be added.',
|
||||
type: 'string',
|
||||
demandOption: true,
|
||||
})
|
||||
.option('registry', { description: 'The NPM registry to use.', type: 'string' })
|
||||
.option('verbose', {
|
||||
description: 'Display additional details about internal operations during execution.',
|
||||
type: 'boolean',
|
||||
default: false,
|
||||
})
|
||||
.option('skip-confirmation', {
|
||||
description: 'Skip asking a confirmation prompt before installing and executing the package. ' +
|
||||
'Ensure package name is correct prior to using this option.',
|
||||
type: 'boolean',
|
||||
default: false,
|
||||
})
|
||||
// Prior to downloading we don't know the full schema and therefore we cannot be strict on the options.
|
||||
// Possibly in the future update the logic to use the following syntax:
|
||||
// `ng add @angular/localize -- --package-options`.
|
||||
.strict(false);
|
||||
const collectionName = await this.getCollectionName();
|
||||
const workflow = this.getOrCreateWorkflowForBuilder(collectionName);
|
||||
try {
|
||||
const collection = workflow.engine.createCollection(collectionName);
|
||||
const options = await this.getSchematicOptions(collection, this.schematicName, workflow);
|
||||
return this.addSchemaOptionsToCommand(localYargs, options);
|
||||
}
|
||||
catch (error) {
|
||||
// During `ng add` prior to the downloading of the package
|
||||
// we are not able to resolve and create a collection.
|
||||
// Or when the collection value is a path to a tarball.
|
||||
}
|
||||
return localYargs;
|
||||
}
|
||||
// eslint-disable-next-line max-lines-per-function
|
||||
async run(options) {
|
||||
const { logger, packageManager } = this.context;
|
||||
const { verbose, registry, collection, skipConfirmation } = options;
|
||||
let packageIdentifier;
|
||||
try {
|
||||
packageIdentifier = (0, npm_package_arg_1.default)(collection);
|
||||
}
|
||||
catch (e) {
|
||||
(0, error_1.assertIsError)(e);
|
||||
logger.error(e.message);
|
||||
return 1;
|
||||
}
|
||||
if (packageIdentifier.name &&
|
||||
packageIdentifier.registry &&
|
||||
this.isPackageInstalled(packageIdentifier.name)) {
|
||||
const validVersion = await this.isProjectVersionValid(packageIdentifier);
|
||||
if (validVersion) {
|
||||
// Already installed so just run schematic
|
||||
logger.info('Skipping installation: Package already installed');
|
||||
return this.executeSchematic({ ...options, collection: packageIdentifier.name });
|
||||
}
|
||||
}
|
||||
const taskContext = {
|
||||
packageIdentifier,
|
||||
executeSchematic: this.executeSchematic.bind(this),
|
||||
hasMismatchedPeer: this.hasMismatchedPeer.bind(this),
|
||||
};
|
||||
const tasks = new listr2_1.Listr([
|
||||
{
|
||||
title: 'Determining Package Manager',
|
||||
task(context, task) {
|
||||
context.usingYarn = packageManager.name === workspace_schema_1.PackageManager.Yarn;
|
||||
task.output = `Using package manager: ${listr2_1.color.dim(packageManager.name)}`;
|
||||
},
|
||||
rendererOptions: { persistentOutput: true },
|
||||
},
|
||||
{
|
||||
title: 'Searching for compatible package version',
|
||||
enabled: packageIdentifier.type === 'range' && packageIdentifier.rawSpec === '*',
|
||||
async task(context, task) {
|
||||
(0, node_assert_1.default)(context.packageIdentifier.name, 'Registry package identifiers should always have a name.');
|
||||
// only package name provided; search for viable version
|
||||
// plus special cases for packages that did not have peer deps setup
|
||||
let packageMetadata;
|
||||
try {
|
||||
packageMetadata = await (0, package_metadata_1.fetchPackageMetadata)(context.packageIdentifier.name, logger, {
|
||||
registry,
|
||||
usingYarn: context.usingYarn,
|
||||
verbose,
|
||||
});
|
||||
}
|
||||
catch (e) {
|
||||
(0, error_1.assertIsError)(e);
|
||||
throw new CommandError(`Unable to load package information from registry: ${e.message}`);
|
||||
}
|
||||
// Start with the version tagged as `latest` if it exists
|
||||
const latestManifest = packageMetadata.tags['latest'];
|
||||
if (latestManifest) {
|
||||
context.packageIdentifier = npm_package_arg_1.default.resolve(latestManifest.name, latestManifest.version);
|
||||
}
|
||||
// Adjust the version based on name and peer dependencies
|
||||
if (latestManifest?.peerDependencies &&
|
||||
Object.keys(latestManifest.peerDependencies).length === 0) {
|
||||
task.output = `Found compatible package version: ${listr2_1.color.blue(latestManifest.version)}.`;
|
||||
}
|
||||
else if (!latestManifest || (await context.hasMismatchedPeer(latestManifest))) {
|
||||
// 'latest' is invalid so search for most recent matching package
|
||||
// Allow prelease versions if the CLI itself is a prerelease
|
||||
const allowPrereleases = (0, semver_1.prerelease)(version_1.VERSION.full);
|
||||
const versionExclusions = packageVersionExclusions[packageMetadata.name];
|
||||
const versionManifests = Object.values(packageMetadata.versions).filter((value) => {
|
||||
// Prerelease versions are not stable and should not be considered by default
|
||||
if (!allowPrereleases && (0, semver_1.prerelease)(value.version)) {
|
||||
return false;
|
||||
}
|
||||
// Deprecated versions should not be used or considered
|
||||
if (value.deprecated) {
|
||||
return false;
|
||||
}
|
||||
// Excluded package versions should not be considered
|
||||
if (versionExclusions &&
|
||||
(0, semver_1.satisfies)(value.version, versionExclusions, { includePrerelease: true })) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
});
|
||||
// Sort in reverse SemVer order so that the newest compatible version is chosen
|
||||
versionManifests.sort((a, b) => (0, semver_1.compare)(b.version, a.version, true));
|
||||
let found = false;
|
||||
for (const versionManifest of versionManifests) {
|
||||
const mismatch = await context.hasMismatchedPeer(versionManifest);
|
||||
if (mismatch) {
|
||||
continue;
|
||||
}
|
||||
context.packageIdentifier = npm_package_arg_1.default.resolve(versionManifest.name, versionManifest.version);
|
||||
found = true;
|
||||
}
|
||||
if (!found) {
|
||||
task.output = "Unable to find compatible package. Using 'latest' tag.";
|
||||
}
|
||||
else {
|
||||
task.output = `Found compatible package version: ${listr2_1.color.blue(context.packageIdentifier.toString())}.`;
|
||||
}
|
||||
}
|
||||
else {
|
||||
task.output = `Found compatible package version: ${listr2_1.color.blue(context.packageIdentifier.toString())}.`;
|
||||
}
|
||||
},
|
||||
rendererOptions: { persistentOutput: true },
|
||||
},
|
||||
{
|
||||
title: 'Loading package information from registry',
|
||||
async task(context, task) {
|
||||
let manifest;
|
||||
try {
|
||||
manifest = await (0, package_metadata_1.fetchPackageManifest)(context.packageIdentifier.toString(), logger, {
|
||||
registry,
|
||||
verbose,
|
||||
usingYarn: context.usingYarn,
|
||||
});
|
||||
}
|
||||
catch (e) {
|
||||
(0, error_1.assertIsError)(e);
|
||||
throw new CommandError(`Unable to fetch package information for '${context.packageIdentifier}': ${e.message}`);
|
||||
}
|
||||
context.savePackage = manifest['ng-add']?.save;
|
||||
context.collectionName = manifest.name;
|
||||
if (await context.hasMismatchedPeer(manifest)) {
|
||||
task.output = listr2_1.color.yellow(listr2_1.figures.warning +
|
||||
' Package has unmet peer dependencies. Adding the package may not succeed.');
|
||||
}
|
||||
},
|
||||
rendererOptions: { persistentOutput: true },
|
||||
},
|
||||
{
|
||||
title: 'Confirming installation',
|
||||
enabled: !skipConfirmation,
|
||||
async task(context, task) {
|
||||
if (!(0, tty_1.isTTY)()) {
|
||||
task.output =
|
||||
`'--skip-confirmation' can be used to bypass installation confirmation. ` +
|
||||
`Ensure package name is correct prior to '--skip-confirmation' option usage.`;
|
||||
throw new CommandError('No terminal detected');
|
||||
}
|
||||
const { ListrInquirerPromptAdapter } = await Promise.resolve().then(() => __importStar(require('@listr2/prompt-adapter-inquirer')));
|
||||
const { confirm } = await Promise.resolve().then(() => __importStar(require('@inquirer/prompts')));
|
||||
const shouldProceed = await task.prompt(ListrInquirerPromptAdapter).run(confirm, {
|
||||
message: `The package ${listr2_1.color.blue(context.packageIdentifier.toString())} will be installed and executed.\n` +
|
||||
'Would you like to proceed?',
|
||||
default: true,
|
||||
theme: { prefix: '' },
|
||||
});
|
||||
if (!shouldProceed) {
|
||||
throw new CommandError('Command aborted');
|
||||
}
|
||||
},
|
||||
rendererOptions: { persistentOutput: true },
|
||||
},
|
||||
{
|
||||
async task(context, task) {
|
||||
// Only show if installation will actually occur
|
||||
task.title = 'Installing package';
|
||||
if (context.savePackage === false) {
|
||||
task.title += ' in temporary location';
|
||||
// Temporary packages are located in a different directory
|
||||
// Hence we need to resolve them using the temp path
|
||||
const { success, tempNodeModules } = await packageManager.installTemp(context.packageIdentifier.toString(), registry ? [`--registry="${registry}"`] : undefined);
|
||||
const tempRequire = (0, module_1.createRequire)(tempNodeModules + '/');
|
||||
(0, node_assert_1.default)(context.collectionName, 'Collection name should always be available');
|
||||
const resolvedCollectionPath = tempRequire.resolve((0, path_1.join)(context.collectionName, 'package.json'));
|
||||
if (!success) {
|
||||
throw new CommandError('Unable to install package');
|
||||
}
|
||||
context.collectionName = (0, path_1.dirname)(resolvedCollectionPath);
|
||||
}
|
||||
else {
|
||||
const success = await packageManager.install(context.packageIdentifier.toString(), context.savePackage, registry ? [`--registry="${registry}"`] : undefined, undefined);
|
||||
if (!success) {
|
||||
throw new CommandError('Unable to install package');
|
||||
}
|
||||
}
|
||||
},
|
||||
rendererOptions: { bottomBar: Infinity },
|
||||
},
|
||||
// TODO: Rework schematic execution as a task and insert here
|
||||
]);
|
||||
try {
|
||||
const result = await tasks.run(taskContext);
|
||||
(0, node_assert_1.default)(result.collectionName, 'Collection name should always be available');
|
||||
return this.executeSchematic({ ...options, collection: result.collectionName });
|
||||
}
|
||||
catch (e) {
|
||||
if (e instanceof CommandError) {
|
||||
return 1;
|
||||
}
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
async isProjectVersionValid(packageIdentifier) {
|
||||
if (!packageIdentifier.name) {
|
||||
return false;
|
||||
}
|
||||
const installedVersion = await this.findProjectVersion(packageIdentifier.name);
|
||||
if (!installedVersion) {
|
||||
return false;
|
||||
}
|
||||
if (packageIdentifier.rawSpec === '*') {
|
||||
return true;
|
||||
}
|
||||
if (packageIdentifier.type === 'range' &&
|
||||
packageIdentifier.fetchSpec &&
|
||||
packageIdentifier.fetchSpec !== '*') {
|
||||
return (0, semver_1.satisfies)(installedVersion, packageIdentifier.fetchSpec);
|
||||
}
|
||||
if (packageIdentifier.type === 'version') {
|
||||
const v1 = (0, semver_1.valid)(packageIdentifier.fetchSpec);
|
||||
const v2 = (0, semver_1.valid)(installedVersion);
|
||||
return v1 !== null && v1 === v2;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
async getCollectionName() {
|
||||
let [, collectionName] = this.context.args.positional;
|
||||
// The CLI argument may specify also a version, like `ng add @my/lib@13.0.0`,
|
||||
// but here we need only the name of the package, like `@my/lib`
|
||||
try {
|
||||
const packageIdentifier = (0, npm_package_arg_1.default)(collectionName);
|
||||
collectionName = packageIdentifier.name ?? collectionName;
|
||||
}
|
||||
catch (e) {
|
||||
(0, error_1.assertIsError)(e);
|
||||
this.context.logger.error(e.message);
|
||||
}
|
||||
return collectionName;
|
||||
}
|
||||
isPackageInstalled(name) {
|
||||
try {
|
||||
this.rootRequire.resolve((0, path_1.join)(name, 'package.json'));
|
||||
return true;
|
||||
}
|
||||
catch (e) {
|
||||
(0, error_1.assertIsError)(e);
|
||||
if (e.code !== 'MODULE_NOT_FOUND') {
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
async executeSchematic(options) {
|
||||
try {
|
||||
const { verbose, skipConfirmation, interactive, force, dryRun, registry, defaults, collection: collectionName, ...schematicOptions } = options;
|
||||
return await this.runSchematic({
|
||||
schematicOptions,
|
||||
schematicName: this.schematicName,
|
||||
collectionName,
|
||||
executionOptions: {
|
||||
interactive,
|
||||
force,
|
||||
dryRun,
|
||||
defaults,
|
||||
packageRegistry: registry,
|
||||
},
|
||||
});
|
||||
}
|
||||
catch (e) {
|
||||
if (e instanceof tools_1.NodePackageDoesNotSupportSchematics) {
|
||||
this.context.logger.error('The package that you are trying to add does not support schematics.' +
|
||||
'You can try using a different version of the package or contact the package author to add ng-add support.');
|
||||
return 1;
|
||||
}
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
async findProjectVersion(name) {
|
||||
const { logger, root } = this.context;
|
||||
let installedPackage;
|
||||
try {
|
||||
installedPackage = this.rootRequire.resolve((0, path_1.join)(name, 'package.json'));
|
||||
}
|
||||
catch { }
|
||||
if (installedPackage) {
|
||||
try {
|
||||
const installed = await (0, package_metadata_1.fetchPackageManifest)((0, path_1.dirname)(installedPackage), logger);
|
||||
return installed.version;
|
||||
}
|
||||
catch { }
|
||||
}
|
||||
let projectManifest;
|
||||
try {
|
||||
projectManifest = await (0, package_metadata_1.fetchPackageManifest)(root, logger);
|
||||
}
|
||||
catch { }
|
||||
if (projectManifest) {
|
||||
const version = projectManifest.dependencies?.[name] || projectManifest.devDependencies?.[name];
|
||||
if (version) {
|
||||
return version;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
async hasMismatchedPeer(manifest) {
|
||||
for (const peer in manifest.peerDependencies) {
|
||||
let peerIdentifier;
|
||||
try {
|
||||
peerIdentifier = npm_package_arg_1.default.resolve(peer, manifest.peerDependencies[peer]);
|
||||
}
|
||||
catch {
|
||||
this.context.logger.warn(`Invalid peer dependency ${peer} found in package.`);
|
||||
continue;
|
||||
}
|
||||
if (peerIdentifier.type === 'version' || peerIdentifier.type === 'range') {
|
||||
try {
|
||||
const version = await this.findProjectVersion(peer);
|
||||
if (!version) {
|
||||
continue;
|
||||
}
|
||||
const options = { includePrerelease: true };
|
||||
if (!(0, semver_1.intersects)(version, peerIdentifier.rawSpec, options) &&
|
||||
!(0, semver_1.satisfies)(version, peerIdentifier.rawSpec, options)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
catch {
|
||||
// Not found or invalid so ignore
|
||||
continue;
|
||||
}
|
||||
}
|
||||
else {
|
||||
// type === 'tag' | 'file' | 'directory' | 'remote' | 'git'
|
||||
// Cannot accurately compare these as the tag/location may have changed since install
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
exports.default = AddCommandModule;
|
||||
7
node_modules/@angular/cli/src/commands/add/long-description.md
generated
vendored
Executable file
7
node_modules/@angular/cli/src/commands/add/long-description.md
generated
vendored
Executable file
|
|
@ -0,0 +1,7 @@
|
|||
Adds the npm package for a published library to your workspace, and configures
|
||||
the project in the current working directory to use that library, as specified by the library's schematic.
|
||||
For example, adding `@angular/pwa` configures your project for PWA support:
|
||||
|
||||
```bash
|
||||
ng add @angular/pwa
|
||||
```
|
||||
16
node_modules/@angular/cli/src/commands/analytics/cli.d.ts
generated
vendored
Executable file
16
node_modules/@angular/cli/src/commands/analytics/cli.d.ts
generated
vendored
Executable file
|
|
@ -0,0 +1,16 @@
|
|||
/**
|
||||
* @license
|
||||
* Copyright Google LLC All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by an MIT-style license that can be
|
||||
* found in the LICENSE file at https://angular.dev/license
|
||||
*/
|
||||
import { Argv } from 'yargs';
|
||||
import { CommandModule, CommandModuleImplementation, Options } from '../../command-builder/command-module';
|
||||
export default class AnalyticsCommandModule extends CommandModule implements CommandModuleImplementation {
|
||||
command: string;
|
||||
describe: string;
|
||||
longDescriptionPath: string;
|
||||
builder(localYargs: Argv): Argv;
|
||||
run(_options: Options<{}>): void;
|
||||
}
|
||||
33
node_modules/@angular/cli/src/commands/analytics/cli.js
generated
vendored
Executable file
33
node_modules/@angular/cli/src/commands/analytics/cli.js
generated
vendored
Executable file
|
|
@ -0,0 +1,33 @@
|
|||
"use strict";
|
||||
/**
|
||||
* @license
|
||||
* Copyright Google LLC All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by an MIT-style license that can be
|
||||
* found in the LICENSE file at https://angular.dev/license
|
||||
*/
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const node_path_1 = require("node:path");
|
||||
const command_module_1 = require("../../command-builder/command-module");
|
||||
const command_1 = require("../../command-builder/utilities/command");
|
||||
const cli_1 = require("./info/cli");
|
||||
const cli_2 = require("./settings/cli");
|
||||
class AnalyticsCommandModule extends command_module_1.CommandModule {
|
||||
command = 'analytics';
|
||||
describe = 'Configures the gathering of Angular CLI usage metrics.';
|
||||
longDescriptionPath = (0, node_path_1.join)(__dirname, 'long-description.md');
|
||||
builder(localYargs) {
|
||||
const subcommands = [
|
||||
cli_1.AnalyticsInfoCommandModule,
|
||||
cli_2.AnalyticsDisableModule,
|
||||
cli_2.AnalyticsEnableModule,
|
||||
cli_2.AnalyticsPromptModule,
|
||||
].sort(); // sort by class name.
|
||||
for (const module of subcommands) {
|
||||
localYargs = (0, command_1.addCommandModuleToYargs)(localYargs, module, this.context);
|
||||
}
|
||||
return localYargs.demandCommand(1, command_1.demandCommandFailureMessage).strict();
|
||||
}
|
||||
run(_options) { }
|
||||
}
|
||||
exports.default = AnalyticsCommandModule;
|
||||
16
node_modules/@angular/cli/src/commands/analytics/info/cli.d.ts
generated
vendored
Executable file
16
node_modules/@angular/cli/src/commands/analytics/info/cli.d.ts
generated
vendored
Executable file
|
|
@ -0,0 +1,16 @@
|
|||
/**
|
||||
* @license
|
||||
* Copyright Google LLC All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by an MIT-style license that can be
|
||||
* found in the LICENSE file at https://angular.dev/license
|
||||
*/
|
||||
import { Argv } from 'yargs';
|
||||
import { CommandModule, CommandModuleImplementation, Options } from '../../../command-builder/command-module';
|
||||
export declare class AnalyticsInfoCommandModule extends CommandModule implements CommandModuleImplementation {
|
||||
command: string;
|
||||
describe: string;
|
||||
longDescriptionPath?: string;
|
||||
builder(localYargs: Argv): Argv;
|
||||
run(_options: Options<{}>): Promise<void>;
|
||||
}
|
||||
24
node_modules/@angular/cli/src/commands/analytics/info/cli.js
generated
vendored
Executable file
24
node_modules/@angular/cli/src/commands/analytics/info/cli.js
generated
vendored
Executable file
|
|
@ -0,0 +1,24 @@
|
|||
"use strict";
|
||||
/**
|
||||
* @license
|
||||
* Copyright Google LLC All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by an MIT-style license that can be
|
||||
* found in the LICENSE file at https://angular.dev/license
|
||||
*/
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.AnalyticsInfoCommandModule = void 0;
|
||||
const analytics_1 = require("../../../analytics/analytics");
|
||||
const command_module_1 = require("../../../command-builder/command-module");
|
||||
class AnalyticsInfoCommandModule extends command_module_1.CommandModule {
|
||||
command = 'info';
|
||||
describe = 'Prints analytics gathering and reporting configuration in the console.';
|
||||
longDescriptionPath;
|
||||
builder(localYargs) {
|
||||
return localYargs.strict();
|
||||
}
|
||||
async run(_options) {
|
||||
this.context.logger.info(await (0, analytics_1.getAnalyticsInfoString)(this.context));
|
||||
}
|
||||
}
|
||||
exports.AnalyticsInfoCommandModule = AnalyticsInfoCommandModule;
|
||||
20
node_modules/@angular/cli/src/commands/analytics/long-description.md
generated
vendored
Executable file
20
node_modules/@angular/cli/src/commands/analytics/long-description.md
generated
vendored
Executable file
|
|
@ -0,0 +1,20 @@
|
|||
You can help the Angular Team to prioritize features and improvements by permitting the Angular team to send command-line command usage statistics to Google.
|
||||
The Angular Team does not collect usage statistics unless you explicitly opt in. When installing the Angular CLI you are prompted to allow global collection of usage statistics.
|
||||
If you say no or skip the prompt, no data is collected.
|
||||
|
||||
### What is collected?
|
||||
|
||||
Usage analytics include the commands and selected flags for each execution.
|
||||
Usage analytics may include the following information:
|
||||
|
||||
- Your operating system \(macOS, Linux distribution, Windows\) and its version.
|
||||
- Package manager name and version \(local version only\).
|
||||
- Node.js version \(local version only\).
|
||||
- Angular CLI version \(local version only\).
|
||||
- Command name that was run.
|
||||
- Workspace information, the number of application and library projects.
|
||||
- For schematics commands \(add, generate and new\), the schematic collection and name and a list of selected flags.
|
||||
- For build commands \(build, serve\), the builder name, the number and size of bundles \(initial and lazy\), compilation units, the time it took to build and rebuild, and basic Angular-specific API usage.
|
||||
|
||||
Only Angular owned and developed schematics and builders are reported.
|
||||
Third-party schematics and builders do not send data to the Angular Team.
|
||||
35
node_modules/@angular/cli/src/commands/analytics/settings/cli.d.ts
generated
vendored
Executable file
35
node_modules/@angular/cli/src/commands/analytics/settings/cli.d.ts
generated
vendored
Executable file
|
|
@ -0,0 +1,35 @@
|
|||
/**
|
||||
* @license
|
||||
* Copyright Google LLC All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by an MIT-style license that can be
|
||||
* found in the LICENSE file at https://angular.dev/license
|
||||
*/
|
||||
import { Argv } from 'yargs';
|
||||
import { CommandModule, CommandModuleImplementation, Options } from '../../../command-builder/command-module';
|
||||
interface AnalyticsCommandArgs {
|
||||
global: boolean;
|
||||
}
|
||||
declare abstract class AnalyticsSettingModule extends CommandModule<AnalyticsCommandArgs> implements CommandModuleImplementation<AnalyticsCommandArgs> {
|
||||
longDescriptionPath?: string;
|
||||
builder(localYargs: Argv): Argv<AnalyticsCommandArgs>;
|
||||
abstract run({ global }: Options<AnalyticsCommandArgs>): Promise<void>;
|
||||
}
|
||||
export declare class AnalyticsDisableModule extends AnalyticsSettingModule implements CommandModuleImplementation<AnalyticsCommandArgs> {
|
||||
command: string;
|
||||
aliases: string;
|
||||
describe: string;
|
||||
run({ global }: Options<AnalyticsCommandArgs>): Promise<void>;
|
||||
}
|
||||
export declare class AnalyticsEnableModule extends AnalyticsSettingModule implements CommandModuleImplementation<AnalyticsCommandArgs> {
|
||||
command: string;
|
||||
aliases: string;
|
||||
describe: string;
|
||||
run({ global }: Options<AnalyticsCommandArgs>): Promise<void>;
|
||||
}
|
||||
export declare class AnalyticsPromptModule extends AnalyticsSettingModule implements CommandModuleImplementation<AnalyticsCommandArgs> {
|
||||
command: string;
|
||||
describe: string;
|
||||
run({ global }: Options<AnalyticsCommandArgs>): Promise<void>;
|
||||
}
|
||||
export {};
|
||||
53
node_modules/@angular/cli/src/commands/analytics/settings/cli.js
generated
vendored
Executable file
53
node_modules/@angular/cli/src/commands/analytics/settings/cli.js
generated
vendored
Executable file
|
|
@ -0,0 +1,53 @@
|
|||
"use strict";
|
||||
/**
|
||||
* @license
|
||||
* Copyright Google LLC All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by an MIT-style license that can be
|
||||
* found in the LICENSE file at https://angular.dev/license
|
||||
*/
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.AnalyticsPromptModule = exports.AnalyticsEnableModule = exports.AnalyticsDisableModule = void 0;
|
||||
const analytics_1 = require("../../../analytics/analytics");
|
||||
const command_module_1 = require("../../../command-builder/command-module");
|
||||
class AnalyticsSettingModule extends command_module_1.CommandModule {
|
||||
longDescriptionPath;
|
||||
builder(localYargs) {
|
||||
return localYargs
|
||||
.option('global', {
|
||||
description: `Configure analytics gathering and reporting globally in the caller's home directory.`,
|
||||
alias: ['g'],
|
||||
type: 'boolean',
|
||||
default: false,
|
||||
})
|
||||
.strict();
|
||||
}
|
||||
}
|
||||
class AnalyticsDisableModule extends AnalyticsSettingModule {
|
||||
command = 'disable';
|
||||
aliases = 'off';
|
||||
describe = 'Disables analytics gathering and reporting for the user.';
|
||||
async run({ global }) {
|
||||
await (0, analytics_1.setAnalyticsConfig)(global, false);
|
||||
process.stderr.write(await (0, analytics_1.getAnalyticsInfoString)(this.context));
|
||||
}
|
||||
}
|
||||
exports.AnalyticsDisableModule = AnalyticsDisableModule;
|
||||
class AnalyticsEnableModule extends AnalyticsSettingModule {
|
||||
command = 'enable';
|
||||
aliases = 'on';
|
||||
describe = 'Enables analytics gathering and reporting for the user.';
|
||||
async run({ global }) {
|
||||
await (0, analytics_1.setAnalyticsConfig)(global, true);
|
||||
process.stderr.write(await (0, analytics_1.getAnalyticsInfoString)(this.context));
|
||||
}
|
||||
}
|
||||
exports.AnalyticsEnableModule = AnalyticsEnableModule;
|
||||
class AnalyticsPromptModule extends AnalyticsSettingModule {
|
||||
command = 'prompt';
|
||||
describe = 'Prompts the user to set the analytics gathering status interactively.';
|
||||
async run({ global }) {
|
||||
await (0, analytics_1.promptAnalytics)(this.context, global, true);
|
||||
}
|
||||
}
|
||||
exports.AnalyticsPromptModule = AnalyticsPromptModule;
|
||||
16
node_modules/@angular/cli/src/commands/build/cli.d.ts
generated
vendored
Executable file
16
node_modules/@angular/cli/src/commands/build/cli.d.ts
generated
vendored
Executable file
|
|
@ -0,0 +1,16 @@
|
|||
/**
|
||||
* @license
|
||||
* Copyright Google LLC All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by an MIT-style license that can be
|
||||
* found in the LICENSE file at https://angular.dev/license
|
||||
*/
|
||||
import { ArchitectCommandModule } from '../../command-builder/architect-command-module';
|
||||
import { CommandModuleImplementation } from '../../command-builder/command-module';
|
||||
export default class BuildCommandModule extends ArchitectCommandModule implements CommandModuleImplementation {
|
||||
multiTarget: boolean;
|
||||
command: string;
|
||||
aliases: string[] | undefined;
|
||||
describe: string;
|
||||
longDescriptionPath: string;
|
||||
}
|
||||
20
node_modules/@angular/cli/src/commands/build/cli.js
generated
vendored
Executable file
20
node_modules/@angular/cli/src/commands/build/cli.js
generated
vendored
Executable file
|
|
@ -0,0 +1,20 @@
|
|||
"use strict";
|
||||
/**
|
||||
* @license
|
||||
* Copyright Google LLC All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by an MIT-style license that can be
|
||||
* found in the LICENSE file at https://angular.dev/license
|
||||
*/
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const path_1 = require("path");
|
||||
const architect_command_module_1 = require("../../command-builder/architect-command-module");
|
||||
const command_config_1 = require("../command-config");
|
||||
class BuildCommandModule extends architect_command_module_1.ArchitectCommandModule {
|
||||
multiTarget = false;
|
||||
command = 'build [project]';
|
||||
aliases = command_config_1.RootCommands['build'].aliases;
|
||||
describe = 'Compiles an Angular application or library into an output directory named dist/ at the given output path.';
|
||||
longDescriptionPath = (0, path_1.join)(__dirname, 'long-description.md');
|
||||
}
|
||||
exports.default = BuildCommandModule;
|
||||
18
node_modules/@angular/cli/src/commands/build/long-description.md
generated
vendored
Executable file
18
node_modules/@angular/cli/src/commands/build/long-description.md
generated
vendored
Executable file
|
|
@ -0,0 +1,18 @@
|
|||
The command can be used to build a project of type "application" or "library".
|
||||
When used to build a library, a different builder is invoked, and only the `ts-config`, `configuration`, `poll` and `watch` options are applied.
|
||||
All other options apply only to building applications.
|
||||
|
||||
The application builder uses the [esbuild](https://esbuild.github.io/) build tool, with default configuration options specified in the workspace configuration file (`angular.json`) or with a named alternative configuration.
|
||||
A "development" configuration is created by default when you use the CLI to create the project, and you can use that configuration by specifying the `--configuration development`.
|
||||
|
||||
The configuration options generally correspond to the command options.
|
||||
You can override individual configuration defaults by specifying the corresponding options on the command line.
|
||||
The command can accept option names given in dash-case.
|
||||
Note that in the configuration file, you must specify names in camelCase.
|
||||
|
||||
Some additional options can only be set through the configuration file,
|
||||
either by direct editing or with the `ng config` command.
|
||||
These include `assets`, `styles`, and `scripts` objects that provide runtime-global resources to include in the project.
|
||||
Resources in CSS, such as images and fonts, are automatically written and fingerprinted at the root of the output folder.
|
||||
|
||||
For further details, see [Workspace Configuration](reference/configs/workspace-config).
|
||||
17
node_modules/@angular/cli/src/commands/cache/clean/cli.d.ts
generated
vendored
Executable file
17
node_modules/@angular/cli/src/commands/cache/clean/cli.d.ts
generated
vendored
Executable file
|
|
@ -0,0 +1,17 @@
|
|||
/**
|
||||
* @license
|
||||
* Copyright Google LLC All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by an MIT-style license that can be
|
||||
* found in the LICENSE file at https://angular.dev/license
|
||||
*/
|
||||
import { Argv } from 'yargs';
|
||||
import { CommandModule, CommandModuleImplementation, CommandScope } from '../../../command-builder/command-module';
|
||||
export declare class CacheCleanModule extends CommandModule implements CommandModuleImplementation {
|
||||
command: string;
|
||||
describe: string;
|
||||
longDescriptionPath: string | undefined;
|
||||
scope: CommandScope;
|
||||
builder(localYargs: Argv): Argv;
|
||||
run(): Promise<void>;
|
||||
}
|
||||
31
node_modules/@angular/cli/src/commands/cache/clean/cli.js
generated
vendored
Executable file
31
node_modules/@angular/cli/src/commands/cache/clean/cli.js
generated
vendored
Executable file
|
|
@ -0,0 +1,31 @@
|
|||
"use strict";
|
||||
/**
|
||||
* @license
|
||||
* Copyright Google LLC All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by an MIT-style license that can be
|
||||
* found in the LICENSE file at https://angular.dev/license
|
||||
*/
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.CacheCleanModule = void 0;
|
||||
const fs_1 = require("fs");
|
||||
const command_module_1 = require("../../../command-builder/command-module");
|
||||
const utilities_1 = require("../utilities");
|
||||
class CacheCleanModule extends command_module_1.CommandModule {
|
||||
command = 'clean';
|
||||
describe = 'Deletes persistent disk cache from disk.';
|
||||
longDescriptionPath;
|
||||
scope = command_module_1.CommandScope.In;
|
||||
builder(localYargs) {
|
||||
return localYargs.strict();
|
||||
}
|
||||
run() {
|
||||
const { path } = (0, utilities_1.getCacheConfig)(this.context.workspace);
|
||||
return fs_1.promises.rm(path, {
|
||||
force: true,
|
||||
recursive: true,
|
||||
maxRetries: 3,
|
||||
});
|
||||
}
|
||||
}
|
||||
exports.CacheCleanModule = CacheCleanModule;
|
||||
17
node_modules/@angular/cli/src/commands/cache/cli.d.ts
generated
vendored
Executable file
17
node_modules/@angular/cli/src/commands/cache/cli.d.ts
generated
vendored
Executable file
|
|
@ -0,0 +1,17 @@
|
|||
/**
|
||||
* @license
|
||||
* Copyright Google LLC All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by an MIT-style license that can be
|
||||
* found in the LICENSE file at https://angular.dev/license
|
||||
*/
|
||||
import { Argv } from 'yargs';
|
||||
import { CommandModule, CommandModuleImplementation, CommandScope, Options } from '../../command-builder/command-module';
|
||||
export default class CacheCommandModule extends CommandModule implements CommandModuleImplementation {
|
||||
command: string;
|
||||
describe: string;
|
||||
longDescriptionPath: string;
|
||||
scope: CommandScope;
|
||||
builder(localYargs: Argv): Argv;
|
||||
run(_options: Options<{}>): void;
|
||||
}
|
||||
35
node_modules/@angular/cli/src/commands/cache/cli.js
generated
vendored
Executable file
35
node_modules/@angular/cli/src/commands/cache/cli.js
generated
vendored
Executable file
|
|
@ -0,0 +1,35 @@
|
|||
"use strict";
|
||||
/**
|
||||
* @license
|
||||
* Copyright Google LLC All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by an MIT-style license that can be
|
||||
* found in the LICENSE file at https://angular.dev/license
|
||||
*/
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const path_1 = require("path");
|
||||
const command_module_1 = require("../../command-builder/command-module");
|
||||
const command_1 = require("../../command-builder/utilities/command");
|
||||
const cli_1 = require("./clean/cli");
|
||||
const cli_2 = require("./info/cli");
|
||||
const cli_3 = require("./settings/cli");
|
||||
class CacheCommandModule extends command_module_1.CommandModule {
|
||||
command = 'cache';
|
||||
describe = 'Configure persistent disk cache and retrieve cache statistics.';
|
||||
longDescriptionPath = (0, path_1.join)(__dirname, 'long-description.md');
|
||||
scope = command_module_1.CommandScope.In;
|
||||
builder(localYargs) {
|
||||
const subcommands = [
|
||||
cli_3.CacheEnableModule,
|
||||
cli_3.CacheDisableModule,
|
||||
cli_1.CacheCleanModule,
|
||||
cli_2.CacheInfoCommandModule,
|
||||
].sort();
|
||||
for (const module of subcommands) {
|
||||
localYargs = (0, command_1.addCommandModuleToYargs)(localYargs, module, this.context);
|
||||
}
|
||||
return localYargs.demandCommand(1, command_1.demandCommandFailureMessage).strict();
|
||||
}
|
||||
run(_options) { }
|
||||
}
|
||||
exports.default = CacheCommandModule;
|
||||
20
node_modules/@angular/cli/src/commands/cache/info/cli.d.ts
generated
vendored
Executable file
20
node_modules/@angular/cli/src/commands/cache/info/cli.d.ts
generated
vendored
Executable file
|
|
@ -0,0 +1,20 @@
|
|||
/**
|
||||
* @license
|
||||
* Copyright Google LLC All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by an MIT-style license that can be
|
||||
* found in the LICENSE file at https://angular.dev/license
|
||||
*/
|
||||
import { Argv } from 'yargs';
|
||||
import { CommandModule, CommandModuleImplementation, CommandScope } from '../../../command-builder/command-module';
|
||||
export declare class CacheInfoCommandModule extends CommandModule implements CommandModuleImplementation {
|
||||
command: string;
|
||||
describe: string;
|
||||
longDescriptionPath?: string | undefined;
|
||||
scope: CommandScope;
|
||||
builder(localYargs: Argv): Argv;
|
||||
run(): Promise<void>;
|
||||
private getSizeOfDirectory;
|
||||
private formatSize;
|
||||
private effectiveEnabledStatus;
|
||||
}
|
||||
81
node_modules/@angular/cli/src/commands/cache/info/cli.js
generated
vendored
Executable file
81
node_modules/@angular/cli/src/commands/cache/info/cli.js
generated
vendored
Executable file
|
|
@ -0,0 +1,81 @@
|
|||
"use strict";
|
||||
/**
|
||||
* @license
|
||||
* Copyright Google LLC All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by an MIT-style license that can be
|
||||
* found in the LICENSE file at https://angular.dev/license
|
||||
*/
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.CacheInfoCommandModule = void 0;
|
||||
const core_1 = require("@angular-devkit/core");
|
||||
const fs_1 = require("fs");
|
||||
const path_1 = require("path");
|
||||
const command_module_1 = require("../../../command-builder/command-module");
|
||||
const environment_options_1 = require("../../../utilities/environment-options");
|
||||
const utilities_1 = require("../utilities");
|
||||
class CacheInfoCommandModule extends command_module_1.CommandModule {
|
||||
command = 'info';
|
||||
describe = 'Prints persistent disk cache configuration and statistics in the console.';
|
||||
longDescriptionPath;
|
||||
scope = command_module_1.CommandScope.In;
|
||||
builder(localYargs) {
|
||||
return localYargs.strict();
|
||||
}
|
||||
async run() {
|
||||
const { path, environment, enabled } = (0, utilities_1.getCacheConfig)(this.context.workspace);
|
||||
this.context.logger.info(core_1.tags.stripIndents `
|
||||
Enabled: ${enabled ? 'yes' : 'no'}
|
||||
Environment: ${environment}
|
||||
Path: ${path}
|
||||
Size on disk: ${await this.getSizeOfDirectory(path)}
|
||||
Effective status on current machine: ${this.effectiveEnabledStatus() ? 'enabled' : 'disabled'}
|
||||
`);
|
||||
}
|
||||
async getSizeOfDirectory(path) {
|
||||
const directoriesStack = [path];
|
||||
let size = 0;
|
||||
while (directoriesStack.length) {
|
||||
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
||||
const dirPath = directoriesStack.pop();
|
||||
let entries = [];
|
||||
try {
|
||||
entries = await fs_1.promises.readdir(dirPath);
|
||||
}
|
||||
catch { }
|
||||
for (const entry of entries) {
|
||||
const entryPath = (0, path_1.join)(dirPath, entry);
|
||||
const stats = await fs_1.promises.stat(entryPath);
|
||||
if (stats.isDirectory()) {
|
||||
directoriesStack.push(entryPath);
|
||||
}
|
||||
size += stats.size;
|
||||
}
|
||||
}
|
||||
return this.formatSize(size);
|
||||
}
|
||||
formatSize(size) {
|
||||
if (size <= 0) {
|
||||
return '0 bytes';
|
||||
}
|
||||
const abbreviations = ['bytes', 'kB', 'MB', 'GB'];
|
||||
const index = Math.floor(Math.log(size) / Math.log(1024));
|
||||
const roundedSize = size / Math.pow(1024, index);
|
||||
// bytes don't have a fraction
|
||||
const fractionDigits = index === 0 ? 0 : 2;
|
||||
return `${roundedSize.toFixed(fractionDigits)} ${abbreviations[index]}`;
|
||||
}
|
||||
effectiveEnabledStatus() {
|
||||
const { enabled, environment } = (0, utilities_1.getCacheConfig)(this.context.workspace);
|
||||
if (enabled) {
|
||||
switch (environment) {
|
||||
case 'ci':
|
||||
return environment_options_1.isCI;
|
||||
case 'local':
|
||||
return !environment_options_1.isCI;
|
||||
}
|
||||
}
|
||||
return enabled;
|
||||
}
|
||||
}
|
||||
exports.CacheInfoCommandModule = CacheInfoCommandModule;
|
||||
53
node_modules/@angular/cli/src/commands/cache/long-description.md
generated
vendored
Executable file
53
node_modules/@angular/cli/src/commands/cache/long-description.md
generated
vendored
Executable file
|
|
@ -0,0 +1,53 @@
|
|||
Angular CLI saves a number of cachable operations on disk by default.
|
||||
|
||||
When you re-run the same build, the build system restores the state of the previous build and re-uses previously performed operations, which decreases the time taken to build and test your applications and libraries.
|
||||
|
||||
To amend the default cache settings, add the `cli.cache` object to your [Workspace Configuration](reference/configs/workspace-config).
|
||||
The object goes under `cli.cache` at the top level of the file, outside the `projects` sections.
|
||||
|
||||
```jsonc
|
||||
{
|
||||
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
|
||||
"version": 1,
|
||||
"cli": {
|
||||
"cache": {
|
||||
// ...
|
||||
},
|
||||
},
|
||||
"projects": {},
|
||||
}
|
||||
```
|
||||
|
||||
For more information, see [cache options](reference/configs/workspace-config#cache-options).
|
||||
|
||||
### Cache environments
|
||||
|
||||
By default, disk cache is only enabled for local environments. The value of environment can be one of the following:
|
||||
|
||||
- `all` - allows disk cache on all machines.
|
||||
- `local` - allows disk cache only on development machines.
|
||||
- `ci` - allows disk cache only on continuous integration (CI) systems.
|
||||
|
||||
To change the environment setting to `all`, run the following command:
|
||||
|
||||
```bash
|
||||
ng config cli.cache.environment all
|
||||
```
|
||||
|
||||
For more information, see `environment` in [cache options](reference/configs/workspace-config#cache-options).
|
||||
|
||||
<div class="alert is-helpful">
|
||||
|
||||
The Angular CLI checks for the presence and value of the `CI` environment variable to determine in which environment it is running.
|
||||
|
||||
</div>
|
||||
|
||||
### Cache path
|
||||
|
||||
By default, `.angular/cache` is used as a base directory to store cache results.
|
||||
|
||||
To change this path to `.cache/ng`, run the following command:
|
||||
|
||||
```bash
|
||||
ng config cli.cache.path ".cache/ng"
|
||||
```
|
||||
27
node_modules/@angular/cli/src/commands/cache/settings/cli.d.ts
generated
vendored
Executable file
27
node_modules/@angular/cli/src/commands/cache/settings/cli.d.ts
generated
vendored
Executable file
|
|
@ -0,0 +1,27 @@
|
|||
/**
|
||||
* @license
|
||||
* Copyright Google LLC All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by an MIT-style license that can be
|
||||
* found in the LICENSE file at https://angular.dev/license
|
||||
*/
|
||||
import { Argv } from 'yargs';
|
||||
import { CommandModule, CommandModuleImplementation, CommandScope } from '../../../command-builder/command-module';
|
||||
export declare class CacheDisableModule extends CommandModule implements CommandModuleImplementation {
|
||||
command: string;
|
||||
aliases: string;
|
||||
describe: string;
|
||||
longDescriptionPath: string | undefined;
|
||||
scope: CommandScope;
|
||||
builder(localYargs: Argv): Argv;
|
||||
run(): Promise<void>;
|
||||
}
|
||||
export declare class CacheEnableModule extends CommandModule implements CommandModuleImplementation {
|
||||
command: string;
|
||||
aliases: string;
|
||||
describe: string;
|
||||
longDescriptionPath: string | undefined;
|
||||
scope: CommandScope;
|
||||
builder(localYargs: Argv): Argv;
|
||||
run(): Promise<void>;
|
||||
}
|
||||
40
node_modules/@angular/cli/src/commands/cache/settings/cli.js
generated
vendored
Executable file
40
node_modules/@angular/cli/src/commands/cache/settings/cli.js
generated
vendored
Executable file
|
|
@ -0,0 +1,40 @@
|
|||
"use strict";
|
||||
/**
|
||||
* @license
|
||||
* Copyright Google LLC All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by an MIT-style license that can be
|
||||
* found in the LICENSE file at https://angular.dev/license
|
||||
*/
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.CacheEnableModule = exports.CacheDisableModule = void 0;
|
||||
const command_module_1 = require("../../../command-builder/command-module");
|
||||
const utilities_1 = require("../utilities");
|
||||
class CacheDisableModule extends command_module_1.CommandModule {
|
||||
command = 'disable';
|
||||
aliases = 'off';
|
||||
describe = 'Disables persistent disk cache for all projects in the workspace.';
|
||||
longDescriptionPath;
|
||||
scope = command_module_1.CommandScope.In;
|
||||
builder(localYargs) {
|
||||
return localYargs;
|
||||
}
|
||||
run() {
|
||||
return (0, utilities_1.updateCacheConfig)(this.getWorkspaceOrThrow(), 'enabled', false);
|
||||
}
|
||||
}
|
||||
exports.CacheDisableModule = CacheDisableModule;
|
||||
class CacheEnableModule extends command_module_1.CommandModule {
|
||||
command = 'enable';
|
||||
aliases = 'on';
|
||||
describe = 'Enables disk cache for all projects in the workspace.';
|
||||
longDescriptionPath;
|
||||
scope = command_module_1.CommandScope.In;
|
||||
builder(localYargs) {
|
||||
return localYargs;
|
||||
}
|
||||
run() {
|
||||
return (0, utilities_1.updateCacheConfig)(this.getWorkspaceOrThrow(), 'enabled', true);
|
||||
}
|
||||
}
|
||||
exports.CacheEnableModule = CacheEnableModule;
|
||||
11
node_modules/@angular/cli/src/commands/cache/utilities.d.ts
generated
vendored
Executable file
11
node_modules/@angular/cli/src/commands/cache/utilities.d.ts
generated
vendored
Executable file
|
|
@ -0,0 +1,11 @@
|
|||
/**
|
||||
* @license
|
||||
* Copyright Google LLC All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by an MIT-style license that can be
|
||||
* found in the LICENSE file at https://angular.dev/license
|
||||
*/
|
||||
import { Cache } from '../../../lib/config/workspace-schema';
|
||||
import { AngularWorkspace } from '../../utilities/config';
|
||||
export declare function updateCacheConfig<K extends keyof Cache>(workspace: AngularWorkspace, key: K, value: Cache[K]): Promise<void>;
|
||||
export declare function getCacheConfig(workspace: AngularWorkspace | undefined): Required<Cache>;
|
||||
46
node_modules/@angular/cli/src/commands/cache/utilities.js
generated
vendored
Executable file
46
node_modules/@angular/cli/src/commands/cache/utilities.js
generated
vendored
Executable file
|
|
@ -0,0 +1,46 @@
|
|||
"use strict";
|
||||
/**
|
||||
* @license
|
||||
* Copyright Google LLC All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by an MIT-style license that can be
|
||||
* found in the LICENSE file at https://angular.dev/license
|
||||
*/
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.updateCacheConfig = updateCacheConfig;
|
||||
exports.getCacheConfig = getCacheConfig;
|
||||
const core_1 = require("@angular-devkit/core");
|
||||
const path_1 = require("path");
|
||||
const workspace_schema_1 = require("../../../lib/config/workspace-schema");
|
||||
function updateCacheConfig(workspace, key, value) {
|
||||
const cli = (workspace.extensions['cli'] ??= {});
|
||||
const cache = (cli['cache'] ??= {});
|
||||
cache[key] = value;
|
||||
return workspace.save();
|
||||
}
|
||||
function getCacheConfig(workspace) {
|
||||
if (!workspace) {
|
||||
throw new Error(`Cannot retrieve cache configuration as workspace is not defined.`);
|
||||
}
|
||||
const defaultSettings = {
|
||||
path: (0, path_1.resolve)(workspace.basePath, '.angular/cache'),
|
||||
environment: workspace_schema_1.Environment.Local,
|
||||
enabled: true,
|
||||
};
|
||||
const cliSetting = workspace.extensions['cli'];
|
||||
if (!cliSetting || !(0, core_1.isJsonObject)(cliSetting)) {
|
||||
return defaultSettings;
|
||||
}
|
||||
const cacheSettings = cliSetting['cache'];
|
||||
if (!(0, core_1.isJsonObject)(cacheSettings)) {
|
||||
return defaultSettings;
|
||||
}
|
||||
const { path = defaultSettings.path, environment = defaultSettings.environment, enabled = defaultSettings.enabled,
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
} = cacheSettings;
|
||||
return {
|
||||
path: (0, path_1.resolve)(workspace.basePath, path),
|
||||
environment,
|
||||
enabled,
|
||||
};
|
||||
}
|
||||
17
node_modules/@angular/cli/src/commands/command-config.d.ts
generated
vendored
Executable file
17
node_modules/@angular/cli/src/commands/command-config.d.ts
generated
vendored
Executable file
|
|
@ -0,0 +1,17 @@
|
|||
/**
|
||||
* @license
|
||||
* Copyright Google LLC All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by an MIT-style license that can be
|
||||
* found in the LICENSE file at https://angular.dev/license
|
||||
*/
|
||||
import { CommandModuleConstructor } from '../command-builder/utilities/command';
|
||||
export type CommandNames = 'add' | 'analytics' | 'build' | 'cache' | 'completion' | 'config' | 'deploy' | 'e2e' | 'extract-i18n' | 'generate' | 'lint' | 'make-this-awesome' | 'new' | 'run' | 'serve' | 'test' | 'update' | 'version';
|
||||
export interface CommandConfig {
|
||||
aliases?: string[];
|
||||
factory: () => Promise<{
|
||||
default: CommandModuleConstructor;
|
||||
}>;
|
||||
}
|
||||
export declare const RootCommands: Record<CommandNames & string, CommandConfig>;
|
||||
export declare const RootCommandsAliases: Record<string, CommandConfig>;
|
||||
102
node_modules/@angular/cli/src/commands/command-config.js
generated
vendored
Executable file
102
node_modules/@angular/cli/src/commands/command-config.js
generated
vendored
Executable file
|
|
@ -0,0 +1,102 @@
|
|||
"use strict";
|
||||
/**
|
||||
* @license
|
||||
* Copyright Google LLC All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by an MIT-style license that can be
|
||||
* found in the LICENSE file at https://angular.dev/license
|
||||
*/
|
||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
var desc = Object.getOwnPropertyDescriptor(m, k);
|
||||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
||||
desc = { enumerable: true, get: function() { return m[k]; } };
|
||||
}
|
||||
Object.defineProperty(o, k2, desc);
|
||||
}) : (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
o[k2] = m[k];
|
||||
}));
|
||||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
||||
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
||||
}) : function(o, v) {
|
||||
o["default"] = v;
|
||||
});
|
||||
var __importStar = (this && this.__importStar) || function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
||||
__setModuleDefault(result, mod);
|
||||
return result;
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.RootCommandsAliases = exports.RootCommands = void 0;
|
||||
exports.RootCommands = {
|
||||
'add': {
|
||||
factory: () => Promise.resolve().then(() => __importStar(require('./add/cli'))),
|
||||
},
|
||||
'analytics': {
|
||||
factory: () => Promise.resolve().then(() => __importStar(require('./analytics/cli'))),
|
||||
},
|
||||
'build': {
|
||||
factory: () => Promise.resolve().then(() => __importStar(require('./build/cli'))),
|
||||
aliases: ['b'],
|
||||
},
|
||||
'cache': {
|
||||
factory: () => Promise.resolve().then(() => __importStar(require('./cache/cli'))),
|
||||
},
|
||||
'completion': {
|
||||
factory: () => Promise.resolve().then(() => __importStar(require('./completion/cli'))),
|
||||
},
|
||||
'config': {
|
||||
factory: () => Promise.resolve().then(() => __importStar(require('./config/cli'))),
|
||||
},
|
||||
'deploy': {
|
||||
factory: () => Promise.resolve().then(() => __importStar(require('./deploy/cli'))),
|
||||
},
|
||||
'e2e': {
|
||||
factory: () => Promise.resolve().then(() => __importStar(require('./e2e/cli'))),
|
||||
aliases: ['e'],
|
||||
},
|
||||
'extract-i18n': {
|
||||
factory: () => Promise.resolve().then(() => __importStar(require('./extract-i18n/cli'))),
|
||||
},
|
||||
'generate': {
|
||||
factory: () => Promise.resolve().then(() => __importStar(require('./generate/cli'))),
|
||||
aliases: ['g'],
|
||||
},
|
||||
'lint': {
|
||||
factory: () => Promise.resolve().then(() => __importStar(require('./lint/cli'))),
|
||||
},
|
||||
'make-this-awesome': {
|
||||
factory: () => Promise.resolve().then(() => __importStar(require('./make-this-awesome/cli'))),
|
||||
},
|
||||
'new': {
|
||||
factory: () => Promise.resolve().then(() => __importStar(require('./new/cli'))),
|
||||
aliases: ['n'],
|
||||
},
|
||||
'run': {
|
||||
factory: () => Promise.resolve().then(() => __importStar(require('./run/cli'))),
|
||||
},
|
||||
'serve': {
|
||||
factory: () => Promise.resolve().then(() => __importStar(require('./serve/cli'))),
|
||||
aliases: ['dev', 's'],
|
||||
},
|
||||
'test': {
|
||||
factory: () => Promise.resolve().then(() => __importStar(require('./test/cli'))),
|
||||
aliases: ['t'],
|
||||
},
|
||||
'update': {
|
||||
factory: () => Promise.resolve().then(() => __importStar(require('./update/cli'))),
|
||||
},
|
||||
'version': {
|
||||
factory: () => Promise.resolve().then(() => __importStar(require('./version/cli'))),
|
||||
aliases: ['v'],
|
||||
},
|
||||
};
|
||||
exports.RootCommandsAliases = Object.values(exports.RootCommands).reduce((prev, current) => {
|
||||
current.aliases?.forEach((alias) => {
|
||||
prev[alias] = current;
|
||||
});
|
||||
return prev;
|
||||
}, {});
|
||||
16
node_modules/@angular/cli/src/commands/completion/cli.d.ts
generated
vendored
Executable file
16
node_modules/@angular/cli/src/commands/completion/cli.d.ts
generated
vendored
Executable file
|
|
@ -0,0 +1,16 @@
|
|||
/**
|
||||
* @license
|
||||
* Copyright Google LLC All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by an MIT-style license that can be
|
||||
* found in the LICENSE file at https://angular.dev/license
|
||||
*/
|
||||
import { Argv } from 'yargs';
|
||||
import { CommandModule, CommandModuleImplementation } from '../../command-builder/command-module';
|
||||
export default class CompletionCommandModule extends CommandModule implements CommandModuleImplementation {
|
||||
command: string;
|
||||
describe: string;
|
||||
longDescriptionPath: string;
|
||||
builder(localYargs: Argv): Argv;
|
||||
run(): Promise<number>;
|
||||
}
|
||||
63
node_modules/@angular/cli/src/commands/completion/cli.js
generated
vendored
Executable file
63
node_modules/@angular/cli/src/commands/completion/cli.js
generated
vendored
Executable file
|
|
@ -0,0 +1,63 @@
|
|||
"use strict";
|
||||
/**
|
||||
* @license
|
||||
* Copyright Google LLC All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by an MIT-style license that can be
|
||||
* found in the LICENSE file at https://angular.dev/license
|
||||
*/
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const path_1 = require("path");
|
||||
const yargs_1 = __importDefault(require("yargs"));
|
||||
const command_module_1 = require("../../command-builder/command-module");
|
||||
const command_1 = require("../../command-builder/utilities/command");
|
||||
const color_1 = require("../../utilities/color");
|
||||
const completion_1 = require("../../utilities/completion");
|
||||
const error_1 = require("../../utilities/error");
|
||||
class CompletionCommandModule extends command_module_1.CommandModule {
|
||||
command = 'completion';
|
||||
describe = 'Set up Angular CLI autocompletion for your terminal.';
|
||||
longDescriptionPath = (0, path_1.join)(__dirname, 'long-description.md');
|
||||
builder(localYargs) {
|
||||
return (0, command_1.addCommandModuleToYargs)(localYargs, CompletionScriptCommandModule, this.context);
|
||||
}
|
||||
async run() {
|
||||
let rcFile;
|
||||
try {
|
||||
rcFile = await (0, completion_1.initializeAutocomplete)();
|
||||
}
|
||||
catch (err) {
|
||||
(0, error_1.assertIsError)(err);
|
||||
this.context.logger.error(err.message);
|
||||
return 1;
|
||||
}
|
||||
this.context.logger.info(`
|
||||
Appended \`source <(ng completion script)\` to \`${rcFile}\`. Restart your terminal or run the following to autocomplete \`ng\` commands:
|
||||
|
||||
${color_1.colors.yellow('source <(ng completion script)')}
|
||||
`.trim());
|
||||
if ((await (0, completion_1.hasGlobalCliInstall)()) === false) {
|
||||
this.context.logger.warn('Setup completed successfully, but there does not seem to be a global install of the' +
|
||||
' Angular CLI. For autocompletion to work, the CLI will need to be on your `$PATH`, which' +
|
||||
' is typically done with the `-g` flag in `npm install -g @angular/cli`.' +
|
||||
'\n\n' +
|
||||
'For more information, see https://angular.dev/cli/completion#global-install');
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
exports.default = CompletionCommandModule;
|
||||
class CompletionScriptCommandModule extends command_module_1.CommandModule {
|
||||
command = 'script';
|
||||
describe = 'Generate a bash and zsh real-time type-ahead autocompletion script.';
|
||||
longDescriptionPath = undefined;
|
||||
builder(localYargs) {
|
||||
return localYargs;
|
||||
}
|
||||
run() {
|
||||
yargs_1.default.showCompletionScript();
|
||||
}
|
||||
}
|
||||
67
node_modules/@angular/cli/src/commands/completion/long-description.md
generated
vendored
Executable file
67
node_modules/@angular/cli/src/commands/completion/long-description.md
generated
vendored
Executable file
|
|
@ -0,0 +1,67 @@
|
|||
Setting up autocompletion configures your terminal, so pressing the `<TAB>` key while in the middle
|
||||
of typing will display various commands and options available to you. This makes it very easy to
|
||||
discover and use CLI commands without lots of memorization.
|
||||
|
||||

|
||||
|
||||
## Automated setup
|
||||
|
||||
The CLI should prompt and ask to set up autocompletion for you the first time you use it (v14+).
|
||||
Simply answer "Yes" and the CLI will take care of the rest.
|
||||
|
||||
```
|
||||
$ ng serve
|
||||
? Would you like to enable autocompletion? This will set up your terminal so pressing TAB while typing Angular CLI commands will show possible options and autocomplete arguments. (Enabling autocompletion will modify configuration files in your home directory.) Yes
|
||||
Appended `source <(ng completion script)` to `/home/my-username/.bashrc`. Restart your terminal or run:
|
||||
|
||||
source <(ng completion script)
|
||||
|
||||
to autocomplete `ng` commands.
|
||||
|
||||
# Serve output...
|
||||
```
|
||||
|
||||
If you already refused the prompt, it won't ask again. But you can run `ng completion` to
|
||||
do the same thing automatically.
|
||||
|
||||
This modifies your terminal environment to load Angular CLI autocompletion, but can't update your
|
||||
current terminal session. Either restart it or run `source <(ng completion script)` directly to
|
||||
enable autocompletion in your current session.
|
||||
|
||||
Test it out by typing `ng ser<TAB>` and it should autocomplete to `ng serve`. Ambiguous arguments
|
||||
will show all possible options and their documentation, such as `ng generate <TAB>`.
|
||||
|
||||
## Manual setup
|
||||
|
||||
Some users may have highly customized terminal setups, possibly with configuration files checked
|
||||
into source control with an opinionated structure. `ng completion` only ever appends Angular's setup
|
||||
to an existing configuration file for your current shell, or creates one if none exists. If you want
|
||||
more control over exactly where this configuration lives, you can manually set it up by having your
|
||||
shell run at startup:
|
||||
|
||||
```bash
|
||||
source <(ng completion script)
|
||||
```
|
||||
|
||||
This is equivalent to what `ng completion` will automatically set up, and gives power users more
|
||||
flexibility in their environments when desired.
|
||||
|
||||
## Platform support
|
||||
|
||||
Angular CLI supports autocompletion for the Bash and Zsh shells on MacOS and Linux operating
|
||||
systems. On Windows, Git Bash and [Windows Subsystem for Linux](https://docs.microsoft.com/en-us/windows/wsl/)
|
||||
using Bash or Zsh are supported.
|
||||
|
||||
## Global install
|
||||
|
||||
Autocompletion works by configuring your terminal to invoke the Angular CLI on startup to load the
|
||||
setup script. This means the terminal must be able to find and execute the Angular CLI, typically
|
||||
through a global install that places the binary on the user's `$PATH`. If you get
|
||||
`command not found: ng`, make sure the CLI is installed globally which you can do with the `-g`
|
||||
flag:
|
||||
|
||||
```bash
|
||||
npm install -g @angular/cli
|
||||
```
|
||||
24
node_modules/@angular/cli/src/commands/config/cli.d.ts
generated
vendored
Executable file
24
node_modules/@angular/cli/src/commands/config/cli.d.ts
generated
vendored
Executable file
|
|
@ -0,0 +1,24 @@
|
|||
/**
|
||||
* @license
|
||||
* Copyright Google LLC All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by an MIT-style license that can be
|
||||
* found in the LICENSE file at https://angular.dev/license
|
||||
*/
|
||||
import { Argv } from 'yargs';
|
||||
import { CommandModule, CommandModuleImplementation, Options } from '../../command-builder/command-module';
|
||||
interface ConfigCommandArgs {
|
||||
'json-path'?: string;
|
||||
value?: string;
|
||||
global?: boolean;
|
||||
}
|
||||
export default class ConfigCommandModule extends CommandModule<ConfigCommandArgs> implements CommandModuleImplementation<ConfigCommandArgs> {
|
||||
command: string;
|
||||
describe: string;
|
||||
longDescriptionPath: string;
|
||||
builder(localYargs: Argv): Argv<ConfigCommandArgs>;
|
||||
run(options: Options<ConfigCommandArgs>): Promise<number | void>;
|
||||
private get;
|
||||
private set;
|
||||
}
|
||||
export {};
|
||||
149
node_modules/@angular/cli/src/commands/config/cli.js
generated
vendored
Executable file
149
node_modules/@angular/cli/src/commands/config/cli.js
generated
vendored
Executable file
|
|
@ -0,0 +1,149 @@
|
|||
"use strict";
|
||||
/**
|
||||
* @license
|
||||
* Copyright Google LLC All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by an MIT-style license that can be
|
||||
* found in the LICENSE file at https://angular.dev/license
|
||||
*/
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const crypto_1 = require("crypto");
|
||||
const path_1 = require("path");
|
||||
const command_module_1 = require("../../command-builder/command-module");
|
||||
const config_1 = require("../../utilities/config");
|
||||
const json_file_1 = require("../../utilities/json-file");
|
||||
class ConfigCommandModule extends command_module_1.CommandModule {
|
||||
command = 'config [json-path] [value]';
|
||||
describe = 'Retrieves or sets Angular configuration values in the angular.json file for the workspace.';
|
||||
longDescriptionPath = (0, path_1.join)(__dirname, 'long-description.md');
|
||||
builder(localYargs) {
|
||||
return localYargs
|
||||
.positional('json-path', {
|
||||
description: `The configuration key to set or query, in JSON path format. ` +
|
||||
`For example: "a[3].foo.bar[2]". If no new value is provided, returns the current value of this key.`,
|
||||
type: 'string',
|
||||
})
|
||||
.positional('value', {
|
||||
description: 'If provided, a new value for the given configuration key.',
|
||||
type: 'string',
|
||||
})
|
||||
.option('global', {
|
||||
description: `Access the global configuration in the caller's home directory.`,
|
||||
alias: ['g'],
|
||||
type: 'boolean',
|
||||
default: false,
|
||||
})
|
||||
.strict();
|
||||
}
|
||||
async run(options) {
|
||||
const level = options.global ? 'global' : 'local';
|
||||
const [config] = await (0, config_1.getWorkspaceRaw)(level);
|
||||
if (options.value == undefined) {
|
||||
if (!config) {
|
||||
this.context.logger.error('No config found.');
|
||||
return 1;
|
||||
}
|
||||
return this.get(config, options);
|
||||
}
|
||||
else {
|
||||
return this.set(options);
|
||||
}
|
||||
}
|
||||
get(jsonFile, options) {
|
||||
const { logger } = this.context;
|
||||
const value = options.jsonPath
|
||||
? jsonFile.get(parseJsonPath(options.jsonPath))
|
||||
: jsonFile.content;
|
||||
if (value === undefined) {
|
||||
logger.error('Value cannot be found.');
|
||||
return 1;
|
||||
}
|
||||
else if (typeof value === 'string') {
|
||||
logger.info(value);
|
||||
}
|
||||
else {
|
||||
logger.info(JSON.stringify(value, null, 2));
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
async set(options) {
|
||||
if (!options.jsonPath?.trim()) {
|
||||
throw new command_module_1.CommandModuleError('Invalid Path.');
|
||||
}
|
||||
const [config, configPath] = await (0, config_1.getWorkspaceRaw)(options.global ? 'global' : 'local');
|
||||
const { logger } = this.context;
|
||||
if (!config || !configPath) {
|
||||
throw new command_module_1.CommandModuleError('Confguration file cannot be found.');
|
||||
}
|
||||
const normalizeUUIDValue = (v) => (v === '' ? (0, crypto_1.randomUUID)() : `${v}`);
|
||||
const value = options.jsonPath === 'cli.analyticsSharing.uuid'
|
||||
? normalizeUUIDValue(options.value)
|
||||
: options.value;
|
||||
const modified = config.modify(parseJsonPath(options.jsonPath), normalizeValue(value));
|
||||
if (!modified) {
|
||||
logger.error('Value cannot be found.');
|
||||
return 1;
|
||||
}
|
||||
await (0, config_1.validateWorkspace)((0, json_file_1.parseJson)(config.content), options.global ?? false);
|
||||
config.save();
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
exports.default = ConfigCommandModule;
|
||||
/**
|
||||
* Splits a JSON path string into fragments. Fragments can be used to get the value referenced
|
||||
* by the path. For example, a path of "a[3].foo.bar[2]" would give you a fragment array of
|
||||
* ["a", 3, "foo", "bar", 2].
|
||||
* @param path The JSON string to parse.
|
||||
* @returns {(string|number)[]} The fragments for the string.
|
||||
* @private
|
||||
*/
|
||||
function parseJsonPath(path) {
|
||||
const fragments = (path || '').split(/\./g);
|
||||
const result = [];
|
||||
while (fragments.length > 0) {
|
||||
const fragment = fragments.shift();
|
||||
if (fragment == undefined) {
|
||||
break;
|
||||
}
|
||||
const match = fragment.match(/([^[]+)((\[.*\])*)/);
|
||||
if (!match) {
|
||||
throw new command_module_1.CommandModuleError('Invalid JSON path.');
|
||||
}
|
||||
result.push(match[1]);
|
||||
if (match[2]) {
|
||||
const indices = match[2]
|
||||
.slice(1, -1)
|
||||
.split('][')
|
||||
.map((x) => (/^\d$/.test(x) ? +x : x.replace(/"|'/g, '')));
|
||||
result.push(...indices);
|
||||
}
|
||||
}
|
||||
return result.filter((fragment) => fragment != null);
|
||||
}
|
||||
function normalizeValue(value) {
|
||||
const valueString = `${value}`.trim();
|
||||
switch (valueString) {
|
||||
case 'true':
|
||||
return true;
|
||||
case 'false':
|
||||
return false;
|
||||
case 'null':
|
||||
return null;
|
||||
case 'undefined':
|
||||
return undefined;
|
||||
}
|
||||
if (isFinite(+valueString)) {
|
||||
return +valueString;
|
||||
}
|
||||
try {
|
||||
// We use `JSON.parse` instead of `parseJson` because the latter will parse UUIDs
|
||||
// and convert them into a numberic entities.
|
||||
// Example: 73b61974-182c-48e4-b4c6-30ddf08c5c98 -> 73.
|
||||
// These values should never contain comments, therefore using `JSON.parse` is safe.
|
||||
return JSON.parse(valueString);
|
||||
}
|
||||
catch {
|
||||
return value;
|
||||
}
|
||||
}
|
||||
13
node_modules/@angular/cli/src/commands/config/long-description.md
generated
vendored
Executable file
13
node_modules/@angular/cli/src/commands/config/long-description.md
generated
vendored
Executable file
|
|
@ -0,0 +1,13 @@
|
|||
A workspace has a single CLI configuration file, `angular.json`, at the top level.
|
||||
The `projects` object contains a configuration object for each project in the workspace.
|
||||
|
||||
You can edit the configuration directly in a code editor,
|
||||
or indirectly on the command line using this command.
|
||||
|
||||
The configurable property names match command option names,
|
||||
except that in the configuration file, all names must use camelCase,
|
||||
while on the command line options can be given dash-case.
|
||||
|
||||
For further details, see [Workspace Configuration](reference/configs/workspace-config).
|
||||
|
||||
For configuration of CLI usage analytics, see [ng analytics](cli/analytics).
|
||||
17
node_modules/@angular/cli/src/commands/deploy/cli.d.ts
generated
vendored
Executable file
17
node_modules/@angular/cli/src/commands/deploy/cli.d.ts
generated
vendored
Executable file
|
|
@ -0,0 +1,17 @@
|
|||
/**
|
||||
* @license
|
||||
* Copyright Google LLC All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by an MIT-style license that can be
|
||||
* found in the LICENSE file at https://angular.dev/license
|
||||
*/
|
||||
import { MissingTargetChoice } from '../../command-builder/architect-base-command-module';
|
||||
import { ArchitectCommandModule } from '../../command-builder/architect-command-module';
|
||||
import { CommandModuleImplementation } from '../../command-builder/command-module';
|
||||
export default class DeployCommandModule extends ArchitectCommandModule implements CommandModuleImplementation {
|
||||
missingTargetChoices: MissingTargetChoice[];
|
||||
multiTarget: boolean;
|
||||
command: string;
|
||||
longDescriptionPath: string;
|
||||
describe: string;
|
||||
}
|
||||
37
node_modules/@angular/cli/src/commands/deploy/cli.js
generated
vendored
Executable file
37
node_modules/@angular/cli/src/commands/deploy/cli.js
generated
vendored
Executable file
|
|
@ -0,0 +1,37 @@
|
|||
"use strict";
|
||||
/**
|
||||
* @license
|
||||
* Copyright Google LLC All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by an MIT-style license that can be
|
||||
* found in the LICENSE file at https://angular.dev/license
|
||||
*/
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const node_path_1 = require("node:path");
|
||||
const architect_command_module_1 = require("../../command-builder/architect-command-module");
|
||||
class DeployCommandModule extends architect_command_module_1.ArchitectCommandModule {
|
||||
// The below choices should be kept in sync with the list in https://angular.dev/tools/cli/deployment
|
||||
missingTargetChoices = [
|
||||
{
|
||||
name: 'Amazon S3',
|
||||
value: '@jefiozie/ngx-aws-deploy',
|
||||
},
|
||||
{
|
||||
name: 'Firebase',
|
||||
value: '@angular/fire',
|
||||
},
|
||||
{
|
||||
name: 'Netlify',
|
||||
value: '@netlify-builder/deploy',
|
||||
},
|
||||
{
|
||||
name: 'GitHub Pages',
|
||||
value: 'angular-cli-ghpages',
|
||||
},
|
||||
];
|
||||
multiTarget = false;
|
||||
command = 'deploy [project]';
|
||||
longDescriptionPath = (0, node_path_1.join)(__dirname, 'long-description.md');
|
||||
describe = 'Invokes the deploy builder for a specified project or for the default project in the workspace.';
|
||||
}
|
||||
exports.default = DeployCommandModule;
|
||||
22
node_modules/@angular/cli/src/commands/deploy/long-description.md
generated
vendored
Executable file
22
node_modules/@angular/cli/src/commands/deploy/long-description.md
generated
vendored
Executable file
|
|
@ -0,0 +1,22 @@
|
|||
The command takes an optional project name, as specified in the `projects` section of the `angular.json` workspace configuration file.
|
||||
When a project name is not supplied, executes the `deploy` builder for the default project.
|
||||
|
||||
To use the `ng deploy` command, use `ng add` to add a package that implements deployment capabilities to your favorite platform.
|
||||
Adding the package automatically updates your workspace configuration, adding a deployment
|
||||
[CLI builder](tools/cli/cli-builder).
|
||||
For example:
|
||||
|
||||
```json
|
||||
"projects": {
|
||||
"my-project": {
|
||||
...
|
||||
"architect": {
|
||||
...
|
||||
"deploy": {
|
||||
"builder": "@angular/fire:deploy",
|
||||
"options": {}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
18
node_modules/@angular/cli/src/commands/e2e/cli.d.ts
generated
vendored
Executable file
18
node_modules/@angular/cli/src/commands/e2e/cli.d.ts
generated
vendored
Executable file
|
|
@ -0,0 +1,18 @@
|
|||
/**
|
||||
* @license
|
||||
* Copyright Google LLC All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by an MIT-style license that can be
|
||||
* found in the LICENSE file at https://angular.dev/license
|
||||
*/
|
||||
import { MissingTargetChoice } from '../../command-builder/architect-base-command-module';
|
||||
import { ArchitectCommandModule } from '../../command-builder/architect-command-module';
|
||||
import { CommandModuleImplementation } from '../../command-builder/command-module';
|
||||
export default class E2eCommandModule extends ArchitectCommandModule implements CommandModuleImplementation {
|
||||
missingTargetChoices: MissingTargetChoice[];
|
||||
multiTarget: boolean;
|
||||
command: string;
|
||||
aliases: string[] | undefined;
|
||||
describe: string;
|
||||
longDescriptionPath?: string;
|
||||
}
|
||||
41
node_modules/@angular/cli/src/commands/e2e/cli.js
generated
vendored
Executable file
41
node_modules/@angular/cli/src/commands/e2e/cli.js
generated
vendored
Executable file
|
|
@ -0,0 +1,41 @@
|
|||
"use strict";
|
||||
/**
|
||||
* @license
|
||||
* Copyright Google LLC All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by an MIT-style license that can be
|
||||
* found in the LICENSE file at https://angular.dev/license
|
||||
*/
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const architect_command_module_1 = require("../../command-builder/architect-command-module");
|
||||
const command_config_1 = require("../command-config");
|
||||
class E2eCommandModule extends architect_command_module_1.ArchitectCommandModule {
|
||||
missingTargetChoices = [
|
||||
{
|
||||
name: 'Playwright',
|
||||
value: 'playwright-ng-schematics',
|
||||
},
|
||||
{
|
||||
name: 'Cypress',
|
||||
value: '@cypress/schematic',
|
||||
},
|
||||
{
|
||||
name: 'Nightwatch',
|
||||
value: '@nightwatch/schematics',
|
||||
},
|
||||
{
|
||||
name: 'WebdriverIO',
|
||||
value: '@wdio/schematics',
|
||||
},
|
||||
{
|
||||
name: 'Puppeteer',
|
||||
value: '@puppeteer/ng-schematics',
|
||||
},
|
||||
];
|
||||
multiTarget = true;
|
||||
command = 'e2e [project]';
|
||||
aliases = command_config_1.RootCommands['e2e'].aliases;
|
||||
describe = 'Builds and serves an Angular application, then runs end-to-end tests.';
|
||||
longDescriptionPath;
|
||||
}
|
||||
exports.default = E2eCommandModule;
|
||||
17
node_modules/@angular/cli/src/commands/extract-i18n/cli.d.ts
generated
vendored
Executable file
17
node_modules/@angular/cli/src/commands/extract-i18n/cli.d.ts
generated
vendored
Executable file
|
|
@ -0,0 +1,17 @@
|
|||
/**
|
||||
* @license
|
||||
* Copyright Google LLC All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by an MIT-style license that can be
|
||||
* found in the LICENSE file at https://angular.dev/license
|
||||
*/
|
||||
import { workspaces } from '@angular-devkit/core';
|
||||
import { ArchitectCommandModule } from '../../command-builder/architect-command-module';
|
||||
import { CommandModuleImplementation } from '../../command-builder/command-module';
|
||||
export default class ExtractI18nCommandModule extends ArchitectCommandModule implements CommandModuleImplementation {
|
||||
multiTarget: boolean;
|
||||
command: string;
|
||||
describe: string;
|
||||
longDescriptionPath?: string | undefined;
|
||||
findDefaultBuilderName(project: workspaces.ProjectDefinition): Promise<string | undefined>;
|
||||
}
|
||||
47
node_modules/@angular/cli/src/commands/extract-i18n/cli.js
generated
vendored
Executable file
47
node_modules/@angular/cli/src/commands/extract-i18n/cli.js
generated
vendored
Executable file
|
|
@ -0,0 +1,47 @@
|
|||
"use strict";
|
||||
/**
|
||||
* @license
|
||||
* Copyright Google LLC All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by an MIT-style license that can be
|
||||
* found in the LICENSE file at https://angular.dev/license
|
||||
*/
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const node_module_1 = require("node:module");
|
||||
const node_path_1 = require("node:path");
|
||||
const architect_command_module_1 = require("../../command-builder/architect-command-module");
|
||||
class ExtractI18nCommandModule extends architect_command_module_1.ArchitectCommandModule {
|
||||
multiTarget = false;
|
||||
command = 'extract-i18n [project]';
|
||||
describe = 'Extracts i18n messages from source code.';
|
||||
longDescriptionPath;
|
||||
async findDefaultBuilderName(project) {
|
||||
// Only application type projects have a default i18n extraction target
|
||||
if (project.extensions['projectType'] !== 'application') {
|
||||
return;
|
||||
}
|
||||
const buildTarget = project.targets.get('build');
|
||||
if (!buildTarget) {
|
||||
// No default if there is no build target
|
||||
return;
|
||||
}
|
||||
// Provide a default based on the defined builder for the 'build' target
|
||||
switch (buildTarget.builder) {
|
||||
case '@angular-devkit/build-angular:application':
|
||||
case '@angular-devkit/build-angular:browser-esbuild':
|
||||
case '@angular-devkit/build-angular:browser':
|
||||
return '@angular-devkit/build-angular:extract-i18n';
|
||||
case '@angular/build:application':
|
||||
return '@angular/build:extract-i18n';
|
||||
}
|
||||
// For other builders, check for `@angular-devkit/build-angular` and use if found.
|
||||
// This package is safer to use since it supports both application builder types.
|
||||
try {
|
||||
const projectRequire = (0, node_module_1.createRequire)((0, node_path_1.join)(this.context.root, project.root) + '/');
|
||||
projectRequire.resolve('@angular-devkit/build-angular');
|
||||
return '@angular-devkit/build-angular:extract-i18n';
|
||||
}
|
||||
catch { }
|
||||
}
|
||||
}
|
||||
exports.default = ExtractI18nCommandModule;
|
||||
47
node_modules/@angular/cli/src/commands/generate/cli.d.ts
generated
vendored
Executable file
47
node_modules/@angular/cli/src/commands/generate/cli.d.ts
generated
vendored
Executable file
|
|
@ -0,0 +1,47 @@
|
|||
/**
|
||||
* @license
|
||||
* Copyright Google LLC All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by an MIT-style license that can be
|
||||
* found in the LICENSE file at https://angular.dev/license
|
||||
*/
|
||||
import { Argv } from 'yargs';
|
||||
import { CommandModuleImplementation, Options, OtherOptions } from '../../command-builder/command-module';
|
||||
import { SchematicsCommandArgs, SchematicsCommandModule } from '../../command-builder/schematics-command-module';
|
||||
interface GenerateCommandArgs extends SchematicsCommandArgs {
|
||||
schematic?: string;
|
||||
}
|
||||
export default class GenerateCommandModule extends SchematicsCommandModule implements CommandModuleImplementation<GenerateCommandArgs> {
|
||||
command: string;
|
||||
aliases: string[] | undefined;
|
||||
describe: string;
|
||||
longDescriptionPath?: string | undefined;
|
||||
builder(argv: Argv): Promise<Argv<GenerateCommandArgs>>;
|
||||
run(options: Options<GenerateCommandArgs> & OtherOptions): Promise<number | void>;
|
||||
private getCollectionNames;
|
||||
private shouldAddCollectionNameAsPartOfCommand;
|
||||
/**
|
||||
* Generate an aliases string array to be passed to the command builder.
|
||||
*
|
||||
* @example `[component]` or `[@schematics/angular:component]`.
|
||||
*/
|
||||
private generateCommandAliasesStrings;
|
||||
/**
|
||||
* Generate a command string to be passed to the command builder.
|
||||
*
|
||||
* @example `component [name]` or `@schematics/angular:component [name]`.
|
||||
*/
|
||||
private generateCommandString;
|
||||
/**
|
||||
* Get schematics that can to be registered as subcommands.
|
||||
*/
|
||||
private getSchematics;
|
||||
private listSchematicAliases;
|
||||
/**
|
||||
* Get schematics that should to be registered as subcommands.
|
||||
*
|
||||
* @returns a sorted list of schematic that needs to be registered as subcommands.
|
||||
*/
|
||||
private getSchematicsToRegister;
|
||||
}
|
||||
export {};
|
||||
188
node_modules/@angular/cli/src/commands/generate/cli.js
generated
vendored
Executable file
188
node_modules/@angular/cli/src/commands/generate/cli.js
generated
vendored
Executable file
|
|
@ -0,0 +1,188 @@
|
|||
"use strict";
|
||||
/**
|
||||
* @license
|
||||
* Copyright Google LLC All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by an MIT-style license that can be
|
||||
* found in the LICENSE file at https://angular.dev/license
|
||||
*/
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const core_1 = require("@angular-devkit/core");
|
||||
const command_module_1 = require("../../command-builder/command-module");
|
||||
const schematics_command_module_1 = require("../../command-builder/schematics-command-module");
|
||||
const command_1 = require("../../command-builder/utilities/command");
|
||||
const command_config_1 = require("../command-config");
|
||||
class GenerateCommandModule extends schematics_command_module_1.SchematicsCommandModule {
|
||||
command = 'generate';
|
||||
aliases = command_config_1.RootCommands['generate'].aliases;
|
||||
describe = 'Generates and/or modifies files based on a schematic.';
|
||||
longDescriptionPath;
|
||||
async builder(argv) {
|
||||
let localYargs = (await super.builder(argv)).command({
|
||||
command: '$0 <schematic>',
|
||||
describe: 'Run the provided schematic.',
|
||||
builder: (localYargs) => localYargs
|
||||
.positional('schematic', {
|
||||
describe: 'The [collection:schematic] to run.',
|
||||
type: 'string',
|
||||
demandOption: true,
|
||||
})
|
||||
.strict(),
|
||||
handler: (options) => this.handler(options),
|
||||
});
|
||||
for (const [schematicName, collectionName] of await this.getSchematicsToRegister()) {
|
||||
const workflow = this.getOrCreateWorkflowForBuilder(collectionName);
|
||||
const collection = workflow.engine.createCollection(collectionName);
|
||||
const { description: { schemaJson, aliases: schematicAliases, hidden: schematicHidden, description: schematicDescription, }, } = collection.createSchematic(schematicName, true);
|
||||
if (!schemaJson) {
|
||||
continue;
|
||||
}
|
||||
const { 'x-deprecated': xDeprecated, description = schematicDescription, hidden = schematicHidden, } = schemaJson;
|
||||
const options = await this.getSchematicOptions(collection, schematicName, workflow);
|
||||
localYargs = localYargs.command({
|
||||
command: await this.generateCommandString(collectionName, schematicName, options),
|
||||
// When 'describe' is set to false, it results in a hidden command.
|
||||
describe: hidden === true ? false : typeof description === 'string' ? description : '',
|
||||
deprecated: xDeprecated === true || typeof xDeprecated === 'string' ? xDeprecated : false,
|
||||
aliases: Array.isArray(schematicAliases)
|
||||
? await this.generateCommandAliasesStrings(collectionName, schematicAliases)
|
||||
: undefined,
|
||||
builder: (localYargs) => this.addSchemaOptionsToCommand(localYargs, options).strict(),
|
||||
handler: (options) => this.handler({
|
||||
...options,
|
||||
schematic: `${collectionName}:${schematicName}`,
|
||||
}),
|
||||
});
|
||||
}
|
||||
return localYargs.demandCommand(1, command_1.demandCommandFailureMessage);
|
||||
}
|
||||
async run(options) {
|
||||
const { dryRun, schematic, defaults, force, interactive, ...schematicOptions } = options;
|
||||
const [collectionName, schematicName] = this.parseSchematicInfo(schematic);
|
||||
if (!collectionName || !schematicName) {
|
||||
throw new command_module_1.CommandModuleError('A collection and schematic is required during execution.');
|
||||
}
|
||||
return this.runSchematic({
|
||||
collectionName,
|
||||
schematicName,
|
||||
schematicOptions,
|
||||
executionOptions: {
|
||||
dryRun,
|
||||
defaults,
|
||||
force,
|
||||
interactive,
|
||||
},
|
||||
});
|
||||
}
|
||||
async getCollectionNames() {
|
||||
const [collectionName] = this.parseSchematicInfo(
|
||||
// positional = [generate, component] or [generate]
|
||||
this.context.args.positional[1]);
|
||||
return collectionName ? [collectionName] : [...(await this.getSchematicCollections())];
|
||||
}
|
||||
async shouldAddCollectionNameAsPartOfCommand() {
|
||||
const [collectionNameFromArgs] = this.parseSchematicInfo(
|
||||
// positional = [generate, component] or [generate]
|
||||
this.context.args.positional[1]);
|
||||
const schematicCollectionsFromConfig = await this.getSchematicCollections();
|
||||
const collectionNames = await this.getCollectionNames();
|
||||
// Only add the collection name as part of the command when it's not a known
|
||||
// schematics collection or when it has been provided via the CLI.
|
||||
// Ex:`ng generate @schematics/angular:c`
|
||||
return (!!collectionNameFromArgs ||
|
||||
!collectionNames.some((c) => schematicCollectionsFromConfig.has(c)));
|
||||
}
|
||||
/**
|
||||
* Generate an aliases string array to be passed to the command builder.
|
||||
*
|
||||
* @example `[component]` or `[@schematics/angular:component]`.
|
||||
*/
|
||||
async generateCommandAliasesStrings(collectionName, schematicAliases) {
|
||||
// Only add the collection name as part of the command when it's not a known
|
||||
// schematics collection or when it has been provided via the CLI.
|
||||
// Ex:`ng generate @schematics/angular:c`
|
||||
return (await this.shouldAddCollectionNameAsPartOfCommand())
|
||||
? schematicAliases.map((alias) => `${collectionName}:${alias}`)
|
||||
: schematicAliases;
|
||||
}
|
||||
/**
|
||||
* Generate a command string to be passed to the command builder.
|
||||
*
|
||||
* @example `component [name]` or `@schematics/angular:component [name]`.
|
||||
*/
|
||||
async generateCommandString(collectionName, schematicName, options) {
|
||||
const dasherizedSchematicName = core_1.strings.dasherize(schematicName);
|
||||
// Only add the collection name as part of the command when it's not a known
|
||||
// schematics collection or when it has been provided via the CLI.
|
||||
// Ex:`ng generate @schematics/angular:component`
|
||||
const commandName = (await this.shouldAddCollectionNameAsPartOfCommand())
|
||||
? collectionName + ':' + dasherizedSchematicName
|
||||
: dasherizedSchematicName;
|
||||
const positionalArgs = options
|
||||
.filter((o) => o.positional !== undefined)
|
||||
.map((o) => {
|
||||
const label = `${core_1.strings.dasherize(o.name)}${o.type === 'array' ? ' ..' : ''}`;
|
||||
return o.required ? `<${label}>` : `[${label}]`;
|
||||
})
|
||||
.join(' ');
|
||||
return `${commandName}${positionalArgs ? ' ' + positionalArgs : ''}`;
|
||||
}
|
||||
/**
|
||||
* Get schematics that can to be registered as subcommands.
|
||||
*/
|
||||
async *getSchematics() {
|
||||
const seenNames = new Set();
|
||||
for (const collectionName of await this.getCollectionNames()) {
|
||||
const workflow = this.getOrCreateWorkflowForBuilder(collectionName);
|
||||
const collection = workflow.engine.createCollection(collectionName);
|
||||
for (const schematicName of collection.listSchematicNames(true /** includeHidden */)) {
|
||||
// If a schematic with this same name is already registered skip.
|
||||
if (!seenNames.has(schematicName)) {
|
||||
seenNames.add(schematicName);
|
||||
yield {
|
||||
schematicName,
|
||||
collectionName,
|
||||
schematicAliases: this.listSchematicAliases(collection, schematicName),
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
listSchematicAliases(collection, schematicName) {
|
||||
const description = collection.description.schematics[schematicName];
|
||||
if (description) {
|
||||
return description.aliases && new Set(description.aliases);
|
||||
}
|
||||
// Extended collections
|
||||
if (collection.baseDescriptions) {
|
||||
for (const base of collection.baseDescriptions) {
|
||||
const description = base.schematics[schematicName];
|
||||
if (description) {
|
||||
return description.aliases && new Set(description.aliases);
|
||||
}
|
||||
}
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
/**
|
||||
* Get schematics that should to be registered as subcommands.
|
||||
*
|
||||
* @returns a sorted list of schematic that needs to be registered as subcommands.
|
||||
*/
|
||||
async getSchematicsToRegister() {
|
||||
const schematicsToRegister = [];
|
||||
const [, schematicNameFromArgs] = this.parseSchematicInfo(
|
||||
// positional = [generate, component] or [generate]
|
||||
this.context.args.positional[1]);
|
||||
for await (const { schematicName, collectionName, schematicAliases } of this.getSchematics()) {
|
||||
if (schematicNameFromArgs &&
|
||||
(schematicName === schematicNameFromArgs || schematicAliases?.has(schematicNameFromArgs))) {
|
||||
return [[schematicName, collectionName]];
|
||||
}
|
||||
schematicsToRegister.push([schematicName, collectionName]);
|
||||
}
|
||||
// Didn't find the schematic or no schematic name was provided Ex: `ng generate --help`.
|
||||
return schematicsToRegister.sort(([nameA], [nameB]) => nameA.localeCompare(nameB, undefined, { sensitivity: 'accent' }));
|
||||
}
|
||||
}
|
||||
exports.default = GenerateCommandModule;
|
||||
17
node_modules/@angular/cli/src/commands/lint/cli.d.ts
generated
vendored
Executable file
17
node_modules/@angular/cli/src/commands/lint/cli.d.ts
generated
vendored
Executable file
|
|
@ -0,0 +1,17 @@
|
|||
/**
|
||||
* @license
|
||||
* Copyright Google LLC All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by an MIT-style license that can be
|
||||
* found in the LICENSE file at https://angular.dev/license
|
||||
*/
|
||||
import { MissingTargetChoice } from '../../command-builder/architect-base-command-module';
|
||||
import { ArchitectCommandModule } from '../../command-builder/architect-command-module';
|
||||
import { CommandModuleImplementation } from '../../command-builder/command-module';
|
||||
export default class LintCommandModule extends ArchitectCommandModule implements CommandModuleImplementation {
|
||||
missingTargetChoices: MissingTargetChoice[];
|
||||
multiTarget: boolean;
|
||||
command: string;
|
||||
longDescriptionPath: string;
|
||||
describe: string;
|
||||
}
|
||||
24
node_modules/@angular/cli/src/commands/lint/cli.js
generated
vendored
Executable file
24
node_modules/@angular/cli/src/commands/lint/cli.js
generated
vendored
Executable file
|
|
@ -0,0 +1,24 @@
|
|||
"use strict";
|
||||
/**
|
||||
* @license
|
||||
* Copyright Google LLC All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by an MIT-style license that can be
|
||||
* found in the LICENSE file at https://angular.dev/license
|
||||
*/
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const path_1 = require("path");
|
||||
const architect_command_module_1 = require("../../command-builder/architect-command-module");
|
||||
class LintCommandModule extends architect_command_module_1.ArchitectCommandModule {
|
||||
missingTargetChoices = [
|
||||
{
|
||||
name: 'ESLint',
|
||||
value: '@angular-eslint/schematics',
|
||||
},
|
||||
];
|
||||
multiTarget = true;
|
||||
command = 'lint [project]';
|
||||
longDescriptionPath = (0, path_1.join)(__dirname, 'long-description.md');
|
||||
describe = 'Runs linting tools on Angular application code in a given project folder.';
|
||||
}
|
||||
exports.default = LintCommandModule;
|
||||
20
node_modules/@angular/cli/src/commands/lint/long-description.md
generated
vendored
Executable file
20
node_modules/@angular/cli/src/commands/lint/long-description.md
generated
vendored
Executable file
|
|
@ -0,0 +1,20 @@
|
|||
The command takes an optional project name, as specified in the `projects` section of the `angular.json` workspace configuration file.
|
||||
When a project name is not supplied, executes the `lint` builder for all projects.
|
||||
|
||||
To use the `ng lint` command, use `ng add` to add a package that implements linting capabilities. Adding the package automatically updates your workspace configuration, adding a lint [CLI builder](tools/cli/cli-builder).
|
||||
For example:
|
||||
|
||||
```json
|
||||
"projects": {
|
||||
"my-project": {
|
||||
...
|
||||
"architect": {
|
||||
...
|
||||
"lint": {
|
||||
"builder": "@angular-eslint/builder:lint",
|
||||
"options": {}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
17
node_modules/@angular/cli/src/commands/make-this-awesome/cli.d.ts
generated
vendored
Executable file
17
node_modules/@angular/cli/src/commands/make-this-awesome/cli.d.ts
generated
vendored
Executable file
|
|
@ -0,0 +1,17 @@
|
|||
/**
|
||||
* @license
|
||||
* Copyright Google LLC All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by an MIT-style license that can be
|
||||
* found in the LICENSE file at https://angular.dev/license
|
||||
*/
|
||||
import { Argv } from 'yargs';
|
||||
import { CommandModule, CommandModuleImplementation } from '../../command-builder/command-module';
|
||||
export default class AwesomeCommandModule extends CommandModule implements CommandModuleImplementation {
|
||||
command: string;
|
||||
describe: false;
|
||||
deprecated: boolean;
|
||||
longDescriptionPath?: string | undefined;
|
||||
builder(localYargs: Argv): Argv;
|
||||
run(): void;
|
||||
}
|
||||
35
node_modules/@angular/cli/src/commands/make-this-awesome/cli.js
generated
vendored
Executable file
35
node_modules/@angular/cli/src/commands/make-this-awesome/cli.js
generated
vendored
Executable file
|
|
@ -0,0 +1,35 @@
|
|||
"use strict";
|
||||
/**
|
||||
* @license
|
||||
* Copyright Google LLC All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by an MIT-style license that can be
|
||||
* found in the LICENSE file at https://angular.dev/license
|
||||
*/
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const command_module_1 = require("../../command-builder/command-module");
|
||||
const color_1 = require("../../utilities/color");
|
||||
class AwesomeCommandModule extends command_module_1.CommandModule {
|
||||
command = 'make-this-awesome';
|
||||
describe = false;
|
||||
deprecated = false;
|
||||
longDescriptionPath;
|
||||
builder(localYargs) {
|
||||
return localYargs;
|
||||
}
|
||||
run() {
|
||||
const pickOne = (of) => of[Math.floor(Math.random() * of.length)];
|
||||
const phrase = pickOne([
|
||||
`You're on it, there's nothing for me to do!`,
|
||||
`Let's take a look... nope, it's all good!`,
|
||||
`You're doing fine.`,
|
||||
`You're already doing great.`,
|
||||
`Nothing to do; already awesome. Exiting.`,
|
||||
`Error 418: As Awesome As Can Get.`,
|
||||
`I spy with my little eye a great developer!`,
|
||||
`Noop... already awesome.`,
|
||||
]);
|
||||
this.context.logger.info(color_1.colors.green(phrase));
|
||||
}
|
||||
}
|
||||
exports.default = AwesomeCommandModule;
|
||||
27
node_modules/@angular/cli/src/commands/new/cli.d.ts
generated
vendored
Executable file
27
node_modules/@angular/cli/src/commands/new/cli.d.ts
generated
vendored
Executable file
|
|
@ -0,0 +1,27 @@
|
|||
/**
|
||||
* @license
|
||||
* Copyright Google LLC All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by an MIT-style license that can be
|
||||
* found in the LICENSE file at https://angular.dev/license
|
||||
*/
|
||||
import { Argv } from 'yargs';
|
||||
import { CommandModuleImplementation, CommandScope, Options, OtherOptions } from '../../command-builder/command-module';
|
||||
import { SchematicsCommandArgs, SchematicsCommandModule } from '../../command-builder/schematics-command-module';
|
||||
interface NewCommandArgs extends SchematicsCommandArgs {
|
||||
collection?: string;
|
||||
}
|
||||
export default class NewCommandModule extends SchematicsCommandModule implements CommandModuleImplementation<NewCommandArgs> {
|
||||
private readonly schematicName;
|
||||
scope: CommandScope;
|
||||
protected allowPrivateSchematics: boolean;
|
||||
command: string;
|
||||
aliases: string[] | undefined;
|
||||
describe: string;
|
||||
longDescriptionPath: string;
|
||||
builder(argv: Argv): Promise<Argv<NewCommandArgs>>;
|
||||
run(options: Options<NewCommandArgs> & OtherOptions): Promise<number | void>;
|
||||
/** Find a collection from config that has an `ng-new` schematic. */
|
||||
private getCollectionFromConfig;
|
||||
}
|
||||
export {};
|
||||
74
node_modules/@angular/cli/src/commands/new/cli.js
generated
vendored
Executable file
74
node_modules/@angular/cli/src/commands/new/cli.js
generated
vendored
Executable file
|
|
@ -0,0 +1,74 @@
|
|||
"use strict";
|
||||
/**
|
||||
* @license
|
||||
* Copyright Google LLC All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by an MIT-style license that can be
|
||||
* found in the LICENSE file at https://angular.dev/license
|
||||
*/
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const node_path_1 = require("node:path");
|
||||
const command_module_1 = require("../../command-builder/command-module");
|
||||
const schematics_command_module_1 = require("../../command-builder/schematics-command-module");
|
||||
const version_1 = require("../../utilities/version");
|
||||
const command_config_1 = require("../command-config");
|
||||
class NewCommandModule extends schematics_command_module_1.SchematicsCommandModule {
|
||||
schematicName = 'ng-new';
|
||||
scope = command_module_1.CommandScope.Out;
|
||||
allowPrivateSchematics = true;
|
||||
command = 'new [name]';
|
||||
aliases = command_config_1.RootCommands['new'].aliases;
|
||||
describe = 'Creates a new Angular workspace.';
|
||||
longDescriptionPath = (0, node_path_1.join)(__dirname, 'long-description.md');
|
||||
async builder(argv) {
|
||||
const localYargs = (await super.builder(argv)).option('collection', {
|
||||
alias: 'c',
|
||||
describe: 'A collection of schematics to use in generating the initial application.',
|
||||
type: 'string',
|
||||
});
|
||||
const { options: { collection: collectionNameFromArgs }, } = this.context.args;
|
||||
const collectionName = typeof collectionNameFromArgs === 'string'
|
||||
? collectionNameFromArgs
|
||||
: await this.getCollectionFromConfig();
|
||||
const workflow = this.getOrCreateWorkflowForBuilder(collectionName);
|
||||
const collection = workflow.engine.createCollection(collectionName);
|
||||
const options = await this.getSchematicOptions(collection, this.schematicName, workflow);
|
||||
return this.addSchemaOptionsToCommand(localYargs, options);
|
||||
}
|
||||
async run(options) {
|
||||
// Register the version of the CLI in the registry.
|
||||
const collectionName = options.collection ?? (await this.getCollectionFromConfig());
|
||||
const { dryRun, force, interactive, defaults, collection, ...schematicOptions } = options;
|
||||
const workflow = await this.getOrCreateWorkflowForExecution(collectionName, {
|
||||
dryRun,
|
||||
force,
|
||||
interactive,
|
||||
defaults,
|
||||
});
|
||||
workflow.registry.addSmartDefaultProvider('ng-cli-version', () => version_1.VERSION.full);
|
||||
return this.runSchematic({
|
||||
collectionName,
|
||||
schematicName: this.schematicName,
|
||||
schematicOptions,
|
||||
executionOptions: {
|
||||
dryRun,
|
||||
force,
|
||||
interactive,
|
||||
defaults,
|
||||
},
|
||||
});
|
||||
}
|
||||
/** Find a collection from config that has an `ng-new` schematic. */
|
||||
async getCollectionFromConfig() {
|
||||
for (const collectionName of await this.getSchematicCollections()) {
|
||||
const workflow = this.getOrCreateWorkflowForBuilder(collectionName);
|
||||
const collection = workflow.engine.createCollection(collectionName);
|
||||
const schematicsInCollection = collection.description.schematics;
|
||||
if (Object.keys(schematicsInCollection).includes(this.schematicName)) {
|
||||
return collectionName;
|
||||
}
|
||||
}
|
||||
return schematics_command_module_1.DEFAULT_SCHEMATICS_COLLECTION;
|
||||
}
|
||||
}
|
||||
exports.default = NewCommandModule;
|
||||
15
node_modules/@angular/cli/src/commands/new/long-description.md
generated
vendored
Executable file
15
node_modules/@angular/cli/src/commands/new/long-description.md
generated
vendored
Executable file
|
|
@ -0,0 +1,15 @@
|
|||
Creates and initializes a new Angular application that is the default project for a new workspace.
|
||||
|
||||
Provides interactive prompts for optional configuration, such as adding routing support.
|
||||
All prompts can safely be allowed to default.
|
||||
|
||||
- The new workspace folder is given the specified project name, and contains configuration files at the top level.
|
||||
|
||||
- By default, the files for a new initial application (with the same name as the workspace) are placed in the `src/` subfolder.
|
||||
- The new application's configuration appears in the `projects` section of the `angular.json` workspace configuration file, under its project name.
|
||||
|
||||
- Subsequent applications that you generate in the workspace reside in the `projects/` subfolder.
|
||||
|
||||
If you plan to have multiple applications in the workspace, you can create an empty workspace by using the `--no-create-application` option.
|
||||
You can then use `ng generate application` to create an initial application.
|
||||
This allows a workspace name different from the initial app name, and ensures that all applications reside in the `/projects` subfolder, matching the structure of the configuration file.
|
||||
25
node_modules/@angular/cli/src/commands/run/cli.d.ts
generated
vendored
Executable file
25
node_modules/@angular/cli/src/commands/run/cli.d.ts
generated
vendored
Executable file
|
|
@ -0,0 +1,25 @@
|
|||
/**
|
||||
* @license
|
||||
* Copyright Google LLC All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by an MIT-style license that can be
|
||||
* found in the LICENSE file at https://angular.dev/license
|
||||
*/
|
||||
import { Target } from '@angular-devkit/architect';
|
||||
import { Argv } from 'yargs';
|
||||
import { ArchitectBaseCommandModule } from '../../command-builder/architect-base-command-module';
|
||||
import { CommandModuleImplementation, CommandScope, Options, OtherOptions } from '../../command-builder/command-module';
|
||||
export interface RunCommandArgs {
|
||||
target: string;
|
||||
}
|
||||
export default class RunCommandModule extends ArchitectBaseCommandModule<RunCommandArgs> implements CommandModuleImplementation<RunCommandArgs> {
|
||||
scope: CommandScope;
|
||||
command: string;
|
||||
describe: string;
|
||||
longDescriptionPath: string;
|
||||
builder(argv: Argv): Promise<Argv<RunCommandArgs>>;
|
||||
run(options: Options<RunCommandArgs> & OtherOptions): Promise<number>;
|
||||
protected makeTargetSpecifier(options?: Options<RunCommandArgs>): Target | undefined;
|
||||
/** @returns a sorted list of target specifiers to be used for auto completion. */
|
||||
private getTargetChoices;
|
||||
}
|
||||
88
node_modules/@angular/cli/src/commands/run/cli.js
generated
vendored
Executable file
88
node_modules/@angular/cli/src/commands/run/cli.js
generated
vendored
Executable file
|
|
@ -0,0 +1,88 @@
|
|||
"use strict";
|
||||
/**
|
||||
* @license
|
||||
* Copyright Google LLC All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by an MIT-style license that can be
|
||||
* found in the LICENSE file at https://angular.dev/license
|
||||
*/
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const path_1 = require("path");
|
||||
const architect_base_command_module_1 = require("../../command-builder/architect-base-command-module");
|
||||
const command_module_1 = require("../../command-builder/command-module");
|
||||
class RunCommandModule extends architect_base_command_module_1.ArchitectBaseCommandModule {
|
||||
scope = command_module_1.CommandScope.In;
|
||||
command = 'run <target>';
|
||||
describe = 'Runs an Architect target with an optional custom builder configuration defined in your project.';
|
||||
longDescriptionPath = (0, path_1.join)(__dirname, 'long-description.md');
|
||||
async builder(argv) {
|
||||
const { jsonHelp, getYargsCompletions, help } = this.context.args.options;
|
||||
const localYargs = argv
|
||||
.positional('target', {
|
||||
describe: 'The Architect target to run provided in the following format `project:target[:configuration]`.',
|
||||
type: 'string',
|
||||
demandOption: true,
|
||||
// Show only in when using --help and auto completion because otherwise comma seperated configuration values will be invalid.
|
||||
// Also, hide choices from JSON help so that we don't display them in AIO.
|
||||
choices: (getYargsCompletions || help) && !jsonHelp ? this.getTargetChoices() : undefined,
|
||||
})
|
||||
.middleware((args) => {
|
||||
// TODO: remove in version 15.
|
||||
const { configuration, target } = args;
|
||||
if (typeof configuration === 'string' && target) {
|
||||
const targetWithConfig = target.split(':', 2);
|
||||
targetWithConfig.push(configuration);
|
||||
throw new command_module_1.CommandModuleError('Unknown argument: configuration.\n' +
|
||||
`Provide the configuration as part of the target 'ng run ${targetWithConfig.join(':')}'.`);
|
||||
}
|
||||
}, true)
|
||||
.strict();
|
||||
const target = this.makeTargetSpecifier();
|
||||
if (!target) {
|
||||
return localYargs;
|
||||
}
|
||||
const schemaOptions = await this.getArchitectTargetOptions(target);
|
||||
return this.addSchemaOptionsToCommand(localYargs, schemaOptions);
|
||||
}
|
||||
async run(options) {
|
||||
const target = this.makeTargetSpecifier(options);
|
||||
const { target: _target, ...extraOptions } = options;
|
||||
if (!target) {
|
||||
throw new command_module_1.CommandModuleError('Cannot determine project or target.');
|
||||
}
|
||||
return this.runSingleTarget(target, extraOptions);
|
||||
}
|
||||
makeTargetSpecifier(options) {
|
||||
const architectTarget = options?.target ?? this.context.args.positional[1];
|
||||
if (!architectTarget) {
|
||||
return undefined;
|
||||
}
|
||||
const [project = '', target = '', configuration] = architectTarget.split(':');
|
||||
return {
|
||||
project,
|
||||
target,
|
||||
configuration,
|
||||
};
|
||||
}
|
||||
/** @returns a sorted list of target specifiers to be used for auto completion. */
|
||||
getTargetChoices() {
|
||||
if (!this.context.workspace) {
|
||||
return;
|
||||
}
|
||||
const targets = [];
|
||||
for (const [projectName, project] of this.context.workspace.projects) {
|
||||
for (const [targetName, target] of project.targets) {
|
||||
const currentTarget = `${projectName}:${targetName}`;
|
||||
targets.push(currentTarget);
|
||||
if (!target.configurations) {
|
||||
continue;
|
||||
}
|
||||
for (const configName of Object.keys(target.configurations)) {
|
||||
targets.push(`${currentTarget}:${configName}`);
|
||||
}
|
||||
}
|
||||
}
|
||||
return targets.sort();
|
||||
}
|
||||
}
|
||||
exports.default = RunCommandModule;
|
||||
10
node_modules/@angular/cli/src/commands/run/long-description.md
generated
vendored
Executable file
10
node_modules/@angular/cli/src/commands/run/long-description.md
generated
vendored
Executable file
|
|
@ -0,0 +1,10 @@
|
|||
Architect is the tool that the CLI uses to perform complex tasks such as compilation, according to provided configurations.
|
||||
The CLI commands run Architect targets such as `build`, `serve`, `test`, and `lint`.
|
||||
Each named target has a default configuration, specified by an `options` object,
|
||||
and an optional set of named alternate configurations in the `configurations` object.
|
||||
|
||||
For example, the `serve` target for a newly generated app has a predefined
|
||||
alternate configuration named `production`.
|
||||
|
||||
You can define new targets and their configuration options in the `architect` section
|
||||
of the `angular.json` file which you can run them from the command line using the `ng run` command.
|
||||
16
node_modules/@angular/cli/src/commands/serve/cli.d.ts
generated
vendored
Executable file
16
node_modules/@angular/cli/src/commands/serve/cli.d.ts
generated
vendored
Executable file
|
|
@ -0,0 +1,16 @@
|
|||
/**
|
||||
* @license
|
||||
* Copyright Google LLC All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by an MIT-style license that can be
|
||||
* found in the LICENSE file at https://angular.dev/license
|
||||
*/
|
||||
import { ArchitectCommandModule } from '../../command-builder/architect-command-module';
|
||||
import { CommandModuleImplementation } from '../../command-builder/command-module';
|
||||
export default class ServeCommandModule extends ArchitectCommandModule implements CommandModuleImplementation {
|
||||
multiTarget: boolean;
|
||||
command: string;
|
||||
aliases: string[] | undefined;
|
||||
describe: string;
|
||||
longDescriptionPath?: string | undefined;
|
||||
}
|
||||
19
node_modules/@angular/cli/src/commands/serve/cli.js
generated
vendored
Executable file
19
node_modules/@angular/cli/src/commands/serve/cli.js
generated
vendored
Executable file
|
|
@ -0,0 +1,19 @@
|
|||
"use strict";
|
||||
/**
|
||||
* @license
|
||||
* Copyright Google LLC All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by an MIT-style license that can be
|
||||
* found in the LICENSE file at https://angular.dev/license
|
||||
*/
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const architect_command_module_1 = require("../../command-builder/architect-command-module");
|
||||
const command_config_1 = require("../command-config");
|
||||
class ServeCommandModule extends architect_command_module_1.ArchitectCommandModule {
|
||||
multiTarget = false;
|
||||
command = 'serve [project]';
|
||||
aliases = command_config_1.RootCommands['serve'].aliases;
|
||||
describe = 'Builds and serves your application, rebuilding on file changes.';
|
||||
longDescriptionPath;
|
||||
}
|
||||
exports.default = ServeCommandModule;
|
||||
16
node_modules/@angular/cli/src/commands/test/cli.d.ts
generated
vendored
Executable file
16
node_modules/@angular/cli/src/commands/test/cli.d.ts
generated
vendored
Executable file
|
|
@ -0,0 +1,16 @@
|
|||
/**
|
||||
* @license
|
||||
* Copyright Google LLC All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by an MIT-style license that can be
|
||||
* found in the LICENSE file at https://angular.dev/license
|
||||
*/
|
||||
import { ArchitectCommandModule } from '../../command-builder/architect-command-module';
|
||||
import { CommandModuleImplementation } from '../../command-builder/command-module';
|
||||
export default class TestCommandModule extends ArchitectCommandModule implements CommandModuleImplementation {
|
||||
multiTarget: boolean;
|
||||
command: string;
|
||||
aliases: string[] | undefined;
|
||||
describe: string;
|
||||
longDescriptionPath: string;
|
||||
}
|
||||
20
node_modules/@angular/cli/src/commands/test/cli.js
generated
vendored
Executable file
20
node_modules/@angular/cli/src/commands/test/cli.js
generated
vendored
Executable file
|
|
@ -0,0 +1,20 @@
|
|||
"use strict";
|
||||
/**
|
||||
* @license
|
||||
* Copyright Google LLC All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by an MIT-style license that can be
|
||||
* found in the LICENSE file at https://angular.dev/license
|
||||
*/
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const path_1 = require("path");
|
||||
const architect_command_module_1 = require("../../command-builder/architect-command-module");
|
||||
const command_config_1 = require("../command-config");
|
||||
class TestCommandModule extends architect_command_module_1.ArchitectCommandModule {
|
||||
multiTarget = true;
|
||||
command = 'test [project]';
|
||||
aliases = command_config_1.RootCommands['test'].aliases;
|
||||
describe = 'Runs unit tests in a project.';
|
||||
longDescriptionPath = (0, path_1.join)(__dirname, 'long-description.md');
|
||||
}
|
||||
exports.default = TestCommandModule;
|
||||
2
node_modules/@angular/cli/src/commands/test/long-description.md
generated
vendored
Executable file
2
node_modules/@angular/cli/src/commands/test/long-description.md
generated
vendored
Executable file
|
|
@ -0,0 +1,2 @@
|
|||
Takes the name of the project, as specified in the `projects` section of the `angular.json` workspace configuration file.
|
||||
When a project name is not supplied, it will execute for all projects.
|
||||
58
node_modules/@angular/cli/src/commands/update/cli.d.ts
generated
vendored
Executable file
58
node_modules/@angular/cli/src/commands/update/cli.d.ts
generated
vendored
Executable file
|
|
@ -0,0 +1,58 @@
|
|||
/**
|
||||
* @license
|
||||
* Copyright Google LLC All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by an MIT-style license that can be
|
||||
* found in the LICENSE file at https://angular.dev/license
|
||||
*/
|
||||
import { Argv } from 'yargs';
|
||||
import { CommandModule, CommandScope, Options } from '../../command-builder/command-module';
|
||||
interface UpdateCommandArgs {
|
||||
packages?: string[];
|
||||
force: boolean;
|
||||
next: boolean;
|
||||
'migrate-only'?: boolean;
|
||||
name?: string;
|
||||
from?: string;
|
||||
to?: string;
|
||||
'allow-dirty': boolean;
|
||||
verbose: boolean;
|
||||
'create-commits': boolean;
|
||||
}
|
||||
export default class UpdateCommandModule extends CommandModule<UpdateCommandArgs> {
|
||||
scope: CommandScope;
|
||||
protected shouldReportAnalytics: boolean;
|
||||
private readonly resolvePaths;
|
||||
command: string;
|
||||
describe: string;
|
||||
longDescriptionPath: string;
|
||||
builder(localYargs: Argv): Argv<UpdateCommandArgs>;
|
||||
run(options: Options<UpdateCommandArgs>): Promise<number | void>;
|
||||
private executeSchematic;
|
||||
/**
|
||||
* @return Whether or not the migration was performed successfully.
|
||||
*/
|
||||
private executeMigration;
|
||||
/**
|
||||
* @return Whether or not the migrations were performed successfully.
|
||||
*/
|
||||
private executeMigrations;
|
||||
private executePackageMigrations;
|
||||
private migrateOnly;
|
||||
private updatePackagesAndMigrate;
|
||||
/**
|
||||
* @return Whether or not the commit was successful.
|
||||
*/
|
||||
private commit;
|
||||
private checkCleanGit;
|
||||
/**
|
||||
* Checks if the current installed CLI version is older or newer than a compatible version.
|
||||
* @returns the version to install or null when there is no update to install.
|
||||
*/
|
||||
private checkCLIVersion;
|
||||
private getCLIUpdateRunnerVersion;
|
||||
private runTempBinary;
|
||||
private packageManagerForce;
|
||||
private getOptionalMigrationsToRun;
|
||||
}
|
||||
export {};
|
||||
906
node_modules/@angular/cli/src/commands/update/cli.js
generated
vendored
Executable file
906
node_modules/@angular/cli/src/commands/update/cli.js
generated
vendored
Executable file
|
|
@ -0,0 +1,906 @@
|
|||
"use strict";
|
||||
/**
|
||||
* @license
|
||||
* Copyright Google LLC All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by an MIT-style license that can be
|
||||
* found in the LICENSE file at https://angular.dev/license
|
||||
*/
|
||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
var desc = Object.getOwnPropertyDescriptor(m, k);
|
||||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
||||
desc = { enumerable: true, get: function() { return m[k]; } };
|
||||
}
|
||||
Object.defineProperty(o, k2, desc);
|
||||
}) : (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
o[k2] = m[k];
|
||||
}));
|
||||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
||||
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
||||
}) : function(o, v) {
|
||||
o["default"] = v;
|
||||
});
|
||||
var __importStar = (this && this.__importStar) || function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
||||
__setModuleDefault(result, mod);
|
||||
return result;
|
||||
};
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const schematics_1 = require("@angular-devkit/schematics");
|
||||
const tools_1 = require("@angular-devkit/schematics/tools");
|
||||
const listr2_1 = require("listr2");
|
||||
const node_child_process_1 = require("node:child_process");
|
||||
const node_fs_1 = require("node:fs");
|
||||
const node_module_1 = require("node:module");
|
||||
const npm_package_arg_1 = __importDefault(require("npm-package-arg"));
|
||||
const npm_pick_manifest_1 = __importDefault(require("npm-pick-manifest"));
|
||||
const path = __importStar(require("path"));
|
||||
const path_1 = require("path");
|
||||
const semver = __importStar(require("semver"));
|
||||
const workspace_schema_1 = require("../../../lib/config/workspace-schema");
|
||||
const command_module_1 = require("../../command-builder/command-module");
|
||||
const schematic_engine_host_1 = require("../../command-builder/utilities/schematic-engine-host");
|
||||
const schematic_workflow_1 = require("../../command-builder/utilities/schematic-workflow");
|
||||
const color_1 = require("../../utilities/color");
|
||||
const environment_options_1 = require("../../utilities/environment-options");
|
||||
const error_1 = require("../../utilities/error");
|
||||
const log_file_1 = require("../../utilities/log-file");
|
||||
const package_metadata_1 = require("../../utilities/package-metadata");
|
||||
const package_tree_1 = require("../../utilities/package-tree");
|
||||
const prompt_1 = require("../../utilities/prompt");
|
||||
const tty_1 = require("../../utilities/tty");
|
||||
const version_1 = require("../../utilities/version");
|
||||
class CommandError extends Error {
|
||||
}
|
||||
const ANGULAR_PACKAGES_REGEXP = /^@(?:angular|nguniversal)\//;
|
||||
const UPDATE_SCHEMATIC_COLLECTION = path.join(__dirname, 'schematic/collection.json');
|
||||
class UpdateCommandModule extends command_module_1.CommandModule {
|
||||
scope = command_module_1.CommandScope.In;
|
||||
shouldReportAnalytics = false;
|
||||
resolvePaths = [__dirname, this.context.root];
|
||||
command = 'update [packages..]';
|
||||
describe = 'Updates your workspace and its dependencies. See https://update.angular.dev/.';
|
||||
longDescriptionPath = (0, path_1.join)(__dirname, 'long-description.md');
|
||||
builder(localYargs) {
|
||||
return localYargs
|
||||
.positional('packages', {
|
||||
description: 'The names of package(s) to update.',
|
||||
type: 'string',
|
||||
array: true,
|
||||
})
|
||||
.option('force', {
|
||||
description: 'Ignore peer dependency version mismatches.',
|
||||
type: 'boolean',
|
||||
default: false,
|
||||
})
|
||||
.option('next', {
|
||||
description: 'Use the prerelease version, including beta and RCs.',
|
||||
type: 'boolean',
|
||||
default: false,
|
||||
})
|
||||
.option('migrate-only', {
|
||||
description: 'Only perform a migration, do not update the installed version.',
|
||||
type: 'boolean',
|
||||
})
|
||||
.option('name', {
|
||||
description: 'The name of the migration to run. Only available when a single package is updated.',
|
||||
type: 'string',
|
||||
conflicts: ['to', 'from'],
|
||||
})
|
||||
.option('from', {
|
||||
description: 'Version from which to migrate from. ' +
|
||||
`Only available when a single package is updated, and only with 'migrate-only'.`,
|
||||
type: 'string',
|
||||
implies: ['migrate-only'],
|
||||
conflicts: ['name'],
|
||||
})
|
||||
.option('to', {
|
||||
describe: 'Version up to which to apply migrations. Only available when a single package is updated, ' +
|
||||
`and only with 'migrate-only' option. Requires 'from' to be specified. Default to the installed version detected.`,
|
||||
type: 'string',
|
||||
implies: ['from', 'migrate-only'],
|
||||
conflicts: ['name'],
|
||||
})
|
||||
.option('allow-dirty', {
|
||||
describe: 'Whether to allow updating when the repository contains modified or untracked files.',
|
||||
type: 'boolean',
|
||||
default: false,
|
||||
})
|
||||
.option('verbose', {
|
||||
describe: 'Display additional details about internal operations during execution.',
|
||||
type: 'boolean',
|
||||
default: false,
|
||||
})
|
||||
.option('create-commits', {
|
||||
describe: 'Create source control commits for updates and migrations.',
|
||||
type: 'boolean',
|
||||
alias: ['C'],
|
||||
default: false,
|
||||
})
|
||||
.middleware((argv) => {
|
||||
if (argv.name) {
|
||||
argv['migrate-only'] = true;
|
||||
}
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
return argv;
|
||||
})
|
||||
.check(({ packages, 'allow-dirty': allowDirty, 'migrate-only': migrateOnly }) => {
|
||||
const { logger } = this.context;
|
||||
// This allows the user to easily reset any changes from the update.
|
||||
if (packages?.length && !this.checkCleanGit()) {
|
||||
if (allowDirty) {
|
||||
logger.warn('Repository is not clean. Update changes will be mixed with pre-existing changes.');
|
||||
}
|
||||
else {
|
||||
throw new command_module_1.CommandModuleError('Repository is not clean. Please commit or stash any changes before updating.');
|
||||
}
|
||||
}
|
||||
if (migrateOnly) {
|
||||
if (packages?.length !== 1) {
|
||||
throw new command_module_1.CommandModuleError(`A single package must be specified when using the 'migrate-only' option.`);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
})
|
||||
.strict();
|
||||
}
|
||||
async run(options) {
|
||||
const { logger, packageManager } = this.context;
|
||||
// Check if the current installed CLI version is older than the latest compatible version.
|
||||
// Skip when running `ng update` without a package name as this will not trigger an actual update.
|
||||
if (!environment_options_1.disableVersionCheck && options.packages?.length) {
|
||||
const cliVersionToInstall = await this.checkCLIVersion(options.packages, options.verbose, options.next);
|
||||
if (cliVersionToInstall) {
|
||||
logger.warn('The installed Angular CLI version is outdated.\n' +
|
||||
`Installing a temporary Angular CLI versioned ${cliVersionToInstall} to perform the update.`);
|
||||
return this.runTempBinary(`@angular/cli@${cliVersionToInstall}`, process.argv.slice(2));
|
||||
}
|
||||
}
|
||||
const packages = [];
|
||||
for (const request of options.packages ?? []) {
|
||||
try {
|
||||
const packageIdentifier = (0, npm_package_arg_1.default)(request);
|
||||
// only registry identifiers are supported
|
||||
if (!packageIdentifier.registry) {
|
||||
logger.error(`Package '${request}' is not a registry package identifer.`);
|
||||
return 1;
|
||||
}
|
||||
if (packages.some((v) => v.name === packageIdentifier.name)) {
|
||||
logger.error(`Duplicate package '${packageIdentifier.name}' specified.`);
|
||||
return 1;
|
||||
}
|
||||
if (options.migrateOnly && packageIdentifier.rawSpec !== '*') {
|
||||
logger.warn('Package specifier has no effect when using "migrate-only" option.');
|
||||
}
|
||||
// If next option is used and no specifier supplied, use next tag
|
||||
if (options.next && packageIdentifier.rawSpec === '*') {
|
||||
packageIdentifier.fetchSpec = 'next';
|
||||
}
|
||||
packages.push(packageIdentifier);
|
||||
}
|
||||
catch (e) {
|
||||
(0, error_1.assertIsError)(e);
|
||||
logger.error(e.message);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
logger.info(`Using package manager: ${color_1.colors.gray(packageManager.name)}`);
|
||||
logger.info('Collecting installed dependencies...');
|
||||
const rootDependencies = await (0, package_tree_1.getProjectDependencies)(this.context.root);
|
||||
logger.info(`Found ${rootDependencies.size} dependencies.`);
|
||||
const workflow = new tools_1.NodeWorkflow(this.context.root, {
|
||||
packageManager: packageManager.name,
|
||||
packageManagerForce: this.packageManagerForce(options.verbose),
|
||||
// __dirname -> favor @schematics/update from this package
|
||||
// Otherwise, use packages from the active workspace (migrations)
|
||||
resolvePaths: this.resolvePaths,
|
||||
schemaValidation: true,
|
||||
engineHostCreator: (options) => new schematic_engine_host_1.SchematicEngineHost(options.resolvePaths),
|
||||
});
|
||||
if (packages.length === 0) {
|
||||
// Show status
|
||||
const { success } = await this.executeSchematic(workflow, UPDATE_SCHEMATIC_COLLECTION, 'update', {
|
||||
force: options.force,
|
||||
next: options.next,
|
||||
verbose: options.verbose,
|
||||
packageManager: packageManager.name,
|
||||
packages: [],
|
||||
});
|
||||
return success ? 0 : 1;
|
||||
}
|
||||
return options.migrateOnly
|
||||
? this.migrateOnly(workflow, (options.packages ?? [])[0], rootDependencies, options)
|
||||
: this.updatePackagesAndMigrate(workflow, rootDependencies, options, packages);
|
||||
}
|
||||
async executeSchematic(workflow, collection, schematic, options = {}) {
|
||||
const { logger } = this.context;
|
||||
const workflowSubscription = (0, schematic_workflow_1.subscribeToWorkflow)(workflow, logger);
|
||||
// TODO: Allow passing a schematic instance directly
|
||||
try {
|
||||
await workflow
|
||||
.execute({
|
||||
collection,
|
||||
schematic,
|
||||
options,
|
||||
logger,
|
||||
})
|
||||
.toPromise();
|
||||
return { success: !workflowSubscription.error, files: workflowSubscription.files };
|
||||
}
|
||||
catch (e) {
|
||||
if (e instanceof schematics_1.UnsuccessfulWorkflowExecution) {
|
||||
logger.error(`${color_1.figures.cross} Migration failed. See above for further details.\n`);
|
||||
}
|
||||
else {
|
||||
(0, error_1.assertIsError)(e);
|
||||
const logPath = (0, log_file_1.writeErrorToLogFile)(e);
|
||||
logger.fatal(`${color_1.figures.cross} Migration failed: ${e.message}\n` +
|
||||
` See "${logPath}" for further details.\n`);
|
||||
}
|
||||
return { success: false, files: workflowSubscription.files };
|
||||
}
|
||||
finally {
|
||||
workflowSubscription.unsubscribe();
|
||||
}
|
||||
}
|
||||
/**
|
||||
* @return Whether or not the migration was performed successfully.
|
||||
*/
|
||||
async executeMigration(workflow, packageName, collectionPath, migrationName, commit) {
|
||||
const { logger } = this.context;
|
||||
const collection = workflow.engine.createCollection(collectionPath);
|
||||
const name = collection.listSchematicNames().find((name) => name === migrationName);
|
||||
if (!name) {
|
||||
logger.error(`Cannot find migration '${migrationName}' in '${packageName}'.`);
|
||||
return 1;
|
||||
}
|
||||
logger.info(color_1.colors.cyan(`** Executing '${migrationName}' of package '${packageName}' **\n`));
|
||||
const schematic = workflow.engine.createSchematic(name, collection);
|
||||
return this.executePackageMigrations(workflow, [schematic.description], packageName, commit);
|
||||
}
|
||||
/**
|
||||
* @return Whether or not the migrations were performed successfully.
|
||||
*/
|
||||
async executeMigrations(workflow, packageName, collectionPath, from, to, commit) {
|
||||
const collection = workflow.engine.createCollection(collectionPath);
|
||||
const migrationRange = new semver.Range('>' + (semver.prerelease(from) ? from.split('-')[0] + '-0' : from) + ' <=' + to.split('-')[0]);
|
||||
const requiredMigrations = [];
|
||||
const optionalMigrations = [];
|
||||
for (const name of collection.listSchematicNames()) {
|
||||
const schematic = workflow.engine.createSchematic(name, collection);
|
||||
const description = schematic.description;
|
||||
description.version = coerceVersionNumber(description.version);
|
||||
if (!description.version) {
|
||||
continue;
|
||||
}
|
||||
if (semver.satisfies(description.version, migrationRange, { includePrerelease: true })) {
|
||||
(description.optional ? optionalMigrations : requiredMigrations).push(description);
|
||||
}
|
||||
}
|
||||
if (requiredMigrations.length === 0 && optionalMigrations.length === 0) {
|
||||
return 0;
|
||||
}
|
||||
// Required migrations
|
||||
if (requiredMigrations.length) {
|
||||
this.context.logger.info(color_1.colors.cyan(`** Executing migrations of package '${packageName}' **\n`));
|
||||
requiredMigrations.sort((a, b) => semver.compare(a.version, b.version) || a.name.localeCompare(b.name));
|
||||
const result = await this.executePackageMigrations(workflow, requiredMigrations, packageName, commit);
|
||||
if (result === 1) {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
// Optional migrations
|
||||
if (optionalMigrations.length) {
|
||||
this.context.logger.info(color_1.colors.magenta(`** Optional migrations of package '${packageName}' **\n`));
|
||||
optionalMigrations.sort((a, b) => semver.compare(a.version, b.version) || a.name.localeCompare(b.name));
|
||||
const migrationsToRun = await this.getOptionalMigrationsToRun(optionalMigrations, packageName);
|
||||
if (migrationsToRun?.length) {
|
||||
return this.executePackageMigrations(workflow, migrationsToRun, packageName, commit);
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
async executePackageMigrations(workflow, migrations, packageName, commit = false) {
|
||||
const { logger } = this.context;
|
||||
for (const migration of migrations) {
|
||||
const { title, description } = getMigrationTitleAndDescription(migration);
|
||||
logger.info(color_1.colors.cyan(color_1.figures.pointer) + ' ' + color_1.colors.bold(title));
|
||||
if (description) {
|
||||
logger.info(' ' + description);
|
||||
}
|
||||
const { success, files } = await this.executeSchematic(workflow, migration.collection.name, migration.name);
|
||||
if (!success) {
|
||||
return 1;
|
||||
}
|
||||
let modifiedFilesText;
|
||||
switch (files.size) {
|
||||
case 0:
|
||||
modifiedFilesText = 'No changes made';
|
||||
break;
|
||||
case 1:
|
||||
modifiedFilesText = '1 file modified';
|
||||
break;
|
||||
default:
|
||||
modifiedFilesText = `${files.size} files modified`;
|
||||
break;
|
||||
}
|
||||
logger.info(` Migration completed (${modifiedFilesText}).`);
|
||||
// Commit migration
|
||||
if (commit) {
|
||||
const commitPrefix = `${packageName} migration - ${migration.name}`;
|
||||
const commitMessage = migration.description
|
||||
? `${commitPrefix}\n\n${migration.description}`
|
||||
: commitPrefix;
|
||||
const committed = this.commit(commitMessage);
|
||||
if (!committed) {
|
||||
// Failed to commit, something went wrong. Abort the update.
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
logger.info(''); // Extra trailing newline.
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
async migrateOnly(workflow, packageName, rootDependencies, options) {
|
||||
const { logger } = this.context;
|
||||
const packageDependency = rootDependencies.get(packageName);
|
||||
let packagePath = packageDependency?.path;
|
||||
let packageNode = packageDependency?.package;
|
||||
if (packageDependency && !packageNode) {
|
||||
logger.error('Package found in package.json but is not installed.');
|
||||
return 1;
|
||||
}
|
||||
else if (!packageDependency) {
|
||||
// Allow running migrations on transitively installed dependencies
|
||||
// There can technically be nested multiple versions
|
||||
// TODO: If multiple, this should find all versions and ask which one to use
|
||||
const packageJson = (0, package_tree_1.findPackageJson)(this.context.root, packageName);
|
||||
if (packageJson) {
|
||||
packagePath = path.dirname(packageJson);
|
||||
packageNode = await (0, package_tree_1.readPackageJson)(packageJson);
|
||||
}
|
||||
}
|
||||
if (!packageNode || !packagePath) {
|
||||
logger.error('Package is not installed.');
|
||||
return 1;
|
||||
}
|
||||
const updateMetadata = packageNode['ng-update'];
|
||||
let migrations = updateMetadata?.migrations;
|
||||
if (migrations === undefined) {
|
||||
logger.error('Package does not provide migrations.');
|
||||
return 1;
|
||||
}
|
||||
else if (typeof migrations !== 'string') {
|
||||
logger.error('Package contains a malformed migrations field.');
|
||||
return 1;
|
||||
}
|
||||
else if (path.posix.isAbsolute(migrations) || path.win32.isAbsolute(migrations)) {
|
||||
logger.error('Package contains an invalid migrations field. Absolute paths are not permitted.');
|
||||
return 1;
|
||||
}
|
||||
// Normalize slashes
|
||||
migrations = migrations.replace(/\\/g, '/');
|
||||
if (migrations.startsWith('../')) {
|
||||
logger.error('Package contains an invalid migrations field. Paths outside the package root are not permitted.');
|
||||
return 1;
|
||||
}
|
||||
// Check if it is a package-local location
|
||||
const localMigrations = path.join(packagePath, migrations);
|
||||
if ((0, node_fs_1.existsSync)(localMigrations)) {
|
||||
migrations = localMigrations;
|
||||
}
|
||||
else {
|
||||
// Try to resolve from package location.
|
||||
// This avoids issues with package hoisting.
|
||||
try {
|
||||
const packageRequire = (0, node_module_1.createRequire)(packagePath + '/');
|
||||
migrations = packageRequire.resolve(migrations, { paths: this.resolvePaths });
|
||||
}
|
||||
catch (e) {
|
||||
(0, error_1.assertIsError)(e);
|
||||
if (e.code === 'MODULE_NOT_FOUND') {
|
||||
logger.error('Migrations for package were not found.');
|
||||
}
|
||||
else {
|
||||
logger.error(`Unable to resolve migrations for package. [${e.message}]`);
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
if (options.name) {
|
||||
return this.executeMigration(workflow, packageName, migrations, options.name, options.createCommits);
|
||||
}
|
||||
const from = coerceVersionNumber(options.from);
|
||||
if (!from) {
|
||||
logger.error(`"from" value [${options.from}] is not a valid version.`);
|
||||
return 1;
|
||||
}
|
||||
return this.executeMigrations(workflow, packageName, migrations, from, options.to || packageNode.version, options.createCommits);
|
||||
}
|
||||
// eslint-disable-next-line max-lines-per-function
|
||||
async updatePackagesAndMigrate(workflow, rootDependencies, options, packages) {
|
||||
const { logger } = this.context;
|
||||
const logVerbose = (message) => {
|
||||
if (options.verbose) {
|
||||
logger.info(message);
|
||||
}
|
||||
};
|
||||
const requests = [];
|
||||
// Validate packages actually are part of the workspace
|
||||
for (const pkg of packages) {
|
||||
const node = rootDependencies.get(pkg.name);
|
||||
if (!node?.package) {
|
||||
logger.error(`Package '${pkg.name}' is not a dependency.`);
|
||||
return 1;
|
||||
}
|
||||
// If a specific version is requested and matches the installed version, skip.
|
||||
if (pkg.type === 'version' && node.package.version === pkg.fetchSpec) {
|
||||
logger.info(`Package '${pkg.name}' is already at '${pkg.fetchSpec}'.`);
|
||||
continue;
|
||||
}
|
||||
requests.push({ identifier: pkg, node });
|
||||
}
|
||||
if (requests.length === 0) {
|
||||
return 0;
|
||||
}
|
||||
logger.info('Fetching dependency metadata from registry...');
|
||||
const packagesToUpdate = [];
|
||||
for (const { identifier: requestIdentifier, node } of requests) {
|
||||
const packageName = requestIdentifier.name;
|
||||
let metadata;
|
||||
try {
|
||||
// Metadata requests are internally cached; multiple requests for same name
|
||||
// does not result in additional network traffic
|
||||
metadata = await (0, package_metadata_1.fetchPackageMetadata)(packageName, logger, {
|
||||
verbose: options.verbose,
|
||||
});
|
||||
}
|
||||
catch (e) {
|
||||
(0, error_1.assertIsError)(e);
|
||||
logger.error(`Error fetching metadata for '${packageName}': ` + e.message);
|
||||
return 1;
|
||||
}
|
||||
// Try to find a package version based on the user requested package specifier
|
||||
// registry specifier types are either version, range, or tag
|
||||
let manifest;
|
||||
if (requestIdentifier.type === 'version' ||
|
||||
requestIdentifier.type === 'range' ||
|
||||
requestIdentifier.type === 'tag') {
|
||||
try {
|
||||
manifest = (0, npm_pick_manifest_1.default)(metadata, requestIdentifier.fetchSpec);
|
||||
}
|
||||
catch (e) {
|
||||
(0, error_1.assertIsError)(e);
|
||||
if (e.code === 'ETARGET') {
|
||||
// If not found and next was used and user did not provide a specifier, try latest.
|
||||
// Package may not have a next tag.
|
||||
if (requestIdentifier.type === 'tag' &&
|
||||
requestIdentifier.fetchSpec === 'next' &&
|
||||
!requestIdentifier.rawSpec) {
|
||||
try {
|
||||
manifest = (0, npm_pick_manifest_1.default)(metadata, 'latest');
|
||||
}
|
||||
catch (e) {
|
||||
(0, error_1.assertIsError)(e);
|
||||
if (e.code !== 'ETARGET' && e.code !== 'ENOVERSIONS') {
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (e.code !== 'ENOVERSIONS') {
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!manifest) {
|
||||
logger.error(`Package specified by '${requestIdentifier.raw}' does not exist within the registry.`);
|
||||
return 1;
|
||||
}
|
||||
if (manifest.version === node.package?.version) {
|
||||
logger.info(`Package '${packageName}' is already up to date.`);
|
||||
continue;
|
||||
}
|
||||
if (node.package && ANGULAR_PACKAGES_REGEXP.test(node.package.name)) {
|
||||
const { name, version } = node.package;
|
||||
const toBeInstalledMajorVersion = +manifest.version.split('.')[0];
|
||||
const currentMajorVersion = +version.split('.')[0];
|
||||
if (toBeInstalledMajorVersion - currentMajorVersion > 1) {
|
||||
// Only allow updating a single version at a time.
|
||||
if (currentMajorVersion < 6) {
|
||||
// Before version 6, the major versions were not always sequential.
|
||||
// Example @angular/core skipped version 3, @angular/cli skipped versions 2-5.
|
||||
logger.error(`Updating multiple major versions of '${name}' at once is not supported. Please migrate each major version individually.\n` +
|
||||
`For more information about the update process, see https://update.angular.dev/.`);
|
||||
}
|
||||
else {
|
||||
const nextMajorVersionFromCurrent = currentMajorVersion + 1;
|
||||
logger.error(`Updating multiple major versions of '${name}' at once is not supported. Please migrate each major version individually.\n` +
|
||||
`Run 'ng update ${name}@${nextMajorVersionFromCurrent}' in your workspace directory ` +
|
||||
`to update to latest '${nextMajorVersionFromCurrent}.x' version of '${name}'.\n\n` +
|
||||
`For more information about the update process, see https://update.angular.dev/?v=${currentMajorVersion}.0-${nextMajorVersionFromCurrent}.0`);
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
packagesToUpdate.push(requestIdentifier.toString());
|
||||
}
|
||||
if (packagesToUpdate.length === 0) {
|
||||
return 0;
|
||||
}
|
||||
const { success } = await this.executeSchematic(workflow, UPDATE_SCHEMATIC_COLLECTION, 'update', {
|
||||
verbose: options.verbose,
|
||||
force: options.force,
|
||||
next: options.next,
|
||||
packageManager: this.context.packageManager.name,
|
||||
packages: packagesToUpdate,
|
||||
});
|
||||
if (success) {
|
||||
const { root: commandRoot, packageManager } = this.context;
|
||||
const installArgs = this.packageManagerForce(options.verbose) ? ['--force'] : [];
|
||||
const tasks = new listr2_1.Listr([
|
||||
{
|
||||
title: 'Cleaning node modules directory',
|
||||
async task(_, task) {
|
||||
try {
|
||||
await node_fs_1.promises.rm(path.join(commandRoot, 'node_modules'), {
|
||||
force: true,
|
||||
recursive: true,
|
||||
maxRetries: 3,
|
||||
});
|
||||
}
|
||||
catch (e) {
|
||||
(0, error_1.assertIsError)(e);
|
||||
if (e.code === 'ENOENT') {
|
||||
task.skip('Cleaning not required. Node modules directory not found.');
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
{
|
||||
title: 'Installing packages',
|
||||
async task() {
|
||||
const installationSuccess = await packageManager.installAll(installArgs, commandRoot);
|
||||
if (!installationSuccess) {
|
||||
throw new CommandError('Unable to install packages');
|
||||
}
|
||||
},
|
||||
},
|
||||
]);
|
||||
try {
|
||||
await tasks.run();
|
||||
}
|
||||
catch (e) {
|
||||
if (e instanceof CommandError) {
|
||||
return 1;
|
||||
}
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
if (success && options.createCommits) {
|
||||
if (!this.commit(`Angular CLI update for packages - ${packagesToUpdate.join(', ')}`)) {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
// This is a temporary workaround to allow data to be passed back from the update schematic
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
const migrations = global.externalMigrations;
|
||||
if (success && migrations) {
|
||||
const rootRequire = (0, node_module_1.createRequire)(this.context.root + '/');
|
||||
for (const migration of migrations) {
|
||||
// Resolve the package from the workspace root, as otherwise it will be resolved from the temp
|
||||
// installed CLI version.
|
||||
let packagePath;
|
||||
logVerbose(`Resolving migration package '${migration.package}' from '${this.context.root}'...`);
|
||||
try {
|
||||
try {
|
||||
packagePath = path.dirname(
|
||||
// This may fail if the `package.json` is not exported as an entry point
|
||||
rootRequire.resolve(path.join(migration.package, 'package.json')));
|
||||
}
|
||||
catch (e) {
|
||||
(0, error_1.assertIsError)(e);
|
||||
if (e.code === 'MODULE_NOT_FOUND') {
|
||||
// Fallback to trying to resolve the package's main entry point
|
||||
packagePath = rootRequire.resolve(migration.package);
|
||||
}
|
||||
else {
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (e) {
|
||||
(0, error_1.assertIsError)(e);
|
||||
if (e.code === 'MODULE_NOT_FOUND') {
|
||||
logVerbose(e.toString());
|
||||
logger.error(`Migrations for package (${migration.package}) were not found.` +
|
||||
' The package could not be found in the workspace.');
|
||||
}
|
||||
else {
|
||||
logger.error(`Unable to resolve migrations for package (${migration.package}). [${e.message}]`);
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
let migrations;
|
||||
// Check if it is a package-local location
|
||||
const localMigrations = path.join(packagePath, migration.collection);
|
||||
if ((0, node_fs_1.existsSync)(localMigrations)) {
|
||||
migrations = localMigrations;
|
||||
}
|
||||
else {
|
||||
// Try to resolve from package location.
|
||||
// This avoids issues with package hoisting.
|
||||
try {
|
||||
const packageRequire = (0, node_module_1.createRequire)(packagePath + '/');
|
||||
migrations = packageRequire.resolve(migration.collection);
|
||||
}
|
||||
catch (e) {
|
||||
(0, error_1.assertIsError)(e);
|
||||
if (e.code === 'MODULE_NOT_FOUND') {
|
||||
logger.error(`Migrations for package (${migration.package}) were not found.`);
|
||||
}
|
||||
else {
|
||||
logger.error(`Unable to resolve migrations for package (${migration.package}). [${e.message}]`);
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
const result = await this.executeMigrations(workflow, migration.package, migrations, migration.from, migration.to, options.createCommits);
|
||||
// A non-zero value is a failure for the package's migrations
|
||||
if (result !== 0) {
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
||||
return success ? 0 : 1;
|
||||
}
|
||||
/**
|
||||
* @return Whether or not the commit was successful.
|
||||
*/
|
||||
commit(message) {
|
||||
const { logger } = this.context;
|
||||
// Check if a commit is needed.
|
||||
let commitNeeded;
|
||||
try {
|
||||
commitNeeded = hasChangesToCommit();
|
||||
}
|
||||
catch (err) {
|
||||
logger.error(` Failed to read Git tree:\n${err.stderr}`);
|
||||
return false;
|
||||
}
|
||||
if (!commitNeeded) {
|
||||
logger.info(' No changes to commit after migration.');
|
||||
return true;
|
||||
}
|
||||
// Commit changes and abort on error.
|
||||
try {
|
||||
createCommit(message);
|
||||
}
|
||||
catch (err) {
|
||||
logger.error(`Failed to commit update (${message}):\n${err.stderr}`);
|
||||
return false;
|
||||
}
|
||||
// Notify user of the commit.
|
||||
const hash = findCurrentGitSha();
|
||||
const shortMessage = message.split('\n')[0];
|
||||
if (hash) {
|
||||
logger.info(` Committed migration step (${getShortHash(hash)}): ${shortMessage}.`);
|
||||
}
|
||||
else {
|
||||
// Commit was successful, but reading the hash was not. Something weird happened,
|
||||
// but nothing that would stop the update. Just log the weirdness and continue.
|
||||
logger.info(` Committed migration step: ${shortMessage}.`);
|
||||
logger.warn(' Failed to look up hash of most recent commit, continuing anyways.');
|
||||
}
|
||||
return true;
|
||||
}
|
||||
checkCleanGit() {
|
||||
try {
|
||||
const topLevel = (0, node_child_process_1.execSync)('git rev-parse --show-toplevel', {
|
||||
encoding: 'utf8',
|
||||
stdio: 'pipe',
|
||||
});
|
||||
const result = (0, node_child_process_1.execSync)('git status --porcelain', { encoding: 'utf8', stdio: 'pipe' });
|
||||
if (result.trim().length === 0) {
|
||||
return true;
|
||||
}
|
||||
// Only files inside the workspace root are relevant
|
||||
for (const entry of result.split('\n')) {
|
||||
const relativeEntry = path.relative(path.resolve(this.context.root), path.resolve(topLevel.trim(), entry.slice(3).trim()));
|
||||
if (!relativeEntry.startsWith('..') && !path.isAbsolute(relativeEntry)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch { }
|
||||
return true;
|
||||
}
|
||||
/**
|
||||
* Checks if the current installed CLI version is older or newer than a compatible version.
|
||||
* @returns the version to install or null when there is no update to install.
|
||||
*/
|
||||
async checkCLIVersion(packagesToUpdate, verbose = false, next = false) {
|
||||
const { version } = await (0, package_metadata_1.fetchPackageManifest)(`@angular/cli@${this.getCLIUpdateRunnerVersion(packagesToUpdate, next)}`, this.context.logger, {
|
||||
verbose,
|
||||
usingYarn: this.context.packageManager.name === workspace_schema_1.PackageManager.Yarn,
|
||||
});
|
||||
return version_1.VERSION.full === version ? null : version;
|
||||
}
|
||||
getCLIUpdateRunnerVersion(packagesToUpdate, next) {
|
||||
if (next) {
|
||||
return 'next';
|
||||
}
|
||||
const updatingAngularPackage = packagesToUpdate?.find((r) => ANGULAR_PACKAGES_REGEXP.test(r));
|
||||
if (updatingAngularPackage) {
|
||||
// If we are updating any Angular package we can update the CLI to the target version because
|
||||
// migrations for @angular/core@13 can be executed using Angular/cli@13.
|
||||
// This is same behaviour as `npx @angular/cli@13 update @angular/core@13`.
|
||||
// `@angular/cli@13` -> ['', 'angular/cli', '13']
|
||||
// `@angular/cli` -> ['', 'angular/cli']
|
||||
const tempVersion = coerceVersionNumber(updatingAngularPackage.split('@')[2]);
|
||||
return semver.parse(tempVersion)?.major ?? 'latest';
|
||||
}
|
||||
// When not updating an Angular package we cannot determine which schematic runtime the migration should to be executed in.
|
||||
// Typically, we can assume that the `@angular/cli` was updated previously.
|
||||
// Example: Angular official packages are typically updated prior to NGRX etc...
|
||||
// Therefore, we only update to the latest patch version of the installed major version of the Angular CLI.
|
||||
// This is important because we might end up in a scenario where locally Angular v12 is installed, updating NGRX from 11 to 12.
|
||||
// We end up using Angular ClI v13 to run the migrations if we run the migrations using the CLI installed major version + 1 logic.
|
||||
return version_1.VERSION.major;
|
||||
}
|
||||
async runTempBinary(packageName, args = []) {
|
||||
const { success, tempNodeModules } = await this.context.packageManager.installTemp(packageName);
|
||||
if (!success) {
|
||||
return 1;
|
||||
}
|
||||
// Remove version/tag etc... from package name
|
||||
// Ex: @angular/cli@latest -> @angular/cli
|
||||
const packageNameNoVersion = packageName.substring(0, packageName.lastIndexOf('@'));
|
||||
const pkgLocation = (0, path_1.join)(tempNodeModules, packageNameNoVersion);
|
||||
const packageJsonPath = (0, path_1.join)(pkgLocation, 'package.json');
|
||||
// Get a binary location for this package
|
||||
let binPath;
|
||||
if ((0, node_fs_1.existsSync)(packageJsonPath)) {
|
||||
const content = await node_fs_1.promises.readFile(packageJsonPath, 'utf-8');
|
||||
if (content) {
|
||||
const { bin = {} } = JSON.parse(content);
|
||||
const binKeys = Object.keys(bin);
|
||||
if (binKeys.length) {
|
||||
binPath = (0, path_1.resolve)(pkgLocation, bin[binKeys[0]]);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!binPath) {
|
||||
throw new Error(`Cannot locate bin for temporary package: ${packageNameNoVersion}.`);
|
||||
}
|
||||
const { status, error } = (0, node_child_process_1.spawnSync)(process.execPath, [binPath, ...args], {
|
||||
stdio: 'inherit',
|
||||
env: {
|
||||
...process.env,
|
||||
NG_DISABLE_VERSION_CHECK: 'true',
|
||||
NG_CLI_ANALYTICS: 'false',
|
||||
},
|
||||
});
|
||||
if (status === null && error) {
|
||||
throw error;
|
||||
}
|
||||
return status ?? 0;
|
||||
}
|
||||
packageManagerForce(verbose) {
|
||||
// npm 7+ can fail due to it incorrectly resolving peer dependencies that have valid SemVer
|
||||
// ranges during an update. Update will set correct versions of dependencies within the
|
||||
// package.json file. The force option is set to workaround these errors.
|
||||
// Example error:
|
||||
// npm ERR! Conflicting peer dependency: @angular/compiler-cli@14.0.0-rc.0
|
||||
// npm ERR! node_modules/@angular/compiler-cli
|
||||
// npm ERR! peer @angular/compiler-cli@"^14.0.0 || ^14.0.0-rc" from @angular-devkit/build-angular@14.0.0-rc.0
|
||||
// npm ERR! node_modules/@angular-devkit/build-angular
|
||||
// npm ERR! dev @angular-devkit/build-angular@"~14.0.0-rc.0" from the root project
|
||||
if (this.context.packageManager.name === workspace_schema_1.PackageManager.Npm &&
|
||||
this.context.packageManager.version &&
|
||||
semver.gte(this.context.packageManager.version, '7.0.0')) {
|
||||
if (verbose) {
|
||||
this.context.logger.info('NPM 7+ detected -- enabling force option for package installation');
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
async getOptionalMigrationsToRun(optionalMigrations, packageName) {
|
||||
const { logger } = this.context;
|
||||
const numberOfMigrations = optionalMigrations.length;
|
||||
logger.info(`This package has ${numberOfMigrations} optional migration${numberOfMigrations > 1 ? 's' : ''} that can be executed.`);
|
||||
if (!(0, tty_1.isTTY)()) {
|
||||
for (const migration of optionalMigrations) {
|
||||
const { title } = getMigrationTitleAndDescription(migration);
|
||||
logger.info(color_1.colors.cyan(color_1.figures.pointer) + ' ' + color_1.colors.bold(title));
|
||||
logger.info(color_1.colors.gray(` ng update ${packageName} --name ${migration.name}`));
|
||||
logger.info(''); // Extra trailing newline.
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
logger.info('Optional migrations may be skipped and executed after the update process, if preferred.');
|
||||
logger.info(''); // Extra trailing newline.
|
||||
const answer = await (0, prompt_1.askChoices)(`Select the migrations that you'd like to run`, optionalMigrations.map((migration) => {
|
||||
const { title, documentation } = getMigrationTitleAndDescription(migration);
|
||||
return {
|
||||
name: `[${color_1.colors.white(migration.name)}] ${title}${documentation ? ` (${documentation})` : ''}`,
|
||||
value: migration.name,
|
||||
};
|
||||
}), null);
|
||||
logger.info(''); // Extra trailing newline.
|
||||
return optionalMigrations.filter(({ name }) => answer?.includes(name));
|
||||
}
|
||||
}
|
||||
exports.default = UpdateCommandModule;
|
||||
/**
|
||||
* @return Whether or not the working directory has Git changes to commit.
|
||||
*/
|
||||
function hasChangesToCommit() {
|
||||
// List all modified files not covered by .gitignore.
|
||||
// If any files are returned, then there must be something to commit.
|
||||
return (0, node_child_process_1.execSync)('git ls-files -m -d -o --exclude-standard').toString() !== '';
|
||||
}
|
||||
/**
|
||||
* Precondition: Must have pending changes to commit, they do not need to be staged.
|
||||
* Postcondition: The Git working tree is committed and the repo is clean.
|
||||
* @param message The commit message to use.
|
||||
*/
|
||||
function createCommit(message) {
|
||||
// Stage entire working tree for commit.
|
||||
(0, node_child_process_1.execSync)('git add -A', { encoding: 'utf8', stdio: 'pipe' });
|
||||
// Commit with the message passed via stdin to avoid bash escaping issues.
|
||||
(0, node_child_process_1.execSync)('git commit --no-verify -F -', { encoding: 'utf8', stdio: 'pipe', input: message });
|
||||
}
|
||||
/**
|
||||
* @return The Git SHA hash of the HEAD commit. Returns null if unable to retrieve the hash.
|
||||
*/
|
||||
function findCurrentGitSha() {
|
||||
try {
|
||||
return (0, node_child_process_1.execSync)('git rev-parse HEAD', { encoding: 'utf8', stdio: 'pipe' }).trim();
|
||||
}
|
||||
catch {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
function getShortHash(commitHash) {
|
||||
return commitHash.slice(0, 9);
|
||||
}
|
||||
function coerceVersionNumber(version) {
|
||||
if (!version) {
|
||||
return undefined;
|
||||
}
|
||||
if (!/^\d{1,30}\.\d{1,30}\.\d{1,30}/.test(version)) {
|
||||
const match = version.match(/^\d{1,30}(\.\d{1,30})*/);
|
||||
if (!match) {
|
||||
return undefined;
|
||||
}
|
||||
if (!match[1]) {
|
||||
version = version.substring(0, match[0].length) + '.0.0' + version.substring(match[0].length);
|
||||
}
|
||||
else if (!match[2]) {
|
||||
version = version.substring(0, match[0].length) + '.0' + version.substring(match[0].length);
|
||||
}
|
||||
else {
|
||||
return undefined;
|
||||
}
|
||||
}
|
||||
return semver.valid(version) ?? undefined;
|
||||
}
|
||||
function getMigrationTitleAndDescription(migration) {
|
||||
const [title, ...description] = migration.description.split('. ');
|
||||
return {
|
||||
title: title.endsWith('.') ? title : title + '.',
|
||||
description: description.join('.\n '),
|
||||
documentation: migration.documentation
|
||||
? new URL(migration.documentation, 'https://angular.dev').href
|
||||
: undefined,
|
||||
};
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue