@servicetitan/startup 33.1.1 → 34.0.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/dist/cli/commands/build.d.ts +48 -22
- package/dist/cli/commands/build.d.ts.map +1 -1
- package/dist/cli/commands/build.js +72 -52
- package/dist/cli/commands/build.js.map +1 -1
- package/dist/cli/commands/bundle-package.d.ts +54 -10
- package/dist/cli/commands/bundle-package.d.ts.map +1 -1
- package/dist/cli/commands/bundle-package.js +40 -0
- package/dist/cli/commands/bundle-package.js.map +1 -1
- package/dist/cli/commands/clean.d.ts +4 -0
- package/dist/cli/commands/clean.d.ts.map +1 -1
- package/dist/cli/commands/clean.js +50 -16
- package/dist/cli/commands/clean.js.map +1 -1
- package/dist/cli/commands/convert-eslint-config.d.ts +1 -1
- package/dist/cli/commands/convert-eslint-config.d.ts.map +1 -1
- package/dist/cli/commands/convert-eslint-config.js +2 -15
- package/dist/cli/commands/convert-eslint-config.js.map +1 -1
- package/dist/cli/commands/eslint.d.ts +29 -7
- package/dist/cli/commands/eslint.d.ts.map +1 -1
- package/dist/cli/commands/eslint.js +18 -6
- package/dist/cli/commands/eslint.js.map +1 -1
- package/dist/cli/commands/get-command.d.ts.map +1 -1
- package/dist/cli/commands/get-command.js +6 -0
- package/dist/cli/commands/get-command.js.map +1 -1
- package/dist/cli/commands/index.d.ts +2 -2
- package/dist/cli/commands/index.d.ts.map +1 -1
- package/dist/cli/commands/index.js +2 -2
- package/dist/cli/commands/index.js.map +1 -1
- package/dist/cli/commands/init.d.ts +10 -6
- package/dist/cli/commands/init.d.ts.map +1 -1
- package/dist/cli/commands/init.js +8 -6
- package/dist/cli/commands/init.js.map +1 -1
- package/dist/cli/commands/install.d.ts +27 -15
- package/dist/cli/commands/install.d.ts.map +1 -1
- package/dist/cli/commands/install.js +18 -16
- package/dist/cli/commands/install.js.map +1 -1
- package/dist/cli/commands/kendo-ui-license.d.ts +1 -0
- package/dist/cli/commands/kendo-ui-license.d.ts.map +1 -1
- package/dist/cli/commands/kendo-ui-license.js +1 -0
- package/dist/cli/commands/kendo-ui-license.js.map +1 -1
- package/dist/cli/commands/lint.d.ts +51 -17
- package/dist/cli/commands/lint.d.ts.map +1 -1
- package/dist/cli/commands/lint.js +36 -26
- package/dist/cli/commands/lint.js.map +1 -1
- package/dist/cli/commands/mfe-check.d.ts +52 -0
- package/dist/cli/commands/mfe-check.d.ts.map +1 -0
- package/dist/cli/commands/mfe-check.js +145 -0
- package/dist/cli/commands/mfe-check.js.map +1 -0
- package/dist/cli/commands/mfe-generate-metadata.d.ts +20 -0
- package/dist/cli/commands/mfe-generate-metadata.d.ts.map +1 -0
- package/dist/cli/commands/mfe-generate-metadata.js +93 -0
- package/dist/cli/commands/mfe-generate-metadata.js.map +1 -0
- package/dist/cli/commands/mfe-list.d.ts +52 -15
- package/dist/cli/commands/mfe-list.d.ts.map +1 -1
- package/dist/cli/commands/mfe-list.js +42 -29
- package/dist/cli/commands/mfe-list.js.map +1 -1
- package/dist/cli/commands/mfe-package-clean.d.ts +34 -15
- package/dist/cli/commands/mfe-package-clean.d.ts.map +1 -1
- package/dist/cli/commands/mfe-package-clean.js +43 -34
- package/dist/cli/commands/mfe-package-clean.js.map +1 -1
- package/dist/cli/commands/mfe-package-publish.d.ts +60 -22
- package/dist/cli/commands/mfe-package-publish.d.ts.map +1 -1
- package/dist/cli/commands/mfe-package-publish.js +137 -78
- package/dist/cli/commands/mfe-package-publish.js.map +1 -1
- package/dist/cli/commands/mfe-package-rollback.d.ts +40 -0
- package/dist/cli/commands/mfe-package-rollback.d.ts.map +1 -0
- package/dist/cli/commands/mfe-package-rollback.js +119 -0
- package/dist/cli/commands/mfe-package-rollback.js.map +1 -0
- package/dist/cli/commands/mfe-publish.d.ts +36 -11
- package/dist/cli/commands/mfe-publish.d.ts.map +1 -1
- package/dist/cli/commands/mfe-publish.js +72 -22
- package/dist/cli/commands/mfe-publish.js.map +1 -1
- package/dist/cli/commands/prepare-package.d.ts +14 -5
- package/dist/cli/commands/prepare-package.d.ts.map +1 -1
- package/dist/cli/commands/prepare-package.js +20 -0
- package/dist/cli/commands/prepare-package.js.map +1 -1
- package/dist/cli/commands/review/review.d.ts +17 -8
- package/dist/cli/commands/review/review.d.ts.map +1 -1
- package/dist/cli/commands/review/review.js +16 -21
- package/dist/cli/commands/review/review.js.map +1 -1
- package/dist/cli/commands/review/rules/index.d.ts.map +1 -1
- package/dist/cli/commands/review/rules/index.js +3 -1
- package/dist/cli/commands/review/rules/index.js.map +1 -1
- package/dist/cli/commands/review/rules/no-deprecated-content-base.js.map +1 -1
- package/dist/cli/commands/review/rules/prefer-open-ended-peer-dependencies.js.map +1 -1
- package/dist/cli/commands/review/rules/require-compatible-launch-darkly-sdk.js +4 -4
- package/dist/cli/commands/review/rules/require-compatible-launch-darkly-sdk.js.map +1 -1
- package/dist/cli/commands/review/rules/require-one-collection-version.js +1 -2
- package/dist/cli/commands/review/rules/require-one-collection-version.js.map +1 -1
- package/dist/cli/commands/review/rules/require-one-uikit-version.d.ts.map +1 -1
- package/dist/cli/commands/review/rules/require-one-uikit-version.js +1 -0
- package/dist/cli/commands/review/rules/require-one-uikit-version.js.map +1 -1
- package/dist/cli/commands/review/rules/require-project-version-in-root-node-modules.d.ts.map +1 -1
- package/dist/cli/commands/review/rules/require-project-version-in-root-node-modules.js +8 -8
- package/dist/cli/commands/review/rules/require-project-version-in-root-node-modules.js.map +1 -1
- package/dist/cli/commands/review/rules/require-tsconfig-references.d.ts +24 -0
- package/dist/cli/commands/review/rules/require-tsconfig-references.d.ts.map +1 -0
- package/dist/cli/commands/review/rules/require-tsconfig-references.js +146 -0
- package/dist/cli/commands/review/rules/require-tsconfig-references.js.map +1 -0
- package/dist/cli/commands/review/utils/collate-dependencies.js +1 -3
- package/dist/cli/commands/review/utils/collate-dependencies.js.map +1 -1
- package/dist/cli/commands/review/utils/compare-version.js +2 -2
- package/dist/cli/commands/review/utils/compare-version.js.map +1 -1
- package/dist/cli/commands/review/utils/set-version.js +1 -1
- package/dist/cli/commands/review/utils/set-version.js.map +1 -1
- package/dist/cli/commands/run-task.d.ts +29 -7
- package/dist/cli/commands/run-task.d.ts.map +1 -1
- package/dist/cli/commands/run-task.js +21 -8
- package/dist/cli/commands/run-task.js.map +1 -1
- package/dist/cli/commands/run-task.test.js +14 -2
- package/dist/cli/commands/run-task.test.js.map +1 -1
- package/dist/cli/commands/start.d.ts +38 -18
- package/dist/cli/commands/start.d.ts.map +1 -1
- package/dist/cli/commands/start.js +65 -45
- package/dist/cli/commands/start.js.map +1 -1
- package/dist/cli/commands/stylelint.d.ts +29 -7
- package/dist/cli/commands/stylelint.d.ts.map +1 -1
- package/dist/cli/commands/stylelint.js +18 -6
- package/dist/cli/commands/stylelint.js.map +1 -1
- package/dist/cli/commands/test/runners/vitest.js +1 -1
- package/dist/cli/commands/test/runners/vitest.js.map +1 -1
- package/dist/cli/commands/test/tests.d.ts +25 -5
- package/dist/cli/commands/test/tests.d.ts.map +1 -1
- package/dist/cli/commands/test/tests.js +22 -14
- package/dist/cli/commands/test/tests.js.map +1 -1
- package/dist/cli/commands/types.d.ts +51 -10
- package/dist/cli/commands/types.d.ts.map +1 -1
- package/dist/cli/commands/types.js +1 -0
- package/dist/cli/commands/types.js.map +1 -1
- package/dist/cli/commands/upload-sourcemaps.d.ts +26 -6
- package/dist/cli/commands/upload-sourcemaps.d.ts.map +1 -1
- package/dist/cli/commands/upload-sourcemaps.js +27 -4
- package/dist/cli/commands/upload-sourcemaps.js.map +1 -1
- package/dist/cli/commands/utils.d.ts +4 -0
- package/dist/cli/commands/utils.d.ts.map +1 -0
- package/dist/cli/commands/utils.js +28 -0
- package/dist/cli/commands/utils.js.map +1 -0
- package/dist/cli/index.js +8 -5
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/tasks/cli-task.d.ts.map +1 -1
- package/dist/cli/tasks/cli-task.js +1 -1
- package/dist/cli/tasks/cli-task.js.map +1 -1
- package/dist/cli/tasks/swc-compile-package.d.ts +1 -2
- package/dist/cli/tasks/swc-compile-package.d.ts.map +1 -1
- package/dist/cli/tasks/swc-compile-package.js.map +1 -1
- package/dist/cli/tasks/tsc-compile-package.d.ts +1 -2
- package/dist/cli/tasks/tsc-compile-package.d.ts.map +1 -1
- package/dist/cli/tasks/tsc-compile-package.js.map +1 -1
- package/dist/cli/tasks/tsc-compile.d.ts +1 -2
- package/dist/cli/tasks/tsc-compile.d.ts.map +1 -1
- package/dist/cli/tasks/tsc-compile.js.map +1 -1
- package/dist/cli/utils/bundle.d.ts.map +1 -1
- package/dist/cli/utils/bundle.js +2 -2
- package/dist/cli/utils/bundle.js.map +1 -1
- package/dist/cli/utils/check-startup-location.d.ts +4 -0
- package/dist/cli/utils/check-startup-location.d.ts.map +1 -0
- package/dist/cli/utils/check-startup-location.js +27 -0
- package/dist/cli/utils/check-startup-location.js.map +1 -0
- package/dist/cli/utils/cli-npm.d.ts +6 -0
- package/dist/cli/utils/cli-npm.d.ts.map +1 -1
- package/dist/cli/utils/cli-npm.js +25 -3
- package/dist/cli/utils/cli-npm.js.map +1 -1
- package/dist/cli/utils/compile-less.js +1 -1
- package/dist/cli/utils/compile-less.js.map +1 -1
- package/dist/cli/utils/constants.d.ts +2 -0
- package/dist/cli/utils/constants.d.ts.map +1 -0
- package/dist/cli/utils/constants.js +13 -0
- package/dist/cli/utils/constants.js.map +1 -0
- package/dist/cli/utils/copy-files.d.ts.map +1 -1
- package/dist/cli/utils/copy-files.js.map +1 -1
- package/dist/cli/utils/eslint.d.ts +1 -2
- package/dist/cli/utils/eslint.d.ts.map +1 -1
- package/dist/cli/utils/eslint.js.map +1 -1
- package/dist/cli/utils/index.d.ts +2 -0
- package/dist/cli/utils/index.d.ts.map +1 -1
- package/dist/cli/utils/index.js +2 -0
- package/dist/cli/utils/index.js.map +1 -1
- package/dist/cli/utils/is-module-installed.js +1 -1
- package/dist/cli/utils/is-module-installed.js.map +1 -1
- package/dist/cli/utils/lerna-exec.d.ts.map +1 -1
- package/dist/cli/utils/lerna-exec.js +1 -3
- package/dist/cli/utils/lerna-exec.js.map +1 -1
- package/dist/cli/utils/process-tree.js.map +1 -1
- package/dist/cli/utils/set-node-options.js +2 -4
- package/dist/cli/utils/set-node-options.js.map +1 -1
- package/dist/cli/utils/stylelint.d.ts +1 -2
- package/dist/cli/utils/stylelint.d.ts.map +1 -1
- package/dist/cli/utils/stylelint.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/jest/resolver.js +2 -2
- package/dist/jest/resolver.js.map +1 -1
- package/dist/jest/svg-transformer.d.ts.map +1 -1
- package/dist/jest/svg-transformer.js.map +1 -1
- package/dist/utils/find-packages.js +1 -1
- package/dist/utils/find-packages.js.map +1 -1
- package/dist/utils/format-relative-date.js +1 -1
- package/dist/utils/format-relative-date.js.map +1 -1
- package/dist/utils/get-configuration.d.ts +3 -0
- package/dist/utils/get-configuration.d.ts.map +1 -1
- package/dist/utils/get-configuration.js +14 -11
- package/dist/utils/get-configuration.js.map +1 -1
- package/dist/utils/get-destination-folders.d.ts.map +1 -1
- package/dist/utils/get-destination-folders.js.map +1 -1
- package/dist/utils/get-folders.d.ts.map +1 -1
- package/dist/utils/get-folders.js.map +1 -1
- package/dist/utils/get-jest-config.js +1 -1
- package/dist/utils/get-jest-config.js.map +1 -1
- package/dist/utils/get-package-data.js +1 -1
- package/dist/utils/get-package-data.js.map +1 -1
- package/dist/utils/get-packages.js.map +1 -1
- package/dist/utils/index.d.ts +1 -0
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/index.js +1 -0
- package/dist/utils/index.js.map +1 -1
- package/dist/utils/load-shared-dependencies.js.map +1 -1
- package/dist/utils/prettify.d.ts +13 -0
- package/dist/utils/prettify.d.ts.map +1 -0
- package/dist/utils/prettify.js +48 -0
- package/dist/utils/prettify.js.map +1 -0
- package/dist/utils/read-json.js +1 -1
- package/dist/utils/read-json.js.map +1 -1
- package/dist/utils/transform-svg.js +2 -2
- package/dist/utils/transform-svg.js.map +1 -1
- package/dist/webpack/configs/cache-config.js +1 -1
- package/dist/webpack/configs/cache-config.js.map +1 -1
- package/dist/webpack/configs/optimization-config.js +3 -4
- package/dist/webpack/configs/optimization-config.js.map +1 -1
- package/dist/webpack/configs/output-config.js +1 -1
- package/dist/webpack/configs/output-config.js.map +1 -1
- package/dist/webpack/configs/plugins/assets-manifest-plugin.d.ts.map +1 -1
- package/dist/webpack/configs/plugins/assets-manifest-plugin.js +5 -5
- package/dist/webpack/configs/plugins/assets-manifest-plugin.js.map +1 -1
- package/dist/webpack/configs/plugins/bundle-analyser-plugin.d.ts.map +1 -1
- package/dist/webpack/configs/plugins/bundle-analyser-plugin.js +1 -1
- package/dist/webpack/configs/plugins/bundle-analyser-plugin.js.map +1 -1
- package/dist/webpack/configs/plugins/define-exposed-dependencies-plugin.d.ts.map +1 -1
- package/dist/webpack/configs/plugins/define-exposed-dependencies-plugin.js +6 -9
- package/dist/webpack/configs/plugins/define-exposed-dependencies-plugin.js.map +1 -1
- package/dist/webpack/configs/plugins/html-tags-plugin.js +1 -1
- package/dist/webpack/configs/plugins/html-tags-plugin.js.map +1 -1
- package/dist/webpack/configs/plugins/ignore-plugin/check-resource.js +1 -1
- package/dist/webpack/configs/plugins/ignore-plugin/check-resource.js.map +1 -1
- package/dist/webpack/configs/plugins/ignore-plugin/ignore-plugin.d.ts.map +1 -1
- package/dist/webpack/configs/plugins/ignore-plugin/ignore-plugin.js.map +1 -1
- package/dist/webpack/configs/plugins/moment-locales-plugin.js +1 -1
- package/dist/webpack/configs/plugins/moment-locales-plugin.js.map +1 -1
- package/dist/webpack/configs/plugins/watch-run-plugin.d.ts.map +1 -1
- package/dist/webpack/configs/plugins/watch-run-plugin.js.map +1 -1
- package/dist/webpack/configs/types.d.ts +1 -0
- package/dist/webpack/configs/types.d.ts.map +1 -1
- package/dist/webpack/configs/utils/build-metadata.d.ts +10 -0
- package/dist/webpack/configs/utils/build-metadata.d.ts.map +1 -0
- package/dist/webpack/configs/utils/build-metadata.js +50 -0
- package/dist/webpack/configs/utils/build-metadata.js.map +1 -0
- package/dist/webpack/configs/utils/generate-metadata.d.ts.map +1 -1
- package/dist/webpack/configs/utils/generate-metadata.js +5 -24
- package/dist/webpack/configs/utils/generate-metadata.js.map +1 -1
- package/dist/webpack/configs/utils/get-exposed-dependencies.d.ts +3 -0
- package/dist/webpack/configs/utils/get-exposed-dependencies.d.ts.map +1 -0
- package/dist/webpack/configs/utils/get-exposed-dependencies.js +21 -0
- package/dist/webpack/configs/utils/get-exposed-dependencies.js.map +1 -0
- package/dist/webpack/configs/utils/get-launchdarkly-sdk-version.js +1 -1
- package/dist/webpack/configs/utils/get-launchdarkly-sdk-version.js.map +1 -1
- package/dist/webpack/configs/utils/index.d.ts +1 -0
- package/dist/webpack/configs/utils/index.d.ts.map +1 -1
- package/dist/webpack/configs/utils/index.js +1 -0
- package/dist/webpack/configs/utils/index.js.map +1 -1
- package/dist/webpack/create-webpack-config.js +10 -4
- package/dist/webpack/create-webpack-config.js.map +1 -1
- package/dist/webpack/loaders/expose-loader/index.d.ts.map +1 -1
- package/dist/webpack/loaders/expose-loader/index.js.map +1 -1
- package/dist/webpack/loaders/expose-loader/runtime/get-global-this.js +1 -1
- package/dist/webpack/loaders/expose-loader/runtime/get-global-this.js.map +1 -1
- package/dist/webpack/loaders/expose-loader/utils/get-new-user-request.js +2 -2
- package/dist/webpack/loaders/expose-loader/utils/get-new-user-request.js.map +1 -1
- package/dist/webpack/utils/stringify-config.js +2 -2
- package/dist/webpack/utils/stringify-config.js.map +1 -1
- package/dist/webpack/utils/testing/get-compiler.d.ts.map +1 -1
- package/dist/webpack/utils/testing/get-compiler.js +1 -1
- package/dist/webpack/utils/testing/get-compiler.js.map +1 -1
- package/dist/webpack/utils/testing/get-errors.d.ts.map +1 -1
- package/dist/webpack/utils/testing/get-errors.js.map +1 -1
- package/dist/webpack/utils/testing/get-warnings.d.ts.map +1 -1
- package/dist/webpack/utils/testing/get-warnings.js.map +1 -1
- package/dist/webpack/utils/testing/read-asset.d.ts.map +1 -1
- package/dist/webpack/utils/testing/read-asset.js +1 -1
- package/dist/webpack/utils/testing/read-asset.js.map +1 -1
- package/dist/webpack/utils/testing/read-assets.d.ts.map +1 -1
- package/dist/webpack/utils/testing/read-assets.js.map +1 -1
- package/package.json +35 -41
- package/src/cli/commands/__tests__/build.test.ts +32 -9
- package/src/cli/commands/__tests__/bundle-package.test.ts +2 -1
- package/src/cli/commands/__tests__/clean.test.ts +99 -8
- package/src/cli/commands/__tests__/convert-eslint-config.test.ts +14 -9
- package/src/cli/commands/__tests__/eslint.test.ts +1 -1
- package/src/cli/commands/__tests__/get-command.test.ts +3 -1
- package/src/cli/commands/__tests__/init.test.ts +14 -1
- package/src/cli/commands/__tests__/install.test.ts +6 -2
- package/src/cli/commands/__tests__/kendo-ui-license.test.ts +7 -2
- package/src/cli/commands/__tests__/lint.test.ts +4 -2
- package/src/cli/commands/__tests__/mfe-check.test.ts +346 -0
- package/src/cli/commands/__tests__/mfe-generate-metadata.test.ts +160 -0
- package/src/cli/commands/__tests__/mfe-list.test.ts +8 -1
- package/src/cli/commands/__tests__/mfe-package-clean.test.ts +0 -1
- package/src/cli/commands/__tests__/mfe-package-publish.test.ts +322 -93
- package/src/cli/commands/__tests__/mfe-package-rollback.test.ts +196 -0
- package/src/cli/commands/__tests__/mfe-publish.test.ts +65 -5
- package/src/cli/commands/__tests__/prepare-package.test.ts +3 -0
- package/src/cli/commands/__tests__/start.test.ts +30 -7
- package/src/cli/commands/__tests__/stylelint.test.ts +1 -1
- package/src/cli/commands/__tests__/styles-check.test.ts +1 -2
- package/src/cli/commands/__tests__/upload-sourcemaps.test.ts +3 -6
- package/src/cli/commands/build.ts +35 -26
- package/src/cli/commands/bundle-package.ts +11 -10
- package/src/cli/commands/clean.ts +51 -5
- package/src/cli/commands/convert-eslint-config.ts +3 -12
- package/src/cli/commands/eslint.ts +9 -11
- package/src/cli/commands/get-command.ts +6 -1
- package/src/cli/commands/index.ts +2 -2
- package/src/cli/commands/init.ts +7 -9
- package/src/cli/commands/install.ts +11 -13
- package/src/cli/commands/kendo-ui-license.ts +1 -1
- package/src/cli/commands/lint.ts +12 -18
- package/src/cli/commands/mfe-check.ts +166 -0
- package/src/cli/commands/mfe-generate-metadata.ts +69 -0
- package/src/cli/commands/mfe-list.ts +28 -30
- package/src/cli/commands/mfe-package-clean.ts +29 -34
- package/src/cli/commands/mfe-package-publish.ts +153 -87
- package/src/cli/commands/mfe-package-rollback.ts +100 -0
- package/src/cli/commands/mfe-publish.ts +80 -27
- package/src/cli/commands/prepare-package.ts +6 -5
- package/src/cli/commands/review/__tests__/review.test.ts +18 -19
- package/src/cli/commands/review/review.ts +11 -20
- package/src/cli/commands/review/rules/__tests__/no-deprecated-content-base.test.ts +1 -1
- package/src/cli/commands/review/rules/__tests__/no-deprecated-startup-install.test.ts +0 -1
- package/src/cli/commands/review/rules/__tests__/no-direct-peer-dependencies.test.ts +1 -1
- package/src/cli/commands/review/rules/__tests__/no-typescript-entry-point.test.ts +0 -1
- package/src/cli/commands/review/rules/__tests__/require-all-react-dependencies.test.ts +0 -1
- package/src/cli/commands/review/rules/__tests__/require-compatible-launch-darkly-sdk.test.ts +2 -2
- package/src/cli/commands/review/rules/__tests__/require-explicit-side-effects.test.ts +0 -1
- package/src/cli/commands/review/rules/__tests__/require-npmrc.test.ts +0 -1
- package/src/cli/commands/review/rules/__tests__/require-one-anvil-uikit-contrib-version.test.ts +1 -2
- package/src/cli/commands/review/rules/__tests__/require-one-collection-version.test.ts +0 -1
- package/src/cli/commands/review/rules/__tests__/require-one-package-version.test.ts +0 -1
- package/src/cli/commands/review/rules/__tests__/require-one-react-version.test.ts +0 -1
- package/src/cli/commands/review/rules/__tests__/require-one-uikit-version.test.ts +1 -1
- package/src/cli/commands/review/rules/__tests__/require-project-version-in-root-node-modules.test.ts +2 -3
- package/src/cli/commands/review/rules/__tests__/require-servicetitan-scope.test.ts +0 -1
- package/src/cli/commands/review/rules/__tests__/require-tsconfig-references.test.ts +315 -0
- package/src/cli/commands/review/rules/index.ts +2 -0
- package/src/cli/commands/review/rules/require-compatible-launch-darkly-sdk.ts +1 -1
- package/src/cli/commands/review/rules/require-one-uikit-version.ts +1 -0
- package/src/cli/commands/review/rules/require-project-version-in-root-node-modules.ts +3 -3
- package/src/cli/commands/review/rules/require-tsconfig-references.ts +157 -0
- package/src/cli/commands/review/utils/__tests__/set-version.test.ts +0 -1
- package/src/cli/commands/run-task.test.ts +15 -3
- package/src/cli/commands/run-task.ts +12 -14
- package/src/cli/commands/start.ts +75 -59
- package/src/cli/commands/stylelint.ts +9 -11
- package/src/cli/commands/test/runners/__tests__/jest.test.ts +1 -2
- package/src/cli/commands/test/runners/vitest.ts +1 -1
- package/src/cli/commands/test/tests.ts +13 -15
- package/src/cli/commands/types.ts +53 -7
- package/src/cli/commands/upload-sourcemaps.ts +14 -12
- package/src/cli/commands/utils.ts +6 -0
- package/src/cli/index.ts +11 -7
- package/src/cli/tasks/__tests__/cli-task.test.ts +1 -1
- package/src/cli/tasks/__tests__/swc-compile-package.test.ts +3 -1
- package/src/cli/tasks/__tests__/tsc-compile-package.test.ts +2 -0
- package/src/cli/tasks/__tests__/tsc-compile.test.ts +3 -13
- package/src/cli/tasks/cli-task.ts +1 -1
- package/src/cli/tasks/swc-compile-package.ts +1 -3
- package/src/cli/tasks/tsc-compile-package.ts +1 -2
- package/src/cli/tasks/tsc-compile.ts +1 -2
- package/src/cli/utils/__tests__/bundle.test.ts +1 -2
- package/src/cli/utils/__tests__/check-args.test.ts +1 -1
- package/src/cli/utils/__tests__/check-startup-location.test.ts +88 -0
- package/src/cli/utils/__tests__/cli-git.test.ts +1 -2
- package/src/cli/utils/__tests__/cli-npm.test.ts +51 -2
- package/src/cli/utils/__tests__/cli-os.test.ts +1 -2
- package/src/cli/utils/__tests__/compile.test.ts +1 -1
- package/src/cli/utils/__tests__/copy-files.test.ts +0 -1
- package/src/cli/utils/__tests__/eslint.test.ts +1 -1
- package/src/cli/utils/__tests__/lerna-exec.test.ts +1 -2
- package/src/cli/utils/__tests__/maybe-create-git-folder.test.ts +0 -1
- package/src/cli/utils/__tests__/set-node-options.test.ts +0 -1
- package/src/cli/utils/__tests__/stylelint.test.ts +1 -1
- package/src/cli/utils/bundle.ts +1 -3
- package/src/cli/utils/check-startup-location.ts +21 -0
- package/src/cli/utils/cli-npm.ts +22 -0
- package/src/cli/utils/compile-less.ts +1 -1
- package/src/cli/utils/constants.ts +1 -0
- package/src/cli/utils/copy-files.ts +0 -1
- package/src/cli/utils/eslint.ts +1 -3
- package/src/cli/utils/index.ts +2 -0
- package/src/cli/utils/lerna-exec.ts +0 -1
- package/src/cli/utils/stylelint.ts +1 -2
- package/src/index.ts +1 -1
- package/src/jest/svg-transformer.ts +0 -1
- package/src/utils/__tests__/get-branch-configs.test.ts +0 -1
- package/src/utils/__tests__/get-configuration.test.ts +0 -1
- package/src/utils/__tests__/get-destination-folders.test.ts +1 -2
- package/src/utils/__tests__/get-folders.test.ts +0 -1
- package/src/utils/__tests__/get-jest-config.test.ts +1 -2
- package/src/utils/__tests__/get-package-data.test.ts +1 -2
- package/src/utils/__tests__/get-packages.test.ts +1 -1
- package/src/utils/__tests__/get-startup-version.test.ts +0 -1
- package/src/utils/__tests__/get-tsconfig.test.ts +0 -1
- package/src/utils/__tests__/load-shared-dependencies.test.ts +1 -1
- package/src/utils/__tests__/log.test.ts +1 -1
- package/src/utils/__tests__/prettify.test.ts +80 -0
- package/src/utils/__tests__/read-json.test.ts +0 -1
- package/src/utils/find-packages.ts +1 -1
- package/src/utils/get-configuration.ts +8 -7
- package/src/utils/get-destination-folders.ts +0 -1
- package/src/utils/get-folders.ts +0 -1
- package/src/utils/get-jest-config.ts +1 -1
- package/src/utils/index.ts +1 -0
- package/src/utils/prettify.ts +36 -0
- package/src/webpack/__tests__/create-webpack-config-shared-dependencies.test.ts +6 -2
- package/src/webpack/__tests__/create-webpack-config-web-component.test.ts +7 -4
- package/src/webpack/__tests__/create-webpack-config.test.ts +8 -4
- package/src/webpack/configs/cache-config.ts +1 -1
- package/src/webpack/configs/plugins/assets-manifest-plugin.ts +1 -1
- package/src/webpack/configs/plugins/bundle-analyser-plugin.ts +2 -2
- package/src/webpack/configs/plugins/define-exposed-dependencies-plugin.ts +6 -15
- package/src/webpack/configs/plugins/ignore-plugin/__tests__/get-package-json.test.ts +1 -1
- package/src/webpack/configs/plugins/ignore-plugin/__tests__/is-optional-peer-dependency.test.ts +1 -1
- package/src/webpack/configs/plugins/ignore-plugin/ignore-plugin.ts +0 -1
- package/src/webpack/configs/plugins/watch-run-plugin.ts +0 -1
- package/src/webpack/configs/types.ts +1 -0
- package/src/webpack/configs/utils/__tests__/build-metadata.test.ts +71 -0
- package/src/webpack/configs/utils/__tests__/generate-metadata.test.ts +42 -46
- package/src/webpack/configs/utils/__tests__/get-exposed-dependencies.test.ts +39 -0
- package/src/webpack/configs/utils/__tests__/get-web-components-version.test.ts +0 -1
- package/src/webpack/configs/utils/build-metadata.ts +40 -0
- package/src/webpack/configs/utils/generate-metadata.ts +7 -21
- package/src/webpack/configs/utils/get-exposed-dependencies.ts +17 -0
- package/src/webpack/configs/utils/index.ts +1 -0
- package/src/webpack/create-webpack-config.ts +3 -3
- package/src/webpack/loaders/expose-loader/__tests__/index.test.ts +0 -2
- package/src/webpack/loaders/expose-loader/index.ts +0 -1
- package/src/webpack/utils/testing/get-compiler.ts +1 -3
- package/src/webpack/utils/testing/get-errors.ts +0 -1
- package/src/webpack/utils/testing/get-warnings.ts +0 -1
- package/src/webpack/utils/testing/read-asset.ts +1 -2
- package/src/webpack/utils/testing/read-assets.ts +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import path from 'path';
|
|
2
1
|
import fs from 'fs';
|
|
2
|
+
import path from 'path';
|
|
3
3
|
import {
|
|
4
4
|
getBranchesConfigs,
|
|
5
5
|
getFolders,
|
|
@@ -10,6 +10,7 @@ import {
|
|
|
10
10
|
} from '../../utils';
|
|
11
11
|
import { EntryPoint, EntryPoints, Metadata } from '../../webpack/configs';
|
|
12
12
|
import {
|
|
13
|
+
DRY_RUN_PREFIX,
|
|
13
14
|
getDefaultBuildVersion,
|
|
14
15
|
gitGetBranch,
|
|
15
16
|
gitGetCommitHash,
|
|
@@ -17,30 +18,60 @@ import {
|
|
|
17
18
|
npmPackageSet,
|
|
18
19
|
npmPublish,
|
|
19
20
|
npmTagVersion,
|
|
21
|
+
npmView,
|
|
20
22
|
runCommand,
|
|
21
23
|
} from '../utils';
|
|
22
|
-
import { Command,
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
24
|
+
import { Command, CommandOptions } from './types';
|
|
25
|
+
import { buildRollbackTag, DEFAULT_MFE_REGISTRY } from './utils';
|
|
26
|
+
|
|
27
|
+
export const mfePackagePublishOptions = {
|
|
28
|
+
branch: {
|
|
29
|
+
string: true,
|
|
30
|
+
description: 'Branch name to associate with published version',
|
|
31
|
+
defaultDescription: 'current git branch',
|
|
32
|
+
},
|
|
33
|
+
build: {
|
|
34
|
+
string: true,
|
|
35
|
+
description: 'Package version',
|
|
36
|
+
defaultDescription: '<branch_name>.<commit_hash>',
|
|
37
|
+
},
|
|
38
|
+
dry: {
|
|
39
|
+
boolean: true,
|
|
40
|
+
description: 'Take no action and only log what would be published',
|
|
41
|
+
},
|
|
42
|
+
force: {
|
|
43
|
+
boolean: true,
|
|
44
|
+
description: 'Force publishing from an unrecognized branch',
|
|
45
|
+
},
|
|
46
|
+
registry: { string: true, hidden: true, description: 'Registry url' },
|
|
47
|
+
trackHistory: {
|
|
48
|
+
boolean: true,
|
|
49
|
+
description: `Tag the previous release, to support rollbacks`,
|
|
50
|
+
defaultDescription: 'true',
|
|
51
|
+
hidden: true,
|
|
52
|
+
},
|
|
53
|
+
tag: {
|
|
54
|
+
string: true,
|
|
55
|
+
description: 'Tag to assign to published version',
|
|
56
|
+
},
|
|
57
|
+
uploadSourcemaps: {
|
|
58
|
+
boolean: true,
|
|
59
|
+
description: 'Upload source maps to Datadog?',
|
|
60
|
+
defaultDescription: 'true',
|
|
61
|
+
},
|
|
62
|
+
} satisfies CommandOptions;
|
|
33
63
|
|
|
34
64
|
interface PublishData {
|
|
35
65
|
buildVersion: string;
|
|
36
66
|
dry: boolean;
|
|
37
|
-
fallbackTag: string;
|
|
38
67
|
force: boolean;
|
|
39
68
|
isBranchConfigured: boolean;
|
|
40
69
|
registry: string;
|
|
41
70
|
tag: string;
|
|
42
71
|
uploadSourcemaps: boolean;
|
|
43
72
|
version: string;
|
|
73
|
+
trackHistory: boolean;
|
|
74
|
+
publishedTags: Record<string, string>;
|
|
44
75
|
}
|
|
45
76
|
|
|
46
77
|
interface PackageJson {
|
|
@@ -49,37 +80,8 @@ interface PackageJson {
|
|
|
49
80
|
files?: string[];
|
|
50
81
|
}
|
|
51
82
|
|
|
52
|
-
export class MFEPackagePublish extends Command<
|
|
53
|
-
static readonly options =
|
|
54
|
-
'branch': {
|
|
55
|
-
string: true,
|
|
56
|
-
description: 'Branch name to associate with published version',
|
|
57
|
-
defaultDescription: 'current git branch',
|
|
58
|
-
},
|
|
59
|
-
'build': {
|
|
60
|
-
string: true,
|
|
61
|
-
description: 'Package version',
|
|
62
|
-
defaultDescription: '<branch_name>.<commit_hash>',
|
|
63
|
-
},
|
|
64
|
-
'dry': {
|
|
65
|
-
boolean: true,
|
|
66
|
-
description: 'Take no action and only log what would be published',
|
|
67
|
-
},
|
|
68
|
-
'force': {
|
|
69
|
-
boolean: true,
|
|
70
|
-
description: 'Force publishing from an unrecognized branch',
|
|
71
|
-
},
|
|
72
|
-
'registry': { string: true, hidden: true, description: 'Registry url' },
|
|
73
|
-
'tag': {
|
|
74
|
-
string: true,
|
|
75
|
-
description: 'Tag to assign to published version',
|
|
76
|
-
},
|
|
77
|
-
'upload-source-maps': {
|
|
78
|
-
boolean: true,
|
|
79
|
-
description: 'Upload source maps to Datadog?',
|
|
80
|
-
defaultDescription: 'true',
|
|
81
|
-
},
|
|
82
|
-
};
|
|
83
|
+
export class MFEPackagePublish extends Command<typeof mfePackagePublishOptions> {
|
|
84
|
+
static readonly options = mfePackagePublishOptions;
|
|
83
85
|
|
|
84
86
|
@logErrors
|
|
85
87
|
async execute() {
|
|
@@ -88,14 +90,15 @@ export class MFEPackagePublish extends Command<Args> {
|
|
|
88
90
|
}
|
|
89
91
|
|
|
90
92
|
const packageJson = readJson<PackageJson>('package.json');
|
|
91
|
-
|
|
93
|
+
|
|
94
|
+
const data = this.getPublishData(packageJson.name);
|
|
92
95
|
if (!this.checkPackage(packageJson, data)) {
|
|
93
96
|
return;
|
|
94
97
|
}
|
|
95
98
|
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
+
await this.maybeApplyRollbackTag(packageJson.name, data);
|
|
100
|
+
|
|
101
|
+
await this.maybePublishPackage(packageJson, data);
|
|
99
102
|
|
|
100
103
|
if (data.uploadSourcemaps) {
|
|
101
104
|
this.uploadSourcemaps(data);
|
|
@@ -103,7 +106,7 @@ export class MFEPackagePublish extends Command<Args> {
|
|
|
103
106
|
}
|
|
104
107
|
|
|
105
108
|
private get dryRunPrefix() {
|
|
106
|
-
return this.args.dry ?
|
|
109
|
+
return this.args.dry ? DRY_RUN_PREFIX : '';
|
|
107
110
|
}
|
|
108
111
|
|
|
109
112
|
private checkPackage(packageJson: PackageJson, { force, isBranchConfigured }: PublishData) {
|
|
@@ -126,45 +129,53 @@ export class MFEPackagePublish extends Command<Args> {
|
|
|
126
129
|
return true;
|
|
127
130
|
}
|
|
128
131
|
|
|
129
|
-
private async
|
|
130
|
-
{
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
132
|
+
private async maybePublishPackage(packageJson: PackageJson, data: PublishData) {
|
|
133
|
+
try {
|
|
134
|
+
const { dry, registry, tag, version } = data;
|
|
135
|
+
|
|
136
|
+
const versions = npmGetPackageVersions(registry, packageJson.name);
|
|
137
|
+
if (versions.includes(version)) {
|
|
138
|
+
log.warning(
|
|
139
|
+
`${this.dryRunPrefix}${packageJson.name} version ${version} is already published, skipping publish`
|
|
140
|
+
);
|
|
141
|
+
|
|
142
|
+
log.info(`${this.dryRunPrefix}Tagging version ${version} with tag "${tag}"`);
|
|
143
|
+
|
|
144
|
+
if (!dry) {
|
|
145
|
+
await npmTagVersion({
|
|
146
|
+
packageName: packageJson.name,
|
|
147
|
+
packageVersion: version,
|
|
148
|
+
registry,
|
|
149
|
+
tag,
|
|
150
|
+
});
|
|
151
|
+
}
|
|
141
152
|
|
|
142
|
-
|
|
143
|
-
log.info(`${this.dryRunPrefix}adding tag "${tag}" to ${name} version ${version}`);
|
|
144
|
-
if (!dry) {
|
|
145
|
-
await npmTagVersion({
|
|
146
|
-
packageName: name,
|
|
147
|
-
packageVersion: version,
|
|
148
|
-
registry,
|
|
149
|
-
tag,
|
|
150
|
-
});
|
|
153
|
+
return;
|
|
151
154
|
}
|
|
152
|
-
}
|
|
153
|
-
return true;
|
|
154
|
-
}
|
|
155
155
|
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
156
|
+
this.validateMetadata(version);
|
|
157
|
+
|
|
158
|
+
await npmPackageSet('version', version);
|
|
159
|
+
await npmPackageSet('publishConfig.registry', registry);
|
|
160
|
+
await this.setPackageFiles(packageJson);
|
|
161
161
|
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
162
|
+
log.info(`${this.dryRunPrefix}Publishing ${packageJson.name} version ${version}`);
|
|
163
|
+
await npmPublish({ dry, tag });
|
|
164
|
+
} catch (error) {
|
|
165
|
+
log.error(`Failed to publish package ${packageJson.name}`);
|
|
165
166
|
|
|
166
|
-
|
|
167
|
-
|
|
167
|
+
const versionOriginallyTaggedWithRollback =
|
|
168
|
+
data.publishedTags[buildRollbackTag(data.tag)];
|
|
169
|
+
|
|
170
|
+
if (versionOriginallyTaggedWithRollback) {
|
|
171
|
+
await this.restoreRollbackTag(
|
|
172
|
+
packageJson.name,
|
|
173
|
+
data,
|
|
174
|
+
versionOriginallyTaggedWithRollback
|
|
175
|
+
);
|
|
176
|
+
}
|
|
177
|
+
throw error;
|
|
178
|
+
}
|
|
168
179
|
}
|
|
169
180
|
|
|
170
181
|
private uploadSourcemaps({ dry, version }: PublishData) {
|
|
@@ -175,26 +186,28 @@ export class MFEPackagePublish extends Command<Args> {
|
|
|
175
186
|
runCommand(`npx startup upload-sourcemaps ${options.join(' ')}`);
|
|
176
187
|
}
|
|
177
188
|
|
|
178
|
-
private getPublishData(): PublishData {
|
|
189
|
+
private getPublishData(packageName: string): PublishData {
|
|
179
190
|
const cli = this.args;
|
|
180
191
|
const branch = cli.branch ?? gitGetBranch();
|
|
181
192
|
const branchConfig = getBranchesConfigs()[branch];
|
|
182
193
|
|
|
183
194
|
// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
|
|
184
195
|
const buildVersion = cli.build || getDefaultBuildVersion(branch, gitGetCommitHash());
|
|
185
|
-
const registry = cli.registry ??
|
|
196
|
+
const registry = cli.registry ?? DEFAULT_MFE_REGISTRY;
|
|
186
197
|
const tag = cli.tag ?? branchConfig?.publishTag ?? '';
|
|
187
198
|
const uploadSourcemaps = cli.uploadSourcemaps ?? branchConfig?.uploadSourcemaps ?? true;
|
|
188
199
|
const version = '0.0.0-' + buildVersion;
|
|
200
|
+
const publishedTags = npmView({ packageName, registry })?.['dist-tags'] ?? {};
|
|
189
201
|
|
|
190
202
|
return {
|
|
191
203
|
buildVersion,
|
|
192
204
|
dry: !!cli.dry,
|
|
193
|
-
fallbackTag: 'latest',
|
|
194
205
|
force: !!cli.force,
|
|
195
206
|
isBranchConfigured: !!branchConfig,
|
|
207
|
+
publishedTags,
|
|
196
208
|
registry,
|
|
197
|
-
tag,
|
|
209
|
+
tag: tag || 'latest',
|
|
210
|
+
trackHistory: cli.trackHistory ?? true,
|
|
198
211
|
uploadSourcemaps,
|
|
199
212
|
version,
|
|
200
213
|
};
|
|
@@ -263,4 +276,57 @@ export class MFEPackagePublish extends Command<Args> {
|
|
|
263
276
|
});
|
|
264
277
|
});
|
|
265
278
|
}
|
|
279
|
+
|
|
280
|
+
private async maybeApplyRollbackTag(packageName: string, data: PublishData) {
|
|
281
|
+
const { dry, registry, tag, trackHistory, version, publishedTags } = data;
|
|
282
|
+
|
|
283
|
+
if (!trackHistory) {
|
|
284
|
+
log.info('Track history is turned off, skipping rollback tag');
|
|
285
|
+
return;
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
const previousVersion = publishedTags[tag];
|
|
289
|
+
|
|
290
|
+
if (!previousVersion) {
|
|
291
|
+
log.info(`No previous version published with tag "${tag}", skipping rollback tag`);
|
|
292
|
+
return;
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
if (previousVersion === version) {
|
|
296
|
+
log.info(`Version "${version}" is already tagged "${tag}", skipping rollback tag`);
|
|
297
|
+
return;
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
const prevTag = buildRollbackTag(tag);
|
|
301
|
+
|
|
302
|
+
log.info(
|
|
303
|
+
`${this.dryRunPrefix}Tagging previous version ${previousVersion} with tag "${prevTag}"`
|
|
304
|
+
);
|
|
305
|
+
|
|
306
|
+
if (!dry) {
|
|
307
|
+
await npmTagVersion({
|
|
308
|
+
packageName,
|
|
309
|
+
packageVersion: previousVersion,
|
|
310
|
+
registry,
|
|
311
|
+
tag: prevTag,
|
|
312
|
+
});
|
|
313
|
+
}
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
private async restoreRollbackTag(
|
|
317
|
+
packageName: string,
|
|
318
|
+
{ registry, tag }: PublishData,
|
|
319
|
+
version: string
|
|
320
|
+
) {
|
|
321
|
+
const rollbackTag = buildRollbackTag(tag);
|
|
322
|
+
|
|
323
|
+
log.info(`Restoring rollback tag ${rollbackTag} back to version ${version}`);
|
|
324
|
+
|
|
325
|
+
await npmTagVersion({
|
|
326
|
+
packageName,
|
|
327
|
+
packageVersion: version,
|
|
328
|
+
registry,
|
|
329
|
+
tag: rollbackTag,
|
|
330
|
+
});
|
|
331
|
+
}
|
|
266
332
|
}
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import { log, logErrors, readJson } from '../../utils';
|
|
2
|
+
import { DRY_RUN_PREFIX, npmTagVersion, npmView } from '../utils';
|
|
3
|
+
import { Command, CommandOptions } from './types';
|
|
4
|
+
import { buildRollbackTag, DEFAULT_MFE_REGISTRY } from './utils';
|
|
5
|
+
|
|
6
|
+
export const mfePackageRollbackOptions = {
|
|
7
|
+
dry: {
|
|
8
|
+
boolean: true,
|
|
9
|
+
description: 'Take no action and only log what would be rolled back',
|
|
10
|
+
},
|
|
11
|
+
registry: {
|
|
12
|
+
string: true,
|
|
13
|
+
hidden: true,
|
|
14
|
+
description: 'Registry url',
|
|
15
|
+
},
|
|
16
|
+
tag: {
|
|
17
|
+
string: true,
|
|
18
|
+
description: 'The tag to rollback to its previous version',
|
|
19
|
+
required: true,
|
|
20
|
+
},
|
|
21
|
+
} satisfies CommandOptions;
|
|
22
|
+
|
|
23
|
+
interface PackageJson {
|
|
24
|
+
name: string;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export class MFEPackageRollback extends Command<typeof mfePackageRollbackOptions> {
|
|
28
|
+
static readonly description = 'Rollback a package to a previous tagged version';
|
|
29
|
+
|
|
30
|
+
static readonly options = mfePackageRollbackOptions;
|
|
31
|
+
|
|
32
|
+
private get dryRunPrefix() {
|
|
33
|
+
return this.args.dry ? DRY_RUN_PREFIX : '';
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
@logErrors
|
|
37
|
+
async execute() {
|
|
38
|
+
if (this.args.dry) {
|
|
39
|
+
log.warning('DRY-RUN MODE ENABLED, WILL NOT PERFORM ROLLBACK');
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
await this.handleRollback();
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
private async handleRollback() {
|
|
46
|
+
const { tag, registry = DEFAULT_MFE_REGISTRY, dry } = this.args;
|
|
47
|
+
|
|
48
|
+
const packageJson = readJson<PackageJson>('package.json');
|
|
49
|
+
const packageName = packageJson.name;
|
|
50
|
+
|
|
51
|
+
log.info(`${this.dryRunPrefix}Rolling back ${packageName} for tag "${tag}"`);
|
|
52
|
+
|
|
53
|
+
const packageInfo = npmView({ packageName, registry });
|
|
54
|
+
if (!packageInfo) {
|
|
55
|
+
throw new Error(`Package ${packageName} not found in registry`);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
const distTags = packageInfo?.['dist-tags'] ?? {};
|
|
59
|
+
|
|
60
|
+
const rollbackTag = buildRollbackTag(tag);
|
|
61
|
+
const rollbackVersion = distTags[rollbackTag];
|
|
62
|
+
|
|
63
|
+
if (!rollbackVersion) {
|
|
64
|
+
throw new Error(
|
|
65
|
+
`No rollback version found for tag "${tag}" (looking for "${rollbackTag}")`
|
|
66
|
+
);
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
log.info(
|
|
70
|
+
`${this.dryRunPrefix}Found rollback version ${rollbackVersion} for tag "${rollbackTag}"`
|
|
71
|
+
);
|
|
72
|
+
|
|
73
|
+
const currentVersion = distTags[tag];
|
|
74
|
+
if (currentVersion === rollbackVersion) {
|
|
75
|
+
log.info(
|
|
76
|
+
`${this.dryRunPrefix}Tags "${tag}" and "${rollbackTag}" both point to version ${rollbackVersion}, skipping rollback`
|
|
77
|
+
);
|
|
78
|
+
return;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
if (currentVersion) {
|
|
82
|
+
log.info(
|
|
83
|
+
`${this.dryRunPrefix}Current tag "${tag}" points to version ${currentVersion}`
|
|
84
|
+
);
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
log.info(
|
|
88
|
+
`${this.dryRunPrefix}Rolling back ${packageName} tag "${tag}" to version ${rollbackVersion}`
|
|
89
|
+
);
|
|
90
|
+
|
|
91
|
+
if (!dry) {
|
|
92
|
+
await npmTagVersion({
|
|
93
|
+
packageName,
|
|
94
|
+
packageVersion: rollbackVersion,
|
|
95
|
+
registry,
|
|
96
|
+
tag,
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
}
|
|
@@ -1,19 +1,40 @@
|
|
|
1
1
|
import { getPackages, isWebComponent, logErrors, PackageType } from '../../utils';
|
|
2
|
-
import { Args as CleanArgs, MFEPackageClean } from './mfe-package-clean';
|
|
3
|
-
import { Args as PublishArgs, MFEPackagePublish } from './mfe-package-publish';
|
|
4
|
-
import { Command } from './types';
|
|
5
2
|
import { lernaExec } from '../utils';
|
|
3
|
+
import { mfePackageCleanOptions } from './mfe-package-clean';
|
|
4
|
+
import { mfePackagePublishOptions } from './mfe-package-publish';
|
|
5
|
+
import { mfePackageRollbackOptions } from './mfe-package-rollback';
|
|
6
|
+
import { Command, CommandOptions } from './types';
|
|
6
7
|
|
|
7
|
-
|
|
8
|
-
clean
|
|
9
|
-
concurrency
|
|
10
|
-
|
|
11
|
-
|
|
8
|
+
const mfePublishOwnOptions = {
|
|
9
|
+
clean: { boolean: true, description: 'Unpublish old versions' },
|
|
10
|
+
concurrency: {
|
|
11
|
+
number: true,
|
|
12
|
+
description: 'Publish/unpublish the specified number of packages concurrently',
|
|
13
|
+
defaultDescription: '1',
|
|
14
|
+
},
|
|
15
|
+
rollback: {
|
|
16
|
+
boolean: true,
|
|
17
|
+
description: 'Rollback specified tag to the previous version',
|
|
18
|
+
},
|
|
19
|
+
scope: {
|
|
20
|
+
array: true,
|
|
21
|
+
string: true,
|
|
22
|
+
description: 'Publish/unpublish only the specified packages',
|
|
23
|
+
},
|
|
24
|
+
} satisfies CommandOptions;
|
|
25
|
+
|
|
26
|
+
type MFEPublishOptions = typeof mfePublishOwnOptions &
|
|
27
|
+
typeof mfePackagePublishOptions &
|
|
28
|
+
typeof mfePackageCleanOptions &
|
|
29
|
+
// make 'tag' not required for mfe-publish args, since it is only required for rollback
|
|
30
|
+
Omit<typeof mfePackageRollbackOptions, 'tag'> & {
|
|
31
|
+
tag: Omit<typeof mfePackageRollbackOptions.tag, 'required'>;
|
|
32
|
+
};
|
|
12
33
|
|
|
13
|
-
export class MFEPublish extends Command<
|
|
34
|
+
export class MFEPublish extends Command<MFEPublishOptions> {
|
|
14
35
|
static readonly description = 'Publish or unpublish MFE packages';
|
|
15
36
|
static get options() {
|
|
16
|
-
const publishOptions = Object.entries(
|
|
37
|
+
const publishOptions = Object.entries(mfePackagePublishOptions).reduce(
|
|
17
38
|
(result, [key, value]) => {
|
|
18
39
|
result[key] = { group: 'Publish Options:', ...value };
|
|
19
40
|
return result;
|
|
@@ -21,9 +42,10 @@ export class MFEPublish extends Command<Args> {
|
|
|
21
42
|
{} as NonNullable<typeof Command.options>
|
|
22
43
|
);
|
|
23
44
|
|
|
24
|
-
const cleanOptions = Object.entries(
|
|
45
|
+
const cleanOptions = Object.entries(mfePackageCleanOptions).reduce(
|
|
25
46
|
(result, [key, value]) => {
|
|
26
|
-
|
|
47
|
+
// no-break space suffix prevents key collisions
|
|
48
|
+
result[`${key}\u00A0`] = {
|
|
27
49
|
group: 'Clean Options:',
|
|
28
50
|
...value,
|
|
29
51
|
};
|
|
@@ -32,19 +54,26 @@ export class MFEPublish extends Command<Args> {
|
|
|
32
54
|
{} as NonNullable<typeof Command.options>
|
|
33
55
|
);
|
|
34
56
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
57
|
+
const rollbackOptions = Object.entries(mfePackageRollbackOptions).reduce(
|
|
58
|
+
(result, [key, value]) => {
|
|
59
|
+
const optionProps = Object.fromEntries(
|
|
60
|
+
Object.entries(value).filter(([k]) => k !== 'required')
|
|
61
|
+
);
|
|
62
|
+
// double no-break space suffix prevents key collisions
|
|
63
|
+
result[`${key}\u00A0\u00A0`] = {
|
|
64
|
+
group: 'Rollback Options:',
|
|
65
|
+
...optionProps,
|
|
66
|
+
};
|
|
67
|
+
return result;
|
|
45
68
|
},
|
|
69
|
+
{} as NonNullable<typeof Command.options>
|
|
70
|
+
);
|
|
71
|
+
|
|
72
|
+
return {
|
|
73
|
+
...mfePublishOwnOptions,
|
|
46
74
|
...publishOptions,
|
|
47
75
|
...cleanOptions,
|
|
76
|
+
...rollbackOptions,
|
|
48
77
|
};
|
|
49
78
|
}
|
|
50
79
|
|
|
@@ -58,33 +87,57 @@ export class MFEPublish extends Command<Args> {
|
|
|
58
87
|
throw new Error('no packages found for publication');
|
|
59
88
|
}
|
|
60
89
|
|
|
90
|
+
const isRollback = !!this.args.rollback;
|
|
61
91
|
const isClean = !!this.args.clean;
|
|
92
|
+
|
|
93
|
+
let cmdSuffix: string;
|
|
94
|
+
let options: string[];
|
|
95
|
+
|
|
96
|
+
if (isRollback) {
|
|
97
|
+
cmdSuffix = 'rollback';
|
|
98
|
+
options = this.getRollbackOptions();
|
|
99
|
+
} else {
|
|
100
|
+
cmdSuffix = isClean ? 'clean' : 'publish';
|
|
101
|
+
options = isClean ? this.getCleanOptions() : this.getPublishOptions();
|
|
102
|
+
}
|
|
103
|
+
|
|
62
104
|
await lernaExec({
|
|
63
|
-
'cmd': `startup mfe-package-${
|
|
105
|
+
'cmd': `startup mfe-package-${cmdSuffix}`,
|
|
64
106
|
'parallel': this.args.concurrency ?? 1,
|
|
65
107
|
'scope': packages.map(({ name }) => name),
|
|
66
108
|
'stream': true,
|
|
67
|
-
'--':
|
|
109
|
+
'--': options,
|
|
68
110
|
});
|
|
69
111
|
}
|
|
70
112
|
|
|
71
113
|
getPublishOptions() {
|
|
72
|
-
const { build, branch, dry, force, registry, tag, uploadSourcemaps } =
|
|
73
|
-
.args
|
|
114
|
+
const { build, branch, dry, force, registry, tag, uploadSourcemaps, trackHistory } =
|
|
115
|
+
this.args;
|
|
74
116
|
return [
|
|
75
117
|
...[branch && `--branch ${branch}`],
|
|
76
118
|
...[build && `--build ${build}`],
|
|
77
119
|
...[dry && '--dry'],
|
|
78
120
|
...[force && '--force'],
|
|
79
121
|
...[registry && `--registry ${registry}`],
|
|
122
|
+
...[trackHistory === true && '--track-history'],
|
|
123
|
+
...[trackHistory === false && '--no-track-history'],
|
|
80
124
|
...[typeof tag === 'string' && `--tag ${tag}`],
|
|
81
125
|
...[uploadSourcemaps === true && `--upload-sourcemaps`],
|
|
82
126
|
...[uploadSourcemaps === false && `--no-upload-sourcemaps`],
|
|
83
127
|
].filter(item => !!item) as string[];
|
|
84
128
|
}
|
|
85
129
|
|
|
130
|
+
getRollbackOptions() {
|
|
131
|
+
const { dry, registry, tag } = this.args;
|
|
132
|
+
return [
|
|
133
|
+
...[dry && '--dry'],
|
|
134
|
+
...[registry && `--registry ${registry}`],
|
|
135
|
+
...[typeof tag === 'string' && `--tag ${tag}`],
|
|
136
|
+
].filter(item => !!item) as string[];
|
|
137
|
+
}
|
|
138
|
+
|
|
86
139
|
getCleanOptions() {
|
|
87
|
-
const { all, branch, count, dry, registry } = this.args
|
|
140
|
+
const { all, branch, count, dry, registry } = this.args;
|
|
88
141
|
return [
|
|
89
142
|
...[all && '--all'],
|
|
90
143
|
...[typeof branch === 'string' && `--branch ${branch}`],
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import { logErrors } from '../../utils';
|
|
2
2
|
import { copyFiles } from '../utils';
|
|
3
|
-
import { Command,
|
|
3
|
+
import { Command, CommandOptions } from './types';
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
watch
|
|
7
|
-
}
|
|
5
|
+
const options = {
|
|
6
|
+
watch: { boolean: true, hidden: true },
|
|
7
|
+
} satisfies CommandOptions;
|
|
8
8
|
|
|
9
|
-
export class PreparePackage extends Command<
|
|
9
|
+
export class PreparePackage extends Command<typeof options> {
|
|
10
|
+
static readonly options = options;
|
|
10
11
|
@logErrors
|
|
11
12
|
execute() {
|
|
12
13
|
return copyFiles({ watch: this.args.watch });
|