@servicetitan/startup 34.3.0-beta.2 → 35.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 +0 -16
- package/dist/cli/commands/build.d.ts.map +1 -1
- package/dist/cli/commands/build.js +2 -15
- package/dist/cli/commands/build.js.map +1 -1
- package/dist/cli/commands/bundle-package.d.ts.map +1 -1
- package/dist/cli/commands/bundle-package.js +0 -1
- package/dist/cli/commands/bundle-package.js.map +1 -1
- package/dist/cli/commands/get-command.js +2 -2
- package/dist/cli/commands/get-command.js.map +1 -1
- package/dist/cli/commands/mfe-check.d.ts.map +1 -1
- package/dist/cli/commands/mfe-check.js +2 -2
- package/dist/cli/commands/mfe-check.js.map +1 -1
- package/dist/cli/commands/mfe-generate-metadata.js +2 -2
- package/dist/cli/commands/mfe-generate-metadata.js.map +1 -1
- package/dist/cli/commands/mfe-package-publish.d.ts +10 -0
- package/dist/cli/commands/mfe-package-publish.d.ts.map +1 -1
- package/dist/cli/commands/mfe-package-publish.js +12 -0
- package/dist/cli/commands/mfe-package-publish.js.map +1 -1
- package/dist/cli/commands/mfe-package-rollback.d.ts +10 -1
- package/dist/cli/commands/mfe-package-rollback.d.ts.map +1 -1
- package/dist/cli/commands/mfe-package-rollback.js +15 -3
- package/dist/cli/commands/mfe-package-rollback.js.map +1 -1
- package/dist/cli/commands/mfe-publish.d.ts.map +1 -1
- package/dist/cli/commands/mfe-publish.js +10 -4
- package/dist/cli/commands/mfe-publish.js.map +1 -1
- package/dist/cli/commands/mfe-purge-cache.d.ts +57 -0
- package/dist/cli/commands/mfe-purge-cache.d.ts.map +1 -0
- package/dist/cli/commands/mfe-purge-cache.js +101 -0
- package/dist/cli/commands/mfe-purge-cache.js.map +1 -0
- package/dist/cli/commands/start.d.ts +0 -8
- package/dist/cli/commands/start.d.ts.map +1 -1
- package/dist/cli/commands/start.js +2 -8
- package/dist/cli/commands/start.js.map +1 -1
- package/dist/cli/commands/{utils.d.ts → utils/build-rollback-tag.d.ts} +1 -2
- package/dist/cli/commands/utils/build-rollback-tag.d.ts.map +1 -0
- package/dist/cli/commands/{utils.js → utils/build-rollback-tag.js} +1 -5
- package/dist/cli/commands/utils/build-rollback-tag.js.map +1 -0
- package/dist/cli/commands/utils/constants.d.ts +2 -0
- package/dist/cli/commands/utils/constants.d.ts.map +1 -0
- package/dist/cli/commands/utils/constants.js +13 -0
- package/dist/cli/commands/utils/constants.js.map +1 -0
- package/dist/cli/commands/utils/index.d.ts +4 -0
- package/dist/cli/commands/utils/index.d.ts.map +1 -0
- package/dist/{core → cli/commands/utils}/index.js +3 -7
- package/dist/cli/commands/utils/index.js.map +1 -0
- package/dist/cli/commands/utils/purge-cache.d.ts +6 -0
- package/dist/cli/commands/utils/purge-cache.d.ts.map +1 -0
- package/dist/cli/commands/utils/purge-cache.js +21 -0
- package/dist/cli/commands/utils/purge-cache.js.map +1 -0
- package/dist/cli/utils/bundle.d.ts +5 -2
- package/dist/cli/utils/bundle.d.ts.map +1 -1
- package/dist/cli/utils/bundle.js +98 -18
- package/dist/cli/utils/bundle.js.map +1 -1
- package/dist/cli/utils/cli-os.js +1 -1
- package/dist/cli/utils/cli-os.js.map +1 -1
- package/dist/index.d.ts +0 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +0 -1
- package/dist/index.js.map +1 -1
- package/dist/storybook-config/webpack-final.d.ts +1 -1
- package/dist/storybook-config/webpack-final.d.ts.map +1 -1
- package/dist/storybook-config/webpack-final.js +6 -18
- package/dist/storybook-config/webpack-final.js.map +1 -1
- package/dist/utils/get-configuration.d.ts +1 -28
- package/dist/utils/get-configuration.d.ts.map +1 -1
- package/dist/utils/get-configuration.js +2 -42
- package/dist/utils/get-configuration.js.map +1 -1
- package/dist/utils/get-package-data.d.ts.map +1 -1
- package/dist/utils/get-package-data.js +2 -3
- package/dist/utils/get-package-data.js.map +1 -1
- package/dist/webpack/configs/amd-config.d.ts +2 -3
- package/dist/webpack/configs/amd-config.d.ts.map +1 -1
- package/dist/webpack/configs/amd-config.js.map +1 -1
- package/dist/webpack/configs/cache-config.d.ts +2 -3
- package/dist/webpack/configs/cache-config.d.ts.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/dev-server-config.d.ts +2 -3
- package/dist/webpack/configs/dev-server-config.d.ts.map +1 -1
- package/dist/webpack/configs/dev-server-config.js +1 -1
- package/dist/webpack/configs/dev-server-config.js.map +1 -1
- package/dist/webpack/configs/devtool-config.d.ts +2 -3
- package/dist/webpack/configs/devtool-config.d.ts.map +1 -1
- package/dist/webpack/configs/devtool-config.js +1 -1
- package/dist/webpack/configs/devtool-config.js.map +1 -1
- package/dist/webpack/configs/entry.config.d.ts +2 -3
- package/dist/webpack/configs/entry.config.d.ts.map +1 -1
- package/dist/webpack/configs/entry.config.js +5 -6
- package/dist/webpack/configs/entry.config.js.map +1 -1
- package/dist/webpack/configs/externals-config.d.ts +2 -3
- package/dist/webpack/configs/externals-config.d.ts.map +1 -1
- package/dist/webpack/configs/externals-config.js +14 -4
- package/dist/webpack/configs/externals-config.js.map +1 -1
- package/dist/webpack/configs/index.d.ts +1 -0
- package/dist/webpack/configs/index.d.ts.map +1 -1
- package/dist/webpack/configs/index.js.map +1 -1
- package/dist/webpack/configs/loaders/css-loader.d.ts +2 -2
- package/dist/webpack/configs/loaders/css-loader.d.ts.map +1 -1
- package/dist/webpack/configs/loaders/css-loader.js +1 -2
- package/dist/webpack/configs/loaders/css-loader.js.map +1 -1
- package/dist/webpack/configs/loaders/style-loader.d.ts +2 -2
- package/dist/webpack/configs/loaders/style-loader.d.ts.map +1 -1
- package/dist/webpack/configs/loaders/style-loader.js +1 -4
- package/dist/webpack/configs/loaders/style-loader.js.map +1 -1
- package/dist/webpack/configs/module-config.d.ts +2 -3
- package/dist/webpack/configs/module-config.d.ts.map +1 -1
- package/dist/webpack/configs/module-config.js.map +1 -1
- package/dist/webpack/configs/optimization-config.d.ts +2 -3
- package/dist/webpack/configs/optimization-config.d.ts.map +1 -1
- package/dist/webpack/configs/optimization-config.js +7 -10
- package/dist/webpack/configs/optimization-config.js.map +1 -1
- package/dist/webpack/configs/output-config.d.ts +2 -3
- package/dist/webpack/configs/output-config.d.ts.map +1 -1
- package/dist/webpack/configs/output-config.js +24 -15
- package/dist/webpack/configs/output-config.js.map +1 -1
- package/dist/webpack/configs/plugins/assets-manifest-plugin.d.ts +8 -3
- package/dist/webpack/configs/plugins/assets-manifest-plugin.d.ts.map +1 -1
- package/dist/webpack/configs/plugins/assets-manifest-plugin.js +47 -10
- package/dist/webpack/configs/plugins/assets-manifest-plugin.js.map +1 -1
- package/dist/webpack/configs/plugins/bundle-analyser-plugin.d.ts +2 -3
- package/dist/webpack/configs/plugins/bundle-analyser-plugin.d.ts.map +1 -1
- package/dist/webpack/configs/plugins/bundle-analyser-plugin.js +6 -6
- package/dist/webpack/configs/plugins/bundle-analyser-plugin.js.map +1 -1
- package/dist/webpack/configs/plugins/define-exposed-dependencies-plugin.d.ts +2 -3
- package/dist/webpack/configs/plugins/define-exposed-dependencies-plugin.d.ts.map +1 -1
- package/dist/webpack/configs/plugins/define-exposed-dependencies-plugin.js +13 -4
- package/dist/webpack/configs/plugins/define-exposed-dependencies-plugin.js.map +1 -1
- package/dist/webpack/configs/plugins/define-exposed-instance-dependencies-plugin.d.ts +2 -3
- package/dist/webpack/configs/plugins/define-exposed-instance-dependencies-plugin.d.ts.map +1 -1
- package/dist/webpack/configs/plugins/define-exposed-instance-dependencies-plugin.js +12 -4
- package/dist/webpack/configs/plugins/define-exposed-instance-dependencies-plugin.js.map +1 -1
- package/dist/webpack/configs/plugins/define-web-component-name-plugin.d.ts +2 -3
- package/dist/webpack/configs/plugins/define-web-component-name-plugin.d.ts.map +1 -1
- package/dist/webpack/configs/plugins/define-web-component-name-plugin.js +6 -4
- package/dist/webpack/configs/plugins/define-web-component-name-plugin.js.map +1 -1
- package/dist/webpack/configs/plugins/filter-warnings-plugin.d.ts +2 -3
- package/dist/webpack/configs/plugins/filter-warnings-plugin.d.ts.map +1 -1
- package/dist/webpack/configs/plugins/filter-warnings-plugin.js +2 -2
- package/dist/webpack/configs/plugins/filter-warnings-plugin.js.map +1 -1
- package/dist/webpack/configs/plugins/html-plugin.d.ts +2 -3
- package/dist/webpack/configs/plugins/html-plugin.d.ts.map +1 -1
- package/dist/webpack/configs/plugins/html-plugin.js +2 -5
- package/dist/webpack/configs/plugins/html-plugin.js.map +1 -1
- package/dist/webpack/configs/plugins/html-tags-plugin.d.ts +2 -3
- package/dist/webpack/configs/plugins/html-tags-plugin.d.ts.map +1 -1
- package/dist/webpack/configs/plugins/html-tags-plugin.js +19 -8
- package/dist/webpack/configs/plugins/html-tags-plugin.js.map +1 -1
- package/dist/webpack/configs/plugins/ignore-plugin/check-resource.d.ts +3 -0
- package/dist/webpack/configs/plugins/ignore-plugin/check-resource.d.ts.map +1 -0
- package/dist/{core/check-resource → webpack/configs/plugins/ignore-plugin}/check-resource.js +2 -2
- package/dist/webpack/configs/plugins/ignore-plugin/check-resource.js.map +1 -0
- package/dist/webpack/configs/plugins/ignore-plugin/get-package-json.d.ts.map +1 -0
- package/dist/{core/check-resource → webpack/configs/plugins/ignore-plugin}/get-package-json.js +2 -2
- package/dist/webpack/configs/plugins/ignore-plugin/get-package-json.js.map +1 -0
- package/dist/webpack/configs/plugins/ignore-plugin/ignore-plugin.d.ts +3 -17
- package/dist/webpack/configs/plugins/ignore-plugin/ignore-plugin.d.ts.map +1 -1
- package/dist/webpack/configs/plugins/ignore-plugin/ignore-plugin.js +6 -45
- package/dist/webpack/configs/plugins/ignore-plugin/ignore-plugin.js.map +1 -1
- package/dist/webpack/configs/plugins/ignore-plugin/is-optional-peer-dependency.d.ts.map +1 -0
- package/dist/webpack/configs/plugins/ignore-plugin/is-optional-peer-dependency.js.map +1 -0
- package/dist/webpack/configs/plugins/ignore-plugin/is-optional-react-dom-peer-dependency.d.ts.map +1 -0
- package/dist/webpack/configs/plugins/ignore-plugin/is-optional-react-dom-peer-dependency.js.map +1 -0
- package/dist/webpack/configs/plugins/mini-css-extract-plugin.d.ts +2 -3
- package/dist/webpack/configs/plugins/mini-css-extract-plugin.d.ts.map +1 -1
- package/dist/webpack/configs/plugins/mini-css-extract-plugin.js +2 -4
- package/dist/webpack/configs/plugins/mini-css-extract-plugin.js.map +1 -1
- package/dist/webpack/configs/plugins/moment-locales-plugin.d.ts +2 -3
- package/dist/webpack/configs/plugins/moment-locales-plugin.d.ts.map +1 -1
- package/dist/webpack/configs/plugins/moment-locales-plugin.js.map +1 -1
- package/dist/webpack/configs/plugins/remove-empty-scripts-plugin.d.ts +2 -3
- package/dist/webpack/configs/plugins/remove-empty-scripts-plugin.d.ts.map +1 -1
- package/dist/webpack/configs/plugins/remove-empty-scripts-plugin.js +1 -1
- package/dist/webpack/configs/plugins/remove-empty-scripts-plugin.js.map +1 -1
- package/dist/webpack/configs/plugins/virtual-modules-plugin.d.ts +3 -3
- package/dist/webpack/configs/plugins/virtual-modules-plugin.d.ts.map +1 -1
- package/dist/webpack/configs/plugins/virtual-modules-plugin.js +56 -13
- package/dist/webpack/configs/plugins/virtual-modules-plugin.js.map +1 -1
- package/dist/webpack/configs/plugins/watch-run-plugin.d.ts +2 -3
- 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/plugins-config.d.ts +2 -3
- package/dist/webpack/configs/plugins-config.d.ts.map +1 -1
- package/dist/webpack/configs/plugins-config.js.map +1 -1
- package/dist/webpack/configs/resolve-config.d.ts +2 -3
- package/dist/webpack/configs/resolve-config.d.ts.map +1 -1
- package/dist/webpack/configs/resolve-config.js.map +1 -1
- package/dist/webpack/configs/rules/css-rules.d.ts +2 -2
- package/dist/webpack/configs/rules/css-rules.d.ts.map +1 -1
- package/dist/webpack/configs/rules/css-rules.js +1 -2
- package/dist/webpack/configs/rules/css-rules.js.map +1 -1
- package/dist/webpack/configs/rules/font-rules.d.ts +2 -2
- package/dist/webpack/configs/rules/font-rules.d.ts.map +1 -1
- package/dist/webpack/configs/rules/font-rules.js.map +1 -1
- package/dist/webpack/configs/rules/image-rules.d.ts +2 -2
- package/dist/webpack/configs/rules/image-rules.d.ts.map +1 -1
- package/dist/webpack/configs/rules/image-rules.js.map +1 -1
- package/dist/webpack/configs/rules/js-rules.d.ts +2 -2
- package/dist/webpack/configs/rules/js-rules.d.ts.map +1 -1
- package/dist/webpack/configs/rules/js-rules.js +1 -3
- package/dist/webpack/configs/rules/js-rules.js.map +1 -1
- package/dist/webpack/configs/rules/less-rules.d.ts +2 -2
- package/dist/webpack/configs/rules/less-rules.d.ts.map +1 -1
- package/dist/webpack/configs/rules/less-rules.js.map +1 -1
- package/dist/webpack/configs/rules/scss-rules.d.ts +2 -2
- package/dist/webpack/configs/rules/scss-rules.d.ts.map +1 -1
- package/dist/webpack/configs/rules/scss-rules.js.map +1 -1
- package/dist/webpack/configs/rules/svg-rules.d.ts +2 -2
- package/dist/webpack/configs/rules/svg-rules.d.ts.map +1 -1
- package/dist/webpack/configs/rules/svg-rules.js.map +1 -1
- package/dist/webpack/configs/rules-config.d.ts +2 -3
- package/dist/webpack/configs/rules-config.d.ts.map +1 -1
- package/dist/webpack/configs/rules-config.js +2 -2
- package/dist/webpack/configs/rules-config.js.map +1 -1
- package/dist/webpack/configs/stats-config.d.ts +2 -3
- package/dist/webpack/configs/stats-config.d.ts.map +1 -1
- package/dist/webpack/configs/stats-config.js.map +1 -1
- package/dist/webpack/configs/types.d.ts +35 -0
- package/dist/webpack/configs/types.d.ts.map +1 -0
- package/dist/webpack/configs/types.js.map +1 -0
- package/dist/webpack/configs/utils/build-metadata.d.ts.map +1 -0
- package/dist/{core → webpack/configs}/utils/build-metadata.js +1 -1
- package/dist/webpack/configs/utils/build-metadata.js.map +1 -0
- package/dist/webpack/configs/utils/generate-metadata.d.ts +3 -0
- package/dist/webpack/configs/utils/generate-metadata.d.ts.map +1 -0
- package/dist/{core → webpack/configs}/utils/generate-metadata.js +4 -5
- package/dist/webpack/configs/utils/generate-metadata.js.map +1 -0
- package/dist/webpack/configs/utils/get-bundle-type.d.ts +3 -0
- package/dist/webpack/configs/utils/get-bundle-type.d.ts.map +1 -0
- package/dist/{core → webpack/configs}/utils/get-bundle-type.js +2 -5
- package/dist/webpack/configs/utils/get-bundle-type.js.map +1 -0
- package/dist/webpack/configs/utils/get-exposed-dependencies.d.ts.map +1 -0
- package/dist/webpack/configs/utils/get-exposed-dependencies.js.map +1 -0
- package/dist/webpack/configs/utils/get-launchdarkly-sdk-version.d.ts.map +1 -0
- package/dist/{core → webpack/configs}/utils/get-launchdarkly-sdk-version.js +1 -1
- package/dist/webpack/configs/utils/get-launchdarkly-sdk-version.js.map +1 -0
- package/dist/webpack/configs/utils/get-web-components-version.d.ts.map +1 -0
- package/dist/{core → webpack/configs}/utils/get-web-components-version.js +1 -1
- package/dist/webpack/configs/utils/get-web-components-version.js.map +1 -0
- package/dist/webpack/configs/utils/index.d.ts +4 -0
- package/dist/webpack/configs/utils/index.d.ts.map +1 -0
- package/dist/{core → webpack/configs}/utils/index.js +0 -5
- package/dist/webpack/configs/utils/index.js.map +1 -0
- package/dist/webpack/configs/watch-options-config.d.ts +2 -2
- package/dist/webpack/configs/watch-options-config.d.ts.map +1 -1
- package/dist/webpack/configs/watch-options-config.js +2 -2
- package/dist/webpack/configs/watch-options-config.js.map +1 -1
- package/dist/webpack/create-webpack-config.d.ts +0 -10
- package/dist/webpack/create-webpack-config.d.ts.map +1 -1
- package/dist/webpack/create-webpack-config.js +41 -108
- package/dist/webpack/create-webpack-config.js.map +1 -1
- package/dist/webpack/types.d.ts +11 -4
- package/dist/webpack/types.d.ts.map +1 -1
- 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/stringify-config.d.ts.map +1 -0
- package/dist/webpack/utils/stringify-config.js.map +1 -0
- package/package.json +16 -19
- package/src/cli/commands/__tests__/mfe-generate-metadata.test.ts +4 -3
- package/src/cli/commands/__tests__/mfe-package-publish.test.ts +27 -1
- package/src/cli/commands/__tests__/mfe-package-rollback.test.ts +31 -0
- package/src/cli/commands/__tests__/mfe-publish.test.ts +4 -2
- package/src/cli/commands/__tests__/mfe-purge-cache.test.ts +141 -0
- package/src/cli/commands/build.ts +2 -7
- package/src/cli/commands/bundle-package.ts +1 -3
- package/src/cli/commands/get-command.ts +2 -2
- package/src/cli/commands/mfe-check.ts +2 -1
- package/src/cli/commands/mfe-generate-metadata.ts +1 -1
- package/src/cli/commands/mfe-package-publish.ts +12 -2
- package/src/cli/commands/mfe-package-rollback.ts +15 -5
- package/src/cli/commands/mfe-publish.ts +14 -3
- package/src/cli/commands/mfe-purge-cache.ts +75 -0
- package/src/cli/commands/start.ts +2 -5
- package/src/cli/commands/utils/__tests__/purge-cache.test.ts +40 -0
- package/src/cli/commands/{utils.ts → utils/build-rollback-tag.ts} +0 -1
- package/src/cli/commands/utils/constants.ts +1 -0
- package/src/cli/commands/utils/index.ts +3 -0
- package/src/cli/commands/utils/purge-cache.ts +13 -0
- package/src/cli/utils/__tests__/bundle.test.ts +10 -19
- package/src/cli/utils/bundle.ts +101 -20
- package/src/cli/utils/cli-os.ts +1 -1
- package/src/index.ts +0 -1
- package/src/storybook-config/__tests__/webpack-final.test.ts +2 -5
- package/src/storybook-config/webpack-final.ts +10 -24
- package/src/utils/__tests__/get-configuration.test.ts +1 -99
- package/src/utils/__tests__/get-package-data.test.ts +1 -35
- package/src/utils/get-configuration.ts +2 -92
- package/src/utils/get-package-data.ts +1 -3
- package/src/webpack/__tests__/create-webpack-config-shared-dependencies.test.ts +2 -2
- package/src/webpack/__tests__/create-webpack-config-web-component.test.ts +11 -11
- package/src/webpack/__tests__/create-webpack-config.test.ts +2 -3
- package/src/webpack/configs/amd-config.ts +2 -3
- package/src/webpack/configs/cache-config.ts +3 -4
- package/src/webpack/configs/dev-server-config.ts +3 -8
- package/src/webpack/configs/devtool-config.ts +3 -4
- package/src/webpack/configs/entry.config.ts +7 -8
- package/src/webpack/configs/externals-config.ts +21 -5
- package/src/webpack/configs/index.ts +1 -0
- package/src/webpack/configs/loaders/css-loader.ts +2 -3
- package/src/webpack/configs/loaders/style-loader.ts +5 -5
- package/src/webpack/configs/module-config.ts +2 -3
- package/src/webpack/configs/optimization-config.ts +11 -16
- package/src/webpack/configs/output-config.ts +22 -16
- package/src/webpack/configs/plugins/assets-manifest-plugin.ts +36 -9
- package/src/webpack/configs/plugins/bundle-analyser-plugin.ts +8 -8
- package/src/webpack/configs/plugins/define-exposed-dependencies-plugin.ts +15 -7
- package/src/webpack/configs/plugins/define-exposed-instance-dependencies-plugin.ts +13 -7
- package/src/webpack/configs/plugins/define-web-component-name-plugin.ts +8 -7
- package/src/webpack/configs/plugins/filter-warnings-plugin.ts +3 -4
- package/src/webpack/configs/plugins/html-plugin.ts +6 -7
- package/src/webpack/configs/plugins/html-tags-plugin.ts +16 -7
- package/src/{core/check-resource → webpack/configs/plugins/ignore-plugin}/__tests__/check-resource.test.ts +5 -18
- package/src/{core/check-resource → webpack/configs/plugins/ignore-plugin}/check-resource.ts +4 -4
- package/src/{core/check-resource → webpack/configs/plugins/ignore-plugin}/get-package-json.ts +2 -2
- package/src/webpack/configs/plugins/ignore-plugin/ignore-plugin.ts +6 -48
- package/src/webpack/configs/plugins/mini-css-extract-plugin.ts +5 -10
- package/src/webpack/configs/plugins/moment-locales-plugin.ts +2 -3
- package/src/webpack/configs/plugins/remove-empty-scripts-plugin.ts +3 -4
- package/src/webpack/configs/plugins/virtual-modules-plugin.ts +65 -13
- package/src/webpack/configs/plugins/watch-run-plugin.ts +2 -3
- package/src/webpack/configs/plugins-config.ts +2 -3
- package/src/webpack/configs/resolve-config.ts +2 -3
- package/src/webpack/configs/rules/css-rules.ts +3 -4
- package/src/webpack/configs/rules/font-rules.ts +2 -2
- package/src/webpack/configs/rules/image-rules.ts +2 -2
- package/src/webpack/configs/rules/js-rules.ts +2 -4
- package/src/webpack/configs/rules/less-rules.ts +2 -2
- package/src/webpack/configs/rules/scss-rules.ts +2 -2
- package/src/webpack/configs/rules/svg-rules.ts +2 -2
- package/src/webpack/configs/rules-config.ts +5 -9
- package/src/webpack/configs/stats-config.ts +2 -3
- package/src/webpack/configs/types.ts +38 -0
- package/src/{core → webpack/configs}/utils/__tests__/build-metadata.test.ts +2 -2
- package/src/{core → webpack/configs}/utils/__tests__/generate-metadata.test.ts +13 -27
- package/src/{core → webpack/configs}/utils/build-metadata.ts +1 -1
- package/src/{core → webpack/configs}/utils/generate-metadata.ts +6 -7
- package/src/webpack/configs/utils/get-bundle-type.ts +22 -0
- package/src/{core → webpack/configs}/utils/get-launchdarkly-sdk-version.ts +1 -1
- package/src/{core → webpack/configs}/utils/get-web-components-version.ts +1 -1
- package/src/webpack/configs/utils/index.ts +3 -0
- package/src/webpack/configs/watch-options-config.ts +3 -3
- package/src/webpack/create-webpack-config.ts +43 -85
- package/src/webpack/types.ts +11 -7
- package/src/webpack/utils/index.ts +1 -0
- package/dist/cli/commands/bundle-vite.d.ts +0 -66
- package/dist/cli/commands/bundle-vite.d.ts.map +0 -1
- package/dist/cli/commands/bundle-vite.js +0 -184
- package/dist/cli/commands/bundle-vite.js.map +0 -1
- package/dist/cli/commands/utils.d.ts.map +0 -1
- package/dist/cli/commands/utils.js.map +0 -1
- package/dist/core/check-resource/check-resource.d.ts +0 -3
- package/dist/core/check-resource/check-resource.d.ts.map +0 -1
- package/dist/core/check-resource/check-resource.js.map +0 -1
- package/dist/core/check-resource/get-package-json.d.ts.map +0 -1
- package/dist/core/check-resource/get-package-json.js.map +0 -1
- package/dist/core/check-resource/index.d.ts +0 -2
- package/dist/core/check-resource/index.d.ts.map +0 -1
- package/dist/core/check-resource/index.js +0 -13
- package/dist/core/check-resource/index.js.map +0 -1
- package/dist/core/check-resource/is-optional-peer-dependency.d.ts.map +0 -1
- package/dist/core/check-resource/is-optional-peer-dependency.js.map +0 -1
- package/dist/core/check-resource/is-optional-react-dom-peer-dependency.d.ts.map +0 -1
- package/dist/core/check-resource/is-optional-react-dom-peer-dependency.js.map +0 -1
- package/dist/core/context.d.ts +0 -14
- package/dist/core/context.d.ts.map +0 -1
- package/dist/core/context.js +0 -62
- package/dist/core/context.js.map +0 -1
- package/dist/core/defines/exposed-dependencies.d.ts +0 -5
- package/dist/core/defines/exposed-dependencies.d.ts.map +0 -1
- package/dist/core/defines/exposed-dependencies.js +0 -26
- package/dist/core/defines/exposed-dependencies.js.map +0 -1
- package/dist/core/defines/exposed-instance-dependencies.d.ts +0 -5
- package/dist/core/defines/exposed-instance-dependencies.d.ts.map +0 -1
- package/dist/core/defines/exposed-instance-dependencies.js +0 -29
- package/dist/core/defines/exposed-instance-dependencies.js.map +0 -1
- package/dist/core/defines/index.d.ts +0 -4
- package/dist/core/defines/index.d.ts.map +0 -1
- package/dist/core/defines/index.js +0 -26
- package/dist/core/defines/index.js.map +0 -1
- package/dist/core/defines/web-component-name.d.ts +0 -5
- package/dist/core/defines/web-component-name.d.ts.map +0 -1
- package/dist/core/defines/web-component-name.js +0 -23
- package/dist/core/defines/web-component-name.js.map +0 -1
- package/dist/core/externals.d.ts +0 -3
- package/dist/core/externals.d.ts.map +0 -1
- package/dist/core/externals.js +0 -29
- package/dist/core/externals.js.map +0 -1
- package/dist/core/get-exposed-dependencies-entry-points.d.ts +0 -11
- package/dist/core/get-exposed-dependencies-entry-points.d.ts.map +0 -1
- package/dist/core/get-exposed-dependencies-entry-points.js +0 -82
- package/dist/core/get-exposed-dependencies-entry-points.js.map +0 -1
- package/dist/core/index.d.ts +0 -9
- package/dist/core/index.d.ts.map +0 -1
- package/dist/core/index.js.map +0 -1
- package/dist/core/types.d.ts +0 -55
- package/dist/core/types.d.ts.map +0 -1
- package/dist/core/types.js.map +0 -1
- package/dist/core/utils/build-metadata.d.ts.map +0 -1
- package/dist/core/utils/build-metadata.js.map +0 -1
- package/dist/core/utils/generate-metadata.d.ts +0 -3
- package/dist/core/utils/generate-metadata.d.ts.map +0 -1
- package/dist/core/utils/generate-metadata.js.map +0 -1
- package/dist/core/utils/get-bundle-type.d.ts +0 -3
- package/dist/core/utils/get-bundle-type.d.ts.map +0 -1
- package/dist/core/utils/get-bundle-type.js.map +0 -1
- package/dist/core/utils/get-exposed-dependencies.d.ts.map +0 -1
- package/dist/core/utils/get-exposed-dependencies.js.map +0 -1
- package/dist/core/utils/get-launchdarkly-sdk-version.d.ts.map +0 -1
- package/dist/core/utils/get-launchdarkly-sdk-version.js.map +0 -1
- package/dist/core/utils/get-output-path.d.ts +0 -3
- package/dist/core/utils/get-output-path.d.ts.map +0 -1
- package/dist/core/utils/get-output-path.js +0 -32
- package/dist/core/utils/get-output-path.js.map +0 -1
- package/dist/core/utils/get-web-components-version.d.ts.map +0 -1
- package/dist/core/utils/get-web-components-version.js.map +0 -1
- package/dist/core/utils/index.d.ts +0 -9
- package/dist/core/utils/index.d.ts.map +0 -1
- package/dist/core/utils/index.js.map +0 -1
- package/dist/core/utils/stringify-config.d.ts.map +0 -1
- package/dist/core/utils/stringify-config.js.map +0 -1
- package/dist/core/virtual-modules.d.ts +0 -9
- package/dist/core/virtual-modules.d.ts.map +0 -1
- package/dist/core/virtual-modules.js +0 -84
- package/dist/core/virtual-modules.js.map +0 -1
- package/dist/vite/base-config.d.ts +0 -4
- package/dist/vite/base-config.d.ts.map +0 -1
- package/dist/vite/base-config.js +0 -76
- package/dist/vite/base-config.js.map +0 -1
- package/dist/vite/build-shared-deps.d.ts +0 -3
- package/dist/vite/build-shared-deps.d.ts.map +0 -1
- package/dist/vite/build-shared-deps.js +0 -310
- package/dist/vite/build-shared-deps.js.map +0 -1
- package/dist/vite/create-vite-config.d.ts +0 -3
- package/dist/vite/create-vite-config.d.ts.map +0 -1
- package/dist/vite/create-vite-config.js +0 -52
- package/dist/vite/create-vite-config.js.map +0 -1
- package/dist/vite/define-config.d.ts +0 -12
- package/dist/vite/define-config.d.ts.map +0 -1
- package/dist/vite/define-config.js +0 -15
- package/dist/vite/define-config.js.map +0 -1
- package/dist/vite/load-config-file.d.ts +0 -6
- package/dist/vite/load-config-file.d.ts.map +0 -1
- package/dist/vite/load-config-file.js +0 -107
- package/dist/vite/load-config-file.js.map +0 -1
- package/dist/vite/merge-config.d.ts +0 -6
- package/dist/vite/merge-config.d.ts.map +0 -1
- package/dist/vite/merge-config.js +0 -106
- package/dist/vite/merge-config.js.map +0 -1
- package/dist/vite/plugins/css-injector-plugin.d.ts +0 -15
- package/dist/vite/plugins/css-injector-plugin.d.ts.map +0 -1
- package/dist/vite/plugins/css-injector-plugin.js +0 -76
- package/dist/vite/plugins/css-injector-plugin.js.map +0 -1
- package/dist/vite/plugins/dev-server-routing-plugin.d.ts +0 -12
- package/dist/vite/plugins/dev-server-routing-plugin.d.ts.map +0 -1
- package/dist/vite/plugins/dev-server-routing-plugin.js +0 -85
- package/dist/vite/plugins/dev-server-routing-plugin.js.map +0 -1
- package/dist/vite/plugins/externals-plugin.d.ts +0 -4
- package/dist/vite/plugins/externals-plugin.d.ts.map +0 -1
- package/dist/vite/plugins/externals-plugin.js +0 -39
- package/dist/vite/plugins/externals-plugin.js.map +0 -1
- package/dist/vite/plugins/html-plugin.d.ts +0 -5
- package/dist/vite/plugins/html-plugin.d.ts.map +0 -1
- package/dist/vite/plugins/html-plugin.js +0 -74
- package/dist/vite/plugins/html-plugin.js.map +0 -1
- package/dist/vite/plugins/ignore-modules-plugin.d.ts +0 -4
- package/dist/vite/plugins/ignore-modules-plugin.d.ts.map +0 -1
- package/dist/vite/plugins/ignore-modules-plugin.js +0 -30
- package/dist/vite/plugins/ignore-modules-plugin.js.map +0 -1
- package/dist/vite/plugins/index.d.ts +0 -10
- package/dist/vite/plugins/index.d.ts.map +0 -1
- package/dist/vite/plugins/index.js +0 -28
- package/dist/vite/plugins/index.js.map +0 -1
- package/dist/vite/plugins/metadata-plugin.d.ts +0 -4
- package/dist/vite/plugins/metadata-plugin.d.ts.map +0 -1
- package/dist/vite/plugins/metadata-plugin.js +0 -86
- package/dist/vite/plugins/metadata-plugin.js.map +0 -1
- package/dist/vite/plugins/style-urls-plugin.d.ts +0 -4
- package/dist/vite/plugins/style-urls-plugin.d.ts.map +0 -1
- package/dist/vite/plugins/style-urls-plugin.js +0 -29
- package/dist/vite/plugins/style-urls-plugin.js.map +0 -1
- package/dist/vite/plugins/svgr-plugin.d.ts +0 -4
- package/dist/vite/plugins/svgr-plugin.d.ts.map +0 -1
- package/dist/vite/plugins/svgr-plugin.js +0 -31
- package/dist/vite/plugins/svgr-plugin.js.map +0 -1
- package/dist/vite/plugins/virtual-modules-plugin.d.ts +0 -4
- package/dist/vite/plugins/virtual-modules-plugin.d.ts.map +0 -1
- package/dist/vite/plugins/virtual-modules-plugin.js +0 -71
- package/dist/vite/plugins/virtual-modules-plugin.js.map +0 -1
- package/patches/vite-plugin-css-injected-by-js+3.5.2.patch +0 -63
- package/src/cli/commands/bundle-vite.ts +0 -112
- package/src/core/check-resource/index.ts +0 -1
- package/src/core/context.ts +0 -65
- package/src/core/defines/exposed-dependencies.ts +0 -21
- package/src/core/defines/exposed-instance-dependencies.ts +0 -19
- package/src/core/defines/index.ts +0 -3
- package/src/core/defines/web-component-name.ts +0 -15
- package/src/core/externals.ts +0 -23
- package/src/core/get-exposed-dependencies-entry-points.ts +0 -59
- package/src/core/index.ts +0 -8
- package/src/core/types.ts +0 -59
- package/src/core/utils/get-bundle-type.ts +0 -20
- package/src/core/utils/get-output-path.ts +0 -18
- package/src/core/utils/index.ts +0 -8
- package/src/core/virtual-modules.ts +0 -76
- package/src/vite/__tests__/define-config.test.ts +0 -13
- package/src/vite/__tests__/load-config-file.test.ts +0 -115
- package/src/vite/__tests__/merge-config.test.ts +0 -173
- package/src/vite/base-config.ts +0 -79
- package/src/vite/build-shared-deps.ts +0 -320
- package/src/vite/create-vite-config.ts +0 -50
- package/src/vite/define-config.ts +0 -20
- package/src/vite/index.html +0 -29
- package/src/vite/load-config-file.ts +0 -54
- package/src/vite/merge-config.ts +0 -93
- package/src/vite/plugins/css-injector-plugin.ts +0 -85
- package/src/vite/plugins/dev-server-routing-plugin.ts +0 -89
- package/src/vite/plugins/externals-plugin.ts +0 -27
- package/src/vite/plugins/html-plugin.ts +0 -65
- package/src/vite/plugins/ignore-modules-plugin.ts +0 -22
- package/src/vite/plugins/index.ts +0 -9
- package/src/vite/plugins/metadata-plugin.ts +0 -78
- package/src/vite/plugins/style-urls-plugin.ts +0 -34
- package/src/vite/plugins/svgr-plugin.ts +0 -11
- package/src/vite/plugins/virtual-modules-plugin.ts +0 -74
- package/src/webpack/configs/plugins/ignore-plugin/empty-module.js +0 -1
- /package/dist/{core/check-resource → webpack/configs/plugins/ignore-plugin}/get-package-json.d.ts +0 -0
- /package/dist/{core/check-resource → webpack/configs/plugins/ignore-plugin}/is-optional-peer-dependency.d.ts +0 -0
- /package/dist/{core/check-resource → webpack/configs/plugins/ignore-plugin}/is-optional-peer-dependency.js +0 -0
- /package/dist/{core/check-resource → webpack/configs/plugins/ignore-plugin}/is-optional-react-dom-peer-dependency.d.ts +0 -0
- /package/dist/{core/check-resource → webpack/configs/plugins/ignore-plugin}/is-optional-react-dom-peer-dependency.js +0 -0
- /package/dist/{core → webpack/configs}/types.js +0 -0
- /package/dist/{core → webpack/configs}/utils/build-metadata.d.ts +0 -0
- /package/dist/{core → webpack/configs}/utils/get-exposed-dependencies.d.ts +0 -0
- /package/dist/{core → webpack/configs}/utils/get-exposed-dependencies.js +0 -0
- /package/dist/{core → webpack/configs}/utils/get-launchdarkly-sdk-version.d.ts +0 -0
- /package/dist/{core → webpack/configs}/utils/get-web-components-version.d.ts +0 -0
- /package/dist/{core → webpack}/utils/stringify-config.d.ts +0 -0
- /package/dist/{core → webpack}/utils/stringify-config.js +0 -0
- /package/src/{core/check-resource → webpack/configs/plugins/ignore-plugin}/__tests__/get-package-json.test.ts +0 -0
- /package/src/{core/check-resource → webpack/configs/plugins/ignore-plugin}/__tests__/is-optional-peer-dependency.test.ts +0 -0
- /package/src/{core/check-resource → webpack/configs/plugins/ignore-plugin}/__tests__/is-optional-react-dom-peer-dependency.test.ts +0 -0
- /package/src/{core/check-resource → webpack/configs/plugins/ignore-plugin}/is-optional-peer-dependency.ts +0 -0
- /package/src/{core/check-resource → webpack/configs/plugins/ignore-plugin}/is-optional-react-dom-peer-dependency.ts +0 -0
- /package/src/{core → webpack/configs}/utils/__tests__/get-exposed-dependencies.test.ts +0 -0
- /package/src/{core → webpack/configs}/utils/__tests__/get-launchdarkly-sdk-version.test.ts +0 -0
- /package/src/{core → webpack/configs}/utils/__tests__/get-web-components-version.test.ts +0 -0
- /package/src/{core → webpack/configs}/utils/get-exposed-dependencies.ts +0 -0
- /package/src/{core → webpack}/utils/stringify-config.ts +0 -0
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
import { log } from '../../../utils';
|
|
2
|
+
import { MFEPurgeCache, PurgeResponse } from '../mfe-purge-cache';
|
|
3
|
+
|
|
4
|
+
jest.mock('../../../utils', () => ({
|
|
5
|
+
...jest.requireActual('../../../utils'),
|
|
6
|
+
log: { debug: jest.fn(), info: jest.fn(), warning: jest.fn() },
|
|
7
|
+
}));
|
|
8
|
+
|
|
9
|
+
describe(`[startup] ${MFEPurgeCache.name}`, () => {
|
|
10
|
+
const host = 'https://unpkg.example.com';
|
|
11
|
+
const token = 'purge-token';
|
|
12
|
+
const tag = 'prod';
|
|
13
|
+
const packageName = '@servicetitan/foo';
|
|
14
|
+
const version = '0.0.0-master.abc1223';
|
|
15
|
+
const location = `/${packageName}@${version}/dist/metadata.json`;
|
|
16
|
+
|
|
17
|
+
let args: ConstructorParameters<typeof MFEPurgeCache>[0];
|
|
18
|
+
let fetchSpy: jest.SpyInstance;
|
|
19
|
+
let fetchResponse: any;
|
|
20
|
+
let responseJson: PurgeResponse;
|
|
21
|
+
|
|
22
|
+
beforeEach(() => {
|
|
23
|
+
process.env.UNPKG_PURGE_TOKEN = token;
|
|
24
|
+
args = { host, packageName, tag };
|
|
25
|
+
fetchResponse = {
|
|
26
|
+
ok: true,
|
|
27
|
+
json: jest.fn().mockImplementation(() => Promise.resolve(responseJson)),
|
|
28
|
+
};
|
|
29
|
+
responseJson = [{ pod: '10.36.110.200', status: 302, cache: 'BYPASS', location }];
|
|
30
|
+
|
|
31
|
+
jest.clearAllMocks();
|
|
32
|
+
jest.spyOn(process.stdout, 'write').mockImplementation(jest.fn()); // suppress error output
|
|
33
|
+
fetchSpy = jest.spyOn(global, 'fetch').mockImplementation(() => fetchResponse);
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
afterEach(() => delete process.env.UNPKG_PURGE_TOKEN);
|
|
37
|
+
|
|
38
|
+
const subject = () => new MFEPurgeCache(args).execute();
|
|
39
|
+
|
|
40
|
+
test('sends POST request with X-Purge-Token header', async () => {
|
|
41
|
+
await subject();
|
|
42
|
+
|
|
43
|
+
expect(fetchSpy).toHaveBeenCalledWith(
|
|
44
|
+
`${host}/_purge/${packageName}@${tag}/dist/metadata.json`,
|
|
45
|
+
{ method: 'POST', headers: { 'X-Purge-Token': token } }
|
|
46
|
+
);
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
test('logs progress', async () => {
|
|
50
|
+
await subject();
|
|
51
|
+
|
|
52
|
+
expect(log.info).toHaveBeenCalledWith(`Purging cache for ${packageName}@${tag}`);
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
test('logs the redirect location from the response', async () => {
|
|
56
|
+
await subject();
|
|
57
|
+
|
|
58
|
+
expect(log.info).toHaveBeenCalledWith(
|
|
59
|
+
`Cache purged: ${packageName}@${tag}/dist/metadata.json -> ${location.replace(/^\//, '')}`
|
|
60
|
+
);
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
describe('when request fails', () => {
|
|
64
|
+
beforeEach(() => {
|
|
65
|
+
fetchResponse = { ok: false, status: 403, statusText: 'Forbidden' };
|
|
66
|
+
});
|
|
67
|
+
|
|
68
|
+
test('throws error', () => {
|
|
69
|
+
expect(subject).rejects.toThrow(
|
|
70
|
+
`Purge request failed: ${fetchResponse.status} ${fetchResponse.statusText}`
|
|
71
|
+
);
|
|
72
|
+
});
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
function itLogsNullLocation() {
|
|
76
|
+
test('logs null location', async () => {
|
|
77
|
+
await subject();
|
|
78
|
+
|
|
79
|
+
expect(log.info).toHaveBeenCalledWith(expect.stringMatching(/-> null$/));
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
describe('when response location is null', () => {
|
|
84
|
+
beforeEach(() => (responseJson[0].location = null));
|
|
85
|
+
|
|
86
|
+
itLogsNullLocation();
|
|
87
|
+
});
|
|
88
|
+
|
|
89
|
+
describe('when response is empty', () => {
|
|
90
|
+
beforeEach(() => (responseJson = []));
|
|
91
|
+
|
|
92
|
+
itLogsNullLocation();
|
|
93
|
+
});
|
|
94
|
+
|
|
95
|
+
describe('when response is unexpected', () => {
|
|
96
|
+
beforeEach(() => (responseJson = {} as any));
|
|
97
|
+
|
|
98
|
+
itLogsNullLocation();
|
|
99
|
+
});
|
|
100
|
+
|
|
101
|
+
describe('when host has trailing slash', () => {
|
|
102
|
+
beforeEach(() => {
|
|
103
|
+
args.host = `${host}/`;
|
|
104
|
+
});
|
|
105
|
+
|
|
106
|
+
test('strips trailing slash from host', async () => {
|
|
107
|
+
await subject();
|
|
108
|
+
|
|
109
|
+
expect(fetchSpy).toHaveBeenCalledWith(
|
|
110
|
+
`${host}/_purge/${packageName}@${tag}/dist/metadata.json`,
|
|
111
|
+
expect.anything()
|
|
112
|
+
);
|
|
113
|
+
});
|
|
114
|
+
});
|
|
115
|
+
|
|
116
|
+
describe('with --token', () => {
|
|
117
|
+
const cliToken = 'cli-purge-token';
|
|
118
|
+
|
|
119
|
+
beforeEach(() => (args.token = cliToken));
|
|
120
|
+
|
|
121
|
+
test('uses specified token', async () => {
|
|
122
|
+
await subject();
|
|
123
|
+
|
|
124
|
+
expect(fetchSpy).toHaveBeenCalledWith(
|
|
125
|
+
expect.anything(),
|
|
126
|
+
expect.objectContaining({ headers: { 'X-Purge-Token': cliToken } })
|
|
127
|
+
);
|
|
128
|
+
});
|
|
129
|
+
});
|
|
130
|
+
|
|
131
|
+
describe('with no token', () => {
|
|
132
|
+
beforeEach(() => delete process.env.UNPKG_PURGE_TOKEN);
|
|
133
|
+
|
|
134
|
+
test('logs warning and does nothing', async () => {
|
|
135
|
+
await subject();
|
|
136
|
+
|
|
137
|
+
expect(log.warning).toHaveBeenCalledWith('Token is not defined, skipping purge');
|
|
138
|
+
expect(fetchSpy).not.toHaveBeenCalled();
|
|
139
|
+
});
|
|
140
|
+
});
|
|
141
|
+
});
|
|
@@ -8,11 +8,9 @@ const options = {
|
|
|
8
8
|
codeCoverage: { boolean: true, description: 'Instrument code for coverage analysis?' },
|
|
9
9
|
config: { string: true, hidden: true, description: 'Use specified configuration' },
|
|
10
10
|
ignore: { array: true, string: true, description: 'Packages to skip' },
|
|
11
|
-
preview: { boolean: true, description: 'Start preview server after build?' },
|
|
12
11
|
scope: { array: true, string: true, description: 'Packages to build' },
|
|
13
12
|
stat: { boolean: true, description: 'Generate bundle report?' },
|
|
14
13
|
useTsc: { boolean: true, description: 'Use tsc to compile packages?' },
|
|
15
|
-
useVite: { boolean: true, description: 'Use Vite to bundle packages?' },
|
|
16
14
|
} satisfies CommandOptions;
|
|
17
15
|
|
|
18
16
|
enum BuildProcesses {
|
|
@@ -35,8 +33,6 @@ export class Build extends Command<typeof options> {
|
|
|
35
33
|
checkArgs(this.args, { obsolete: ['--esbuild', '--experimental-bundlers'] });
|
|
36
34
|
|
|
37
35
|
const useTsc = this.args.useTsc;
|
|
38
|
-
const useVite = this.args.useVite;
|
|
39
|
-
const cmd = useVite ? 'startup bundle-vite' : 'startup bundle-package';
|
|
40
36
|
|
|
41
37
|
const packages = getPackages({
|
|
42
38
|
scope: this.args.scope,
|
|
@@ -93,7 +89,7 @@ export class Build extends Command<typeof options> {
|
|
|
93
89
|
return Promise.resolve();
|
|
94
90
|
}
|
|
95
91
|
return lernaExec({
|
|
96
|
-
cmd,
|
|
92
|
+
'cmd': 'startup bundle-package',
|
|
97
93
|
'scope': webpackScope,
|
|
98
94
|
'parallel': true,
|
|
99
95
|
'stream': true,
|
|
@@ -116,14 +112,13 @@ export class Build extends Command<typeof options> {
|
|
|
116
112
|
}
|
|
117
113
|
|
|
118
114
|
return lernaExec({
|
|
119
|
-
cmd,
|
|
115
|
+
'cmd': 'startup bundle-package',
|
|
120
116
|
'scope': webpackScope,
|
|
121
117
|
'stream': true,
|
|
122
118
|
'--': [
|
|
123
119
|
...[this.args.config ? `--config "${this.args.config}"` : undefined],
|
|
124
120
|
...[this.args.codeCoverage ? '--code-coverage' : undefined],
|
|
125
121
|
...[this.args.stat ? '--stat' : undefined],
|
|
126
|
-
...[useVite && this.args.preview ? '--preview' : undefined],
|
|
127
122
|
].filter(item => !!item) as string[],
|
|
128
123
|
});
|
|
129
124
|
},
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { getTsConfig, log, logErrors
|
|
1
|
+
import { getTsConfig, log, logErrors } from '../../utils';
|
|
2
2
|
import { bundle, getModuleType } from '../utils';
|
|
3
3
|
import { Command, CommandOptions } from './types';
|
|
4
4
|
|
|
@@ -15,8 +15,6 @@ export class BundlePackage extends Command<typeof options> {
|
|
|
15
15
|
static readonly options = options;
|
|
16
16
|
@logErrors
|
|
17
17
|
async execute() {
|
|
18
|
-
validateSharedDependenciesConsistency();
|
|
19
|
-
|
|
20
18
|
const {
|
|
21
19
|
config,
|
|
22
20
|
codeCoverage,
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { CommandName } from '../../utils';
|
|
2
2
|
import { Build } from './build';
|
|
3
3
|
import { BundlePackage } from './bundle-package';
|
|
4
|
-
import { BundleVite } from './bundle-vite';
|
|
5
4
|
import { Clean } from './clean';
|
|
6
5
|
import { ConvertEslintConfig } from './convert-eslint-config';
|
|
7
6
|
import { ESLintCommand } from './eslint';
|
|
@@ -16,6 +15,7 @@ import { MFEPackageClean } from './mfe-package-clean';
|
|
|
16
15
|
import { MFEPackagePublish } from './mfe-package-publish';
|
|
17
16
|
import { MFEPackageRollback } from './mfe-package-rollback';
|
|
18
17
|
import { MFEPublish } from './mfe-publish';
|
|
18
|
+
import { MFEPurgeCache } from './mfe-purge-cache';
|
|
19
19
|
import { PreparePackage } from './prepare-package';
|
|
20
20
|
import { Review } from './review';
|
|
21
21
|
import { RunTask } from './run-task';
|
|
@@ -29,7 +29,6 @@ import { UploadSourcemaps } from './upload-sourcemaps';
|
|
|
29
29
|
const commands: Record<CommandName, Newable<Command>> = {
|
|
30
30
|
[CommandName.build]: Build,
|
|
31
31
|
[CommandName['bundle-package']]: BundlePackage,
|
|
32
|
-
[CommandName['bundle-vite']]: BundleVite,
|
|
33
32
|
[CommandName['convert-eslint-config']]: ConvertEslintConfig,
|
|
34
33
|
[CommandName.clean]: Clean,
|
|
35
34
|
[CommandName.eslint]: ESLintCommand,
|
|
@@ -44,6 +43,7 @@ const commands: Record<CommandName, Newable<Command>> = {
|
|
|
44
43
|
[CommandName['mfe-package-publish']]: MFEPackagePublish,
|
|
45
44
|
[CommandName['mfe-package-rollback']]: MFEPackageRollback,
|
|
46
45
|
[CommandName['mfe-publish']]: MFEPublish,
|
|
46
|
+
[CommandName['mfe-purge-cache']]: MFEPurgeCache,
|
|
47
47
|
[CommandName['prepare-package']]: PreparePackage,
|
|
48
48
|
[CommandName.review]: Review,
|
|
49
49
|
[CommandName.start]: Start,
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { getVersionMismatches } from '@servicetitan/startup-utils';
|
|
2
2
|
import path from 'node:path';
|
|
3
|
-
import { getExposedDependencies, Metadata } from '../../core';
|
|
4
3
|
import {
|
|
5
4
|
isWebComponent,
|
|
6
5
|
loadSharedDependencies,
|
|
@@ -9,6 +8,8 @@ import {
|
|
|
9
8
|
readJson,
|
|
10
9
|
toArray,
|
|
11
10
|
} from '../../utils';
|
|
11
|
+
import { Metadata } from '../../webpack/configs/types';
|
|
12
|
+
import { getExposedDependencies } from '../../webpack/configs/utils';
|
|
12
13
|
import { Command, CommandOptions } from './types';
|
|
13
14
|
|
|
14
15
|
interface HostPackageJSON {
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import fs from 'node:fs';
|
|
2
2
|
import path from 'node:path';
|
|
3
|
-
import { buildMetadata } from '../../core';
|
|
4
3
|
import {
|
|
5
4
|
getFolders,
|
|
6
5
|
getPackageData,
|
|
@@ -10,6 +9,7 @@ import {
|
|
|
10
9
|
log,
|
|
11
10
|
logErrors,
|
|
12
11
|
} from '../../utils';
|
|
12
|
+
import { buildMetadata } from '../../webpack/configs/utils/build-metadata';
|
|
13
13
|
import { Command, CommandOptions } from './types';
|
|
14
14
|
|
|
15
15
|
const options = {
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import fs from 'fs';
|
|
2
2
|
import path from 'path';
|
|
3
|
-
import { EntryPoint, EntryPoints, Metadata } from '../../core';
|
|
4
3
|
import {
|
|
5
4
|
getBranchesConfigs,
|
|
6
5
|
getFolders,
|
|
@@ -9,6 +8,7 @@ import {
|
|
|
9
8
|
logErrors,
|
|
10
9
|
readJson,
|
|
11
10
|
} from '../../utils';
|
|
11
|
+
import { EntryPoint, EntryPoints, Metadata } from '../../webpack/configs';
|
|
12
12
|
import {
|
|
13
13
|
DRY_RUN_PREFIX,
|
|
14
14
|
getDefaultBuildVersion,
|
|
@@ -22,7 +22,7 @@ import {
|
|
|
22
22
|
runCommand,
|
|
23
23
|
} from '../utils';
|
|
24
24
|
import { Command, CommandOptions } from './types';
|
|
25
|
-
import { buildRollbackTag,
|
|
25
|
+
import { DEFAULT_MFE_REGISTRY, buildRollbackTag, purgeCache } from './utils';
|
|
26
26
|
|
|
27
27
|
export const mfePackagePublishOptions = {
|
|
28
28
|
branch: {
|
|
@@ -59,6 +59,11 @@ export const mfePackagePublishOptions = {
|
|
|
59
59
|
description: 'Upload source maps to Datadog?',
|
|
60
60
|
defaultDescription: 'true',
|
|
61
61
|
},
|
|
62
|
+
purgeCache: {
|
|
63
|
+
boolean: true,
|
|
64
|
+
description: 'Purge unpkg cache after publishing?',
|
|
65
|
+
defaultDescription: 'true',
|
|
66
|
+
},
|
|
62
67
|
} satisfies CommandOptions;
|
|
63
68
|
|
|
64
69
|
interface PublishData {
|
|
@@ -100,6 +105,11 @@ export class MFEPackagePublish extends Command<typeof mfePackagePublishOptions>
|
|
|
100
105
|
|
|
101
106
|
await this.maybePublishPackage(packageJson, data);
|
|
102
107
|
|
|
108
|
+
const { dry, tag } = data;
|
|
109
|
+
if (this.args.purgeCache !== false && !dry) {
|
|
110
|
+
purgeCache({ packageName: packageJson.name, tag });
|
|
111
|
+
}
|
|
112
|
+
|
|
103
113
|
if (data.uploadSourcemaps) {
|
|
104
114
|
this.uploadSourcemaps(data);
|
|
105
115
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { log, logErrors, readJson } from '../../utils';
|
|
2
2
|
import { DRY_RUN_PREFIX, npmTagVersion, npmView } from '../utils';
|
|
3
3
|
import { Command, CommandOptions } from './types';
|
|
4
|
-
import { buildRollbackTag,
|
|
4
|
+
import { DEFAULT_MFE_REGISTRY, buildRollbackTag, purgeCache } from './utils';
|
|
5
5
|
|
|
6
6
|
export const mfePackageRollbackOptions = {
|
|
7
7
|
dry: {
|
|
@@ -18,6 +18,11 @@ export const mfePackageRollbackOptions = {
|
|
|
18
18
|
description: 'The tag to rollback to its previous version',
|
|
19
19
|
required: true,
|
|
20
20
|
},
|
|
21
|
+
purgeCache: {
|
|
22
|
+
boolean: true,
|
|
23
|
+
description: 'Purge unpkg cache after rolling back?',
|
|
24
|
+
defaultDescription: 'true',
|
|
25
|
+
},
|
|
21
26
|
} satisfies CommandOptions;
|
|
22
27
|
|
|
23
28
|
interface PackageJson {
|
|
@@ -25,8 +30,6 @@ interface PackageJson {
|
|
|
25
30
|
}
|
|
26
31
|
|
|
27
32
|
export class MFEPackageRollback extends Command<typeof mfePackageRollbackOptions> {
|
|
28
|
-
static readonly description = 'Rollback a package to a previous tagged version';
|
|
29
|
-
|
|
30
33
|
static readonly options = mfePackageRollbackOptions;
|
|
31
34
|
|
|
32
35
|
private get dryRunPrefix() {
|
|
@@ -35,11 +38,16 @@ export class MFEPackageRollback extends Command<typeof mfePackageRollbackOptions
|
|
|
35
38
|
|
|
36
39
|
@logErrors
|
|
37
40
|
async execute() {
|
|
38
|
-
|
|
41
|
+
const { dry, tag } = this.args;
|
|
42
|
+
if (dry) {
|
|
39
43
|
log.warning('DRY-RUN MODE ENABLED, WILL NOT PERFORM ROLLBACK');
|
|
40
44
|
}
|
|
41
45
|
|
|
42
|
-
await this.handleRollback();
|
|
46
|
+
const packageName = await this.handleRollback();
|
|
47
|
+
|
|
48
|
+
if (packageName && this.args.purgeCache !== false && !dry) {
|
|
49
|
+
purgeCache({ packageName, tag });
|
|
50
|
+
}
|
|
43
51
|
}
|
|
44
52
|
|
|
45
53
|
private async handleRollback() {
|
|
@@ -96,5 +104,7 @@ export class MFEPackageRollback extends Command<typeof mfePackageRollbackOptions
|
|
|
96
104
|
tag,
|
|
97
105
|
});
|
|
98
106
|
}
|
|
107
|
+
|
|
108
|
+
return packageName;
|
|
99
109
|
}
|
|
100
110
|
}
|
|
@@ -111,17 +111,28 @@ export class MFEPublish extends Command<MFEPublishOptions> {
|
|
|
111
111
|
}
|
|
112
112
|
|
|
113
113
|
getPublishOptions() {
|
|
114
|
-
const {
|
|
115
|
-
|
|
114
|
+
const {
|
|
115
|
+
build,
|
|
116
|
+
branch,
|
|
117
|
+
dry,
|
|
118
|
+
force,
|
|
119
|
+
purgeCache,
|
|
120
|
+
registry,
|
|
121
|
+
tag,
|
|
122
|
+
uploadSourcemaps,
|
|
123
|
+
trackHistory,
|
|
124
|
+
} = this.args;
|
|
116
125
|
return [
|
|
117
126
|
...[branch && `--branch ${branch}`],
|
|
118
127
|
...[build && `--build ${build}`],
|
|
119
128
|
...[dry && '--dry'],
|
|
120
129
|
...[force && '--force'],
|
|
130
|
+
...[purgeCache === true && '--purge-cache'],
|
|
131
|
+
...[purgeCache === false && '--no-purge-cache'],
|
|
121
132
|
...[registry && `--registry ${registry}`],
|
|
133
|
+
...[typeof tag === 'string' && `--tag ${tag}`],
|
|
122
134
|
...[trackHistory === true && '--track-history'],
|
|
123
135
|
...[trackHistory === false && '--no-track-history'],
|
|
124
|
-
...[typeof tag === 'string' && `--tag ${tag}`],
|
|
125
136
|
...[uploadSourcemaps === true && `--upload-sourcemaps`],
|
|
126
137
|
...[uploadSourcemaps === false && `--no-upload-sourcemaps`],
|
|
127
138
|
].filter(item => !!item) as string[];
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { log, logErrors } from '../../utils';
|
|
2
|
+
import { Command, CommandOptions } from './types';
|
|
3
|
+
|
|
4
|
+
const mfePurgeCacheOptions = {
|
|
5
|
+
host: {
|
|
6
|
+
string: true,
|
|
7
|
+
description: 'Host URL to send purge requests to',
|
|
8
|
+
demandOption: true,
|
|
9
|
+
},
|
|
10
|
+
packageName: {
|
|
11
|
+
string: true,
|
|
12
|
+
description: 'Package name to purge',
|
|
13
|
+
demandOption: true,
|
|
14
|
+
},
|
|
15
|
+
tag: {
|
|
16
|
+
string: true,
|
|
17
|
+
description: 'Package tag to purge',
|
|
18
|
+
demandOption: true,
|
|
19
|
+
},
|
|
20
|
+
token: {
|
|
21
|
+
string: true,
|
|
22
|
+
description: 'X-Purge-Token header value',
|
|
23
|
+
defaultDescription: 'process.env.UNPKG_PURGE_TOKEN',
|
|
24
|
+
},
|
|
25
|
+
} satisfies CommandOptions;
|
|
26
|
+
|
|
27
|
+
export type PurgeResponse = {
|
|
28
|
+
pod: string;
|
|
29
|
+
status: number;
|
|
30
|
+
cache: string | null;
|
|
31
|
+
location: string | null;
|
|
32
|
+
}[];
|
|
33
|
+
|
|
34
|
+
export class MFEPurgeCache extends Command<typeof mfePurgeCacheOptions> {
|
|
35
|
+
static readonly options = mfePurgeCacheOptions;
|
|
36
|
+
|
|
37
|
+
@logErrors
|
|
38
|
+
async execute() {
|
|
39
|
+
const { host: rawHost, packageName, tag } = this.args;
|
|
40
|
+
const host = rawHost.replace(/\/$/, '');
|
|
41
|
+
const token = this.args.token ?? process.env.UNPKG_PURGE_TOKEN;
|
|
42
|
+
const packageNameAndTag = `${packageName}@${tag}`;
|
|
43
|
+
const path = `${packageNameAndTag}/dist/metadata.json`;
|
|
44
|
+
|
|
45
|
+
log.info(`Purging cache for ${packageNameAndTag}`);
|
|
46
|
+
|
|
47
|
+
if (!token) {
|
|
48
|
+
log.warning('Token is not defined, skipping purge');
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
const response = await fetch(`${host}/_purge/${path}`, {
|
|
53
|
+
method: 'POST',
|
|
54
|
+
headers: { 'X-Purge-Token': token },
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
if (!response.ok) {
|
|
58
|
+
throw new Error(`Purge request failed: ${response.status} ${response.statusText}`);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
const responseJson = await response.json();
|
|
62
|
+
/* istanbul ignore next: debug only */
|
|
63
|
+
log.debug('mfe-purge-cache', () => JSON.stringify(responseJson, null, 2));
|
|
64
|
+
|
|
65
|
+
log.info(`Cache purged: ${path} -> ${this.getLocation(responseJson)}`);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
private getLocation(responseJson: PurgeResponse) {
|
|
69
|
+
let location: string | null = null;
|
|
70
|
+
if (Array.isArray(responseJson)) {
|
|
71
|
+
location = responseJson[0]?.location?.replace(/^\//, '') ?? null;
|
|
72
|
+
}
|
|
73
|
+
return location;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
@@ -16,7 +16,6 @@ const options = {
|
|
|
16
16
|
ignore: { array: true, string: true, description: 'Packages to skip' },
|
|
17
17
|
scope: { array: true, string: true, description: 'Packages to run and watch' },
|
|
18
18
|
useTsc: { boolean: true, description: 'Use tsc to compile packages?' },
|
|
19
|
-
useVite: { boolean: true, description: 'Use Vite to bundle packages?' },
|
|
20
19
|
} satisfies CommandOptions;
|
|
21
20
|
|
|
22
21
|
enum StartProcesses {
|
|
@@ -40,8 +39,6 @@ export class Start extends Command<typeof options> {
|
|
|
40
39
|
checkArgs(this.args, { obsolete: ['--esbuild', '--experimental-bundlers'] });
|
|
41
40
|
|
|
42
41
|
const useTsc = this.args.useTsc;
|
|
43
|
-
const useVite = this.args.useVite;
|
|
44
|
-
const cmd = useVite ? 'startup bundle-vite' : 'startup bundle-package';
|
|
45
42
|
|
|
46
43
|
const packages = getPackages({
|
|
47
44
|
scope: this.args.scope,
|
|
@@ -154,7 +151,7 @@ export class Start extends Command<typeof options> {
|
|
|
154
151
|
return Promise.resolve();
|
|
155
152
|
}
|
|
156
153
|
return lernaExec({
|
|
157
|
-
cmd,
|
|
154
|
+
'cmd': 'startup bundle-package',
|
|
158
155
|
'scope': webpackScope,
|
|
159
156
|
'parallel': true,
|
|
160
157
|
'stream': true,
|
|
@@ -170,7 +167,7 @@ export class Start extends Command<typeof options> {
|
|
|
170
167
|
return Promise.resolve();
|
|
171
168
|
}
|
|
172
169
|
return lernaExec({
|
|
173
|
-
cmd,
|
|
170
|
+
'cmd': 'startup bundle-package',
|
|
174
171
|
'scope': webpackScope,
|
|
175
172
|
'parallel': true,
|
|
176
173
|
'stream': true,
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { runCommandOutput } from '../../../utils';
|
|
2
|
+
import { purgeCache } from '../purge-cache';
|
|
3
|
+
|
|
4
|
+
jest.mock('../../../utils', () => ({
|
|
5
|
+
...jest.requireActual('../../../utils'),
|
|
6
|
+
runCommandOutput: jest.fn(),
|
|
7
|
+
}));
|
|
8
|
+
|
|
9
|
+
describe(purgeCache.name, () => {
|
|
10
|
+
let args: Parameters<typeof purgeCache>[0];
|
|
11
|
+
const packageName = '@servicetitan/foo';
|
|
12
|
+
const tag = 'prod';
|
|
13
|
+
|
|
14
|
+
beforeEach(() => {
|
|
15
|
+
jest.clearAllMocks();
|
|
16
|
+
args = { packageName, tag };
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
const subject = () => purgeCache(args);
|
|
20
|
+
|
|
21
|
+
test('runs mfe-purge-cache with host "https://unpkg.servicetitan.com", package name and tag', () => {
|
|
22
|
+
subject();
|
|
23
|
+
|
|
24
|
+
expect(runCommandOutput).toHaveBeenCalledWith(
|
|
25
|
+
`npx startup mfe-purge-cache --host https://unpkg.servicetitan.com --package-name ${packageName} --tag ${tag}`
|
|
26
|
+
);
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
describe('when registry is "https://verdaccio.st.dev"', () => {
|
|
30
|
+
beforeEach(() => (args.registry = 'https://verdaccio.st.dev'));
|
|
31
|
+
|
|
32
|
+
test('runs mfe-purge-cache with host "https://unpkg.st.dev"', () => {
|
|
33
|
+
subject();
|
|
34
|
+
|
|
35
|
+
expect(runCommandOutput).toHaveBeenCalledWith(
|
|
36
|
+
expect.stringContaining(`--host https://unpkg.st.dev`)
|
|
37
|
+
);
|
|
38
|
+
});
|
|
39
|
+
});
|
|
40
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const DEFAULT_MFE_REGISTRY = 'https://verdaccio.servicetitan.com';
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { runCommandOutput } from '../../utils';
|
|
2
|
+
|
|
3
|
+
const DEV_MFE_REGISTRY = 'https://verdaccio.st.dev';
|
|
4
|
+
const DEFAULT_UNPKG_HOST = 'https://unpkg.servicetitan.com';
|
|
5
|
+
const DEV_UNPKG_HOST = 'https://unpkg.st.dev';
|
|
6
|
+
|
|
7
|
+
export function purgeCache(options: { packageName: string; registry?: string; tag: string }) {
|
|
8
|
+
const { packageName, registry, tag } = options;
|
|
9
|
+
const host = registry === DEV_MFE_REGISTRY ? DEV_UNPKG_HOST : DEFAULT_UNPKG_HOST;
|
|
10
|
+
runCommandOutput(
|
|
11
|
+
`npx startup mfe-purge-cache --host ${host} --package-name ${packageName} --tag ${tag}`
|
|
12
|
+
);
|
|
13
|
+
}
|
|
@@ -12,12 +12,8 @@ import {
|
|
|
12
12
|
isExposeSharedDependencies,
|
|
13
13
|
loadSharedDependencies,
|
|
14
14
|
} from '../../../utils';
|
|
15
|
-
import { createWebpackConfig
|
|
16
|
-
import {
|
|
17
|
-
webpackDevConfigFileName,
|
|
18
|
-
webpackProdConfigFileName,
|
|
19
|
-
} from '../../../webpack/create-webpack-config';
|
|
20
|
-
import { bundle } from '../bundle';
|
|
15
|
+
import { createWebpackConfig } from '../../../webpack';
|
|
16
|
+
import { bundle, webpackDevConfigFileName, webpackProdConfigFileName } from '../bundle';
|
|
21
17
|
|
|
22
18
|
jest.mock('fs', () => fs);
|
|
23
19
|
jest.mock('portfinder');
|
|
@@ -28,16 +24,11 @@ jest.mock('../../../utils', () => ({
|
|
|
28
24
|
getFolders: jest.fn(),
|
|
29
25
|
getPackageData: jest.fn(),
|
|
30
26
|
hasHeadlessBundle: jest.fn(),
|
|
31
|
-
isDevServerDisabled: jest.fn(),
|
|
32
27
|
isExposeSharedDependencies: jest.fn(),
|
|
33
|
-
isWebComponent: jest.fn(),
|
|
34
28
|
loadSharedDependencies: jest.fn(),
|
|
35
29
|
log: { info: jest.fn(), debug: jest.fn() }, // suppress test output
|
|
36
30
|
}));
|
|
37
|
-
jest.mock('../../../webpack', () => ({
|
|
38
|
-
createWebpackConfig: jest.fn(),
|
|
39
|
-
createWebpackConfigs: jest.fn(),
|
|
40
|
-
}));
|
|
31
|
+
jest.mock('../../../webpack', () => ({ createWebpackConfig: jest.fn() }));
|
|
41
32
|
|
|
42
33
|
describe('[startup] Cli Utils', () => {
|
|
43
34
|
const pkg = createPackage({});
|
|
@@ -46,7 +37,7 @@ describe('[startup] Cli Utils', () => {
|
|
|
46
37
|
|
|
47
38
|
beforeEach(() => {
|
|
48
39
|
jest.resetAllMocks();
|
|
49
|
-
jest.mocked(
|
|
40
|
+
jest.mocked(createWebpackConfig).mockReturnValue(createWebpackResult);
|
|
50
41
|
jest.mocked(webpack).mockImplementation((): any => compiler);
|
|
51
42
|
jest.mocked(getPortPromise).mockImplementation(options =>
|
|
52
43
|
Promise.resolve(options?.port ?? 0)
|
|
@@ -302,7 +293,7 @@ describe('[startup] Cli Utils', () => {
|
|
|
302
293
|
};
|
|
303
294
|
});
|
|
304
295
|
|
|
305
|
-
test('builds full and
|
|
296
|
+
test('builds full and "embed" packages', async () => {
|
|
306
297
|
await subject();
|
|
307
298
|
|
|
308
299
|
expect(createWebpackConfig).toHaveBeenCalledWith(
|
|
@@ -311,7 +302,7 @@ describe('[startup] Cli Utils', () => {
|
|
|
311
302
|
);
|
|
312
303
|
expect(createWebpackConfig).toHaveBeenCalledWith(defaultCreateOverrides, {
|
|
313
304
|
...defaultCreateOptions,
|
|
314
|
-
|
|
305
|
+
embed: true,
|
|
315
306
|
});
|
|
316
307
|
expect(compiler.run).toHaveBeenCalledTimes(2);
|
|
317
308
|
});
|
|
@@ -348,7 +339,7 @@ describe('[startup] Cli Utils', () => {
|
|
|
348
339
|
expect(createWebpackConfig).toHaveBeenCalledWith(overrides, createOptions);
|
|
349
340
|
expect(createWebpackConfig).toHaveBeenCalledWith(overrides, {
|
|
350
341
|
...createOptions,
|
|
351
|
-
|
|
342
|
+
embed: true,
|
|
352
343
|
});
|
|
353
344
|
});
|
|
354
345
|
}
|
|
@@ -535,7 +526,7 @@ describe('[startup] Cli Utils', () => {
|
|
|
535
526
|
expect(createWebpackConfig).toHaveBeenCalledWith(overrides, options);
|
|
536
527
|
expect(createWebpackConfig).toHaveBeenCalledWith(overrides, {
|
|
537
528
|
...options,
|
|
538
|
-
|
|
529
|
+
embed: true,
|
|
539
530
|
});
|
|
540
531
|
expect(webpack).toHaveBeenNthCalledWith(1, createWebpackResult);
|
|
541
532
|
expect(webpack).toHaveBeenNthCalledWith(2, createWebpackResult);
|
|
@@ -577,7 +568,7 @@ describe('[startup] Cli Utils', () => {
|
|
|
577
568
|
expect(createWebpackConfig).toHaveBeenCalledWith(overrides, options);
|
|
578
569
|
expect(createWebpackConfig).toHaveBeenCalledWith(overrides, {
|
|
579
570
|
...options,
|
|
580
|
-
|
|
571
|
+
embed: true,
|
|
581
572
|
});
|
|
582
573
|
expect(WebpackDevServer).not.toHaveBeenCalled();
|
|
583
574
|
});
|
|
@@ -597,7 +588,7 @@ describe('[startup] Cli Utils', () => {
|
|
|
597
588
|
expect(createWebpackConfig).toHaveBeenCalledWith(overrides, options);
|
|
598
589
|
expect(createWebpackConfig).toHaveBeenCalledWith(overrides, {
|
|
599
590
|
...options,
|
|
600
|
-
|
|
591
|
+
embed: true,
|
|
601
592
|
});
|
|
602
593
|
});
|
|
603
594
|
}
|