@depup/angular__cli 21.2.1-depup.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +36 -0
- package/bin/bootstrap.js +33 -0
- package/bin/ng.js +71 -0
- package/bin/package.json +3 -0
- package/changes.json +30 -0
- package/lib/cli/index.d.ts +11 -0
- package/lib/cli/index.js +109 -0
- package/lib/cli/index.js.map +1 -0
- package/lib/code-examples.db +0 -0
- package/lib/config/schema.json +6150 -0
- package/lib/config/workspace-schema.d.ts +1025 -0
- package/lib/config/workspace-schema.js +133 -0
- package/lib/config/workspace-schema.js.map +1 -0
- package/lib/init.d.ts +8 -0
- package/lib/init.js +162 -0
- package/lib/init.js.map +1 -0
- package/package.json +103 -0
- package/src/analytics/analytics-collector.d.ts +35 -0
- package/src/analytics/analytics-collector.js +195 -0
- package/src/analytics/analytics-collector.js.map +1 -0
- package/src/analytics/analytics-parameters.d.ts +101 -0
- package/src/analytics/analytics-parameters.js +107 -0
- package/src/analytics/analytics-parameters.js.map +1 -0
- package/src/analytics/analytics.d.ts +27 -0
- package/src/analytics/analytics.js +183 -0
- package/src/analytics/analytics.js.map +1 -0
- package/src/command-builder/architect-base-command-module.d.ts +30 -0
- package/src/command-builder/architect-base-command-module.js +244 -0
- package/src/command-builder/architect-base-command-module.js.map +1 -0
- package/src/command-builder/architect-command-module.d.ts +28 -0
- package/src/command-builder/architect-command-module.js +218 -0
- package/src/command-builder/architect-command-module.js.map +1 -0
- package/src/command-builder/command-module.d.ts +73 -0
- package/src/command-builder/command-module.js +245 -0
- package/src/command-builder/command-module.js.map +1 -0
- package/src/command-builder/command-runner.d.ts +9 -0
- package/src/command-builder/command-runner.js +195 -0
- package/src/command-builder/command-runner.js.map +1 -0
- package/src/command-builder/definitions.d.ts +41 -0
- package/src/command-builder/definitions.js +20 -0
- package/src/command-builder/definitions.js.map +1 -0
- package/src/command-builder/schematics-command-module.d.ts +41 -0
- package/src/command-builder/schematics-command-module.js +408 -0
- package/src/command-builder/schematics-command-module.js.map +1 -0
- package/src/command-builder/utilities/command.d.ts +13 -0
- package/src/command-builder/utilities/command.js +39 -0
- package/src/command-builder/utilities/command.js.map +1 -0
- package/src/command-builder/utilities/json-help.d.ts +37 -0
- package/src/command-builder/utilities/json-help.js +92 -0
- package/src/command-builder/utilities/json-help.js.map +1 -0
- package/src/command-builder/utilities/json-schema.d.ts +64 -0
- package/src/command-builder/utilities/json-schema.js +349 -0
- package/src/command-builder/utilities/json-schema.js.map +1 -0
- package/src/command-builder/utilities/normalize-options-middleware.d.ts +18 -0
- package/src/command-builder/utilities/normalize-options-middleware.js +37 -0
- package/src/command-builder/utilities/normalize-options-middleware.js.map +1 -0
- package/src/command-builder/utilities/schematic-engine-host.d.ts +15 -0
- package/src/command-builder/utilities/schematic-engine-host.js +179 -0
- package/src/command-builder/utilities/schematic-engine-host.js.map +1 -0
- package/src/command-builder/utilities/schematic-workflow.d.ts +14 -0
- package/src/command-builder/utilities/schematic-workflow.js +70 -0
- package/src/command-builder/utilities/schematic-workflow.js.map +1 -0
- package/src/commands/add/cli.d.ts +38 -0
- package/src/commands/add/cli.js +623 -0
- package/src/commands/add/cli.js.map +1 -0
- package/src/commands/add/long-description.md +7 -0
- package/src/commands/analytics/cli.d.ts +16 -0
- package/src/commands/analytics/cli.js +34 -0
- package/src/commands/analytics/cli.js.map +1 -0
- package/src/commands/analytics/info/cli.d.ts +16 -0
- package/src/commands/analytics/info/cli.js +25 -0
- package/src/commands/analytics/info/cli.js.map +1 -0
- package/src/commands/analytics/long-description.md +20 -0
- package/src/commands/analytics/settings/cli.d.ts +35 -0
- package/src/commands/analytics/settings/cli.js +54 -0
- package/src/commands/analytics/settings/cli.js.map +1 -0
- package/src/commands/build/cli.d.ts +16 -0
- package/src/commands/build/cli.js +21 -0
- package/src/commands/build/cli.js.map +1 -0
- package/src/commands/build/long-description.md +18 -0
- package/src/commands/cache/clean/cli.d.ts +17 -0
- package/src/commands/cache/clean/cli.js +32 -0
- package/src/commands/cache/clean/cli.js.map +1 -0
- package/src/commands/cache/cli.d.ts +17 -0
- package/src/commands/cache/cli.js +36 -0
- package/src/commands/cache/cli.js.map +1 -0
- package/src/commands/cache/info/cli.d.ts +20 -0
- package/src/commands/cache/info/cli.js +139 -0
- package/src/commands/cache/info/cli.js.map +1 -0
- package/src/commands/cache/long-description.md +53 -0
- package/src/commands/cache/settings/cli.d.ts +27 -0
- package/src/commands/cache/settings/cli.js +41 -0
- package/src/commands/cache/settings/cli.js.map +1 -0
- package/src/commands/cache/utilities.d.ts +11 -0
- package/src/commands/cache/utilities.js +47 -0
- package/src/commands/cache/utilities.js.map +1 -0
- package/src/commands/command-config.d.ts +17 -0
- package/src/commands/command-config.js +116 -0
- package/src/commands/command-config.js.map +1 -0
- package/src/commands/completion/cli.d.ts +16 -0
- package/src/commands/completion/cli.js +61 -0
- package/src/commands/completion/cli.js.map +1 -0
- package/src/commands/completion/long-description.md +67 -0
- package/src/commands/config/cli.d.ts +24 -0
- package/src/commands/config/cli.js +150 -0
- package/src/commands/config/cli.js.map +1 -0
- package/src/commands/config/long-description.md +13 -0
- package/src/commands/deploy/cli.d.ts +17 -0
- package/src/commands/deploy/cli.js +38 -0
- package/src/commands/deploy/cli.js.map +1 -0
- package/src/commands/deploy/long-description.md +22 -0
- package/src/commands/e2e/cli.d.ts +18 -0
- package/src/commands/e2e/cli.js +42 -0
- package/src/commands/e2e/cli.js.map +1 -0
- package/src/commands/extract-i18n/cli.d.ts +17 -0
- package/src/commands/extract-i18n/cli.js +48 -0
- package/src/commands/extract-i18n/cli.js.map +1 -0
- package/src/commands/generate/cli.d.ts +47 -0
- package/src/commands/generate/cli.js +189 -0
- package/src/commands/generate/cli.js.map +1 -0
- package/src/commands/lint/cli.d.ts +17 -0
- package/src/commands/lint/cli.js +25 -0
- package/src/commands/lint/cli.js.map +1 -0
- package/src/commands/lint/long-description.md +20 -0
- package/src/commands/make-this-awesome/cli.d.ts +17 -0
- package/src/commands/make-this-awesome/cli.js +36 -0
- package/src/commands/make-this-awesome/cli.js.map +1 -0
- package/src/commands/mcp/cli.d.ts +20 -0
- package/src/commands/mcp/cli.js +74 -0
- package/src/commands/mcp/cli.js.map +1 -0
- package/src/commands/mcp/constants.d.ts +10 -0
- package/src/commands/mcp/constants.js +16 -0
- package/src/commands/mcp/constants.js.map +1 -0
- package/src/commands/mcp/devserver.d.ts +85 -0
- package/src/commands/mcp/devserver.js +112 -0
- package/src/commands/mcp/devserver.js.map +1 -0
- package/src/commands/mcp/host.d.ts +97 -0
- package/src/commands/mcp/host.js +118 -0
- package/src/commands/mcp/host.js.map +1 -0
- package/src/commands/mcp/mcp-server.d.ts +192 -0
- package/src/commands/mcp/mcp-server.js +155 -0
- package/src/commands/mcp/mcp-server.js.map +1 -0
- package/src/commands/mcp/resources/ai-tutor.md +824 -0
- package/src/commands/mcp/resources/best-practices.md +54 -0
- package/src/commands/mcp/resources/instructions.d.ts +9 -0
- package/src/commands/mcp/resources/instructions.js +26 -0
- package/src/commands/mcp/resources/instructions.js.map +1 -0
- package/src/commands/mcp/shared-options.d.ts +12 -0
- package/src/commands/mcp/shared-options.js +22 -0
- package/src/commands/mcp/shared-options.js.map +1 -0
- package/src/commands/mcp/tools/ai-tutor.d.ts +12 -0
- package/src/commands/mcp/tools/ai-tutor.js +59 -0
- package/src/commands/mcp/tools/ai-tutor.js.map +1 -0
- package/src/commands/mcp/tools/best-practices.d.ts +13 -0
- package/src/commands/mcp/tools/best-practices.js +187 -0
- package/src/commands/mcp/tools/best-practices.js.map +1 -0
- package/src/commands/mcp/tools/build.d.ts +37 -0
- package/src/commands/mcp/tools/build.js +89 -0
- package/src/commands/mcp/tools/build.js.map +1 -0
- package/src/commands/mcp/tools/devserver/devserver-start.d.ts +31 -0
- package/src/commands/mcp/tools/devserver/devserver-start.js +91 -0
- package/src/commands/mcp/tools/devserver/devserver-start.js.map +1 -0
- package/src/commands/mcp/tools/devserver/devserver-stop.d.ts +31 -0
- package/src/commands/mcp/tools/devserver/devserver-stop.js +68 -0
- package/src/commands/mcp/tools/devserver/devserver-stop.js.map +1 -0
- package/src/commands/mcp/tools/devserver/devserver-wait-for-build.d.ts +41 -0
- package/src/commands/mcp/tools/devserver/devserver-wait-for-build.js +104 -0
- package/src/commands/mcp/tools/devserver/devserver-wait-for-build.js.map +1 -0
- package/src/commands/mcp/tools/doc-search.d.ts +21 -0
- package/src/commands/mcp/tools/doc-search.js +324 -0
- package/src/commands/mcp/tools/doc-search.js.map +1 -0
- package/src/commands/mcp/tools/e2e.d.ts +44 -0
- package/src/commands/mcp/tools/e2e.js +87 -0
- package/src/commands/mcp/tools/e2e.js.map +1 -0
- package/src/commands/mcp/tools/examples/database-discovery.d.ts +34 -0
- package/src/commands/mcp/tools/examples/database-discovery.js +87 -0
- package/src/commands/mcp/tools/examples/database-discovery.js.map +1 -0
- package/src/commands/mcp/tools/examples/database.d.ts +35 -0
- package/src/commands/mcp/tools/examples/database.js +125 -0
- package/src/commands/mcp/tools/examples/database.js.map +1 -0
- package/src/commands/mcp/tools/examples/index.d.ts +26 -0
- package/src/commands/mcp/tools/examples/index.js +149 -0
- package/src/commands/mcp/tools/examples/index.js.map +1 -0
- package/src/commands/mcp/tools/examples/query-escaper.d.ts +20 -0
- package/src/commands/mcp/tools/examples/query-escaper.js +68 -0
- package/src/commands/mcp/tools/examples/query-escaper.js.map +1 -0
- package/src/commands/mcp/tools/examples/runtime-database.d.ts +10 -0
- package/src/commands/mcp/tools/examples/runtime-database.js +192 -0
- package/src/commands/mcp/tools/examples/runtime-database.js.map +1 -0
- package/src/commands/mcp/tools/examples/schemas.d.ts +29 -0
- package/src/commands/mcp/tools/examples/schemas.js +101 -0
- package/src/commands/mcp/tools/examples/schemas.js.map +1 -0
- package/src/commands/mcp/tools/examples/utils.d.ts +14 -0
- package/src/commands/mcp/tools/examples/utils.js +31 -0
- package/src/commands/mcp/tools/examples/utils.js.map +1 -0
- package/src/commands/mcp/tools/modernize.d.ts +43 -0
- package/src/commands/mcp/tools/modernize.js +165 -0
- package/src/commands/mcp/tools/modernize.js.map +1 -0
- package/src/commands/mcp/tools/onpush-zoneless-migration/analyze-for-unsupported-zone-uses.d.ts +17 -0
- package/src/commands/mcp/tools/onpush-zoneless-migration/analyze-for-unsupported-zone-uses.js +62 -0
- package/src/commands/mcp/tools/onpush-zoneless-migration/analyze-for-unsupported-zone-uses.js.map +1 -0
- package/src/commands/mcp/tools/onpush-zoneless-migration/migrate-single-file.d.ts +12 -0
- package/src/commands/mcp/tools/onpush-zoneless-migration/migrate-single-file.js +73 -0
- package/src/commands/mcp/tools/onpush-zoneless-migration/migrate-single-file.js.map +1 -0
- package/src/commands/mcp/tools/onpush-zoneless-migration/migrate-test-file.d.ts +11 -0
- package/src/commands/mcp/tools/onpush-zoneless-migration/migrate-test-file.js +60 -0
- package/src/commands/mcp/tools/onpush-zoneless-migration/migrate-test-file.js.map +1 -0
- package/src/commands/mcp/tools/onpush-zoneless-migration/prompts.d.ts +15 -0
- package/src/commands/mcp/tools/onpush-zoneless-migration/prompts.js +238 -0
- package/src/commands/mcp/tools/onpush-zoneless-migration/prompts.js.map +1 -0
- package/src/commands/mcp/tools/onpush-zoneless-migration/send-debug-message.d.ts +10 -0
- package/src/commands/mcp/tools/onpush-zoneless-migration/send-debug-message.js +20 -0
- package/src/commands/mcp/tools/onpush-zoneless-migration/send-debug-message.js.map +1 -0
- package/src/commands/mcp/tools/onpush-zoneless-migration/ts-utils.d.ts +35 -0
- package/src/commands/mcp/tools/onpush-zoneless-migration/ts-utils.js +136 -0
- package/src/commands/mcp/tools/onpush-zoneless-migration/ts-utils.js.map +1 -0
- package/src/commands/mcp/tools/onpush-zoneless-migration/types.d.ts +13 -0
- package/src/commands/mcp/tools/onpush-zoneless-migration/types.js +10 -0
- package/src/commands/mcp/tools/onpush-zoneless-migration/types.js.map +1 -0
- package/src/commands/mcp/tools/onpush-zoneless-migration/zoneless-migration.d.ts +16 -0
- package/src/commands/mcp/tools/onpush-zoneless-migration/zoneless-migration.js +224 -0
- package/src/commands/mcp/tools/onpush-zoneless-migration/zoneless-migration.js.map +1 -0
- package/src/commands/mcp/tools/projects.d.ts +47 -0
- package/src/commands/mcp/tools/projects.js +523 -0
- package/src/commands/mcp/tools/projects.js.map +1 -0
- package/src/commands/mcp/tools/test.d.ts +35 -0
- package/src/commands/mcp/tools/test.js +79 -0
- package/src/commands/mcp/tools/test.js.map +1 -0
- package/src/commands/mcp/tools/tool-registry.d.ts +39 -0
- package/src/commands/mcp/tools/tool-registry.js +35 -0
- package/src/commands/mcp/tools/tool-registry.js.map +1 -0
- package/src/commands/mcp/utils.d.ts +25 -0
- package/src/commands/mcp/utils.js +44 -0
- package/src/commands/mcp/utils.js.map +1 -0
- package/src/commands/mcp/workspace-utils.d.ts +53 -0
- package/src/commands/mcp/workspace-utils.js +138 -0
- package/src/commands/mcp/workspace-utils.js.map +1 -0
- package/src/commands/new/cli.d.ts +27 -0
- package/src/commands/new/cli.js +76 -0
- package/src/commands/new/cli.js.map +1 -0
- package/src/commands/new/long-description.md +15 -0
- package/src/commands/run/cli.d.ts +25 -0
- package/src/commands/run/cli.js +89 -0
- package/src/commands/run/cli.js.map +1 -0
- package/src/commands/run/long-description.md +10 -0
- package/src/commands/serve/cli.d.ts +16 -0
- package/src/commands/serve/cli.js +20 -0
- package/src/commands/serve/cli.js.map +1 -0
- package/src/commands/test/cli.d.ts +16 -0
- package/src/commands/test/cli.js +21 -0
- package/src/commands/test/cli.js.map +1 -0
- package/src/commands/test/long-description.md +2 -0
- package/src/commands/update/cli.d.ts +34 -0
- package/src/commands/update/cli.js +531 -0
- package/src/commands/update/cli.js.map +1 -0
- package/src/commands/update/long-description.md +22 -0
- package/src/commands/update/schematic/collection.json +9 -0
- package/src/commands/update/schematic/index.d.ts +11 -0
- package/src/commands/update/schematic/index.js +715 -0
- package/src/commands/update/schematic/index.js.map +1 -0
- package/src/commands/update/schematic/schema.d.ts +51 -0
- package/src/commands/update/schematic/schema.js +16 -0
- package/src/commands/update/schematic/schema.js.map +1 -0
- package/src/commands/update/schematic/schema.json +64 -0
- package/src/commands/update/utilities/cli-version.d.ts +48 -0
- package/src/commands/update/utilities/cli-version.js +196 -0
- package/src/commands/update/utilities/cli-version.js.map +1 -0
- package/src/commands/update/utilities/constants.d.ts +12 -0
- package/src/commands/update/utilities/constants.js +16 -0
- package/src/commands/update/utilities/constants.js.map +1 -0
- package/src/commands/update/utilities/git.d.ts +36 -0
- package/src/commands/update/utilities/git.js +148 -0
- package/src/commands/update/utilities/git.js.map +1 -0
- package/src/commands/update/utilities/migration.d.ts +32 -0
- package/src/commands/update/utilities/migration.js +267 -0
- package/src/commands/update/utilities/migration.js.map +1 -0
- package/src/commands/version/cli.d.ts +36 -0
- package/src/commands/version/cli.js +117 -0
- package/src/commands/version/cli.js.map +1 -0
- package/src/commands/version/version-info.d.ts +46 -0
- package/src/commands/version/version-info.js +107 -0
- package/src/commands/version/version-info.js.map +1 -0
- package/src/package-managers/discovery.d.ts +23 -0
- package/src/package-managers/discovery.js +104 -0
- package/src/package-managers/discovery.js.map +1 -0
- package/src/package-managers/error.d.ts +43 -0
- package/src/package-managers/error.js +41 -0
- package/src/package-managers/error.js.map +1 -0
- package/src/package-managers/factory.d.ts +30 -0
- package/src/package-managers/factory.js +137 -0
- package/src/package-managers/factory.js.map +1 -0
- package/src/package-managers/host.d.ts +86 -0
- package/src/package-managers/host.js +80 -0
- package/src/package-managers/host.js.map +1 -0
- package/src/package-managers/index.d.ts +13 -0
- package/src/package-managers/index.js +17 -0
- package/src/package-managers/index.js.map +1 -0
- package/src/package-managers/logger.d.ts +27 -0
- package/src/package-managers/logger.js +10 -0
- package/src/package-managers/logger.js.map +1 -0
- package/src/package-managers/package-manager-descriptor.d.ts +245 -0
- package/src/package-managers/package-manager-descriptor.js +175 -0
- package/src/package-managers/package-manager-descriptor.js.map +1 -0
- package/src/package-managers/package-manager.d.ts +191 -0
- package/src/package-managers/package-manager.js +496 -0
- package/src/package-managers/package-manager.js.map +1 -0
- package/src/package-managers/package-metadata.d.ts +91 -0
- package/src/package-managers/package-metadata.js +10 -0
- package/src/package-managers/package-metadata.js.map +1 -0
- package/src/package-managers/package-tree.d.ts +23 -0
- package/src/package-managers/package-tree.js +10 -0
- package/src/package-managers/package-tree.js.map +1 -0
- package/src/package-managers/parsers.d.ts +170 -0
- package/src/package-managers/parsers.js +467 -0
- package/src/package-managers/parsers.js.map +1 -0
- package/src/utilities/color.d.ts +9 -0
- package/src/utilities/color.js +28 -0
- package/src/utilities/color.js.map +1 -0
- package/src/utilities/completion.d.ts +30 -0
- package/src/utilities/completion.js +270 -0
- package/src/utilities/completion.js.map +1 -0
- package/src/utilities/config.d.ts +38 -0
- package/src/utilities/config.js +369 -0
- package/src/utilities/config.js.map +1 -0
- package/src/utilities/environment-options.d.ts +25 -0
- package/src/utilities/environment-options.js +60 -0
- package/src/utilities/environment-options.js.map +1 -0
- package/src/utilities/eol.d.ts +20 -0
- package/src/utilities/eol.js +35 -0
- package/src/utilities/eol.js.map +1 -0
- package/src/utilities/error.d.ts +18 -0
- package/src/utilities/error.js +41 -0
- package/src/utilities/error.js.map +1 -0
- package/src/utilities/find-up.d.ts +21 -0
- package/src/utilities/find-up.js +67 -0
- package/src/utilities/find-up.js.map +1 -0
- package/src/utilities/json-file.d.ts +24 -0
- package/src/utilities/json-file.js +179 -0
- package/src/utilities/json-file.js.map +1 -0
- package/src/utilities/log-file.d.ts +13 -0
- package/src/utilities/log-file.js +28 -0
- package/src/utilities/log-file.js.map +1 -0
- package/src/utilities/memoize.d.ts +15 -0
- package/src/utilities/memoize.js +64 -0
- package/src/utilities/memoize.js.map +1 -0
- package/src/utilities/package-metadata.d.ts +58 -0
- package/src/utilities/package-metadata.js +265 -0
- package/src/utilities/package-metadata.js.map +1 -0
- package/src/utilities/prettier.d.ts +13 -0
- package/src/utilities/prettier.js +46 -0
- package/src/utilities/prettier.js.map +1 -0
- package/src/utilities/project.d.ts +8 -0
- package/src/utilities/project.js +81 -0
- package/src/utilities/project.js.map +1 -0
- package/src/utilities/prompt.d.ts +17 -0
- package/src/utilities/prompt.js +90 -0
- package/src/utilities/prompt.js.map +1 -0
- package/src/utilities/tty.d.ts +16 -0
- package/src/utilities/tty.js +23 -0
- package/src/utilities/tty.js.map +1 -0
- package/src/utilities/version.d.ts +16 -0
- package/src/utilities/version.js +26 -0
- package/src/utilities/version.js.map +1 -0
|
@@ -0,0 +1,244 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* @license
|
|
4
|
+
* Copyright Google LLC All Rights Reserved.
|
|
5
|
+
*
|
|
6
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
7
|
+
* found in the LICENSE file at https://angular.dev/license
|
|
8
|
+
*/
|
|
9
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
12
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
13
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
14
|
+
}
|
|
15
|
+
Object.defineProperty(o, k2, desc);
|
|
16
|
+
}) : (function(o, m, k, k2) {
|
|
17
|
+
if (k2 === undefined) k2 = k;
|
|
18
|
+
o[k2] = m[k];
|
|
19
|
+
}));
|
|
20
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
21
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
22
|
+
}) : function(o, v) {
|
|
23
|
+
o["default"] = v;
|
|
24
|
+
});
|
|
25
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
26
|
+
var ownKeys = function(o) {
|
|
27
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
28
|
+
var ar = [];
|
|
29
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
30
|
+
return ar;
|
|
31
|
+
};
|
|
32
|
+
return ownKeys(o);
|
|
33
|
+
};
|
|
34
|
+
return function (mod) {
|
|
35
|
+
if (mod && mod.__esModule) return mod;
|
|
36
|
+
var result = {};
|
|
37
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
38
|
+
__setModuleDefault(result, mod);
|
|
39
|
+
return result;
|
|
40
|
+
};
|
|
41
|
+
})();
|
|
42
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
43
|
+
exports.ArchitectBaseCommandModule = void 0;
|
|
44
|
+
const architect_1 = require("@angular-devkit/architect");
|
|
45
|
+
const node_1 = require("@angular-devkit/architect/node");
|
|
46
|
+
const core_1 = require("@angular-devkit/core");
|
|
47
|
+
const node_module_1 = require("node:module");
|
|
48
|
+
const analytics_1 = require("../analytics/analytics");
|
|
49
|
+
const analytics_parameters_1 = require("../analytics/analytics-parameters");
|
|
50
|
+
const error_1 = require("../utilities/error");
|
|
51
|
+
const prompt_1 = require("../utilities/prompt");
|
|
52
|
+
const tty_1 = require("../utilities/tty");
|
|
53
|
+
const command_module_1 = require("./command-module");
|
|
54
|
+
const json_schema_1 = require("./utilities/json-schema");
|
|
55
|
+
class ArchitectBaseCommandModule extends command_module_1.CommandModule {
|
|
56
|
+
scope = command_module_1.CommandScope.In;
|
|
57
|
+
missingTargetChoices;
|
|
58
|
+
async runSingleTarget(target, options) {
|
|
59
|
+
const architectHost = this.getArchitectHost();
|
|
60
|
+
let builderName;
|
|
61
|
+
try {
|
|
62
|
+
builderName = await architectHost.getBuilderNameForTarget(target);
|
|
63
|
+
}
|
|
64
|
+
catch (e) {
|
|
65
|
+
(0, error_1.assertIsError)(e);
|
|
66
|
+
return this.onMissingTarget(e.message);
|
|
67
|
+
}
|
|
68
|
+
const isAngularBuild = builderName.startsWith('@angular/build:');
|
|
69
|
+
const { logger } = this.context;
|
|
70
|
+
const run = await this.getArchitect(isAngularBuild).scheduleTarget(target, options, {
|
|
71
|
+
logger,
|
|
72
|
+
});
|
|
73
|
+
const analytics = (0, analytics_1.isPackageNameSafeForAnalytics)(builderName)
|
|
74
|
+
? await this.getAnalytics()
|
|
75
|
+
: undefined;
|
|
76
|
+
let outputSubscription;
|
|
77
|
+
if (analytics) {
|
|
78
|
+
analytics.reportArchitectRunEvent({
|
|
79
|
+
[analytics_parameters_1.EventCustomDimension.BuilderTarget]: builderName,
|
|
80
|
+
});
|
|
81
|
+
let firstRun = true;
|
|
82
|
+
outputSubscription = run.output.subscribe(({ stats }) => {
|
|
83
|
+
const parameters = this.builderStatsToAnalyticsParameters(stats, builderName);
|
|
84
|
+
if (!parameters) {
|
|
85
|
+
return;
|
|
86
|
+
}
|
|
87
|
+
if (firstRun) {
|
|
88
|
+
firstRun = false;
|
|
89
|
+
analytics.reportBuildRunEvent(parameters);
|
|
90
|
+
}
|
|
91
|
+
else {
|
|
92
|
+
analytics.reportRebuildRunEvent(parameters);
|
|
93
|
+
}
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
try {
|
|
97
|
+
const { error, success } = await run.lastOutput;
|
|
98
|
+
if (error) {
|
|
99
|
+
logger.error(error);
|
|
100
|
+
}
|
|
101
|
+
return success ? 0 : 1;
|
|
102
|
+
}
|
|
103
|
+
finally {
|
|
104
|
+
await run.stop();
|
|
105
|
+
outputSubscription?.unsubscribe();
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
builderStatsToAnalyticsParameters(stats, builderName) {
|
|
109
|
+
if (!stats || typeof stats !== 'object' || !('durationInMs' in stats)) {
|
|
110
|
+
return undefined;
|
|
111
|
+
}
|
|
112
|
+
const { optimization, allChunksCount, aot, lazyChunksCount, initialChunksCount, durationInMs, changedChunksCount, cssSizeInBytes, jsSizeInBytes, ngComponentCount, } = stats;
|
|
113
|
+
return {
|
|
114
|
+
[analytics_parameters_1.EventCustomDimension.BuilderTarget]: builderName,
|
|
115
|
+
[analytics_parameters_1.EventCustomDimension.Aot]: aot,
|
|
116
|
+
[analytics_parameters_1.EventCustomDimension.Optimization]: optimization,
|
|
117
|
+
[analytics_parameters_1.EventCustomMetric.AllChunksCount]: allChunksCount,
|
|
118
|
+
[analytics_parameters_1.EventCustomMetric.LazyChunksCount]: lazyChunksCount,
|
|
119
|
+
[analytics_parameters_1.EventCustomMetric.InitialChunksCount]: initialChunksCount,
|
|
120
|
+
[analytics_parameters_1.EventCustomMetric.ChangedChunksCount]: changedChunksCount,
|
|
121
|
+
[analytics_parameters_1.EventCustomMetric.DurationInMs]: durationInMs,
|
|
122
|
+
[analytics_parameters_1.EventCustomMetric.JsSizeInBytes]: jsSizeInBytes,
|
|
123
|
+
[analytics_parameters_1.EventCustomMetric.CssSizeInBytes]: cssSizeInBytes,
|
|
124
|
+
[analytics_parameters_1.EventCustomMetric.NgComponentCount]: ngComponentCount,
|
|
125
|
+
};
|
|
126
|
+
}
|
|
127
|
+
_architectHost;
|
|
128
|
+
getArchitectHost() {
|
|
129
|
+
if (this._architectHost) {
|
|
130
|
+
return this._architectHost;
|
|
131
|
+
}
|
|
132
|
+
const workspace = this.getWorkspaceOrThrow();
|
|
133
|
+
return (this._architectHost = new node_1.WorkspaceNodeModulesArchitectHost(workspace, workspace.basePath));
|
|
134
|
+
}
|
|
135
|
+
_architect;
|
|
136
|
+
getArchitect(skipUndefinedArrayTransform) {
|
|
137
|
+
if (this._architect) {
|
|
138
|
+
return this._architect;
|
|
139
|
+
}
|
|
140
|
+
const registry = new core_1.json.schema.CoreSchemaRegistry();
|
|
141
|
+
if (skipUndefinedArrayTransform) {
|
|
142
|
+
registry.addPostTransform(core_1.json.schema.transforms.addUndefinedObjectDefaults);
|
|
143
|
+
}
|
|
144
|
+
else {
|
|
145
|
+
registry.addPostTransform(core_1.json.schema.transforms.addUndefinedDefaults);
|
|
146
|
+
}
|
|
147
|
+
registry.useXDeprecatedProvider((msg) => this.context.logger.warn(msg));
|
|
148
|
+
const architectHost = this.getArchitectHost();
|
|
149
|
+
return (this._architect = new architect_1.Architect(architectHost, registry));
|
|
150
|
+
}
|
|
151
|
+
async getArchitectTargetOptions(target) {
|
|
152
|
+
const architectHost = this.getArchitectHost();
|
|
153
|
+
let builderConf;
|
|
154
|
+
try {
|
|
155
|
+
builderConf = await architectHost.getBuilderNameForTarget(target);
|
|
156
|
+
}
|
|
157
|
+
catch {
|
|
158
|
+
return [];
|
|
159
|
+
}
|
|
160
|
+
let builderDesc;
|
|
161
|
+
try {
|
|
162
|
+
builderDesc = await architectHost.resolveBuilder(builderConf);
|
|
163
|
+
}
|
|
164
|
+
catch (e) {
|
|
165
|
+
(0, error_1.assertIsError)(e);
|
|
166
|
+
if (e.code === 'MODULE_NOT_FOUND') {
|
|
167
|
+
this.warnOnMissingNodeModules();
|
|
168
|
+
throw new command_module_1.CommandModuleError(`Could not find the '${builderConf}' builder's node package.`);
|
|
169
|
+
}
|
|
170
|
+
throw e;
|
|
171
|
+
}
|
|
172
|
+
return (0, json_schema_1.parseJsonSchemaToOptions)(new core_1.json.schema.CoreSchemaRegistry(), builderDesc.optionSchema, true);
|
|
173
|
+
}
|
|
174
|
+
warnOnMissingNodeModules() {
|
|
175
|
+
const basePath = this.context.workspace?.basePath;
|
|
176
|
+
if (!basePath) {
|
|
177
|
+
return;
|
|
178
|
+
}
|
|
179
|
+
const workspaceResolve = (0, node_module_1.createRequire)(basePath + '/').resolve;
|
|
180
|
+
try {
|
|
181
|
+
workspaceResolve('@angular/core');
|
|
182
|
+
return;
|
|
183
|
+
}
|
|
184
|
+
catch { }
|
|
185
|
+
this.context.logger.warn(`Node packages may not be installed. Try installing with '${this.context.packageManager.name} install'.`);
|
|
186
|
+
}
|
|
187
|
+
getArchitectTarget() {
|
|
188
|
+
return this.commandName;
|
|
189
|
+
}
|
|
190
|
+
async onMissingTarget(defaultMessage) {
|
|
191
|
+
const { logger } = this.context;
|
|
192
|
+
const choices = this.missingTargetChoices;
|
|
193
|
+
if (!choices?.length) {
|
|
194
|
+
logger.error(defaultMessage);
|
|
195
|
+
return 1;
|
|
196
|
+
}
|
|
197
|
+
const missingTargetMessage = `Cannot find "${this.getArchitectTarget()}" target for the specified project.\n` +
|
|
198
|
+
`You can add a package that implements these capabilities.\n\n` +
|
|
199
|
+
`For example:\n` +
|
|
200
|
+
choices.map(({ name, value }) => ` ${name}: ng add ${value}`).join('\n') +
|
|
201
|
+
'\n';
|
|
202
|
+
if ((0, tty_1.isTTY)()) {
|
|
203
|
+
// Use prompts to ask the user if they'd like to install a package.
|
|
204
|
+
logger.warn(missingTargetMessage);
|
|
205
|
+
const packageToInstall = await this.getMissingTargetPackageToInstall(choices);
|
|
206
|
+
if (packageToInstall) {
|
|
207
|
+
// Example run: `ng add angular-eslint`.
|
|
208
|
+
const AddCommandModule = (await Promise.resolve().then(() => __importStar(require('../commands/add/cli')))).default;
|
|
209
|
+
await new AddCommandModule(this.context).run({
|
|
210
|
+
interactive: true,
|
|
211
|
+
force: false,
|
|
212
|
+
dryRun: false,
|
|
213
|
+
defaults: false,
|
|
214
|
+
collection: packageToInstall,
|
|
215
|
+
});
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
else {
|
|
219
|
+
// Non TTY display error message.
|
|
220
|
+
logger.error(missingTargetMessage);
|
|
221
|
+
}
|
|
222
|
+
return 1;
|
|
223
|
+
}
|
|
224
|
+
async getMissingTargetPackageToInstall(choices) {
|
|
225
|
+
if (choices.length === 1) {
|
|
226
|
+
// Single choice
|
|
227
|
+
const { name, value } = choices[0];
|
|
228
|
+
if (await (0, prompt_1.askConfirmation)(`Would you like to add ${name} now?`, true, false)) {
|
|
229
|
+
return value;
|
|
230
|
+
}
|
|
231
|
+
return null;
|
|
232
|
+
}
|
|
233
|
+
// Multiple choice
|
|
234
|
+
return (0, prompt_1.askQuestion)(`Would you like to add a package with "${this.getArchitectTarget()}" capabilities now?`, [
|
|
235
|
+
{
|
|
236
|
+
name: 'No',
|
|
237
|
+
value: null,
|
|
238
|
+
},
|
|
239
|
+
...choices,
|
|
240
|
+
], 0, null);
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
exports.ArchitectBaseCommandModule = ArchitectBaseCommandModule;
|
|
244
|
+
//# sourceMappingURL=architect-base-command-module.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"architect-base-command-module.js","sourceRoot":"","sources":["architect-base-command-module.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,yDAA8D;AAC9D,yDAGwC;AACxC,+CAA4C;AAC5C,6CAA4C;AAC5C,sDAAuE;AACvE,4EAA4F;AAC5F,8CAAmD;AACnD,gDAAmE;AACnE,0CAAyC;AACzC,qDAM0B;AAC1B,yDAA2E;AAO3E,MAAsB,0BACpB,SAAQ,8BAAgB;IAGf,KAAK,GAAG,6BAAY,CAAC,EAAE,CAAC;IACd,oBAAoB,CAAoC;IAEjE,KAAK,CAAC,eAAe,CAAC,MAAc,EAAE,OAAqB;QACnE,MAAM,aAAa,GAAG,IAAI,CAAC,gBAAgB,EAAE,CAAC;QAE9C,IAAI,WAAmB,CAAC;QACxB,IAAI,CAAC;YACH,WAAW,GAAG,MAAM,aAAa,CAAC,uBAAuB,CAAC,MAAM,CAAC,CAAC;QACpE,CAAC;QAAC,OAAO,CAAC,EAAE,CAAC;YACX,IAAA,qBAAa,EAAC,CAAC,CAAC,CAAC;YAEjB,OAAO,IAAI,CAAC,eAAe,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC;QACzC,CAAC;QAED,MAAM,cAAc,GAAG,WAAW,CAAC,UAAU,CAAC,iBAAiB,CAAC,CAAC;QAEjE,MAAM,EAAE,MAAM,EAAE,GAAG,IAAI,CAAC,OAAO,CAAC;QAChC,MAAM,GAAG,GAAG,MAAM,IAAI,CAAC,YAAY,CAAC,cAAc,CAAC,CAAC,cAAc,CAChE,MAAM,EACN,OAA0B,EAC1B;YACE,MAAM;SACP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;QACd,CAAC;QAED,kBAAkB;QAClB,OAAO,IAAA,oBAAW,EAChB,yCAAyC,IAAI,CAAC,kBAAkB,EAAE,qBAAqB,EACvF;YACE;gBACE,IAAI,EAAE,IAAI;gBACV,KAAK,EAAE,IAAI;aACZ;YACD,GAAG,OAAO;SACX,EACD,CAAC,EACD,IAAI,CACL,CAAC;IACJ,CAAC;CACF;AAtQD,gEAsQC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright Google LLC All Rights Reserved.
|
|
4
|
+
*
|
|
5
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
6
|
+
* found in the LICENSE file at https://angular.dev/license
|
|
7
|
+
*/
|
|
8
|
+
import { Target } from '@angular-devkit/architect';
|
|
9
|
+
import { workspaces } from '@angular-devkit/core';
|
|
10
|
+
import { Argv } from 'yargs';
|
|
11
|
+
import { ArchitectBaseCommandModule } from './architect-base-command-module';
|
|
12
|
+
import { CommandModuleImplementation, Options, OtherOptions } from './command-module';
|
|
13
|
+
export interface ArchitectCommandArgs {
|
|
14
|
+
configuration?: string;
|
|
15
|
+
project?: string;
|
|
16
|
+
}
|
|
17
|
+
export declare abstract class ArchitectCommandModule extends ArchitectBaseCommandModule<ArchitectCommandArgs> implements CommandModuleImplementation<ArchitectCommandArgs> {
|
|
18
|
+
abstract readonly multiTarget: boolean;
|
|
19
|
+
findDefaultBuilderName?(project: workspaces.ProjectDefinition, target: Target): Promise<string | undefined>;
|
|
20
|
+
builder(argv: Argv): Promise<Argv<ArchitectCommandArgs>>;
|
|
21
|
+
run(options: Options<ArchitectCommandArgs> & OtherOptions): Promise<number | void>;
|
|
22
|
+
private getArchitectProject;
|
|
23
|
+
private getProjectNamesByTarget;
|
|
24
|
+
/** @returns a sorted list of project names to be used for auto completion. */
|
|
25
|
+
private getProjectChoices;
|
|
26
|
+
/** @returns a sorted list of configuration names to be used for auto completion. */
|
|
27
|
+
private getConfigurationChoices;
|
|
28
|
+
}
|
|
@@ -0,0 +1,218 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* @license
|
|
4
|
+
* Copyright Google LLC All Rights Reserved.
|
|
5
|
+
*
|
|
6
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
7
|
+
* found in the LICENSE file at https://angular.dev/license
|
|
8
|
+
*/
|
|
9
|
+
var __runInitializers = (this && this.__runInitializers) || function (thisArg, initializers, value) {
|
|
10
|
+
var useValue = arguments.length > 2;
|
|
11
|
+
for (var i = 0; i < initializers.length; i++) {
|
|
12
|
+
value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);
|
|
13
|
+
}
|
|
14
|
+
return useValue ? value : void 0;
|
|
15
|
+
};
|
|
16
|
+
var __esDecorate = (this && this.__esDecorate) || function (ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
|
|
17
|
+
function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; }
|
|
18
|
+
var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value";
|
|
19
|
+
var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null;
|
|
20
|
+
var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});
|
|
21
|
+
var _, done = false;
|
|
22
|
+
for (var i = decorators.length - 1; i >= 0; i--) {
|
|
23
|
+
var context = {};
|
|
24
|
+
for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p];
|
|
25
|
+
for (var p in contextIn.access) context.access[p] = contextIn.access[p];
|
|
26
|
+
context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); };
|
|
27
|
+
var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);
|
|
28
|
+
if (kind === "accessor") {
|
|
29
|
+
if (result === void 0) continue;
|
|
30
|
+
if (result === null || typeof result !== "object") throw new TypeError("Object expected");
|
|
31
|
+
if (_ = accept(result.get)) descriptor.get = _;
|
|
32
|
+
if (_ = accept(result.set)) descriptor.set = _;
|
|
33
|
+
if (_ = accept(result.init)) initializers.unshift(_);
|
|
34
|
+
}
|
|
35
|
+
else if (_ = accept(result)) {
|
|
36
|
+
if (kind === "field") initializers.unshift(_);
|
|
37
|
+
else descriptor[key] = _;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
if (target) Object.defineProperty(target, contextIn.name, descriptor);
|
|
41
|
+
done = true;
|
|
42
|
+
};
|
|
43
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
44
|
+
exports.ArchitectCommandModule = void 0;
|
|
45
|
+
const config_1 = require("../utilities/config");
|
|
46
|
+
const memoize_1 = require("../utilities/memoize");
|
|
47
|
+
const architect_base_command_module_1 = require("./architect-base-command-module");
|
|
48
|
+
const command_module_1 = require("./command-module");
|
|
49
|
+
let ArchitectCommandModule = (() => {
|
|
50
|
+
let _classSuper = architect_base_command_module_1.ArchitectBaseCommandModule;
|
|
51
|
+
let _instanceExtraInitializers = [];
|
|
52
|
+
let _getProjectNamesByTarget_decorators;
|
|
53
|
+
return class ArchitectCommandModule extends _classSuper {
|
|
54
|
+
static {
|
|
55
|
+
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
|
|
56
|
+
_getProjectNamesByTarget_decorators = [memoize_1.memoize];
|
|
57
|
+
__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);
|
|
58
|
+
if (_metadata) Object.defineProperty(this, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
59
|
+
}
|
|
60
|
+
async builder(argv) {
|
|
61
|
+
const target = this.getArchitectTarget();
|
|
62
|
+
// Add default builder if target is not in project and a command default is provided
|
|
63
|
+
if (this.findDefaultBuilderName && this.context.workspace) {
|
|
64
|
+
for (const [project, projectDefinition] of this.context.workspace.projects) {
|
|
65
|
+
const targetDefinition = projectDefinition.targets.get(target);
|
|
66
|
+
if (targetDefinition?.builder) {
|
|
67
|
+
continue;
|
|
68
|
+
}
|
|
69
|
+
const defaultBuilder = await this.findDefaultBuilderName(projectDefinition, {
|
|
70
|
+
project,
|
|
71
|
+
target,
|
|
72
|
+
});
|
|
73
|
+
if (!defaultBuilder) {
|
|
74
|
+
continue;
|
|
75
|
+
}
|
|
76
|
+
if (targetDefinition) {
|
|
77
|
+
targetDefinition.builder = defaultBuilder;
|
|
78
|
+
}
|
|
79
|
+
else {
|
|
80
|
+
projectDefinition.targets.set(target, {
|
|
81
|
+
builder: defaultBuilder,
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
const project = this.getArchitectProject();
|
|
87
|
+
const { jsonHelp, getYargsCompletions, help } = this.context.args.options;
|
|
88
|
+
const localYargs = argv
|
|
89
|
+
.positional('project', {
|
|
90
|
+
describe: 'The name of the project to build. Can be an application or a library.',
|
|
91
|
+
type: 'string',
|
|
92
|
+
// Hide choices from JSON help so that we don't display them in AIO.
|
|
93
|
+
choices: jsonHelp ? undefined : this.getProjectChoices(),
|
|
94
|
+
})
|
|
95
|
+
.option('configuration', {
|
|
96
|
+
describe: `One or more named builder configurations as a comma-separated ` +
|
|
97
|
+
`list as specified in the "configurations" section in angular.json.\n` +
|
|
98
|
+
`The builder uses the named configurations to run the given target.\n` +
|
|
99
|
+
`For more information, see https://angular.dev/reference/configs/workspace-config#alternate-build-configurations.`,
|
|
100
|
+
alias: 'c',
|
|
101
|
+
type: 'string',
|
|
102
|
+
// Show only in when using --help and auto completion because otherwise comma seperated configuration values will be invalid.
|
|
103
|
+
// Also, hide choices from JSON help so that we don't display them in AIO.
|
|
104
|
+
choices: (getYargsCompletions || help) && !jsonHelp && project
|
|
105
|
+
? this.getConfigurationChoices(project)
|
|
106
|
+
: undefined,
|
|
107
|
+
})
|
|
108
|
+
.strict();
|
|
109
|
+
if (!project) {
|
|
110
|
+
return localYargs;
|
|
111
|
+
}
|
|
112
|
+
const schemaOptions = await this.getArchitectTargetOptions({
|
|
113
|
+
project,
|
|
114
|
+
target,
|
|
115
|
+
});
|
|
116
|
+
return this.addSchemaOptionsToCommand(localYargs, schemaOptions);
|
|
117
|
+
}
|
|
118
|
+
async run(options) {
|
|
119
|
+
const originalProcessTitle = process.title;
|
|
120
|
+
try {
|
|
121
|
+
const target = this.getArchitectTarget();
|
|
122
|
+
const { configuration = '', project, ...architectOptions } = options;
|
|
123
|
+
if (project) {
|
|
124
|
+
process.title = `${originalProcessTitle} (${project})`;
|
|
125
|
+
return await this.runSingleTarget({ configuration, target, project }, architectOptions);
|
|
126
|
+
}
|
|
127
|
+
// This runs each target sequentially.
|
|
128
|
+
// Running them in parallel would jumble the log messages.
|
|
129
|
+
let result = 0;
|
|
130
|
+
const projectNames = this.getProjectNamesByTarget(target);
|
|
131
|
+
if (!projectNames) {
|
|
132
|
+
return this.onMissingTarget('Cannot determine project or target for command.');
|
|
133
|
+
}
|
|
134
|
+
for (const project of projectNames) {
|
|
135
|
+
process.title = `${originalProcessTitle} (${project})`;
|
|
136
|
+
result |= await this.runSingleTarget({ configuration, target, project }, architectOptions);
|
|
137
|
+
}
|
|
138
|
+
return result;
|
|
139
|
+
}
|
|
140
|
+
finally {
|
|
141
|
+
process.title = originalProcessTitle;
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
getArchitectProject() {
|
|
145
|
+
const { options, positional } = this.context.args;
|
|
146
|
+
const [, projectName] = positional;
|
|
147
|
+
if (projectName) {
|
|
148
|
+
return projectName;
|
|
149
|
+
}
|
|
150
|
+
// Yargs allows positional args to be used as flags.
|
|
151
|
+
if (typeof options['project'] === 'string') {
|
|
152
|
+
return options['project'];
|
|
153
|
+
}
|
|
154
|
+
const target = this.getArchitectTarget();
|
|
155
|
+
const projectFromTarget = this.getProjectNamesByTarget(target);
|
|
156
|
+
return projectFromTarget?.length ? projectFromTarget[0] : undefined;
|
|
157
|
+
}
|
|
158
|
+
getProjectNamesByTarget(target) {
|
|
159
|
+
const workspace = this.getWorkspaceOrThrow();
|
|
160
|
+
const allProjectsForTargetName = [];
|
|
161
|
+
for (const [name, project] of workspace.projects) {
|
|
162
|
+
if (project.targets.has(target)) {
|
|
163
|
+
allProjectsForTargetName.push(name);
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
if (allProjectsForTargetName.length === 0) {
|
|
167
|
+
return undefined;
|
|
168
|
+
}
|
|
169
|
+
if (this.multiTarget) {
|
|
170
|
+
// For multi target commands, we always list all projects that have the target.
|
|
171
|
+
return allProjectsForTargetName;
|
|
172
|
+
}
|
|
173
|
+
else {
|
|
174
|
+
if (allProjectsForTargetName.length === 1) {
|
|
175
|
+
return allProjectsForTargetName;
|
|
176
|
+
}
|
|
177
|
+
const maybeProject = (0, config_1.getProjectByCwd)(workspace);
|
|
178
|
+
if (maybeProject) {
|
|
179
|
+
return allProjectsForTargetName.includes(maybeProject) ? [maybeProject] : undefined;
|
|
180
|
+
}
|
|
181
|
+
const { getYargsCompletions, help } = this.context.args.options;
|
|
182
|
+
if (!getYargsCompletions && !help) {
|
|
183
|
+
// Only issue the below error when not in help / completion mode.
|
|
184
|
+
throw new command_module_1.CommandModuleError('Cannot determine project for command.\n' +
|
|
185
|
+
'This is a multi-project workspace and more than one project supports this command. ' +
|
|
186
|
+
`Run "ng ${this.command}" to execute the command for a specific project or change the current ` +
|
|
187
|
+
'working directory to a project directory.\n\n' +
|
|
188
|
+
`Available projects are:\n${allProjectsForTargetName
|
|
189
|
+
.sort()
|
|
190
|
+
.map((p) => `- ${p}`)
|
|
191
|
+
.join('\n')}`);
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
return undefined;
|
|
195
|
+
}
|
|
196
|
+
/** @returns a sorted list of project names to be used for auto completion. */
|
|
197
|
+
getProjectChoices() {
|
|
198
|
+
const { workspace } = this.context;
|
|
199
|
+
return workspace ? [...workspace.projects.keys()].sort() : undefined;
|
|
200
|
+
}
|
|
201
|
+
/** @returns a sorted list of configuration names to be used for auto completion. */
|
|
202
|
+
getConfigurationChoices(project) {
|
|
203
|
+
const projectDefinition = this.context.workspace?.projects.get(project);
|
|
204
|
+
if (!projectDefinition) {
|
|
205
|
+
return undefined;
|
|
206
|
+
}
|
|
207
|
+
const target = this.getArchitectTarget();
|
|
208
|
+
const configurations = projectDefinition.targets.get(target)?.configurations;
|
|
209
|
+
return configurations ? Object.keys(configurations).sort() : undefined;
|
|
210
|
+
}
|
|
211
|
+
constructor() {
|
|
212
|
+
super(...arguments);
|
|
213
|
+
__runInitializers(this, _instanceExtraInitializers);
|
|
214
|
+
}
|
|
215
|
+
};
|
|
216
|
+
})();
|
|
217
|
+
exports.ArchitectCommandModule = ArchitectCommandModule;
|
|
218
|
+
//# sourceMappingURL=architect-command-module.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"architect-command-module.js","sourceRoot":"","sources":["architect-command-module.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAKH,gDAAsD;AACtD,kDAA+C;AAC/C,mFAA6E;AAC7E,qDAK0B;IAOJ,sBAAsB;sBAClC,0DAA0B;;;iBADd,sBACpB,SAAQ,WAAgD;;;mDAgIvD,iBAAO;YACR,wNAAQ,uBAAuB,6DA4C9B;;;QAnKD,KAAK,CAAC,OAAO,CAAC,IAAU;YACtB,MAAM,MAAM,GAAG,IAAI,CAAC,kBAAkB,EAAE,CAAC;YAEzC,oFAAoF;YACpF,IAAI,IAAI,CAAC,sBAAsB,IAAI,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE,CAAC;gBAC1D,KAAK,MAAM,CAAC,OAAO,EAAE,iBAAiB,CAAC,IAAI,IAAI,CAAC,OA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,CAAC,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC;QACvE,CAAC;QAED,oFAAoF;QAC5E,uBAAuB,CAAC,OAAe;YAC7C,MAAM,iBAAiB,GAAG,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE,QAAQ,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;YACxE,IAAI,CAAC,iBAAiB,EAAE,CAAC;gBACvB,OAAO,SAAS,CAAC;YACnB,CAAC;YAED,MAAM,MAAM,GAAG,IAAI,CAAC,kBAAkB,EAAE,CAAC;YACzC,MAAM,cAAc,GAAG,iBAAiB,CAAC,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,cAAc,CAAC;YAE7E,OAAO,cAAc,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC;QACzE,CAAC;;;YAlMmB,mDAAsB;;;;AAAtB,wDAAsB"}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright Google LLC All Rights Reserved.
|
|
4
|
+
*
|
|
5
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
6
|
+
* found in the LICENSE file at https://angular.dev/license
|
|
7
|
+
*/
|
|
8
|
+
import type { ArgumentsCamelCase, Argv, CommandModule as YargsCommandModule } from 'yargs';
|
|
9
|
+
import { AnalyticsCollector } from '../analytics/analytics-collector';
|
|
10
|
+
import { EventCustomDimension, EventCustomMetric } from '../analytics/analytics-parameters';
|
|
11
|
+
import { AngularWorkspace } from '../utilities/config';
|
|
12
|
+
import { CommandContext, CommandScope, Options, OtherOptions } from './definitions';
|
|
13
|
+
import { Option } from './utilities/json-schema';
|
|
14
|
+
export { CommandScope };
|
|
15
|
+
export type { CommandContext, Options, OtherOptions };
|
|
16
|
+
export interface CommandModuleImplementation<T extends {} = {}> extends Omit<YargsCommandModule<{}, T>, 'builder' | 'handler'> {
|
|
17
|
+
/** Scope in which the command can be executed in. */
|
|
18
|
+
scope: CommandScope;
|
|
19
|
+
/** Path used to load the long description for the command in JSON help text. */
|
|
20
|
+
longDescriptionPath?: string;
|
|
21
|
+
/** Object declaring the options the command accepts, or a function accepting and returning a yargs instance. */
|
|
22
|
+
builder(argv: Argv): Promise<Argv<T>> | Argv<T>;
|
|
23
|
+
/** A function which will be passed the parsed argv. */
|
|
24
|
+
run(options: Options<T> & OtherOptions): Promise<number | void> | number | void;
|
|
25
|
+
}
|
|
26
|
+
export interface FullDescribe {
|
|
27
|
+
describe?: string;
|
|
28
|
+
longDescription?: string;
|
|
29
|
+
longDescriptionRelativePath?: string;
|
|
30
|
+
}
|
|
31
|
+
export declare abstract class CommandModule<T extends {} = {}> implements CommandModuleImplementation<T> {
|
|
32
|
+
protected readonly context: CommandContext;
|
|
33
|
+
abstract readonly command: string;
|
|
34
|
+
abstract readonly describe: string | false;
|
|
35
|
+
abstract readonly longDescriptionPath?: string;
|
|
36
|
+
protected readonly shouldReportAnalytics: boolean;
|
|
37
|
+
readonly scope: CommandScope;
|
|
38
|
+
private readonly optionsWithAnalytics;
|
|
39
|
+
constructor(context: CommandContext);
|
|
40
|
+
/**
|
|
41
|
+
* Description object which contains the long command descroption.
|
|
42
|
+
* This is used to generate JSON help wich is used in AIO.
|
|
43
|
+
*
|
|
44
|
+
* `false` will result in a hidden command.
|
|
45
|
+
*/
|
|
46
|
+
get fullDescribe(): FullDescribe | false;
|
|
47
|
+
protected get commandName(): string;
|
|
48
|
+
abstract builder(argv: Argv): Promise<Argv<T>> | Argv<T>;
|
|
49
|
+
abstract run(options: Options<T> & OtherOptions): Promise<number | void> | number | void;
|
|
50
|
+
handler(args: ArgumentsCamelCase<T> & OtherOptions): Promise<void>;
|
|
51
|
+
protected getAnalytics(): Promise<AnalyticsCollector | undefined>;
|
|
52
|
+
/**
|
|
53
|
+
* Adds schema options to a command also this keeps track of options that are required for analytics.
|
|
54
|
+
* **Note:** This method should be called from the command bundler method.
|
|
55
|
+
*/
|
|
56
|
+
protected addSchemaOptionsToCommand<T>(localYargs: Argv<T>, options: Option[]): Argv<T>;
|
|
57
|
+
protected getWorkspaceOrThrow(): AngularWorkspace;
|
|
58
|
+
/**
|
|
59
|
+
* Flush on an interval (if the event loop is waiting).
|
|
60
|
+
*
|
|
61
|
+
* @returns a method that when called will terminate the periodic
|
|
62
|
+
* flush and call flush one last time.
|
|
63
|
+
*/
|
|
64
|
+
protected getAnalyticsParameters(options: (Options<T> & OtherOptions) | OtherOptions): Partial<Record<EventCustomDimension | EventCustomMetric, string | boolean | number>>;
|
|
65
|
+
private reportCommandRunAnalytics;
|
|
66
|
+
private reportWorkspaceInfoAnalytics;
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Creates an known command module error.
|
|
70
|
+
* This is used so during executation we can filter between known validation error and real non handled errors.
|
|
71
|
+
*/
|
|
72
|
+
export declare class CommandModuleError extends Error {
|
|
73
|
+
}
|