@servicetitan/startup 33.1.0 → 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,"sources":["../../../../../src/cli/commands/review/rules/require-compatible-launch-darkly-sdk.ts"],"sourcesContent":["import chalk from 'chalk';\nimport { execSync } from 'child_process';\nimport { satisfies } from 'semver';\nimport { FixCategory, Package, PackageError, PackageRule, Project } from '../types';\nimport { applyFilter, checkPackages, setVersion } from '../utils';\n\nconst JS_CLIENT_SDK = 'launchdarkly-js-client-sdk';\nconst LD_SERVICE = '@servicetitan/launchdarkly-service';\n\ninterface ErrorData {\n name?: string;\n actualVersion: string;\n targetVersion: string;\n}\n\ntype RuleError = PackageError<ErrorData>;\n\nexport class RequireCompatibleLaunchDarklySdk implements PackageRule {\n #project!: Project;\n\n get id() {\n return 'require-compatible-launch-darkly-sdk';\n }\n\n run(project: Project): RuleError | RuleError[] | undefined {\n this.#project = project;\n\n /*\n * Pass an empty filter object to checkPackages to disable its filtering.\n * The project-level check is only useful when there are no package-level\n * errors so we need an accurate count.\n */\n const errors = checkPackages({}, project, this.checkPackage);\n\n if (!errors.length) {\n return this.checkProject();\n }\n\n return applyFilter(project.config.rules?.[this.id], errors, ({ data }) => data!.name!);\n }\n\n fix({ data }: RuleError, project: Project) {\n const { name, targetVersion } = data ?? {};\n if (!targetVersion) {\n return;\n }\n if (name) {\n setVersion({\n project,\n packageName: name,\n dependency: JS_CLIENT_SDK,\n version: targetVersion,\n });\n return;\n }\n\n [\n `npm pkg set dependencies[\"${JS_CLIENT_SDK}\"]=${targetVersion}`,\n 'npx
|
|
1
|
+
{"version":3,"sources":["../../../../../src/cli/commands/review/rules/require-compatible-launch-darkly-sdk.ts"],"sourcesContent":["import chalk from 'chalk';\nimport { execSync } from 'child_process';\nimport { satisfies } from 'semver';\nimport { FixCategory, Package, PackageError, PackageRule, Project } from '../types';\nimport { applyFilter, checkPackages, setVersion } from '../utils';\n\nconst JS_CLIENT_SDK = 'launchdarkly-js-client-sdk';\nconst LD_SERVICE = '@servicetitan/launchdarkly-service';\n\ninterface ErrorData {\n name?: string;\n actualVersion: string;\n targetVersion: string;\n}\n\ntype RuleError = PackageError<ErrorData>;\n\nexport class RequireCompatibleLaunchDarklySdk implements PackageRule {\n #project!: Project;\n\n get id() {\n return 'require-compatible-launch-darkly-sdk';\n }\n\n run(project: Project): RuleError | RuleError[] | undefined {\n this.#project = project;\n\n /*\n * Pass an empty filter object to checkPackages to disable its filtering.\n * The project-level check is only useful when there are no package-level\n * errors so we need an accurate count.\n */\n const errors = checkPackages({}, project, this.checkPackage);\n\n if (!errors.length) {\n return this.checkProject();\n }\n\n return applyFilter(project.config.rules?.[this.id], errors, ({ data }) => data!.name!);\n }\n\n fix({ data }: RuleError, project: Project) {\n const { name, targetVersion } = data ?? {};\n if (!targetVersion) {\n return;\n }\n if (name) {\n setVersion({\n project,\n packageName: name,\n dependency: JS_CLIENT_SDK,\n version: targetVersion,\n });\n return;\n }\n\n [\n `npm pkg set dependencies[\"${JS_CLIENT_SDK}\"]=${targetVersion}`,\n 'npx @servicetitan/install --fix --quiet',\n `npm pkg delete dependencies[\"${JS_CLIENT_SDK}\"]`,\n ].forEach(command => execSync(command, { stdio: 'inherit' }));\n }\n\n private readonly checkPackage = ({\n dependencies = {},\n location,\n name,\n }: Package): RuleError | undefined => {\n if (!dependencies[JS_CLIENT_SDK]) {\n return;\n }\n\n const actualVersion = this.getActualJsClientSdkVersion(name);\n const targetVersion = this.getTargetJsClientSdkVersion(name);\n if (actualVersion && targetVersion && !satisfies(actualVersion, targetVersion)) {\n return this.createError({\n message: `package \"${name}\" depends on an incompatible version of ${JS_CLIENT_SDK}`,\n location,\n data: { name, actualVersion, targetVersion },\n });\n }\n };\n\n private checkProject() {\n const actualVersion = this.getActualJsClientSdkVersion();\n const targetVersion = this.getTargetJsClientSdkVersion();\n if (actualVersion && targetVersion && !satisfies(actualVersion, targetVersion)) {\n return this.createError({\n message: `project depends on an incompatible version of ${JS_CLIENT_SDK}`,\n location: this.#project.packageLock.location,\n data: { actualVersion, targetVersion },\n });\n }\n }\n\n private createError(params: { message: string; location: string; data: ErrorData }): RuleError {\n const { message, data, location } = params;\n return {\n id: this.id,\n message,\n details: this.formatDetails(data),\n location,\n fixable: data.name ? FixCategory.isolated : FixCategory.lockFile,\n data,\n };\n }\n\n private formatDetails({ actualVersion, targetVersion }: ErrorData) {\n return `${chalk.yellow(actualVersion)} does not match ${targetVersion}`;\n }\n\n private getActualJsClientSdkVersion(packageName?: string) {\n return this.getResolvedDependency({ packageName, dependency: JS_CLIENT_SDK }).version;\n }\n\n private getResolvedDependency({\n packageName,\n dependency,\n }: {\n packageName?: string;\n dependency: string;\n }) {\n const { packages } = this.#project.packageLock;\n return (\n (packageName\n ? packages[`node_modules/${packageName}/node_modules/${dependency}`]\n : undefined) ??\n packages[`node_modules/${dependency}`] ??\n {}\n );\n }\n\n private getTargetJsClientSdkVersion(packageName?: string) {\n const { dependencies = {}, peerDependencies = {} } = this.getResolvedDependency({\n packageName,\n dependency: LD_SERVICE,\n });\n\n return dependencies[JS_CLIENT_SDK] ?? peerDependencies[JS_CLIENT_SDK];\n }\n}\n"],"names":["RequireCompatibleLaunchDarklySdk","JS_CLIENT_SDK","LD_SERVICE","id","run","project","errors","checkPackages","checkPackage","length","checkProject","applyFilter","config","rules","data","name","fix","targetVersion","setVersion","packageName","dependency","version","forEach","command","execSync","stdio","actualVersion","getActualJsClientSdkVersion","getTargetJsClientSdkVersion","satisfies","createError","message","location","packageLock","params","details","formatDetails","fixable","FixCategory","isolated","lockFile","chalk","yellow","getResolvedDependency","packages","undefined","dependencies","peerDependencies"],"mappings":";;;;+BAiBaA;;;eAAAA;;;8DAjBK;+BACO;wBACC;uBAC+C;uBAClB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEvD,MAAMC,gBAAgB;AACtB,MAAMC,aAAa;IAWf;AADG,MAAMF;IAGT,IAAIG,KAAK;QACL,OAAO;IACX;IAEAC,IAAIC,OAAgB,EAAuC;YAcpCA;uCAbd,UAAWA;QAEhB;;;;SAIC,GACD,MAAMC,SAASC,IAAAA,oBAAa,EAAC,CAAC,GAAGF,SAAS,IAAI,CAACG,YAAY;QAE3D,IAAI,CAACF,OAAOG,MAAM,EAAE;YAChB,OAAO,IA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,2BAA2B,CAACZ;YACvD,MAAME,gBAAgB,IAAI,CAACW,2BAA2B,CAACb;YACvD,IAAIW,iBAAiBT,iBAAiB,CAACY,IAAAA,iBAAS,EAACH,eAAeT,gBAAgB;gBAC5E,OAAO,IAAI,CAACa,WAAW,CAAC;oBACpBC,SAAS,CAAC,SAAS,EAAEhB,KAAK,wCAAwC,EAAEd,eAAe;oBACnF+B;oBACAlB,MAAM;wBAAEC;wBAAMW;wBAAeT;oBAAc;gBAC/C;YACJ;QACJ;;AA2DJ"}
|
|
@@ -77,8 +77,7 @@ class RequireOneCollectionVersion {
|
|
|
77
77
|
return this.sortVersions(this.collection.packages.reduce((result, name)=>{
|
|
78
78
|
var _dependencies_name;
|
|
79
79
|
Object.entries((_dependencies_name = dependencies[name]) !== null && _dependencies_name !== void 0 ? _dependencies_name : {}).forEach(([version, dependents])=>{
|
|
80
|
-
var _result, _version;
|
|
81
|
-
var _;
|
|
80
|
+
var _result, _version, _;
|
|
82
81
|
(_ = (_result = result)[_version = version]) !== null && _ !== void 0 ? _ : _result[_version] = {};
|
|
83
82
|
result[version][name] = dependents;
|
|
84
83
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../src/cli/commands/review/rules/require-one-collection-version.ts"],"sourcesContent":["import chalk from 'chalk';\nimport { log } from '../../../../utils';\nimport { FixCategory, Package, PackageError, PackageRule, Project } from '../types';\nimport { applyFilter, compareVersion, formatDependsOn, nameToLocation, setVersion } from '../utils';\n\nexport interface Collection {\n name: string;\n packages: string[];\n}\n\n/**\n * Maps version number to packages with that version and their dependents.\n */\ninterface Versions {\n [version: string]: {\n [packageName: string]: string[];\n };\n}\n\ninterface ErrorData {\n targetVersion: string;\n otherVersions: Versions;\n}\n\ninterface ErrorDetail {\n dependents: string[];\n extra: boolean;\n packageName: string;\n}\n\nexport class RequireOneCollectionVersion implements PackageRule {\n constructor(private readonly collection: Collection) {}\n\n get id() {\n return `require-one-${this.collection.name}-version`;\n }\n\n run(project: Project): PackageError<ErrorData> | undefined {\n const versions = this.collateVersions(project);\n\n /* istanbul ignore next: debug only */\n log.debug(`review:${this.collection.name}-versions`, () =>\n JSON.stringify(versions, null, 2)\n );\n\n const keys = Object.keys(versions);\n if (keys.length <= 1) {\n return;\n }\n\n const message = `project depends on multiple versions of ${this.collection.name} packages`;\n const details = this.composeDetails(project, versions);\n const targetVersion = keys[0];\n const otherVersions = Object.fromEntries(Object.entries(versions).slice(1));\n return {\n id: this.id,\n message,\n details,\n fixable: FixCategory.normal,\n data: { targetVersion, otherVersions },\n };\n }\n\n fix({ data }: PackageError<ErrorData>, project: Project) {\n const { targetVersion, otherVersions } = data ?? {};\n if (!(targetVersion && otherVersions)) {\n return;\n }\n\n Object.values(otherVersions).forEach(packages => {\n Object.entries(packages).forEach(([name, dependents]) => {\n dependents.forEach(dependent =>\n setVersion({\n project,\n packageName: dependent,\n dependency: name,\n version: targetVersion,\n })\n );\n });\n });\n }\n\n private collateVersions(project: Project) {\n const dependencies = this.getDependencies(project);\n return this.sortVersions(\n this.collection.packages.reduce<Versions>((result, name) => {\n Object.entries(dependencies[name] ?? {}).forEach(([version, dependents]) => {\n result[version] ??= {};\n result[version][name] = dependents;\n });\n return result;\n }, {})\n );\n }\n\n private composeDetails({ packages }: Project, versions: Versions) {\n const extra = this.getExtra(versions);\n return this.sortDetails(this.getDetails(packages, versions, extra)).map(detail =>\n this.formatDetail(detail)\n );\n }\n\n private formatDetail({ dependents, packageName, extra }: ErrorDetail) {\n return formatDependsOn(dependents, chalk[extra ? 'red' : 'yellow'](packageName));\n }\n\n private getDependencies({ config, dependencies }: Project) {\n const ruleConfig = config.rules?.[this.id];\n return Object.fromEntries(\n applyFilter(ruleConfig, Object.entries(dependencies), ([name]) => name)\n ) as Project['dependencies'];\n }\n\n private getDetails(packages: Package[], versions: Versions, extra: Set<string>) {\n return Object.entries(versions).reduce((result, [version, dependencies]) => {\n Object.entries(dependencies).forEach(([pkg, dependents]) => {\n result.push({\n packageName: `${pkg}@${version}`,\n dependents: dependents.map(name => nameToLocation(name, packages)),\n extra: extra.has(pkg),\n });\n });\n return result;\n }, [] as ErrorDetail[]);\n }\n\n /**\n * Assumes first version is the most common and the other ones are extra (see sortVersions)\n */\n private getExtra(versions: Versions): Set<string> {\n return new Set(\n Object.entries(versions)\n .slice(1)\n .flatMap(([_version, dependencies]) => Object.keys(dependencies))\n );\n }\n\n /**\n * Orders details so that extraneous packages are at the top\n */\n private sortDetails(details: ErrorDetail[]) {\n return details.sort((a, b) => {\n if (a.extra === b.extra) {\n return 0;\n }\n return a.extra === true ? -1 : 1;\n });\n }\n\n /**\n * Orders versions in descending order by the number of packages using the version\n * and then by version number. I.e., It puts most common version at the top and if\n * multiple versions tie for the top position, it puts the highest version first.\n */\n private sortVersions(versions: Versions): Versions {\n return Object.fromEntries(\n Object.entries(versions)\n .sort(\n ([v1, depsV1], [v2, depsV2]) =>\n Object.keys(depsV1).length - Object.keys(depsV2).length ||\n compareVersion(v1, v2)\n )\n .reverse()\n );\n }\n}\n"],"names":["RequireOneCollectionVersion","id","collection","name","run","project","versions","collateVersions","log","debug","JSON","stringify","keys","Object","length","message","details","composeDetails","targetVersion","otherVersions","fromEntries","entries","slice","fixable","FixCategory","normal","data","fix","values","forEach","packages","dependents","dependent","setVersion","packageName","dependency","version","dependencies","getDependencies","sortVersions","reduce","result","extra","getExtra","sortDetails","getDetails","map","detail","formatDetail","formatDependsOn","chalk","config","ruleConfig","rules","applyFilter","pkg","push","nameToLocation","has","Set","flatMap","_version","sort","a","b","v1","depsV1","v2","depsV2","compareVersion","reverse"],"mappings":";;;;+BA8BaA;;;eAAAA;;;8DA9BK;uBACE;uBACqD;wBACgB;;;;;;;;;;;;;;;;;;;AA2BlF,MAAMA;IAGT,IAAIC,KAAK;QACL,OAAO,CAAC,YAAY,EAAE,IAAI,CAACC,UAAU,CAACC,IAAI,CAAC,QAAQ,CAAC;IACxD;IAEAC,IAAIC,OAAgB,EAAuC;QACvD,MAAMC,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ection-version.ts"],"sourcesContent":["import chalk from 'chalk';\nimport { log } from '../../../../utils';\nimport { FixCategory, Package, PackageError, PackageRule, Project } from '../types';\nimport { applyFilter, compareVersion, formatDependsOn, nameToLocation, setVersion } from '../utils';\n\nexport interface Collection {\n name: string;\n packages: string[];\n}\n\n/**\n * Maps version number to packages with that version and their dependents.\n */\ninterface Versions {\n [version: string]: {\n [packageName: string]: string[];\n };\n}\n\ninterface ErrorData {\n targetVersion: string;\n otherVersions: Versions;\n}\n\ninterface ErrorDetail {\n dependents: string[];\n extra: boolean;\n packageName: string;\n}\n\nexport class RequireOneCollectionVersion implements PackageRule {\n constructor(private readonly collection: Collection) {}\n\n get id() {\n return `require-one-${this.collection.name}-version`;\n }\n\n run(project: Project): PackageError<ErrorData> | undefined {\n const versions = this.collateVersions(project);\n\n /* istanbul ignore next: debug only */\n log.debug(`review:${this.collection.name}-versions`, () =>\n JSON.stringify(versions, null, 2)\n );\n\n const keys = Object.keys(versions);\n if (keys.length <= 1) {\n return;\n }\n\n const message = `project depends on multiple versions of ${this.collection.name} packages`;\n const details = this.composeDetails(project, versions);\n const targetVersion = keys[0];\n const otherVersions = Object.fromEntries(Object.entries(versions).slice(1));\n return {\n id: this.id,\n message,\n details,\n fixable: FixCategory.normal,\n data: { targetVersion, otherVersions },\n };\n }\n\n fix({ data }: PackageError<ErrorData>, project: Project) {\n const { targetVersion, otherVersions } = data ?? {};\n if (!(targetVersion && otherVersions)) {\n return;\n }\n\n Object.values(otherVersions).forEach(packages => {\n Object.entries(packages).forEach(([name, dependents]) => {\n dependents.forEach(dependent =>\n setVersion({\n project,\n packageName: dependent,\n dependency: name,\n version: targetVersion,\n })\n );\n });\n });\n }\n\n private collateVersions(project: Project) {\n const dependencies = this.getDependencies(project);\n return this.sortVersions(\n this.collection.packages.reduce<Versions>((result, name) => {\n Object.entries(dependencies[name] ?? {}).forEach(([version, dependents]) => {\n result[version] ??= {};\n result[version][name] = dependents;\n });\n return result;\n }, {})\n );\n }\n\n private composeDetails({ packages }: Project, versions: Versions) {\n const extra = this.getExtra(versions);\n return this.sortDetails(this.getDetails(packages, versions, extra)).map(detail =>\n this.formatDetail(detail)\n );\n }\n\n private formatDetail({ dependents, packageName, extra }: ErrorDetail) {\n return formatDependsOn(dependents, chalk[extra ? 'red' : 'yellow'](packageName));\n }\n\n private getDependencies({ config, dependencies }: Project) {\n const ruleConfig = config.rules?.[this.id];\n return Object.fromEntries(\n applyFilter(ruleConfig, Object.entries(dependencies), ([name]) => name)\n ) as Project['dependencies'];\n }\n\n private getDetails(packages: Package[], versions: Versions, extra: Set<string>) {\n return Object.entries(versions).reduce((result, [version, dependencies]) => {\n Object.entries(dependencies).forEach(([pkg, dependents]) => {\n result.push({\n packageName: `${pkg}@${version}`,\n dependents: dependents.map(name => nameToLocation(name, packages)),\n extra: extra.has(pkg),\n });\n });\n return result;\n }, [] as ErrorDetail[]);\n }\n\n /**\n * Assumes first version is the most common and the other ones are extra (see sortVersions)\n */\n private getExtra(versions: Versions): Set<string> {\n return new Set(\n Object.entries(versions)\n .slice(1)\n .flatMap(([_version, dependencies]) => Object.keys(dependencies))\n );\n }\n\n /**\n * Orders details so that extraneous packages are at the top\n */\n private sortDetails(details: ErrorDetail[]) {\n return details.sort((a, b) => {\n if (a.extra === b.extra) {\n return 0;\n }\n return a.extra === true ? -1 : 1;\n });\n }\n\n /**\n * Orders versions in descending order by the number of packages using the version\n * and then by version number. I.e., It puts most common version at the top and if\n * multiple versions tie for the top position, it puts the highest version first.\n */\n private sortVersions(versions: Versions): Versions {\n return Object.fromEntries(\n Object.entries(versions)\n .sort(\n ([v1, depsV1], [v2, depsV2]) =>\n Object.keys(depsV1).length - Object.keys(depsV2).length ||\n compareVersion(v1, v2)\n )\n .reverse()\n );\n }\n}\n"],"names":["RequireOneCollectionVersion","id","collection","name","run","project","versions","collateVersions","log","debug","JSON","stringify","keys","Object","length","message","details","composeDetails","targetVersion","otherVersions","fromEntries","entries","slice","fixable","FixCategory","normal","data","fix","values","forEach","packages","dependents","dependent","setVersion","packageName","dependency","version","dependencies","getDependencies","sortVersions","reduce","result","extra","getExtra","sortDetails","getDetails","map","detail","formatDetail","formatDependsOn","chalk","config","ruleConfig","rules","applyFilter","pkg","push","nameToLocation","has","Set","flatMap","_version","sort","a","b","v1","depsV1","v2","depsV2","compareVersion","reverse"],"mappings":";;;;+BA8BaA;;;eAAAA;;;8DA9BK;uBACE;uBACqD;wBACgB;;;;;;;;;;;;;;;;;;;AA2BlF,MAAMA;IAGT,IAAIC,KAAK;QACL,OAAO,CAAC,YAAY,EAAE,IAAI,CAACC,UAAU,CAACC,IAAI,CAAC,QAAQ,CAAC;IACxD;IAEAC,IAAIC,OAAgB,EAAuC;QACvD,MAAMC,WAAW,IAAI,CAACC,eAAe,CAACF;QAEtC,oCAAoC,GACpCG,UAAG,CAACC,KAAK,CAAC,CAAC,OAAO,EAAE,IAAI,CAACP,UAAU,CAACC,IAAI,CAAC,SAAS,CAAC,EAAE,IACjDO,KAAKC,SAAS,CAACL,UAAU,MAAM;QAGnC,MAAMM,OAAOC,OAAOD,IAAI,CAACN;QACzB,IAAIM,KAAKE,MAAM,IAAI,GAAG;YAClB;QACJ;QAEA,MAAMC,UAAU,CAAC,wCAAwC,EAAE,IAAI,CAACb,UAAU,CAACC,IAAI,CAAC,SAAS,CAAC;QAC1F,MAAMa,UAAU,IAAI,CAACC,cAAc,CAACZ,SAASC;QAC7C,MAAMY,gBAAgBN,IAAI,CAAC,EAAE;QAC7B,MAAMO,gBAAgBN,OAAOO,WAAW,CAACP,OAAOQ,OAAO,CAACf,UAAUgB,KAAK,CAAC;QACxE,OAAO;YACHrB,IAAI,IAAI,CAACA,EAAE;YACXc;YACAC;YACAO,SAASC,kBAAW,CAACC,MAAM;YAC3BC,MAAM;gBAAER;gBAAeC;YAAc;QACzC;IACJ;IAEAQ,IAAI,EAAED,IAAI,EAA2B,EAAErB,OAAgB,EAAE;QACrD,MAAM,EAAEa,aAAa,EAAEC,aAAa,EAAE,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K,OAAO,CAAC,IAAI;QACnC;IACJ;IAEA;;;;KAIC,GACD,AAAQH,aAAajC,QAAkB,EAAY;QAC/C,OAAOO,OAAOO,WAAW,CACrBP,OAAOQ,OAAO,CAACf,UACVwD,IAAI,CACD,CAAC,CAACG,IAAIC,OAAO,EAAE,CAACC,IAAIC,OAAO,GACvBvD,OAAOD,IAAI,CAACsD,QAAQpD,MAAM,GAAGD,OAAOD,IAAI,CAACwD,QAAQtD,MAAM,IACvDuD,IAAAA,sBAAc,EAACJ,IAAIE,KAE1BG,OAAO;IAEpB;IAtIA,YAAY,AAAiBpE,UAAsB,CAAE;;aAAxBA,aAAAA;IAAyB;AAuI1D"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"require-one-uikit-version.d.ts","sourceRoot":"","sources":["../../../../../src/cli/commands/review/rules/require-one-uikit-version.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,2BAA2B,EAAE,MAAM,kCAAkC,CAAC;
|
|
1
|
+
{"version":3,"file":"require-one-uikit-version.d.ts","sourceRoot":"","sources":["../../../../../src/cli/commands/review/rules/require-one-uikit-version.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,2BAA2B,EAAE,MAAM,kCAAkC,CAAC;AAwB/E,qBAAa,sBAAuB,SAAQ,2BAA2B;;CAItE"}
|
|
@@ -25,6 +25,7 @@ const UIKIT_PACKAGES = [
|
|
|
25
25
|
'@servicetitan/react-ioc',
|
|
26
26
|
'@servicetitan/restrict-imports',
|
|
27
27
|
'@servicetitan/startup',
|
|
28
|
+
'@servicetitan/startup-utils',
|
|
28
29
|
'@servicetitan/stylelint-config',
|
|
29
30
|
'@servicetitan/suppress-warnings',
|
|
30
31
|
'@servicetitan/web-components'
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../src/cli/commands/review/rules/require-one-uikit-version.ts"],"sourcesContent":["import { RequireOneCollectionVersion } from './require-one-collection-version';\n\nconst UIKIT_PACKAGES = [\n '@servicetitan/ajax-handlers',\n '@servicetitan/datadog-rum',\n '@servicetitan/error-boundary',\n '@servicetitan/eslint-config',\n '@servicetitan/eslint-plugin',\n '@servicetitan/eslint-plugin-folder-schema',\n '@servicetitan/folder-lint',\n '@servicetitan/hash-browser-router',\n '@servicetitan/ko-bridge',\n '@servicetitan/launchdarkly-service',\n '@servicetitan/lazy-module',\n '@servicetitan/log-service',\n '@servicetitan/react-ioc',\n '@servicetitan/restrict-imports',\n '@servicetitan/startup',\n '@servicetitan/stylelint-config',\n '@servicetitan/suppress-warnings',\n '@servicetitan/web-components',\n];\n\nexport class RequireOneUikitVersion extends RequireOneCollectionVersion {\n constructor() {\n super({ name: 'uikit', packages: UIKIT_PACKAGES });\n }\n}\n"],"names":["RequireOneUikitVersion","UIKIT_PACKAGES","RequireOneCollectionVersion","name","packages"],"mappings":";;;;+
|
|
1
|
+
{"version":3,"sources":["../../../../../src/cli/commands/review/rules/require-one-uikit-version.ts"],"sourcesContent":["import { RequireOneCollectionVersion } from './require-one-collection-version';\n\nconst UIKIT_PACKAGES = [\n '@servicetitan/ajax-handlers',\n '@servicetitan/datadog-rum',\n '@servicetitan/error-boundary',\n '@servicetitan/eslint-config',\n '@servicetitan/eslint-plugin',\n '@servicetitan/eslint-plugin-folder-schema',\n '@servicetitan/folder-lint',\n '@servicetitan/hash-browser-router',\n '@servicetitan/ko-bridge',\n '@servicetitan/launchdarkly-service',\n '@servicetitan/lazy-module',\n '@servicetitan/log-service',\n '@servicetitan/react-ioc',\n '@servicetitan/restrict-imports',\n '@servicetitan/startup',\n '@servicetitan/startup-utils',\n '@servicetitan/stylelint-config',\n '@servicetitan/suppress-warnings',\n '@servicetitan/web-components',\n];\n\nexport class RequireOneUikitVersion extends RequireOneCollectionVersion {\n constructor() {\n super({ name: 'uikit', packages: UIKIT_PACKAGES });\n }\n}\n"],"names":["RequireOneUikitVersion","UIKIT_PACKAGES","RequireOneCollectionVersion","name","packages"],"mappings":";;;;+BAwBaA;;;eAAAA;;;6CAxB+B;AAE5C,MAAMC,iBAAiB;IACnB;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;CACH;AAEM,MAAMD,+BAA+BE,wDAA2B;IACnE,aAAc;QACV,KAAK,CAAC;YAAEC,MAAM;YAASC,UAAUH;QAAe;IACpD;AACJ"}
|
package/dist/cli/commands/review/rules/require-project-version-in-root-node-modules.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"require-project-version-in-root-node-modules.d.ts","sourceRoot":"","sources":["../../../../../src/cli/commands/review/rules/require-project-version-in-root-node-modules.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"require-project-version-in-root-node-modules.d.ts","sourceRoot":"","sources":["../../../../../src/cli/commands/review/rules/require-project-version-in-root-node-modules.ts"],"names":[],"mappings":"AAIA,OAAO,EAAe,YAAY,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AAG3E,UAAU,QAAQ;IACd,IAAI,EAAE,MAAM,CAAC;IACb,eAAe,EAAE,MAAM,EAAE,CAAC;IAC1B,WAAW,EAAE,MAAM,CAAC;CACvB;AAED,UAAU,SAAS;IACf,UAAU,EAAE,QAAQ,EAAE,CAAC;CAC1B;AAED,qBAAa,sCAAuC,YAAW,WAAW;IACtE,IAAI,EAAE,WAEL;IAED,GAAG,CAAC,OAAO,EAAE,OAAO,GAAG,YAAY,CAAC,SAAS,CAAC,GAAG,SAAS;IAgB1D,GAAG,CAAC,EAAE,IAAI,EAAE,EAAE,YAAY,CAAC,SAAS,CAAC,EAAE,OAAO,EAAE,OAAO;IAoCvD,OAAO,CAAC,aAAa;IAOrB,OAAO,CAAC,cAAc;IActB,OAAO,CAAC,eAAe;CAI1B"}
|
|
@@ -9,11 +9,11 @@ Object.defineProperty(exports, "RequireProjectVersionInRootNodeModules", {
|
|
|
9
9
|
}
|
|
10
10
|
});
|
|
11
11
|
const _chalk = /*#__PURE__*/ _interop_require_default(require("chalk"));
|
|
12
|
+
const _child_process = require("child_process");
|
|
12
13
|
const _semver = require("semver");
|
|
14
|
+
const _utils = require("../../../../utils");
|
|
13
15
|
const _types = require("../types");
|
|
14
|
-
const
|
|
15
|
-
const _child_process = require("child_process");
|
|
16
|
-
const _utils1 = require("../../../../utils");
|
|
16
|
+
const _utils1 = require("../utils");
|
|
17
17
|
function _interop_require_default(obj) {
|
|
18
18
|
return obj && obj.__esModule ? obj : {
|
|
19
19
|
default: obj
|
|
@@ -49,8 +49,8 @@ class RequireProjectVersionInRootNodeModules {
|
|
|
49
49
|
return;
|
|
50
50
|
}
|
|
51
51
|
const dependencies = mismatches.reduce((result, { name, projectVersions })=>{
|
|
52
|
-
if (!(0,
|
|
53
|
-
result[name] = (0,
|
|
52
|
+
if (!(0, _utils1.getKey)(root, name)) {
|
|
53
|
+
result[name] = (0, _utils1.getMaxVersion)(projectVersions);
|
|
54
54
|
}
|
|
55
55
|
return result;
|
|
56
56
|
}, {});
|
|
@@ -58,10 +58,10 @@ class RequireProjectVersionInRootNodeModules {
|
|
|
58
58
|
if (entries.length === 0) {
|
|
59
59
|
return;
|
|
60
60
|
}
|
|
61
|
-
/* istanbul ignore next: debug only */
|
|
61
|
+
/* istanbul ignore next: debug only */ _utils.log.debug(`review:${this.id}`, ()=>JSON.stringify(dependencies, null, 2));
|
|
62
62
|
[
|
|
63
63
|
...entries.map(([name, version])=>`npm pkg set dependencies["${name}"]="${version}"`),
|
|
64
|
-
'npx
|
|
64
|
+
'npx @servicetitan/install --fix --quiet',
|
|
65
65
|
...entries.map(([name])=>`npm pkg delete dependencies["${name}"]`)
|
|
66
66
|
].forEach((command)=>(0, _child_process.execSync)(command, {
|
|
67
67
|
stdio: 'inherit'
|
|
@@ -94,7 +94,7 @@ class RequireProjectVersionInRootNodeModules {
|
|
|
94
94
|
getDependencies({ config, dependencies }) {
|
|
95
95
|
var _config_rules;
|
|
96
96
|
const ruleConfig = (_config_rules = config.rules) === null || _config_rules === void 0 ? void 0 : _config_rules[this.id];
|
|
97
|
-
return (0,
|
|
97
|
+
return (0, _utils1.applyFilter)(ruleConfig, Object.entries(dependencies), ([name])=>name);
|
|
98
98
|
}
|
|
99
99
|
}
|
|
100
100
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../src/cli/commands/review/rules/require-project-version-in-root-node-modules.ts"],"sourcesContent":["import chalk from 'chalk';\nimport {
|
|
1
|
+
{"version":3,"sources":["../../../../../src/cli/commands/review/rules/require-project-version-in-root-node-modules.ts"],"sourcesContent":["import chalk from 'chalk';\nimport { execSync } from 'child_process';\nimport { satisfies } from 'semver';\nimport { log } from '../../../../utils';\nimport { FixCategory, PackageError, PackageRule, Project } from '../types';\nimport { applyFilter, getKey, getMaxVersion } from '../utils';\n\ninterface Mismatch {\n name: string;\n projectVersions: string[];\n rootVersion: string;\n}\n\ninterface ErrorData {\n mismatches: Mismatch[];\n}\n\nexport class RequireProjectVersionInRootNodeModules implements PackageRule {\n get id() {\n return 'require-project-version-in-root-node-modules';\n }\n\n run(project: Project): PackageError<ErrorData> | undefined {\n const mismatches = this.findMismatches(project);\n if (!mismatches.length) {\n return;\n }\n\n return {\n id: this.id,\n message: 'project has unexpected version in root node_modules',\n details: this.formatDetails(mismatches),\n fixable: FixCategory.lockFile,\n location: project.packageLock.location,\n data: { mismatches },\n };\n }\n\n fix({ data }: PackageError<ErrorData>, project: Project) {\n const { mismatches } = data ?? {};\n if (!mismatches) {\n return;\n }\n\n const root = project.packages.find(({ location }) => location === '.');\n if (!root) {\n return;\n }\n\n const dependencies = mismatches.reduce<Record<string, string>>(\n (result, { name, projectVersions }) => {\n if (!getKey(root, name)) {\n result[name] = getMaxVersion(projectVersions);\n }\n return result;\n },\n {}\n );\n\n const entries = Object.entries(dependencies);\n if (entries.length === 0) {\n return;\n }\n\n /* istanbul ignore next: debug only */\n log.debug(`review:${this.id}`, () => JSON.stringify(dependencies, null, 2));\n\n [\n ...entries.map(([name, version]) => `npm pkg set dependencies[\"${name}\"]=\"${version}\"`),\n 'npx @servicetitan/install --fix --quiet',\n ...entries.map(([name]) => `npm pkg delete dependencies[\"${name}\"]`),\n ].forEach(command => execSync(command, { stdio: 'inherit' }));\n }\n\n private formatDetails(mismatches: Mismatch[]) {\n return mismatches.map(({ name, projectVersions, rootVersion }) => {\n const pkg = chalk.yellow(`${name}@${rootVersion}`);\n return `${pkg} does not match ${chalk.yellow(projectVersions.join(', '))}`;\n });\n }\n\n private findMismatches(project: Project) {\n const { packageLock } = project;\n return this.getDependencies(project).reduce((result, [name, versions]) => {\n const rootVersion = packageLock.packages[`node_modules/${name}`]?.version;\n if (rootVersion) {\n const projectVersions = Object.keys(versions);\n if (!projectVersions.some(version => satisfies(rootVersion, version))) {\n result.push({ name, projectVersions, rootVersion });\n }\n }\n return result;\n }, [] as Mismatch[]);\n }\n\n private getDependencies({ config, dependencies }: Project) {\n const ruleConfig = config.rules?.[this.id];\n return applyFilter(ruleConfig, Object.entries(dependencies), ([name]) => name);\n }\n}\n"],"names":["RequireProjectVersionInRootNodeModules","id","run","project","mismatches","findMismatches","length","message","details","formatDetails","fixable","FixCategory","lockFile","location","packageLock","data","fix","root","packages","find","dependencies","reduce","result","name","projectVersions","getKey","getMaxVersion","entries","Object","log","debug","JSON","stringify","map","version","forEach","command","execSync","stdio","rootVersion","pkg","chalk","yellow","join","getDependencies","versions","keys","some","satisfies","push","config","ruleConfig","rules","applyFilter"],"mappings":";;;;+BAiBaA;;;eAAAA;;;8DAjBK;+BACO;wBACC;uBACN;uBAC4C;wBACb;;;;;;AAY5C,MAAMA;IACT,IAAIC,KAAK;QACL,OAAO;IACX;IAEAC,IAAIC,OAAgB,EAAuC;QACvD,MAAMC,aAAa,IAAI,CAACC,cAAc,CAACF;QACvC,IAAI,CAACC,WAAWE,MAAM,EAAE;YACpB;QACJ;QAEA,OAAO;YACHL,IAAI,IAAI,CAACA,EAAE;YACXM,SAAS;YACTC,SAAS,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,OAAOA,WAAW6B,GAAG,CAAC,CAAC,EAAEV,IAAI,EAAEC,eAAe,EAAEe,WAAW,EAAE;YACzD,MAAMC,MAAMC,cAAK,CAACC,MAAM,CAAC,GAAGnB,KAAK,CAAC,EAAEgB,aAAa;YACjD,OAAO,GAAGC,IAAI,gBAAgB,EAAEC,cAAK,CAACC,MAAM,CAAClB,gBAAgBmB,IAAI,CAAC,QAAQ;QAC9E;IACJ;IAEQtC,eAAeF,OAAgB,EAAE;QACrC,MAAM,EAAEW,WAAW,EAAE,GAAGX;QACxB,OAAO,IAAI,CAACyC,eAAe,CAACzC,SAASkB,MAAM,CAAC,CAACC,QAAQ,CAACC,MAAMsB,SAAS;gBAC7C/B;YAApB,MAAMyB,eAAczB,yBAAAA,YAAYI,QAAQ,CAAC,CAAC,aAAa,EAAEK,MAAM,CAAC,cAA5CT,6CAAAA,uBAA8CoB,OAAO;YACzE,IAAIK,aAAa;gBACb,MAAMf,kBAAkBI,OAAOkB,IAAI,CAACD;gBACpC,IAAI,CAACrB,gBAAgBuB,IAAI,CAACb,CAAAA,UAAWc,IAAAA,iBAAS,EAACT,aAAaL,WAAW;oBACnEZ,OAAO2B,IAAI,CAAC;wBAAE1B;wBAAMC;wBAAiBe;oBAAY;gBACrD;YACJ;YACA,OAAOjB;QACX,GAAG,EAAE;IACT;IAEQsB,gBAAgB,EAAEM,MAAM,EAAE9B,YAAY,EAAW,EAAE;YACpC8B;QAAnB,MAAMC,cAAaD,gBAAAA,OAAOE,KAAK,cAAZF,oCAAAA,aAAc,CAAC,IAAI,CAACjD,EAAE,CAAC;QAC1C,OAAOoD,IAAAA,mBAAW,EAACF,YAAYvB,OAAOD,OAAO,CAACP,eAAe,CAAC,CAACG,KAAK,GAAKA;IAC7E;AACJ"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { PackageError, PackageRule, Project } from '../types';
|
|
2
|
+
interface ErrorData {
|
|
3
|
+
tsconfigPath: string;
|
|
4
|
+
missingReference: string;
|
|
5
|
+
expectedPath: string;
|
|
6
|
+
}
|
|
7
|
+
export type RuleError = PackageError<ErrorData>;
|
|
8
|
+
export declare class RequireTsconfigReferences implements PackageRule {
|
|
9
|
+
private packageNameToLocation;
|
|
10
|
+
private locationToPackageName;
|
|
11
|
+
private workspacePackageNames;
|
|
12
|
+
get id(): string;
|
|
13
|
+
run(project: Project): RuleError[];
|
|
14
|
+
fix({ data }: RuleError): void;
|
|
15
|
+
private getLocalDependencies;
|
|
16
|
+
private normalizeTsConfigPath;
|
|
17
|
+
private getTsConfigReferencedPackages;
|
|
18
|
+
private getExpectedReferencePath;
|
|
19
|
+
private collectTsConfigFiles;
|
|
20
|
+
private findMissingDependencyReferences;
|
|
21
|
+
private readonly checkTsConfigReferences;
|
|
22
|
+
}
|
|
23
|
+
export {};
|
|
24
|
+
//# sourceMappingURL=require-tsconfig-references.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"require-tsconfig-references.d.ts","sourceRoot":"","sources":["../../../../../src/cli/commands/review/rules/require-tsconfig-references.ts"],"names":[],"mappings":"AAIA,OAAO,EAAwB,YAAY,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AAOpF,UAAU,SAAS;IACf,YAAY,EAAE,MAAM,CAAC;IACrB,gBAAgB,EAAE,MAAM,CAAC;IACzB,YAAY,EAAE,MAAM,CAAC;CACxB;AAED,MAAM,MAAM,SAAS,GAAG,YAAY,CAAC,SAAS,CAAC,CAAC;AAEhD,qBAAa,yBAA0B,YAAW,WAAW;IACzD,OAAO,CAAC,qBAAqB,CAAuB;IACpD,OAAO,CAAC,qBAAqB,CAAuB;IACpD,OAAO,CAAC,qBAAqB,CAAe;IAE5C,IAAI,EAAE,WAEL;IAED,GAAG,CAAC,OAAO,EAAE,OAAO,GAAG,SAAS,EAAE;IAYlC,GAAG,CAAC,EAAE,IAAI,EAAE,EAAE,SAAS;IAmBvB,OAAO,CAAC,oBAAoB;IAY5B,OAAO,CAAC,qBAAqB;IAI7B,OAAO,CAAC,6BAA6B;IAuBrC,OAAO,CAAC,wBAAwB;IAQhC,OAAO,CAAC,oBAAoB;IAS5B,OAAO,CAAC,+BAA+B;IA6BvC,OAAO,CAAC,QAAQ,CAAC,uBAAuB,CAWtC;CACL"}
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
Object.defineProperty(exports, "RequireTsconfigReferences", {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: function() {
|
|
8
|
+
return RequireTsconfigReferences;
|
|
9
|
+
}
|
|
10
|
+
});
|
|
11
|
+
const _glob = require("glob");
|
|
12
|
+
const _nodefs = /*#__PURE__*/ _interop_require_default(require("node:fs"));
|
|
13
|
+
const _nodepath = /*#__PURE__*/ _interop_require_default(require("node:path"));
|
|
14
|
+
const _utils = require("../../../../utils");
|
|
15
|
+
const _types = require("../types");
|
|
16
|
+
const _utils1 = require("../utils");
|
|
17
|
+
function _define_property(obj, key, value) {
|
|
18
|
+
if (key in obj) {
|
|
19
|
+
Object.defineProperty(obj, key, {
|
|
20
|
+
value: value,
|
|
21
|
+
enumerable: true,
|
|
22
|
+
configurable: true,
|
|
23
|
+
writable: true
|
|
24
|
+
});
|
|
25
|
+
} else {
|
|
26
|
+
obj[key] = value;
|
|
27
|
+
}
|
|
28
|
+
return obj;
|
|
29
|
+
}
|
|
30
|
+
function _interop_require_default(obj) {
|
|
31
|
+
return obj && obj.__esModule ? obj : {
|
|
32
|
+
default: obj
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
class RequireTsconfigReferences {
|
|
36
|
+
get id() {
|
|
37
|
+
return 'require-tsconfig-references';
|
|
38
|
+
}
|
|
39
|
+
run(project) {
|
|
40
|
+
this.packageNameToLocation = new Map(project.packages.map(({ name, location })=>[
|
|
41
|
+
name,
|
|
42
|
+
location
|
|
43
|
+
]));
|
|
44
|
+
this.locationToPackageName = new Map(project.packages.map(({ name, location })=>[
|
|
45
|
+
_nodepath.default.resolve(location),
|
|
46
|
+
name
|
|
47
|
+
]));
|
|
48
|
+
this.workspacePackageNames = new Set(project.packages.map(({ name })=>name));
|
|
49
|
+
return (0, _utils1.checkPackages)(this, project, this.checkTsConfigReferences);
|
|
50
|
+
}
|
|
51
|
+
fix({ data }) {
|
|
52
|
+
var _tsconfig_references;
|
|
53
|
+
if (!data) {
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
56
|
+
const { tsconfigPath, expectedPath } = data;
|
|
57
|
+
const tsconfig = (0, _utils.readJsonSafe)(tsconfigPath);
|
|
58
|
+
if (!tsconfig) {
|
|
59
|
+
return;
|
|
60
|
+
}
|
|
61
|
+
const references = (_tsconfig_references = tsconfig.references) !== null && _tsconfig_references !== void 0 ? _tsconfig_references : [];
|
|
62
|
+
references.push({
|
|
63
|
+
path: expectedPath
|
|
64
|
+
});
|
|
65
|
+
tsconfig.references = references;
|
|
66
|
+
_nodefs.default.writeFileSync(tsconfigPath, JSON.stringify(tsconfig) + '\n', 'utf-8');
|
|
67
|
+
(0, _utils.prettifySync)(tsconfigPath);
|
|
68
|
+
}
|
|
69
|
+
getLocalDependencies(pkg) {
|
|
70
|
+
const dependencies = {
|
|
71
|
+
...pkg.dependencies,
|
|
72
|
+
...pkg.devDependencies,
|
|
73
|
+
...pkg.peerDependencies
|
|
74
|
+
};
|
|
75
|
+
return Object.keys(dependencies).filter((dependency)=>this.workspacePackageNames.has(dependency));
|
|
76
|
+
}
|
|
77
|
+
normalizeTsConfigPath(filePath) {
|
|
78
|
+
return filePath.endsWith('.json') ? filePath : `${filePath}.json`;
|
|
79
|
+
}
|
|
80
|
+
getTsConfigReferencedPackages(tsconfigPath) {
|
|
81
|
+
const config = (0, _utils.readJsonSafe)(tsconfigPath);
|
|
82
|
+
if (!(config === null || config === void 0 ? void 0 : config.references)) {
|
|
83
|
+
return new Set();
|
|
84
|
+
}
|
|
85
|
+
const tsconfigDir = _nodepath.default.dirname(tsconfigPath);
|
|
86
|
+
const referencedPackages = new Set();
|
|
87
|
+
for (const reference of config.references){
|
|
88
|
+
const normalizedPath = this.normalizeTsConfigPath(reference.path);
|
|
89
|
+
const resolvedRefPath = _nodepath.default.resolve(tsconfigDir, normalizedPath);
|
|
90
|
+
const refDir = _nodepath.default.dirname(resolvedRefPath);
|
|
91
|
+
const packageName = this.locationToPackageName.get(refDir);
|
|
92
|
+
if (packageName) {
|
|
93
|
+
referencedPackages.add(packageName);
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
return referencedPackages;
|
|
97
|
+
}
|
|
98
|
+
getExpectedReferencePath(fromLocation, toLocation) {
|
|
99
|
+
const relativePath = _nodepath.default.relative(fromLocation, toLocation);
|
|
100
|
+
const tsconfigFile = (0, _utils.getTsConfig)(toLocation);
|
|
101
|
+
const tsconfigName = _nodepath.default.basename(tsconfigFile);
|
|
102
|
+
return _nodepath.default.join(relativePath, tsconfigName).replaceAll('\\', '/');
|
|
103
|
+
}
|
|
104
|
+
collectTsConfigFiles(location) {
|
|
105
|
+
const tsconfigFiles = (0, _glob.globSync)([
|
|
106
|
+
'tsconfig.json',
|
|
107
|
+
'tsconfig.*.json'
|
|
108
|
+
], {
|
|
109
|
+
absolute: false,
|
|
110
|
+
cwd: location
|
|
111
|
+
});
|
|
112
|
+
return tsconfigFiles.map((tsconfigFile)=>_nodepath.default.join(location, tsconfigFile));
|
|
113
|
+
}
|
|
114
|
+
findMissingDependencyReferences(pkg, tsconfigPath, localDependencies) {
|
|
115
|
+
const referencedPackages = this.getTsConfigReferencedPackages(tsconfigPath);
|
|
116
|
+
return localDependencies.filter((dependency)=>!referencedPackages.has(dependency)).map((dependency)=>{
|
|
117
|
+
const dependencyLocation = this.packageNameToLocation.get(dependency);
|
|
118
|
+
return {
|
|
119
|
+
id: this.id,
|
|
120
|
+
message: `missing reference for dependency: ${dependency}`,
|
|
121
|
+
location: tsconfigPath,
|
|
122
|
+
fixable: _types.FixCategory.normal,
|
|
123
|
+
data: {
|
|
124
|
+
tsconfigPath,
|
|
125
|
+
missingReference: dependency,
|
|
126
|
+
expectedPath: this.getExpectedReferencePath(pkg.location, dependencyLocation)
|
|
127
|
+
}
|
|
128
|
+
};
|
|
129
|
+
});
|
|
130
|
+
}
|
|
131
|
+
constructor(){
|
|
132
|
+
_define_property(this, "packageNameToLocation", void 0);
|
|
133
|
+
_define_property(this, "locationToPackageName", void 0);
|
|
134
|
+
_define_property(this, "workspacePackageNames", void 0);
|
|
135
|
+
_define_property(this, "checkTsConfigReferences", (pkg)=>{
|
|
136
|
+
if (pkg.location === '.') {
|
|
137
|
+
return [];
|
|
138
|
+
}
|
|
139
|
+
const tsconfigFiles = this.collectTsConfigFiles(pkg.location);
|
|
140
|
+
const localDependencies = this.getLocalDependencies(pkg);
|
|
141
|
+
return tsconfigFiles.flatMap((tsconfigPath)=>this.findMissingDependencyReferences(pkg, tsconfigPath, localDependencies));
|
|
142
|
+
});
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
//# sourceMappingURL=require-tsconfig-references.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../src/cli/commands/review/rules/require-tsconfig-references.ts"],"sourcesContent":["import { globSync } from 'glob';\nimport fs from 'node:fs';\nimport path from 'node:path';\nimport { getTsConfig, prettifySync, readJsonSafe } from '../../../../utils';\nimport { FixCategory, Package, PackageError, PackageRule, Project } from '../types';\nimport { checkPackages } from '../utils';\n\ninterface TsConfig {\n references?: { path: string }[];\n}\n\ninterface ErrorData {\n tsconfigPath: string;\n missingReference: string;\n expectedPath: string;\n}\n\nexport type RuleError = PackageError<ErrorData>;\n\nexport class RequireTsconfigReferences implements PackageRule {\n private packageNameToLocation!: Map<string, string>;\n private locationToPackageName!: Map<string, string>;\n private workspacePackageNames!: Set<string>;\n\n get id() {\n return 'require-tsconfig-references';\n }\n\n run(project: Project): RuleError[] {\n this.packageNameToLocation = new Map(\n project.packages.map(({ name, location }) => [name, location])\n );\n this.locationToPackageName = new Map(\n project.packages.map(({ name, location }) => [path.resolve(location), name])\n );\n this.workspacePackageNames = new Set(project.packages.map(({ name }) => name));\n\n return checkPackages(this, project, this.checkTsConfigReferences);\n }\n\n fix({ data }: RuleError) {\n if (!data) {\n return;\n }\n\n const { tsconfigPath, expectedPath } = data;\n const tsconfig = readJsonSafe<TsConfig>(tsconfigPath);\n if (!tsconfig) {\n return;\n }\n\n const references = tsconfig.references ?? [];\n references.push({ path: expectedPath });\n tsconfig.references = references;\n\n fs.writeFileSync(tsconfigPath, JSON.stringify(tsconfig) + '\\n', 'utf-8');\n prettifySync(tsconfigPath);\n }\n\n private getLocalDependencies(pkg: Package) {\n const dependencies = {\n ...pkg.dependencies,\n ...pkg.devDependencies,\n ...pkg.peerDependencies,\n };\n\n return Object.keys(dependencies).filter(dependency =>\n this.workspacePackageNames.has(dependency)\n );\n }\n\n private normalizeTsConfigPath(filePath: string): string {\n return filePath.endsWith('.json') ? filePath : `${filePath}.json`;\n }\n\n private getTsConfigReferencedPackages(tsconfigPath: string) {\n const config = readJsonSafe<TsConfig>(tsconfigPath);\n if (!config?.references) {\n return new Set<string>();\n }\n\n const tsconfigDir = path.dirname(tsconfigPath);\n const referencedPackages = new Set<string>();\n\n for (const reference of config.references) {\n const normalizedPath = this.normalizeTsConfigPath(reference.path);\n const resolvedRefPath = path.resolve(tsconfigDir, normalizedPath);\n const refDir = path.dirname(resolvedRefPath);\n const packageName = this.locationToPackageName.get(refDir);\n\n if (packageName) {\n referencedPackages.add(packageName);\n }\n }\n\n return referencedPackages;\n }\n\n private getExpectedReferencePath(fromLocation: string, toLocation: string) {\n const relativePath = path.relative(fromLocation, toLocation);\n const tsconfigFile = getTsConfig(toLocation);\n const tsconfigName = path.basename(tsconfigFile);\n\n return path.join(relativePath, tsconfigName).replaceAll('\\\\', '/');\n }\n\n private collectTsConfigFiles(location: string): string[] {\n const tsconfigFiles = globSync(['tsconfig.json', 'tsconfig.*.json'], {\n absolute: false,\n cwd: location,\n });\n\n return tsconfigFiles.map(tsconfigFile => path.join(location, tsconfigFile));\n }\n\n private findMissingDependencyReferences(\n pkg: Package,\n tsconfigPath: string,\n localDependencies: string[]\n ): RuleError[] {\n const referencedPackages = this.getTsConfigReferencedPackages(tsconfigPath);\n\n return localDependencies\n .filter(dependency => !referencedPackages.has(dependency))\n .map(dependency => {\n const dependencyLocation = this.packageNameToLocation.get(dependency)!;\n\n return {\n id: this.id,\n message: `missing reference for dependency: ${dependency}`,\n location: tsconfigPath,\n fixable: FixCategory.normal,\n data: {\n tsconfigPath,\n missingReference: dependency,\n expectedPath: this.getExpectedReferencePath(\n pkg.location,\n dependencyLocation\n ),\n },\n };\n });\n }\n\n private readonly checkTsConfigReferences = (pkg: Package) => {\n if (pkg.location === '.') {\n return [];\n }\n\n const tsconfigFiles = this.collectTsConfigFiles(pkg.location);\n const localDependencies = this.getLocalDependencies(pkg);\n\n return tsconfigFiles.flatMap(tsconfigPath =>\n this.findMissingDependencyReferences(pkg, tsconfigPath, localDependencies)\n );\n };\n}\n"],"names":["RequireTsconfigReferences","id","run","project","packageNameToLocation","Map","packages","map","name","location","locationToPackageName","path","resolve","workspacePackageNames","Set","checkPackages","checkTsConfigReferences","fix","data","tsconfig","tsconfigPath","expectedPath","readJsonSafe","references","push","fs","writeFileSync","JSON","stringify","prettifySync","getLocalDependencies","pkg","dependencies","devDependencies","peerDependencies","Object","keys","filter","dependency","has","normalizeTsConfigPath","filePath","endsWith","getTsConfigReferencedPackages","config","tsconfigDir","dirname","referencedPackages","reference","normalizedPath","resolvedRefPath","refDir","packageName","get","add","getExpectedReferencePath","fromLocation","toLocation","relativePath","relative","tsconfigFile","getTsConfig","tsconfigName","basename","join","replaceAll","collectTsConfigFiles","tsconfigFiles","globSync","absolute","cwd","findMissingDependencyReferences","localDependencies","dependencyLocation","message","fixable","FixCategory","normal","missingReference","flatMap"],"mappings":";;;;+BAmBaA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B,EAAE;YACjEC,UAAU;YACVC,KAAK7D;QACT;QAEA,OAAO0D,cAAc5D,GAAG,CAACqD,CAAAA,eAAgBjD,iBAAI,CAACqD,IAAI,CAACvD,UAAUmD;IACjE;IAEQW,gCACJxC,GAAY,EACZX,YAAoB,EACpBoD,iBAA2B,EAChB;QACX,MAAMzB,qBAAqB,IAAI,CAACJ,6BAA6B,CAACvB;QAE9D,OAAOoD,kBACFnC,MAAM,CAACC,CAAAA,aAAc,CAACS,mBAAmBR,GAAG,CAACD,aAC7C/B,GAAG,CAAC+B,CAAAA;YACD,MAAMmC,qBAAqB,IAAI,CAACrE,qBAAqB,CAACiD,GAAG,CAACf;YAE1D,OAAO;gBACHrC,IAAI,IAAI,CAACA,EAAE;gBACXyE,SAAS,CAAC,kCAAkC,EAAEpC,YAAY;gBAC1D7B,UAAUW;gBACVuD,SAASC,kBAAW,CAACC,MAAM;gBAC3B3D,MAAM;oBACFE;oBACA0D,kBAAkBxC;oBAClBjB,cAAc,IAAI,CAACkC,wBAAwB,CACvCxB,IAAItB,QAAQ,EACZgE;gBAER;YACJ;QACJ;IACR;;QA1HA,uBAAQrE,yBAAR,KAAA;QACA,uBAAQM,yBAAR,KAAA;QACA,uBAAQG,yBAAR,KAAA;QA0HA,uBAAiBG,2BAA0B,CAACe;YACxC,IAAIA,IAAItB,QAAQ,KAAK,KAAK;gBACtB,OAAO,EAAE;YACb;YAEA,MAAM0D,gBAAgB,IAAI,CAACD,oBAAoB,CAACnC,IAAItB,QAAQ;YAC5D,MAAM+D,oBAAoB,IAAI,CAAC1C,oBAAoB,CAACC;YAEpD,OAAOoC,cAAcY,OAAO,CAAC3D,CAAAA,eACzB,IAAI,CAACmD,+BAA+B,CAACxC,KAAKX,cAAcoD;QAEhE;;AACJ"}
|
|
@@ -16,10 +16,8 @@ function collateDependencies(packages) {
|
|
|
16
16
|
...Object.entries(devDependencies)
|
|
17
17
|
].forEach(([dependency, version])=>{
|
|
18
18
|
if ((0, _semver.validRange)(version)) {
|
|
19
|
-
var _result, _dependency, _result_dependency, _version;
|
|
20
|
-
var _;
|
|
19
|
+
var _result, _dependency, _, _result_dependency, _version, _1;
|
|
21
20
|
(_ = (_result = result)[_dependency = dependency]) !== null && _ !== void 0 ? _ : _result[_dependency] = {};
|
|
22
|
-
var _1;
|
|
23
21
|
(_1 = (_result_dependency = result[dependency])[_version = version]) !== null && _1 !== void 0 ? _1 : _result_dependency[_version] = [];
|
|
24
22
|
result[dependency][version].push(name);
|
|
25
23
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../src/cli/commands/review/utils/collate-dependencies.ts"],"sourcesContent":["import { validRange } from 'semver';\nimport { Dependencies, Package } from '../types';\n\n/**\n * Collates all dependencies and devDependencies from an array of packages into a Dependencies map.\n *\n * For each package, this function collects both `dependencies` and `devDependencies`.\n * It groups package names by dependency and version, resulting in a structure that shows\n * which packages depend on which versions of each dependency.\n *\n * @param {Package[]} packages The array of Package objects to process.\n * @returns {Dependencies} An object mapping dependency names to version maps,\n * where each version maps to an array of package names that depend on that version.\n *\n * @example\n * // Given:\n * packages = [\n * { name: 'foo', dependencies: { lodash: '^4.17.21' } },\n * { name: 'bar', devDependencies: { lodash: '^4.17.21' } },\n * { name: 'baz', dependencies: { lodash: '^4.17.20' } }\n * ]\n * // collateDependencies(packages) returns:\n * {\n * lodash: {\n * '^4.17.21': ['foo', 'bar'],\n * '^4.17.20': ['baz']\n * }\n * }\n */\nexport function collateDependencies(packages: Package[]): Dependencies {\n return packages.reduce<Dependencies>(\n (result, { name, dependencies = {}, devDependencies = {} }) => {\n [...Object.entries(dependencies), ...Object.entries(devDependencies)].forEach(\n ([dependency, version]) => {\n if (validRange(version)) {\n result[dependency] ??= {};\n result[dependency][version] ??= [];\n result[dependency][version].push(name);\n }\n }\n );\n return result;\n },\n {}\n );\n}\n"],"names":["collateDependencies","packages","reduce","result","name","dependencies","devDependencies","Object","entries","forEach","dependency","version","validRange","push"],"mappings":";;;;+BA6BgBA;;;eAAAA;;;wBA7BW;AA6BpB,SAASA,oBAAoBC,QAAmB;IACnD,OAAOA,SAASC,MAAM,CAClB,CAACC,QAAQ,EAAEC,IAAI,EAAEC,eAAe,CAAC,CAAC,EAAEC,kBAAkB,CAAC,CAAC,EAAE;QACtD;eAAIC,OAAOC,OAAO,CAACH;eAAkBE,OAAOC,OAAO,CAACF;SAAiB,CAACG,OAAO,CACzE,CAAC,CAACC,YAAYC,QAAQ;YAClB,IAAIC,IAAAA,kBAAU,EAACD,UAAU;oBACrBR,SAAOO,
|
|
1
|
+
{"version":3,"sources":["../../../../../src/cli/commands/review/utils/collate-dependencies.ts"],"sourcesContent":["import { validRange } from 'semver';\nimport { Dependencies, Package } from '../types';\n\n/**\n * Collates all dependencies and devDependencies from an array of packages into a Dependencies map.\n *\n * For each package, this function collects both `dependencies` and `devDependencies`.\n * It groups package names by dependency and version, resulting in a structure that shows\n * which packages depend on which versions of each dependency.\n *\n * @param {Package[]} packages The array of Package objects to process.\n * @returns {Dependencies} An object mapping dependency names to version maps,\n * where each version maps to an array of package names that depend on that version.\n *\n * @example\n * // Given:\n * packages = [\n * { name: 'foo', dependencies: { lodash: '^4.17.21' } },\n * { name: 'bar', devDependencies: { lodash: '^4.17.21' } },\n * { name: 'baz', dependencies: { lodash: '^4.17.20' } }\n * ]\n * // collateDependencies(packages) returns:\n * {\n * lodash: {\n * '^4.17.21': ['foo', 'bar'],\n * '^4.17.20': ['baz']\n * }\n * }\n */\nexport function collateDependencies(packages: Package[]): Dependencies {\n return packages.reduce<Dependencies>(\n (result, { name, dependencies = {}, devDependencies = {} }) => {\n [...Object.entries(dependencies), ...Object.entries(devDependencies)].forEach(\n ([dependency, version]) => {\n if (validRange(version)) {\n result[dependency] ??= {};\n result[dependency][version] ??= [];\n result[dependency][version].push(name);\n }\n }\n );\n return result;\n },\n {}\n );\n}\n"],"names":["collateDependencies","packages","reduce","result","name","dependencies","devDependencies","Object","entries","forEach","dependency","version","validRange","push"],"mappings":";;;;+BA6BgBA;;;eAAAA;;;wBA7BW;AA6BpB,SAASA,oBAAoBC,QAAmB;IACnD,OAAOA,SAASC,MAAM,CAClB,CAACC,QAAQ,EAAEC,IAAI,EAAEC,eAAe,CAAC,CAAC,EAAEC,kBAAkB,CAAC,CAAC,EAAE;QACtD;eAAIC,OAAOC,OAAO,CAACH;eAAkBE,OAAOC,OAAO,CAACF;SAAiB,CAACG,OAAO,CACzE,CAAC,CAACC,YAAYC,QAAQ;YAClB,IAAIC,IAAAA,kBAAU,EAACD,UAAU;oBACrBR,SAAOO,aAAPP,GACAA,oBAAmBQ,UAAnBR;iBADAA,IAAAA,CAAAA,UAAAA,OAAM,CAACO,cAAAA,WAAW,cAAlBP,eAAAA,IAAAA,OAAM,CAACO,YAAW,GAAK,CAAC;iBACxBP,KAAAA,CAAAA,qBAAAA,MAAM,CAACO,WAAW,CAAA,CAACC,WAAAA,QAAQ,cAA3BR,gBAAAA,KAAAA,kBAAkB,CAACQ,SAAQ,GAAK,EAAE;gBAClCR,MAAM,CAACO,WAAW,CAACC,QAAQ,CAACE,IAAI,CAACT;YACrC;QACJ;QAEJ,OAAOD;IACX,GACA,CAAC;AAET"}
|
|
@@ -88,6 +88,7 @@ function comparePrefix(a, b) {
|
|
|
88
88
|
return prefixOrder[getPrefix(a)] - prefixOrder[getPrefix(b)];
|
|
89
89
|
}
|
|
90
90
|
function getPrefix(version, { infer = false } = {}) {
|
|
91
|
+
var _ref;
|
|
91
92
|
var _REGEX_PREFIX_exec;
|
|
92
93
|
if (infer) {
|
|
93
94
|
if (REGEX_N_DOT_X.test(version)) {
|
|
@@ -97,8 +98,7 @@ function getPrefix(version, { infer = false } = {}) {
|
|
|
97
98
|
return '~';
|
|
98
99
|
}
|
|
99
100
|
}
|
|
100
|
-
|
|
101
|
-
return (_REGEX_PREFIX_exec__trim = (_REGEX_PREFIX_exec = REGEX_PREFIX.exec(version)) === null || _REGEX_PREFIX_exec === void 0 ? void 0 : _REGEX_PREFIX_exec[1].trim()) !== null && _REGEX_PREFIX_exec__trim !== void 0 ? _REGEX_PREFIX_exec__trim : '';
|
|
101
|
+
return (_ref = (_REGEX_PREFIX_exec = REGEX_PREFIX.exec(version)) === null || _REGEX_PREFIX_exec === void 0 ? void 0 : _REGEX_PREFIX_exec[1].trim()) !== null && _ref !== void 0 ? _ref : '';
|
|
102
102
|
}
|
|
103
103
|
function maxVersion(str) {
|
|
104
104
|
if (!_semver.validRange(str)) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../src/cli/commands/review/utils/compare-version.ts"],"sourcesContent":["import * as semver from 'semver';\n\nconst REGEX_PREFIX = /^(\\D{1,2})/;\nconst REGEX_N_DOT_X = /^\\D*\\d\\.x/; // E.g., 1.x\nconst REGEX_N_DOT_N_DOT_X = /^\\D*\\d\\.\\d\\.x/; // E.g., 1.0.x\n\nconst prefixOrder = Object.fromEntries(\n ['<', '<=', '=', '', '~', '^', '>=', '>'].map((prefix, index) => [prefix, index])\n);\n\n/**\n * Compare two semver strings.\n * @returns\n * - `0` if a == b\n * - `>0` if a is semantically greater than b (e.g., \"^1.0.0\" is greater than \"~1.0.0\")\n * - `<0` if a is semantically less than b (e.g., \"<1\" is less than \"<=1\")\n */\nexport function compareVersion(a: string, b: string) {\n const max = { a: maxVersion(a), b: maxVersion(b) };\n if (!(max.a && max.b)) {\n return a.localeCompare(b);\n }\n\n const min = { a: semver.minVersion(a), b: semver.minVersion(b) };\n const result =\n semver.compare(max.a, max.b) || // e.g., ^1.0.0 gt ~1.0.0\n comparePrefix(a, b) || // e.g., ^1 gt 1.x\n (min.a && min.b ? semver.compare(min.a, min.b) : 0) || // e.g., ^1.1.1 gt ^1.0.0\n a.length - b.length; // >=1.0.0 gt >=1\n return result > 0 ? 1 : result < 0 ? -1 : 0;\n}\n\nfunction comparePrefix(a: string, b: string) {\n return prefixOrder[getPrefix(a)] - prefixOrder[getPrefix(b)];\n}\n\nfunction getPrefix(version: string, { infer = false }: { infer?: boolean } = {}) {\n if (infer) {\n if (REGEX_N_DOT_X.test(version)) {\n return '^';\n }\n if (REGEX_N_DOT_N_DOT_X.test(version)) {\n return '~';\n }\n }\n return REGEX_PREFIX.exec(version)?.[1].trim() ?? '';\n}\n\nfunction maxVersion(str: string) {\n if (!semver.validRange(str)) {\n return;\n }\n\n const v = semver.coerce(str);\n if (!v) {\n return;\n }\n\n const prefix = getPrefix(str, { infer: true });\n if (prefix === '<') {\n if (v.patch) {\n return new semver.SemVer(`${v.major}.${v.minor}.${v.patch - 1}`);\n }\n if (v.minor) {\n return new semver.SemVer(`${v.major}.${v.minor - 1}.999`);\n }\n if (v.major) {\n return new semver.SemVer(`${v.major - 1}.999.999`);\n }\n }\n if (prefix === '~') {\n return new semver.SemVer(`${v.major}.${v.minor}.999`);\n }\n if (prefix === '^') {\n return new semver.SemVer(`${v.major}.999.999`);\n }\n if (prefix === '>=' || prefix === '>') {\n return new semver.SemVer('999.999.999');\n }\n\n return v;\n}\n"],"names":["compareVersion","REGEX_PREFIX","REGEX_N_DOT_X","REGEX_N_DOT_N_DOT_X","prefixOrder","Object","fromEntries","map","prefix","index","a","b","max","maxVersion","localeCompare","min","semver","minVersion","result","compare","comparePrefix","length","getPrefix","version","infer","test","exec","trim","str","validRange","v","coerce","patch","SemVer","major","minor"],"mappings":";;;;+BAiBgBA;;;eAAAA;;;gEAjBQ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAExB,MAAMC,eAAe;AACrB,MAAMC,gBAAgB,aAAa,YAAY;AAC/C,MAAMC,sBAAsB,iBAAiB,cAAc;AAE3D,MAAMC,cAAcC,OAAOC,WAAW,CAClC;IAAC;IAAK;IAAM;IAAK;IAAI;IAAK;IAAK;IAAM;CAAI,CAACC,GAAG,CAAC,CAACC,QAAQC,QAAU;QAACD;QAAQC;KAAM;AAU7E,SAAST,eAAeU,CAAS,EAAEC,CAAS;IAC/C,MAAMC,MAAM;QAAEF,GAAGG,WAAWH;QAAIC,GAAGE,WAAWF;IAAG;IACjD,IAAI,CAAEC,CAAAA,IAAIF,CAAC,IAAIE,IAAID,CAAC,AAADA,GAAI;QACnB,OAAOD,EAAEI,aAAa,CAACH;IAC3B;IAEA,MAAMI,MAAM;QAAEL,GAAGM,QAAOC,UAAU,CAACP;QAAIC,GAAGK,QAAOC,UAAU,CAACN;IAAG;IAC/D,MAAMO,SACFF,QAAOG,OAAO,CAACP,IAAIF,CAAC,EAAEE,IAAID,CAAC,KAAK,yBAAyB;IACzDS,cAAcV,GAAGC,MAAM,kBAAkB;IACxCI,CAAAA,IAAIL,CAAC,IAAIK,IAAIJ,CAAC,GAAGK,QAAOG,OAAO,CAACJ,IAAIL,CAAC,EAAEK,IAAIJ,CAAC,IAAI,CAAA,KAAM,yBAAyB;IAChFD,EAAEW,MAAM,GAAGV,EAAEU,MAAM,EAAE,kBAAkB;IAC3C,OAAOH,SAAS,IAAI,IAAIA,SAAS,IAAI,CAAC,IAAI;AAC9C;AAEA,SAASE,cAAcV,CAAS,EAAEC,CAAS;IACvC,OAAOP,WAAW,CAACkB,UAAUZ,GAAG,GAAGN,WAAW,CAACkB,UAAUX,GAAG;AAChE;AAEA,SAASW,UAAUC,OAAe,EAAE,EAAEC,QAAQ,KAAK,EAAuB,GAAG,CAAC,CAAC
|
|
1
|
+
{"version":3,"sources":["../../../../../src/cli/commands/review/utils/compare-version.ts"],"sourcesContent":["import * as semver from 'semver';\n\nconst REGEX_PREFIX = /^(\\D{1,2})/;\nconst REGEX_N_DOT_X = /^\\D*\\d\\.x/; // E.g., 1.x\nconst REGEX_N_DOT_N_DOT_X = /^\\D*\\d\\.\\d\\.x/; // E.g., 1.0.x\n\nconst prefixOrder = Object.fromEntries(\n ['<', '<=', '=', '', '~', '^', '>=', '>'].map((prefix, index) => [prefix, index])\n);\n\n/**\n * Compare two semver strings.\n * @returns\n * - `0` if a == b\n * - `>0` if a is semantically greater than b (e.g., \"^1.0.0\" is greater than \"~1.0.0\")\n * - `<0` if a is semantically less than b (e.g., \"<1\" is less than \"<=1\")\n */\nexport function compareVersion(a: string, b: string) {\n const max = { a: maxVersion(a), b: maxVersion(b) };\n if (!(max.a && max.b)) {\n return a.localeCompare(b);\n }\n\n const min = { a: semver.minVersion(a), b: semver.minVersion(b) };\n const result =\n semver.compare(max.a, max.b) || // e.g., ^1.0.0 gt ~1.0.0\n comparePrefix(a, b) || // e.g., ^1 gt 1.x\n (min.a && min.b ? semver.compare(min.a, min.b) : 0) || // e.g., ^1.1.1 gt ^1.0.0\n a.length - b.length; // >=1.0.0 gt >=1\n return result > 0 ? 1 : result < 0 ? -1 : 0;\n}\n\nfunction comparePrefix(a: string, b: string) {\n return prefixOrder[getPrefix(a)] - prefixOrder[getPrefix(b)];\n}\n\nfunction getPrefix(version: string, { infer = false }: { infer?: boolean } = {}) {\n if (infer) {\n if (REGEX_N_DOT_X.test(version)) {\n return '^';\n }\n if (REGEX_N_DOT_N_DOT_X.test(version)) {\n return '~';\n }\n }\n return REGEX_PREFIX.exec(version)?.[1].trim() ?? '';\n}\n\nfunction maxVersion(str: string) {\n if (!semver.validRange(str)) {\n return;\n }\n\n const v = semver.coerce(str);\n if (!v) {\n return;\n }\n\n const prefix = getPrefix(str, { infer: true });\n if (prefix === '<') {\n if (v.patch) {\n return new semver.SemVer(`${v.major}.${v.minor}.${v.patch - 1}`);\n }\n if (v.minor) {\n return new semver.SemVer(`${v.major}.${v.minor - 1}.999`);\n }\n if (v.major) {\n return new semver.SemVer(`${v.major - 1}.999.999`);\n }\n }\n if (prefix === '~') {\n return new semver.SemVer(`${v.major}.${v.minor}.999`);\n }\n if (prefix === '^') {\n return new semver.SemVer(`${v.major}.999.999`);\n }\n if (prefix === '>=' || prefix === '>') {\n return new semver.SemVer('999.999.999');\n }\n\n return v;\n}\n"],"names":["compareVersion","REGEX_PREFIX","REGEX_N_DOT_X","REGEX_N_DOT_N_DOT_X","prefixOrder","Object","fromEntries","map","prefix","index","a","b","max","maxVersion","localeCompare","min","semver","minVersion","result","compare","comparePrefix","length","getPrefix","version","infer","test","exec","trim","str","validRange","v","coerce","patch","SemVer","major","minor"],"mappings":";;;;+BAiBgBA;;;eAAAA;;;gEAjBQ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAExB,MAAMC,eAAe;AACrB,MAAMC,gBAAgB,aAAa,YAAY;AAC/C,MAAMC,sBAAsB,iBAAiB,cAAc;AAE3D,MAAMC,cAAcC,OAAOC,WAAW,CAClC;IAAC;IAAK;IAAM;IAAK;IAAI;IAAK;IAAK;IAAM;CAAI,CAACC,GAAG,CAAC,CAACC,QAAQC,QAAU;QAACD;QAAQC;KAAM;AAU7E,SAAST,eAAeU,CAAS,EAAEC,CAAS;IAC/C,MAAMC,MAAM;QAAEF,GAAGG,WAAWH;QAAIC,GAAGE,WAAWF;IAAG;IACjD,IAAI,CAAEC,CAAAA,IAAIF,CAAC,IAAIE,IAAID,CAAC,AAADA,GAAI;QACnB,OAAOD,EAAEI,aAAa,CAACH;IAC3B;IAEA,MAAMI,MAAM;QAAEL,GAAGM,QAAOC,UAAU,CAACP;QAAIC,GAAGK,QAAOC,UAAU,CAACN;IAAG;IAC/D,MAAMO,SACFF,QAAOG,OAAO,CAACP,IAAIF,CAAC,EAAEE,IAAID,CAAC,KAAK,yBAAyB;IACzDS,cAAcV,GAAGC,MAAM,kBAAkB;IACxCI,CAAAA,IAAIL,CAAC,IAAIK,IAAIJ,CAAC,GAAGK,QAAOG,OAAO,CAACJ,IAAIL,CAAC,EAAEK,IAAIJ,CAAC,IAAI,CAAA,KAAM,yBAAyB;IAChFD,EAAEW,MAAM,GAAGV,EAAEU,MAAM,EAAE,kBAAkB;IAC3C,OAAOH,SAAS,IAAI,IAAIA,SAAS,IAAI,CAAC,IAAI;AAC9C;AAEA,SAASE,cAAcV,CAAS,EAAEC,CAAS;IACvC,OAAOP,WAAW,CAACkB,UAAUZ,GAAG,GAAGN,WAAW,CAACkB,UAAUX,GAAG;AAChE;AAEA,S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M,CAAC,GAAGH,EAAEI,KAAK,CAAC,QAAQ,CAAC;IACjD;IACA,IAAI1B,WAAW,QAAQA,WAAW,KAAK;QACnC,OAAO,IAAIQ,QAAOiB,MAAM,CAAC;IAC7B;IAEA,OAAOH;AACX"}
|
|
@@ -17,12 +17,12 @@ function _interop_require_default(obj) {
|
|
|
17
17
|
};
|
|
18
18
|
}
|
|
19
19
|
function setVersion(params) {
|
|
20
|
+
var _params_key;
|
|
20
21
|
const { project: { packages }, packageName, dependency, version } = params;
|
|
21
22
|
const pkg = packages.find(({ name })=>name === packageName);
|
|
22
23
|
if (!pkg) {
|
|
23
24
|
return;
|
|
24
25
|
}
|
|
25
|
-
var _params_key;
|
|
26
26
|
const key = (_params_key = params.key) !== null && _params_key !== void 0 ? _params_key : (0, _getkey.getKey)(pkg, dependency);
|
|
27
27
|
if (!key) {
|
|
28
28
|
return;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../src/cli/commands/review/utils/set-version.ts"],"sourcesContent":["import { execSync } from 'child_process';\nimport path from 'path';\nimport { Project } from '../types';\nimport { getKey } from './get-key';\n\ninterface Params {\n project: Project;\n packageName: string;\n dependency: string;\n version: string;\n key?: string;\n}\n\nexport function setVersion(params: Params) {\n const {\n project: { packages },\n packageName,\n dependency,\n version,\n } = params;\n const pkg = packages.find(({ name }) => name === packageName);\n if (!pkg) {\n return;\n }\n\n const key = params.key ?? getKey(pkg, dependency);\n if (!key) {\n return;\n }\n\n const workspace = path.relative('.', pkg.location);\n const command = `npm pkg set ${key}[\"${dependency}\"]=\"${version}\"${workspace ? ` -w ${workspace}` : ''}`;\n execSync(command);\n}\n"],"names":["setVersion","params","project","packages","packageName","dependency","version","pkg","find","name","key","getKey","workspace","path","relative","location","command","execSync"],"mappings":";;;;+BAagBA;;;eAAAA;;;+BAbS;6DACR;wBAEM;;;;;;AAUhB,SAASA,WAAWC,MAAc;
|
|
1
|
+
{"version":3,"sources":["../../../../../src/cli/commands/review/utils/set-version.ts"],"sourcesContent":["import { execSync } from 'child_process';\nimport path from 'path';\nimport { Project } from '../types';\nimport { getKey } from './get-key';\n\ninterface Params {\n project: Project;\n packageName: string;\n dependency: string;\n version: string;\n key?: string;\n}\n\nexport function setVersion(params: Params) {\n const {\n project: { packages },\n packageName,\n dependency,\n version,\n } = params;\n const pkg = packages.find(({ name }) => name === packageName);\n if (!pkg) {\n return;\n }\n\n const key = params.key ?? getKey(pkg, dependency);\n if (!key) {\n return;\n }\n\n const workspace = path.relative('.', pkg.location);\n const command = `npm pkg set ${key}[\"${dependency}\"]=\"${version}\"${workspace ? ` -w ${workspace}` : ''}`;\n execSync(command);\n}\n"],"names":["setVersion","params","project","packages","packageName","dependency","version","pkg","find","name","key","getKey","workspace","path","relative","location","command","execSync"],"mappings":";;;;+BAagBA;;;eAAAA;;;+BAbS;6DACR;wBAEM;;;;;;AAUhB,SAASA,WAAWC,MAAc;QAYzBA;IAXZ,MAAM,EACFC,SAAS,EAAEC,QAAQ,EAAE,EACrBC,WAAW,EACXC,UAAU,EACVC,OAAO,EACV,GAAGL;IACJ,MAAMM,MAAMJ,SAASK,IAAI,CAAC,CAAC,EAAEC,IAAI,EAAE,GAAKA,SAASL;IACjD,IAAI,CAACG,KAAK;QACN;IACJ;IAEA,MAAMG,OAAMT,cAAAA,OAAOS,GAAG,cAAVT,yBAAAA,cAAcU,IAAAA,cAAM,EAACJ,KAAKF;IACtC,IAAI,CAACK,KAAK;QACN;IACJ;IAEA,MAAME,YAAYC,aAAI,CAACC,QAAQ,CAAC,KAAKP,IAAIQ,QAAQ;IACjD,MAAMC,UAAU,CAAC,YAAY,EAAEN,IAAI,EAAE,EAAEL,WAAW,IAAI,EAAEC,QAAQ,CAAC,EAAEM,YAAY,CAAC,IAAI,EAAEA,WAAW,GAAG,IAAI;IACxGK,IAAAA,uBAAQ,EAACD;AACb"}
|
|
@@ -1,13 +1,35 @@
|
|
|
1
|
-
import { Command
|
|
2
|
-
|
|
3
|
-
_:
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
import { Command } from './types';
|
|
2
|
+
declare const options: {
|
|
3
|
+
_: {
|
|
4
|
+
description: string;
|
|
5
|
+
array: true;
|
|
6
|
+
string: true;
|
|
7
|
+
};
|
|
8
|
+
taskName: {
|
|
9
|
+
string: true;
|
|
10
|
+
hidden: true;
|
|
11
|
+
};
|
|
12
|
+
taskArgs: {
|
|
13
|
+
array: true;
|
|
14
|
+
string: true;
|
|
15
|
+
hidden: true;
|
|
16
|
+
};
|
|
17
|
+
};
|
|
18
|
+
export declare class RunTask extends Command<typeof options> {
|
|
8
19
|
static readonly options: {
|
|
9
20
|
_: {
|
|
10
21
|
description: string;
|
|
22
|
+
array: true;
|
|
23
|
+
string: true;
|
|
24
|
+
};
|
|
25
|
+
taskName: {
|
|
26
|
+
string: true;
|
|
27
|
+
hidden: true;
|
|
28
|
+
};
|
|
29
|
+
taskArgs: {
|
|
30
|
+
array: true;
|
|
31
|
+
string: true;
|
|
32
|
+
hidden: true;
|
|
11
33
|
};
|
|
12
34
|
};
|
|
13
35
|
execute(): Promise<void>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"run-task.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/run-task.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,OAAO,
|
|
1
|
+
{"version":3,"file":"run-task.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/run-task.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,OAAO,EAAkB,MAAM,SAAS,CAAC;AAElD,QAAA,MAAM,OAAO;;;;;;;;;;;;;;;CAIa,CAAC;AAQ3B,qBAAa,OAAQ,SAAQ,OAAO,CAAC,OAAO,OAAO,CAAC;IAChD,MAAM,CAAC,QAAQ,CAAC,OAAO;;;;;;;;;;;;;;;MAAW;IAG5B,OAAO;CAchB"}
|