@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
|
@@ -8,15 +8,20 @@ import {
|
|
|
8
8
|
npmPackageSet,
|
|
9
9
|
npmPublish,
|
|
10
10
|
npmTagVersion,
|
|
11
|
+
npmView,
|
|
11
12
|
runCommand,
|
|
12
13
|
} from '../../utils';
|
|
13
14
|
import { MFEPackagePublish } from '../mfe-package-publish';
|
|
15
|
+
import { ROLLBACK_TAG_SUFFIX } from '../utils';
|
|
14
16
|
|
|
15
17
|
jest.mock('fs', () => fs);
|
|
18
|
+
jest.mock('yargs', () => jest.fn());
|
|
19
|
+
jest.mock('yargs/helpers', () => ({ hideBin: jest.fn() }));
|
|
20
|
+
|
|
16
21
|
jest.mock('../../../utils', () => ({
|
|
17
22
|
...jest.requireActual('../../../utils'),
|
|
18
23
|
isWebComponent: jest.fn(),
|
|
19
|
-
log: { info: jest.fn(), warning: jest.fn() },
|
|
24
|
+
log: { info: jest.fn(), warning: jest.fn(), error: jest.fn() },
|
|
20
25
|
}));
|
|
21
26
|
jest.mock('../../utils', () => ({
|
|
22
27
|
...jest.requireActual('../../utils'),
|
|
@@ -26,17 +31,22 @@ jest.mock('../../utils', () => ({
|
|
|
26
31
|
npmPackageSet: jest.fn(),
|
|
27
32
|
npmPublish: jest.fn(),
|
|
28
33
|
npmTagVersion: jest.fn(),
|
|
34
|
+
npmView: jest.fn(),
|
|
29
35
|
runCommand: jest.fn(),
|
|
30
36
|
}));
|
|
31
37
|
|
|
32
38
|
describe(`[startup] ${MFEPackagePublish.name}`, () => {
|
|
33
39
|
const defaultRegistry = 'https://verdaccio.servicetitan.com';
|
|
34
40
|
const branch = 'master';
|
|
41
|
+
const tag = 'prod';
|
|
42
|
+
const rollbackTag = `${tag}${ROLLBACK_TAG_SUFFIX}`;
|
|
43
|
+
const previousVersion = 'bar';
|
|
35
44
|
const commitHash = '6c461f1a';
|
|
36
45
|
const packageName = '@servicetitan/foo';
|
|
37
46
|
let args: ConstructorParameters<typeof MFEPackagePublish>[0];
|
|
38
47
|
|
|
39
|
-
const
|
|
48
|
+
const buildPackageVersion = (branchOverride?: string) =>
|
|
49
|
+
`0.0.0-${branchOverride ?? branch}.${commitHash}`;
|
|
40
50
|
|
|
41
51
|
beforeEach(() => {
|
|
42
52
|
args = {};
|
|
@@ -45,6 +55,13 @@ describe(`[startup] ${MFEPackagePublish.name}`, () => {
|
|
|
45
55
|
jest.mocked(gitGetBranch).mockReturnValue(branch);
|
|
46
56
|
jest.mocked(gitGetCommitHash).mockReturnValue(commitHash);
|
|
47
57
|
jest.mocked(npmGetPackageVersions).mockReturnValue([]);
|
|
58
|
+
jest.mocked(npmPublish).mockResolvedValue(undefined);
|
|
59
|
+
jest.mocked(npmTagVersion).mockResolvedValue(undefined);
|
|
60
|
+
jest.mocked(npmView).mockReturnValue({
|
|
61
|
+
'name': packageName,
|
|
62
|
+
'version': previousVersion,
|
|
63
|
+
'dist-tags': { [tag]: previousVersion },
|
|
64
|
+
});
|
|
48
65
|
vol.fromNestedJSON({
|
|
49
66
|
'package.json': JSON.stringify({ name: packageName, files: [] }),
|
|
50
67
|
'tsconfig.json': JSON.stringify({
|
|
@@ -78,7 +95,7 @@ describe(`[startup] ${MFEPackagePublish.name}`, () => {
|
|
|
78
95
|
test('sets package version', async () => {
|
|
79
96
|
await subject();
|
|
80
97
|
|
|
81
|
-
expect(npmPackageSet).toHaveBeenCalledWith('version',
|
|
98
|
+
expect(npmPackageSet).toHaveBeenCalledWith('version', buildPackageVersion());
|
|
82
99
|
});
|
|
83
100
|
|
|
84
101
|
test('sets package registry', async () => {
|
|
@@ -92,17 +109,7 @@ describe(`[startup] ${MFEPackagePublish.name}`, () => {
|
|
|
92
109
|
|
|
93
110
|
const metadata = JSON.parse(fs.readFileSync('dist/metadata.json', 'utf8').toString());
|
|
94
111
|
|
|
95
|
-
expect(metadata.version).toBe(
|
|
96
|
-
});
|
|
97
|
-
|
|
98
|
-
describe('with "registry" argument', () => {
|
|
99
|
-
beforeEach(() => (args.registry = 'https://foo'));
|
|
100
|
-
|
|
101
|
-
test('sets package registry to specified value', async () => {
|
|
102
|
-
await subject();
|
|
103
|
-
|
|
104
|
-
expect(npmPackageSet).toHaveBeenCalledWith('publishConfig.registry', args.registry);
|
|
105
|
-
});
|
|
112
|
+
expect(metadata.version).toBe(buildPackageVersion());
|
|
106
113
|
});
|
|
107
114
|
|
|
108
115
|
test('publishes package and logs message', async () => {
|
|
@@ -110,7 +117,7 @@ describe(`[startup] ${MFEPackagePublish.name}`, () => {
|
|
|
110
117
|
|
|
111
118
|
expect(npmPublish).toHaveBeenCalled();
|
|
112
119
|
expect(log.info).toHaveBeenCalledWith(
|
|
113
|
-
expect.stringContaining(`
|
|
120
|
+
expect.stringContaining(`Publishing ${packageName} version ${buildPackageVersion()}`)
|
|
114
121
|
);
|
|
115
122
|
});
|
|
116
123
|
|
|
@@ -118,39 +125,31 @@ describe(`[startup] ${MFEPackagePublish.name}`, () => {
|
|
|
118
125
|
await subject();
|
|
119
126
|
|
|
120
127
|
expect(runCommand).toHaveBeenCalledWith(
|
|
121
|
-
`npx startup upload-sourcemaps --releaseVersion=${
|
|
128
|
+
`npx startup upload-sourcemaps --releaseVersion=${buildPackageVersion()}`
|
|
122
129
|
);
|
|
123
130
|
});
|
|
124
131
|
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
await subject();
|
|
132
|
+
test('gets current tagged versions before publishing', async () => {
|
|
133
|
+
await subject();
|
|
128
134
|
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
135
|
+
expect(npmView).toHaveBeenCalledWith({
|
|
136
|
+
packageName,
|
|
137
|
+
registry: defaultRegistry,
|
|
132
138
|
});
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
describe('with "uploadSourcemaps: false"', () => {
|
|
136
|
-
beforeEach(() => (args.uploadSourcemaps = false));
|
|
137
|
-
|
|
138
|
-
itDoesNotUploadSourcemaps();
|
|
139
139
|
});
|
|
140
140
|
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
}),
|
|
150
|
-
})
|
|
151
|
-
);
|
|
141
|
+
test(`tags previous version with {tag}${ROLLBACK_TAG_SUFFIX}`, async () => {
|
|
142
|
+
await subject();
|
|
143
|
+
expect(npmTagVersion).toHaveBeenCalledWith({
|
|
144
|
+
packageName,
|
|
145
|
+
packageVersion: previousVersion,
|
|
146
|
+
registry: defaultRegistry,
|
|
147
|
+
tag: rollbackTag,
|
|
148
|
+
});
|
|
152
149
|
|
|
153
|
-
|
|
150
|
+
expect(log.info).toHaveBeenCalledWith(
|
|
151
|
+
`Tagging previous version ${previousVersion} with tag "${rollbackTag}"`
|
|
152
|
+
);
|
|
154
153
|
});
|
|
155
154
|
|
|
156
155
|
Object.entries({ dev: ['dev', 'develop'], next: ['next'], prod: ['master'] }).forEach(
|
|
@@ -167,34 +166,25 @@ describe(`[startup] ${MFEPackagePublish.name}`, () => {
|
|
|
167
166
|
}
|
|
168
167
|
);
|
|
169
168
|
|
|
170
|
-
describe('with "
|
|
171
|
-
beforeEach(() => (args.
|
|
169
|
+
describe('with "registry" argument', () => {
|
|
170
|
+
beforeEach(() => (args.registry = 'https://foo'));
|
|
172
171
|
|
|
173
|
-
test('
|
|
172
|
+
test('sets package registry to specified value', async () => {
|
|
174
173
|
await subject();
|
|
175
174
|
|
|
176
|
-
expect(
|
|
175
|
+
expect(npmPackageSet).toHaveBeenCalledWith('publishConfig.registry', args.registry);
|
|
177
176
|
});
|
|
178
177
|
});
|
|
179
178
|
|
|
180
|
-
describe('
|
|
181
|
-
const
|
|
179
|
+
describe('with "tag" argument', () => {
|
|
180
|
+
const tag = 'foo';
|
|
182
181
|
|
|
183
|
-
beforeEach(() =>
|
|
184
|
-
vol.fromJSON({
|
|
185
|
-
'package.json': JSON.stringify({
|
|
186
|
-
name: packageName,
|
|
187
|
-
cli: { 'web-component': { branches: { [branch]: branchConfig } } },
|
|
188
|
-
}),
|
|
189
|
-
})
|
|
190
|
-
);
|
|
182
|
+
beforeEach(() => (args.tag = tag));
|
|
191
183
|
|
|
192
|
-
test('uses
|
|
184
|
+
test('uses specified tag', async () => {
|
|
193
185
|
await subject();
|
|
194
186
|
|
|
195
|
-
expect(npmPublish).toHaveBeenCalledWith(
|
|
196
|
-
expect.objectContaining({ tag: branchConfig.publishTag })
|
|
197
|
-
);
|
|
187
|
+
expect(npmPublish).toHaveBeenCalledWith(expect.objectContaining({ tag: args.tag }));
|
|
198
188
|
});
|
|
199
189
|
});
|
|
200
190
|
|
|
@@ -225,21 +215,201 @@ describe(`[startup] ${MFEPackagePublish.name}`, () => {
|
|
|
225
215
|
);
|
|
226
216
|
});
|
|
227
217
|
|
|
228
|
-
test('logs
|
|
218
|
+
test('logs messages', async () => {
|
|
229
219
|
await subject();
|
|
230
220
|
|
|
231
221
|
expect(log.info).toHaveBeenCalledWith(
|
|
232
222
|
expect.stringContaining(
|
|
233
|
-
`(dry-run)
|
|
223
|
+
`(dry-run) Publishing ${packageName} version ${buildPackageVersion()}`
|
|
234
224
|
)
|
|
235
225
|
);
|
|
226
|
+
expect(log.info).toHaveBeenCalledWith(
|
|
227
|
+
`(dry-run) Tagging previous version ${previousVersion} with tag "${rollbackTag}"`
|
|
228
|
+
);
|
|
229
|
+
});
|
|
230
|
+
|
|
231
|
+
test('does not tag previous version', async () => {
|
|
232
|
+
await subject();
|
|
233
|
+
|
|
234
|
+
expect(npmTagVersion).not.toHaveBeenCalled();
|
|
236
235
|
});
|
|
237
236
|
|
|
238
237
|
test('uploads sourcemaps with "--dry" option', async () => {
|
|
239
238
|
await subject();
|
|
240
239
|
|
|
241
240
|
expect(runCommand).toHaveBeenCalledWith(
|
|
242
|
-
`npx startup upload-sourcemaps --dry --releaseVersion=${
|
|
241
|
+
`npx startup upload-sourcemaps --dry --releaseVersion=${buildPackageVersion()}`
|
|
242
|
+
);
|
|
243
|
+
});
|
|
244
|
+
});
|
|
245
|
+
|
|
246
|
+
function itDoesNotUploadSourcemaps() {
|
|
247
|
+
test('does not upload sourcemaps', async () => {
|
|
248
|
+
await subject();
|
|
249
|
+
|
|
250
|
+
expect(runCommand).not.toHaveBeenCalledWith(
|
|
251
|
+
expect.stringContaining('upload-sourcemaps')
|
|
252
|
+
);
|
|
253
|
+
});
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
describe('with "uploadSourcemaps: false"', () => {
|
|
257
|
+
beforeEach(() => (args.uploadSourcemaps = false));
|
|
258
|
+
|
|
259
|
+
itDoesNotUploadSourcemaps();
|
|
260
|
+
});
|
|
261
|
+
|
|
262
|
+
describe('when branch configuration includes "uploadSourcemaps: false"', () => {
|
|
263
|
+
beforeEach(() =>
|
|
264
|
+
vol.fromJSON({
|
|
265
|
+
'package.json': JSON.stringify({
|
|
266
|
+
name: packageName,
|
|
267
|
+
cli: {
|
|
268
|
+
'web-component': { branches: { [branch]: { uploadSourcemaps: false } } },
|
|
269
|
+
},
|
|
270
|
+
}),
|
|
271
|
+
})
|
|
272
|
+
);
|
|
273
|
+
|
|
274
|
+
itDoesNotUploadSourcemaps();
|
|
275
|
+
});
|
|
276
|
+
|
|
277
|
+
describe('with "trackHistory: false"', () => {
|
|
278
|
+
beforeEach(() => {
|
|
279
|
+
args.trackHistory = false;
|
|
280
|
+
});
|
|
281
|
+
|
|
282
|
+
test('skips tagging rollback and logs', async () => {
|
|
283
|
+
await subject();
|
|
284
|
+
|
|
285
|
+
expect(npmTagVersion).not.toHaveBeenCalled();
|
|
286
|
+
expect(log.info).toHaveBeenCalledWith(
|
|
287
|
+
'Track history is turned off, skipping rollback tag'
|
|
288
|
+
);
|
|
289
|
+
});
|
|
290
|
+
});
|
|
291
|
+
|
|
292
|
+
describe('when no previous version exists', () => {
|
|
293
|
+
beforeEach(() => {
|
|
294
|
+
jest.mocked(npmView).mockReturnValue({
|
|
295
|
+
'name': packageName,
|
|
296
|
+
'version': previousVersion,
|
|
297
|
+
'dist-tags': {},
|
|
298
|
+
});
|
|
299
|
+
});
|
|
300
|
+
|
|
301
|
+
test('skips tagging rollback and logs', async () => {
|
|
302
|
+
await subject();
|
|
303
|
+
|
|
304
|
+
expect(npmTagVersion).not.toHaveBeenCalled();
|
|
305
|
+
expect(log.info).toHaveBeenCalledWith(
|
|
306
|
+
`No previous version published with tag "${tag}", skipping rollback tag`
|
|
307
|
+
);
|
|
308
|
+
});
|
|
309
|
+
});
|
|
310
|
+
|
|
311
|
+
describe('when previous version equals current version', () => {
|
|
312
|
+
beforeEach(() => {
|
|
313
|
+
args.build = 'same-version';
|
|
314
|
+
jest.mocked(npmView).mockReturnValue({
|
|
315
|
+
'name': packageName,
|
|
316
|
+
'version': `0.0.0-${args.build}`,
|
|
317
|
+
'dist-tags': { [tag]: `0.0.0-${args.build}` },
|
|
318
|
+
});
|
|
319
|
+
});
|
|
320
|
+
|
|
321
|
+
test('skips tagging rollback and logs', async () => {
|
|
322
|
+
await subject();
|
|
323
|
+
|
|
324
|
+
expect(npmTagVersion).not.toHaveBeenCalled();
|
|
325
|
+
expect(log.info).not.toHaveBeenCalledWith(
|
|
326
|
+
expect.stringContaining('Tagging previous version')
|
|
327
|
+
);
|
|
328
|
+
expect(log.info).toHaveBeenCalledWith(
|
|
329
|
+
`Version "0.0.0-${args.build}" is already tagged "${tag}", skipping rollback tag`
|
|
330
|
+
);
|
|
331
|
+
});
|
|
332
|
+
});
|
|
333
|
+
|
|
334
|
+
describe('when tagging rollback fails', () => {
|
|
335
|
+
const error = new Error('Failed to apply rollback tag');
|
|
336
|
+
|
|
337
|
+
beforeEach(() => {
|
|
338
|
+
jest.mocked(npmTagVersion).mockRejectedValue(error);
|
|
339
|
+
});
|
|
340
|
+
|
|
341
|
+
test('throws error and skips publishing', async () => {
|
|
342
|
+
jest.spyOn(process.stdout, 'write').mockImplementation(jest.fn()); // suppress error output
|
|
343
|
+
await expect(subject).rejects.toThrow(error);
|
|
344
|
+
|
|
345
|
+
expect(npmPublish).not.toHaveBeenCalled();
|
|
346
|
+
expect(runCommand).not.toHaveBeenCalled();
|
|
347
|
+
});
|
|
348
|
+
});
|
|
349
|
+
|
|
350
|
+
describe('when publish fails after rollback tag is applied', () => {
|
|
351
|
+
const currentTaggedVersion = 'current-v2.0.0';
|
|
352
|
+
const rollbackTaggedVersion = 'original-rollback-v1.0.0';
|
|
353
|
+
const error = new Error('Publish failed');
|
|
354
|
+
|
|
355
|
+
beforeEach(() => {
|
|
356
|
+
jest.mocked(npmView).mockReturnValueOnce({
|
|
357
|
+
'name': packageName,
|
|
358
|
+
'version': 'some-version',
|
|
359
|
+
'dist-tags': {
|
|
360
|
+
[tag]: currentTaggedVersion,
|
|
361
|
+
[rollbackTag]: rollbackTaggedVersion,
|
|
362
|
+
},
|
|
363
|
+
});
|
|
364
|
+
|
|
365
|
+
jest.mocked(npmPublish).mockRejectedValue(error);
|
|
366
|
+
});
|
|
367
|
+
|
|
368
|
+
test('restores rollback tag to the version it started on', async () => {
|
|
369
|
+
jest.spyOn(process.stdout, 'write').mockImplementation(jest.fn()); // suppress error output
|
|
370
|
+
|
|
371
|
+
await expect(subject).rejects.toThrow(error.message);
|
|
372
|
+
|
|
373
|
+
expect(npmTagVersion).toHaveBeenNthCalledWith(
|
|
374
|
+
1,
|
|
375
|
+
expect.objectContaining({
|
|
376
|
+
packageName,
|
|
377
|
+
packageVersion: currentTaggedVersion,
|
|
378
|
+
tag: rollbackTag,
|
|
379
|
+
})
|
|
380
|
+
);
|
|
381
|
+
expect(npmTagVersion).toHaveBeenNthCalledWith(
|
|
382
|
+
2,
|
|
383
|
+
expect.objectContaining({
|
|
384
|
+
packageName,
|
|
385
|
+
packageVersion: rollbackTaggedVersion,
|
|
386
|
+
tag: rollbackTag,
|
|
387
|
+
})
|
|
388
|
+
);
|
|
389
|
+
expect(log.error).toHaveBeenCalledWith(`Failed to publish package ${packageName}`);
|
|
390
|
+
expect(log.info).toHaveBeenCalledWith(
|
|
391
|
+
`Restoring rollback tag ${rollbackTag} back to version ${rollbackTaggedVersion}`
|
|
392
|
+
);
|
|
393
|
+
});
|
|
394
|
+
});
|
|
395
|
+
|
|
396
|
+
describe('when branch configuration includes "publishTag"', () => {
|
|
397
|
+
const branchConfig: WebComponentBranchConfigs = { publishTag: 'foo' };
|
|
398
|
+
|
|
399
|
+
beforeEach(() =>
|
|
400
|
+
vol.fromJSON({
|
|
401
|
+
'package.json': JSON.stringify({
|
|
402
|
+
name: packageName,
|
|
403
|
+
cli: { 'web-component': { branches: { [branch]: branchConfig } } },
|
|
404
|
+
}),
|
|
405
|
+
})
|
|
406
|
+
);
|
|
407
|
+
|
|
408
|
+
test('uses configured "publishTag"', async () => {
|
|
409
|
+
await subject();
|
|
410
|
+
|
|
411
|
+
expect(npmPublish).toHaveBeenCalledWith(
|
|
412
|
+
expect.objectContaining({ tag: branchConfig.publishTag })
|
|
243
413
|
);
|
|
244
414
|
});
|
|
245
415
|
});
|
|
@@ -283,56 +453,113 @@ describe(`[startup] ${MFEPackagePublish.name}`, () => {
|
|
|
283
453
|
});
|
|
284
454
|
}
|
|
285
455
|
|
|
456
|
+
function itTagsPublishedVersion(tag?: string) {
|
|
457
|
+
test(`tags published version`, async () => {
|
|
458
|
+
await subject();
|
|
459
|
+
|
|
460
|
+
expect(npmTagVersion).toHaveBeenCalledWith({
|
|
461
|
+
packageName,
|
|
462
|
+
packageVersion: buildPackageVersion(),
|
|
463
|
+
registry: defaultRegistry,
|
|
464
|
+
tag,
|
|
465
|
+
});
|
|
466
|
+
expect(log.info).toHaveBeenCalledWith(
|
|
467
|
+
`Tagging version ${buildPackageVersion()} with tag "${tag}"`
|
|
468
|
+
);
|
|
469
|
+
});
|
|
470
|
+
}
|
|
471
|
+
|
|
286
472
|
describe('when version is already published', () => {
|
|
287
473
|
beforeEach(() =>
|
|
288
|
-
jest.mocked(npmGetPackageVersions).mockReturnValue([
|
|
474
|
+
jest.mocked(npmGetPackageVersions).mockReturnValue([buildPackageVersion()])
|
|
289
475
|
);
|
|
290
476
|
|
|
291
477
|
itLogsMessageAndSkipsPublishing(/is already published/);
|
|
292
478
|
|
|
293
|
-
|
|
294
|
-
beforeEach(() => (args.tag = 'foo'));
|
|
479
|
+
itTagsPublishedVersion(tag);
|
|
295
480
|
|
|
296
|
-
|
|
297
|
-
|
|
481
|
+
describe('when tagging published version fails', () => {
|
|
482
|
+
const error = new Error('Tagging failed');
|
|
298
483
|
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
tag: args.tag,
|
|
304
|
-
});
|
|
305
|
-
expect(log.info).toHaveBeenCalledWith(
|
|
306
|
-
expect.stringMatching(`adding tag "${args.tag}"`)
|
|
307
|
-
);
|
|
484
|
+
beforeEach(() => {
|
|
485
|
+
jest.mocked(npmTagVersion).mockResolvedValueOnce(undefined); // rollback tag
|
|
486
|
+
jest.mocked(npmTagVersion).mockRejectedValueOnce(error); // tag published
|
|
487
|
+
jest.mocked(npmTagVersion).mockResolvedValue(undefined); // restore rollback
|
|
308
488
|
});
|
|
309
489
|
|
|
310
|
-
|
|
311
|
-
|
|
490
|
+
test('logs error', async () => {
|
|
491
|
+
jest.spyOn(process.stdout, 'write').mockImplementation(jest.fn()); // suppress error output
|
|
492
|
+
await expect(subject).rejects.toThrow(error);
|
|
312
493
|
|
|
313
|
-
|
|
314
|
-
|
|
494
|
+
expect(log.error).toHaveBeenCalledWith(`Failed to publish package ${packageName}`);
|
|
495
|
+
});
|
|
315
496
|
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
497
|
+
describe('when there is an existing version with rollback tag', () => {
|
|
498
|
+
const rollbackVersion = 'rollback-version';
|
|
499
|
+
|
|
500
|
+
beforeEach(() => {
|
|
501
|
+
jest.mocked(npmView).mockReturnValueOnce({
|
|
502
|
+
'name': packageName,
|
|
503
|
+
'version': previousVersion,
|
|
504
|
+
'dist-tags': {
|
|
505
|
+
[tag]: previousVersion,
|
|
506
|
+
[rollbackTag]: rollbackVersion,
|
|
507
|
+
},
|
|
321
508
|
});
|
|
322
509
|
});
|
|
510
|
+
|
|
511
|
+
test('restores rollback tag', async () => {
|
|
512
|
+
jest.spyOn(process.stdout, 'write').mockImplementation(jest.fn()); // suppress error output
|
|
513
|
+
await expect(subject).rejects.toThrow(error);
|
|
514
|
+
|
|
515
|
+
expect(npmTagVersion).toHaveBeenCalledWith(
|
|
516
|
+
expect.objectContaining({
|
|
517
|
+
packageVersion: rollbackVersion,
|
|
518
|
+
tag: rollbackTag,
|
|
519
|
+
})
|
|
520
|
+
);
|
|
521
|
+
});
|
|
323
522
|
});
|
|
523
|
+
});
|
|
324
524
|
|
|
325
|
-
|
|
326
|
-
|
|
525
|
+
describe('with "tag" argument', () => {
|
|
526
|
+
const tag = 'foo';
|
|
327
527
|
|
|
328
|
-
|
|
329
|
-
await subject();
|
|
528
|
+
beforeEach(() => (args.tag = tag));
|
|
330
529
|
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
530
|
+
itTagsPublishedVersion(tag);
|
|
531
|
+
});
|
|
532
|
+
|
|
533
|
+
describe('with "registry" argument', () => {
|
|
534
|
+
const registry = 'https://foo';
|
|
535
|
+
|
|
536
|
+
beforeEach(() => (args.registry = registry));
|
|
537
|
+
|
|
538
|
+
test('uses specified registry', async () => {
|
|
539
|
+
await subject();
|
|
540
|
+
|
|
541
|
+
expect(npmTagVersion).toHaveBeenCalledWith({
|
|
542
|
+
packageName,
|
|
543
|
+
packageVersion: buildPackageVersion(),
|
|
544
|
+
registry,
|
|
545
|
+
tag,
|
|
335
546
|
});
|
|
547
|
+
expect(log.info).toHaveBeenCalledWith(
|
|
548
|
+
`Tagging version ${buildPackageVersion()} with tag "${tag}"`
|
|
549
|
+
);
|
|
550
|
+
});
|
|
551
|
+
});
|
|
552
|
+
|
|
553
|
+
describe('with "dry" argument', () => {
|
|
554
|
+
beforeEach(() => (args.dry = true));
|
|
555
|
+
|
|
556
|
+
test('logs message and does not tag version', async () => {
|
|
557
|
+
await subject();
|
|
558
|
+
|
|
559
|
+
expect(npmTagVersion).not.toHaveBeenCalled();
|
|
560
|
+
expect(log.info).toHaveBeenCalledWith(
|
|
561
|
+
`(dry-run) Tagging version ${buildPackageVersion()} with tag "${tag}"`
|
|
562
|
+
);
|
|
336
563
|
});
|
|
337
564
|
});
|
|
338
565
|
});
|
|
@@ -346,7 +573,9 @@ describe(`[startup] ${MFEPackagePublish.name}`, () => {
|
|
|
346
573
|
});
|
|
347
574
|
|
|
348
575
|
describe('with unrecognized branch', () => {
|
|
349
|
-
|
|
576
|
+
const branch = 'foo';
|
|
577
|
+
|
|
578
|
+
beforeEach(() => jest.mocked(gitGetBranch).mockReturnValue(branch));
|
|
350
579
|
|
|
351
580
|
itLogsMessageAndSkipsPublishing(/branch is not configured for publishing/);
|
|
352
581
|
|