@servicetitan/startup 33.1.1 → 34.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli/commands/build.d.ts +48 -22
- package/dist/cli/commands/build.d.ts.map +1 -1
- package/dist/cli/commands/build.js +72 -52
- package/dist/cli/commands/build.js.map +1 -1
- package/dist/cli/commands/bundle-package.d.ts +54 -10
- package/dist/cli/commands/bundle-package.d.ts.map +1 -1
- package/dist/cli/commands/bundle-package.js +40 -0
- package/dist/cli/commands/bundle-package.js.map +1 -1
- package/dist/cli/commands/clean.d.ts +4 -0
- package/dist/cli/commands/clean.d.ts.map +1 -1
- package/dist/cli/commands/clean.js +50 -16
- package/dist/cli/commands/clean.js.map +1 -1
- package/dist/cli/commands/convert-eslint-config.d.ts +1 -1
- package/dist/cli/commands/convert-eslint-config.d.ts.map +1 -1
- package/dist/cli/commands/convert-eslint-config.js +2 -15
- package/dist/cli/commands/convert-eslint-config.js.map +1 -1
- package/dist/cli/commands/eslint.d.ts +29 -7
- package/dist/cli/commands/eslint.d.ts.map +1 -1
- package/dist/cli/commands/eslint.js +18 -6
- package/dist/cli/commands/eslint.js.map +1 -1
- package/dist/cli/commands/get-command.d.ts.map +1 -1
- package/dist/cli/commands/get-command.js +6 -0
- package/dist/cli/commands/get-command.js.map +1 -1
- package/dist/cli/commands/index.d.ts +2 -2
- package/dist/cli/commands/index.d.ts.map +1 -1
- package/dist/cli/commands/index.js +2 -2
- package/dist/cli/commands/index.js.map +1 -1
- package/dist/cli/commands/init.d.ts +10 -6
- package/dist/cli/commands/init.d.ts.map +1 -1
- package/dist/cli/commands/init.js +8 -6
- package/dist/cli/commands/init.js.map +1 -1
- package/dist/cli/commands/install.d.ts +27 -15
- package/dist/cli/commands/install.d.ts.map +1 -1
- package/dist/cli/commands/install.js +18 -16
- package/dist/cli/commands/install.js.map +1 -1
- package/dist/cli/commands/kendo-ui-license.d.ts +1 -0
- package/dist/cli/commands/kendo-ui-license.d.ts.map +1 -1
- package/dist/cli/commands/kendo-ui-license.js +1 -0
- package/dist/cli/commands/kendo-ui-license.js.map +1 -1
- package/dist/cli/commands/lint.d.ts +51 -17
- package/dist/cli/commands/lint.d.ts.map +1 -1
- package/dist/cli/commands/lint.js +36 -26
- package/dist/cli/commands/lint.js.map +1 -1
- package/dist/cli/commands/mfe-check.d.ts +52 -0
- package/dist/cli/commands/mfe-check.d.ts.map +1 -0
- package/dist/cli/commands/mfe-check.js +145 -0
- package/dist/cli/commands/mfe-check.js.map +1 -0
- package/dist/cli/commands/mfe-generate-metadata.d.ts +20 -0
- package/dist/cli/commands/mfe-generate-metadata.d.ts.map +1 -0
- package/dist/cli/commands/mfe-generate-metadata.js +93 -0
- package/dist/cli/commands/mfe-generate-metadata.js.map +1 -0
- package/dist/cli/commands/mfe-list.d.ts +52 -15
- package/dist/cli/commands/mfe-list.d.ts.map +1 -1
- package/dist/cli/commands/mfe-list.js +42 -29
- package/dist/cli/commands/mfe-list.js.map +1 -1
- package/dist/cli/commands/mfe-package-clean.d.ts +34 -15
- package/dist/cli/commands/mfe-package-clean.d.ts.map +1 -1
- package/dist/cli/commands/mfe-package-clean.js +43 -34
- package/dist/cli/commands/mfe-package-clean.js.map +1 -1
- package/dist/cli/commands/mfe-package-publish.d.ts +60 -22
- package/dist/cli/commands/mfe-package-publish.d.ts.map +1 -1
- package/dist/cli/commands/mfe-package-publish.js +137 -78
- package/dist/cli/commands/mfe-package-publish.js.map +1 -1
- package/dist/cli/commands/mfe-package-rollback.d.ts +40 -0
- package/dist/cli/commands/mfe-package-rollback.d.ts.map +1 -0
- package/dist/cli/commands/mfe-package-rollback.js +119 -0
- package/dist/cli/commands/mfe-package-rollback.js.map +1 -0
- package/dist/cli/commands/mfe-publish.d.ts +36 -11
- package/dist/cli/commands/mfe-publish.d.ts.map +1 -1
- package/dist/cli/commands/mfe-publish.js +72 -22
- package/dist/cli/commands/mfe-publish.js.map +1 -1
- package/dist/cli/commands/prepare-package.d.ts +14 -5
- package/dist/cli/commands/prepare-package.d.ts.map +1 -1
- package/dist/cli/commands/prepare-package.js +20 -0
- package/dist/cli/commands/prepare-package.js.map +1 -1
- package/dist/cli/commands/review/review.d.ts +17 -8
- package/dist/cli/commands/review/review.d.ts.map +1 -1
- package/dist/cli/commands/review/review.js +16 -21
- package/dist/cli/commands/review/review.js.map +1 -1
- package/dist/cli/commands/review/rules/index.d.ts.map +1 -1
- package/dist/cli/commands/review/rules/index.js +3 -1
- package/dist/cli/commands/review/rules/index.js.map +1 -1
- package/dist/cli/commands/review/rules/no-deprecated-content-base.js.map +1 -1
- package/dist/cli/commands/review/rules/prefer-open-ended-peer-dependencies.js.map +1 -1
- package/dist/cli/commands/review/rules/require-compatible-launch-darkly-sdk.js +4 -4
- package/dist/cli/commands/review/rules/require-compatible-launch-darkly-sdk.js.map +1 -1
- package/dist/cli/commands/review/rules/require-one-collection-version.js +1 -2
- package/dist/cli/commands/review/rules/require-one-collection-version.js.map +1 -1
- package/dist/cli/commands/review/rules/require-one-uikit-version.d.ts.map +1 -1
- package/dist/cli/commands/review/rules/require-one-uikit-version.js +1 -0
- package/dist/cli/commands/review/rules/require-one-uikit-version.js.map +1 -1
- package/dist/cli/commands/review/rules/require-project-version-in-root-node-modules.d.ts.map +1 -1
- package/dist/cli/commands/review/rules/require-project-version-in-root-node-modules.js +8 -8
- package/dist/cli/commands/review/rules/require-project-version-in-root-node-modules.js.map +1 -1
- package/dist/cli/commands/review/rules/require-tsconfig-references.d.ts +24 -0
- package/dist/cli/commands/review/rules/require-tsconfig-references.d.ts.map +1 -0
- package/dist/cli/commands/review/rules/require-tsconfig-references.js +146 -0
- package/dist/cli/commands/review/rules/require-tsconfig-references.js.map +1 -0
- package/dist/cli/commands/review/utils/collate-dependencies.js +1 -3
- package/dist/cli/commands/review/utils/collate-dependencies.js.map +1 -1
- package/dist/cli/commands/review/utils/compare-version.js +2 -2
- package/dist/cli/commands/review/utils/compare-version.js.map +1 -1
- package/dist/cli/commands/review/utils/set-version.js +1 -1
- package/dist/cli/commands/review/utils/set-version.js.map +1 -1
- package/dist/cli/commands/run-task.d.ts +29 -7
- package/dist/cli/commands/run-task.d.ts.map +1 -1
- package/dist/cli/commands/run-task.js +21 -8
- package/dist/cli/commands/run-task.js.map +1 -1
- package/dist/cli/commands/run-task.test.js +14 -2
- package/dist/cli/commands/run-task.test.js.map +1 -1
- package/dist/cli/commands/start.d.ts +38 -18
- package/dist/cli/commands/start.d.ts.map +1 -1
- package/dist/cli/commands/start.js +65 -45
- package/dist/cli/commands/start.js.map +1 -1
- package/dist/cli/commands/stylelint.d.ts +29 -7
- package/dist/cli/commands/stylelint.d.ts.map +1 -1
- package/dist/cli/commands/stylelint.js +18 -6
- package/dist/cli/commands/stylelint.js.map +1 -1
- package/dist/cli/commands/test/runners/vitest.js +1 -1
- package/dist/cli/commands/test/runners/vitest.js.map +1 -1
- package/dist/cli/commands/test/tests.d.ts +25 -5
- package/dist/cli/commands/test/tests.d.ts.map +1 -1
- package/dist/cli/commands/test/tests.js +22 -14
- package/dist/cli/commands/test/tests.js.map +1 -1
- package/dist/cli/commands/types.d.ts +51 -10
- package/dist/cli/commands/types.d.ts.map +1 -1
- package/dist/cli/commands/types.js +1 -0
- package/dist/cli/commands/types.js.map +1 -1
- package/dist/cli/commands/upload-sourcemaps.d.ts +26 -6
- package/dist/cli/commands/upload-sourcemaps.d.ts.map +1 -1
- package/dist/cli/commands/upload-sourcemaps.js +27 -4
- package/dist/cli/commands/upload-sourcemaps.js.map +1 -1
- package/dist/cli/commands/utils.d.ts +4 -0
- package/dist/cli/commands/utils.d.ts.map +1 -0
- package/dist/cli/commands/utils.js +28 -0
- package/dist/cli/commands/utils.js.map +1 -0
- package/dist/cli/index.js +8 -5
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/tasks/cli-task.d.ts.map +1 -1
- package/dist/cli/tasks/cli-task.js +1 -1
- package/dist/cli/tasks/cli-task.js.map +1 -1
- package/dist/cli/tasks/swc-compile-package.d.ts +1 -2
- package/dist/cli/tasks/swc-compile-package.d.ts.map +1 -1
- package/dist/cli/tasks/swc-compile-package.js.map +1 -1
- package/dist/cli/tasks/tsc-compile-package.d.ts +1 -2
- package/dist/cli/tasks/tsc-compile-package.d.ts.map +1 -1
- package/dist/cli/tasks/tsc-compile-package.js.map +1 -1
- package/dist/cli/tasks/tsc-compile.d.ts +1 -2
- package/dist/cli/tasks/tsc-compile.d.ts.map +1 -1
- package/dist/cli/tasks/tsc-compile.js.map +1 -1
- package/dist/cli/utils/bundle.d.ts.map +1 -1
- package/dist/cli/utils/bundle.js +2 -2
- package/dist/cli/utils/bundle.js.map +1 -1
- package/dist/cli/utils/check-startup-location.d.ts +4 -0
- package/dist/cli/utils/check-startup-location.d.ts.map +1 -0
- package/dist/cli/utils/check-startup-location.js +27 -0
- package/dist/cli/utils/check-startup-location.js.map +1 -0
- package/dist/cli/utils/cli-npm.d.ts +6 -0
- package/dist/cli/utils/cli-npm.d.ts.map +1 -1
- package/dist/cli/utils/cli-npm.js +25 -3
- package/dist/cli/utils/cli-npm.js.map +1 -1
- package/dist/cli/utils/compile-less.js +1 -1
- package/dist/cli/utils/compile-less.js.map +1 -1
- package/dist/cli/utils/constants.d.ts +2 -0
- package/dist/cli/utils/constants.d.ts.map +1 -0
- package/dist/cli/utils/constants.js +13 -0
- package/dist/cli/utils/constants.js.map +1 -0
- package/dist/cli/utils/copy-files.d.ts.map +1 -1
- package/dist/cli/utils/copy-files.js.map +1 -1
- package/dist/cli/utils/eslint.d.ts +1 -2
- package/dist/cli/utils/eslint.d.ts.map +1 -1
- package/dist/cli/utils/eslint.js.map +1 -1
- package/dist/cli/utils/index.d.ts +2 -0
- package/dist/cli/utils/index.d.ts.map +1 -1
- package/dist/cli/utils/index.js +2 -0
- package/dist/cli/utils/index.js.map +1 -1
- package/dist/cli/utils/is-module-installed.js +1 -1
- package/dist/cli/utils/is-module-installed.js.map +1 -1
- package/dist/cli/utils/lerna-exec.d.ts.map +1 -1
- package/dist/cli/utils/lerna-exec.js +1 -3
- package/dist/cli/utils/lerna-exec.js.map +1 -1
- package/dist/cli/utils/process-tree.js.map +1 -1
- package/dist/cli/utils/set-node-options.js +2 -4
- package/dist/cli/utils/set-node-options.js.map +1 -1
- package/dist/cli/utils/stylelint.d.ts +1 -2
- package/dist/cli/utils/stylelint.d.ts.map +1 -1
- package/dist/cli/utils/stylelint.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/jest/resolver.js +2 -2
- package/dist/jest/resolver.js.map +1 -1
- package/dist/jest/svg-transformer.d.ts.map +1 -1
- package/dist/jest/svg-transformer.js.map +1 -1
- package/dist/utils/find-packages.js +1 -1
- package/dist/utils/find-packages.js.map +1 -1
- package/dist/utils/format-relative-date.js +1 -1
- package/dist/utils/format-relative-date.js.map +1 -1
- package/dist/utils/get-configuration.d.ts +3 -0
- package/dist/utils/get-configuration.d.ts.map +1 -1
- package/dist/utils/get-configuration.js +14 -11
- package/dist/utils/get-configuration.js.map +1 -1
- package/dist/utils/get-destination-folders.d.ts.map +1 -1
- package/dist/utils/get-destination-folders.js.map +1 -1
- package/dist/utils/get-folders.d.ts.map +1 -1
- package/dist/utils/get-folders.js.map +1 -1
- package/dist/utils/get-jest-config.js +1 -1
- package/dist/utils/get-jest-config.js.map +1 -1
- package/dist/utils/get-package-data.js +1 -1
- package/dist/utils/get-package-data.js.map +1 -1
- package/dist/utils/get-packages.js.map +1 -1
- package/dist/utils/index.d.ts +1 -0
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/index.js +1 -0
- package/dist/utils/index.js.map +1 -1
- package/dist/utils/load-shared-dependencies.js.map +1 -1
- package/dist/utils/prettify.d.ts +13 -0
- package/dist/utils/prettify.d.ts.map +1 -0
- package/dist/utils/prettify.js +48 -0
- package/dist/utils/prettify.js.map +1 -0
- package/dist/utils/read-json.js +1 -1
- package/dist/utils/read-json.js.map +1 -1
- package/dist/utils/transform-svg.js +2 -2
- package/dist/utils/transform-svg.js.map +1 -1
- package/dist/webpack/configs/cache-config.js +1 -1
- package/dist/webpack/configs/cache-config.js.map +1 -1
- package/dist/webpack/configs/optimization-config.js +3 -4
- package/dist/webpack/configs/optimization-config.js.map +1 -1
- package/dist/webpack/configs/output-config.js +1 -1
- package/dist/webpack/configs/output-config.js.map +1 -1
- package/dist/webpack/configs/plugins/assets-manifest-plugin.d.ts.map +1 -1
- package/dist/webpack/configs/plugins/assets-manifest-plugin.js +5 -5
- package/dist/webpack/configs/plugins/assets-manifest-plugin.js.map +1 -1
- package/dist/webpack/configs/plugins/bundle-analyser-plugin.d.ts.map +1 -1
- package/dist/webpack/configs/plugins/bundle-analyser-plugin.js +1 -1
- package/dist/webpack/configs/plugins/bundle-analyser-plugin.js.map +1 -1
- package/dist/webpack/configs/plugins/define-exposed-dependencies-plugin.d.ts.map +1 -1
- package/dist/webpack/configs/plugins/define-exposed-dependencies-plugin.js +6 -9
- package/dist/webpack/configs/plugins/define-exposed-dependencies-plugin.js.map +1 -1
- package/dist/webpack/configs/plugins/html-tags-plugin.js +1 -1
- package/dist/webpack/configs/plugins/html-tags-plugin.js.map +1 -1
- package/dist/webpack/configs/plugins/ignore-plugin/check-resource.js +1 -1
- package/dist/webpack/configs/plugins/ignore-plugin/check-resource.js.map +1 -1
- package/dist/webpack/configs/plugins/ignore-plugin/ignore-plugin.d.ts.map +1 -1
- package/dist/webpack/configs/plugins/ignore-plugin/ignore-plugin.js.map +1 -1
- package/dist/webpack/configs/plugins/moment-locales-plugin.js +1 -1
- package/dist/webpack/configs/plugins/moment-locales-plugin.js.map +1 -1
- package/dist/webpack/configs/plugins/watch-run-plugin.d.ts.map +1 -1
- package/dist/webpack/configs/plugins/watch-run-plugin.js.map +1 -1
- package/dist/webpack/configs/types.d.ts +1 -0
- package/dist/webpack/configs/types.d.ts.map +1 -1
- package/dist/webpack/configs/utils/build-metadata.d.ts +10 -0
- package/dist/webpack/configs/utils/build-metadata.d.ts.map +1 -0
- package/dist/webpack/configs/utils/build-metadata.js +50 -0
- package/dist/webpack/configs/utils/build-metadata.js.map +1 -0
- package/dist/webpack/configs/utils/generate-metadata.d.ts.map +1 -1
- package/dist/webpack/configs/utils/generate-metadata.js +5 -24
- package/dist/webpack/configs/utils/generate-metadata.js.map +1 -1
- package/dist/webpack/configs/utils/get-exposed-dependencies.d.ts +3 -0
- package/dist/webpack/configs/utils/get-exposed-dependencies.d.ts.map +1 -0
- package/dist/webpack/configs/utils/get-exposed-dependencies.js +21 -0
- package/dist/webpack/configs/utils/get-exposed-dependencies.js.map +1 -0
- package/dist/webpack/configs/utils/get-launchdarkly-sdk-version.js +1 -1
- package/dist/webpack/configs/utils/get-launchdarkly-sdk-version.js.map +1 -1
- package/dist/webpack/configs/utils/index.d.ts +1 -0
- package/dist/webpack/configs/utils/index.d.ts.map +1 -1
- package/dist/webpack/configs/utils/index.js +1 -0
- package/dist/webpack/configs/utils/index.js.map +1 -1
- package/dist/webpack/create-webpack-config.js +10 -4
- package/dist/webpack/create-webpack-config.js.map +1 -1
- package/dist/webpack/loaders/expose-loader/index.d.ts.map +1 -1
- package/dist/webpack/loaders/expose-loader/index.js.map +1 -1
- package/dist/webpack/loaders/expose-loader/runtime/get-global-this.js +1 -1
- package/dist/webpack/loaders/expose-loader/runtime/get-global-this.js.map +1 -1
- package/dist/webpack/loaders/expose-loader/utils/get-new-user-request.js +2 -2
- package/dist/webpack/loaders/expose-loader/utils/get-new-user-request.js.map +1 -1
- package/dist/webpack/utils/stringify-config.js +2 -2
- package/dist/webpack/utils/stringify-config.js.map +1 -1
- package/dist/webpack/utils/testing/get-compiler.d.ts.map +1 -1
- package/dist/webpack/utils/testing/get-compiler.js +1 -1
- package/dist/webpack/utils/testing/get-compiler.js.map +1 -1
- package/dist/webpack/utils/testing/get-errors.d.ts.map +1 -1
- package/dist/webpack/utils/testing/get-errors.js.map +1 -1
- package/dist/webpack/utils/testing/get-warnings.d.ts.map +1 -1
- package/dist/webpack/utils/testing/get-warnings.js.map +1 -1
- package/dist/webpack/utils/testing/read-asset.d.ts.map +1 -1
- package/dist/webpack/utils/testing/read-asset.js +1 -1
- package/dist/webpack/utils/testing/read-asset.js.map +1 -1
- package/dist/webpack/utils/testing/read-assets.d.ts.map +1 -1
- package/dist/webpack/utils/testing/read-assets.js.map +1 -1
- package/package.json +35 -41
- package/src/cli/commands/__tests__/build.test.ts +32 -9
- package/src/cli/commands/__tests__/bundle-package.test.ts +2 -1
- package/src/cli/commands/__tests__/clean.test.ts +99 -8
- package/src/cli/commands/__tests__/convert-eslint-config.test.ts +14 -9
- package/src/cli/commands/__tests__/eslint.test.ts +1 -1
- package/src/cli/commands/__tests__/get-command.test.ts +3 -1
- package/src/cli/commands/__tests__/init.test.ts +14 -1
- package/src/cli/commands/__tests__/install.test.ts +6 -2
- package/src/cli/commands/__tests__/kendo-ui-license.test.ts +7 -2
- package/src/cli/commands/__tests__/lint.test.ts +4 -2
- package/src/cli/commands/__tests__/mfe-check.test.ts +346 -0
- package/src/cli/commands/__tests__/mfe-generate-metadata.test.ts +160 -0
- package/src/cli/commands/__tests__/mfe-list.test.ts +8 -1
- package/src/cli/commands/__tests__/mfe-package-clean.test.ts +0 -1
- package/src/cli/commands/__tests__/mfe-package-publish.test.ts +322 -93
- package/src/cli/commands/__tests__/mfe-package-rollback.test.ts +196 -0
- package/src/cli/commands/__tests__/mfe-publish.test.ts +65 -5
- package/src/cli/commands/__tests__/prepare-package.test.ts +3 -0
- package/src/cli/commands/__tests__/start.test.ts +30 -7
- package/src/cli/commands/__tests__/stylelint.test.ts +1 -1
- package/src/cli/commands/__tests__/styles-check.test.ts +1 -2
- package/src/cli/commands/__tests__/upload-sourcemaps.test.ts +3 -6
- package/src/cli/commands/build.ts +35 -26
- package/src/cli/commands/bundle-package.ts +11 -10
- package/src/cli/commands/clean.ts +51 -5
- package/src/cli/commands/convert-eslint-config.ts +3 -12
- package/src/cli/commands/eslint.ts +9 -11
- package/src/cli/commands/get-command.ts +6 -1
- package/src/cli/commands/index.ts +2 -2
- package/src/cli/commands/init.ts +7 -9
- package/src/cli/commands/install.ts +11 -13
- package/src/cli/commands/kendo-ui-license.ts +1 -1
- package/src/cli/commands/lint.ts +12 -18
- package/src/cli/commands/mfe-check.ts +166 -0
- package/src/cli/commands/mfe-generate-metadata.ts +69 -0
- package/src/cli/commands/mfe-list.ts +28 -30
- package/src/cli/commands/mfe-package-clean.ts +29 -34
- package/src/cli/commands/mfe-package-publish.ts +153 -87
- package/src/cli/commands/mfe-package-rollback.ts +100 -0
- package/src/cli/commands/mfe-publish.ts +80 -27
- package/src/cli/commands/prepare-package.ts +6 -5
- package/src/cli/commands/review/__tests__/review.test.ts +18 -19
- package/src/cli/commands/review/review.ts +11 -20
- package/src/cli/commands/review/rules/__tests__/no-deprecated-content-base.test.ts +1 -1
- package/src/cli/commands/review/rules/__tests__/no-deprecated-startup-install.test.ts +0 -1
- package/src/cli/commands/review/rules/__tests__/no-direct-peer-dependencies.test.ts +1 -1
- package/src/cli/commands/review/rules/__tests__/no-typescript-entry-point.test.ts +0 -1
- package/src/cli/commands/review/rules/__tests__/require-all-react-dependencies.test.ts +0 -1
- package/src/cli/commands/review/rules/__tests__/require-compatible-launch-darkly-sdk.test.ts +2 -2
- package/src/cli/commands/review/rules/__tests__/require-explicit-side-effects.test.ts +0 -1
- package/src/cli/commands/review/rules/__tests__/require-npmrc.test.ts +0 -1
- package/src/cli/commands/review/rules/__tests__/require-one-anvil-uikit-contrib-version.test.ts +1 -2
- package/src/cli/commands/review/rules/__tests__/require-one-collection-version.test.ts +0 -1
- package/src/cli/commands/review/rules/__tests__/require-one-package-version.test.ts +0 -1
- package/src/cli/commands/review/rules/__tests__/require-one-react-version.test.ts +0 -1
- package/src/cli/commands/review/rules/__tests__/require-one-uikit-version.test.ts +1 -1
- package/src/cli/commands/review/rules/__tests__/require-project-version-in-root-node-modules.test.ts +2 -3
- package/src/cli/commands/review/rules/__tests__/require-servicetitan-scope.test.ts +0 -1
- package/src/cli/commands/review/rules/__tests__/require-tsconfig-references.test.ts +315 -0
- package/src/cli/commands/review/rules/index.ts +2 -0
- package/src/cli/commands/review/rules/require-compatible-launch-darkly-sdk.ts +1 -1
- package/src/cli/commands/review/rules/require-one-uikit-version.ts +1 -0
- package/src/cli/commands/review/rules/require-project-version-in-root-node-modules.ts +3 -3
- package/src/cli/commands/review/rules/require-tsconfig-references.ts +157 -0
- package/src/cli/commands/review/utils/__tests__/set-version.test.ts +0 -1
- package/src/cli/commands/run-task.test.ts +15 -3
- package/src/cli/commands/run-task.ts +12 -14
- package/src/cli/commands/start.ts +75 -59
- package/src/cli/commands/stylelint.ts +9 -11
- package/src/cli/commands/test/runners/__tests__/jest.test.ts +1 -2
- package/src/cli/commands/test/runners/vitest.ts +1 -1
- package/src/cli/commands/test/tests.ts +13 -15
- package/src/cli/commands/types.ts +53 -7
- package/src/cli/commands/upload-sourcemaps.ts +14 -12
- package/src/cli/commands/utils.ts +6 -0
- package/src/cli/index.ts +11 -7
- package/src/cli/tasks/__tests__/cli-task.test.ts +1 -1
- package/src/cli/tasks/__tests__/swc-compile-package.test.ts +3 -1
- package/src/cli/tasks/__tests__/tsc-compile-package.test.ts +2 -0
- package/src/cli/tasks/__tests__/tsc-compile.test.ts +3 -13
- package/src/cli/tasks/cli-task.ts +1 -1
- package/src/cli/tasks/swc-compile-package.ts +1 -3
- package/src/cli/tasks/tsc-compile-package.ts +1 -2
- package/src/cli/tasks/tsc-compile.ts +1 -2
- package/src/cli/utils/__tests__/bundle.test.ts +1 -2
- package/src/cli/utils/__tests__/check-args.test.ts +1 -1
- package/src/cli/utils/__tests__/check-startup-location.test.ts +88 -0
- package/src/cli/utils/__tests__/cli-git.test.ts +1 -2
- package/src/cli/utils/__tests__/cli-npm.test.ts +51 -2
- package/src/cli/utils/__tests__/cli-os.test.ts +1 -2
- package/src/cli/utils/__tests__/compile.test.ts +1 -1
- package/src/cli/utils/__tests__/copy-files.test.ts +0 -1
- package/src/cli/utils/__tests__/eslint.test.ts +1 -1
- package/src/cli/utils/__tests__/lerna-exec.test.ts +1 -2
- package/src/cli/utils/__tests__/maybe-create-git-folder.test.ts +0 -1
- package/src/cli/utils/__tests__/set-node-options.test.ts +0 -1
- package/src/cli/utils/__tests__/stylelint.test.ts +1 -1
- package/src/cli/utils/bundle.ts +1 -3
- package/src/cli/utils/check-startup-location.ts +21 -0
- package/src/cli/utils/cli-npm.ts +22 -0
- package/src/cli/utils/compile-less.ts +1 -1
- package/src/cli/utils/constants.ts +1 -0
- package/src/cli/utils/copy-files.ts +0 -1
- package/src/cli/utils/eslint.ts +1 -3
- package/src/cli/utils/index.ts +2 -0
- package/src/cli/utils/lerna-exec.ts +0 -1
- package/src/cli/utils/stylelint.ts +1 -2
- package/src/index.ts +1 -1
- package/src/jest/svg-transformer.ts +0 -1
- package/src/utils/__tests__/get-branch-configs.test.ts +0 -1
- package/src/utils/__tests__/get-configuration.test.ts +0 -1
- package/src/utils/__tests__/get-destination-folders.test.ts +1 -2
- package/src/utils/__tests__/get-folders.test.ts +0 -1
- package/src/utils/__tests__/get-jest-config.test.ts +1 -2
- package/src/utils/__tests__/get-package-data.test.ts +1 -2
- package/src/utils/__tests__/get-packages.test.ts +1 -1
- package/src/utils/__tests__/get-startup-version.test.ts +0 -1
- package/src/utils/__tests__/get-tsconfig.test.ts +0 -1
- package/src/utils/__tests__/load-shared-dependencies.test.ts +1 -1
- package/src/utils/__tests__/log.test.ts +1 -1
- package/src/utils/__tests__/prettify.test.ts +80 -0
- package/src/utils/__tests__/read-json.test.ts +0 -1
- package/src/utils/find-packages.ts +1 -1
- package/src/utils/get-configuration.ts +8 -7
- package/src/utils/get-destination-folders.ts +0 -1
- package/src/utils/get-folders.ts +0 -1
- package/src/utils/get-jest-config.ts +1 -1
- package/src/utils/index.ts +1 -0
- package/src/utils/prettify.ts +36 -0
- package/src/webpack/__tests__/create-webpack-config-shared-dependencies.test.ts +6 -2
- package/src/webpack/__tests__/create-webpack-config-web-component.test.ts +7 -4
- package/src/webpack/__tests__/create-webpack-config.test.ts +8 -4
- package/src/webpack/configs/cache-config.ts +1 -1
- package/src/webpack/configs/plugins/assets-manifest-plugin.ts +1 -1
- package/src/webpack/configs/plugins/bundle-analyser-plugin.ts +2 -2
- package/src/webpack/configs/plugins/define-exposed-dependencies-plugin.ts +6 -15
- package/src/webpack/configs/plugins/ignore-plugin/__tests__/get-package-json.test.ts +1 -1
- package/src/webpack/configs/plugins/ignore-plugin/__tests__/is-optional-peer-dependency.test.ts +1 -1
- package/src/webpack/configs/plugins/ignore-plugin/ignore-plugin.ts +0 -1
- package/src/webpack/configs/plugins/watch-run-plugin.ts +0 -1
- package/src/webpack/configs/types.ts +1 -0
- package/src/webpack/configs/utils/__tests__/build-metadata.test.ts +71 -0
- package/src/webpack/configs/utils/__tests__/generate-metadata.test.ts +42 -46
- package/src/webpack/configs/utils/__tests__/get-exposed-dependencies.test.ts +39 -0
- package/src/webpack/configs/utils/__tests__/get-web-components-version.test.ts +0 -1
- package/src/webpack/configs/utils/build-metadata.ts +40 -0
- package/src/webpack/configs/utils/generate-metadata.ts +7 -21
- package/src/webpack/configs/utils/get-exposed-dependencies.ts +17 -0
- package/src/webpack/configs/utils/index.ts +1 -0
- package/src/webpack/create-webpack-config.ts +3 -3
- package/src/webpack/loaders/expose-loader/__tests__/index.test.ts +0 -2
- package/src/webpack/loaders/expose-loader/index.ts +0 -1
- package/src/webpack/utils/testing/get-compiler.ts +1 -3
- package/src/webpack/utils/testing/get-errors.ts +0 -1
- package/src/webpack/utils/testing/get-warnings.ts +0 -1
- package/src/webpack/utils/testing/read-asset.ts +1 -2
- package/src/webpack/utils/testing/read-assets.ts +0 -1
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import path from 'path';
|
|
2
2
|
import { lint } from 'stylelint';
|
|
3
|
-
import { CommandArgs } from '../commands';
|
|
4
3
|
import { getDestinationFolders, getStylelintConfiguration, log } from '../../utils';
|
|
5
4
|
|
|
6
|
-
interface Args
|
|
5
|
+
interface Args {
|
|
7
6
|
fix?: boolean;
|
|
8
7
|
paths?: string[];
|
|
9
8
|
}
|
package/src/index.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { fs, vol } from 'memfs';
|
|
2
|
-
import { getPackages } from '../get-packages';
|
|
3
|
-
|
|
4
2
|
import { getDestinationFolders } from '../get-destination-folders';
|
|
3
|
+
import { getPackages } from '../get-packages';
|
|
5
4
|
|
|
6
5
|
jest.mock('fs', () => fs);
|
|
7
6
|
jest.mock('../get-packages', () => ({ getPackages: jest.fn() }));
|
|
@@ -2,9 +2,8 @@ import { Config } from '@jest/types';
|
|
|
2
2
|
import path from 'path';
|
|
3
3
|
import { getJestConfiguration } from '../get-configuration';
|
|
4
4
|
import { getDestinationFolders } from '../get-destination-folders';
|
|
5
|
-
import { pick } from '../pick';
|
|
6
|
-
|
|
7
5
|
import { getJestConfigCLI } from '../get-jest-config';
|
|
6
|
+
import { pick } from '../pick';
|
|
8
7
|
|
|
9
8
|
jest.mock('../get-destination-folders');
|
|
10
9
|
jest.mock('../get-configuration', () => ({
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { loadSharedDependencies } from '../load-shared-dependencies';
|
|
2
2
|
|
|
3
|
-
describe(`[startup]
|
|
3
|
+
describe(`[startup] ${loadSharedDependencies.name}`, () => {
|
|
4
4
|
const defaultSharedDependencies = {
|
|
5
5
|
'@servicetitan/design-system': 'SharedDependencies.ServiceTitan.DesignSystem',
|
|
6
6
|
'@servicetitan/anvil2': 'SharedDependencies.ServiceTitan.Anvil2',
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { exec, execSync } from 'node:child_process';
|
|
2
|
+
import { prettify, prettifySync } from '../prettify';
|
|
3
|
+
|
|
4
|
+
jest.mock('node:child_process', () => ({
|
|
5
|
+
exec: jest.fn(),
|
|
6
|
+
execSync: jest.fn(),
|
|
7
|
+
}));
|
|
8
|
+
|
|
9
|
+
describe('[startup] Prettify Utils', () => {
|
|
10
|
+
const filename = '/path/to/file.ts';
|
|
11
|
+
const expectedCommand = `npx prettier -w "${filename}"`;
|
|
12
|
+
|
|
13
|
+
beforeEach(() => {
|
|
14
|
+
jest.resetAllMocks();
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
describe(`${prettify.name}`, () => {
|
|
18
|
+
const subject = () => prettify(filename);
|
|
19
|
+
|
|
20
|
+
beforeEach(() => {
|
|
21
|
+
jest.mocked(exec).mockImplementation(((_cmd: string, callback: any) => {
|
|
22
|
+
callback(null, '', '');
|
|
23
|
+
}) as any);
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
test('executes correct prettier command', async () => {
|
|
27
|
+
await subject();
|
|
28
|
+
|
|
29
|
+
expect(exec).toHaveBeenCalledWith(expectedCommand, expect.any(Function));
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
describe('when prettier fails', () => {
|
|
33
|
+
const exitCode = 2;
|
|
34
|
+
|
|
35
|
+
beforeEach(() => {
|
|
36
|
+
jest.mocked(exec).mockImplementation(((_cmd: string, callback: any) => {
|
|
37
|
+
callback({ exitCode });
|
|
38
|
+
}) as any);
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
test('throws error with exit code', async () => {
|
|
42
|
+
await expect(subject()).rejects.toThrow(
|
|
43
|
+
`prettier failed with exit code ${exitCode}`
|
|
44
|
+
);
|
|
45
|
+
});
|
|
46
|
+
});
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
describe(`${prettifySync.name}`, () => {
|
|
50
|
+
const subject = () => prettifySync(filename);
|
|
51
|
+
|
|
52
|
+
beforeEach(() => {
|
|
53
|
+
jest.mocked(execSync).mockReturnValue('');
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
test('executes correct prettier command', () => {
|
|
57
|
+
subject();
|
|
58
|
+
|
|
59
|
+
expect(execSync).toHaveBeenCalledWith(expectedCommand, {
|
|
60
|
+
stdio: ['pipe', 'ignore', 'pipe'],
|
|
61
|
+
});
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
describe('when prettier fails', () => {
|
|
65
|
+
const status = 2;
|
|
66
|
+
|
|
67
|
+
beforeEach(() => {
|
|
68
|
+
jest.mocked(execSync).mockImplementation(() => {
|
|
69
|
+
const error = new Error('Command failed') as Error & { status: number };
|
|
70
|
+
error.status = status;
|
|
71
|
+
throw error;
|
|
72
|
+
});
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
test('throws error with exit code', () => {
|
|
76
|
+
expect(() => subject()).toThrow(`prettier failed with exit code ${status}`);
|
|
77
|
+
});
|
|
78
|
+
});
|
|
79
|
+
});
|
|
80
|
+
});
|
|
@@ -2,8 +2,8 @@ import { globSync } from 'glob';
|
|
|
2
2
|
import multimatch from 'multimatch';
|
|
3
3
|
import path from 'path';
|
|
4
4
|
import { findUp } from './find-up';
|
|
5
|
-
import { readJsonSafe } from './read-json';
|
|
6
5
|
import { log } from './log';
|
|
6
|
+
import { readJsonSafe } from './read-json';
|
|
7
7
|
|
|
8
8
|
export interface ProjectPackage extends Record<string, any> {
|
|
9
9
|
name: string;
|
|
@@ -6,10 +6,9 @@ import path from 'path';
|
|
|
6
6
|
import { LinterOptions } from 'stylelint';
|
|
7
7
|
import { ViteUserConfig } from 'vitest/config';
|
|
8
8
|
import { Configuration as WebpackDevServerConfiguration } from 'webpack-dev-server';
|
|
9
|
-
|
|
10
9
|
import { ReviewConfiguration } from '../cli/commands/review';
|
|
11
|
-
import { log } from './log';
|
|
12
10
|
import { getFolders } from './get-folders';
|
|
11
|
+
import { log } from './log';
|
|
13
12
|
import { readJson, readJsonSafe } from './read-json';
|
|
14
13
|
|
|
15
14
|
export const allowedWebpackDevServerOptions = ['headers', 'port', 'proxy', 'static'] as const;
|
|
@@ -28,11 +27,10 @@ export interface MinifyOptions {
|
|
|
28
27
|
js?: boolean | MinifyJSOptions;
|
|
29
28
|
}
|
|
30
29
|
|
|
31
|
-
export interface WebpackConfiguration
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
> {
|
|
30
|
+
export interface WebpackConfiguration extends Omit<
|
|
31
|
+
Pick<WebpackDevServerConfiguration, ElementType<typeof allowedWebpackDevServerOptions>>,
|
|
32
|
+
'proxy'
|
|
33
|
+
> {
|
|
36
34
|
'contentBase'?: boolean | string | string[] | number; // deprecated 2024-07
|
|
37
35
|
'custom-style-rules'?: boolean;
|
|
38
36
|
'expose-shared-dependencies'?: boolean;
|
|
@@ -71,9 +69,12 @@ export enum CommandName {
|
|
|
71
69
|
'install' = 'install',
|
|
72
70
|
'kendo-ui-license' = 'kendo-ui-license',
|
|
73
71
|
'lint' = 'lint',
|
|
72
|
+
'mfe-check' = 'mfe-check',
|
|
73
|
+
'mfe-generate-metadata' = 'mfe-generate-metadata',
|
|
74
74
|
'mfe-list' = 'mfe-list',
|
|
75
75
|
'mfe-package-clean' = 'mfe-package-clean',
|
|
76
76
|
'mfe-package-publish' = 'mfe-package-publish',
|
|
77
|
+
'mfe-package-rollback' = 'mfe-package-rollback',
|
|
77
78
|
'mfe-publish' = 'mfe-publish',
|
|
78
79
|
'prepare-package' = 'prepare-package',
|
|
79
80
|
'review' = 'review',
|
package/src/utils/get-folders.ts
CHANGED
|
@@ -2,8 +2,8 @@ import { Config } from '@jest/types';
|
|
|
2
2
|
import path from 'path';
|
|
3
3
|
import { getJestConfiguration } from './get-configuration';
|
|
4
4
|
import { getDestinationFolders } from './get-destination-folders';
|
|
5
|
-
import { toArray } from './to-array';
|
|
6
5
|
import { omit } from './omit';
|
|
6
|
+
import { toArray } from './to-array';
|
|
7
7
|
|
|
8
8
|
function getDefaultJestConfiguration() {
|
|
9
9
|
const moduleNameMapper = {
|
package/src/utils/index.ts
CHANGED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { exec, execSync } from 'node:child_process';
|
|
2
|
+
import { promisify } from 'node:util';
|
|
3
|
+
|
|
4
|
+
function getCommand(filename: string) {
|
|
5
|
+
return `npx prettier -w "${filename}"`;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
function createError(exitCode: number) {
|
|
9
|
+
return new Error(`prettier failed with exit code ${exitCode}`);
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Format a file using Prettier.
|
|
14
|
+
* @param filename - The path to the file to format
|
|
15
|
+
* @throws Error if Prettier fails
|
|
16
|
+
*/
|
|
17
|
+
export async function prettify(filename: string) {
|
|
18
|
+
try {
|
|
19
|
+
await promisify(exec)(getCommand(filename));
|
|
20
|
+
} catch (error: any) {
|
|
21
|
+
throw createError(error.exitCode);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Format a file using Prettier.
|
|
27
|
+
* @param filename - The path to the file to format
|
|
28
|
+
* @throws Error if Prettier fails
|
|
29
|
+
*/
|
|
30
|
+
export function prettifySync(filename: string) {
|
|
31
|
+
try {
|
|
32
|
+
execSync(getCommand(filename), { stdio: ['pipe', 'ignore', 'pipe'] });
|
|
33
|
+
} catch (error: any) {
|
|
34
|
+
throw createError(error.status);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { fs, vol } from 'memfs';
|
|
2
|
+
|
|
2
3
|
import * as mockFS from 'fs';
|
|
3
4
|
import HtmlWebpackPlugin from 'html-webpack-plugin';
|
|
4
5
|
import HtmlWebpackTagsPlugin from 'html-webpack-tags-plugin';
|
|
@@ -8,6 +9,7 @@ import { DefinePlugin, EntryObject } from 'webpack';
|
|
|
8
9
|
import { WebpackAssetsManifest } from 'webpack-assets-manifest';
|
|
9
10
|
import RemoveEmptyScriptsPlugin from 'webpack-remove-empty-scripts';
|
|
10
11
|
import VirtualModulesPlugin from 'webpack-virtual-modules';
|
|
12
|
+
import yargs from 'yargs';
|
|
11
13
|
import {
|
|
12
14
|
getFolders,
|
|
13
15
|
getPackageData,
|
|
@@ -22,9 +24,8 @@ import {
|
|
|
22
24
|
} from '../../utils';
|
|
23
25
|
import { miniCssPluginStyleRules } from '../__mocks__';
|
|
24
26
|
import { getLaunchDarklySdkVersion } from '../configs/utils/get-launchdarkly-sdk-version';
|
|
25
|
-
import { getModuleEntryPath } from '../utils';
|
|
26
|
-
|
|
27
27
|
import { createWebpackConfig } from '../index';
|
|
28
|
+
import { getModuleEntryPath } from '../utils';
|
|
28
29
|
|
|
29
30
|
jest.mock('fs', () => fs);
|
|
30
31
|
jest.mock('html-webpack-plugin', () => jest.fn());
|
|
@@ -40,6 +41,8 @@ jest.mock('webpack', () => ({
|
|
|
40
41
|
jest.mock('webpack-assets-manifest', () => ({ WebpackAssetsManifest: jest.fn() }));
|
|
41
42
|
jest.mock('webpack-remove-empty-scripts', () => jest.fn());
|
|
42
43
|
jest.mock('webpack-virtual-modules', () => jest.fn());
|
|
44
|
+
jest.mock('yargs', () => jest.fn());
|
|
45
|
+
jest.mock('yargs/helpers', () => ({ hideBin: jest.fn() }));
|
|
43
46
|
|
|
44
47
|
jest.mock('../../utils', () => ({
|
|
45
48
|
...jest.requireActual('../../utils'),
|
|
@@ -102,6 +105,7 @@ describe(`[startup] ${createWebpackConfig.name}`, () => {
|
|
|
102
105
|
jest.mocked(RemoveEmptyScriptsPlugin).mockImplementation(
|
|
103
106
|
mockPlugIn('WebpackRemoveEmptyScriptsPlugin')
|
|
104
107
|
);
|
|
108
|
+
jest.mocked(yargs).mockImplementation(() => ({ argv: {} }) as any);
|
|
105
109
|
|
|
106
110
|
jest.mocked(getFolders).mockReturnValue({ source, destination });
|
|
107
111
|
jest.mocked(getModuleEntryPath).mockImplementation(name => `${name}/entryPath`);
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import HtmlWebpackPlugin from 'html-webpack-plugin';
|
|
2
|
-
import MiniCssExtractPlugin from 'mini-css-extract-plugin';
|
|
3
2
|
import { fs, vol } from 'memfs';
|
|
3
|
+
import MiniCssExtractPlugin from 'mini-css-extract-plugin';
|
|
4
4
|
import path from 'path';
|
|
5
5
|
import { DefinePlugin } from 'webpack';
|
|
6
6
|
import { WebpackAssetsManifest } from 'webpack-assets-manifest';
|
|
7
7
|
import VirtualModulesPlugin from 'webpack-virtual-modules';
|
|
8
|
-
|
|
8
|
+
import yargs from 'yargs';
|
|
9
9
|
import { webpackDevConfigFileName, webpackProdConfigFileName } from '../../cli/utils';
|
|
10
10
|
import {
|
|
11
11
|
getFolders,
|
|
@@ -17,9 +17,8 @@ import {
|
|
|
17
17
|
} from '../../utils';
|
|
18
18
|
import { miniCssPluginStyleRules } from '../__mocks__';
|
|
19
19
|
import { generateMetadata } from '../configs/utils';
|
|
20
|
-
import { getCallerFile, splitByEntry } from '../utils';
|
|
21
|
-
|
|
22
20
|
import { createWebpackConfig } from '../index';
|
|
21
|
+
import { getCallerFile, splitByEntry } from '../utils';
|
|
23
22
|
|
|
24
23
|
jest.mock('fs', () => fs);
|
|
25
24
|
jest.mock('html-webpack-plugin', () => jest.fn());
|
|
@@ -33,6 +32,9 @@ jest.mock('webpack', () => ({
|
|
|
33
32
|
}));
|
|
34
33
|
jest.mock('webpack-assets-manifest', () => ({ WebpackAssetsManifest: jest.fn() }));
|
|
35
34
|
jest.mock('webpack-virtual-modules', () => jest.fn());
|
|
35
|
+
jest.mock('yargs', () => jest.fn());
|
|
36
|
+
jest.mock('yargs/helpers', () => ({ hideBin: jest.fn() }));
|
|
37
|
+
|
|
36
38
|
jest.mock('../../utils', () => ({
|
|
37
39
|
...jest.requireActual('../../utils'),
|
|
38
40
|
getFolders: jest.fn(),
|
|
@@ -103,6 +105,7 @@ describe(`[startup] ${createWebpackConfig.name}`, () => {
|
|
|
103
105
|
jest.mocked(HtmlWebpackPlugin).mockImplementation(mockPlugIn('HtmlWebpackPlugin'));
|
|
104
106
|
jest.mocked(VirtualModulesPlugin).mockImplementation(mockPlugIn('VirtualModulesPlugin'));
|
|
105
107
|
jest.mocked(WebpackAssetsManifest).mockImplementation(mockPlugIn('WebpackAssetsManifest'));
|
|
108
|
+
jest.mocked(yargs).mockImplementation(() => ({ argv: {} }) as any);
|
|
106
109
|
|
|
107
110
|
jest.mocked(getCallerFile).mockReturnValue('');
|
|
108
111
|
jest.mocked(getFolders).mockReturnValue({ source, destination });
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import CssMinimizerWebpackPlugin from 'css-minimizer-webpack-plugin';
|
|
2
2
|
import HtmlWebpackPlugin from 'html-webpack-plugin';
|
|
3
|
-
import MiniCssExtractPlugin from 'mini-css-extract-plugin';
|
|
4
3
|
import { fs, vol } from 'memfs';
|
|
4
|
+
import MiniCssExtractPlugin from 'mini-css-extract-plugin';
|
|
5
5
|
import MomentLocalesPlugin from 'moment-locales-webpack-plugin';
|
|
6
6
|
import os from 'os';
|
|
7
7
|
import path from 'path';
|
|
8
8
|
import TerserPlugin from 'terser-webpack-plugin';
|
|
9
9
|
import { IgnorePlugin, ProvidePlugin } from 'webpack';
|
|
10
10
|
import WebpackDevServer from 'webpack-dev-server';
|
|
11
|
+
import yargs from 'yargs';
|
|
11
12
|
const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin;
|
|
12
13
|
const FilterWarningsPlugin = require('webpack-filter-warnings-plugin');
|
|
13
|
-
import { argv } from 'yargs';
|
|
14
14
|
|
|
15
15
|
import {
|
|
16
16
|
Package,
|
|
@@ -50,7 +50,9 @@ jest.mock('webpack-assets-manifest', () => ({ WebpackAssetsManifest: jest.fn() }
|
|
|
50
50
|
jest.mock('webpack-bundle-analyzer', () => ({ BundleAnalyzerPlugin: jest.fn() }));
|
|
51
51
|
jest.mock('webpack-filter-warnings-plugin', () => jest.fn());
|
|
52
52
|
jest.mock('webpack-virtual-modules', () => jest.fn());
|
|
53
|
-
jest.mock('yargs', () => (
|
|
53
|
+
jest.mock('yargs', () => jest.fn());
|
|
54
|
+
jest.mock('yargs/helpers', () => ({ hideBin: jest.fn() }));
|
|
55
|
+
|
|
54
56
|
jest.mock('../../utils', () => ({
|
|
55
57
|
...jest.requireActual('../../utils'),
|
|
56
58
|
getConfiguration: jest.fn(),
|
|
@@ -93,6 +95,7 @@ describe(`[startup] ${createWebpackConfig.name}`, () => {
|
|
|
93
95
|
let overrides: Parameters<typeof createWebpackConfig>[0];
|
|
94
96
|
let options: Parameters<typeof createWebpackConfig>[1];
|
|
95
97
|
let configuration: { webpack?: WebpackConfiguration };
|
|
98
|
+
let argv: Partial<yargs.Argv>;
|
|
96
99
|
|
|
97
100
|
function mockPlugIn(name: string): any {
|
|
98
101
|
return (options: Record<string, any>): any => ({ [name]: options });
|
|
@@ -104,6 +107,7 @@ describe(`[startup] ${createWebpackConfig.name}`, () => {
|
|
|
104
107
|
}
|
|
105
108
|
|
|
106
109
|
beforeEach(() => {
|
|
110
|
+
argv = {};
|
|
107
111
|
packages = [];
|
|
108
112
|
overrides = {
|
|
109
113
|
plugins: {
|
|
@@ -147,7 +151,7 @@ describe(`[startup] ${createWebpackConfig.name}`, () => {
|
|
|
147
151
|
jest.mocked(getTsConfig).mockReturnValue(tsConfig);
|
|
148
152
|
jest.mocked(loadSharedDependencies).mockReturnValue(sharedDependencies);
|
|
149
153
|
|
|
150
|
-
|
|
154
|
+
jest.mocked(yargs).mockImplementation(() => ({ argv }) as any);
|
|
151
155
|
|
|
152
156
|
vol.fromJSON({ [packageJson]: JSON.stringify({ name: packageName }) });
|
|
153
157
|
});
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import fs from 'fs';
|
|
2
2
|
import path from 'path';
|
|
3
3
|
import { WebpackAssetsManifest } from 'webpack-assets-manifest';
|
|
4
|
+
import { readJsonSafe } from '../../../utils';
|
|
4
5
|
import { Context, Overrides } from '../types';
|
|
5
6
|
import { generateMetadata } from '../utils';
|
|
6
|
-
import { readJsonSafe } from '../../../utils';
|
|
7
7
|
|
|
8
8
|
interface Metadata {
|
|
9
9
|
entryPointsPath: string;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import path from 'path';
|
|
2
1
|
import os from 'os';
|
|
3
|
-
|
|
2
|
+
import path from 'path';
|
|
4
3
|
import { Context, Overrides } from '../types';
|
|
5
4
|
import { getBundleType } from '../utils';
|
|
5
|
+
const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin;
|
|
6
6
|
|
|
7
7
|
export function bundleAnalyzerPlugin(context: Context, _: Overrides) {
|
|
8
8
|
if (!context.buildStat) {
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { DefinePlugin } from 'webpack';
|
|
2
2
|
import { getPackageDependencyVersion } from '../../../utils';
|
|
3
3
|
import { Context, Overrides } from '../types';
|
|
4
|
+
import { getExposedDependencies } from '../utils';
|
|
4
5
|
|
|
5
6
|
export function defineExposedDependenciesPlugin(context: Context, _: Overrides) {
|
|
6
7
|
const { emitExposedDependencies, isExposeSharedDependencies } = context;
|
|
@@ -9,22 +10,12 @@ export function defineExposedDependenciesPlugin(context: Context, _: Overrides)
|
|
|
9
10
|
}
|
|
10
11
|
|
|
11
12
|
const { packageData, sharedDependencies } = context;
|
|
13
|
+
const exposedDependencies = getExposedDependencies(sharedDependencies, dependency =>
|
|
14
|
+
getPackageDependencyVersion(dependency, packageData.dependencies?.[dependency])
|
|
15
|
+
);
|
|
16
|
+
|
|
12
17
|
return new DefinePlugin({
|
|
13
18
|
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
14
|
-
EXPOSED_DEPENDENCIES: JSON.stringify(
|
|
15
|
-
Object.entries(sharedDependencies).reduce(
|
|
16
|
-
(result, [dependency, variable]) =>
|
|
17
|
-
Object.assign(result, {
|
|
18
|
-
[dependency]: {
|
|
19
|
-
version: getPackageDependencyVersion(
|
|
20
|
-
dependency,
|
|
21
|
-
packageData.dependencies?.[dependency]
|
|
22
|
-
),
|
|
23
|
-
variable,
|
|
24
|
-
},
|
|
25
|
-
}),
|
|
26
|
-
{}
|
|
27
|
-
)
|
|
28
|
-
),
|
|
19
|
+
EXPOSED_DEPENDENCIES: JSON.stringify(exposedDependencies),
|
|
29
20
|
});
|
|
30
21
|
}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { fs, vol } from 'memfs';
|
|
2
|
+
import { getStartupVersion } from '../../../../utils/get-startup-version';
|
|
3
|
+
import { buildMetadata, BuildMetadataParams } from '../build-metadata';
|
|
4
|
+
import { getLaunchDarklySdkVersion } from '../get-launchdarkly-sdk-version';
|
|
5
|
+
import { getWebComponentsVersion } from '../get-web-components-version';
|
|
6
|
+
|
|
7
|
+
jest.mock('fs', () => fs);
|
|
8
|
+
jest.mock('../../../../utils/get-startup-version');
|
|
9
|
+
jest.mock('../get-launchdarkly-sdk-version');
|
|
10
|
+
jest.mock('../get-web-components-version');
|
|
11
|
+
|
|
12
|
+
describe(`[startup] ${buildMetadata.name}`, () => {
|
|
13
|
+
const destination = 'dist';
|
|
14
|
+
const startupVersion = '1.0';
|
|
15
|
+
const webComponentsVersion = '2.0';
|
|
16
|
+
const launchDarklySdkVersion = '3.0';
|
|
17
|
+
|
|
18
|
+
const defaultParams: BuildMetadataParams = {
|
|
19
|
+
destination,
|
|
20
|
+
name: '@servicetitan/test-package',
|
|
21
|
+
version: '1.0.0',
|
|
22
|
+
dependencies: { foo: '1.0.1' },
|
|
23
|
+
sharedDependencies: { react: 'SharedDependencies.React' },
|
|
24
|
+
};
|
|
25
|
+
let params: BuildMetadataParams;
|
|
26
|
+
|
|
27
|
+
beforeEach(() => {
|
|
28
|
+
params = { ...defaultParams };
|
|
29
|
+
vol.fromJSON({});
|
|
30
|
+
jest.mocked(getStartupVersion).mockReturnValue(startupVersion);
|
|
31
|
+
jest.mocked(getWebComponentsVersion).mockReturnValue(webComponentsVersion);
|
|
32
|
+
jest.mocked(getLaunchDarklySdkVersion).mockReturnValue(launchDarklySdkVersion);
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
afterEach(() => vol.reset());
|
|
36
|
+
|
|
37
|
+
const subject = () => buildMetadata(params);
|
|
38
|
+
|
|
39
|
+
test('builds metadata with correct structure', () => {
|
|
40
|
+
expect(subject()).toEqual({
|
|
41
|
+
name: params.name,
|
|
42
|
+
version: params.version,
|
|
43
|
+
bundledWith: {
|
|
44
|
+
'@servicetitan/startup': startupVersion,
|
|
45
|
+
'@servicetitan/web-components': webComponentsVersion,
|
|
46
|
+
'launchdarkly-js-client-sdk': launchDarklySdkVersion,
|
|
47
|
+
},
|
|
48
|
+
dependencies: params.dependencies,
|
|
49
|
+
sharedDependencies: params.sharedDependencies,
|
|
50
|
+
entrypoints: {},
|
|
51
|
+
});
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
describe('with entrypoints', () => {
|
|
55
|
+
const full = { css: ['full.css'], js: ['full.js'] };
|
|
56
|
+
const light = { css: ['light.css'], js: ['light.js'] };
|
|
57
|
+
const headless = { css: ['headless.css'], js: ['headless.js'] };
|
|
58
|
+
|
|
59
|
+
beforeEach(() => {
|
|
60
|
+
vol.fromJSON({
|
|
61
|
+
[`${destination}/bundle/full/entrypoints.json`]: JSON.stringify(full),
|
|
62
|
+
[`${destination}/bundle/light/entrypoints.json`]: JSON.stringify(light),
|
|
63
|
+
[`${destination}/bundle/headless/entrypoints.json`]: JSON.stringify(headless),
|
|
64
|
+
});
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
test('includes entrypoints', () => {
|
|
68
|
+
expect(subject().entrypoints).toEqual({ full, light, headless });
|
|
69
|
+
});
|
|
70
|
+
});
|
|
71
|
+
});
|