@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 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tsc-compile-package.d.ts","sourceRoot":"","sources":["../../../src/cli/tasks/tsc-compile-package.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"tsc-compile-package.d.ts","sourceRoot":"","sources":["../../../src/cli/tasks/tsc-compile-package.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAErC,UAAU,IAAI;IACV,KAAK,CAAC,EAAE,OAAO,CAAC;CACnB;AAED,qBAAa,iBAAkB,SAAQ,OAAO;gBAC9B,EAAE,KAAK,EAAE,EAAE,IAAI;IAYrB,OAAO;CAsBhB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/cli/tasks/tsc-compile-package.ts"],"sourcesContent":["import { getTsConfig } from '../../utils';\nimport {
|
|
1
|
+
{"version":3,"sources":["../../../src/cli/tasks/tsc-compile-package.ts"],"sourcesContent":["import { getTsConfig } from '../../utils';\nimport { CliTask } from './cli-task';\n\ninterface Args {\n watch?: boolean;\n}\n\nexport class TscCompilePackage extends CliTask {\n constructor({ watch }: Args) {\n super({\n name: 'tsc-compile-package',\n global: false,\n indicators: {\n end: 'Watching for file changes.',\n watchStart: 'Starting incremental compilation.',\n },\n watch,\n });\n }\n\n async execute() {\n const tsConfig = getTsConfig();\n await this.runChildProcess(\n 'tsc',\n [\n this.watch ? '-w' : undefined,\n '--pretty',\n '--preserveWatchOutput',\n '--noCheck',\n '--composite',\n 'false',\n '--declaration',\n 'false',\n '--declarationMap',\n 'false',\n '--tsBuildInfoFile',\n 'tsconfig.compile.tsbuildinfo',\n '--project',\n tsConfig,\n ].filter(i => i !== undefined)\n );\n }\n}\n"],"names":["TscCompilePackage","CliTask","execute","tsConfig","getTsConfig","runChildProcess","watch","undefined","filter","i","name","global","indicators","end","watchStart"],"mappings":";;;;+BAOaA;;;eAAAA;;;uBAPe;yBACJ;AAMjB,MAAMA,0BAA0BC,gBAAO;IAa1C,MAAMC,UAAU;QACZ,MAAMC,WAAWC,IAAAA,kBAAW;QAC5B,MAAM,IAAI,CAACC,eAAe,CACtB,OACA;YACI,IAAI,CAACC,KAAK,GAAG,OAAOC;YACpB;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACAJ;SACH,CAACK,MAAM,CAACC,CAAAA,IAAKA,MAAMF;IAE5B;IAjCA,YAAY,EAAED,KAAK,EAAQ,CAAE;QACzB,KAAK,CAAC;YACFI,MAAM;YACNC,QAAQ;YACRC,YAAY;gBACRC,KAAK;gBACLC,YAAY;YAChB;YACAR;QACJ;IACJ;AAwBJ"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tsc-compile.d.ts","sourceRoot":"","sources":["../../../src/cli/tasks/tsc-compile.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"tsc-compile.d.ts","sourceRoot":"","sources":["../../../src/cli/tasks/tsc-compile.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAErC,UAAU,IAAI;IACV,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IAC3B,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IAC1B,KAAK,CAAC,EAAE,OAAO,CAAC;CACnB;AAED,qBAAa,UAAW,SAAQ,OAAO;IACvB,OAAO,CAAC,QAAQ,CAAC,IAAI;gBAAJ,IAAI,EAAE,IAAI;IAYjC,OAAO;CA0BhB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/cli/tasks/tsc-compile.ts"],"sourcesContent":["import { getPackages, getPackagesGraph, getTsConfig, log, Package, PackageType } from '../../utils';\nimport {
|
|
1
|
+
{"version":3,"sources":["../../../src/cli/tasks/tsc-compile.ts"],"sourcesContent":["import { getPackages, getPackagesGraph, getTsConfig, log, Package, PackageType } from '../../utils';\nimport { CliTask } from './cli-task';\n\ninterface Args {\n ignore?: string | string[];\n scope?: string | string[];\n watch?: boolean;\n}\n\nexport class TscCompile extends CliTask {\n constructor(private readonly args: Args) {\n super({\n name: 'tsc-compile',\n watch: args.watch,\n global: true,\n indicators: {\n end: 'Watching for file changes.',\n watchStart: 'Starting incremental compilation.',\n },\n });\n }\n\n async execute() {\n const packages = getPackages({\n scope: this.args.scope,\n ignore: this.args.ignore,\n type: [PackageType.TSC, PackageType.Webpack],\n });\n\n const tsConfigs = collapsePackages(packages).map(({ location }) => getTsConfig(location));\n\n log.debug(\n 'tsc-compile',\n `${this.args.watch ? 'watching' : 'compiling'} ${tsConfigs.join(' ')}`\n );\n\n await this.runChildProcess(\n 'tsc',\n [\n '-b',\n this.watch ? '-w' : undefined,\n '--pretty',\n '--preserveWatchOutput',\n '--emitDeclarationOnly',\n ...tsConfigs,\n ].filter(i => i !== undefined)\n );\n }\n}\n\n/**\n * Exclude dependant packages as they will be built through project references\n */\nfunction collapsePackages(packages: Package[]) {\n const dependencies = new Set(\n Object.values(getPackagesGraph({ scope: packages.map(({ name }) => name) })).flat()\n );\n\n return packages.filter(({ name }) => !dependencies.has(name));\n}\n"],"names":["TscCompile","CliTask","execute","packages","getPackages","scope","args","ignore","type","PackageType","TSC","Webpack","tsConfigs","collapsePackages","map","location","getTsConfig","log","debug","watch","join","runChildProcess","undefined","filter","i","name","global","indicators","end","watchStart","dependencies","Set","Object","values","getPackagesGraph","flat","has"],"mappings":";;;;+BASaA;;;eAAAA;;;uBATyE;yBAC9D;;;;;;;;;;;;;;AAQjB,MAAMA,mBAAmBC,gBAAO;IAanC,MAAMC,UAAU;QACZ,MAAMC,WAAWC,IAAAA,kBAAW,EAAC;YACzBC,OAAO,IAAI,CAACC,IAAI,CAACD,KAAK;YACtBE,QAAQ,IAAI,CAACD,IAAI,CAACC,MAAM;YACxBC,MAAM;gBAACC,kBAAW,CAACC,GAAG;gBAAED,kBAAW,CAACE,OAAO;aAAC;QAChD;QAEA,MAAMC,YAAYC,iBAAiBV,UAAUW,GAAG,CAAC,CAAC,EAAEC,QAAQ,EAAE,GAAKC,IAAAA,kBAAW,EAACD;QAE/EE,UAAG,CAACC,KAAK,CACL,eACA,GAAG,IAAI,CAACZ,IAAI,CAACa,KAAK,GAAG,aAAa,YAAY,CAAC,EAAEP,UAAUQ,IAAI,CAAC,MAAM;QAG1E,MAAM,IAAI,CAACC,eAAe,CACtB,OACA;YACI;YACA,IAAI,CAACF,KAAK,GAAG,OAAOG;YACpB;YACA;YACA;eACGV;SACN,CAACW,MAAM,CAACC,CAAAA,IAAKA,MAAMF;IAE5B;IArCA,YAAY,AAAiBhB,IAAU,CAAE;QACrC,KAAK,CAAC;YACFmB,MAAM;YACNN,OAAOb,KAAKa,KAAK;YACjBO,QAAQ;YACRC,YAAY;gBACRC,KAAK;gBACLC,YAAY;YAChB;QACJ,iDATyBvB,OAAAA;IAU7B;AA4BJ;AAEA;;CAEC,GACD,SAASO,iBAAiBV,QAAmB;IACzC,MAAM2B,eAAe,IAAIC,IACrBC,OAAOC,MAAM,CAACC,IAAAA,uBAAgB,EAAC;QAAE7B,OAAOF,SAASW,GAAG,CAAC,CAAC,EAAEW,IAAI,EAAE,GAAKA;IAAM,IAAIU,IAAI;IAGrF,OAAOhC,SAASoB,MAAM,CAAC,CAAC,EAAEE,IAAI,EAAE,GAAK,CAACK,aAAaM,GAAG,CAACX;AAC3D"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bundle.d.ts","sourceRoot":"","sources":["../../../src/cli/utils/bundle.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"bundle.d.ts","sourceRoot":"","sources":["../../../src/cli/utils/bundle.ts"],"names":[],"mappings":"AAIA,OAAgB,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAcjD,UAAU,OAAO;IACb,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,uBAAuB,CAAC,EAAE,OAAO,GAAG,IAAI,CAAC,aAAa,EAAE,QAAQ,CAAC,CAAC;IAClE,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,KAAK,CAAC,EAAE,OAAO,CAAC;CACnB;AAWD,eAAO,MAAM,wBAAwB,0BAA0B,CAAC;AAChE,eAAO,MAAM,yBAAyB,2BAA2B,CAAC;AAElE,wBAAsB,MAAM,CAAC,OAAO,GAAE,OAAY,0BAmCjD"}
|
package/dist/cli/utils/bundle.js
CHANGED
|
@@ -19,9 +19,9 @@ _export(exports, {
|
|
|
19
19
|
return webpackProdConfigFileName;
|
|
20
20
|
}
|
|
21
21
|
});
|
|
22
|
+
const _crypto = /*#__PURE__*/ _interop_require_default(require("crypto"));
|
|
22
23
|
const _fs = /*#__PURE__*/ _interop_require_default(require("fs"));
|
|
23
24
|
const _path = /*#__PURE__*/ _interop_require_default(require("path"));
|
|
24
|
-
const _crypto = /*#__PURE__*/ _interop_require_default(require("crypto"));
|
|
25
25
|
const _portfinder = require("portfinder");
|
|
26
26
|
const _webpack = /*#__PURE__*/ _interop_require_default(require("webpack"));
|
|
27
27
|
const _webpackdevserver = /*#__PURE__*/ _interop_require_default(require("webpack-dev-server"));
|
|
@@ -146,8 +146,8 @@ async function run(config) {
|
|
|
146
146
|
process.stdout.write(stats.toString(config.stats) + '\n');
|
|
147
147
|
}
|
|
148
148
|
async function runServe({ devServer = {}, ...config }) {
|
|
149
|
-
const compiler = createWebpackCompiler(config);
|
|
150
149
|
var _devServer_host;
|
|
150
|
+
const compiler = createWebpackCompiler(config);
|
|
151
151
|
const host = (_devServer_host = devServer.host) !== null && _devServer_host !== void 0 ? _devServer_host : 'localhost';
|
|
152
152
|
const port = await (0, _portfinder.getPortPromise)({
|
|
153
153
|
port: Number(devServer.port) || 8080,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/cli/utils/bundle.ts"],"sourcesContent":["import fs from 'fs';\nimport path from 'path';\nimport crypto from 'crypto';\nimport { getPortPromise } from 'portfinder';\n\nimport webpack, { Configuration } from 'webpack';\nimport WebpackDevServer from 'webpack-dev-server';\n\nimport {\n getPackageName,\n hasHeadlessBundle,\n isDevServerDisabled,\n isExposeSharedDependencies,\n isWebComponent,\n log,\n pick,\n} from '../../utils';\nimport { Overrides, createWebpackConfig } from '../../webpack';\nimport { stringifyConfig } from '../../webpack/utils';\n\ninterface Options {\n buildStat?: boolean;\n codeCoverage?: boolean;\n config?: string;\n emitExposedDependencies?: boolean | Pick<Configuration, 'output'>;\n useWatchConfig?: boolean;\n watch?: boolean;\n}\n\nfunction getName() {\n const packageName = getPackageName()\n .replace(/\\//g, '-')\n .replace(/[^\\w-]/g, '');\n const hash = crypto.randomBytes(4).toString('hex');\n\n return `${packageName}-${hash}`;\n}\n\nexport const webpackDevConfigFileName = 'webpack.dev.config.js';\nexport const webpackProdConfigFileName = 'webpack.prod.config.js';\n\nexport async function bundle(options: Options = {}) {\n const { emitExposedDependencies, useWatchConfig, watch } = options;\n if (emitExposedDependencies) {\n if (watch) {\n throw new Error('cannot bundle exposed dependencies in watch mode');\n }\n if (!isExposeSharedDependencies()) {\n return;\n }\n }\n\n log.info(`Bundling ${emitExposedDependencies ? 'exposed dependencies' : 'package'}...`);\n\n const mode = watch || useWatchConfig ? 'development' : 'production';\n const fallback = watch || useWatchConfig ? webpackDevConfigFileName : webpackProdConfigFileName;\n const customConfig = readWebpackConfig({ ...options, fallback });\n const webpackOptions = getWebpackOptions(options, customConfig);\n\n /* istanbul ignore next: debug only */\n log.debug('custom-webpack-config', () => stringifyConfig(customConfig));\n\n if (isWebComponent()) {\n return bundleWebComponent({ customConfig, mode, watch, webpackOptions });\n }\n\n const config =\n customConfig && !emitExposedDependencies\n ? customConfig\n : createWebpackConfig({ configuration: { mode } }, webpackOptions);\n\n if (watch) {\n return isDevServerDisabled() ? runWatch(config) : runServe(config);\n }\n\n return run(config);\n}\n\nfunction bundleWebComponent({\n customConfig,\n mode,\n watch,\n webpackOptions,\n}: {\n customConfig: ReturnType<typeof readWebpackConfig>;\n mode: 'development' | 'production';\n watch?: boolean;\n webpackOptions: ReturnType<typeof getWebpackOptions>;\n}) {\n const overrides: Overrides = {\n configuration: { ...customConfig?.configuration, mode },\n plugins: customConfig?.plugins,\n };\n\n const fullConfig = createWebpackConfig(overrides, webpackOptions);\n const lightConfig = createWebpackConfig(overrides, { ...webpackOptions, embed: true });\n const headlessConfig = hasHeadlessBundle()\n ? createWebpackConfig(overrides, {\n ...webpackOptions,\n headless: true,\n })\n : undefined;\n\n const promises = watch\n ? [\n runWatch(lightConfig),\n isDevServerDisabled() ? runWatch(fullConfig) : runServe(fullConfig),\n headlessConfig && runWatch(headlessConfig),\n ]\n : [run(lightConfig), run(fullConfig), headlessConfig && run(headlessConfig)];\n\n return Promise.all(promises.filter(promise => !!promise));\n}\n\nfunction getWebpackOptions(options: Options, customConfig?: Record<string, any>) {\n const result = {\n name: getName(),\n ...pick(options, ['buildStat', 'codeCoverage', 'emitExposedDependencies']),\n };\n\n if (result.emitExposedDependencies && customConfig) {\n result.emitExposedDependencies = { output: customConfig.output };\n }\n\n return result;\n}\n\nfunction readWebpackConfig({ config, fallback }: Options & { fallback: string }) {\n return readConfig(config) ?? readConfig(fallback);\n}\n\nfunction readConfig(relativePath?: string): Record<string, any> | undefined {\n if (relativePath && fs.existsSync(relativePath)) {\n return require(path.resolve(relativePath));\n }\n}\n\nasync function run(config: Configuration) {\n const compiler = createWebpackCompiler(config);\n\n const stats = await new Promise<webpack.Stats>((resolve, reject) => {\n compiler.run((error, stats) => {\n if (!stats || error) {\n return reject(error ?? new Error('Something went wrong.'));\n }\n\n if (stats.hasErrors()) {\n return reject(new Error(stats.toString('errors-only')));\n }\n\n compiler.close(() => resolve(stats));\n });\n });\n\n process.stdout.write(stats.toString(config.stats) + '\\n');\n}\n\nasync function runServe({ devServer = {}, ...config }: Configuration) {\n const compiler = createWebpackCompiler(config);\n const host = devServer.host ?? 'localhost';\n const port = await getPortPromise({\n port: Number(devServer.port) || 8080,\n host,\n });\n\n return new Promise<void>((_0, reject) => {\n const server = new WebpackDevServer({ ...devServer, host, port }, compiler);\n server.startCallback(e => {\n if (e) {\n server.stopCallback(() => {\n reject(e);\n });\n }\n });\n });\n}\n\nasync function runWatch(config: Configuration) {\n const compiler = createWebpackCompiler(config);\n return new Promise<void>((_0, reject) => {\n const watching = compiler.watch({}, e => {\n if (e) {\n watching?.close(() => {\n reject(e);\n });\n }\n });\n });\n}\n\nfunction createWebpackCompiler(config: Configuration) {\n return webpack(config)!; // webpack only potentially returns null when given a callback argument\n}\n"],"names":["bundle","webpackDevConfigFileName","webpackProdConfigFileName","getName","packageName","getPackageName","replace","hash","crypto","randomBytes","toString","options","emitExposedDependencies","useWatchConfig","watch","Error","isExposeSharedDependencies","log","info","mode","fallback","customConfig","readWebpackConfig","webpackOptions","getWebpackOptions","debug","stringifyConfig","isWebComponent","bundleWebComponent","config","createWebpackConfig","configuration","isDevServerDisabled","runWatch","runServe","run","overrides","plugins","fullConfig","lightConfig","embed","headlessConfig","hasHeadlessBundle","headless","undefined","promises","Promise","all","filter","promise","result","name","pick","output","readConfig","relativePath","fs","existsSync","require","path","resolve","compiler","createWebpackCompiler","stats","reject","error","hasErrors","close","process","stdout","write","devServer","host","port","getPortPromise","Number","_0","server","WebpackDevServer","startCallback","e","stopCallback","watching","webpack"],"mappings":";;;;;;;;;;;QAyCsBA;eAAAA;;QAHTC;eAAAA;;QACAC;eAAAA;;;2DAvCE;6DACE;+DACE;4BACY;gEAEQ;yEACV;uBAUtB;0BACwC;wBACf;;;;;;AAWhC,SAASC;IACL,MAAMC,cAAcC,IAAAA,qBAAc,IAC7BC,OAAO,CAAC,OAAO,KACfA,OAAO,CAAC,WAAW;IACxB,MAAMC,OAAOC,eAAM,CAACC,WAAW,CAAC,GAAGC,QAAQ,CAAC;IAE5C,OAAO,GAAGN,YAAY,CAAC,EAAEG,MAAM;AACnC;AAEO,MAAMN,2BAA2B;AACjC,MAAMC,4BAA4B;AAElC,eAAeF,OAAOW,UAAmB,CAAC,CAAC;IAC9C,MAAM,EAAEC,uBAAuB,EAAEC,cAAc,EAAEC,KAAK,EA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IjD,MAAMgD,MAAMrD,QAAQ,CAAC;YAC3C;YAEAmD,SAASM,KAAK,CAAC,IAAMP,QAAQG;QACjC;IACJ;IAEAK,QAAQC,MAAM,CAACC,KAAK,CAACP,MAAMrD,QAAQ,CAACmB,OAAOkC,KAAK,IAAI;AACxD;AAEA,eAAe7B,SAAS,EAAEqC,YAAY,CAAC,CAAC,EAAE,GAAG1C,QAAuB;IAChE,MAAMgC,WAAWC,sBAAsBjC;QAC1B0C;IAAb,MAAMC,OAAOD,CAAAA,kBAAAA,UAAUC,IAAI,cAAdD,6BAAAA,kBAAkB;IAC/B,MAAME,OAAO,MAAMC,IAAAA,0BAAc,EAAC;QAC9BD,MAAME,OAAOJ,UAAUE,IAAI,KAAK;QAChCD;IACJ;IAEA,OAAO,IAAI1B,QAAc,CAAC8B,IAAIZ;QAC1B,MAAMa,SAAS,IAAIC,yBAAgB,CAAC;YAAE,GAAGP,SAAS;YAAEC;YAAMC;QAAK,GAAGZ;QAClEgB,OAAOE,aAAa,CAACC,CAAAA;YACjB,IAAIA,GAAG;gBACHH,OAAOI,YAAY,CAAC;oBAChBjB,OAAOgB;gBACX;YACJ;QACJ;IACJ;AACJ;AAEA,eAAe/C,SAASJ,MAAqB;IACzC,MAAMgC,WAAWC,sBAAsBjC;IACvC,OAAO,IAAIiB,QAAc,CAAC8B,IAAIZ;QAC1B,MAAMkB,WAAWrB,SAAS/C,KAAK,CAAC,CAAC,GAAGkE,CAAAA;YAChC,IAAIA,GAAG;gBACHE,qBAAAA,+BAAAA,SAAUf,KAAK,CAAC;oBACZH,OAAOgB;gBACX;YACJ;QACJ;IACJ;AACJ;AAEA,SAASlB,sBAAsBjC,MAAqB;IAChD,OAAOsD,IAAAA,gBAAO,EAACtD,SAAU,uEAAuE;AACpG"}
|
|
1
|
+
{"version":3,"sources":["../../../src/cli/utils/bundle.ts"],"sourcesContent":["import crypto from 'crypto';\nimport fs from 'fs';\nimport path from 'path';\nimport { getPortPromise } from 'portfinder';\nimport webpack, { Configuration } from 'webpack';\nimport WebpackDevServer from 'webpack-dev-server';\nimport {\n getPackageName,\n hasHeadlessBundle,\n isDevServerDisabled,\n isExposeSharedDependencies,\n isWebComponent,\n log,\n pick,\n} from '../../utils';\nimport { Overrides, createWebpackConfig } from '../../webpack';\nimport { stringifyConfig } from '../../webpack/utils';\n\ninterface Options {\n buildStat?: boolean;\n codeCoverage?: boolean;\n config?: string;\n emitExposedDependencies?: boolean | Pick<Configuration, 'output'>;\n useWatchConfig?: boolean;\n watch?: boolean;\n}\n\nfunction getName() {\n const packageName = getPackageName()\n .replace(/\\//g, '-')\n .replace(/[^\\w-]/g, '');\n const hash = crypto.randomBytes(4).toString('hex');\n\n return `${packageName}-${hash}`;\n}\n\nexport const webpackDevConfigFileName = 'webpack.dev.config.js';\nexport const webpackProdConfigFileName = 'webpack.prod.config.js';\n\nexport async function bundle(options: Options = {}) {\n const { emitExposedDependencies, useWatchConfig, watch } = options;\n if (emitExposedDependencies) {\n if (watch) {\n throw new Error('cannot bundle exposed dependencies in watch mode');\n }\n if (!isExposeSharedDependencies()) {\n return;\n }\n }\n\n log.info(`Bundling ${emitExposedDependencies ? 'exposed dependencies' : 'package'}...`);\n\n const mode = watch || useWatchConfig ? 'development' : 'production';\n const fallback = watch || useWatchConfig ? webpackDevConfigFileName : webpackProdConfigFileName;\n const customConfig = readWebpackConfig({ ...options, fallback });\n const webpackOptions = getWebpackOptions(options, customConfig);\n\n /* istanbul ignore next: debug only */\n log.debug('custom-webpack-config', () => stringifyConfig(customConfig));\n\n if (isWebComponent()) {\n return bundleWebComponent({ customConfig, mode, watch, webpackOptions });\n }\n\n const config =\n customConfig && !emitExposedDependencies\n ? customConfig\n : createWebpackConfig({ configuration: { mode } }, webpackOptions);\n\n if (watch) {\n return isDevServerDisabled() ? runWatch(config) : runServe(config);\n }\n\n return run(config);\n}\n\nfunction bundleWebComponent({\n customConfig,\n mode,\n watch,\n webpackOptions,\n}: {\n customConfig: ReturnType<typeof readWebpackConfig>;\n mode: 'development' | 'production';\n watch?: boolean;\n webpackOptions: ReturnType<typeof getWebpackOptions>;\n}) {\n const overrides: Overrides = {\n configuration: { ...customConfig?.configuration, mode },\n plugins: customConfig?.plugins,\n };\n\n const fullConfig = createWebpackConfig(overrides, webpackOptions);\n const lightConfig = createWebpackConfig(overrides, { ...webpackOptions, embed: true });\n const headlessConfig = hasHeadlessBundle()\n ? createWebpackConfig(overrides, {\n ...webpackOptions,\n headless: true,\n })\n : undefined;\n\n const promises = watch\n ? [\n runWatch(lightConfig),\n isDevServerDisabled() ? runWatch(fullConfig) : runServe(fullConfig),\n headlessConfig && runWatch(headlessConfig),\n ]\n : [run(lightConfig), run(fullConfig), headlessConfig && run(headlessConfig)];\n\n return Promise.all(promises.filter(promise => !!promise));\n}\n\nfunction getWebpackOptions(options: Options, customConfig?: Record<string, any>) {\n const result = {\n name: getName(),\n ...pick(options, ['buildStat', 'codeCoverage', 'emitExposedDependencies']),\n };\n\n if (result.emitExposedDependencies && customConfig) {\n result.emitExposedDependencies = { output: customConfig.output };\n }\n\n return result;\n}\n\nfunction readWebpackConfig({ config, fallback }: Options & { fallback: string }) {\n return readConfig(config) ?? readConfig(fallback);\n}\n\nfunction readConfig(relativePath?: string): Record<string, any> | undefined {\n if (relativePath && fs.existsSync(relativePath)) {\n return require(path.resolve(relativePath));\n }\n}\n\nasync function run(config: Configuration) {\n const compiler = createWebpackCompiler(config);\n\n const stats = await new Promise<webpack.Stats>((resolve, reject) => {\n compiler.run((error, stats) => {\n if (!stats || error) {\n return reject(error ?? new Error('Something went wrong.'));\n }\n\n if (stats.hasErrors()) {\n return reject(new Error(stats.toString('errors-only')));\n }\n\n compiler.close(() => resolve(stats));\n });\n });\n\n process.stdout.write(stats.toString(config.stats) + '\\n');\n}\n\nasync function runServe({ devServer = {}, ...config }: Configuration) {\n const compiler = createWebpackCompiler(config);\n const host = devServer.host ?? 'localhost';\n const port = await getPortPromise({\n port: Number(devServer.port) || 8080,\n host,\n });\n\n return new Promise<void>((_0, reject) => {\n const server = new WebpackDevServer({ ...devServer, host, port }, compiler);\n server.startCallback(e => {\n if (e) {\n server.stopCallback(() => {\n reject(e);\n });\n }\n });\n });\n}\n\nasync function runWatch(config: Configuration) {\n const compiler = createWebpackCompiler(config);\n return new Promise<void>((_0, reject) => {\n const watching = compiler.watch({}, e => {\n if (e) {\n watching?.close(() => {\n reject(e);\n });\n }\n });\n });\n}\n\nfunction createWebpackCompiler(config: Configuration) {\n return webpack(config)!; // webpack only potentially returns null when given a callback argument\n}\n"],"names":["bundle","webpackDevConfigFileName","webpackProdConfigFileName","getName","packageName","getPackageName","replace","hash","crypto","randomBytes","toString","options","emitExposedDependencies","useWatchConfig","watch","Error","isExposeSharedDependencies","log","info","mode","fallback","customConfig","readWebpackConfig","webpackOptions","getWebpackOptions","debug","stringifyConfig","isWebComponent","bundleWebComponent","config","createWebpackConfig","configuration","isDevServerDisabled","runWatch","runServe","run","overrides","plugins","fullConfig","lightConfig","embed","headlessConfig","hasHeadlessBundle","headless","undefined","promises","Promise","all","filter","promise","result","name","pick","output","readConfig","relativePath","fs","existsSync","require","path","resolve","compiler","createWebpackCompiler","stats","reject","error","hasErrors","close","process","stdout","write","devServer","host","port","getPortPromise","Number","_0","server","WebpackDevServer","startCallback","e","stopCallback","watching","webpack"],"mappings":";;;;;;;;;;;QAuCsBA;eAAAA;;QAHTC;eAAAA;;QACAC;eAAAA;;;+DArCM;2DACJ;6DACE;4BACc;gEACQ;yEACV;uBAStB;0BACwC;wBACf;;;;;;AAWhC,SAASC;IACL,MAAMC,cAAcC,IAAAA,qBAAc,IAC7BC,OAAO,CAAC,OAAO,KACfA,OAAO,CAAC,WAAW;IACxB,MAAMC,OAAOC,eAAM,CAACC,WAAW,CAAC,GAAGC,QAAQ,CAAC;IAE5C,OAAO,GAAGN,YAAY,CAAC,EAAEG,MAAM;AACnC;AAEO,MAAMN,2BAA2B;AACjC,MAAMC,4BAA4B;AAElC,eAAeF,OAAOW,UAAmB,CAAC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src/cli/utils/check-startup-location.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAO,MAAM,aAAa,CAAC;AAC/C,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAGtC,wBAAgB,oBAAoB,CAAC,WAAW,EAAE,WAAW,EAAE,OAAO,EAAE,OAAO,QAgB9E"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
Object.defineProperty(exports, "checkStartupLocation", {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: function() {
|
|
8
|
+
return checkStartupLocation;
|
|
9
|
+
}
|
|
10
|
+
});
|
|
11
|
+
const _utils = require("../../utils");
|
|
12
|
+
const _clinpm = require("./cli-npm");
|
|
13
|
+
function checkStartupLocation(commandName, command) {
|
|
14
|
+
const allowRunFromGlobal = command.constructor.allowRunFromGlobal;
|
|
15
|
+
if (allowRunFromGlobal || process.env.SKIP_STARTUP_LOCATION_CHECK) {
|
|
16
|
+
return;
|
|
17
|
+
}
|
|
18
|
+
const projectRoot = (0, _clinpm.npmGetProjectRoot)();
|
|
19
|
+
if (projectRoot && __dirname.startsWith(projectRoot)) {
|
|
20
|
+
process.env.SKIP_STARTUP_LOCATION_CHECK = 'true';
|
|
21
|
+
return;
|
|
22
|
+
}
|
|
23
|
+
_utils.log.error(`Error: ${commandName} must be run from the local @servicetitan/startup installation`);
|
|
24
|
+
process.exit(1);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
//# sourceMappingURL=check-startup-location.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/cli/utils/check-startup-location.ts"],"sourcesContent":["import { CommandName, log } from '../../utils';\nimport { Command } from '../commands';\nimport { npmGetProjectRoot } from './cli-npm';\n\nexport function checkStartupLocation(commandName: CommandName, command: Command) {\n const allowRunFromGlobal = (command.constructor as typeof Command).allowRunFromGlobal;\n if (allowRunFromGlobal || process.env.SKIP_STARTUP_LOCATION_CHECK) {\n return;\n }\n\n const projectRoot = npmGetProjectRoot();\n if (projectRoot && __dirname.startsWith(projectRoot)) {\n process.env.SKIP_STARTUP_LOCATION_CHECK = 'true';\n return;\n }\n\n log.error(\n `Error: ${commandName} must be run from the local @servicetitan/startup installation`\n );\n process.exit(1);\n}\n"],"names":["checkStartupLocation","commandName","command","allowRunFromGlobal","process","env","SKIP_STARTUP_LOCATION_CHECK","projectRoot","npmGetProjectRoot","__dirname","startsWith","log","error","exit"],"mappings":";;;;+BAIgBA;;;eAAAA;;;uBAJiB;wBAEC;AAE3B,SAASA,qBAAqBC,WAAwB,EAAEC,OAAgB;IAC3E,MAAMC,qBAAqB,AAACD,QAAQ,WAAW,CAAoBC,kBAAkB;IACrF,IAAIA,sBAAsBC,QAAQC,GAAG,CAACC,2BAA2B,EAAE;QAC/D;IACJ;IAEA,MAAMC,cAAcC,IAAAA,yBAAiB;IACrC,IAAID,eAAeE,UAAUC,UAAU,CAACH,cAAc;QAClDH,QAAQC,GAAG,CAACC,2BAA2B,GAAG;QAC1C;IACJ;IAEAK,UAAG,CAACC,KAAK,CACL,CAAC,OAAO,EAAEX,YAAY,8DAA8D,CAAC;IAEzFG,QAAQS,IAAI,CAAC;AACjB"}
|
|
@@ -5,6 +5,7 @@ export interface Version {
|
|
|
5
5
|
}
|
|
6
6
|
export declare function npmGetPackageVersions(registry: string, packageName: string): string[];
|
|
7
7
|
export declare function npmGetPackageVersionsDetails(registry: string, packageName: string): Version[];
|
|
8
|
+
export declare function npmGetProjectRoot(): string;
|
|
8
9
|
export declare function npmUnpublish(registry: string, packageName: string, packageVersion: string): Promise<void>;
|
|
9
10
|
export declare function npmPublish({ dry, tag }: {
|
|
10
11
|
dry?: boolean;
|
|
@@ -17,6 +18,11 @@ export declare function npmTagVersion({ packageName, packageVersion, registry, t
|
|
|
17
18
|
registry?: string;
|
|
18
19
|
tag: string;
|
|
19
20
|
}): Promise<void>;
|
|
21
|
+
export declare function npmRemoveTag({ packageName, registry, tag, }: {
|
|
22
|
+
packageName: string;
|
|
23
|
+
registry?: string;
|
|
24
|
+
tag: string;
|
|
25
|
+
}): Promise<void>;
|
|
20
26
|
export interface NPMPackageInfo {
|
|
21
27
|
'name': string;
|
|
22
28
|
'version': string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli-npm.d.ts","sourceRoot":"","sources":["../../../src/cli/utils/cli-npm.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,OAAO;IACpB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,IAAI,CAAC;IACX,GAAG,CAAC,EAAE,MAAM,CAAC;CAChB;AAID,wBAAgB,qBAAqB,CAAC,QAAQ,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,GAAG,MAAM,EAAE,CAWrF;AAED,wBAAgB,4BAA4B,CAAC,QAAQ,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,GAAG,OAAO,EAAE,CAmB7F;AAED,wBAAsB,YAAY,CAAC,QAAQ,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,iBAI/F;AAED,wBAAsB,UAAU,CAAC,EAAE,GAAG,EAAE,GAAG,EAAE,EAAE;IAAE,GAAG,CAAC,EAAE,OAAO,CAAC;IAAC,GAAG,CAAC,EAAE,MAAM,CAAA;CAAE,iBAE7E;AAED,wBAAsB,aAAa,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,iBAE7D;AAED,wBAAsB,aAAa,CAAC,EAChC,WAAW,EACX,cAAc,EACd,QAAQ,EACR,GAAG,GACN,EAAE;IACC,WAAW,EAAE,MAAM,CAAC;IACpB,cAAc,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,GAAG,EAAE,MAAM,CAAC;CACf,iBAMA;AAED,MAAM,WAAW,cAAc;IAC3B,MAAM,EAA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MAAM,CAAC;IACpB,cAAc,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,GAAG,EAAE,MAAM,CAAC;CACf,iBAMA;AAED,wBAAsB,YAAY,CAAC,EAC/B,WAAW,EACX,QAAQ,EACR,GAAG,GACN,EAAE;IACC,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,GAAG,EAAE,MAAM,CAAC;CACf,iBAGA;AAED,MAAM,WAAW,cAAc;IAC3B,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACrC,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAChC,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;CACzB;AAED,wBAAgB,OAAO,CAAC,EAAE,WAAW,EAAE,QAAQ,EAAE,EAAE;IAAE,WAAW,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,EAAE,MAAM,CAAA;CAAE,8BAY5F"}
|
|
@@ -15,12 +15,18 @@ _export(exports, {
|
|
|
15
15
|
get npmGetPackageVersionsDetails () {
|
|
16
16
|
return npmGetPackageVersionsDetails;
|
|
17
17
|
},
|
|
18
|
+
get npmGetProjectRoot () {
|
|
19
|
+
return npmGetProjectRoot;
|
|
20
|
+
},
|
|
18
21
|
get npmPackageSet () {
|
|
19
22
|
return npmPackageSet;
|
|
20
23
|
},
|
|
21
24
|
get npmPublish () {
|
|
22
25
|
return npmPublish;
|
|
23
26
|
},
|
|
27
|
+
get npmRemoveTag () {
|
|
28
|
+
return npmRemoveTag;
|
|
29
|
+
},
|
|
24
30
|
get npmTagVersion () {
|
|
25
31
|
return npmTagVersion;
|
|
26
32
|
},
|
|
@@ -39,7 +45,7 @@ function npmGetPackageVersions(registry, packageName) {
|
|
|
39
45
|
timeout: NPM_TIMEOUT
|
|
40
46
|
});
|
|
41
47
|
return JSON.parse(v);
|
|
42
|
-
} catch (
|
|
48
|
+
} catch (unused) {
|
|
43
49
|
return [];
|
|
44
50
|
}
|
|
45
51
|
}
|
|
@@ -63,10 +69,22 @@ function npmGetPackageVersionsDetails(registry, packageName) {
|
|
|
63
69
|
}
|
|
64
70
|
];
|
|
65
71
|
}, []);
|
|
66
|
-
} catch (
|
|
72
|
+
} catch (unused) {
|
|
67
73
|
return [];
|
|
68
74
|
}
|
|
69
75
|
}
|
|
76
|
+
function npmGetProjectRoot() {
|
|
77
|
+
return (0, _clios.runCommandOutput)('npm prefix', {
|
|
78
|
+
quiet: true,
|
|
79
|
+
// ignore stderr because any error here is fundamental and will be repeated elsewhere
|
|
80
|
+
stdio: [
|
|
81
|
+
'inherit',
|
|
82
|
+
'pipe',
|
|
83
|
+
'ignore'
|
|
84
|
+
],
|
|
85
|
+
timeout: NPM_TIMEOUT
|
|
86
|
+
}).trim();
|
|
87
|
+
}
|
|
70
88
|
async function npmUnpublish(registry, packageName, packageVersion) {
|
|
71
89
|
await (0, _clios.runCommand)(`npm unpublish ${packageName}@${packageVersion} --registry ${registry}`, {
|
|
72
90
|
timeout: NPM_TIMEOUT
|
|
@@ -85,6 +103,10 @@ async function npmPackageSet(key, value) {
|
|
|
85
103
|
async function npmTagVersion({ packageName, packageVersion, registry, tag }) {
|
|
86
104
|
await (0, _clios.runCommand)(`npm dist-tag ${registry ? `--registry=${registry} ` : ''}add ${packageName}@${packageVersion} ${tag}`);
|
|
87
105
|
}
|
|
106
|
+
async function npmRemoveTag({ packageName, registry, tag }) {
|
|
107
|
+
const registryFlag = registry ? `--registry=${registry} ` : '';
|
|
108
|
+
await (0, _clios.runCommand)(`npm dist-tag ${registryFlag}rm ${packageName} ${tag}`);
|
|
109
|
+
}
|
|
88
110
|
function npmView({ packageName, registry }) {
|
|
89
111
|
try {
|
|
90
112
|
const result = (0, _clios.runCommandOutput)([
|
|
@@ -100,7 +122,7 @@ function npmView({ packageName, registry }) {
|
|
|
100
122
|
if (result) {
|
|
101
123
|
return JSON.parse(result);
|
|
102
124
|
}
|
|
103
|
-
} catch (
|
|
125
|
+
} catch (unused) {
|
|
104
126
|
// ignore
|
|
105
127
|
}
|
|
106
128
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/cli/utils/cli-npm.ts"],"sourcesContent":["import { runCommand, runCommandOutput } from './cli-os';\n\nexport interface Version {\n name: string;\n date: Date;\n tag?: string;\n}\n\nconst NPM_TIMEOUT = 10000;\n\nexport function npmGetPackageVersions(registry: string, packageName: string): string[] {\n try {\n const v = runCommandOutput(\n `npm show ${packageName} versions --registry ${registry} --json`,\n { timeout: NPM_TIMEOUT }\n );\n\n return JSON.parse(v);\n } catch {\n return [];\n }\n}\n\nexport function npmGetPackageVersionsDetails(registry: string, packageName: string): Version[] {\n try {\n const result = runCommandOutput(\n `npm view ${packageName} time dist-tags --registry ${registry} --json`,\n { timeout: NPM_TIMEOUT }\n );\n\n const { time, 'dist-tags': distTags } = JSON.parse(result);\n\n const tags = Object.fromEntries(\n Object.entries(distTags).map(([tag, version]) => [version, tag])\n );\n\n return Object.keys(time).reduce((out, version) => {\n return [...out, { name: version, date: new Date(time[version]), tag: tags[version] }];\n }, []);\n } catch {\n return [];\n }\n}\n\nexport async function npmUnpublish(registry: string, packageName: string, packageVersion: string) {\n await runCommand(`npm unpublish ${packageName}@${packageVersion} --registry ${registry}`, {\n timeout: NPM_TIMEOUT,\n });\n}\n\nexport async function npmPublish({ dry, tag }: { dry?: boolean; tag?: string }) {\n await runCommand(['npm publish', !!tag && `--tag ${tag}`, !!dry && `--dry-run`]);\n}\n\nexport async function npmPackageSet(key: string, value: string) {\n await runCommand(`npm pkg set ${key}=${value}`);\n}\n\nexport async function npmTagVersion({\n packageName,\n packageVersion,\n registry,\n tag,\n}: {\n packageName: string;\n packageVersion: string;\n registry?: string;\n tag: string;\n}) {\n await runCommand(\n `npm dist-tag ${\n registry ? `--registry=${registry} ` : ''\n }add ${packageName}@${packageVersion} ${tag}`\n );\n}\n\nexport interface NPMPackageInfo {\n 'name': string;\n 'version': string;\n 'dist-tags'?: Record<string, string>;\n 'time'?: Record<string, string>;\n 'versions'?: string[];\n}\n\nexport function npmView({ packageName, registry }: { packageName: string; registry?: string }) {\n try {\n const result = runCommandOutput(\n ['npm', 'view', '--json', registry ? `--registry=${registry}` : '', packageName],\n { quiet: true, timeout: NPM_TIMEOUT }\n );\n if (result) {\n return JSON.parse(result) as NPMPackageInfo;\n }\n } catch {\n // ignore\n }\n}\n"],"names":["npmGetPackageVersions","npmGetPackageVersionsDetails","npmPackageSet","npmPublish","npmTagVersion","npmUnpublish","npmView","NPM_TIMEOUT","registry","packageName","v","runCommandOutput","timeout","JSON","parse","result","time","distTags","tags","Object","fromEntries","entries","map","tag","version","keys","reduce","out","name","date","Date","packageVersion","runCommand","dry","key","value","
|
|
1
|
+
{"version":3,"sources":["../../../src/cli/utils/cli-npm.ts"],"sourcesContent":["import { runCommand, runCommandOutput } from './cli-os';\n\nexport interface Version {\n name: string;\n date: Date;\n tag?: string;\n}\n\nconst NPM_TIMEOUT = 10000;\n\nexport function npmGetPackageVersions(registry: string, packageName: string): string[] {\n try {\n const v = runCommandOutput(\n `npm show ${packageName} versions --registry ${registry} --json`,\n { timeout: NPM_TIMEOUT }\n );\n\n return JSON.parse(v);\n } catch {\n return [];\n }\n}\n\nexport function npmGetPackageVersionsDetails(registry: string, packageName: string): Version[] {\n try {\n const result = runCommandOutput(\n `npm view ${packageName} time dist-tags --registry ${registry} --json`,\n { timeout: NPM_TIMEOUT }\n );\n\n const { time, 'dist-tags': distTags } = JSON.parse(result);\n\n const tags = Object.fromEntries(\n Object.entries(distTags).map(([tag, version]) => [version, tag])\n );\n\n return Object.keys(time).reduce((out, version) => {\n return [...out, { name: version, date: new Date(time[version]), tag: tags[version] }];\n }, []);\n } catch {\n return [];\n }\n}\n\nexport function npmGetProjectRoot() {\n return runCommandOutput('npm prefix', {\n quiet: true,\n // ignore stderr because any error here is fundamental and will be repeated elsewhere\n stdio: ['inherit', 'pipe', 'ignore'],\n timeout: NPM_TIMEOUT,\n }).trim();\n}\n\nexport async function npmUnpublish(registry: string, packageName: string, packageVersion: string) {\n await runCommand(`npm unpublish ${packageName}@${packageVersion} --registry ${registry}`, {\n timeout: NPM_TIMEOUT,\n });\n}\n\nexport async function npmPublish({ dry, tag }: { dry?: boolean; tag?: string }) {\n await runCommand(['npm publish', !!tag && `--tag ${tag}`, !!dry && `--dry-run`]);\n}\n\nexport async function npmPackageSet(key: string, value: string) {\n await runCommand(`npm pkg set ${key}=${value}`);\n}\n\nexport async function npmTagVersion({\n packageName,\n packageVersion,\n registry,\n tag,\n}: {\n packageName: string;\n packageVersion: string;\n registry?: string;\n tag: string;\n}) {\n await runCommand(\n `npm dist-tag ${\n registry ? `--registry=${registry} ` : ''\n }add ${packageName}@${packageVersion} ${tag}`\n );\n}\n\nexport async function npmRemoveTag({\n packageName,\n registry,\n tag,\n}: {\n packageName: string;\n registry?: string;\n tag: string;\n}) {\n const registryFlag = registry ? `--registry=${registry} ` : '';\n await runCommand(`npm dist-tag ${registryFlag}rm ${packageName} ${tag}`);\n}\n\nexport interface NPMPackageInfo {\n 'name': string;\n 'version': string;\n 'dist-tags'?: Record<string, string>;\n 'time'?: Record<string, string>;\n 'versions'?: string[];\n}\n\nexport function npmView({ packageName, registry }: { packageName: string; registry?: string }) {\n try {\n const result = runCommandOutput(\n ['npm', 'view', '--json', registry ? `--registry=${registry}` : '', packageName],\n { quiet: true, timeout: NPM_TIMEOUT }\n );\n if (result) {\n return JSON.parse(result) as NPMPackageInfo;\n }\n } catch {\n // ignore\n }\n}\n"],"names":["npmGetPackageVersions","npmGetPackageVersionsDetails","npmGetProjectRoot","npmPackageSet","npmPublish","npmRemoveTag","npmTagVersion","npmUnpublish","npmView","NPM_TIMEOUT","registry","packageName","v","runCommandOutput","timeout","JSON","parse","result","time","distTags","tags","Object","fromEntries","entries","map","tag","version","keys","reduce","out","name","date","Date","quiet","stdio","trim","packageVersion","runCommand","dry","key","value","registryFlag"],"mappings":";;;;;;;;;;;QAUgBA;eAAAA;;QAaAC;eAAAA;;QAqBAC;eAAAA;;QAmBMC;eAAAA;;QAJAC;eAAAA;;QA0BAC;eAAAA;;QAlBAC;eAAAA;;QAdAC;eAAAA;;QAqDNC;eAAAA;;;uBA1G6B;AAQ7C,MAAMC,cAAc;AAEb,SAAST,sBAAsBU,QAAgB,EAAEC,WAAmB;IACvE,IAAI;QACA,MAAMC,IAAIC,IAAAA,uBAAgB,EACtB,CAAC,SAAS,EAAEF,YAAY,qBAAqB,EAAED,SAAS,OAAO,CAAC,EAChE;YAAEI,SAASL;QAAY;QAG3B,OAAOM,KAAKC,KAAK,CAACJ;IACtB,EAAE,eAAM;QACJ,OAAO,EAAE;IACb;AACJ;AAEO,SAASX,6BAA6BS,QAAgB,EAAEC,WAAmB;IAC9E,IAAI;QACA,MAAMM,SAASJ,IAAAA,uBAAgB,EAC3B,CAAC,SAAS,EAAEF,YAAY,2BAA2B,EAAED,SAAS,OAAO,CAAC,EACtE;YAAEI,SAASL;QAAY;QAG3B,MAAM,EAAES,IAAI,EAAE,aAAaC,QAAQ,EAAE,GAAGJ,KAAKC,KAAK,CAACC;QAEnD,MAAMG,OAAOC,OAAOC,WAAW,CAC3BD,OAAOE,OAAO,CAACJ,UAAUK,GAAG,CAAC,CAAC,CAACC,KAAKC,QAAQ,GAAK;gBAACA;gBAASD;aAAI;QAGnE,OAAOJ,OAAOM,IAAI,CAACT,MAAMU,MAAM,CAAC,CAACC,KAAKH;YAClC,OAAO;mBAAIG;gBAAK;oBAAEC,MAAMJ;oBAASK,MAAM,IAAIC,KAAKd,IAAI,CAACQ,QAAQ;oBAAGD,KAAKL,IAAI,CAACM,QAAQ;gBAAC;aAAE;QACzF,GAAG,EAAE;IACT,EAAE,eAAM;QACJ,OAAO,EAAE;IACb;AACJ;AAEO,SAASxB;IACZ,OAAOW,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AAAA,uBAAgB,EAC3B;YAAC;YAAO;YAAQ;YAAUH,WAAW,CAAC,WAAW,EAAEA,UAAU,GAAG;YAAIC;SAAY,EAChF;YAAEsB,OAAO;YAAMnB,SAASL;QAAY;QAExC,IAAIQ,QAAQ;YACR,OAAOF,KAAKC,KAAK,CAACC;QACtB;IACJ,EAAE,eAAM;IACJ,SAAS;IACb;AACJ"}
|
|
@@ -9,8 +9,8 @@ Object.defineProperty(exports, "compileLess", {
|
|
|
9
9
|
}
|
|
10
10
|
});
|
|
11
11
|
const _fs = /*#__PURE__*/ _interop_require_default(require("fs"));
|
|
12
|
-
const _path = /*#__PURE__*/ _interop_require_default(require("path"));
|
|
13
12
|
const _less = /*#__PURE__*/ _interop_require_default(require("less"));
|
|
13
|
+
const _path = /*#__PURE__*/ _interop_require_default(require("path"));
|
|
14
14
|
function _interop_require_default(obj) {
|
|
15
15
|
return obj && obj.__esModule ? obj : {
|
|
16
16
|
default: obj
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/cli/utils/compile-less.ts"],"sourcesContent":["import fs from 'fs';\nimport
|
|
1
|
+
{"version":3,"sources":["../../../src/cli/utils/compile-less.ts"],"sourcesContent":["import fs from 'fs';\nimport less from 'less';\nimport path from 'path';\nconst lessPackageImporter = require('less-plugin-npm-import');\n\nexport async function compileLess(filePath: string) {\n const result = await less.render(fs.readFileSync(filePath, 'utf8'), {\n paths: [path.dirname(filePath)],\n math: 'always',\n plugins: [new lessPackageImporter({ prefix: '~' })],\n });\n\n return result.css;\n}\n"],"names":["compileLess","lessPackageImporter","require","filePath","result","less","render","fs","readFileSync","paths","path","dirname","math","plugins","prefix","css"],"mappings":";;;;+BAKsBA;;;eAAAA;;;2DALP;6DACE;6DACA;;;;;;AACjB,MAAMC,sBAAsBC,QAAQ;AAE7B,eAAeF,YAAYG,QAAgB;IAC9C,MAAMC,SAAS,MAAMC,aAAI,CAACC,MAAM,CAACC,WAAE,CAACC,YAAY,CAACL,UAAU,SAAS;QAChEM,OAAO;YAACC,aAAI,CAACC,OAAO,CAACR;SAAU;QAC/BS,MAAM;QACNC,SAAS;YAAC,IAAIZ,oBAAoB;gBAAEa,QAAQ;YAAI;SAAG;IACvD;IAEA,OAAOV,OAAOW,GAAG;AACrB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../src/cli/utils/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,cAAc,eAAe,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
Object.defineProperty(exports, "DRY_RUN_PREFIX", {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: function() {
|
|
8
|
+
return DRY_RUN_PREFIX;
|
|
9
|
+
}
|
|
10
|
+
});
|
|
11
|
+
const DRY_RUN_PREFIX = '(dry-run) ';
|
|
12
|
+
|
|
13
|
+
//# sourceMappingURL=constants.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/cli/utils/constants.ts"],"sourcesContent":["export const DRY_RUN_PREFIX = '(dry-run) ';\n"],"names":["DRY_RUN_PREFIX"],"mappings":";;;;+BAAaA;;;eAAAA;;;AAAN,MAAMA,iBAAiB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"copy-files.d.ts","sourceRoot":"","sources":["../../../src/cli/utils/copy-files.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"copy-files.d.ts","sourceRoot":"","sources":["../../../src/cli/utils/copy-files.ts"],"names":[],"mappings":"AAUA,eAAO,MAAM,eAAe,UAA0B,CAAC;AAGvD,eAAO,MAAM,mBAAmB,UAKxB,CAAC;AAIT,UAAU,gBAAgB;IACtB,KAAK,CAAC,EAAE,OAAO,CAAC;CACnB;AAED,wBAAsB,SAAS,CAAC,EAAE,KAAK,EAAE,EAAE,gBAAgB,iBAiD1D"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/cli/utils/copy-files.ts"],"sourcesContent":["import cpx from 'cpx2';\nimport fs from 'fs';\nimport { glob } from 'glob';\nimport DtsCreator from 'typed-css-modules';\
|
|
1
|
+
{"version":3,"sources":["../../../src/cli/utils/copy-files.ts"],"sourcesContent":["import cpx from 'cpx2';\nimport fs from 'fs';\nimport { glob } from 'glob';\nimport DtsCreator from 'typed-css-modules';\nimport { getFolders, log } from '../../utils';\nimport { compileLess } from './compile-less';\nimport { compileSass } from './compile-sass';\n\nconst assetExtensions = ['eot', 'gif', 'jpg', 'otf', 'png', 'svg', 'ttf', 'woff', 'woff2'];\nconst resourceExtensions = ['json'];\nexport const styleExtensions = ['css', 'less', 'scss'];\nconst styleTypeDefinitionExtensions = styleExtensions.map(ext => `${ext}.d.ts`);\n\nexport const supportedExtensions = [\n assetExtensions,\n resourceExtensions,\n styleExtensions,\n styleTypeDefinitionExtensions,\n].flat();\n\nconst styleModuleRegex = new RegExp(`\\\\.module\\\\.(${styleExtensions.join('|')})$`);\n\ninterface CopyFilesOptions {\n watch?: boolean;\n}\n\nexport async function copyFiles({ watch }: CopyFilesOptions) {\n const { source, destination } = getFolders();\n if (!fs.existsSync(source)) {\n return;\n }\n\n const filesPattern = `${source}/**/*.{${supportedExtensions.join()}}`;\n const creator = new DtsCreator({ camelCase: true, namedExports: true });\n const generateDefinitions = async (file: string) => {\n try {\n const css = await compile(file);\n const content = await creator.create(file, css, !!watch);\n await content.writeFile();\n } catch (error) {\n log.error(String(error));\n }\n };\n\n if (!watch) {\n const modulesPattern = `${source}/**/*.module.{${styleExtensions.join()}}`;\n log.info(`Generating types for ${modulesPattern}`);\n const modules = await glob(modulesPattern);\n await Promise.all(modules.map(generateDefinitions));\n\n log.info(`Copying ${filesPattern} -> ${destination}`);\n cpx.copySync(filesPattern, destination);\n\n return;\n }\n\n log.info(`Watching ${filesPattern} -> ${destination}`);\n cpx.watch(filesPattern, destination, {\n initialCopy: false,\n // Optimization so cpx2 doesn't waste resources watching irrelevant files\n ignore: ['__tests__', '__mocks__', '*.*', ...supportedExtensions.map(ext => `!*.${ext}`)],\n })\n .on('copy', async ({ srcPath, dstPath }: { srcPath: string; dstPath: string }) => {\n log.info(`Copied ${srcPath} -> ${dstPath}`);\n if (styleModuleRegex.test(srcPath)) {\n log.info(`Generating types for ${srcPath}`);\n await generateDefinitions(srcPath);\n }\n })\n .on('watch-error', (error: unknown) => log.error(String(error)));\n\n /* istanbul ignore next: not executed in test environment */\n if (process.env.NODE_ENV !== 'test') {\n await new Promise<void>(() => {});\n }\n}\n\nasync function compile(filePath: string) {\n if (filePath.endsWith('.less')) {\n return compileLess(filePath);\n }\n if (filePath.endsWith('.scss')) {\n return compileSass(filePath);\n }\n}\n"],"names":["copyFiles","styleExtensions","supportedExtensions","assetExtensions","resourceExtensions","styleTypeDefinitionExtensions","map","ext","flat","styleModuleRegex","RegExp","join","watch","source","destination","getFolders","fs","existsSync","filesPattern","creator","DtsCreator","camelCase","namedExports","generateDefinitions","file","css","compile","content","create","writeFile","error","log","String","modulesPattern","info","modules","glob","Promise","all","cpx","copySync","initialCopy","ignore","on","srcPath","dstPath","test","process","env","NODE_ENV","filePath","endsWith","compileLess","compileSass"],"mappings":";;;;;;;;;;;QA0BsBA;eAAAA;;QAhBTC;eAAAA;;QAGAC;eAAAA;;;6DAbG;2DACD;sBACM;wEACE;uBACS;6BACJ;6BACA;;;;;;AAE5B,MAAMC,kBAAkB;IAAC;IAAO;IAAO;IAAO;IAAO;IAAO;IAAO;IAAO;IAAQ;CAAQ;AAC1F,MAAMC,qBAAqB;IAAC;CAAO;AAC5B,MAAMH,kBAAkB;IAAC;IAAO;IAAQ;CAAO;AACtD,MAAMI,gCAAgCJ,gBAAgBK,GAAG,CAACC,CAAAA,MAAO,GAAGA,IAAI,KAAK,CAAC;AAEvE,MAAML,sBAAsB;IAC/BC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J,aAAa;QACjC2B,aAAa;QACb,yEAAyE;QACzEC,QAAQ;YAAC;YAAa;YAAa;eAAUxC,oBAAoBI,GAAG,CAACC,CAAAA,MAAO,CAAC,GAAG,EAAEA,KAAK;SAAE;IAC7F,GACKoC,EAAE,CAAC,QAAQ,OAAO,EAAEC,OAAO,EAAEC,OAAO,EAAwC;QACzEd,UAAG,CAACG,IAAI,CAAC,CAAC,OAAO,EAAEU,QAAQ,IAAI,EAAEC,SAAS;QAC1C,IAAIpC,iBAAiBqC,IAAI,CAACF,UAAU;YAChCb,UAAG,CAACG,IAAI,CAAC,CAAC,qBAAqB,EAAEU,SAAS;YAC1C,MAAMrB,oBAAoBqB;QAC9B;IACJ,GACCD,EAAE,CAAC,eAAe,CAACb,QAAmBC,UAAG,CAACD,KAAK,CAACE,OAAOF;IAE5D,0DAA0D,GAC1D,IAAIiB,QAAQC,GAAG,CAACC,QAAQ,KAAK,QAAQ;QACjC,MAAM,IAAIZ,QAAc,KAAO;IACnC;AACJ;AAEA,eAAeX,QAAQwB,QAAgB;IACnC,IAAIA,SAASC,QAAQ,CAAC,UAAU;QAC5B,OAAOC,IAAAA,wBAAW,EAACF;IACvB;IACA,IAAIA,SAASC,QAAQ,CAAC,UAAU;QAC5B,OAAOE,IAAAA,wBAAW,EAACH;IACvB;AACJ"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"eslint.d.ts","sourceRoot":"","sources":["../../../src/cli/utils/eslint.ts"],"names":[],"mappings":"AAGA,
|
|
1
|
+
{"version":3,"file":"eslint.d.ts","sourceRoot":"","sources":["../../../src/cli/utils/eslint.ts"],"names":[],"mappings":"AAGA,UAAU,IAAI;IACV,GAAG,CAAC,EAAE,OAAO,CAAC;IACd,KAAK,EAAE,MAAM,EAAE,CAAC;CACnB;AAED,wBAAsB,MAAM,CAAC,EAAE,GAAG,EAAE,KAAK,EAAE,EAAE,IAAI,iBA4ChD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/cli/utils/eslint.ts"],"sourcesContent":["import { ESLint } from 'eslint';\
|
|
1
|
+
{"version":3,"sources":["../../../src/cli/utils/eslint.ts"],"sourcesContent":["import { ESLint } from 'eslint';\nimport { getDestinationFolders, getESLintConfiguration, log } from '../../utils';\n\ninterface Args {\n fix?: boolean;\n paths: string[];\n}\n\nexport async function eslint({ fix, paths }: Args) {\n const { disabled, ...config } = getESLintConfiguration();\n\n if (disabled) {\n return;\n }\n\n const options: ESLint.Options = {\n errorOnUnmatchedPattern: false,\n ignorePatterns: [\n // **/node_modules/ is excluded by default\n '.vscode/',\n '**/.yalc/',\n '**/*.css.d.ts',\n '**/*.scss.d.ts',\n '**/*.less.d.ts',\n ...getDestinationFolders(),\n ],\n fix,\n ...config,\n };\n\n /* istanbul ignore next: debug only */\n log.debug('eslint-options', () => JSON.stringify(options, null, 2));\n\n const eslint = new ESLint(options);\n\n let files = paths;\n if (files.length === 0) {\n files = [process.cwd()];\n }\n\n const results = await eslint.lintFiles(files);\n\n if (fix) {\n await ESLint.outputFixes(results);\n }\n\n const formatter = await eslint.loadFormatter('stylish');\n process.stdout.write(formatter.format(results) as string);\n\n if (ESLint.getErrorResults(results).length) {\n process.exitCode = 1;\n }\n}\n"],"names":["eslint","fix","paths","disabled","config","getESLintConfiguration","options","errorOnUnmatchedPattern","ignorePatterns","getDestinationFolders","log","debug","JSON","stringify","ESLint","files","length","process","cwd","results","lintFiles","outputFixes","formatter","loadFormatter","stdout","write","format","getErrorResults","exitCode"],"mappings":";;;;+BAQsBA;;;eAAAA;;;wBARC;uBAC4C;AAO5D,eAAeA,OAAO,EAAEC,GAAG,EAAEC,KAAK,EAAQ;IAC7C,MAAM,EAAEC,QAAQ,EAAE,GAAGC,QAAQ,GAAGC,IAAAA,6BAAsB;IAEtD,IAAIF,UAAU;QACV;IACJ;IAEA,MAAMG,UAA0B;QAC5BC,yBAAyB;QACzBC,gBAAgB;YACZ,0CAA0C;YAC1C;YACA;YACA;YACA;YACA;eACGC,IAAAA,4BAAqB;SAC3B;QACDR;QACA,GAAGG,MAAM;IACb;IAEA,oCAAoC,GACpCM,UAAG,CAACC,KAAK,CAAC,kBAAkB,IAAMC,KAAKC,SAAS,CAACP,SAAS,MAAM;IAEhE,MAAMN,SAAS,IAAIc,cAAM,CAACR;IAE1B,IAAIS,QAAQb;IACZ,IAAIa,MAAMC,MAAM,KAAK,GAAG;QACpBD,QAAQ;YAACE,QAAQC,GAAG;SAAG;IAC3B;IAEA,MAAMC,UAAU,MAAMnB,OAAOoB,SAAS,CAACL;IAEvC,IAAId,KAAK;QACL,MAAMa,cAAM,CAACO,WAAW,CAACF;IAC7B;IAEA,MAAMG,YAAY,MAAMtB,OAAOuB,aAAa,CAAC;IAC7CN,QAAQO,MAAM,CAACC,KAAK,CAACH,UAAUI,MAAM,CAACP;IAEtC,IAAIL,cAAM,CAACa,eAAe,CAACR,SAASH,MAAM,EAAE;QACxCC,QAAQW,QAAQ,GAAG;IACvB;AACJ"}
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
export * from './bundle';
|
|
2
2
|
export * from './check-args';
|
|
3
|
+
export * from './check-startup-location';
|
|
3
4
|
export * from './cli-git';
|
|
4
5
|
export * from './cli-npm';
|
|
5
6
|
export * from './cli-os';
|
|
6
7
|
export * from './compile';
|
|
7
8
|
export * from './compile-less';
|
|
8
9
|
export * from './compile-sass';
|
|
10
|
+
export * from './constants';
|
|
9
11
|
export * from './copy-files';
|
|
10
12
|
export * from './eslint';
|
|
11
13
|
export * from './get-module-type';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/cli/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,cAAc,CAAC;AAC7B,cAAc,WAAW,CAAC;AAC1B,cAAc,WAAW,CAAC;AAC1B,cAAc,UAAU,CAAC;AACzB,cAAc,WAAW,CAAC;AAC1B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,cAAc,CAAC;AAC7B,cAAc,UAAU,CAAC;AACzB,cAAc,mBAAmB,CAAC;AAClC,cAAc,uBAAuB,CAAC;AACtC,cAAc,UAAU,CAAC;AACzB,cAAc,cAAc,CAAC;AAC7B,cAAc,2BAA2B,CAAC;AAC1C,cAAc,eAAe,CAAC;AAC9B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,WAAW,CAAC;AAC1B,cAAc,oBAAoB,CAAC;AAEnC,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC;AAC7B,cAAc,gBAAgB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/cli/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,cAAc,CAAC;AAC7B,cAAc,0BAA0B,CAAC;AACzC,cAAc,WAAW,CAAC;AAC1B,cAAc,WAAW,CAAC;AAC1B,cAAc,UAAU,CAAC;AACzB,cAAc,WAAW,CAAC;AAC1B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC;AAC7B,cAAc,UAAU,CAAC;AACzB,cAAc,mBAAmB,CAAC;AAClC,cAAc,uBAAuB,CAAC;AACtC,cAAc,UAAU,CAAC;AACzB,cAAc,cAAc,CAAC;AAC7B,cAAc,2BAA2B,CAAC;AAC1C,cAAc,eAAe,CAAC;AAC9B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,WAAW,CAAC;AAC1B,cAAc,oBAAoB,CAAC;AAEnC,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC;AAC7B,cAAc,gBAAgB,CAAC"}
|
package/dist/cli/utils/index.js
CHANGED
|
@@ -4,12 +4,14 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
});
|
|
5
5
|
_export_star(require("./bundle"), exports);
|
|
6
6
|
_export_star(require("./check-args"), exports);
|
|
7
|
+
_export_star(require("./check-startup-location"), exports);
|
|
7
8
|
_export_star(require("./cli-git"), exports);
|
|
8
9
|
_export_star(require("./cli-npm"), exports);
|
|
9
10
|
_export_star(require("./cli-os"), exports);
|
|
10
11
|
_export_star(require("./compile"), exports);
|
|
11
12
|
_export_star(require("./compile-less"), exports);
|
|
12
13
|
_export_star(require("./compile-sass"), exports);
|
|
14
|
+
_export_star(require("./constants"), exports);
|
|
13
15
|
_export_star(require("./copy-files"), exports);
|
|
14
16
|
_export_star(require("./eslint"), exports);
|
|
15
17
|
_export_star(require("./get-module-type"), exports);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/cli/utils/index.ts"],"sourcesContent":["export * from './bundle';\nexport * from './check-args';\nexport * from './cli-git';\nexport * from './cli-npm';\nexport * from './cli-os';\nexport * from './compile';\nexport * from './compile-less';\nexport * from './compile-sass';\nexport * from './copy-files';\nexport * from './eslint';\nexport * from './get-module-type';\nexport * from './is-module-installed';\nexport * from './is-tty';\nexport * from './lerna-exec';\nexport * from './maybe-create-git-folder';\nexport * from './pipe-stdout';\nexport * from './process-tree';\nexport * from './publish';\nexport * from './set-node-options';\n// Don't export ./stylelint, it breaks tests using the default \"jsdom\" environment\nexport * from './ts-config';\nexport * from './type-check';\nexport * from './watch-stdout';\n"],"names":[],"mappings":";;;;qBAAc;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA;qBAEA;qBACA;qBACA"}
|
|
1
|
+
{"version":3,"sources":["../../../src/cli/utils/index.ts"],"sourcesContent":["export * from './bundle';\nexport * from './check-args';\nexport * from './check-startup-location';\nexport * from './cli-git';\nexport * from './cli-npm';\nexport * from './cli-os';\nexport * from './compile';\nexport * from './compile-less';\nexport * from './compile-sass';\nexport * from './constants';\nexport * from './copy-files';\nexport * from './eslint';\nexport * from './get-module-type';\nexport * from './is-module-installed';\nexport * from './is-tty';\nexport * from './lerna-exec';\nexport * from './maybe-create-git-folder';\nexport * from './pipe-stdout';\nexport * from './process-tree';\nexport * from './publish';\nexport * from './set-node-options';\n// Don't export ./stylelint, it breaks tests using the default \"jsdom\" environment\nexport * from './ts-config';\nexport * from './type-check';\nexport * from './watch-stdout';\n"],"names":[],"mappings":";;;;qBAAc;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA;qBAEA;qBACA;qBACA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/cli/utils/is-module-installed.ts"],"sourcesContent":["export function isModuleInstalled(name: string): boolean {\n try {\n require.resolve(name);\n return true;\n } catch {\n return false;\n }\n}\n"],"names":["isModuleInstalled","name","require","resolve"],"mappings":";;;;+BAAgBA;;;eAAAA;;;AAAT,SAASA,kBAAkBC,IAAY;IAC1C,IAAI;QACAC,QAAQC,OAAO,CAACF;QAChB,OAAO;IACX,EAAE,
|
|
1
|
+
{"version":3,"sources":["../../../src/cli/utils/is-module-installed.ts"],"sourcesContent":["export function isModuleInstalled(name: string): boolean {\n try {\n require.resolve(name);\n return true;\n } catch {\n return false;\n }\n}\n"],"names":["isModuleInstalled","name","require","resolve"],"mappings":";;;;+BAAgBA;;;eAAAA;;;AAAT,SAASA,kBAAkBC,IAAY;IAC1C,IAAI;QACAC,QAAQC,OAAO,CAACF;QAChB,OAAO;IACX,EAAE,eAAM;QACJ,OAAO;IACX;AACJ"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lerna-exec.d.ts","sourceRoot":"","sources":["../../../src/cli/utils/lerna-exec.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"lerna-exec.d.ts","sourceRoot":"","sources":["../../../src/cli/utils/lerna-exec.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AAK3C,UAAU,IAAI;IACV,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IACnB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,UAAU,CAAC,EAAE,OAAO,GAAG,MAAM,CAAC;IAC9B,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,GAAG,QAAQ,GAAG,SAAS,GAAG,SAAS,WAAW,EAAE,CAAC;CACpE;AAED,wBAAgB,SAAS,CAAC,IAAI,EAAE,IAAI,mCAkBnC"}
|
|
@@ -19,8 +19,8 @@ function _interop_require_default(obj) {
|
|
|
19
19
|
};
|
|
20
20
|
}
|
|
21
21
|
function lernaExec(args) {
|
|
22
|
+
var _args_, _args_1, _args_stdio;
|
|
22
23
|
(0, _maybecreategitfolder.maybeCreateGitFolder)();
|
|
23
|
-
var _args_;
|
|
24
24
|
const lernaArguments = [
|
|
25
25
|
'exec',
|
|
26
26
|
...getOptions(args),
|
|
@@ -28,12 +28,10 @@ function lernaExec(args) {
|
|
|
28
28
|
...args.cmd.split(' '),
|
|
29
29
|
...((_args_ = args['--']) !== null && _args_ !== void 0 ? _args_ : []).flatMap((arg)=>arg.split(' '))
|
|
30
30
|
];
|
|
31
|
-
var _args_1;
|
|
32
31
|
_utils.log.info(`Running ${[
|
|
33
32
|
args.cmd,
|
|
34
33
|
...(_args_1 = args['--']) !== null && _args_1 !== void 0 ? _args_1 : []
|
|
35
34
|
].join(' ')}`);
|
|
36
|
-
var _args_stdio;
|
|
37
35
|
return (0, _execa.default)('lerna', lernaArguments, {
|
|
38
36
|
stdio: (_args_stdio = args.stdio) !== null && _args_stdio !== void 0 ? _args_stdio : 'inherit',
|
|
39
37
|
env: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/cli/utils/lerna-exec.ts"],"sourcesContent":["import { isCI } from '@servicetitan/install';\nimport execa, { StdioOption } from 'execa';\nimport os from 'node:os';\
|
|
1
|
+
{"version":3,"sources":["../../../src/cli/utils/lerna-exec.ts"],"sourcesContent":["import { isCI } from '@servicetitan/install';\nimport execa, { StdioOption } from 'execa';\nimport os from 'node:os';\nimport { log } from '../../utils';\nimport { maybeCreateGitFolder } from './maybe-create-git-folder';\n\ninterface Args {\n 'bail'?: boolean;\n 'cmd': string;\n 'scope'?: string[];\n 'stream'?: boolean;\n 'parallel'?: boolean | number;\n '--'?: string[];\n 'stdio'?: 'pipe' | 'ignore' | 'inherit' | readonly StdioOption[];\n}\n\nexport function lernaExec(args: Args) {\n maybeCreateGitFolder();\n\n const lernaArguments = [\n 'exec',\n ...getOptions(args),\n '--',\n ...args.cmd.split(' '),\n ...(args['--'] ?? []).flatMap(arg => arg.split(' ')),\n ];\n log.info(`Running ${[args.cmd, ...(args['--'] ?? [])].join(' ')}`);\n return execa('lerna', lernaArguments, {\n stdio: args.stdio ?? 'inherit',\n env: {\n // eslint-disable-next-line @typescript-eslint/naming-convention\n FORCE_COLOR: 'true',\n },\n });\n}\n\nfunction getOptions(args: Args) {\n const result = (args.scope ?? []).map(name => `--scope=${name}`);\n if (args.bail === false) {\n result.push('--no-bail');\n }\n if (args.parallel === true) {\n result.push(isCI() ? `--concurrency=${os.availableParallelism()}` : '--parallel');\n } else if (typeof args.parallel === 'number') {\n result.push(`--concurrency=${args.parallel}`);\n }\n if (args.stream) {\n result.push('--stream');\n }\n return result;\n}\n"],"names":["lernaExec","args","maybeCreateGitFolder","lernaArguments","getOptions","cmd","split","flatMap","arg","log","info","join","execa","stdio","env","FORCE_COLOR","result","scope","map","name","bail","push","parallel","isCI","os","availableParallelism","stream"],"mappings":";;;;+BAgBgBA;;;eAAAA;;;yBAhBK;8DACc;+DACpB;uBACK;sCACiB;;;;;;AAY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
|
-
{"version":3,"sources":["../../../src/cli/utils/process-tree.ts"],"sourcesContent":["interface HandlerResultObject {\n process: Promise<unknown>;\n onComplete?: Promise<unknown>;\n}\n\nexport type HandlerResult = HandlerResultObject | Promise<unknown>;\n\nfunction isHandlerResultObject(result: HandlerResult): result is HandlerResultObject {\n return 'process' in result;\n}\n\nexport class ProcessTree<T extends Record<any, any> = never> {\n readonly #entries: Map<\n T,\n {\n handler: () => HandlerResult;\n dependsOn: T[keyof T][];\n process?: Promise<unknown>;\n onComplete?: Promise<unknown>;\n }\n > = new Map();\n\n add(\n name: T[keyof T],\n handler: () => HandlerResult,\n {\n dependsOn = [],\n }: {\n dependsOn?: T[keyof T][];\n } = {}\n ) {\n dependsOn.forEach(item => {\n if (!this.#entries.has(item)) {\n throw new Error(`Unknown process dependency: ${item}`);\n }\n });\n this.#entries.set(name, { handler, dependsOn });\n }\n\n run() {\n [...this.#entries.keys()].forEach(item => {\n const entry = this.#entries.get(item)!;\n\n const handlerResult = Promise.all(\n entry.dependsOn.map(item => this.#entries.get(item)!.onComplete).filter(el => !!el)\n ).then(() => ({ result: entry.handler() }));\n\n entry.process = handlerResult.then(({ result }) =>\n isHandlerResultObject(result) ? result.process : result\n );\n entry.onComplete = handlerResult.then(({ result }) =>\n isHandlerResultObject(result) ? (result.onComplete ?? result.process) : result\n );\n });\n return Promise.all(\n [...this.#entries.values()].map(item => item.process).filter(el => !!el)\n );\n }\n}\n"],"names":["ProcessTree","isHandlerResultObject","result","add","name","handler","dependsOn","forEach","item","has","Error","set","run","keys","entry","get","handlerResult","Promise","all","map","onComplete","filter","el","then","process","values","Map"],"mappings":";;;;+BAWaA;;;eAAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAJb,SAASC,sBAAsBC,MAAqB;IAChD,OAAO,aAAaA;AACxB;IAGa;AADN,MAAMF;IAWTG,IACIC,IAAgB,EAChBC,OAA4B,EAC5B,EACIC,YAAY,EAAE,EAGjB,GAAG,CAAC,CAAC,EACR;QACEA,UAAUC,OAAO,CAACC,CAAAA;YACd,IAAI,CAAC,yBAAA,IAAI,EAAC,UAASC,GAAG,CAACD,OAAO;gBAC1B,MAAM,IAAIE,MAAM,CAAC,4BAA4B,EAAEF,MAAM;YACzD;QACJ;QACA,yBAAA,IAAI,EAAC,UAASG,GAAG,CAACP,MAAM;YAAEC;YAASC;QAAU;IACjD;IAEAM,MAAM;QACF;eAAI,yBAAA,IAAI,EAAC,UAASC,IAAI;SAAG,CAACN,OAAO,CAACC,CAAAA;YAC9B,MAAMM,QAAQ,yBAAA,IAAI,EAAC,UAASC,GAAG,CAACP;YAEhC,MAAMQ,gBAAgBC,QAAQC,GAAG,CAC7BJ,MAAMR,SAAS,CAACa,GAAG,CAACX,CAAAA,OAAQ,yBAAA,IAAI,EAAC,UAASO,GAAG,CAACP,MAAOY,UAAU,EAAEC,MAAM,CAACC,CAAAA,KAAM,CAAC,CAACA,KAClFC,IAAI,CAAC,IAAO,CAAA;oBAAErB,QAAQY,MAAMT,OAAO;gBAAG,CAAA;YAExCS,MAAMU,OAAO,GAAGR,cAAcO,IAAI,CAAC,CAAC,EAAErB,MAAM,EAAE,GAC1CD,sBAAsBC,UAAUA,OAAOsB,OAAO,GAAGtB;YAErDY,MAAMM,UAAU,GAAGJ,cAAcO,IAAI,CAAC,CAAC,EAAErB,MAAM,EAAE;oBACZA;uBAAjCD,sBAAsBC,
|
|
1
|
+
{"version":3,"sources":["../../../src/cli/utils/process-tree.ts"],"sourcesContent":["interface HandlerResultObject {\n process: Promise<unknown>;\n onComplete?: Promise<unknown>;\n}\n\nexport type HandlerResult = HandlerResultObject | Promise<unknown>;\n\nfunction isHandlerResultObject(result: HandlerResult): result is HandlerResultObject {\n return 'process' in result;\n}\n\nexport class ProcessTree<T extends Record<any, any> = never> {\n readonly #entries: Map<\n T,\n {\n handler: () => HandlerResult;\n dependsOn: T[keyof T][];\n process?: Promise<unknown>;\n onComplete?: Promise<unknown>;\n }\n > = new Map();\n\n add(\n name: T[keyof T],\n handler: () => HandlerResult,\n {\n dependsOn = [],\n }: {\n dependsOn?: T[keyof T][];\n } = {}\n ) {\n dependsOn.forEach(item => {\n if (!this.#entries.has(item)) {\n throw new Error(`Unknown process dependency: ${item}`);\n }\n });\n this.#entries.set(name, { handler, dependsOn });\n }\n\n run() {\n [...this.#entries.keys()].forEach(item => {\n const entry = this.#entries.get(item)!;\n\n const handlerResult = Promise.all(\n entry.dependsOn.map(item => this.#entries.get(item)!.onComplete).filter(el => !!el)\n ).then(() => ({ result: entry.handler() }));\n\n entry.process = handlerResult.then(({ result }) =>\n isHandlerResultObject(result) ? result.process : result\n );\n entry.onComplete = handlerResult.then(({ result }) =>\n isHandlerResultObject(result) ? (result.onComplete ?? result.process) : result\n );\n });\n return Promise.all(\n [...this.#entries.values()].map(item => item.process).filter(el => !!el)\n );\n }\n}\n"],"names":["ProcessTree","isHandlerResultObject","result","add","name","handler","dependsOn","forEach","item","has","Error","set","run","keys","entry","get","handlerResult","Promise","all","map","onComplete","filter","el","then","process","values","Map"],"mappings":";;;;+BAWaA;;;eAAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAJb,SAASC,sBAAsBC,MAAqB;IAChD,OAAO,aAAaA;AACxB;IAGa;AADN,MAAMF;IAWTG,IACIC,IAAgB,EAChBC,OAA4B,EAC5B,EACIC,YAAY,EAAE,EAGjB,GAAG,CAAC,CAAC,EACR;QACEA,UAAUC,OAAO,CAACC,CAAAA;YACd,IAAI,CAAC,yBAAA,IAAI,EAAC,UAASC,GAAG,CAACD,OAAO;gBAC1B,MAAM,IAAIE,MAAM,CAAC,4BAA4B,EAAEF,MAAM;YACzD;QACJ;QACA,yBAAA,IAAI,EAAC,UAASG,GAAG,CAACP,MAAM;YAAEC;YAASC;QAAU;IACjD;IAEAM,MAAM;QACF;eAAI,yBAAA,IAAI,EAAC,UAASC,IAAI;SAAG,CAACN,OAAO,CAACC,CAAAA;YAC9B,MAAMM,QAAQ,yBAAA,IAAI,EAAC,UAASC,GAAG,CAACP;YAEhC,MAAMQ,gBAAgBC,QAAQC,GAAG,CAC7BJ,MAAMR,SAAS,CAACa,GAAG,CAACX,CAAAA,OAAQ,yBAAA,IAAI,EAAC,UAASO,GAAG,CAACP,MAAOY,UAAU,EAAEC,MAAM,CAACC,CAAAA,KAAM,CAAC,CAACA,KAClFC,IAAI,CAAC,IAAO,CAAA;oBAAErB,QAAQY,MAAMT,OAAO;gBAAG,CAAA;YAExCS,MAAMU,OAAO,GAAGR,cAAcO,IAAI,CAAC,CAAC,EAAErB,MAAM,EAAE,GAC1CD,sBAAsBC,UAAUA,OAAOsB,OAAO,GAAGtB;YAErDY,MAAMM,UAAU,GAAGJ,cAAcO,IAAI,CAAC,CAAC,EAAErB,MAAM,EAAE;oBACZA;uBAAjCD,sBAAsBC,WAAWA,qBAAAA,OAAOkB,UAAU,cAAjBlB,gCAAAA,qBAAqBA,OAAOsB,OAAO,GAAItB;;QAEhF;QACA,OAAOe,QAAQC,GAAG,CACd;eAAI,yBAAA,IAAI,EAAC,UAASO,MAAM;SAAG,CAACN,GAAG,CAACX,CAAAA,OAAQA,KAAKgB,OAAO,EAAEH,MAAM,CAACC,CAAAA,KAAM,CAAC,CAACA;IAE7E;;QA7CA,gCAAS;;mBAQL,IAAII;;;AAsCZ"}
|
|
@@ -19,13 +19,11 @@ const MAX_OLD_SPACE_SIZE_OPTION = 'max_old_space_size';
|
|
|
19
19
|
const DEFAULT_MAX_OLD_SPACE_SIZE_MB = 8192;
|
|
20
20
|
const MIN_REMAINING_MEMORY_MB = 512;
|
|
21
21
|
function setNodeOptions(commandName, command) {
|
|
22
|
+
var _cliConfig_NODE_OPTIONS, _ref, _process_env_NODE_OPTIONS;
|
|
22
23
|
const cliConfig = (0, _utils.getConfigurationSafe)();
|
|
23
24
|
const cmdConfig = cliConfig[commandName];
|
|
24
|
-
var _cliConfig_NODE_OPTIONS;
|
|
25
25
|
const cliNodeOptions = (_cliConfig_NODE_OPTIONS = cliConfig.NODE_OPTIONS) !== null && _cliConfig_NODE_OPTIONS !== void 0 ? _cliConfig_NODE_OPTIONS : [];
|
|
26
|
-
|
|
27
|
-
const cmdNodeOptions = (_cmdConfig_NODE_OPTIONS = cmdConfig === null || cmdConfig === void 0 ? void 0 : cmdConfig.NODE_OPTIONS) !== null && _cmdConfig_NODE_OPTIONS !== void 0 ? _cmdConfig_NODE_OPTIONS : [];
|
|
28
|
-
var _process_env_NODE_OPTIONS;
|
|
26
|
+
const cmdNodeOptions = (_ref = cmdConfig === null || cmdConfig === void 0 ? void 0 : cmdConfig.NODE_OPTIONS) !== null && _ref !== void 0 ? _ref : [];
|
|
29
27
|
const oldNodeOptions = (_process_env_NODE_OPTIONS = process.env.NODE_OPTIONS) !== null && _process_env_NODE_OPTIONS !== void 0 ? _process_env_NODE_OPTIONS : '';
|
|
30
28
|
const mergedOptions = [
|
|
31
29
|
...cmdNodeOptions,
|