@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,148 @@
|
|
|
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.checkCleanGit = checkCleanGit;
|
|
44
|
+
exports.hasChangesToCommit = hasChangesToCommit;
|
|
45
|
+
exports.createCommit = createCommit;
|
|
46
|
+
exports.findCurrentGitSha = findCurrentGitSha;
|
|
47
|
+
exports.getShortHash = getShortHash;
|
|
48
|
+
const node_child_process_1 = require("node:child_process");
|
|
49
|
+
const path = __importStar(require("node:path"));
|
|
50
|
+
/**
|
|
51
|
+
* Execute a git command.
|
|
52
|
+
* @param args Arguments to pass to the git command.
|
|
53
|
+
* @param input Optional input to pass to the command via stdin.
|
|
54
|
+
* @returns The output of the command.
|
|
55
|
+
*/
|
|
56
|
+
function execGit(args, input) {
|
|
57
|
+
return (0, node_child_process_1.execFileSync)('git', args, { encoding: 'utf8', stdio: 'pipe', input });
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Checks if the git repository is clean.
|
|
61
|
+
* This function only checks for changes that are within the specified root directory.
|
|
62
|
+
* Changes outside the root directory are ignored.
|
|
63
|
+
* @param root The root directory of the project to check.
|
|
64
|
+
* @returns True if the repository is clean within the root, false otherwise.
|
|
65
|
+
*/
|
|
66
|
+
function checkCleanGit(root) {
|
|
67
|
+
try {
|
|
68
|
+
const topLevel = execGit(['rev-parse', '--show-toplevel']);
|
|
69
|
+
const result = execGit(['status', '--porcelain', '-z']);
|
|
70
|
+
if (result.length === 0) {
|
|
71
|
+
return true;
|
|
72
|
+
}
|
|
73
|
+
const entries = result.split('\0');
|
|
74
|
+
for (let i = 0; i < entries.length; i++) {
|
|
75
|
+
const line = entries[i];
|
|
76
|
+
if (!line) {
|
|
77
|
+
continue;
|
|
78
|
+
}
|
|
79
|
+
// Status is the first 2 characters.
|
|
80
|
+
// If the status is a rename ('R'), the next entry in the split array is the target path.
|
|
81
|
+
let filePath = line.slice(3);
|
|
82
|
+
const status = line.slice(0, 2);
|
|
83
|
+
if (status[0] === 'R') {
|
|
84
|
+
// Check the source path (filePath)
|
|
85
|
+
if (isPathInsideRoot(filePath, root, topLevel.trim())) {
|
|
86
|
+
return false;
|
|
87
|
+
}
|
|
88
|
+
// The next entry is the target path of the rename.
|
|
89
|
+
i++;
|
|
90
|
+
filePath = entries[i];
|
|
91
|
+
}
|
|
92
|
+
if (isPathInsideRoot(filePath, root, topLevel.trim())) {
|
|
93
|
+
return false;
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
catch { } // eslint-disable-line no-empty
|
|
98
|
+
return true;
|
|
99
|
+
}
|
|
100
|
+
function isPathInsideRoot(filePath, root, topLevel) {
|
|
101
|
+
const relativeEntry = path.relative(path.resolve(root), path.resolve(topLevel, filePath));
|
|
102
|
+
return !relativeEntry.startsWith('..') && !path.isAbsolute(relativeEntry);
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* Checks if the working directory has pending changes to commit.
|
|
106
|
+
* @returns Whether or not the working directory has Git changes to commit. Returns false if not in a Git repository.
|
|
107
|
+
*/
|
|
108
|
+
function hasChangesToCommit() {
|
|
109
|
+
try {
|
|
110
|
+
// List all modified files not covered by .gitignore.
|
|
111
|
+
// If any files are returned, then there must be something to commit.
|
|
112
|
+
return execGit(['ls-files', '-m', '-d', '-o', '--exclude-standard']).trim() !== '';
|
|
113
|
+
}
|
|
114
|
+
catch {
|
|
115
|
+
return false;
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* Stages all changes in the Git working tree and creates a new commit.
|
|
120
|
+
* @param message The commit message to use.
|
|
121
|
+
*/
|
|
122
|
+
function createCommit(message) {
|
|
123
|
+
// Stage entire working tree for commit.
|
|
124
|
+
execGit(['add', '-A']);
|
|
125
|
+
// Commit with the message passed via stdin to avoid bash escaping issues.
|
|
126
|
+
execGit(['commit', '--no-verify', '-F', '-'], message);
|
|
127
|
+
}
|
|
128
|
+
/**
|
|
129
|
+
* Finds the full Git SHA hash of the HEAD commit.
|
|
130
|
+
* @returns The full Git SHA hash of the HEAD commit. Returns null if unable to retrieve the hash.
|
|
131
|
+
*/
|
|
132
|
+
function findCurrentGitSha() {
|
|
133
|
+
try {
|
|
134
|
+
return execGit(['rev-parse', 'HEAD']).trim();
|
|
135
|
+
}
|
|
136
|
+
catch {
|
|
137
|
+
return null;
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
/**
|
|
141
|
+
* Gets the short hash of a commit.
|
|
142
|
+
* @param commitHash The full commit hash.
|
|
143
|
+
* @returns The short hash (first 9 characters).
|
|
144
|
+
*/
|
|
145
|
+
function getShortHash(commitHash) {
|
|
146
|
+
return commitHash.slice(0, 9);
|
|
147
|
+
}
|
|
148
|
+
//# sourceMappingURL=git.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"git.js","sourceRoot":"","sources":["git.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAsBH,sCAqCC;AAYD,gDAQC;AAMD,oCAMC;AAMD,8CAMC;AAOD,oCAEC;AA9GD,2DAAkD;AAClD,gDAAkC;AAElC;;;;;GAKG;AACH,SAAS,OAAO,CAAC,IAAc,EAAE,KAAc;IAC7C,OAAO,IAAA,iCAAY,EAAC,KAAK,EAAE,IAAI,EAAE,EAAE,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,CAAC;AAC/E,CAAC;AAED;;;;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AAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;AAChC,CAAC"}
|
|
@@ -0,0 +1,32 @@
|
|
|
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 { logging } from '@angular-devkit/core';
|
|
9
|
+
import { SchematicDescription } from '@angular-devkit/schematics';
|
|
10
|
+
import { FileSystemCollectionDescription, FileSystemSchematicDescription, NodeWorkflow } from '@angular-devkit/schematics/tools';
|
|
11
|
+
export interface MigrationSchematicDescription extends SchematicDescription<FileSystemCollectionDescription, FileSystemSchematicDescription> {
|
|
12
|
+
version?: string;
|
|
13
|
+
optional?: boolean;
|
|
14
|
+
recommended?: boolean;
|
|
15
|
+
documentation?: string;
|
|
16
|
+
}
|
|
17
|
+
export declare function executeSchematic(workflow: NodeWorkflow, logger: logging.Logger, collection: string, schematic: string, options?: Record<string, unknown>): Promise<{
|
|
18
|
+
success: boolean;
|
|
19
|
+
files: Set<string>;
|
|
20
|
+
}>;
|
|
21
|
+
/**
|
|
22
|
+
* @return Whether or not the migration was performed successfully.
|
|
23
|
+
*/
|
|
24
|
+
export declare function executeMigration(workflow: NodeWorkflow, logger: logging.Logger, packageName: string, collectionPath: string, migrationName: string, commit?: boolean): Promise<number>;
|
|
25
|
+
/**
|
|
26
|
+
* @return Whether or not the migrations were performed successfully.
|
|
27
|
+
*/
|
|
28
|
+
export declare function executeMigrations(workflow: NodeWorkflow, logger: logging.Logger, packageName: string, collectionPath: string, from: string, to: string, commit?: boolean): Promise<number>;
|
|
29
|
+
/**
|
|
30
|
+
* @return Whether or not the commit was successful.
|
|
31
|
+
*/
|
|
32
|
+
export declare function commitChanges(logger: logging.Logger, message: string): boolean;
|
|
@@ -0,0 +1,267 @@
|
|
|
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.executeSchematic = executeSchematic;
|
|
44
|
+
exports.executeMigration = executeMigration;
|
|
45
|
+
exports.executeMigrations = executeMigrations;
|
|
46
|
+
exports.commitChanges = commitChanges;
|
|
47
|
+
const schematics_1 = require("@angular-devkit/schematics");
|
|
48
|
+
const semver = __importStar(require("semver"));
|
|
49
|
+
const schematic_workflow_1 = require("../../../command-builder/utilities/schematic-workflow");
|
|
50
|
+
const color_1 = require("../../../utilities/color");
|
|
51
|
+
const error_1 = require("../../../utilities/error");
|
|
52
|
+
const log_file_1 = require("../../../utilities/log-file");
|
|
53
|
+
const prettier_1 = require("../../../utilities/prettier");
|
|
54
|
+
const prompt_1 = require("../../../utilities/prompt");
|
|
55
|
+
const tty_1 = require("../../../utilities/tty");
|
|
56
|
+
const cli_version_1 = require("./cli-version");
|
|
57
|
+
const git_1 = require("./git");
|
|
58
|
+
async function executeSchematic(workflow, logger, collection, schematic, options = {}) {
|
|
59
|
+
const workflowSubscription = (0, schematic_workflow_1.subscribeToWorkflow)(workflow, logger);
|
|
60
|
+
// TODO: Allow passing a schematic instance directly
|
|
61
|
+
try {
|
|
62
|
+
await workflow
|
|
63
|
+
.execute({
|
|
64
|
+
collection,
|
|
65
|
+
schematic,
|
|
66
|
+
options,
|
|
67
|
+
logger,
|
|
68
|
+
})
|
|
69
|
+
.toPromise();
|
|
70
|
+
return { success: !workflowSubscription.error, files: workflowSubscription.files };
|
|
71
|
+
}
|
|
72
|
+
catch (e) {
|
|
73
|
+
if (e instanceof schematics_1.UnsuccessfulWorkflowExecution) {
|
|
74
|
+
logger.error(`${color_1.figures.cross} Migration failed. See above for further details.\n`);
|
|
75
|
+
}
|
|
76
|
+
else {
|
|
77
|
+
(0, error_1.assertIsError)(e);
|
|
78
|
+
const logPath = (0, log_file_1.writeErrorToLogFile)(e);
|
|
79
|
+
logger.fatal(`${color_1.figures.cross} Migration failed: ${e.message}\n` +
|
|
80
|
+
` See "${logPath}" for further details.\n`);
|
|
81
|
+
}
|
|
82
|
+
return { success: false, files: workflowSubscription.files };
|
|
83
|
+
}
|
|
84
|
+
finally {
|
|
85
|
+
workflowSubscription.unsubscribe();
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* @return Whether or not the migration was performed successfully.
|
|
90
|
+
*/
|
|
91
|
+
async function executeMigration(workflow, logger, packageName, collectionPath, migrationName, commit = false) {
|
|
92
|
+
const collection = workflow.engine.createCollection(collectionPath);
|
|
93
|
+
const name = collection.listSchematicNames().find((name) => name === migrationName);
|
|
94
|
+
if (!name) {
|
|
95
|
+
logger.error(`Cannot find migration '${migrationName}' in '${packageName}'.`);
|
|
96
|
+
return 1;
|
|
97
|
+
}
|
|
98
|
+
logger.info(color_1.colors.cyan(`** Executing '${migrationName}' of package '${packageName}' **\n`));
|
|
99
|
+
const schematic = workflow.engine.createSchematic(name, collection);
|
|
100
|
+
return executePackageMigrations(workflow, logger, [schematic.description], packageName, commit);
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* @return Whether or not the migrations were performed successfully.
|
|
104
|
+
*/
|
|
105
|
+
async function executeMigrations(workflow, logger, packageName, collectionPath, from, to, commit = false) {
|
|
106
|
+
const collection = workflow.engine.createCollection(collectionPath);
|
|
107
|
+
const migrationRange = new semver.Range('>' + (semver.prerelease(from) ? from.split('-')[0] + '-0' : from) + ' <=' + to.split('-')[0]);
|
|
108
|
+
const requiredMigrations = [];
|
|
109
|
+
const optionalMigrations = [];
|
|
110
|
+
for (const name of collection.listSchematicNames()) {
|
|
111
|
+
const schematic = workflow.engine.createSchematic(name, collection);
|
|
112
|
+
const description = schematic.description;
|
|
113
|
+
description.version = (0, cli_version_1.coerceVersionNumber)(description.version);
|
|
114
|
+
if (!description.version) {
|
|
115
|
+
continue;
|
|
116
|
+
}
|
|
117
|
+
if (semver.satisfies(description.version, migrationRange, { includePrerelease: true })) {
|
|
118
|
+
(description.optional ? optionalMigrations : requiredMigrations).push(description);
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
if (requiredMigrations.length === 0 && optionalMigrations.length === 0) {
|
|
122
|
+
return 0;
|
|
123
|
+
}
|
|
124
|
+
// Required migrations
|
|
125
|
+
if (requiredMigrations.length) {
|
|
126
|
+
logger.info(color_1.colors.cyan(`** Executing migrations of package '${packageName}' **\n`));
|
|
127
|
+
requiredMigrations.sort((a, b) => semver.compare(a.version, b.version) || a.name.localeCompare(b.name));
|
|
128
|
+
const result = await executePackageMigrations(workflow, logger, requiredMigrations, packageName, commit);
|
|
129
|
+
if (result === 1) {
|
|
130
|
+
return 1;
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
// Optional migrations
|
|
134
|
+
if (optionalMigrations.length) {
|
|
135
|
+
logger.info(color_1.colors.magenta(`** Optional migrations of package '${packageName}' **\n`));
|
|
136
|
+
optionalMigrations.sort((a, b) => semver.compare(a.version, b.version) || a.name.localeCompare(b.name));
|
|
137
|
+
const migrationsToRun = await getOptionalMigrationsToRun(logger, optionalMigrations, packageName);
|
|
138
|
+
if (migrationsToRun?.length) {
|
|
139
|
+
return executePackageMigrations(workflow, logger, migrationsToRun, packageName, commit);
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
return 0;
|
|
143
|
+
}
|
|
144
|
+
async function executePackageMigrations(workflow, logger, migrations, packageName, commit = false) {
|
|
145
|
+
for (const migration of migrations) {
|
|
146
|
+
const { title, description } = getMigrationTitleAndDescription(migration);
|
|
147
|
+
logger.info(color_1.colors.cyan(color_1.figures.pointer) + ' ' + color_1.colors.bold(title));
|
|
148
|
+
if (description) {
|
|
149
|
+
logger.info(' ' + description);
|
|
150
|
+
}
|
|
151
|
+
const { success, files } = await executeSchematic(workflow, logger, migration.collection.name, migration.name);
|
|
152
|
+
if (!success) {
|
|
153
|
+
return 1;
|
|
154
|
+
}
|
|
155
|
+
let modifiedFilesText;
|
|
156
|
+
switch (files.size) {
|
|
157
|
+
case 0:
|
|
158
|
+
modifiedFilesText = 'No changes made';
|
|
159
|
+
break;
|
|
160
|
+
case 1:
|
|
161
|
+
modifiedFilesText = '1 file modified';
|
|
162
|
+
break;
|
|
163
|
+
default:
|
|
164
|
+
modifiedFilesText = `${files.size} files modified`;
|
|
165
|
+
break;
|
|
166
|
+
}
|
|
167
|
+
if (files.size) {
|
|
168
|
+
try {
|
|
169
|
+
await (0, prettier_1.formatFiles)(process.cwd(), files);
|
|
170
|
+
}
|
|
171
|
+
catch (error) {
|
|
172
|
+
(0, error_1.assertIsError)(error);
|
|
173
|
+
logger.warn(`WARNING: Formatting of files failed with the following error: ${error.message}`);
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
logger.info(` Migration completed (${modifiedFilesText}).`);
|
|
177
|
+
// Commit migration
|
|
178
|
+
if (commit) {
|
|
179
|
+
const commitPrefix = `${packageName} migration - ${migration.name}`;
|
|
180
|
+
const commitMessage = migration.description
|
|
181
|
+
? `${commitPrefix}\n\n${migration.description}`
|
|
182
|
+
: commitPrefix;
|
|
183
|
+
const committed = commitChanges(logger, commitMessage);
|
|
184
|
+
if (!committed) {
|
|
185
|
+
// Failed to commit, something went wrong. Abort the update.
|
|
186
|
+
return 1;
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
logger.info(''); // Extra trailing newline.
|
|
190
|
+
}
|
|
191
|
+
return 0;
|
|
192
|
+
}
|
|
193
|
+
/**
|
|
194
|
+
* @return Whether or not the commit was successful.
|
|
195
|
+
*/
|
|
196
|
+
function commitChanges(logger, message) {
|
|
197
|
+
// Check if a commit is needed.
|
|
198
|
+
let commitNeeded;
|
|
199
|
+
try {
|
|
200
|
+
commitNeeded = (0, git_1.hasChangesToCommit)();
|
|
201
|
+
}
|
|
202
|
+
catch (err) {
|
|
203
|
+
logger.error(` Failed to read Git tree:\n${err.stderr}`);
|
|
204
|
+
return false;
|
|
205
|
+
}
|
|
206
|
+
if (!commitNeeded) {
|
|
207
|
+
logger.info(' No changes to commit after migration.');
|
|
208
|
+
return true;
|
|
209
|
+
}
|
|
210
|
+
// Commit changes and abort on error.
|
|
211
|
+
try {
|
|
212
|
+
(0, git_1.createCommit)(message);
|
|
213
|
+
}
|
|
214
|
+
catch (err) {
|
|
215
|
+
logger.error(`Failed to commit update (${message}):\n${err.stderr}`);
|
|
216
|
+
return false;
|
|
217
|
+
}
|
|
218
|
+
// Notify user of the commit.
|
|
219
|
+
const hash = (0, git_1.findCurrentGitSha)();
|
|
220
|
+
const shortMessage = message.split('\n')[0];
|
|
221
|
+
if (hash) {
|
|
222
|
+
logger.info(` Committed migration step (${(0, git_1.getShortHash)(hash)}): ${shortMessage}.`);
|
|
223
|
+
}
|
|
224
|
+
else {
|
|
225
|
+
// Commit was successful, but reading the hash was not. Something weird happened,
|
|
226
|
+
// but nothing that would stop the update. Just log the weirdness and continue.
|
|
227
|
+
logger.info(` Committed migration step: ${shortMessage}.`);
|
|
228
|
+
logger.warn(' Failed to look up hash of most recent commit, continuing anyways.');
|
|
229
|
+
}
|
|
230
|
+
return true;
|
|
231
|
+
}
|
|
232
|
+
async function getOptionalMigrationsToRun(logger, optionalMigrations, packageName) {
|
|
233
|
+
const numberOfMigrations = optionalMigrations.length;
|
|
234
|
+
logger.info(`This package has ${numberOfMigrations} optional migration${numberOfMigrations > 1 ? 's' : ''} that can be executed.`);
|
|
235
|
+
if (!(0, tty_1.isTTY)()) {
|
|
236
|
+
for (const migration of optionalMigrations) {
|
|
237
|
+
const { title } = getMigrationTitleAndDescription(migration);
|
|
238
|
+
logger.info(color_1.colors.cyan(color_1.figures.pointer) + ' ' + color_1.colors.bold(title));
|
|
239
|
+
logger.info(color_1.colors.gray(` ng update ${packageName} --name ${migration.name}`));
|
|
240
|
+
logger.info(''); // Extra trailing newline.
|
|
241
|
+
}
|
|
242
|
+
return undefined;
|
|
243
|
+
}
|
|
244
|
+
logger.info('Optional migrations may be skipped and executed after the update process, if preferred.');
|
|
245
|
+
logger.info(''); // Extra trailing newline.
|
|
246
|
+
const answer = await (0, prompt_1.askChoices)(`Select the migrations that you'd like to run`, optionalMigrations.map((migration) => {
|
|
247
|
+
const { title, documentation } = getMigrationTitleAndDescription(migration);
|
|
248
|
+
return {
|
|
249
|
+
name: `[${color_1.colors.white(migration.name)}] ${title}${documentation ? ` (${documentation})` : ''}`,
|
|
250
|
+
value: migration.name,
|
|
251
|
+
checked: migration.recommended,
|
|
252
|
+
};
|
|
253
|
+
}), null);
|
|
254
|
+
logger.info(''); // Extra trailing newline.
|
|
255
|
+
return optionalMigrations.filter(({ name }) => answer?.includes(name));
|
|
256
|
+
}
|
|
257
|
+
function getMigrationTitleAndDescription(migration) {
|
|
258
|
+
const [title, ...description] = migration.description.split('. ');
|
|
259
|
+
return {
|
|
260
|
+
title: title.endsWith('.') ? title : title + '.',
|
|
261
|
+
description: description.join('.\n '),
|
|
262
|
+
documentation: migration.documentation
|
|
263
|
+
? new URL(migration.documentation, 'https://angular.dev').href
|
|
264
|
+
: undefined,
|
|
265
|
+
};
|
|
266
|
+
}
|
|
267
|
+
//# sourceMappingURL=migration.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"migration.js","sourceRoot":"","sources":["migration.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmCH,4CAqCC;AAKD,4CA0BC;AAKD,8CA8EC;AA6ED,sCAyCC;AA7SD,2DAAiG;AAOjG,+CAAiC;AACjC,8FAA4F;AAC5F,oDAA2D;AAC3D,oDAAyD;AACzD,0DAAkE;AAClE,0DAA0D;AAC1D,sDAAuD;AACvD,gDAA+C;AAC/C,+CAAoD;AACpD,+BAA0F;AAgBnF,KAAK,UAAU,gBAAgB,CACpC,QAAsB,EACtB,MAAsB,EACtB,UAAkB,EAClB,SAAiB,EACjB,UAAmC,EAAE;IAErC,MAAM,oBAAoB,GAAG,IAAA,wCAAmB,EAAC,QAAQ,EAAE,MAAM,CAAC,CAAC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;YAC/F,KAAK,EAAE,SAAS,CAAC,IAAI;YACrB,OAAO,EAAE,SAAS,CAAC,WAAW;SAC/B,CAAC;IACJ,CAAC,CAAC,EACF,IAAI,CACL,CAAC;IAEF,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC,0BAA0B;IAE3C,OAAO,kBAAkB,CAAC,MAAM,CAAC,CAAC,EAAE,IAAI,EAAE,EAAE,EAAE,CAAC,MAAM,EAAE,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC;AACzE,CAAC;AAED,SAAS,+BAA+B,CAAC,SAAwC;IAK/E,MAAM,CAAC,KAAK,EAAE,GAAG,WAAW,CAAC,GAAG,SAAS,CAAC,WAAW,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IAElE,OAAO;QACL,KAAK,EAAE,KAAK,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,GAAG,GAAG;QAChD,WAAW,EAAE,WAAW,CAAC,IAAI,CAAC,OAAO,CAAC;QACtC,aAAa,EAAE,SAAS,CAAC,aAAa;YACpC,CAAC,CAAC,IAAI,GAAG,CAAC,SAAS,CAAC,aAAa,EAAE,qBAAqB,CAAC,CAAC,IAAI;YAC9D,CAAC,CAAC,SAAS;KACd,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,36 @@
|
|
|
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 { Argv } from 'yargs';
|
|
9
|
+
import { CommandModule, CommandModuleImplementation } from '../../command-builder/command-module';
|
|
10
|
+
/**
|
|
11
|
+
* The command-line module for the `ng version` command.
|
|
12
|
+
*/
|
|
13
|
+
export default class VersionCommandModule extends CommandModule implements CommandModuleImplementation {
|
|
14
|
+
command: string;
|
|
15
|
+
aliases: string[] | undefined;
|
|
16
|
+
describe: string;
|
|
17
|
+
longDescriptionPath?: string | undefined;
|
|
18
|
+
/**
|
|
19
|
+
* Builds the command-line options for the `ng version` command.
|
|
20
|
+
* @param localYargs The `yargs` instance to configure.
|
|
21
|
+
* @returns The configured `yargs` instance.
|
|
22
|
+
*/
|
|
23
|
+
builder(localYargs: Argv): Argv;
|
|
24
|
+
/**
|
|
25
|
+
* The main execution logic for the `ng version` command.
|
|
26
|
+
*/
|
|
27
|
+
run(options: {
|
|
28
|
+
json?: boolean;
|
|
29
|
+
}): Promise<void>;
|
|
30
|
+
/**
|
|
31
|
+
* Formats the package table section of the version output.
|
|
32
|
+
* @param versions A map of package names to their versions.
|
|
33
|
+
* @returns A string containing the formatted package table.
|
|
34
|
+
*/
|
|
35
|
+
private formatPackageTable;
|
|
36
|
+
}
|
|
@@ -0,0 +1,117 @@
|
|
|
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
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
const command_module_1 = require("../../command-builder/command-module");
|
|
11
|
+
const color_1 = require("../../utilities/color");
|
|
12
|
+
const command_config_1 = require("../command-config");
|
|
13
|
+
const version_info_1 = require("./version-info");
|
|
14
|
+
/**
|
|
15
|
+
* The Angular CLI logo, displayed as ASCII art.
|
|
16
|
+
*/
|
|
17
|
+
const ASCII_ART = `
|
|
18
|
+
_ _ ____ _ ___
|
|
19
|
+
/ \\ _ __ __ _ _ _| | __ _ _ __ / ___| | |_ _|
|
|
20
|
+
/ △ \\ | '_ \\ / _\` | | | | |/ _\` | '__| | | | | | |
|
|
21
|
+
/ ___ \\| | | | (_| | |_| | | (_| | | | |___| |___ | |
|
|
22
|
+
/_/ \\_\\_| |_|\\__, |\\__,_|_|\\__,_|_| \\____|_____|___|
|
|
23
|
+
|___/
|
|
24
|
+
`
|
|
25
|
+
.split('\n')
|
|
26
|
+
.map((x) => color_1.colors.red(x))
|
|
27
|
+
.join('\n');
|
|
28
|
+
/**
|
|
29
|
+
* The command-line module for the `ng version` command.
|
|
30
|
+
*/
|
|
31
|
+
class VersionCommandModule extends command_module_1.CommandModule {
|
|
32
|
+
command = 'version';
|
|
33
|
+
aliases = command_config_1.RootCommands['version'].aliases;
|
|
34
|
+
describe = 'Outputs Angular CLI version.';
|
|
35
|
+
longDescriptionPath;
|
|
36
|
+
/**
|
|
37
|
+
* Builds the command-line options for the `ng version` command.
|
|
38
|
+
* @param localYargs The `yargs` instance to configure.
|
|
39
|
+
* @returns The configured `yargs` instance.
|
|
40
|
+
*/
|
|
41
|
+
builder(localYargs) {
|
|
42
|
+
return localYargs.option('json', {
|
|
43
|
+
describe: 'Outputs version information in JSON format.',
|
|
44
|
+
type: 'boolean',
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* The main execution logic for the `ng version` command.
|
|
49
|
+
*/
|
|
50
|
+
async run(options) {
|
|
51
|
+
const { logger } = this.context;
|
|
52
|
+
const versionInfo = await (0, version_info_1.gatherVersionInfo)(this.context);
|
|
53
|
+
if (options.json) {
|
|
54
|
+
// eslint-disable-next-line no-console
|
|
55
|
+
console.log(JSON.stringify(versionInfo, null, 2));
|
|
56
|
+
return;
|
|
57
|
+
}
|
|
58
|
+
const { cli: { version: ngCliVersion }, framework, system: { node: { version: nodeVersion, unsupported: unsupportedNodeVersion }, os: { platform: os, architecture: arch }, packageManager: { name: packageManagerName, version: packageManagerVersion }, }, packages, } = versionInfo;
|
|
59
|
+
const headerInfo = [{ label: 'Angular CLI', value: ngCliVersion }];
|
|
60
|
+
if (framework.version) {
|
|
61
|
+
headerInfo.push({ label: 'Angular', value: framework.version });
|
|
62
|
+
}
|
|
63
|
+
headerInfo.push({
|
|
64
|
+
label: 'Node.js',
|
|
65
|
+
value: `${nodeVersion}${unsupportedNodeVersion ? color_1.colors.yellow(' (Unsupported)') : ''}`,
|
|
66
|
+
}, {
|
|
67
|
+
label: 'Package Manager',
|
|
68
|
+
value: `${packageManagerName} ${packageManagerVersion ?? '<error>'}`,
|
|
69
|
+
}, { label: 'Operating System', value: `${os} ${arch}` });
|
|
70
|
+
const maxHeaderLabelLength = Math.max(...headerInfo.map((l) => l.label.length));
|
|
71
|
+
const header = headerInfo
|
|
72
|
+
.map(({ label, value }) => color_1.colors.bold(label.padEnd(maxHeaderLabelLength + 2)) + `: ${color_1.colors.cyan(value)}`)
|
|
73
|
+
.join('\n');
|
|
74
|
+
const packageTable = this.formatPackageTable(packages);
|
|
75
|
+
logger.info([ASCII_ART, header, packageTable].join('\n\n'));
|
|
76
|
+
if (unsupportedNodeVersion) {
|
|
77
|
+
logger.warn(`Warning: The current version of Node (${nodeVersion}) is not supported by Angular.`);
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Formats the package table section of the version output.
|
|
82
|
+
* @param versions A map of package names to their versions.
|
|
83
|
+
* @returns A string containing the formatted package table.
|
|
84
|
+
*/
|
|
85
|
+
formatPackageTable(versions) {
|
|
86
|
+
const versionKeys = Object.keys(versions);
|
|
87
|
+
if (versionKeys.length === 0) {
|
|
88
|
+
return '';
|
|
89
|
+
}
|
|
90
|
+
const headers = {
|
|
91
|
+
name: 'Package',
|
|
92
|
+
installed: 'Installed Version',
|
|
93
|
+
requested: 'Requested Version',
|
|
94
|
+
};
|
|
95
|
+
const maxNameLength = Math.max(headers.name.length, ...versionKeys.map((key) => key.length));
|
|
96
|
+
const maxInstalledLength = Math.max(headers.installed.length, ...versionKeys.map((key) => versions[key].installed.length));
|
|
97
|
+
const maxRequestedLength = Math.max(headers.requested.length, ...versionKeys.map((key) => versions[key].requested.length));
|
|
98
|
+
const tableRows = versionKeys
|
|
99
|
+
.map((module) => {
|
|
100
|
+
const { requested, installed } = versions[module];
|
|
101
|
+
const name = module.padEnd(maxNameLength);
|
|
102
|
+
const coloredInstalled = installed === '<error>' ? color_1.colors.red(installed) : color_1.colors.cyan(installed);
|
|
103
|
+
const installedPadding = ' '.repeat(maxInstalledLength - installed.length);
|
|
104
|
+
return `│ ${name} │ ${coloredInstalled}${installedPadding} │ ${requested.padEnd(maxRequestedLength)} │`;
|
|
105
|
+
})
|
|
106
|
+
.sort();
|
|
107
|
+
const top = `┌─${'─'.repeat(maxNameLength)}─┬─${'─'.repeat(maxInstalledLength)}─┬─${'─'.repeat(maxRequestedLength)}─┐`;
|
|
108
|
+
const header = `│ ${headers.name.padEnd(maxNameLength)} │ ` +
|
|
109
|
+
`${headers.installed.padEnd(maxInstalledLength)} │ ` +
|
|
110
|
+
`${headers.requested.padEnd(maxRequestedLength)} │`;
|
|
111
|
+
const separator = `├─${'─'.repeat(maxNameLength)}─┼─${'─'.repeat(maxInstalledLength)}─┼─${'─'.repeat(maxRequestedLength)}─┤`;
|
|
112
|
+
const bottom = `└─${'─'.repeat(maxNameLength)}─┴─${'─'.repeat(maxInstalledLength)}─┴─${'─'.repeat(maxRequestedLength)}─┘`;
|
|
113
|
+
return [top, header, separator, ...tableRows, bottom].join('\n');
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
exports.default = VersionCommandModule;
|
|
117
|
+
//# sourceMappingURL=cli.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli.js","sourceRoot":"","sources":["cli.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;AAGH,yEAAkG;AAClG,iDAA+C;AAC/C,sDAAiD;AACjD,iDAAuE;AAEvE;;GAEG;AACH,MAAM,SAAS,GAAG;;;;;;;KAOb;KACF,KAAK,CAAC,IAAI,CAAC;KACX,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,cAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;KACzB,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