@servicetitan/startup 38.0.0 → 38.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/js-yaml.js +2 -2
- package/dist/cli/commands/build.d.ts.map +1 -1
- package/dist/cli/commands/build.js +32 -10
- package/dist/cli/commands/build.js.map +1 -1
- package/dist/cli/commands/bundle-package.d.ts +6 -0
- package/dist/cli/commands/bundle-package.d.ts.map +1 -0
- package/dist/cli/commands/bundle-package.js +59 -0
- package/dist/cli/commands/bundle-package.js.map +1 -0
- package/dist/cli/commands/bundle-vite.js +13 -4
- package/dist/cli/commands/bundle-vite.js.map +1 -1
- package/dist/cli/commands/bundle-webpack.js +13 -4
- package/dist/cli/commands/bundle-webpack.js.map +1 -1
- package/dist/cli/commands/clean.js +13 -4
- package/dist/cli/commands/clean.js.map +1 -1
- package/dist/cli/commands/command.d.ts +13 -0
- package/dist/cli/commands/command.d.ts.map +1 -0
- package/dist/cli/commands/command.js +74 -0
- package/dist/cli/commands/command.js.map +1 -0
- package/dist/cli/commands/convert-eslint-config.js +14 -7
- package/dist/cli/commands/convert-eslint-config.js.map +1 -1
- package/dist/cli/commands/eslint.js +13 -4
- package/dist/cli/commands/eslint.js.map +1 -1
- package/dist/cli/commands/init.d.ts.map +1 -1
- package/dist/cli/commands/init.js +13 -5
- package/dist/cli/commands/init.js.map +1 -1
- package/dist/cli/commands/install.d.ts.map +1 -1
- package/dist/cli/commands/install.js +14 -21
- package/dist/cli/commands/install.js.map +1 -1
- package/dist/cli/commands/kendo-ui-license.js +13 -4
- package/dist/cli/commands/kendo-ui-license.js.map +1 -1
- package/dist/cli/commands/lint.js +13 -4
- package/dist/cli/commands/lint.js.map +1 -1
- package/dist/cli/commands/mfe-check.d.ts.map +1 -1
- package/dist/cli/commands/mfe-check.js +15 -7
- package/dist/cli/commands/mfe-check.js.map +1 -1
- package/dist/cli/commands/mfe-generate-metadata.js +13 -4
- package/dist/cli/commands/mfe-generate-metadata.js.map +1 -1
- package/dist/cli/commands/mfe-list.js +13 -4
- package/dist/cli/commands/mfe-list.js.map +1 -1
- package/dist/cli/commands/mfe-package-clean.js +13 -4
- package/dist/cli/commands/mfe-package-clean.js.map +1 -1
- package/dist/cli/commands/mfe-package-publish.js +13 -4
- package/dist/cli/commands/mfe-package-publish.js.map +1 -1
- package/dist/cli/commands/mfe-package-rollback.js +13 -4
- package/dist/cli/commands/mfe-package-rollback.js.map +1 -1
- package/dist/cli/commands/mfe-publish.js +13 -4
- package/dist/cli/commands/mfe-publish.js.map +1 -1
- package/dist/cli/commands/mfe-purge-cache.js +13 -4
- package/dist/cli/commands/mfe-purge-cache.js.map +1 -1
- package/dist/cli/commands/prepare-package.js +13 -4
- package/dist/cli/commands/prepare-package.js.map +1 -1
- package/dist/cli/commands/registry/build.d.ts +1 -1
- package/dist/cli/commands/registry/build.d.ts.map +1 -1
- package/dist/cli/commands/registry/build.js +3 -5
- package/dist/cli/commands/registry/build.js.map +1 -1
- package/dist/cli/commands/registry/bundle-package.d.ts +41 -0
- package/dist/cli/commands/registry/bundle-package.d.ts.map +1 -0
- package/dist/cli/commands/registry/bundle-package.js +54 -0
- package/dist/cli/commands/registry/bundle-package.js.map +1 -0
- package/dist/cli/commands/registry/command-registry.d.ts +42 -18
- package/dist/cli/commands/registry/command-registry.d.ts.map +1 -1
- package/dist/cli/commands/registry/command-registry.js +10 -19
- package/dist/cli/commands/registry/command-registry.js.map +1 -1
- package/dist/cli/commands/registry/install.d.ts +0 -16
- package/dist/cli/commands/registry/install.d.ts.map +1 -1
- package/dist/cli/commands/registry/install.js +1 -17
- package/dist/cli/commands/registry/install.js.map +1 -1
- package/dist/cli/commands/registry/start.d.ts +1 -1
- package/dist/cli/commands/registry/start.d.ts.map +1 -1
- package/dist/cli/commands/registry/start.js +3 -5
- package/dist/cli/commands/registry/start.js.map +1 -1
- package/dist/cli/commands/review/review.js +14 -7
- package/dist/cli/commands/review/review.js.map +1 -1
- package/dist/cli/commands/review/rules/no-deprecated-content-base.js +1 -3
- package/dist/cli/commands/review/rules/no-deprecated-content-base.js.map +1 -1
- package/dist/cli/commands/review/rules/no-direct-peer-dependencies.js +1 -3
- package/dist/cli/commands/review/rules/no-direct-peer-dependencies.js.map +1 -1
- package/dist/cli/commands/review/rules/no-typescript-entry-point.js +1 -3
- package/dist/cli/commands/review/rules/no-typescript-entry-point.js.map +1 -1
- package/dist/cli/commands/review/rules/prefer-open-ended-peer-dependencies.js +5 -12
- 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 +5 -12
- package/dist/cli/commands/review/rules/require-compatible-launch-darkly-sdk.js.map +1 -1
- package/dist/cli/commands/review/rules/require-explicit-side-effects.js +1 -3
- package/dist/cli/commands/review/rules/require-explicit-side-effects.js.map +1 -1
- package/dist/cli/commands/review/rules/require-one-collection-version.js +1 -3
- package/dist/cli/commands/review/rules/require-one-collection-version.js.map +1 -1
- package/dist/cli/commands/review/rules/require-servicetitan-scope.js +1 -3
- package/dist/cli/commands/review/rules/require-servicetitan-scope.js.map +1 -1
- package/dist/cli/commands/review/rules/require-tsconfig-references.js +1 -3
- package/dist/cli/commands/review/rules/require-tsconfig-references.js.map +1 -1
- package/dist/cli/commands/review/utils/compare-version.js +8 -19
- package/dist/cli/commands/review/utils/compare-version.js.map +1 -1
- package/dist/cli/commands/run-task.d.ts +1 -0
- package/dist/cli/commands/run-task.d.ts.map +1 -1
- package/dist/cli/commands/run-task.js +20 -6
- package/dist/cli/commands/run-task.js.map +1 -1
- package/dist/cli/commands/start.d.ts.map +1 -1
- package/dist/cli/commands/start.js +37 -14
- package/dist/cli/commands/start.js.map +1 -1
- package/dist/cli/commands/stylelint.js +13 -4
- package/dist/cli/commands/stylelint.js.map +1 -1
- package/dist/cli/commands/styles-check.js +13 -4
- package/dist/cli/commands/styles-check.js.map +1 -1
- package/dist/cli/commands/test/runners/jest.js +1 -3
- package/dist/cli/commands/test/runners/jest.js.map +1 -1
- package/dist/cli/commands/test/tests.js +13 -4
- package/dist/cli/commands/test/tests.js.map +1 -1
- package/dist/cli/commands/types.d.ts +1 -6
- package/dist/cli/commands/types.d.ts.map +1 -1
- package/dist/cli/commands/types.js +2 -20
- package/dist/cli/commands/types.js.map +1 -1
- package/dist/cli/commands/upload-sourcemaps.js +17 -13
- package/dist/cli/commands/upload-sourcemaps.js.map +1 -1
- package/dist/cli/index.js +1 -0
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/tasks/cli-task.d.ts +3 -0
- package/dist/cli/tasks/cli-task.d.ts.map +1 -1
- package/dist/cli/tasks/cli-task.js +41 -9
- package/dist/cli/tasks/cli-task.js.map +1 -1
- package/dist/cli/tasks/swc-compile-package/get-swc-options.d.ts +9 -1
- package/dist/cli/tasks/swc-compile-package/get-swc-options.d.ts.map +1 -1
- package/dist/cli/tasks/swc-compile-package/get-swc-options.js +18 -2
- package/dist/cli/tasks/swc-compile-package/get-swc-options.js.map +1 -1
- package/dist/cli/tasks/swc-compile-package/swc-compile-package.d.ts +3 -1
- package/dist/cli/tasks/swc-compile-package/swc-compile-package.d.ts.map +1 -1
- package/dist/cli/tasks/swc-compile-package/swc-compile-package.js +17 -3
- package/dist/cli/tasks/swc-compile-package/swc-compile-package.js.map +1 -1
- package/dist/cli/tasks/task.d.ts +2 -1
- package/dist/cli/tasks/task.d.ts.map +1 -1
- package/dist/cli/tasks/task.js +6 -3
- package/dist/cli/tasks/task.js.map +1 -1
- package/dist/cli/tasks/tsc-compile/tsc-compile.js +1 -3
- package/dist/cli/tasks/tsc-compile/tsc-compile.js.map +1 -1
- package/dist/cli/utils/cli-git.d.ts +7 -0
- package/dist/cli/utils/cli-git.d.ts.map +1 -1
- package/dist/cli/utils/cli-git.js +30 -0
- package/dist/cli/utils/cli-git.js.map +1 -1
- package/dist/cli/utils/cli-npm.d.ts.map +1 -1
- package/dist/cli/utils/cli-npm.js +8 -1
- package/dist/cli/utils/cli-npm.js.map +1 -1
- package/dist/cli/utils/cli-os.d.ts +7 -1
- package/dist/cli/utils/cli-os.d.ts.map +1 -1
- package/dist/cli/utils/cli-os.js +42 -0
- package/dist/cli/utils/cli-os.js.map +1 -1
- package/dist/cli/utils/compile.d.ts.map +1 -1
- package/dist/cli/utils/compile.js +7 -4
- package/dist/cli/utils/compile.js.map +1 -1
- package/dist/cli/utils/copy-files.js +1 -0
- package/dist/cli/utils/copy-files.js.map +1 -1
- package/dist/cli/utils/index.d.ts +1 -1
- package/dist/cli/utils/index.d.ts.map +1 -1
- package/dist/cli/utils/index.js +1 -1
- package/dist/cli/utils/index.js.map +1 -1
- package/dist/cli/utils/process-tree.js +2 -6
- package/dist/cli/utils/process-tree.js.map +1 -1
- package/dist/cli/utils/resolve-bundler.d.ts.map +1 -1
- package/dist/cli/utils/resolve-bundler.js +2 -1
- package/dist/cli/utils/resolve-bundler.js.map +1 -1
- package/dist/cli/utils/ts-config.d.ts +1 -1
- package/dist/cli/utils/ts-config.d.ts.map +1 -1
- package/dist/cli/utils/ts-config.js +1 -3
- package/dist/cli/utils/ts-config.js.map +1 -1
- package/dist/cli/utils/with-exponential-backoff.d.ts +7 -0
- package/dist/cli/utils/with-exponential-backoff.d.ts.map +1 -0
- package/dist/cli/utils/with-exponential-backoff.js +28 -0
- package/dist/cli/utils/with-exponential-backoff.js.map +1 -0
- package/dist/core/constants.d.ts +2 -0
- package/dist/core/constants.d.ts.map +1 -1
- package/dist/core/constants.js +6 -1
- package/dist/core/constants.js.map +1 -1
- package/dist/postinstall.js +118 -0
- package/dist/scripts/generate-bin-wrappers.js +203 -0
- package/dist/storybook-config/swc.d.ts +6 -0
- package/dist/storybook-config/swc.d.ts.map +1 -1
- package/dist/storybook-config/webpack-final.d.ts.map +1 -1
- package/dist/storybook-config/webpack-final.js +2 -1
- package/dist/storybook-config/webpack-final.js.map +1 -1
- package/dist/telemetry/index.d.ts +3 -0
- package/dist/telemetry/index.d.ts.map +1 -0
- package/dist/telemetry/index.js +21 -0
- package/dist/telemetry/index.js.map +1 -0
- package/dist/telemetry/telemetry.d.ts +15 -0
- package/dist/telemetry/telemetry.d.ts.map +1 -0
- package/dist/telemetry/telemetry.js +176 -0
- package/dist/telemetry/telemetry.js.map +1 -0
- package/dist/utils/exit-when-parent-exits.d.ts +6 -0
- package/dist/utils/exit-when-parent-exits.d.ts.map +1 -0
- package/dist/utils/exit-when-parent-exits.js +37 -0
- package/dist/utils/exit-when-parent-exits.js.map +1 -0
- package/dist/utils/find-up.d.ts +1 -1
- package/dist/utils/find-up.d.ts.map +1 -1
- package/dist/utils/find-up.js +2 -2
- package/dist/utils/find-up.js.map +1 -1
- package/dist/utils/get-configuration.d.ts +6 -3
- package/dist/utils/get-configuration.d.ts.map +1 -1
- package/dist/utils/get-configuration.js +10 -2
- package/dist/utils/get-configuration.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/log.js +1 -3
- package/dist/utils/log.js.map +1 -1
- package/dist/vite/build-shared-dependencies.d.ts.map +1 -1
- package/dist/vite/build-shared-dependencies.js +2 -0
- package/dist/vite/build-shared-dependencies.js.map +1 -1
- package/dist/vite/config/base-config.d.ts.map +1 -1
- package/dist/vite/config/base-config.js +12 -1
- package/dist/vite/config/base-config.js.map +1 -1
- package/dist/vite/config/create-filtering-logger.d.ts.map +1 -1
- package/dist/vite/config/create-filtering-logger.js +6 -2
- package/dist/vite/config/create-filtering-logger.js.map +1 -1
- package/dist/vite/config/create-vite-config.js +7 -2
- package/dist/vite/config/create-vite-config.js.map +1 -1
- package/dist/vite/config/load-config-file.js +8 -19
- package/dist/vite/config/load-config-file.js.map +1 -1
- package/dist/vite/index.d.ts +2 -0
- package/dist/vite/index.d.ts.map +1 -1
- package/dist/vite/index.html +2 -2
- package/dist/vite/index.js +16 -0
- package/dist/vite/index.js.map +1 -1
- package/dist/vite/plugins/chain-source-maps-plugin.js +1 -1
- package/dist/vite/plugins/chain-source-maps-plugin.js.map +1 -1
- package/dist/vite/plugins/clean-plugin.js +1 -1
- package/dist/vite/plugins/clean-plugin.js.map +1 -1
- package/dist/vite/plugins/css-injector-plugin.js +1 -1
- package/dist/vite/plugins/css-injector-plugin.js.map +1 -1
- package/dist/vite/plugins/design-system-guard-plugin.d.ts.map +1 -1
- package/dist/vite/plugins/design-system-guard-plugin.js +10 -5
- package/dist/vite/plugins/design-system-guard-plugin.js.map +1 -1
- package/dist/vite/plugins/dev-server-routing-plugin.js +1 -1
- package/dist/vite/plugins/dev-server-routing-plugin.js.map +1 -1
- package/dist/vite/plugins/externals-plugin.d.ts.map +1 -1
- package/dist/vite/plugins/externals-plugin.js +11 -5
- package/dist/vite/plugins/externals-plugin.js.map +1 -1
- package/dist/vite/plugins/html-plugin.d.ts.map +1 -1
- package/dist/vite/plugins/html-plugin.js +5 -3
- package/dist/vite/plugins/html-plugin.js.map +1 -1
- package/dist/vite/plugins/ignore-modules-plugin.d.ts +2 -2
- package/dist/vite/plugins/ignore-modules-plugin.d.ts.map +1 -1
- package/dist/vite/plugins/ignore-modules-plugin.js +36 -24
- package/dist/vite/plugins/ignore-modules-plugin.js.map +1 -1
- package/dist/vite/plugins/index.d.ts +3 -0
- package/dist/vite/plugins/index.d.ts.map +1 -1
- package/dist/vite/plugins/index.js +3 -0
- package/dist/vite/plugins/index.js.map +1 -1
- package/dist/vite/plugins/less-tilde-plugin.d.ts +8 -0
- package/dist/vite/plugins/less-tilde-plugin.d.ts.map +1 -0
- package/dist/vite/plugins/less-tilde-plugin.js +53 -0
- package/dist/vite/plugins/less-tilde-plugin.js.map +1 -0
- package/dist/vite/plugins/magic-comments-plugin/magic-comments-plugin.js +1 -1
- package/dist/vite/plugins/magic-comments-plugin/magic-comments-plugin.js.map +1 -1
- package/dist/vite/plugins/metadata-plugin.js +1 -1
- package/dist/vite/plugins/metadata-plugin.js.map +1 -1
- package/dist/vite/plugins/moment-locales-plugin.d.ts +1 -1
- package/dist/vite/plugins/moment-locales-plugin.d.ts.map +1 -1
- package/dist/vite/plugins/moment-locales-plugin.js +30 -14
- package/dist/vite/plugins/moment-locales-plugin.js.map +1 -1
- package/dist/vite/plugins/react-refresh-plugin/index.d.ts +2 -0
- package/dist/vite/plugins/react-refresh-plugin/index.d.ts.map +1 -0
- package/dist/vite/plugins/react-refresh-plugin/index.js +20 -0
- package/dist/vite/plugins/react-refresh-plugin/index.js.map +1 -0
- package/dist/vite/plugins/react-refresh-plugin/react-refresh-plugin.d.ts +4 -0
- package/dist/vite/plugins/react-refresh-plugin/react-refresh-plugin.d.ts.map +1 -0
- package/dist/vite/plugins/react-refresh-plugin/react-refresh-plugin.js +143 -0
- package/dist/vite/plugins/react-refresh-plugin/react-refresh-plugin.js.map +1 -0
- package/dist/vite/plugins/react-refresh-plugin/refresh-runtime.js +113 -0
- package/dist/vite/plugins/shared-dependencies-plugin/shared-dependencies-plugin.d.ts.map +1 -1
- package/dist/vite/plugins/shared-dependencies-plugin/shared-dependencies-plugin.js +14 -11
- package/dist/vite/plugins/shared-dependencies-plugin/shared-dependencies-plugin.js.map +1 -1
- package/dist/vite/plugins/style-urls-plugin.js +1 -1
- package/dist/vite/plugins/style-urls-plugin.js.map +1 -1
- package/dist/vite/plugins/virtual-modules-plugin.d.ts.map +1 -1
- package/dist/vite/plugins/virtual-modules-plugin.js +9 -6
- package/dist/vite/plugins/virtual-modules-plugin.js.map +1 -1
- package/dist/vite/plugins/window-externals-plugin.d.ts +22 -0
- package/dist/vite/plugins/window-externals-plugin.d.ts.map +1 -0
- package/dist/vite/plugins/window-externals-plugin.js +74 -0
- package/dist/vite/plugins/window-externals-plugin.js.map +1 -0
- package/dist/webpack/bundle-webpack.d.ts.map +1 -1
- package/dist/webpack/bundle-webpack.js +6 -1
- package/dist/webpack/bundle-webpack.js.map +1 -1
- package/dist/webpack/configs/optimization-config.js +17 -12
- 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/ignore-plugin/ignore-plugin.js +1 -3
- package/dist/webpack/configs/plugins/ignore-plugin/ignore-plugin.js.map +1 -1
- package/dist/webpack/loaders/expose-loader/__tests__/__mocks__/configuration.expose-loader.js +13 -0
- package/dist/webpack/loaders/expose-loader/__tests__/__mocks__/index.js +1 -0
- package/dist/webpack/utils/index.d.ts +1 -0
- package/dist/webpack/utils/index.d.ts.map +1 -1
- package/dist/webpack/utils/index.js +1 -0
- package/dist/webpack/utils/index.js.map +1 -1
- package/dist/webpack/utils/normalize-proxy-config.d.ts +6 -0
- package/dist/webpack/utils/normalize-proxy-config.d.ts.map +1 -0
- package/dist/webpack/utils/normalize-proxy-config.js +52 -0
- package/dist/webpack/utils/normalize-proxy-config.js.map +1 -0
- package/package.json +32 -26
- package/src/cli/commands/__tests__/build.test.ts +81 -20
- package/src/cli/commands/__tests__/bundle-package.test.ts +65 -0
- package/src/cli/commands/__tests__/command.test.ts +154 -0
- package/src/cli/commands/__tests__/init.test.ts +1 -1
- package/src/cli/commands/__tests__/install.test.ts +5 -72
- package/src/cli/commands/__tests__/mfe-check.test.ts +26 -5
- package/src/cli/commands/__tests__/run-task.test.ts +20 -1
- package/src/cli/commands/__tests__/start.test.ts +77 -16
- package/src/cli/commands/build.ts +15 -6
- package/src/cli/commands/bundle-package.ts +20 -0
- package/src/cli/commands/command.ts +64 -0
- package/src/cli/commands/init.ts +0 -1
- package/src/cli/commands/install.ts +5 -21
- package/src/cli/commands/mfe-check.ts +6 -10
- package/src/cli/commands/registry/build.ts +3 -2
- package/src/cli/commands/registry/bundle-package.ts +22 -0
- package/src/cli/commands/registry/command-registry.ts +2 -0
- package/src/cli/commands/registry/install.ts +1 -6
- package/src/cli/commands/registry/start.ts +3 -2
- package/src/cli/commands/run-task.ts +8 -2
- package/src/cli/commands/start.ts +17 -6
- package/src/cli/commands/types.ts +2 -6
- package/src/cli/index.ts +3 -0
- package/src/cli/tasks/__tests__/cli-task.test.ts +181 -69
- package/src/cli/tasks/__tests__/task.test.ts +40 -45
- package/src/cli/tasks/cli-task.ts +43 -2
- package/src/cli/tasks/swc-compile-package/__tests__/get-swc-options.test.ts +46 -4
- package/src/cli/tasks/swc-compile-package/__tests__/swc-compile-package.test.ts +25 -4
- package/src/cli/tasks/swc-compile-package/get-swc-options.ts +14 -1
- package/src/cli/tasks/swc-compile-package/swc-compile-package.ts +6 -2
- package/src/cli/tasks/task.ts +8 -2
- package/src/cli/tasks/tsc-compile/__tests__/tsc-compile.test.ts +8 -32
- package/src/cli/tasks/tsc-compile-package/__tests__/tsc-compile-package.test.ts +10 -19
- package/src/cli/utils/__tests__/cli-git.test.ts +54 -3
- package/src/cli/utils/__tests__/cli-npm.test.ts +33 -0
- package/src/cli/utils/__tests__/cli-os.test.ts +183 -4
- package/src/cli/utils/__tests__/compile.test.ts +37 -2
- package/src/cli/utils/__tests__/copy-files.test.ts +1 -1
- package/src/cli/utils/__tests__/with-exponential-backoff.test.ts +119 -0
- package/src/cli/utils/cli-git.ts +27 -1
- package/src/cli/utils/cli-npm.ts +19 -4
- package/src/cli/utils/cli-os.ts +44 -0
- package/src/cli/utils/compile.ts +8 -1
- package/src/cli/utils/copy-files.ts +1 -1
- package/src/cli/utils/index.ts +1 -1
- package/src/cli/utils/resolve-bundler.ts +2 -1
- package/src/cli/utils/ts-config.ts +1 -1
- package/src/cli/utils/with-exponential-backoff.ts +28 -0
- package/src/core/constants.ts +2 -0
- package/src/storybook-config/__tests__/vite-final.test.ts +6 -0
- package/src/storybook-config/__tests__/webpack-final.test.ts +26 -12
- package/src/storybook-config/webpack-final.ts +10 -4
- package/src/telemetry/__tests__/telemetry.test.ts +326 -0
- package/src/telemetry/index.ts +2 -0
- package/src/telemetry/telemetry.ts +134 -0
- package/src/utils/__tests__/exit-when-parent-exits.test.ts +87 -0
- package/src/utils/__tests__/find-up.test.ts +49 -0
- package/src/utils/__tests__/get-configuration.test.ts +62 -0
- package/src/utils/exit-when-parent-exits.ts +33 -0
- package/src/utils/find-up.ts +2 -2
- package/src/utils/get-configuration.ts +14 -5
- package/src/utils/index.ts +1 -0
- package/src/vite/__tests__/build-shared-dependencies.test.ts +39 -5
- package/src/vite/build-shared-dependencies.ts +2 -1
- package/src/vite/config/__tests__/base-config.test.ts +12 -4
- package/src/vite/config/__tests__/create-css-config.test.ts +2 -6
- package/src/vite/config/__tests__/create-filtering-logger.test.ts +3 -2
- package/src/vite/config/__tests__/create-vite-config.test.ts +6 -3
- package/src/vite/config/base-config.ts +13 -1
- package/src/vite/config/create-filtering-logger.ts +8 -2
- package/src/vite/config/create-vite-config.ts +6 -3
- package/src/vite/index.html +2 -2
- package/src/vite/index.ts +2 -0
- package/src/vite/plugins/__tests__/chain-source-maps-plugin.test.ts +1 -1
- package/src/vite/plugins/__tests__/clean-plugin.test.ts +1 -1
- package/src/vite/plugins/__tests__/css-injector-plugin.test.ts +1 -1
- package/src/vite/plugins/__tests__/design-system-guard-plugin.test.ts +15 -3
- package/src/vite/plugins/__tests__/dev-server-routing-plugin.test.ts +1 -1
- package/src/vite/plugins/__tests__/externals-plugin.test.ts +24 -3
- package/src/vite/plugins/__tests__/html-plugin.test.ts +10 -3
- package/src/vite/plugins/__tests__/html-template.test.ts +10 -2
- package/src/vite/plugins/__tests__/ignore-modules-plugin.test.ts +30 -6
- package/src/vite/plugins/__tests__/less-tilde-plugin.test.ts +91 -0
- package/src/vite/plugins/__tests__/metadata-plugin.test.ts +1 -1
- package/src/vite/plugins/__tests__/moment-locales-plugin.test.ts +35 -25
- package/src/vite/plugins/__tests__/style-urls-plugin.test.ts +1 -1
- package/src/vite/plugins/__tests__/virtual-modules-plugin.test.ts +20 -9
- package/src/vite/plugins/__tests__/window-externals-plugin.test.ts +128 -0
- package/src/vite/plugins/chain-source-maps-plugin.ts +1 -1
- package/src/vite/plugins/clean-plugin.ts +1 -1
- package/src/vite/plugins/css-injector-plugin.ts +1 -1
- package/src/vite/plugins/design-system-guard-plugin.ts +11 -8
- package/src/vite/plugins/dev-server-routing-plugin.ts +1 -1
- package/src/vite/plugins/externals-plugin.ts +15 -6
- package/src/vite/plugins/html-plugin.ts +4 -2
- package/src/vite/plugins/ignore-modules-plugin.ts +32 -23
- package/src/vite/plugins/index.ts +3 -0
- package/src/vite/plugins/less-tilde-plugin.ts +64 -0
- package/src/vite/plugins/magic-comments-plugin/magic-comments-plugin.ts +1 -1
- package/src/vite/plugins/metadata-plugin.ts +1 -1
- package/src/vite/plugins/moment-locales-plugin.ts +24 -14
- package/src/vite/plugins/react-refresh-plugin/README.md +165 -0
- package/src/vite/plugins/react-refresh-plugin/__tests__/react-refresh-plugin.test.ts +366 -0
- package/src/vite/plugins/react-refresh-plugin/__tests__/refresh-runtime.test.ts +193 -0
- package/src/vite/plugins/react-refresh-plugin/index.ts +1 -0
- package/src/vite/plugins/react-refresh-plugin/react-refresh-plugin.ts +144 -0
- package/src/vite/plugins/react-refresh-plugin/refresh-runtime.js +113 -0
- package/src/vite/plugins/shared-dependencies-plugin/__tests__/shared-dependencies-plugin.test.ts +21 -16
- package/src/vite/plugins/shared-dependencies-plugin/shared-dependencies-plugin.ts +13 -12
- package/src/vite/plugins/style-urls-plugin.ts +1 -1
- package/src/vite/plugins/virtual-modules-plugin.ts +8 -7
- package/src/vite/plugins/window-externals-plugin.ts +94 -0
- package/src/webpack/__tests__/bundle-webpack.test.ts +32 -0
- package/src/webpack/__tests__/create-webpack-config-shared-dependencies.test.ts +27 -1
- package/src/webpack/__tests__/create-webpack-config-web-component.test.ts +17 -5
- package/src/webpack/__tests__/create-webpack-config.test.ts +10 -6
- package/src/webpack/bundle-webpack.ts +7 -1
- package/src/webpack/configs/optimization-config.ts +22 -11
- package/src/webpack/configs/output-config.ts +1 -1
- package/src/webpack/utils/__tests__/normalize-proxy-config.test.ts +121 -0
- package/src/webpack/utils/index.ts +1 -0
- package/src/webpack/utils/normalize-proxy-config.ts +59 -0
- package/tsconfig/types.d.ts +10 -0
- package/dist/cli/utils/get-bundle-command.d.ts +0 -3
- package/dist/cli/utils/get-bundle-command.d.ts.map +0 -1
- package/dist/cli/utils/get-bundle-command.js +0 -16
- package/dist/cli/utils/get-bundle-command.js.map +0 -1
- package/src/cli/utils/__tests__/get-bundle-command.test.ts +0 -23
- package/src/cli/utils/get-bundle-command.ts +0 -5
|
@@ -2,9 +2,11 @@
|
|
|
2
2
|
* @jest-environment node
|
|
3
3
|
*/
|
|
4
4
|
import { createPackage } from '../../../__mocks__';
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
5
|
+
import { Attributes } from '../../../telemetry';
|
|
6
|
+
import { getConfiguration, getPackages, log, Package, PackageType } from '../../../utils';
|
|
7
|
+
import { compile, lernaExec, ProcessTree, typeCheck } from '../../utils';
|
|
7
8
|
import { Build } from '../build';
|
|
9
|
+
import { Command } from '../command';
|
|
8
10
|
import { kendoUILicense } from '../kendo-ui-license';
|
|
9
11
|
import { entry } from '../registry/build';
|
|
10
12
|
|
|
@@ -25,14 +27,25 @@ jest.mock('../kendo-ui-license', () => ({
|
|
|
25
27
|
}));
|
|
26
28
|
|
|
27
29
|
describe(`[startup] ${Build.name}`, () => {
|
|
30
|
+
const commandProto = Command.prototype as unknown as {
|
|
31
|
+
recordStart: (command: string, attributes?: Attributes) => void;
|
|
32
|
+
recordEnd: (error?: unknown) => Promise<void>;
|
|
33
|
+
};
|
|
34
|
+
|
|
28
35
|
let args: ConstructorParameters<typeof Build>[0];
|
|
29
36
|
let packages: Package[];
|
|
37
|
+
let recordStart: jest.SpyInstance;
|
|
38
|
+
let recordEnd: jest.SpyInstance;
|
|
30
39
|
|
|
31
40
|
beforeEach(() => {
|
|
32
41
|
args = {};
|
|
33
42
|
packages = [];
|
|
43
|
+
jest.restoreAllMocks();
|
|
34
44
|
jest.clearAllMocks();
|
|
45
|
+
jest.mocked(getConfiguration).mockReturnValue({});
|
|
35
46
|
jest.mocked(getPackages).mockImplementation(() => packages);
|
|
47
|
+
recordStart = jest.spyOn(commandProto, 'recordStart').mockImplementation(() => {});
|
|
48
|
+
recordEnd = jest.spyOn(commandProto, 'recordEnd').mockResolvedValue(undefined);
|
|
36
49
|
});
|
|
37
50
|
|
|
38
51
|
const subject = async () => new Build(args).execute();
|
|
@@ -105,7 +118,7 @@ describe(`[startup] ${Build.name}`, () => {
|
|
|
105
118
|
});
|
|
106
119
|
});
|
|
107
120
|
|
|
108
|
-
describe('with
|
|
121
|
+
describe('with bundle package', () => {
|
|
109
122
|
beforeEach(() => packages.push(createPackage({ type: PackageType.Bundle })));
|
|
110
123
|
|
|
111
124
|
itPreparesThePackage();
|
|
@@ -122,11 +135,11 @@ describe(`[startup] ${Build.name}`, () => {
|
|
|
122
135
|
await subject();
|
|
123
136
|
|
|
124
137
|
expect(lernaExec).toHaveBeenCalledWith({
|
|
125
|
-
'cmd': 'startup bundle-
|
|
138
|
+
'cmd': 'startup bundle-package',
|
|
126
139
|
'scope': packages.map(({ name }) => name),
|
|
127
140
|
'parallel': true,
|
|
128
141
|
'stream': true,
|
|
129
|
-
'--': ['--exposed-dependencies'],
|
|
142
|
+
'--': ['--exposed-dependencies', '--bundler webpack'],
|
|
130
143
|
});
|
|
131
144
|
});
|
|
132
145
|
|
|
@@ -134,23 +147,36 @@ describe(`[startup] ${Build.name}`, () => {
|
|
|
134
147
|
await subject();
|
|
135
148
|
|
|
136
149
|
expect(lernaExec).toHaveBeenCalledWith({
|
|
137
|
-
'cmd': 'startup bundle-
|
|
150
|
+
'cmd': 'startup bundle-package',
|
|
138
151
|
'scope': packages.map(({ name }) => name),
|
|
139
152
|
'stream': true,
|
|
140
|
-
'--': [],
|
|
153
|
+
'--': ['--bundler webpack'],
|
|
141
154
|
});
|
|
142
155
|
});
|
|
143
156
|
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
test('bundles with Vite', async () => {
|
|
157
|
+
function itBundlesWithVite() {
|
|
158
|
+
test('bundles with vite', async () => {
|
|
148
159
|
await subject();
|
|
149
160
|
|
|
150
161
|
expect(lernaExec).toHaveBeenCalledWith(
|
|
151
|
-
expect.objectContaining({
|
|
162
|
+
expect.objectContaining({
|
|
163
|
+
'cmd': 'startup bundle-package',
|
|
164
|
+
'--': ['--bundler vite'],
|
|
165
|
+
})
|
|
152
166
|
);
|
|
153
167
|
});
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
describe('with --bundler=vite', () => {
|
|
171
|
+
beforeEach(() => (args.bundler = 'vite'));
|
|
172
|
+
|
|
173
|
+
itBundlesWithVite();
|
|
174
|
+
});
|
|
175
|
+
|
|
176
|
+
describe('with cli.bundler set to vite', () => {
|
|
177
|
+
beforeEach(() => jest.mocked(getConfiguration).mockReturnValue({ bundler: 'vite' }));
|
|
178
|
+
|
|
179
|
+
itBundlesWithVite();
|
|
154
180
|
});
|
|
155
181
|
|
|
156
182
|
describe('with "code-coverage"', () => {
|
|
@@ -161,8 +187,8 @@ describe(`[startup] ${Build.name}`, () => {
|
|
|
161
187
|
|
|
162
188
|
expect(lernaExec).toHaveBeenCalledWith(
|
|
163
189
|
expect.objectContaining({
|
|
164
|
-
'cmd': 'startup bundle-
|
|
165
|
-
'--': ['--code-coverage'],
|
|
190
|
+
'cmd': 'startup bundle-package',
|
|
191
|
+
'--': ['--code-coverage', '--bundler webpack'],
|
|
166
192
|
})
|
|
167
193
|
);
|
|
168
194
|
});
|
|
@@ -176,8 +202,8 @@ describe(`[startup] ${Build.name}`, () => {
|
|
|
176
202
|
|
|
177
203
|
expect(lernaExec).toHaveBeenCalledWith(
|
|
178
204
|
expect.objectContaining({
|
|
179
|
-
'cmd': 'startup bundle-
|
|
180
|
-
'--': ['--stat'],
|
|
205
|
+
'cmd': 'startup bundle-package',
|
|
206
|
+
'--': ['--stat', '--bundler webpack'],
|
|
181
207
|
})
|
|
182
208
|
);
|
|
183
209
|
});
|
|
@@ -191,8 +217,8 @@ describe(`[startup] ${Build.name}`, () => {
|
|
|
191
217
|
|
|
192
218
|
expect(lernaExec).toHaveBeenCalledWith(
|
|
193
219
|
expect.objectContaining({
|
|
194
|
-
'cmd': 'startup bundle-
|
|
195
|
-
'--': ['--preview'],
|
|
220
|
+
'cmd': 'startup bundle-package',
|
|
221
|
+
'--': ['--preview', '--bundler webpack'],
|
|
196
222
|
})
|
|
197
223
|
);
|
|
198
224
|
});
|
|
@@ -206,8 +232,8 @@ describe(`[startup] ${Build.name}`, () => {
|
|
|
206
232
|
|
|
207
233
|
expect(lernaExec).toHaveBeenCalledWith(
|
|
208
234
|
expect.objectContaining({
|
|
209
|
-
'cmd': 'startup bundle-
|
|
210
|
-
'--': [`--config "${args.config}"
|
|
235
|
+
'cmd': 'startup bundle-package',
|
|
236
|
+
'--': [`--config "${args.config}"`, '--bundler webpack'],
|
|
211
237
|
})
|
|
212
238
|
);
|
|
213
239
|
});
|
|
@@ -226,6 +252,41 @@ describe(`[startup] ${Build.name}`, () => {
|
|
|
226
252
|
});
|
|
227
253
|
});
|
|
228
254
|
|
|
255
|
+
describe('telemetry', () => {
|
|
256
|
+
beforeEach(() => packages.push(createPackage({ type: PackageType.TSC })));
|
|
257
|
+
|
|
258
|
+
test('records the command start', async () => {
|
|
259
|
+
await subject();
|
|
260
|
+
|
|
261
|
+
expect(recordStart).toHaveBeenCalledWith('build', { bundler: expect.any(String) });
|
|
262
|
+
});
|
|
263
|
+
|
|
264
|
+
test('records the command completion', async () => {
|
|
265
|
+
await subject();
|
|
266
|
+
|
|
267
|
+
expect(recordEnd).toHaveBeenCalledWith();
|
|
268
|
+
});
|
|
269
|
+
|
|
270
|
+
describe('when the build fails', () => {
|
|
271
|
+
const error = new Error('bundle failed');
|
|
272
|
+
|
|
273
|
+
beforeEach(() => {
|
|
274
|
+
jest.spyOn(log, 'error').mockImplementation(jest.fn());
|
|
275
|
+
jest.spyOn(ProcessTree.prototype, 'run').mockRejectedValue(error);
|
|
276
|
+
});
|
|
277
|
+
|
|
278
|
+
test('records the failure', async () => {
|
|
279
|
+
await subject().catch(() => {});
|
|
280
|
+
|
|
281
|
+
expect(recordEnd).toHaveBeenCalledWith(error);
|
|
282
|
+
});
|
|
283
|
+
|
|
284
|
+
test('propagates the error', async () => {
|
|
285
|
+
await expect(subject()).rejects.toBe(error);
|
|
286
|
+
});
|
|
287
|
+
});
|
|
288
|
+
});
|
|
289
|
+
|
|
229
290
|
describe('with "scope"', () => {
|
|
230
291
|
beforeEach(() => (args.scope = ['foo']));
|
|
231
292
|
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { getConfiguration } from '../../../utils';
|
|
2
|
+
import { BundlePackage } from '../bundle-package';
|
|
3
|
+
import { BundleVite } from '../bundle-vite';
|
|
4
|
+
import { BundleWebpack } from '../bundle-webpack';
|
|
5
|
+
|
|
6
|
+
jest.mock('../../../utils', () => ({
|
|
7
|
+
...jest.requireActual('../../../utils'),
|
|
8
|
+
getConfiguration: jest.fn(() => ({})),
|
|
9
|
+
}));
|
|
10
|
+
jest.mock('../bundle-vite', () => ({ BundleVite: jest.fn(() => ({ execute: jest.fn() })) }));
|
|
11
|
+
jest.mock('../bundle-webpack', () => ({ BundleWebpack: jest.fn(() => ({ execute: jest.fn() })) }));
|
|
12
|
+
|
|
13
|
+
describe(`[startup] ${BundlePackage.name}`, () => {
|
|
14
|
+
let args: ConstructorParameters<typeof BundlePackage>[0];
|
|
15
|
+
|
|
16
|
+
const subject = () => new BundlePackage(args).execute();
|
|
17
|
+
|
|
18
|
+
beforeEach(() => {
|
|
19
|
+
jest.clearAllMocks();
|
|
20
|
+
args = { exposedDependencies: true };
|
|
21
|
+
jest.mocked(getConfiguration).mockReturnValue({});
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
function itBundlesWithWebpack() {
|
|
25
|
+
test('bundles with webpack', async () => {
|
|
26
|
+
await subject();
|
|
27
|
+
|
|
28
|
+
expect(BundleWebpack).toHaveBeenCalledWith(args);
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
function itBundlesWithVite() {
|
|
33
|
+
test('bundles with vite', async () => {
|
|
34
|
+
await subject();
|
|
35
|
+
|
|
36
|
+
expect(BundleVite).toHaveBeenCalledWith(args);
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
itBundlesWithWebpack();
|
|
41
|
+
|
|
42
|
+
describe('with --bundler=vite', () => {
|
|
43
|
+
beforeEach(() => (args = { bundler: 'vite' }));
|
|
44
|
+
|
|
45
|
+
itBundlesWithVite();
|
|
46
|
+
|
|
47
|
+
describe('with cli.bundler set to webpack', () => {
|
|
48
|
+
beforeEach(() => jest.mocked(getConfiguration).mockReturnValue({ bundler: 'webpack' }));
|
|
49
|
+
|
|
50
|
+
itBundlesWithWebpack();
|
|
51
|
+
});
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
describe('with cli.bundler set to vite', () => {
|
|
55
|
+
beforeEach(() => jest.mocked(getConfiguration).mockReturnValue({ bundler: 'vite' }));
|
|
56
|
+
|
|
57
|
+
itBundlesWithVite();
|
|
58
|
+
|
|
59
|
+
describe('with --bundler=webpack', () => {
|
|
60
|
+
beforeEach(() => (args = { bundler: 'webpack' }));
|
|
61
|
+
|
|
62
|
+
itBundlesWithVite();
|
|
63
|
+
});
|
|
64
|
+
});
|
|
65
|
+
});
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
import { Attributes, telemetry } from '../../../telemetry';
|
|
2
|
+
import { exitWhenParentExits } from '../../../utils';
|
|
3
|
+
import { Command } from '../command';
|
|
4
|
+
|
|
5
|
+
jest.mock('../../../telemetry', () => ({
|
|
6
|
+
telemetry: {
|
|
7
|
+
info: jest.fn(),
|
|
8
|
+
error: jest.fn(),
|
|
9
|
+
flush: jest.fn(() => Promise.resolve()),
|
|
10
|
+
},
|
|
11
|
+
}));
|
|
12
|
+
jest.mock('../../../utils', () => ({
|
|
13
|
+
exitWhenParentExits: jest.fn(),
|
|
14
|
+
}));
|
|
15
|
+
|
|
16
|
+
class MockCommand extends Command {
|
|
17
|
+
execute() {
|
|
18
|
+
return Promise.resolve();
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
recordStart(command: string, attributes?: Attributes): void {
|
|
22
|
+
return super.recordStart(command, attributes);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
recordEnd(error?: unknown): Promise<void> {
|
|
26
|
+
return super.recordEnd(error);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
describe(`[startup] ${Command.name} entity`, () => {
|
|
31
|
+
const name: any = 'mock-command';
|
|
32
|
+
const commandName = 'build';
|
|
33
|
+
const attributes: Attributes = { bundler: 'vite' };
|
|
34
|
+
|
|
35
|
+
let args: any;
|
|
36
|
+
|
|
37
|
+
beforeEach(() => {
|
|
38
|
+
jest.clearAllMocks();
|
|
39
|
+
args = {};
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
describe('watchForParentExit', () => {
|
|
43
|
+
const subject = () => new MockCommand(args).watchForParentExit(name);
|
|
44
|
+
|
|
45
|
+
test('does not watch for the parent process to exit', () => {
|
|
46
|
+
subject();
|
|
47
|
+
|
|
48
|
+
expect(exitWhenParentExits).not.toHaveBeenCalled();
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
describe('with watch: true', () => {
|
|
52
|
+
beforeEach(() => (args = { watch: true }));
|
|
53
|
+
|
|
54
|
+
test('watches for the parent process to exit', () => {
|
|
55
|
+
subject();
|
|
56
|
+
|
|
57
|
+
expect(exitWhenParentExits).toHaveBeenCalledWith(name);
|
|
58
|
+
});
|
|
59
|
+
});
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
describe('recordStart', () => {
|
|
63
|
+
let command: MockCommand;
|
|
64
|
+
|
|
65
|
+
beforeEach(() => (command = new MockCommand(args)));
|
|
66
|
+
|
|
67
|
+
const subject = () => command.recordStart(commandName, attributes);
|
|
68
|
+
|
|
69
|
+
test('emits a command.started event with the attributes', () => {
|
|
70
|
+
subject();
|
|
71
|
+
|
|
72
|
+
expect(telemetry.info).toHaveBeenCalledWith(
|
|
73
|
+
'command.started',
|
|
74
|
+
expect.objectContaining({
|
|
75
|
+
...attributes,
|
|
76
|
+
command: commandName,
|
|
77
|
+
runId: expect.any(String),
|
|
78
|
+
})
|
|
79
|
+
);
|
|
80
|
+
});
|
|
81
|
+
|
|
82
|
+
describe('when a run is already active', () => {
|
|
83
|
+
beforeEach(() => command.recordStart(commandName, attributes));
|
|
84
|
+
|
|
85
|
+
test('does not start a second run', () => {
|
|
86
|
+
subject();
|
|
87
|
+
|
|
88
|
+
expect(telemetry.info).toHaveBeenCalledTimes(1);
|
|
89
|
+
});
|
|
90
|
+
});
|
|
91
|
+
});
|
|
92
|
+
|
|
93
|
+
describe('recordEnd', () => {
|
|
94
|
+
let error: unknown;
|
|
95
|
+
let command: MockCommand;
|
|
96
|
+
|
|
97
|
+
beforeEach(() => {
|
|
98
|
+
error = undefined;
|
|
99
|
+
command = new MockCommand(args);
|
|
100
|
+
});
|
|
101
|
+
|
|
102
|
+
const subject = () => command.recordEnd(error);
|
|
103
|
+
|
|
104
|
+
test('does not emit anything', async () => {
|
|
105
|
+
await subject();
|
|
106
|
+
|
|
107
|
+
expect(telemetry.info).not.toHaveBeenCalled();
|
|
108
|
+
expect(telemetry.error).not.toHaveBeenCalled();
|
|
109
|
+
});
|
|
110
|
+
|
|
111
|
+
describe('when called after recordStart', () => {
|
|
112
|
+
beforeEach(() => command.recordStart(commandName, attributes));
|
|
113
|
+
|
|
114
|
+
test('emits a command.finished event with a duration', async () => {
|
|
115
|
+
await subject();
|
|
116
|
+
|
|
117
|
+
expect(telemetry.info).toHaveBeenCalledWith(
|
|
118
|
+
'command.finished',
|
|
119
|
+
expect.objectContaining({
|
|
120
|
+
...attributes,
|
|
121
|
+
command: commandName,
|
|
122
|
+
runId: expect.any(String),
|
|
123
|
+
duration: expect.any(Number),
|
|
124
|
+
})
|
|
125
|
+
);
|
|
126
|
+
});
|
|
127
|
+
|
|
128
|
+
test('flushes pending telemetry', async () => {
|
|
129
|
+
await subject();
|
|
130
|
+
|
|
131
|
+
expect(telemetry.flush).toHaveBeenCalled();
|
|
132
|
+
});
|
|
133
|
+
|
|
134
|
+
describe('with an error', () => {
|
|
135
|
+
beforeEach(() => (error = new Error('boom')));
|
|
136
|
+
|
|
137
|
+
test('emits a command.finished error event', async () => {
|
|
138
|
+
await subject();
|
|
139
|
+
|
|
140
|
+
expect(telemetry.error).toHaveBeenCalledWith(
|
|
141
|
+
'command.finished',
|
|
142
|
+
error,
|
|
143
|
+
expect.objectContaining({
|
|
144
|
+
...attributes,
|
|
145
|
+
command: commandName,
|
|
146
|
+
runId: expect.any(String),
|
|
147
|
+
duration: expect.any(Number),
|
|
148
|
+
})
|
|
149
|
+
);
|
|
150
|
+
});
|
|
151
|
+
});
|
|
152
|
+
});
|
|
153
|
+
});
|
|
154
|
+
});
|
|
@@ -40,7 +40,7 @@ describe(`[startup] ${Init.name}`, () => {
|
|
|
40
40
|
force: true,
|
|
41
41
|
});
|
|
42
42
|
expect(fs.rmSync).toHaveBeenCalledWith(path.join(cwd, '.github', 'CODEOWNERS'));
|
|
43
|
-
expect(fs.rmSync).toHaveBeenCalledWith(path.join(cwd, 'package-lock.json'));
|
|
43
|
+
expect(fs.rmSync).not.toHaveBeenCalledWith(path.join(cwd, 'package-lock.json'));
|
|
44
44
|
});
|
|
45
45
|
|
|
46
46
|
describe('when cloning fails', () => {
|
|
@@ -1,83 +1,16 @@
|
|
|
1
|
-
import { execSync } from 'child_process';
|
|
2
|
-
import { getStartupVersion } from '../../../core';
|
|
3
|
-
import { log } from '../../../utils';
|
|
4
1
|
import { Install } from '../install';
|
|
5
2
|
import { entry } from '../registry/install';
|
|
6
3
|
|
|
7
|
-
jest.mock('child_process', () => ({ execSync: jest.fn() }));
|
|
8
|
-
jest.mock('../../../core', () => ({
|
|
9
|
-
...jest.requireActual('../../../core'),
|
|
10
|
-
getStartupVersion: jest.fn(),
|
|
11
|
-
}));
|
|
12
|
-
jest.mock('../../../utils', () => ({
|
|
13
|
-
...jest.requireActual('../../../utils'),
|
|
14
|
-
log: { debug: jest.fn(), info: jest.fn() }, // suppress log output
|
|
15
|
-
}));
|
|
16
|
-
|
|
17
4
|
describe(`${Install.name}`, () => {
|
|
18
|
-
const
|
|
19
|
-
let args: ConstructorParameters<typeof Install>[0];
|
|
20
|
-
|
|
21
|
-
beforeEach(() => {
|
|
22
|
-
args = {};
|
|
23
|
-
jest.clearAllMocks();
|
|
24
|
-
jest.mocked(getStartupVersion).mockReturnValue(startupVersion);
|
|
25
|
-
});
|
|
26
|
-
|
|
27
|
-
const subject = async () => new Install(args).execute();
|
|
5
|
+
const subject = async () => new Install({}).execute();
|
|
28
6
|
|
|
29
7
|
test('allows running from global location', () => {
|
|
30
8
|
expect(entry.allowRunFromGlobal).toBe(true);
|
|
31
9
|
});
|
|
32
10
|
|
|
33
|
-
test('
|
|
34
|
-
await subject()
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
stdio: 'inherit',
|
|
38
|
-
});
|
|
39
|
-
});
|
|
40
|
-
|
|
41
|
-
const keys = ['fix', 'quiet', 'token'] satisfies (keyof typeof args)[];
|
|
42
|
-
describe.each(keys)('with --%s', option => {
|
|
43
|
-
beforeEach(() => (args[option] = true));
|
|
44
|
-
|
|
45
|
-
test(`runs install with --${option}`, async () => {
|
|
46
|
-
await subject();
|
|
47
|
-
|
|
48
|
-
expect(execSync).toHaveBeenCalledWith(
|
|
49
|
-
expect.stringContaining(`--${option}`),
|
|
50
|
-
expect.anything()
|
|
51
|
-
);
|
|
52
|
-
});
|
|
53
|
-
});
|
|
54
|
-
|
|
55
|
-
describe('with --no-token', () => {
|
|
56
|
-
beforeEach(() => (args.token = false));
|
|
57
|
-
|
|
58
|
-
test('runs install with --no-token', async () => {
|
|
59
|
-
await subject();
|
|
60
|
-
|
|
61
|
-
expect(execSync).toHaveBeenCalledWith(
|
|
62
|
-
expect.stringContaining('--no-token'),
|
|
63
|
-
expect.anything()
|
|
64
|
-
);
|
|
65
|
-
});
|
|
66
|
-
});
|
|
67
|
-
|
|
68
|
-
test('logs progress', async () => {
|
|
69
|
-
await subject();
|
|
70
|
-
|
|
71
|
-
expect(log.info).toHaveBeenCalledWith(`startup cli v${startupVersion}`);
|
|
72
|
-
});
|
|
73
|
-
|
|
74
|
-
describe('with --quiet', () => {
|
|
75
|
-
beforeEach(() => (args = { quiet: true }));
|
|
76
|
-
|
|
77
|
-
test('does not log progress', async () => {
|
|
78
|
-
await subject();
|
|
79
|
-
|
|
80
|
-
expect(log.info).not.toHaveBeenCalled();
|
|
81
|
-
});
|
|
11
|
+
test('throws guidance pointing to @servicetitan/install', async () => {
|
|
12
|
+
await expect(subject()).rejects.toThrow(
|
|
13
|
+
'The `startup install` command has been removed. Run `npx --yes @servicetitan/install` directly instead.'
|
|
14
|
+
);
|
|
82
15
|
});
|
|
83
16
|
});
|
|
@@ -83,6 +83,14 @@ describe(`[startup] ${MfeCheck.name}`, () => {
|
|
|
83
83
|
});
|
|
84
84
|
}
|
|
85
85
|
|
|
86
|
+
function itReportsCompatibleLightBundle() {
|
|
87
|
+
test('outputs human-readable compatible message', async () => {
|
|
88
|
+
await subject();
|
|
89
|
+
|
|
90
|
+
expect(utils.log.info).toHaveBeenCalledWith('Compatible: light bundle can be used');
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
|
|
86
94
|
test('allows running from global location', () => {
|
|
87
95
|
expect(entry.allowRunFromGlobal).toBe(true);
|
|
88
96
|
});
|
|
@@ -97,11 +105,7 @@ describe(`[startup] ${MfeCheck.name}`, () => {
|
|
|
97
105
|
});
|
|
98
106
|
});
|
|
99
107
|
|
|
100
|
-
|
|
101
|
-
await subject();
|
|
102
|
-
|
|
103
|
-
expect(utils.log.info).toHaveBeenCalledWith('Compatible: light bundle can be used');
|
|
104
|
-
});
|
|
108
|
+
itReportsCompatibleLightBundle();
|
|
105
109
|
|
|
106
110
|
test('does not set exit code', async () => {
|
|
107
111
|
await subject();
|
|
@@ -131,6 +135,23 @@ describe(`[startup] ${MfeCheck.name}`, () => {
|
|
|
131
135
|
});
|
|
132
136
|
});
|
|
133
137
|
});
|
|
138
|
+
|
|
139
|
+
describe('when host enables expose-shared-dependencies at the top level of cli', () => {
|
|
140
|
+
beforeEach(() => {
|
|
141
|
+
vol.fromJSON({
|
|
142
|
+
'/path/to/host/package.json': JSON.stringify({
|
|
143
|
+
name: 'host-app',
|
|
144
|
+
dependencies: mockMetadata.dependencies,
|
|
145
|
+
cli: {
|
|
146
|
+
'expose-shared-dependencies': true,
|
|
147
|
+
'shared-dependencies': mockMetadata.sharedDependencies,
|
|
148
|
+
},
|
|
149
|
+
}),
|
|
150
|
+
});
|
|
151
|
+
});
|
|
152
|
+
|
|
153
|
+
itReportsCompatibleLightBundle();
|
|
154
|
+
});
|
|
134
155
|
});
|
|
135
156
|
|
|
136
157
|
describe('when incompatible', () => {
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import { log } from '../../../utils';
|
|
1
|
+
import { exitWhenParentExits, log } from '../../../utils';
|
|
2
2
|
import { SwcCompilePackage, TscCompile, TscCompilePackage } from '../../tasks';
|
|
3
3
|
import { RunTask } from '../run-task';
|
|
4
4
|
|
|
5
5
|
jest.mock('../../../utils', () => ({
|
|
6
6
|
...jest.requireActual('../../../utils'),
|
|
7
|
+
exitWhenParentExits: jest.fn(),
|
|
7
8
|
log: { error: jest.fn(), text: jest.fn() },
|
|
8
9
|
}));
|
|
9
10
|
jest.mock('../../tasks/swc-compile-package');
|
|
@@ -34,9 +35,27 @@ describe(`[startup] ${RunTask.name}`, () => {
|
|
|
34
35
|
|
|
35
36
|
expect(jest.mocked(task).mock.instances[0].execute).toHaveBeenCalled();
|
|
36
37
|
});
|
|
38
|
+
|
|
39
|
+
test(`watches ${task.name} for the parent process to exit`, async () => {
|
|
40
|
+
await subject();
|
|
41
|
+
|
|
42
|
+
expect(jest.mocked(task).mock.instances[0].watchForParentExit).toHaveBeenCalled();
|
|
43
|
+
});
|
|
37
44
|
})
|
|
38
45
|
);
|
|
39
46
|
|
|
47
|
+
describe('watchForParentExit', () => {
|
|
48
|
+
beforeEach(() => (args = {}));
|
|
49
|
+
|
|
50
|
+
const subject = () => new RunTask(args).watchForParentExit();
|
|
51
|
+
|
|
52
|
+
test('does not watch for the parent process to exit', () => {
|
|
53
|
+
subject();
|
|
54
|
+
|
|
55
|
+
expect(exitWhenParentExits).not.toHaveBeenCalled();
|
|
56
|
+
});
|
|
57
|
+
});
|
|
58
|
+
|
|
40
59
|
describe('with empty args', () => {
|
|
41
60
|
beforeEach(() => (args = {}));
|
|
42
61
|
|