@angular/cli 22.2.0 → 22.3.0-next.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/ng.js +7 -10
- package/bin/version.js +98 -0
- package/index.d.ts +19 -0
- package/lib/chunk-5AASRQKS.js +85 -0
- package/lib/chunk-A2VIYA2E.js +165 -0
- package/lib/chunk-CAZUOCTC.js +225 -0
- package/lib/chunk-DHWVZMLH.js +206 -0
- package/lib/chunk-FZ5GFCWU.js +483 -0
- package/lib/chunk-G7TRU43D.js +42 -0
- package/lib/chunk-GHUUJYOY.js +40 -0
- package/lib/chunk-JBLF2TH3.js +267 -0
- package/lib/chunk-Q67GOPL7.js +380 -0
- package/lib/chunk-SN4KY4Z3.js +24 -0
- package/lib/chunk-XFL2J3CJ.js +24 -0
- package/lib/chunk-XG3HVNIL.js +59 -0
- package/lib/chunk-YM7ILCS5.js +2573 -0
- package/lib/cli/index.js +353 -105
- package/lib/cli-4CMZ6KMR.js +48 -0
- package/lib/cli-4Q7DGTBA.js +33 -0
- package/lib/cli-6AHY7ADW.js +96 -0
- package/lib/cli-A5UAJDO6.js +135 -0
- package/lib/cli-ACLGUIBI.js +2531 -0
- package/lib/cli-BQRFWIMG.js +35 -0
- package/lib/cli-CWICUPZW.js +42 -0
- package/lib/cli-DWQUM3M2.js +29 -0
- package/lib/cli-L4TM4JH3.js +88 -0
- package/lib/cli-LYBZEMDR.js +96 -0
- package/lib/cli-PDCEX7HQ.js +605 -0
- package/lib/cli-PJVTDBQM.js +51 -0
- package/lib/cli-PRIRL3WP.js +185 -0
- package/lib/cli-PU5VH7JB.js +189 -0
- package/lib/cli-QUH44NUB.js +68 -0
- package/lib/cli-VVITNTBC.js +50 -0
- package/lib/cli-XM4L4PP4.js +1651 -0
- package/lib/cli-Y2ECUR33.js +33 -0
- package/lib/cli-YDSMJOSO.js +182 -0
- package/lib/color-SJPGXZVA.js +8 -0
- package/lib/config/schema.json +210 -6
- package/lib/config-QXK7SSVG.js +22 -0
- package/lib/init.js +91 -180
- package/package.json +20 -15
- package/lib/cli/index.d.ts +0 -11
- package/lib/cli/index.js.map +0 -1
- package/lib/config/workspace-schema.d.ts +0 -1025
- package/lib/config/workspace-schema.js +0 -131
- package/lib/config/workspace-schema.js.map +0 -1
- package/lib/init.d.ts +0 -8
- package/lib/init.js.map +0 -1
- package/src/analytics/analytics-collector.d.ts +0 -35
- package/src/analytics/analytics-collector.js +0 -195
- package/src/analytics/analytics-collector.js.map +0 -1
- package/src/analytics/analytics-parameters.d.ts +0 -101
- package/src/analytics/analytics-parameters.js +0 -107
- package/src/analytics/analytics-parameters.js.map +0 -1
- package/src/analytics/analytics.d.ts +0 -27
- package/src/analytics/analytics.js +0 -183
- package/src/analytics/analytics.js.map +0 -1
- package/src/command-builder/architect-base-command-module.d.ts +0 -30
- package/src/command-builder/architect-base-command-module.js +0 -244
- package/src/command-builder/architect-base-command-module.js.map +0 -1
- package/src/command-builder/architect-command-module.d.ts +0 -28
- package/src/command-builder/architect-command-module.js +0 -218
- package/src/command-builder/architect-command-module.js.map +0 -1
- package/src/command-builder/command-module.d.ts +0 -73
- package/src/command-builder/command-module.js +0 -260
- package/src/command-builder/command-module.js.map +0 -1
- package/src/command-builder/command-runner.d.ts +0 -9
- package/src/command-builder/command-runner.js +0 -202
- package/src/command-builder/command-runner.js.map +0 -1
- package/src/command-builder/definitions.d.ts +0 -41
- package/src/command-builder/definitions.js +0 -20
- package/src/command-builder/definitions.js.map +0 -1
- package/src/command-builder/schematics-command-module.d.ts +0 -41
- package/src/command-builder/schematics-command-module.js +0 -408
- package/src/command-builder/schematics-command-module.js.map +0 -1
- package/src/command-builder/utilities/command.d.ts +0 -13
- package/src/command-builder/utilities/command.js +0 -39
- package/src/command-builder/utilities/command.js.map +0 -1
- package/src/command-builder/utilities/json-help.d.ts +0 -37
- package/src/command-builder/utilities/json-help.js +0 -92
- package/src/command-builder/utilities/json-help.js.map +0 -1
- package/src/command-builder/utilities/json-schema.d.ts +0 -64
- package/src/command-builder/utilities/json-schema.js +0 -349
- package/src/command-builder/utilities/json-schema.js.map +0 -1
- package/src/command-builder/utilities/normalize-options-middleware.d.ts +0 -18
- package/src/command-builder/utilities/normalize-options-middleware.js +0 -37
- package/src/command-builder/utilities/normalize-options-middleware.js.map +0 -1
- package/src/command-builder/utilities/schematic-engine-host.d.ts +0 -15
- package/src/command-builder/utilities/schematic-engine-host.js +0 -179
- package/src/command-builder/utilities/schematic-engine-host.js.map +0 -1
- package/src/command-builder/utilities/schematic-workflow.d.ts +0 -14
- package/src/command-builder/utilities/schematic-workflow.js +0 -70
- package/src/command-builder/utilities/schematic-workflow.js.map +0 -1
- package/src/commands/add/cli.d.ts +0 -41
- package/src/commands/add/cli.js +0 -705
- package/src/commands/add/cli.js.map +0 -1
- package/src/commands/add/long-description.md +0 -7
- package/src/commands/analytics/cli.d.ts +0 -16
- package/src/commands/analytics/cli.js +0 -34
- package/src/commands/analytics/cli.js.map +0 -1
- package/src/commands/analytics/info/cli.d.ts +0 -16
- package/src/commands/analytics/info/cli.js +0 -25
- package/src/commands/analytics/info/cli.js.map +0 -1
- package/src/commands/analytics/long-description.md +0 -20
- package/src/commands/analytics/settings/cli.d.ts +0 -35
- package/src/commands/analytics/settings/cli.js +0 -54
- package/src/commands/analytics/settings/cli.js.map +0 -1
- package/src/commands/build/cli.d.ts +0 -16
- package/src/commands/build/cli.js +0 -21
- package/src/commands/build/cli.js.map +0 -1
- package/src/commands/build/long-description.md +0 -18
- package/src/commands/cache/clean/cli.d.ts +0 -17
- package/src/commands/cache/clean/cli.js +0 -32
- package/src/commands/cache/clean/cli.js.map +0 -1
- package/src/commands/cache/cli.d.ts +0 -17
- package/src/commands/cache/cli.js +0 -36
- package/src/commands/cache/cli.js.map +0 -1
- package/src/commands/cache/info/cli.d.ts +0 -20
- package/src/commands/cache/info/cli.js +0 -139
- package/src/commands/cache/info/cli.js.map +0 -1
- package/src/commands/cache/long-description.md +0 -53
- package/src/commands/cache/settings/cli.d.ts +0 -27
- package/src/commands/cache/settings/cli.js +0 -41
- package/src/commands/cache/settings/cli.js.map +0 -1
- package/src/commands/cache/utilities.d.ts +0 -11
- package/src/commands/cache/utilities.js +0 -85
- package/src/commands/cache/utilities.js.map +0 -1
- package/src/commands/command-config.d.ts +0 -17
- package/src/commands/command-config.js +0 -116
- package/src/commands/command-config.js.map +0 -1
- package/src/commands/completion/cli.d.ts +0 -16
- package/src/commands/completion/cli.js +0 -61
- package/src/commands/completion/cli.js.map +0 -1
- package/src/commands/completion/long-description.md +0 -67
- package/src/commands/config/cli.d.ts +0 -24
- package/src/commands/config/cli.js +0 -150
- package/src/commands/config/cli.js.map +0 -1
- package/src/commands/config/long-description.md +0 -13
- package/src/commands/deploy/cli.d.ts +0 -17
- package/src/commands/deploy/cli.js +0 -38
- package/src/commands/deploy/cli.js.map +0 -1
- package/src/commands/deploy/long-description.md +0 -22
- package/src/commands/e2e/cli.d.ts +0 -18
- package/src/commands/e2e/cli.js +0 -42
- package/src/commands/e2e/cli.js.map +0 -1
- package/src/commands/extract-i18n/cli.d.ts +0 -17
- package/src/commands/extract-i18n/cli.js +0 -48
- package/src/commands/extract-i18n/cli.js.map +0 -1
- package/src/commands/generate/cli.d.ts +0 -47
- package/src/commands/generate/cli.js +0 -189
- package/src/commands/generate/cli.js.map +0 -1
- package/src/commands/lint/cli.d.ts +0 -17
- package/src/commands/lint/cli.js +0 -25
- package/src/commands/lint/cli.js.map +0 -1
- package/src/commands/lint/long-description.md +0 -20
- package/src/commands/make-this-awesome/cli.d.ts +0 -17
- package/src/commands/make-this-awesome/cli.js +0 -36
- package/src/commands/make-this-awesome/cli.js.map +0 -1
- package/src/commands/mcp/cli.d.ts +0 -21
- package/src/commands/mcp/cli.js +0 -74
- package/src/commands/mcp/cli.js.map +0 -1
- package/src/commands/mcp/constants.d.ts +0 -10
- package/src/commands/mcp/constants.js +0 -16
- package/src/commands/mcp/constants.js.map +0 -1
- package/src/commands/mcp/devserver.d.ts +0 -85
- package/src/commands/mcp/devserver.js +0 -109
- package/src/commands/mcp/devserver.js.map +0 -1
- package/src/commands/mcp/host.d.ts +0 -103
- package/src/commands/mcp/host.js +0 -270
- package/src/commands/mcp/host.js.map +0 -1
- package/src/commands/mcp/mcp-server.d.ts +0 -38
- package/src/commands/mcp/mcp-server.js +0 -176
- package/src/commands/mcp/mcp-server.js.map +0 -1
- package/src/commands/mcp/resources/ai-tutor.md +0 -822
- package/src/commands/mcp/resources/best-practices.md +0 -59
- package/src/commands/mcp/resources/instructions.d.ts +0 -9
- package/src/commands/mcp/resources/instructions.js +0 -26
- package/src/commands/mcp/resources/instructions.js.map +0 -1
- package/src/commands/mcp/shared-options.d.ts +0 -12
- package/src/commands/mcp/shared-options.js +0 -22
- package/src/commands/mcp/shared-options.js.map +0 -1
- package/src/commands/mcp/tools/ai-tutor.d.ts +0 -12
- package/src/commands/mcp/tools/ai-tutor.js +0 -59
- package/src/commands/mcp/tools/ai-tutor.js.map +0 -1
- package/src/commands/mcp/tools/best-practices.d.ts +0 -13
- package/src/commands/mcp/tools/best-practices.js +0 -196
- package/src/commands/mcp/tools/best-practices.js.map +0 -1
- package/src/commands/mcp/tools/devserver/devserver-start.d.ts +0 -32
- package/src/commands/mcp/tools/devserver/devserver-start.js +0 -110
- package/src/commands/mcp/tools/devserver/devserver-start.js.map +0 -1
- package/src/commands/mcp/tools/devserver/devserver-stop.d.ts +0 -31
- package/src/commands/mcp/tools/devserver/devserver-stop.js +0 -69
- package/src/commands/mcp/tools/devserver/devserver-stop.js.map +0 -1
- package/src/commands/mcp/tools/devserver/devserver-wait-for-build.d.ts +0 -41
- package/src/commands/mcp/tools/devserver/devserver-wait-for-build.js +0 -105
- package/src/commands/mcp/tools/devserver/devserver-wait-for-build.js.map +0 -1
- package/src/commands/mcp/tools/doc-search.d.ts +0 -21
- package/src/commands/mcp/tools/doc-search.js +0 -307
- package/src/commands/mcp/tools/doc-search.js.map +0 -1
- package/src/commands/mcp/tools/onpush-zoneless-migration/analyze-for-unsupported-zone-uses.d.ts +0 -17
- package/src/commands/mcp/tools/onpush-zoneless-migration/analyze-for-unsupported-zone-uses.js +0 -62
- package/src/commands/mcp/tools/onpush-zoneless-migration/analyze-for-unsupported-zone-uses.js.map +0 -1
- package/src/commands/mcp/tools/onpush-zoneless-migration/migrate-single-file.d.ts +0 -12
- package/src/commands/mcp/tools/onpush-zoneless-migration/migrate-single-file.js +0 -70
- package/src/commands/mcp/tools/onpush-zoneless-migration/migrate-single-file.js.map +0 -1
- package/src/commands/mcp/tools/onpush-zoneless-migration/migrate-test-file.d.ts +0 -12
- package/src/commands/mcp/tools/onpush-zoneless-migration/migrate-test-file.js +0 -60
- package/src/commands/mcp/tools/onpush-zoneless-migration/migrate-test-file.js.map +0 -1
- package/src/commands/mcp/tools/onpush-zoneless-migration/prompts.d.ts +0 -15
- package/src/commands/mcp/tools/onpush-zoneless-migration/prompts.js +0 -238
- package/src/commands/mcp/tools/onpush-zoneless-migration/prompts.js.map +0 -1
- package/src/commands/mcp/tools/onpush-zoneless-migration/send-debug-message.d.ts +0 -9
- package/src/commands/mcp/tools/onpush-zoneless-migration/send-debug-message.js +0 -14
- package/src/commands/mcp/tools/onpush-zoneless-migration/send-debug-message.js.map +0 -1
- package/src/commands/mcp/tools/onpush-zoneless-migration/ts-utils.d.ts +0 -36
- package/src/commands/mcp/tools/onpush-zoneless-migration/ts-utils.js +0 -135
- package/src/commands/mcp/tools/onpush-zoneless-migration/ts-utils.js.map +0 -1
- package/src/commands/mcp/tools/onpush-zoneless-migration/types.d.ts +0 -13
- package/src/commands/mcp/tools/onpush-zoneless-migration/types.js +0 -10
- package/src/commands/mcp/tools/onpush-zoneless-migration/types.js.map +0 -1
- package/src/commands/mcp/tools/onpush-zoneless-migration/zoneless-migration.d.ts +0 -16
- package/src/commands/mcp/tools/onpush-zoneless-migration/zoneless-migration.js +0 -211
- package/src/commands/mcp/tools/onpush-zoneless-migration/zoneless-migration.js.map +0 -1
- package/src/commands/mcp/tools/projects.d.ts +0 -48
- package/src/commands/mcp/tools/projects.js +0 -541
- package/src/commands/mcp/tools/projects.js.map +0 -1
- package/src/commands/mcp/tools/run-target/build-target-strategy.d.ts +0 -14
- package/src/commands/mcp/tools/run-target/build-target-strategy.js +0 -53
- package/src/commands/mcp/tools/run-target/build-target-strategy.js.map +0 -1
- package/src/commands/mcp/tools/run-target/generic-target-strategy.d.ts +0 -14
- package/src/commands/mcp/tools/run-target/generic-target-strategy.js +0 -63
- package/src/commands/mcp/tools/run-target/generic-target-strategy.js.map +0 -1
- package/src/commands/mcp/tools/run-target/options-serializer.d.ts +0 -13
- package/src/commands/mcp/tools/run-target/options-serializer.js +0 -41
- package/src/commands/mcp/tools/run-target/options-serializer.js.map +0 -1
- package/src/commands/mcp/tools/run-target/run-target.d.ts +0 -34
- package/src/commands/mcp/tools/run-target/run-target.js +0 -69
- package/src/commands/mcp/tools/run-target/run-target.js.map +0 -1
- package/src/commands/mcp/tools/run-target/strategy.d.ts +0 -15
- package/src/commands/mcp/tools/run-target/strategy.js +0 -10
- package/src/commands/mcp/tools/run-target/strategy.js.map +0 -1
- package/src/commands/mcp/tools/run-target/types.d.ts +0 -39
- package/src/commands/mcp/tools/run-target/types.js +0 -41
- package/src/commands/mcp/tools/run-target/types.js.map +0 -1
- package/src/commands/mcp/tools/run-target/unit-test-strategy.d.ts +0 -14
- package/src/commands/mcp/tools/run-target/unit-test-strategy.js +0 -56
- package/src/commands/mcp/tools/run-target/unit-test-strategy.js.map +0 -1
- package/src/commands/mcp/tools/tool-registry.d.ts +0 -40
- package/src/commands/mcp/tools/tool-registry.js +0 -40
- package/src/commands/mcp/tools/tool-registry.js.map +0 -1
- package/src/commands/mcp/utils.d.ts +0 -25
- package/src/commands/mcp/utils.js +0 -44
- package/src/commands/mcp/utils.js.map +0 -1
- package/src/commands/mcp/workspace-utils.d.ts +0 -55
- package/src/commands/mcp/workspace-utils.js +0 -181
- package/src/commands/mcp/workspace-utils.js.map +0 -1
- package/src/commands/new/cli.d.ts +0 -27
- package/src/commands/new/cli.js +0 -76
- package/src/commands/new/cli.js.map +0 -1
- package/src/commands/new/long-description.md +0 -15
- package/src/commands/run/cli.d.ts +0 -25
- package/src/commands/run/cli.js +0 -89
- package/src/commands/run/cli.js.map +0 -1
- package/src/commands/run/long-description.md +0 -10
- package/src/commands/serve/cli.d.ts +0 -16
- package/src/commands/serve/cli.js +0 -20
- package/src/commands/serve/cli.js.map +0 -1
- package/src/commands/test/cli.d.ts +0 -16
- package/src/commands/test/cli.js +0 -21
- package/src/commands/test/cli.js.map +0 -1
- package/src/commands/test/long-description.md +0 -2
- package/src/commands/update/cli.d.ts +0 -50
- package/src/commands/update/cli.js +0 -586
- package/src/commands/update/cli.js.map +0 -1
- package/src/commands/update/long-description.md +0 -22
- package/src/commands/update/update-resolver.d.ts +0 -75
- package/src/commands/update/update-resolver.js +0 -918
- package/src/commands/update/update-resolver.js.map +0 -1
- package/src/commands/update/utilities/cli-version.d.ts +0 -48
- package/src/commands/update/utilities/cli-version.js +0 -196
- package/src/commands/update/utilities/cli-version.js.map +0 -1
- package/src/commands/update/utilities/constants.d.ts +0 -12
- package/src/commands/update/utilities/constants.js +0 -16
- package/src/commands/update/utilities/constants.js.map +0 -1
- package/src/commands/update/utilities/git.d.ts +0 -36
- package/src/commands/update/utilities/git.js +0 -148
- package/src/commands/update/utilities/git.js.map +0 -1
- package/src/commands/update/utilities/migration.d.ts +0 -32
- package/src/commands/update/utilities/migration.js +0 -271
- package/src/commands/update/utilities/migration.js.map +0 -1
- package/src/commands/version/cli.d.ts +0 -36
- package/src/commands/version/cli.js +0 -117
- package/src/commands/version/cli.js.map +0 -1
- package/src/commands/version/version-info.d.ts +0 -46
- package/src/commands/version/version-info.js +0 -101
- package/src/commands/version/version-info.js.map +0 -1
- package/src/package-managers/discovery.d.ts +0 -23
- package/src/package-managers/discovery.js +0 -104
- package/src/package-managers/discovery.js.map +0 -1
- package/src/package-managers/error.d.ts +0 -43
- package/src/package-managers/error.js +0 -41
- package/src/package-managers/error.js.map +0 -1
- package/src/package-managers/factory.d.ts +0 -30
- package/src/package-managers/factory.js +0 -137
- package/src/package-managers/factory.js.map +0 -1
- package/src/package-managers/host.d.ts +0 -86
- package/src/package-managers/host.js +0 -91
- package/src/package-managers/host.js.map +0 -1
- package/src/package-managers/index.d.ts +0 -13
- package/src/package-managers/index.js +0 -17
- package/src/package-managers/index.js.map +0 -1
- package/src/package-managers/logger.d.ts +0 -27
- package/src/package-managers/logger.js +0 -10
- package/src/package-managers/logger.js.map +0 -1
- package/src/package-managers/package-manager-descriptor.d.ts +0 -269
- package/src/package-managers/package-manager-descriptor.js +0 -210
- package/src/package-managers/package-manager-descriptor.js.map +0 -1
- package/src/package-managers/package-manager.d.ts +0 -200
- package/src/package-managers/package-manager.js +0 -720
- package/src/package-managers/package-manager.js.map +0 -1
- package/src/package-managers/package-metadata.d.ts +0 -91
- package/src/package-managers/package-metadata.js +0 -10
- package/src/package-managers/package-metadata.js.map +0 -1
- package/src/package-managers/package-tree.d.ts +0 -23
- package/src/package-managers/package-tree.js +0 -10
- package/src/package-managers/package-tree.js.map +0 -1
- package/src/package-managers/parsers.d.ts +0 -167
- package/src/package-managers/parsers.js +0 -674
- package/src/package-managers/parsers.js.map +0 -1
- package/src/utilities/color.d.ts +0 -23
- package/src/utilities/color.js +0 -41
- package/src/utilities/color.js.map +0 -1
- package/src/utilities/completion.d.ts +0 -30
- package/src/utilities/completion.js +0 -270
- package/src/utilities/completion.js.map +0 -1
- package/src/utilities/config.d.ts +0 -38
- package/src/utilities/config.js +0 -368
- package/src/utilities/config.js.map +0 -1
- package/src/utilities/environment-options.d.ts +0 -25
- package/src/utilities/environment-options.js +0 -60
- package/src/utilities/environment-options.js.map +0 -1
- package/src/utilities/eol.d.ts +0 -20
- package/src/utilities/eol.js +0 -35
- package/src/utilities/eol.js.map +0 -1
- package/src/utilities/error.d.ts +0 -18
- package/src/utilities/error.js +0 -41
- package/src/utilities/error.js.map +0 -1
- package/src/utilities/find-up.d.ts +0 -21
- package/src/utilities/find-up.js +0 -67
- package/src/utilities/find-up.js.map +0 -1
- package/src/utilities/json-file.d.ts +0 -24
- package/src/utilities/json-file.js +0 -179
- package/src/utilities/json-file.js.map +0 -1
- package/src/utilities/log-file.d.ts +0 -13
- package/src/utilities/log-file.js +0 -28
- package/src/utilities/log-file.js.map +0 -1
- package/src/utilities/memoize.d.ts +0 -15
- package/src/utilities/memoize.js +0 -64
- package/src/utilities/memoize.js.map +0 -1
- package/src/utilities/node-version.d.ts +0 -21
- package/src/utilities/node-version.js +0 -65
- package/src/utilities/node-version.js.map +0 -1
- package/src/utilities/prettier.d.ts +0 -19
- package/src/utilities/prettier.js +0 -105
- package/src/utilities/prettier.js.map +0 -1
- package/src/utilities/project.d.ts +0 -8
- package/src/utilities/project.js +0 -81
- package/src/utilities/project.js.map +0 -1
- package/src/utilities/prompt.d.ts +0 -17
- package/src/utilities/prompt.js +0 -90
- package/src/utilities/prompt.js.map +0 -1
- package/src/utilities/tty.d.ts +0 -16
- package/src/utilities/tty.js +0 -23
- package/src/utilities/tty.js.map +0 -1
- package/src/utilities/version.d.ts +0 -16
- package/src/utilities/version.js +0 -26
- package/src/utilities/version.js.map +0 -1
|
@@ -0,0 +1,605 @@
|
|
|
1
|
+
import {
|
|
2
|
+
SchematicsCommandModule
|
|
3
|
+
} from "./chunk-Q67GOPL7.js";
|
|
4
|
+
import "./chunk-JBLF2TH3.js";
|
|
5
|
+
import {
|
|
6
|
+
CommandModuleError,
|
|
7
|
+
isTTY
|
|
8
|
+
} from "./chunk-YM7ILCS5.js";
|
|
9
|
+
import {
|
|
10
|
+
VERSION
|
|
11
|
+
} from "./chunk-XG3HVNIL.js";
|
|
12
|
+
import "./chunk-GHUUJYOY.js";
|
|
13
|
+
import {
|
|
14
|
+
assertIsError
|
|
15
|
+
} from "./chunk-FZ5GFCWU.js";
|
|
16
|
+
|
|
17
|
+
// packages/angular/cli/src/commands/add/cli.js
|
|
18
|
+
import { Listr, color, figures } from "listr2";
|
|
19
|
+
import assert from "node:assert";
|
|
20
|
+
import { existsSync } from "node:fs";
|
|
21
|
+
import fs from "node:fs/promises";
|
|
22
|
+
import { createRequire } from "node:module";
|
|
23
|
+
import { basename, dirname, join } from "node:path";
|
|
24
|
+
import npa from "npm-package-arg";
|
|
25
|
+
import semver, { compare, intersects, prerelease, satisfies, valid } from "semver";
|
|
26
|
+
|
|
27
|
+
// packages/angular/cli/src/commands/add/long-description.md
|
|
28
|
+
var long_description_default = "Adds the npm package for a published library to your workspace, and configures\nthe project in the current working directory to use that library, as specified by the library's schematic.\nFor example, adding `@angular/pwa` configures your project for PWA support:\n\n```bash\nng add @angular/pwa\n```\n";
|
|
29
|
+
|
|
30
|
+
// packages/angular/cli/src/commands/add/cli.js
|
|
31
|
+
var CommandError = class extends Error {
|
|
32
|
+
};
|
|
33
|
+
var packageVersionExclusions = {
|
|
34
|
+
// @angular/localize@9.x and earlier versions as well as @angular/localize@10.0 prereleases do not have peer dependencies setup.
|
|
35
|
+
"@angular/localize": "<10.0.0",
|
|
36
|
+
// @angular/material@7.x versions have unbounded peer dependency ranges (>=7.0.0).
|
|
37
|
+
"@angular/material": "7.x"
|
|
38
|
+
};
|
|
39
|
+
var DEFAULT_CONFLICT_DISPLAY_LIMIT = 5;
|
|
40
|
+
var BUILT_IN_SCHEMATICS = {
|
|
41
|
+
tailwindcss: {
|
|
42
|
+
collection: "@schematics/angular",
|
|
43
|
+
name: "tailwind"
|
|
44
|
+
},
|
|
45
|
+
"@vitest/browser-playwright": {
|
|
46
|
+
collection: "@schematics/angular",
|
|
47
|
+
name: "vitest-browser"
|
|
48
|
+
},
|
|
49
|
+
"@vitest/browser-webdriverio": {
|
|
50
|
+
collection: "@schematics/angular",
|
|
51
|
+
name: "vitest-browser"
|
|
52
|
+
},
|
|
53
|
+
"@vitest/browser-preview": {
|
|
54
|
+
collection: "@schematics/angular",
|
|
55
|
+
name: "vitest-browser"
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
var AddCommandModule = class extends SchematicsCommandModule {
|
|
59
|
+
command = "add <collection>";
|
|
60
|
+
describe = "Adds support for an external library to your project.";
|
|
61
|
+
longDescription = long_description_default;
|
|
62
|
+
allowPrivateSchematics = true;
|
|
63
|
+
schematicName = "ng-add";
|
|
64
|
+
rootRequire = createRequire(this.context.root + "/");
|
|
65
|
+
#projectVersionCache = /* @__PURE__ */ new Map();
|
|
66
|
+
#rootManifestCache = null;
|
|
67
|
+
async builder(argv) {
|
|
68
|
+
const localYargs = (await super.builder(argv)).positional("collection", {
|
|
69
|
+
description: "The package to be added.",
|
|
70
|
+
type: "string",
|
|
71
|
+
demandOption: true
|
|
72
|
+
}).option("registry", { description: "The NPM registry to use.", type: "string" }).option("verbose", {
|
|
73
|
+
description: "Display additional details about internal operations during execution.",
|
|
74
|
+
type: "boolean",
|
|
75
|
+
default: false
|
|
76
|
+
}).option("skip-confirmation", {
|
|
77
|
+
description: "Skip asking a confirmation prompt before installing and executing the package. Ensure package name is correct prior to using this option.",
|
|
78
|
+
type: "boolean",
|
|
79
|
+
default: false
|
|
80
|
+
}).check(({ registry }) => {
|
|
81
|
+
if (registry === void 0) {
|
|
82
|
+
return true;
|
|
83
|
+
}
|
|
84
|
+
if (typeof registry === "string" && URL.canParse(registry)) {
|
|
85
|
+
return true;
|
|
86
|
+
}
|
|
87
|
+
throw new CommandModuleError("Option --registry must be a valid URL.");
|
|
88
|
+
}).strict(false);
|
|
89
|
+
const collectionName = this.getCollectionName();
|
|
90
|
+
if (!collectionName) {
|
|
91
|
+
return localYargs;
|
|
92
|
+
}
|
|
93
|
+
const workflow = this.getOrCreateWorkflowForBuilder(collectionName);
|
|
94
|
+
try {
|
|
95
|
+
const collection = workflow.engine.createCollection(collectionName);
|
|
96
|
+
const options = await this.getSchematicOptions(collection, this.schematicName, workflow);
|
|
97
|
+
return this.addSchemaOptionsToCommand(localYargs, options);
|
|
98
|
+
} catch (error) {
|
|
99
|
+
}
|
|
100
|
+
return localYargs;
|
|
101
|
+
}
|
|
102
|
+
async run(options) {
|
|
103
|
+
this.#projectVersionCache.clear();
|
|
104
|
+
this.#rootManifestCache = null;
|
|
105
|
+
const { logger } = this.context;
|
|
106
|
+
const { collection, skipConfirmation } = options;
|
|
107
|
+
let packageIdentifier;
|
|
108
|
+
try {
|
|
109
|
+
packageIdentifier = npa(collection);
|
|
110
|
+
} catch (e) {
|
|
111
|
+
assertIsError(e);
|
|
112
|
+
logger.error(e.message);
|
|
113
|
+
return 1;
|
|
114
|
+
}
|
|
115
|
+
if (packageIdentifier.name && packageIdentifier.registry && this.isPackageInstalled(packageIdentifier.name)) {
|
|
116
|
+
const validVersion = await this.isProjectVersionValid(packageIdentifier);
|
|
117
|
+
if (validVersion) {
|
|
118
|
+
logger.info("Skipping installation: Package already installed");
|
|
119
|
+
return this.executeSchematic({ ...options, collection: packageIdentifier.name });
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
const taskContext = {
|
|
123
|
+
packageIdentifier,
|
|
124
|
+
isExactVersion: packageIdentifier.type === "version",
|
|
125
|
+
executeSchematic: this.executeSchematic.bind(this),
|
|
126
|
+
getPeerDependencyConflicts: this.getPeerDependencyConflicts.bind(this),
|
|
127
|
+
dryRun: options.dryRun
|
|
128
|
+
};
|
|
129
|
+
const tasks = new Listr([
|
|
130
|
+
{
|
|
131
|
+
title: "Determining Package Manager",
|
|
132
|
+
task: (_context, task) => task.output = `Using package manager: ${color.dim(this.context.packageManager.name)}`,
|
|
133
|
+
rendererOptions: { persistentOutput: true }
|
|
134
|
+
},
|
|
135
|
+
{
|
|
136
|
+
title: "Searching for compatible package version",
|
|
137
|
+
enabled: packageIdentifier.type === "range" && packageIdentifier.rawSpec === "*",
|
|
138
|
+
task: (context, task) => this.findCompatiblePackageVersionTask(context, task, options),
|
|
139
|
+
rendererOptions: { persistentOutput: true }
|
|
140
|
+
},
|
|
141
|
+
{
|
|
142
|
+
title: "Loading package information",
|
|
143
|
+
task: (context, task) => this.loadPackageInfoTask(context, task, options),
|
|
144
|
+
rendererOptions: { persistentOutput: true }
|
|
145
|
+
},
|
|
146
|
+
{
|
|
147
|
+
title: "Confirming installation",
|
|
148
|
+
enabled: !skipConfirmation && !options.dryRun,
|
|
149
|
+
task: (context, task) => this.confirmInstallationTask(context, task),
|
|
150
|
+
rendererOptions: { persistentOutput: true }
|
|
151
|
+
},
|
|
152
|
+
{
|
|
153
|
+
title: "Installing package",
|
|
154
|
+
skip: (context) => {
|
|
155
|
+
if (context.dryRun) {
|
|
156
|
+
return `Skipping package installation. Would install package ${color.blue(context.packageIdentifier.toString())}.`;
|
|
157
|
+
}
|
|
158
|
+
return false;
|
|
159
|
+
},
|
|
160
|
+
task: (context, task) => this.installPackageTask(context, task, options),
|
|
161
|
+
rendererOptions: { bottomBar: Infinity }
|
|
162
|
+
}
|
|
163
|
+
// TODO: Rework schematic execution as a task and insert here
|
|
164
|
+
], {
|
|
165
|
+
/* options */
|
|
166
|
+
});
|
|
167
|
+
try {
|
|
168
|
+
const result = await tasks.run(taskContext);
|
|
169
|
+
assert(result.collectionName, "Collection name should always be available");
|
|
170
|
+
let shouldCleanUp = false;
|
|
171
|
+
if (!result.hasSchematics && !options.dryRun) {
|
|
172
|
+
const packageJsonPath = this.resolvePackageJson(result.collectionName);
|
|
173
|
+
if (packageJsonPath && existsSync(packageJsonPath)) {
|
|
174
|
+
try {
|
|
175
|
+
const localManifest = JSON.parse(await fs.readFile(packageJsonPath, "utf-8"));
|
|
176
|
+
if (localManifest.schematics) {
|
|
177
|
+
result.hasSchematics = true;
|
|
178
|
+
if (localManifest["ng-add"]?.save === false) {
|
|
179
|
+
shouldCleanUp = true;
|
|
180
|
+
}
|
|
181
|
+
} else {
|
|
182
|
+
await this.cleanUpTemporaryDependency(result.collectionName);
|
|
183
|
+
shouldCleanUp = false;
|
|
184
|
+
}
|
|
185
|
+
} catch {
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
if (result.hasSchematics && !options.dryRun) {
|
|
190
|
+
const workflow = this.getOrCreateWorkflowForBuilder(result.collectionName);
|
|
191
|
+
const collection2 = workflow.engine.createCollection(result.collectionName);
|
|
192
|
+
try {
|
|
193
|
+
collection2.createSchematic(this.schematicName, true);
|
|
194
|
+
} catch {
|
|
195
|
+
result.hasSchematics = false;
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
if (!result.hasSchematics) {
|
|
199
|
+
const packageName = result.packageIdentifier.name;
|
|
200
|
+
if (packageName) {
|
|
201
|
+
const builtInSchematic = BUILT_IN_SCHEMATICS[packageName];
|
|
202
|
+
if (builtInSchematic) {
|
|
203
|
+
logger.info(`The ${color.blue(packageName)} package does not provide \`ng add\` actions.`);
|
|
204
|
+
logger.info("The Angular CLI will use built-in actions to add it to your project.");
|
|
205
|
+
return this.executeSchematic({
|
|
206
|
+
...options,
|
|
207
|
+
collection: builtInSchematic.collection,
|
|
208
|
+
schematicName: builtInSchematic.name,
|
|
209
|
+
package: packageName
|
|
210
|
+
});
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
let message = options.dryRun ? "The package does not provide any `ng add` actions, so no further actions would be taken." : "Package installed successfully. The package does not provide any `ng add` actions, so no further actions were taken.";
|
|
214
|
+
if (result.homepage) {
|
|
215
|
+
message += `
|
|
216
|
+
For more information about this package, visit its homepage at ${result.homepage}`;
|
|
217
|
+
}
|
|
218
|
+
logger.info(message);
|
|
219
|
+
return;
|
|
220
|
+
}
|
|
221
|
+
if (options.dryRun) {
|
|
222
|
+
logger.info("The package's `ng add` actions would be executed next.");
|
|
223
|
+
return;
|
|
224
|
+
}
|
|
225
|
+
const schematicExitCode = await this.executeSchematic({
|
|
226
|
+
...options,
|
|
227
|
+
collection: result.collectionName
|
|
228
|
+
});
|
|
229
|
+
if (shouldCleanUp) {
|
|
230
|
+
await this.cleanUpTemporaryDependency(result.collectionName);
|
|
231
|
+
}
|
|
232
|
+
return schematicExitCode;
|
|
233
|
+
} catch (e) {
|
|
234
|
+
if (e instanceof CommandError) {
|
|
235
|
+
logger.error(e.message);
|
|
236
|
+
return 1;
|
|
237
|
+
}
|
|
238
|
+
throw e;
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
async findCompatiblePackageVersionTask(context, task, options) {
|
|
242
|
+
const { registry, verbose } = options;
|
|
243
|
+
const { packageIdentifier } = context;
|
|
244
|
+
const { packageManager } = this.context;
|
|
245
|
+
const packageName = packageIdentifier.name;
|
|
246
|
+
assert(packageName, "Registry package identifiers should always have a name.");
|
|
247
|
+
const rejectionReasons = [];
|
|
248
|
+
try {
|
|
249
|
+
const latestManifest = await packageManager.getManifest(`${packageName}@latest`, {
|
|
250
|
+
registry
|
|
251
|
+
});
|
|
252
|
+
if (latestManifest) {
|
|
253
|
+
const conflicts = await this.getPeerDependencyConflicts(latestManifest);
|
|
254
|
+
if (!conflicts) {
|
|
255
|
+
context.packageIdentifier = npa.resolve(latestManifest.name, latestManifest.version);
|
|
256
|
+
task.output = `Found compatible package version: ${color.blue(latestManifest.version)}.`;
|
|
257
|
+
return;
|
|
258
|
+
}
|
|
259
|
+
rejectionReasons.push(...conflicts);
|
|
260
|
+
}
|
|
261
|
+
} catch (e) {
|
|
262
|
+
assertIsError(e);
|
|
263
|
+
throw new CommandError(`Unable to load package information from registry: ${e.message}`);
|
|
264
|
+
}
|
|
265
|
+
task.output = "Could not find a compatible version with `latest`. Searching for a compatible version.";
|
|
266
|
+
let packageMetadata;
|
|
267
|
+
try {
|
|
268
|
+
packageMetadata = await packageManager.getRegistryMetadata(packageName, {
|
|
269
|
+
registry
|
|
270
|
+
});
|
|
271
|
+
} catch (e) {
|
|
272
|
+
assertIsError(e);
|
|
273
|
+
throw new CommandError(`Unable to load package information from registry: ${e.message}`);
|
|
274
|
+
}
|
|
275
|
+
if (!packageMetadata) {
|
|
276
|
+
throw new CommandError("Unable to load package information from registry.");
|
|
277
|
+
}
|
|
278
|
+
const allowPrereleases = !!prerelease(VERSION.full) || VERSION.full === "0.0.0";
|
|
279
|
+
const potentialVersions = this.#getPotentialVersions(packageMetadata, allowPrereleases);
|
|
280
|
+
const majorVersions = this.#getMajorVersions(potentialVersions);
|
|
281
|
+
let found = await this.#findCompatibleVersion(context, majorVersions, {
|
|
282
|
+
registry,
|
|
283
|
+
verbose,
|
|
284
|
+
rejectionReasons
|
|
285
|
+
});
|
|
286
|
+
if (!found) {
|
|
287
|
+
const checkedVersions = new Set(majorVersions);
|
|
288
|
+
const remainingVersions = potentialVersions.filter((v) => !checkedVersions.has(v));
|
|
289
|
+
found = await this.#findCompatibleVersion(context, remainingVersions, {
|
|
290
|
+
registry,
|
|
291
|
+
verbose,
|
|
292
|
+
rejectionReasons
|
|
293
|
+
});
|
|
294
|
+
}
|
|
295
|
+
if (!found) {
|
|
296
|
+
let message = `Unable to find compatible package.`;
|
|
297
|
+
if (rejectionReasons.length > 0) {
|
|
298
|
+
message += "\nThis is often because of incompatible peer dependencies.\nThese versions were rejected due to the following conflicts:\n" + rejectionReasons.slice(0, verbose ? void 0 : DEFAULT_CONFLICT_DISPLAY_LIMIT).map((r) => ` - ${r}`).join("\n");
|
|
299
|
+
}
|
|
300
|
+
task.output = message;
|
|
301
|
+
} else {
|
|
302
|
+
task.output = `Found compatible package version: ${color.blue(context.packageIdentifier.toString())}.`;
|
|
303
|
+
}
|
|
304
|
+
}
|
|
305
|
+
async #findCompatibleVersion(context, versions, options) {
|
|
306
|
+
const { packageIdentifier } = context;
|
|
307
|
+
const { packageManager } = this.context;
|
|
308
|
+
const { registry, verbose, rejectionReasons } = options;
|
|
309
|
+
const packageName = packageIdentifier.name;
|
|
310
|
+
assert(packageName, "Package name must be defined.");
|
|
311
|
+
for (const version of versions) {
|
|
312
|
+
const manifest = await packageManager.getManifest(`${packageName}@${version}`, {
|
|
313
|
+
registry
|
|
314
|
+
});
|
|
315
|
+
if (!manifest) {
|
|
316
|
+
continue;
|
|
317
|
+
}
|
|
318
|
+
const conflicts = await this.getPeerDependencyConflicts(manifest);
|
|
319
|
+
if (conflicts) {
|
|
320
|
+
if (verbose || rejectionReasons.length < DEFAULT_CONFLICT_DISPLAY_LIMIT) {
|
|
321
|
+
rejectionReasons.push(...conflicts);
|
|
322
|
+
}
|
|
323
|
+
continue;
|
|
324
|
+
}
|
|
325
|
+
context.packageIdentifier = npa.resolve(manifest.name, manifest.version);
|
|
326
|
+
return manifest;
|
|
327
|
+
}
|
|
328
|
+
return null;
|
|
329
|
+
}
|
|
330
|
+
#getPotentialVersions(packageMetadata, allowPrereleases) {
|
|
331
|
+
const versionExclusions = packageVersionExclusions[packageMetadata.name];
|
|
332
|
+
const latestVersion = packageMetadata["dist-tags"]["latest"];
|
|
333
|
+
const versions = Object.values(packageMetadata.versions).filter((version) => {
|
|
334
|
+
if (latestVersion && version === latestVersion) {
|
|
335
|
+
return false;
|
|
336
|
+
}
|
|
337
|
+
if (!allowPrereleases && prerelease(version)) {
|
|
338
|
+
return false;
|
|
339
|
+
}
|
|
340
|
+
if (versionExclusions && satisfies(version, versionExclusions, { includePrerelease: true })) {
|
|
341
|
+
return false;
|
|
342
|
+
}
|
|
343
|
+
return true;
|
|
344
|
+
});
|
|
345
|
+
return versions.sort((a, b) => compare(b, a, true));
|
|
346
|
+
}
|
|
347
|
+
#getMajorVersions(versions) {
|
|
348
|
+
const majorVersions = /* @__PURE__ */ new Map();
|
|
349
|
+
for (const version of versions) {
|
|
350
|
+
const major = semver.major(version);
|
|
351
|
+
const existing = majorVersions.get(major);
|
|
352
|
+
if (!existing || semver.gt(version, existing)) {
|
|
353
|
+
majorVersions.set(major, version);
|
|
354
|
+
}
|
|
355
|
+
}
|
|
356
|
+
return [...majorVersions.values()].sort((a, b) => compare(b, a, true));
|
|
357
|
+
}
|
|
358
|
+
async loadPackageInfoTask(context, task, options) {
|
|
359
|
+
const { registry } = options;
|
|
360
|
+
let manifest;
|
|
361
|
+
try {
|
|
362
|
+
manifest = await this.context.packageManager.getManifest(context.packageIdentifier, {
|
|
363
|
+
registry
|
|
364
|
+
});
|
|
365
|
+
} catch (e) {
|
|
366
|
+
assertIsError(e);
|
|
367
|
+
throw new CommandError(`Unable to fetch package information for '${context.packageIdentifier}': ${e.message}`);
|
|
368
|
+
}
|
|
369
|
+
if (!manifest) {
|
|
370
|
+
throw new CommandError(`Unable to fetch package information for '${context.packageIdentifier}'.`);
|
|
371
|
+
}
|
|
372
|
+
if (context.packageIdentifier.registry) {
|
|
373
|
+
assert(context.packageIdentifier.name, "Registry package identifier must have a name");
|
|
374
|
+
context.packageIdentifier = npa.resolve(
|
|
375
|
+
context.packageIdentifier.name,
|
|
376
|
+
// `save-prefix` option is ignored by some package managers so the caret is needed to ensure
|
|
377
|
+
// that the value in the project package.json is correct.
|
|
378
|
+
(context.isExactVersion ? "" : "^") + manifest.version
|
|
379
|
+
);
|
|
380
|
+
}
|
|
381
|
+
context.hasSchematics = !!manifest.schematics;
|
|
382
|
+
context.savePackage = manifest["ng-add"]?.save;
|
|
383
|
+
context.collectionName = manifest.name;
|
|
384
|
+
context.homepage = manifest.homepage;
|
|
385
|
+
if (await this.getPeerDependencyConflicts(manifest)) {
|
|
386
|
+
task.output = color.yellow(figures.warning + " Package has unmet peer dependencies. Adding the package may not succeed.");
|
|
387
|
+
}
|
|
388
|
+
}
|
|
389
|
+
async confirmInstallationTask(context, task) {
|
|
390
|
+
if (!isTTY()) {
|
|
391
|
+
task.output = `'--skip-confirmation' can be used to bypass installation confirmation. Ensure package name is correct prior to '--skip-confirmation' option usage.`;
|
|
392
|
+
throw new CommandError("No terminal detected");
|
|
393
|
+
}
|
|
394
|
+
const { ListrInquirerPromptAdapter } = await import("@listr2/prompt-adapter-inquirer");
|
|
395
|
+
const { confirm } = await import("@inquirer/prompts");
|
|
396
|
+
const shouldProceed = await task.prompt(ListrInquirerPromptAdapter).run(confirm, {
|
|
397
|
+
message: `The package ${color.blue(context.packageIdentifier.toString())} will be installed and executed.
|
|
398
|
+
Would you like to proceed?`,
|
|
399
|
+
default: true,
|
|
400
|
+
theme: { prefix: "" }
|
|
401
|
+
});
|
|
402
|
+
if (!shouldProceed) {
|
|
403
|
+
throw new CommandError("Command aborted");
|
|
404
|
+
}
|
|
405
|
+
}
|
|
406
|
+
async cleanUpTemporaryDependency(packageName) {
|
|
407
|
+
try {
|
|
408
|
+
this.context.logger.info(`Cleaning up temporary dependency '${packageName}'...`);
|
|
409
|
+
const projectManifest = await this.getProjectManifest();
|
|
410
|
+
if (projectManifest) {
|
|
411
|
+
if (projectManifest.dependencies) {
|
|
412
|
+
delete projectManifest.dependencies[packageName];
|
|
413
|
+
}
|
|
414
|
+
if (projectManifest.devDependencies) {
|
|
415
|
+
delete projectManifest.devDependencies[packageName];
|
|
416
|
+
}
|
|
417
|
+
await fs.writeFile(join(this.context.root, "package.json"), JSON.stringify(projectManifest, null, 2) + "\n");
|
|
418
|
+
}
|
|
419
|
+
await this.context.packageManager.install({ ignoreScripts: true });
|
|
420
|
+
} catch (error) {
|
|
421
|
+
this.context.logger.warn(`Failed to clean up temporary dependency '${packageName}': ${error instanceof Error ? error.message : error}`);
|
|
422
|
+
}
|
|
423
|
+
}
|
|
424
|
+
async installPackageTask(context, task, options) {
|
|
425
|
+
const { registry } = options;
|
|
426
|
+
const { packageIdentifier, savePackage } = context;
|
|
427
|
+
const { packageManager } = this.context;
|
|
428
|
+
task.title = "Installing package";
|
|
429
|
+
if (context.savePackage === false) {
|
|
430
|
+
task.title += " in temporary location";
|
|
431
|
+
const { workingDirectory } = await packageManager.acquireTempPackage(packageIdentifier.toString(), {
|
|
432
|
+
registry
|
|
433
|
+
});
|
|
434
|
+
const tempRequire = createRequire(workingDirectory + "/");
|
|
435
|
+
assert(context.collectionName, "Collection name should always be available");
|
|
436
|
+
const resolvedCollectionPath = tempRequire.resolve(join(context.collectionName, "package.json"));
|
|
437
|
+
context.collectionName = dirname(resolvedCollectionPath);
|
|
438
|
+
} else {
|
|
439
|
+
await packageManager.add(packageIdentifier.toString(), "none", savePackage === "devDependencies", false, true, {
|
|
440
|
+
registry
|
|
441
|
+
});
|
|
442
|
+
}
|
|
443
|
+
}
|
|
444
|
+
async isProjectVersionValid(packageIdentifier) {
|
|
445
|
+
if (!packageIdentifier.name) {
|
|
446
|
+
return false;
|
|
447
|
+
}
|
|
448
|
+
const installedVersion = await this.findProjectVersion(packageIdentifier.name);
|
|
449
|
+
if (!installedVersion) {
|
|
450
|
+
return false;
|
|
451
|
+
}
|
|
452
|
+
if (packageIdentifier.rawSpec === "*") {
|
|
453
|
+
return true;
|
|
454
|
+
}
|
|
455
|
+
if (packageIdentifier.type === "range" && packageIdentifier.fetchSpec && packageIdentifier.fetchSpec !== "*") {
|
|
456
|
+
return satisfies(installedVersion, packageIdentifier.fetchSpec);
|
|
457
|
+
}
|
|
458
|
+
if (packageIdentifier.type === "version") {
|
|
459
|
+
const v1 = valid(packageIdentifier.fetchSpec);
|
|
460
|
+
const v2 = valid(installedVersion);
|
|
461
|
+
return v1 !== null && v1 === v2;
|
|
462
|
+
}
|
|
463
|
+
return false;
|
|
464
|
+
}
|
|
465
|
+
getCollectionName() {
|
|
466
|
+
const [, collectionName] = this.context.args.positional;
|
|
467
|
+
if (!collectionName) {
|
|
468
|
+
return void 0;
|
|
469
|
+
}
|
|
470
|
+
try {
|
|
471
|
+
const packageName = npa(collectionName).name;
|
|
472
|
+
if (packageName) {
|
|
473
|
+
return packageName;
|
|
474
|
+
}
|
|
475
|
+
} catch (e) {
|
|
476
|
+
assertIsError(e);
|
|
477
|
+
this.context.logger.error(e.message);
|
|
478
|
+
}
|
|
479
|
+
return collectionName;
|
|
480
|
+
}
|
|
481
|
+
isPackageInstalled(name) {
|
|
482
|
+
return !!this.resolvePackageJson(name);
|
|
483
|
+
}
|
|
484
|
+
executeSchematic(options) {
|
|
485
|
+
const { verbose, skipConfirmation, interactive, force, dryRun, registry, defaults, collection: collectionName, schematicName, ...schematicOptions } = options;
|
|
486
|
+
return this.runSchematic({
|
|
487
|
+
schematicOptions,
|
|
488
|
+
schematicName: schematicName ?? this.schematicName,
|
|
489
|
+
collectionName,
|
|
490
|
+
executionOptions: {
|
|
491
|
+
interactive,
|
|
492
|
+
force,
|
|
493
|
+
dryRun,
|
|
494
|
+
defaults,
|
|
495
|
+
packageRegistry: registry
|
|
496
|
+
}
|
|
497
|
+
});
|
|
498
|
+
}
|
|
499
|
+
async findProjectVersion(name) {
|
|
500
|
+
const cachedVersion = this.#projectVersionCache.get(name);
|
|
501
|
+
if (cachedVersion !== void 0) {
|
|
502
|
+
return cachedVersion;
|
|
503
|
+
}
|
|
504
|
+
const installedPackagePath = this.resolvePackageJson(name);
|
|
505
|
+
if (installedPackagePath) {
|
|
506
|
+
try {
|
|
507
|
+
const installedPackage = JSON.parse(await fs.readFile(installedPackagePath, "utf-8"));
|
|
508
|
+
this.#projectVersionCache.set(name, installedPackage.version);
|
|
509
|
+
return installedPackage.version;
|
|
510
|
+
} catch {
|
|
511
|
+
}
|
|
512
|
+
}
|
|
513
|
+
const projectManifest = await this.getProjectManifest();
|
|
514
|
+
if (projectManifest) {
|
|
515
|
+
const version = projectManifest.dependencies?.[name] || projectManifest.devDependencies?.[name];
|
|
516
|
+
if (version) {
|
|
517
|
+
this.#projectVersionCache.set(name, version);
|
|
518
|
+
return version;
|
|
519
|
+
}
|
|
520
|
+
}
|
|
521
|
+
this.#projectVersionCache.set(name, null);
|
|
522
|
+
return null;
|
|
523
|
+
}
|
|
524
|
+
async getProjectManifest() {
|
|
525
|
+
if (this.#rootManifestCache) {
|
|
526
|
+
return this.#rootManifestCache;
|
|
527
|
+
}
|
|
528
|
+
const { root } = this.context;
|
|
529
|
+
try {
|
|
530
|
+
this.#rootManifestCache = JSON.parse(await fs.readFile(join(root, "package.json"), "utf-8"));
|
|
531
|
+
return this.#rootManifestCache;
|
|
532
|
+
} catch {
|
|
533
|
+
return null;
|
|
534
|
+
}
|
|
535
|
+
}
|
|
536
|
+
resolvePackageJson(name) {
|
|
537
|
+
try {
|
|
538
|
+
return this.rootRequire.resolve(join(name, "package.json"));
|
|
539
|
+
} catch (e) {
|
|
540
|
+
assertIsError(e);
|
|
541
|
+
if (e.code === "ERR_PACKAGE_PATH_NOT_EXPORTED") {
|
|
542
|
+
try {
|
|
543
|
+
const mainPath = this.rootRequire.resolve(name);
|
|
544
|
+
let directory = dirname(mainPath);
|
|
545
|
+
while (directory && basename(directory) !== "node_modules") {
|
|
546
|
+
const packageJsonPath = join(directory, "package.json");
|
|
547
|
+
if (existsSync(packageJsonPath)) {
|
|
548
|
+
return packageJsonPath;
|
|
549
|
+
}
|
|
550
|
+
const parent = dirname(directory);
|
|
551
|
+
if (parent === directory) {
|
|
552
|
+
break;
|
|
553
|
+
}
|
|
554
|
+
directory = parent;
|
|
555
|
+
}
|
|
556
|
+
} catch (e2) {
|
|
557
|
+
assertIsError(e2);
|
|
558
|
+
this.context.logger.debug(`Failed to resolve package '${name}' during fallback: ${e2.message}`);
|
|
559
|
+
}
|
|
560
|
+
}
|
|
561
|
+
}
|
|
562
|
+
return void 0;
|
|
563
|
+
}
|
|
564
|
+
async getPeerDependencyConflicts(manifest) {
|
|
565
|
+
if (!manifest.peerDependencies) {
|
|
566
|
+
return false;
|
|
567
|
+
}
|
|
568
|
+
const checks = Object.entries(manifest.peerDependencies).map(async ([peer, range]) => {
|
|
569
|
+
let peerIdentifier;
|
|
570
|
+
try {
|
|
571
|
+
peerIdentifier = npa.resolve(peer, range);
|
|
572
|
+
} catch {
|
|
573
|
+
this.context.logger.warn(`Invalid peer dependency ${peer} found in package.`);
|
|
574
|
+
return null;
|
|
575
|
+
}
|
|
576
|
+
if (peerIdentifier.type !== "version" && peerIdentifier.type !== "range") {
|
|
577
|
+
return null;
|
|
578
|
+
}
|
|
579
|
+
try {
|
|
580
|
+
const version = await this.findProjectVersion(peer);
|
|
581
|
+
if (!version) {
|
|
582
|
+
return null;
|
|
583
|
+
}
|
|
584
|
+
const options = { includePrerelease: true };
|
|
585
|
+
if (!intersects(version, peerIdentifier.rawSpec, options) && !satisfies(version, peerIdentifier.rawSpec, options)) {
|
|
586
|
+
return `Package "${manifest.name}@${manifest.version}" has an incompatible peer dependency to "${peer}@${peerIdentifier.rawSpec}" (requires "${version}" in project).`;
|
|
587
|
+
}
|
|
588
|
+
} catch {
|
|
589
|
+
}
|
|
590
|
+
return null;
|
|
591
|
+
});
|
|
592
|
+
const conflicts = (await Promise.all(checks)).filter((result) => !!result);
|
|
593
|
+
return conflicts.length > 0 && conflicts;
|
|
594
|
+
}
|
|
595
|
+
};
|
|
596
|
+
export {
|
|
597
|
+
AddCommandModule as default
|
|
598
|
+
};
|
|
599
|
+
/**
|
|
600
|
+
* @license
|
|
601
|
+
* Copyright Google LLC All Rights Reserved.
|
|
602
|
+
*
|
|
603
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
604
|
+
* found in the LICENSE file at https://angular.dev/license
|
|
605
|
+
*/
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import {
|
|
2
|
+
ArchitectCommandModule
|
|
3
|
+
} from "./chunk-CAZUOCTC.js";
|
|
4
|
+
import "./chunk-DHWVZMLH.js";
|
|
5
|
+
import {
|
|
6
|
+
RootCommands
|
|
7
|
+
} from "./chunk-5AASRQKS.js";
|
|
8
|
+
import "./chunk-YM7ILCS5.js";
|
|
9
|
+
import "./chunk-XG3HVNIL.js";
|
|
10
|
+
import "./chunk-GHUUJYOY.js";
|
|
11
|
+
import "./chunk-FZ5GFCWU.js";
|
|
12
|
+
|
|
13
|
+
// packages/angular/cli/src/commands/e2e/cli.js
|
|
14
|
+
var E2eCommandModule = class extends ArchitectCommandModule {
|
|
15
|
+
missingTargetChoices = [
|
|
16
|
+
{
|
|
17
|
+
name: "Playwright",
|
|
18
|
+
value: "playwright-ng-schematics"
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
name: "Cypress",
|
|
22
|
+
value: "@cypress/schematic"
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
name: "Nightwatch",
|
|
26
|
+
value: "@nightwatch/schematics"
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
name: "WebdriverIO",
|
|
30
|
+
value: "@wdio/schematics"
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
name: "Puppeteer",
|
|
34
|
+
value: "@puppeteer/ng-schematics"
|
|
35
|
+
}
|
|
36
|
+
];
|
|
37
|
+
multiTarget = true;
|
|
38
|
+
command = "e2e [project]";
|
|
39
|
+
aliases = RootCommands["e2e"].aliases;
|
|
40
|
+
describe = "Builds and serves an Angular application, then runs end-to-end tests.";
|
|
41
|
+
};
|
|
42
|
+
export {
|
|
43
|
+
E2eCommandModule as default
|
|
44
|
+
};
|
|
45
|
+
/**
|
|
46
|
+
* @license
|
|
47
|
+
* Copyright Google LLC All Rights Reserved.
|
|
48
|
+
*
|
|
49
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
50
|
+
* found in the LICENSE file at https://angular.dev/license
|
|
51
|
+
*/
|