@servicetitan/startup 33.1.1 → 34.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli/commands/build.d.ts +48 -22
- package/dist/cli/commands/build.d.ts.map +1 -1
- package/dist/cli/commands/build.js +72 -52
- package/dist/cli/commands/build.js.map +1 -1
- package/dist/cli/commands/bundle-package.d.ts +54 -10
- package/dist/cli/commands/bundle-package.d.ts.map +1 -1
- package/dist/cli/commands/bundle-package.js +40 -0
- package/dist/cli/commands/bundle-package.js.map +1 -1
- package/dist/cli/commands/clean.d.ts +4 -0
- package/dist/cli/commands/clean.d.ts.map +1 -1
- package/dist/cli/commands/clean.js +50 -16
- package/dist/cli/commands/clean.js.map +1 -1
- package/dist/cli/commands/convert-eslint-config.d.ts +1 -1
- package/dist/cli/commands/convert-eslint-config.d.ts.map +1 -1
- package/dist/cli/commands/convert-eslint-config.js +2 -15
- package/dist/cli/commands/convert-eslint-config.js.map +1 -1
- package/dist/cli/commands/eslint.d.ts +29 -7
- package/dist/cli/commands/eslint.d.ts.map +1 -1
- package/dist/cli/commands/eslint.js +18 -6
- package/dist/cli/commands/eslint.js.map +1 -1
- package/dist/cli/commands/get-command.d.ts.map +1 -1
- package/dist/cli/commands/get-command.js +6 -0
- package/dist/cli/commands/get-command.js.map +1 -1
- package/dist/cli/commands/index.d.ts +2 -2
- package/dist/cli/commands/index.d.ts.map +1 -1
- package/dist/cli/commands/index.js +2 -2
- package/dist/cli/commands/index.js.map +1 -1
- package/dist/cli/commands/init.d.ts +10 -6
- package/dist/cli/commands/init.d.ts.map +1 -1
- package/dist/cli/commands/init.js +8 -6
- package/dist/cli/commands/init.js.map +1 -1
- package/dist/cli/commands/install.d.ts +27 -15
- package/dist/cli/commands/install.d.ts.map +1 -1
- package/dist/cli/commands/install.js +18 -16
- package/dist/cli/commands/install.js.map +1 -1
- package/dist/cli/commands/kendo-ui-license.d.ts +1 -0
- package/dist/cli/commands/kendo-ui-license.d.ts.map +1 -1
- package/dist/cli/commands/kendo-ui-license.js +1 -0
- package/dist/cli/commands/kendo-ui-license.js.map +1 -1
- package/dist/cli/commands/lint.d.ts +51 -17
- package/dist/cli/commands/lint.d.ts.map +1 -1
- package/dist/cli/commands/lint.js +36 -26
- package/dist/cli/commands/lint.js.map +1 -1
- package/dist/cli/commands/mfe-check.d.ts +52 -0
- package/dist/cli/commands/mfe-check.d.ts.map +1 -0
- package/dist/cli/commands/mfe-check.js +145 -0
- package/dist/cli/commands/mfe-check.js.map +1 -0
- package/dist/cli/commands/mfe-generate-metadata.d.ts +20 -0
- package/dist/cli/commands/mfe-generate-metadata.d.ts.map +1 -0
- package/dist/cli/commands/mfe-generate-metadata.js +93 -0
- package/dist/cli/commands/mfe-generate-metadata.js.map +1 -0
- package/dist/cli/commands/mfe-list.d.ts +52 -15
- package/dist/cli/commands/mfe-list.d.ts.map +1 -1
- package/dist/cli/commands/mfe-list.js +42 -29
- package/dist/cli/commands/mfe-list.js.map +1 -1
- package/dist/cli/commands/mfe-package-clean.d.ts +34 -15
- package/dist/cli/commands/mfe-package-clean.d.ts.map +1 -1
- package/dist/cli/commands/mfe-package-clean.js +43 -34
- package/dist/cli/commands/mfe-package-clean.js.map +1 -1
- package/dist/cli/commands/mfe-package-publish.d.ts +60 -22
- package/dist/cli/commands/mfe-package-publish.d.ts.map +1 -1
- package/dist/cli/commands/mfe-package-publish.js +137 -78
- package/dist/cli/commands/mfe-package-publish.js.map +1 -1
- package/dist/cli/commands/mfe-package-rollback.d.ts +40 -0
- package/dist/cli/commands/mfe-package-rollback.d.ts.map +1 -0
- package/dist/cli/commands/mfe-package-rollback.js +119 -0
- package/dist/cli/commands/mfe-package-rollback.js.map +1 -0
- package/dist/cli/commands/mfe-publish.d.ts +36 -11
- package/dist/cli/commands/mfe-publish.d.ts.map +1 -1
- package/dist/cli/commands/mfe-publish.js +72 -22
- package/dist/cli/commands/mfe-publish.js.map +1 -1
- package/dist/cli/commands/prepare-package.d.ts +14 -5
- package/dist/cli/commands/prepare-package.d.ts.map +1 -1
- package/dist/cli/commands/prepare-package.js +20 -0
- package/dist/cli/commands/prepare-package.js.map +1 -1
- package/dist/cli/commands/review/review.d.ts +17 -8
- package/dist/cli/commands/review/review.d.ts.map +1 -1
- package/dist/cli/commands/review/review.js +16 -21
- package/dist/cli/commands/review/review.js.map +1 -1
- package/dist/cli/commands/review/rules/index.d.ts.map +1 -1
- package/dist/cli/commands/review/rules/index.js +3 -1
- package/dist/cli/commands/review/rules/index.js.map +1 -1
- package/dist/cli/commands/review/rules/no-deprecated-content-base.js.map +1 -1
- package/dist/cli/commands/review/rules/prefer-open-ended-peer-dependencies.js.map +1 -1
- package/dist/cli/commands/review/rules/require-compatible-launch-darkly-sdk.js +4 -4
- package/dist/cli/commands/review/rules/require-compatible-launch-darkly-sdk.js.map +1 -1
- package/dist/cli/commands/review/rules/require-one-collection-version.js +1 -2
- package/dist/cli/commands/review/rules/require-one-collection-version.js.map +1 -1
- package/dist/cli/commands/review/rules/require-one-uikit-version.d.ts.map +1 -1
- package/dist/cli/commands/review/rules/require-one-uikit-version.js +1 -0
- package/dist/cli/commands/review/rules/require-one-uikit-version.js.map +1 -1
- package/dist/cli/commands/review/rules/require-project-version-in-root-node-modules.d.ts.map +1 -1
- package/dist/cli/commands/review/rules/require-project-version-in-root-node-modules.js +8 -8
- package/dist/cli/commands/review/rules/require-project-version-in-root-node-modules.js.map +1 -1
- package/dist/cli/commands/review/rules/require-tsconfig-references.d.ts +24 -0
- package/dist/cli/commands/review/rules/require-tsconfig-references.d.ts.map +1 -0
- package/dist/cli/commands/review/rules/require-tsconfig-references.js +146 -0
- package/dist/cli/commands/review/rules/require-tsconfig-references.js.map +1 -0
- package/dist/cli/commands/review/utils/collate-dependencies.js +1 -3
- package/dist/cli/commands/review/utils/collate-dependencies.js.map +1 -1
- package/dist/cli/commands/review/utils/compare-version.js +2 -2
- package/dist/cli/commands/review/utils/compare-version.js.map +1 -1
- package/dist/cli/commands/review/utils/set-version.js +1 -1
- package/dist/cli/commands/review/utils/set-version.js.map +1 -1
- package/dist/cli/commands/run-task.d.ts +29 -7
- package/dist/cli/commands/run-task.d.ts.map +1 -1
- package/dist/cli/commands/run-task.js +21 -8
- package/dist/cli/commands/run-task.js.map +1 -1
- package/dist/cli/commands/run-task.test.js +14 -2
- package/dist/cli/commands/run-task.test.js.map +1 -1
- package/dist/cli/commands/start.d.ts +38 -18
- package/dist/cli/commands/start.d.ts.map +1 -1
- package/dist/cli/commands/start.js +65 -45
- package/dist/cli/commands/start.js.map +1 -1
- package/dist/cli/commands/stylelint.d.ts +29 -7
- package/dist/cli/commands/stylelint.d.ts.map +1 -1
- package/dist/cli/commands/stylelint.js +18 -6
- package/dist/cli/commands/stylelint.js.map +1 -1
- package/dist/cli/commands/test/runners/vitest.js +1 -1
- package/dist/cli/commands/test/runners/vitest.js.map +1 -1
- package/dist/cli/commands/test/tests.d.ts +25 -5
- package/dist/cli/commands/test/tests.d.ts.map +1 -1
- package/dist/cli/commands/test/tests.js +22 -14
- package/dist/cli/commands/test/tests.js.map +1 -1
- package/dist/cli/commands/types.d.ts +51 -10
- package/dist/cli/commands/types.d.ts.map +1 -1
- package/dist/cli/commands/types.js +1 -0
- package/dist/cli/commands/types.js.map +1 -1
- package/dist/cli/commands/upload-sourcemaps.d.ts +26 -6
- package/dist/cli/commands/upload-sourcemaps.d.ts.map +1 -1
- package/dist/cli/commands/upload-sourcemaps.js +27 -4
- package/dist/cli/commands/upload-sourcemaps.js.map +1 -1
- package/dist/cli/commands/utils.d.ts +4 -0
- package/dist/cli/commands/utils.d.ts.map +1 -0
- package/dist/cli/commands/utils.js +28 -0
- package/dist/cli/commands/utils.js.map +1 -0
- package/dist/cli/index.js +8 -5
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/tasks/cli-task.d.ts.map +1 -1
- package/dist/cli/tasks/cli-task.js +1 -1
- package/dist/cli/tasks/cli-task.js.map +1 -1
- package/dist/cli/tasks/swc-compile-package.d.ts +1 -2
- package/dist/cli/tasks/swc-compile-package.d.ts.map +1 -1
- package/dist/cli/tasks/swc-compile-package.js.map +1 -1
- package/dist/cli/tasks/tsc-compile-package.d.ts +1 -2
- package/dist/cli/tasks/tsc-compile-package.d.ts.map +1 -1
- package/dist/cli/tasks/tsc-compile-package.js.map +1 -1
- package/dist/cli/tasks/tsc-compile.d.ts +1 -2
- package/dist/cli/tasks/tsc-compile.d.ts.map +1 -1
- package/dist/cli/tasks/tsc-compile.js.map +1 -1
- package/dist/cli/utils/bundle.d.ts.map +1 -1
- package/dist/cli/utils/bundle.js +2 -2
- package/dist/cli/utils/bundle.js.map +1 -1
- package/dist/cli/utils/check-startup-location.d.ts +4 -0
- package/dist/cli/utils/check-startup-location.d.ts.map +1 -0
- package/dist/cli/utils/check-startup-location.js +27 -0
- package/dist/cli/utils/check-startup-location.js.map +1 -0
- package/dist/cli/utils/cli-npm.d.ts +6 -0
- package/dist/cli/utils/cli-npm.d.ts.map +1 -1
- package/dist/cli/utils/cli-npm.js +25 -3
- package/dist/cli/utils/cli-npm.js.map +1 -1
- package/dist/cli/utils/compile-less.js +1 -1
- package/dist/cli/utils/compile-less.js.map +1 -1
- package/dist/cli/utils/constants.d.ts +2 -0
- package/dist/cli/utils/constants.d.ts.map +1 -0
- package/dist/cli/utils/constants.js +13 -0
- package/dist/cli/utils/constants.js.map +1 -0
- package/dist/cli/utils/copy-files.d.ts.map +1 -1
- package/dist/cli/utils/copy-files.js.map +1 -1
- package/dist/cli/utils/eslint.d.ts +1 -2
- package/dist/cli/utils/eslint.d.ts.map +1 -1
- package/dist/cli/utils/eslint.js.map +1 -1
- package/dist/cli/utils/index.d.ts +2 -0
- package/dist/cli/utils/index.d.ts.map +1 -1
- package/dist/cli/utils/index.js +2 -0
- package/dist/cli/utils/index.js.map +1 -1
- package/dist/cli/utils/is-module-installed.js +1 -1
- package/dist/cli/utils/is-module-installed.js.map +1 -1
- package/dist/cli/utils/lerna-exec.d.ts.map +1 -1
- package/dist/cli/utils/lerna-exec.js +1 -3
- package/dist/cli/utils/lerna-exec.js.map +1 -1
- package/dist/cli/utils/process-tree.js.map +1 -1
- package/dist/cli/utils/set-node-options.js +2 -4
- package/dist/cli/utils/set-node-options.js.map +1 -1
- package/dist/cli/utils/stylelint.d.ts +1 -2
- package/dist/cli/utils/stylelint.d.ts.map +1 -1
- package/dist/cli/utils/stylelint.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/jest/resolver.js +2 -2
- package/dist/jest/resolver.js.map +1 -1
- package/dist/jest/svg-transformer.d.ts.map +1 -1
- package/dist/jest/svg-transformer.js.map +1 -1
- package/dist/utils/find-packages.js +1 -1
- package/dist/utils/find-packages.js.map +1 -1
- package/dist/utils/format-relative-date.js +1 -1
- package/dist/utils/format-relative-date.js.map +1 -1
- package/dist/utils/get-configuration.d.ts +3 -0
- package/dist/utils/get-configuration.d.ts.map +1 -1
- package/dist/utils/get-configuration.js +14 -11
- package/dist/utils/get-configuration.js.map +1 -1
- package/dist/utils/get-destination-folders.d.ts.map +1 -1
- package/dist/utils/get-destination-folders.js.map +1 -1
- package/dist/utils/get-folders.d.ts.map +1 -1
- package/dist/utils/get-folders.js.map +1 -1
- package/dist/utils/get-jest-config.js +1 -1
- package/dist/utils/get-jest-config.js.map +1 -1
- package/dist/utils/get-package-data.js +1 -1
- package/dist/utils/get-package-data.js.map +1 -1
- package/dist/utils/get-packages.js.map +1 -1
- package/dist/utils/index.d.ts +1 -0
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/index.js +1 -0
- package/dist/utils/index.js.map +1 -1
- package/dist/utils/load-shared-dependencies.js.map +1 -1
- package/dist/utils/prettify.d.ts +13 -0
- package/dist/utils/prettify.d.ts.map +1 -0
- package/dist/utils/prettify.js +48 -0
- package/dist/utils/prettify.js.map +1 -0
- package/dist/utils/read-json.js +1 -1
- package/dist/utils/read-json.js.map +1 -1
- package/dist/utils/transform-svg.js +2 -2
- package/dist/utils/transform-svg.js.map +1 -1
- package/dist/webpack/configs/cache-config.js +1 -1
- package/dist/webpack/configs/cache-config.js.map +1 -1
- package/dist/webpack/configs/optimization-config.js +3 -4
- package/dist/webpack/configs/optimization-config.js.map +1 -1
- package/dist/webpack/configs/output-config.js +1 -1
- package/dist/webpack/configs/output-config.js.map +1 -1
- package/dist/webpack/configs/plugins/assets-manifest-plugin.d.ts.map +1 -1
- package/dist/webpack/configs/plugins/assets-manifest-plugin.js +5 -5
- package/dist/webpack/configs/plugins/assets-manifest-plugin.js.map +1 -1
- package/dist/webpack/configs/plugins/bundle-analyser-plugin.d.ts.map +1 -1
- package/dist/webpack/configs/plugins/bundle-analyser-plugin.js +1 -1
- package/dist/webpack/configs/plugins/bundle-analyser-plugin.js.map +1 -1
- package/dist/webpack/configs/plugins/define-exposed-dependencies-plugin.d.ts.map +1 -1
- package/dist/webpack/configs/plugins/define-exposed-dependencies-plugin.js +6 -9
- package/dist/webpack/configs/plugins/define-exposed-dependencies-plugin.js.map +1 -1
- package/dist/webpack/configs/plugins/html-tags-plugin.js +1 -1
- package/dist/webpack/configs/plugins/html-tags-plugin.js.map +1 -1
- package/dist/webpack/configs/plugins/ignore-plugin/check-resource.js +1 -1
- package/dist/webpack/configs/plugins/ignore-plugin/check-resource.js.map +1 -1
- package/dist/webpack/configs/plugins/ignore-plugin/ignore-plugin.d.ts.map +1 -1
- package/dist/webpack/configs/plugins/ignore-plugin/ignore-plugin.js.map +1 -1
- package/dist/webpack/configs/plugins/moment-locales-plugin.js +1 -1
- package/dist/webpack/configs/plugins/moment-locales-plugin.js.map +1 -1
- package/dist/webpack/configs/plugins/watch-run-plugin.d.ts.map +1 -1
- package/dist/webpack/configs/plugins/watch-run-plugin.js.map +1 -1
- package/dist/webpack/configs/types.d.ts +1 -0
- package/dist/webpack/configs/types.d.ts.map +1 -1
- package/dist/webpack/configs/utils/build-metadata.d.ts +10 -0
- package/dist/webpack/configs/utils/build-metadata.d.ts.map +1 -0
- package/dist/webpack/configs/utils/build-metadata.js +50 -0
- package/dist/webpack/configs/utils/build-metadata.js.map +1 -0
- package/dist/webpack/configs/utils/generate-metadata.d.ts.map +1 -1
- package/dist/webpack/configs/utils/generate-metadata.js +5 -24
- package/dist/webpack/configs/utils/generate-metadata.js.map +1 -1
- package/dist/webpack/configs/utils/get-exposed-dependencies.d.ts +3 -0
- package/dist/webpack/configs/utils/get-exposed-dependencies.d.ts.map +1 -0
- package/dist/webpack/configs/utils/get-exposed-dependencies.js +21 -0
- package/dist/webpack/configs/utils/get-exposed-dependencies.js.map +1 -0
- package/dist/webpack/configs/utils/get-launchdarkly-sdk-version.js +1 -1
- package/dist/webpack/configs/utils/get-launchdarkly-sdk-version.js.map +1 -1
- package/dist/webpack/configs/utils/index.d.ts +1 -0
- package/dist/webpack/configs/utils/index.d.ts.map +1 -1
- package/dist/webpack/configs/utils/index.js +1 -0
- package/dist/webpack/configs/utils/index.js.map +1 -1
- package/dist/webpack/create-webpack-config.js +10 -4
- package/dist/webpack/create-webpack-config.js.map +1 -1
- package/dist/webpack/loaders/expose-loader/index.d.ts.map +1 -1
- package/dist/webpack/loaders/expose-loader/index.js.map +1 -1
- package/dist/webpack/loaders/expose-loader/runtime/get-global-this.js +1 -1
- package/dist/webpack/loaders/expose-loader/runtime/get-global-this.js.map +1 -1
- package/dist/webpack/loaders/expose-loader/utils/get-new-user-request.js +2 -2
- package/dist/webpack/loaders/expose-loader/utils/get-new-user-request.js.map +1 -1
- package/dist/webpack/utils/stringify-config.js +2 -2
- package/dist/webpack/utils/stringify-config.js.map +1 -1
- package/dist/webpack/utils/testing/get-compiler.d.ts.map +1 -1
- package/dist/webpack/utils/testing/get-compiler.js +1 -1
- package/dist/webpack/utils/testing/get-compiler.js.map +1 -1
- package/dist/webpack/utils/testing/get-errors.d.ts.map +1 -1
- package/dist/webpack/utils/testing/get-errors.js.map +1 -1
- package/dist/webpack/utils/testing/get-warnings.d.ts.map +1 -1
- package/dist/webpack/utils/testing/get-warnings.js.map +1 -1
- package/dist/webpack/utils/testing/read-asset.d.ts.map +1 -1
- package/dist/webpack/utils/testing/read-asset.js +1 -1
- package/dist/webpack/utils/testing/read-asset.js.map +1 -1
- package/dist/webpack/utils/testing/read-assets.d.ts.map +1 -1
- package/dist/webpack/utils/testing/read-assets.js.map +1 -1
- package/package.json +35 -41
- package/src/cli/commands/__tests__/build.test.ts +32 -9
- package/src/cli/commands/__tests__/bundle-package.test.ts +2 -1
- package/src/cli/commands/__tests__/clean.test.ts +99 -8
- package/src/cli/commands/__tests__/convert-eslint-config.test.ts +14 -9
- package/src/cli/commands/__tests__/eslint.test.ts +1 -1
- package/src/cli/commands/__tests__/get-command.test.ts +3 -1
- package/src/cli/commands/__tests__/init.test.ts +14 -1
- package/src/cli/commands/__tests__/install.test.ts +6 -2
- package/src/cli/commands/__tests__/kendo-ui-license.test.ts +7 -2
- package/src/cli/commands/__tests__/lint.test.ts +4 -2
- package/src/cli/commands/__tests__/mfe-check.test.ts +346 -0
- package/src/cli/commands/__tests__/mfe-generate-metadata.test.ts +160 -0
- package/src/cli/commands/__tests__/mfe-list.test.ts +8 -1
- package/src/cli/commands/__tests__/mfe-package-clean.test.ts +0 -1
- package/src/cli/commands/__tests__/mfe-package-publish.test.ts +322 -93
- package/src/cli/commands/__tests__/mfe-package-rollback.test.ts +196 -0
- package/src/cli/commands/__tests__/mfe-publish.test.ts +65 -5
- package/src/cli/commands/__tests__/prepare-package.test.ts +3 -0
- package/src/cli/commands/__tests__/start.test.ts +30 -7
- package/src/cli/commands/__tests__/stylelint.test.ts +1 -1
- package/src/cli/commands/__tests__/styles-check.test.ts +1 -2
- package/src/cli/commands/__tests__/upload-sourcemaps.test.ts +3 -6
- package/src/cli/commands/build.ts +35 -26
- package/src/cli/commands/bundle-package.ts +11 -10
- package/src/cli/commands/clean.ts +51 -5
- package/src/cli/commands/convert-eslint-config.ts +3 -12
- package/src/cli/commands/eslint.ts +9 -11
- package/src/cli/commands/get-command.ts +6 -1
- package/src/cli/commands/index.ts +2 -2
- package/src/cli/commands/init.ts +7 -9
- package/src/cli/commands/install.ts +11 -13
- package/src/cli/commands/kendo-ui-license.ts +1 -1
- package/src/cli/commands/lint.ts +12 -18
- package/src/cli/commands/mfe-check.ts +166 -0
- package/src/cli/commands/mfe-generate-metadata.ts +69 -0
- package/src/cli/commands/mfe-list.ts +28 -30
- package/src/cli/commands/mfe-package-clean.ts +29 -34
- package/src/cli/commands/mfe-package-publish.ts +153 -87
- package/src/cli/commands/mfe-package-rollback.ts +100 -0
- package/src/cli/commands/mfe-publish.ts +80 -27
- package/src/cli/commands/prepare-package.ts +6 -5
- package/src/cli/commands/review/__tests__/review.test.ts +18 -19
- package/src/cli/commands/review/review.ts +11 -20
- package/src/cli/commands/review/rules/__tests__/no-deprecated-content-base.test.ts +1 -1
- package/src/cli/commands/review/rules/__tests__/no-deprecated-startup-install.test.ts +0 -1
- package/src/cli/commands/review/rules/__tests__/no-direct-peer-dependencies.test.ts +1 -1
- package/src/cli/commands/review/rules/__tests__/no-typescript-entry-point.test.ts +0 -1
- package/src/cli/commands/review/rules/__tests__/require-all-react-dependencies.test.ts +0 -1
- package/src/cli/commands/review/rules/__tests__/require-compatible-launch-darkly-sdk.test.ts +2 -2
- package/src/cli/commands/review/rules/__tests__/require-explicit-side-effects.test.ts +0 -1
- package/src/cli/commands/review/rules/__tests__/require-npmrc.test.ts +0 -1
- package/src/cli/commands/review/rules/__tests__/require-one-anvil-uikit-contrib-version.test.ts +1 -2
- package/src/cli/commands/review/rules/__tests__/require-one-collection-version.test.ts +0 -1
- package/src/cli/commands/review/rules/__tests__/require-one-package-version.test.ts +0 -1
- package/src/cli/commands/review/rules/__tests__/require-one-react-version.test.ts +0 -1
- package/src/cli/commands/review/rules/__tests__/require-one-uikit-version.test.ts +1 -1
- package/src/cli/commands/review/rules/__tests__/require-project-version-in-root-node-modules.test.ts +2 -3
- package/src/cli/commands/review/rules/__tests__/require-servicetitan-scope.test.ts +0 -1
- package/src/cli/commands/review/rules/__tests__/require-tsconfig-references.test.ts +315 -0
- package/src/cli/commands/review/rules/index.ts +2 -0
- package/src/cli/commands/review/rules/require-compatible-launch-darkly-sdk.ts +1 -1
- package/src/cli/commands/review/rules/require-one-uikit-version.ts +1 -0
- package/src/cli/commands/review/rules/require-project-version-in-root-node-modules.ts +3 -3
- package/src/cli/commands/review/rules/require-tsconfig-references.ts +157 -0
- package/src/cli/commands/review/utils/__tests__/set-version.test.ts +0 -1
- package/src/cli/commands/run-task.test.ts +15 -3
- package/src/cli/commands/run-task.ts +12 -14
- package/src/cli/commands/start.ts +75 -59
- package/src/cli/commands/stylelint.ts +9 -11
- package/src/cli/commands/test/runners/__tests__/jest.test.ts +1 -2
- package/src/cli/commands/test/runners/vitest.ts +1 -1
- package/src/cli/commands/test/tests.ts +13 -15
- package/src/cli/commands/types.ts +53 -7
- package/src/cli/commands/upload-sourcemaps.ts +14 -12
- package/src/cli/commands/utils.ts +6 -0
- package/src/cli/index.ts +11 -7
- package/src/cli/tasks/__tests__/cli-task.test.ts +1 -1
- package/src/cli/tasks/__tests__/swc-compile-package.test.ts +3 -1
- package/src/cli/tasks/__tests__/tsc-compile-package.test.ts +2 -0
- package/src/cli/tasks/__tests__/tsc-compile.test.ts +3 -13
- package/src/cli/tasks/cli-task.ts +1 -1
- package/src/cli/tasks/swc-compile-package.ts +1 -3
- package/src/cli/tasks/tsc-compile-package.ts +1 -2
- package/src/cli/tasks/tsc-compile.ts +1 -2
- package/src/cli/utils/__tests__/bundle.test.ts +1 -2
- package/src/cli/utils/__tests__/check-args.test.ts +1 -1
- package/src/cli/utils/__tests__/check-startup-location.test.ts +88 -0
- package/src/cli/utils/__tests__/cli-git.test.ts +1 -2
- package/src/cli/utils/__tests__/cli-npm.test.ts +51 -2
- package/src/cli/utils/__tests__/cli-os.test.ts +1 -2
- package/src/cli/utils/__tests__/compile.test.ts +1 -1
- package/src/cli/utils/__tests__/copy-files.test.ts +0 -1
- package/src/cli/utils/__tests__/eslint.test.ts +1 -1
- package/src/cli/utils/__tests__/lerna-exec.test.ts +1 -2
- package/src/cli/utils/__tests__/maybe-create-git-folder.test.ts +0 -1
- package/src/cli/utils/__tests__/set-node-options.test.ts +0 -1
- package/src/cli/utils/__tests__/stylelint.test.ts +1 -1
- package/src/cli/utils/bundle.ts +1 -3
- package/src/cli/utils/check-startup-location.ts +21 -0
- package/src/cli/utils/cli-npm.ts +22 -0
- package/src/cli/utils/compile-less.ts +1 -1
- package/src/cli/utils/constants.ts +1 -0
- package/src/cli/utils/copy-files.ts +0 -1
- package/src/cli/utils/eslint.ts +1 -3
- package/src/cli/utils/index.ts +2 -0
- package/src/cli/utils/lerna-exec.ts +0 -1
- package/src/cli/utils/stylelint.ts +1 -2
- package/src/index.ts +1 -1
- package/src/jest/svg-transformer.ts +0 -1
- package/src/utils/__tests__/get-branch-configs.test.ts +0 -1
- package/src/utils/__tests__/get-configuration.test.ts +0 -1
- package/src/utils/__tests__/get-destination-folders.test.ts +1 -2
- package/src/utils/__tests__/get-folders.test.ts +0 -1
- package/src/utils/__tests__/get-jest-config.test.ts +1 -2
- package/src/utils/__tests__/get-package-data.test.ts +1 -2
- package/src/utils/__tests__/get-packages.test.ts +1 -1
- package/src/utils/__tests__/get-startup-version.test.ts +0 -1
- package/src/utils/__tests__/get-tsconfig.test.ts +0 -1
- package/src/utils/__tests__/load-shared-dependencies.test.ts +1 -1
- package/src/utils/__tests__/log.test.ts +1 -1
- package/src/utils/__tests__/prettify.test.ts +80 -0
- package/src/utils/__tests__/read-json.test.ts +0 -1
- package/src/utils/find-packages.ts +1 -1
- package/src/utils/get-configuration.ts +8 -7
- package/src/utils/get-destination-folders.ts +0 -1
- package/src/utils/get-folders.ts +0 -1
- package/src/utils/get-jest-config.ts +1 -1
- package/src/utils/index.ts +1 -0
- package/src/utils/prettify.ts +36 -0
- package/src/webpack/__tests__/create-webpack-config-shared-dependencies.test.ts +6 -2
- package/src/webpack/__tests__/create-webpack-config-web-component.test.ts +7 -4
- package/src/webpack/__tests__/create-webpack-config.test.ts +8 -4
- package/src/webpack/configs/cache-config.ts +1 -1
- package/src/webpack/configs/plugins/assets-manifest-plugin.ts +1 -1
- package/src/webpack/configs/plugins/bundle-analyser-plugin.ts +2 -2
- package/src/webpack/configs/plugins/define-exposed-dependencies-plugin.ts +6 -15
- package/src/webpack/configs/plugins/ignore-plugin/__tests__/get-package-json.test.ts +1 -1
- package/src/webpack/configs/plugins/ignore-plugin/__tests__/is-optional-peer-dependency.test.ts +1 -1
- package/src/webpack/configs/plugins/ignore-plugin/ignore-plugin.ts +0 -1
- package/src/webpack/configs/plugins/watch-run-plugin.ts +0 -1
- package/src/webpack/configs/types.ts +1 -0
- package/src/webpack/configs/utils/__tests__/build-metadata.test.ts +71 -0
- package/src/webpack/configs/utils/__tests__/generate-metadata.test.ts +42 -46
- package/src/webpack/configs/utils/__tests__/get-exposed-dependencies.test.ts +39 -0
- package/src/webpack/configs/utils/__tests__/get-web-components-version.test.ts +0 -1
- package/src/webpack/configs/utils/build-metadata.ts +40 -0
- package/src/webpack/configs/utils/generate-metadata.ts +7 -21
- package/src/webpack/configs/utils/get-exposed-dependencies.ts +17 -0
- package/src/webpack/configs/utils/index.ts +1 -0
- package/src/webpack/create-webpack-config.ts +3 -3
- package/src/webpack/loaders/expose-loader/__tests__/index.test.ts +0 -2
- package/src/webpack/loaders/expose-loader/index.ts +0 -1
- package/src/webpack/utils/testing/get-compiler.ts +1 -3
- package/src/webpack/utils/testing/get-errors.ts +0 -1
- package/src/webpack/utils/testing/get-warnings.ts +0 -1
- package/src/webpack/utils/testing/read-asset.ts +1 -2
- package/src/webpack/utils/testing/read-assets.ts +0 -1
|
@@ -3,22 +3,14 @@ import { execSync } from 'child_process';
|
|
|
3
3
|
import { fs, vol } from 'memfs';
|
|
4
4
|
import path from 'path';
|
|
5
5
|
import terminalLink from 'terminal-link';
|
|
6
|
-
|
|
6
|
+
import type { ProjectPackage } from '../../../../utils';
|
|
7
7
|
import { findPackages, getReviewConfiguration, log } from '../../../../utils';
|
|
8
8
|
import { expectCalls } from '../__mocks__';
|
|
9
|
+
import { Review } from '../review';
|
|
9
10
|
import { rules } from '../rules';
|
|
10
|
-
import {
|
|
11
|
-
ErrorSeverity,
|
|
12
|
-
FixCategory,
|
|
13
|
-
Level,
|
|
14
|
-
Package,
|
|
15
|
-
PackageError,
|
|
16
|
-
ReviewConfiguration,
|
|
17
|
-
} from '../types';
|
|
11
|
+
import { ErrorSeverity, FixCategory, Level, PackageError, ReviewConfiguration } from '../types';
|
|
18
12
|
import { indent } from '../utils';
|
|
19
13
|
|
|
20
|
-
import { Review } from '../review';
|
|
21
|
-
|
|
22
14
|
jest.mock('child_process', () => ({ execSync: jest.fn() }));
|
|
23
15
|
jest.mock('fs', () => fs);
|
|
24
16
|
jest.mock('terminal-link', () => jest.fn());
|
|
@@ -68,6 +60,10 @@ describe(`[startup] ${Review.name}`, () => {
|
|
|
68
60
|
});
|
|
69
61
|
}
|
|
70
62
|
|
|
63
|
+
test('allows running from global location', () => {
|
|
64
|
+
expect(Review.allowRunFromGlobal).toBe(true);
|
|
65
|
+
});
|
|
66
|
+
|
|
71
67
|
describe('when not run from workspace root', () => {
|
|
72
68
|
beforeEach(() => vol.fromJSON({}));
|
|
73
69
|
|
|
@@ -77,15 +73,17 @@ describe(`[startup] ${Review.name}`, () => {
|
|
|
77
73
|
describe('when run from workspace root', () => {
|
|
78
74
|
const rootPackageJSON = { name: 'root', workspaces: ['packages/*'] };
|
|
79
75
|
const packageLockJSON = { packages: {} };
|
|
80
|
-
const packages:
|
|
76
|
+
const packages: ProjectPackage[] = [
|
|
81
77
|
{
|
|
82
78
|
name: 'a',
|
|
79
|
+
version: '1.0.0',
|
|
83
80
|
dependencies: { foo: '1.0.1', bar: '1.0.0' },
|
|
84
81
|
devDependencies: { qux: 'file:.yalc/qux' }, // test ignores non-version dependencies
|
|
85
82
|
location: 'a',
|
|
86
83
|
},
|
|
87
84
|
{
|
|
88
85
|
name: 'b',
|
|
86
|
+
version: '1.0.0',
|
|
89
87
|
dependencies: { foo: '1.0.0', bar: '1.0.0' },
|
|
90
88
|
devDependencies: { baz: '1.0.0' },
|
|
91
89
|
location: 'b',
|
|
@@ -152,13 +150,13 @@ describe(`[startup] ${Review.name}`, () => {
|
|
|
152
150
|
});
|
|
153
151
|
|
|
154
152
|
describe('with --rule option', () => {
|
|
155
|
-
beforeEach(() => (args.rule = rules[0].id));
|
|
153
|
+
beforeEach(() => (args.rule = [rules[0].id]));
|
|
156
154
|
|
|
157
155
|
test('runs only specified rule', async () => {
|
|
158
156
|
await subject();
|
|
159
157
|
|
|
160
158
|
rules.forEach(rule => {
|
|
161
|
-
if (args.rule
|
|
159
|
+
if (args.rule?.includes(rule.id)) {
|
|
162
160
|
expect(rule.run).toHaveBeenCalled();
|
|
163
161
|
} else {
|
|
164
162
|
expect(rule.run).not.toHaveBeenCalled();
|
|
@@ -278,9 +276,10 @@ describe(`[startup] ${Review.name}`, () => {
|
|
|
278
276
|
test('regenerates lockfile', async () => {
|
|
279
277
|
await subject();
|
|
280
278
|
|
|
281
|
-
expect(execSync).toHaveBeenCalledWith(
|
|
282
|
-
|
|
283
|
-
|
|
279
|
+
expect(execSync).toHaveBeenCalledWith(
|
|
280
|
+
'npx @servicetitan/install --fix --quiet',
|
|
281
|
+
{ stdio: 'inherit' }
|
|
282
|
+
);
|
|
284
283
|
});
|
|
285
284
|
|
|
286
285
|
test('summarizes fixes and remaining problems', async () => {
|
|
@@ -452,7 +451,7 @@ describe(`[startup] ${Review.name}`, () => {
|
|
|
452
451
|
|
|
453
452
|
const execStartupInstallWithFixOption = [
|
|
454
453
|
execSync,
|
|
455
|
-
'npx
|
|
454
|
+
'npx @servicetitan/install --fix --quiet',
|
|
456
455
|
{ stdio: 'inherit' },
|
|
457
456
|
];
|
|
458
457
|
|
|
@@ -467,7 +466,7 @@ describe(`[startup] ${Review.name}`, () => {
|
|
|
467
466
|
});
|
|
468
467
|
|
|
469
468
|
describe('with --rule option', () => {
|
|
470
|
-
beforeEach(() => (args.rule = rules[1].id));
|
|
469
|
+
beforeEach(() => (args.rule = [rules[1].id]));
|
|
471
470
|
|
|
472
471
|
test('fixes only specified rule', async () => {
|
|
473
472
|
await subject();
|
|
@@ -9,8 +9,8 @@ import {
|
|
|
9
9
|
readJsonSafe,
|
|
10
10
|
toArray,
|
|
11
11
|
} from '../../../utils';
|
|
12
|
-
import { Command,
|
|
13
|
-
|
|
12
|
+
import { Command, CommandOptions } from '../types';
|
|
13
|
+
import { rules } from './rules';
|
|
14
14
|
import {
|
|
15
15
|
ErrorSeverity,
|
|
16
16
|
FixCategory,
|
|
@@ -29,21 +29,18 @@ import {
|
|
|
29
29
|
pluralize,
|
|
30
30
|
summarize,
|
|
31
31
|
} from './utils';
|
|
32
|
-
import { rules } from './rules';
|
|
33
32
|
|
|
34
33
|
const collator = new Intl.Collator();
|
|
35
34
|
|
|
36
|
-
|
|
37
|
-
fix
|
|
38
|
-
rule
|
|
39
|
-
}
|
|
35
|
+
const options = {
|
|
36
|
+
fix: { boolean: true, description: 'Fix detected problems' },
|
|
37
|
+
rule: { array: true, string: true, description: 'Limit checks to specified rule(s)' },
|
|
38
|
+
} satisfies CommandOptions;
|
|
40
39
|
|
|
41
|
-
export class Review extends Command<
|
|
40
|
+
export class Review extends Command<typeof options> {
|
|
41
|
+
static readonly allowRunFromGlobal = true;
|
|
42
42
|
static readonly description = 'Check project for configuration errors';
|
|
43
|
-
static readonly options =
|
|
44
|
-
fix: { boolean: true, description: 'Fix detected problems' },
|
|
45
|
-
rule: { array: true, description: 'Limit checks to specified rule(s)' },
|
|
46
|
-
};
|
|
43
|
+
static readonly options = options;
|
|
47
44
|
|
|
48
45
|
private readonly severityToLabel: Record<ErrorSeverity, string> = {
|
|
49
46
|
[ErrorSeverity.warning]: chalk.yellow('warning'),
|
|
@@ -121,7 +118,7 @@ export class Review extends Command<Args> {
|
|
|
121
118
|
}
|
|
122
119
|
});
|
|
123
120
|
|
|
124
|
-
execSync('npx
|
|
121
|
+
execSync('npx @servicetitan/install --fix --quiet', { stdio: 'inherit' });
|
|
125
122
|
project = this.createProject();
|
|
126
123
|
errors = this.findErrors(project);
|
|
127
124
|
}
|
|
@@ -225,13 +222,7 @@ export class Review extends Command<Args> {
|
|
|
225
222
|
|
|
226
223
|
private getSelectedRules() {
|
|
227
224
|
const rule = this.args.rule;
|
|
228
|
-
|
|
229
|
-
return new Set([rule]);
|
|
230
|
-
}
|
|
231
|
-
if (Array.isArray(rule)) {
|
|
232
|
-
return new Set(rule.filter(id => !!id));
|
|
233
|
-
}
|
|
234
|
-
return undefined;
|
|
225
|
+
return rule ? new Set(rule.filter(id => !!id)) : undefined;
|
|
235
226
|
}
|
|
236
227
|
}
|
|
237
228
|
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { execSync } from 'child_process';
|
|
2
2
|
import path from 'path';
|
|
3
|
+
import { expectCalls } from '../../__mocks__';
|
|
3
4
|
import {
|
|
4
5
|
ErrorSeverity,
|
|
5
6
|
FixCategory,
|
|
@@ -7,7 +8,6 @@ import {
|
|
|
7
8
|
PackageError,
|
|
8
9
|
ReviewConfiguration,
|
|
9
10
|
} from '../../types';
|
|
10
|
-
import { expectCalls } from '../../__mocks__';
|
|
11
11
|
import { mockConfig, mockProject } from '../__mocks__';
|
|
12
12
|
import { NoDeprecatedContentBase } from '../no-deprecated-content-base';
|
|
13
13
|
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { execSync } from 'child_process';
|
|
2
2
|
import { FixCategory, Package, PackageError, ReviewConfiguration } from '../../types';
|
|
3
3
|
import { mockProject } from '../__mocks__';
|
|
4
|
-
|
|
5
4
|
import { NoDeprecatedStartupInstall } from '../no-deprecated-startup-install';
|
|
6
5
|
|
|
7
6
|
jest.mock('child_process', () => ({ execSync: jest.fn() }));
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { execSync } from 'child_process';
|
|
2
2
|
import path from 'path';
|
|
3
|
-
import { FixCategory, Package, PackageError, ReviewConfiguration } from '../../types';
|
|
4
3
|
import { expectCalls } from '../../__mocks__';
|
|
4
|
+
import { FixCategory, Package, PackageError, ReviewConfiguration } from '../../types';
|
|
5
5
|
import { mockConfig, mockProject } from '../__mocks__';
|
|
6
6
|
import { NoDirectPeerDependencies } from '../no-direct-peer-dependencies';
|
|
7
7
|
|
|
@@ -3,7 +3,6 @@ import path from 'path';
|
|
|
3
3
|
import { getFolders } from '../../../../../utils';
|
|
4
4
|
import { FixCategory, Package, ReviewConfiguration } from '../../types';
|
|
5
5
|
import { mockConfig, mockProject } from '../__mocks__';
|
|
6
|
-
|
|
7
6
|
import { NoTypescriptEntryPoint } from '../no-typescript-entry-point';
|
|
8
7
|
|
|
9
8
|
jest.mock('child_process', () => ({ execSync: jest.fn() }));
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { FixCategory, Project, ReviewConfiguration } from '../../types';
|
|
2
2
|
import { setVersion } from '../../utils';
|
|
3
3
|
import { mockConfig, mockPackages, mockProject } from '../__mocks__';
|
|
4
|
-
|
|
5
4
|
import { RequireAllReactDependencies } from '../require-all-react-dependencies';
|
|
6
5
|
|
|
7
6
|
jest.mock('../../utils', () => ({
|
package/src/cli/commands/review/rules/__tests__/require-compatible-launch-darkly-sdk.test.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import chalk from 'chalk';
|
|
2
2
|
import { execSync } from 'child_process';
|
|
3
|
+
import { expectCalls } from '../../__mocks__';
|
|
3
4
|
import { FixCategory, Package, PackageError, Project, ReviewConfiguration } from '../../types';
|
|
4
5
|
import { setVersion } from '../../utils';
|
|
5
|
-
import { expectCalls } from '../../__mocks__';
|
|
6
6
|
import { mockConfig, mockPackages, mockProject } from '../__mocks__';
|
|
7
7
|
import { RequireCompatibleLaunchDarklySdk } from '../require-compatible-launch-darkly-sdk';
|
|
8
8
|
|
|
@@ -241,7 +241,7 @@ describe(`[startup] Review ${RequireCompatibleLaunchDarklySdk.name}`, () => {
|
|
|
241
241
|
expectCalls(
|
|
242
242
|
...[
|
|
243
243
|
`npm pkg set dependencies["${JS_CLIENT_SDK}"]=${sdkVersions.ldService}`,
|
|
244
|
-
'npx
|
|
244
|
+
'npx @servicetitan/install --fix --quiet',
|
|
245
245
|
`npm pkg delete dependencies["${JS_CLIENT_SDK}"]`,
|
|
246
246
|
].map(command => [execSync, command, { stdio: 'inherit' }])
|
|
247
247
|
);
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { ErrorSeverity, Package, ReviewConfiguration } from '../../types';
|
|
2
2
|
import { mockConfig, mockProject } from '../__mocks__';
|
|
3
|
-
|
|
4
3
|
import { RequireExplicitSideEffects } from '../require-explicit-side-effects';
|
|
5
4
|
|
|
6
5
|
describe(`[startup] Review ${RequireExplicitSideEffects.name}`, () => {
|
package/src/cli/commands/review/rules/__tests__/require-one-anvil-uikit-contrib-version.test.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { RequireOneCollectionVersion } from '../require-one-collection-version';
|
|
2
|
-
|
|
3
1
|
import { RequireOneAnvilUikitContribVersion } from '../require-one-anvil-uikit-contrib-version';
|
|
2
|
+
import { RequireOneCollectionVersion } from '../require-one-collection-version';
|
|
4
3
|
|
|
5
4
|
jest.mock('../require-one-collection-version');
|
|
6
5
|
|
|
@@ -3,7 +3,6 @@ import path from 'path';
|
|
|
3
3
|
import { FixCategory, Project, ReviewConfiguration } from '../../types';
|
|
4
4
|
import { setVersion } from '../../utils';
|
|
5
5
|
import { mockConfig, mockPackages, mockProject } from '../__mocks__';
|
|
6
|
-
|
|
7
6
|
import { RequireOneCollectionVersion } from '../require-one-collection-version';
|
|
8
7
|
|
|
9
8
|
jest.mock('../../utils', () => ({
|
|
@@ -3,7 +3,6 @@ import path from 'path';
|
|
|
3
3
|
import { FixCategory, Project, ReviewConfiguration } from '../../types';
|
|
4
4
|
import { setVersion } from '../../utils';
|
|
5
5
|
import { mockConfig, mockPackages, mockProject } from '../__mocks__';
|
|
6
|
-
|
|
7
6
|
import { RequireOnePackageVersion } from '../require-one-package-version';
|
|
8
7
|
|
|
9
8
|
jest.mock('../../utils', () => ({
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { RequireOneCollectionVersion } from '../require-one-collection-version';
|
|
2
|
-
|
|
3
2
|
import { RequireOneUikitVersion } from '../require-one-uikit-version';
|
|
4
3
|
|
|
5
4
|
jest.mock('../require-one-collection-version');
|
|
@@ -21,6 +20,7 @@ describe(`[startup] Review ${RequireOneUikitVersion.name}`, () => {
|
|
|
21
20
|
'@servicetitan/react-ioc',
|
|
22
21
|
'@servicetitan/restrict-imports',
|
|
23
22
|
'@servicetitan/startup',
|
|
23
|
+
'@servicetitan/startup-utils',
|
|
24
24
|
'@servicetitan/stylelint-config',
|
|
25
25
|
'@servicetitan/suppress-warnings',
|
|
26
26
|
'@servicetitan/web-components',
|
package/src/cli/commands/review/rules/__tests__/require-project-version-in-root-node-modules.test.ts
CHANGED
|
@@ -3,7 +3,6 @@ import { execSync } from 'child_process';
|
|
|
3
3
|
import { expectCalls } from '../../__mocks__';
|
|
4
4
|
import { FixCategory, Package, Project, ReviewConfiguration } from '../../types';
|
|
5
5
|
import { mockConfig, mockPackages, mockProject } from '../__mocks__';
|
|
6
|
-
|
|
7
6
|
import { RequireProjectVersionInRootNodeModules } from '../require-project-version-in-root-node-modules';
|
|
8
7
|
|
|
9
8
|
jest.mock('child_process', () => ({ execSync: jest.fn() }));
|
|
@@ -88,7 +87,7 @@ describe(`[startup] Review ${RequireProjectVersionInRootNodeModules.name}`, () =
|
|
|
88
87
|
expectCalls(
|
|
89
88
|
...[
|
|
90
89
|
'npm pkg set dependencies["foo"]="~1.0.0"',
|
|
91
|
-
'npx
|
|
90
|
+
'npx @servicetitan/install --fix --quiet',
|
|
92
91
|
'npm pkg delete dependencies["foo"]',
|
|
93
92
|
].map(command => [execSync, command, { stdio: 'inherit' }])
|
|
94
93
|
);
|
|
@@ -176,7 +175,7 @@ describe(`[startup] Review ${RequireProjectVersionInRootNodeModules.name}`, () =
|
|
|
176
175
|
...[
|
|
177
176
|
'npm pkg set dependencies["foo"]="~1.0.0"',
|
|
178
177
|
'npm pkg set dependencies["baz"]=">=3 <4"',
|
|
179
|
-
'npx
|
|
178
|
+
'npx @servicetitan/install --fix --quiet',
|
|
180
179
|
'npm pkg delete dependencies["foo"]',
|
|
181
180
|
'npm pkg delete dependencies["baz"]',
|
|
182
181
|
].map(command => [execSync, command, { stdio: 'inherit' }])
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { ErrorSeverity, Package, ReviewConfiguration } from '../../types';
|
|
2
2
|
import { mockConfig, mockProject } from '../__mocks__';
|
|
3
|
-
|
|
4
3
|
import { RequireServiceTitanScope } from '../require-servicetitan-scope';
|
|
5
4
|
|
|
6
5
|
describe(`[startup] Review ${RequireServiceTitanScope.name}`, () => {
|
|
@@ -0,0 +1,315 @@
|
|
|
1
|
+
import { fs, vol } from 'memfs';
|
|
2
|
+
import path from 'node:path';
|
|
3
|
+
import { Package, ReviewConfiguration } from '../../types';
|
|
4
|
+
import { mockProject } from '../__mocks__';
|
|
5
|
+
|
|
6
|
+
import { prettifySync } from '../../../../../utils';
|
|
7
|
+
import { RequireTsconfigReferences } from '../require-tsconfig-references';
|
|
8
|
+
|
|
9
|
+
jest.mock('node:fs', () => fs);
|
|
10
|
+
jest.mock('node:child_process', () => ({
|
|
11
|
+
execSync: jest.fn(),
|
|
12
|
+
}));
|
|
13
|
+
jest.mock('../../../../../utils', () => ({
|
|
14
|
+
...jest.requireActual('../../../../../utils'),
|
|
15
|
+
prettifySync: jest.fn(),
|
|
16
|
+
}));
|
|
17
|
+
|
|
18
|
+
describe(`[startup] Review ${RequireTsconfigReferences.name}`, () => {
|
|
19
|
+
let rule: RequireTsconfigReferences;
|
|
20
|
+
let config: ReviewConfiguration;
|
|
21
|
+
let packages: Package[];
|
|
22
|
+
|
|
23
|
+
beforeEach(() => {
|
|
24
|
+
rule = new RequireTsconfigReferences();
|
|
25
|
+
config = {};
|
|
26
|
+
packages = [];
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
afterEach(() => vol.reset());
|
|
30
|
+
|
|
31
|
+
const subject = () => rule.run(mockProject({ config, packages }));
|
|
32
|
+
const fixSubject = () => {
|
|
33
|
+
const ruleErrors = subject();
|
|
34
|
+
|
|
35
|
+
ruleErrors.forEach(rule.fix);
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
function setupPackages(pkgs: Package[], tsconfigFiles: Record<string, object>) {
|
|
39
|
+
packages = pkgs;
|
|
40
|
+
vol.fromJSON(
|
|
41
|
+
Object.fromEntries(
|
|
42
|
+
Object.entries(tsconfigFiles).map(([filePath, content]) => [
|
|
43
|
+
filePath,
|
|
44
|
+
JSON.stringify(content, null, 4),
|
|
45
|
+
])
|
|
46
|
+
)
|
|
47
|
+
);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
describe('when package has local dependency with correct tsconfig reference', () => {
|
|
51
|
+
beforeEach(() => {
|
|
52
|
+
setupPackages(
|
|
53
|
+
[
|
|
54
|
+
{
|
|
55
|
+
name: '@servicetitan/runtime',
|
|
56
|
+
location: path.normalize('packages/runtime'),
|
|
57
|
+
dependencies: {
|
|
58
|
+
'@servicetitan/log-service': '1.0.0',
|
|
59
|
+
},
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
name: '@servicetitan/log-service',
|
|
63
|
+
location: path.normalize('packages/log-service'),
|
|
64
|
+
},
|
|
65
|
+
],
|
|
66
|
+
{
|
|
67
|
+
[path.normalize('packages/runtime/tsconfig.json')]: {
|
|
68
|
+
references: [{ path: '../log-service/tsconfig.json' }],
|
|
69
|
+
},
|
|
70
|
+
[path.normalize('packages/log-service/tsconfig.json')]: {},
|
|
71
|
+
}
|
|
72
|
+
);
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
test('reports no errors', () => {
|
|
76
|
+
expect(subject()).toEqual([]);
|
|
77
|
+
});
|
|
78
|
+
});
|
|
79
|
+
|
|
80
|
+
describe('when tsconfig files are missing references', () => {
|
|
81
|
+
beforeEach(() => {
|
|
82
|
+
setupPackages(
|
|
83
|
+
[
|
|
84
|
+
{
|
|
85
|
+
name: '@servicetitan/runtime',
|
|
86
|
+
location: path.normalize('packages/runtime'),
|
|
87
|
+
dependencies: {
|
|
88
|
+
'@servicetitan/log-service': '1.0.0',
|
|
89
|
+
},
|
|
90
|
+
},
|
|
91
|
+
{
|
|
92
|
+
name: '@servicetitan/log-service',
|
|
93
|
+
location: path.normalize('packages/log-service'),
|
|
94
|
+
},
|
|
95
|
+
],
|
|
96
|
+
{
|
|
97
|
+
[path.normalize('packages/runtime/tsconfig.json')]: {},
|
|
98
|
+
[path.normalize('packages/runtime/tsconfig.build.json')]: {},
|
|
99
|
+
[path.normalize('packages/log-service/tsconfig.json')]: {},
|
|
100
|
+
}
|
|
101
|
+
);
|
|
102
|
+
});
|
|
103
|
+
|
|
104
|
+
test('reports errors for tsconfig files', () => {
|
|
105
|
+
expect(subject()).toEqual(
|
|
106
|
+
expect.arrayContaining([
|
|
107
|
+
{
|
|
108
|
+
id: 'require-tsconfig-references',
|
|
109
|
+
message: 'missing reference for dependency: @servicetitan/log-service',
|
|
110
|
+
location: path.normalize('packages/runtime/tsconfig.json'),
|
|
111
|
+
fixable: 'normal',
|
|
112
|
+
data: {
|
|
113
|
+
tsconfigPath: path.normalize('packages/runtime/tsconfig.json'),
|
|
114
|
+
missingReference: '@servicetitan/log-service',
|
|
115
|
+
expectedPath: '../log-service/tsconfig.json',
|
|
116
|
+
},
|
|
117
|
+
},
|
|
118
|
+
{
|
|
119
|
+
id: 'require-tsconfig-references',
|
|
120
|
+
message: 'missing reference for dependency: @servicetitan/log-service',
|
|
121
|
+
location: path.normalize('packages/runtime/tsconfig.build.json'),
|
|
122
|
+
fixable: 'normal',
|
|
123
|
+
data: {
|
|
124
|
+
tsconfigPath: path.normalize('packages/runtime/tsconfig.build.json'),
|
|
125
|
+
missingReference: '@servicetitan/log-service',
|
|
126
|
+
expectedPath: '../log-service/tsconfig.json',
|
|
127
|
+
},
|
|
128
|
+
},
|
|
129
|
+
])
|
|
130
|
+
);
|
|
131
|
+
});
|
|
132
|
+
});
|
|
133
|
+
|
|
134
|
+
describe('when package dependencies are in devDependencies and peerDependencies', () => {
|
|
135
|
+
beforeEach(() => {
|
|
136
|
+
setupPackages(
|
|
137
|
+
[
|
|
138
|
+
{
|
|
139
|
+
name: '@servicetitan/runtime',
|
|
140
|
+
location: path.normalize('packages/runtime'),
|
|
141
|
+
devDependencies: { '@servicetitan/log-service': '1.0.0' },
|
|
142
|
+
},
|
|
143
|
+
{
|
|
144
|
+
name: '@servicetitan/examples',
|
|
145
|
+
location: path.normalize('packages/examples'),
|
|
146
|
+
peerDependencies: { '@servicetitan/log-service': '1.0.0' },
|
|
147
|
+
},
|
|
148
|
+
{
|
|
149
|
+
name: '@servicetitan/log-service',
|
|
150
|
+
location: path.normalize('packages/log-service'),
|
|
151
|
+
},
|
|
152
|
+
],
|
|
153
|
+
{
|
|
154
|
+
[path.normalize('packages/runtime/tsconfig.json')]: {},
|
|
155
|
+
[path.normalize('packages/examples/tsconfig.json')]: {},
|
|
156
|
+
[path.normalize('packages/log-service/tsconfig.json')]: {},
|
|
157
|
+
}
|
|
158
|
+
);
|
|
159
|
+
});
|
|
160
|
+
|
|
161
|
+
test('reports missing reference errors', () => {
|
|
162
|
+
expect(subject()).toEqual([
|
|
163
|
+
{
|
|
164
|
+
id: 'require-tsconfig-references',
|
|
165
|
+
message: 'missing reference for dependency: @servicetitan/log-service',
|
|
166
|
+
location: path.normalize('packages/runtime/tsconfig.json'),
|
|
167
|
+
fixable: 'normal',
|
|
168
|
+
data: {
|
|
169
|
+
tsconfigPath: path.normalize('packages/runtime/tsconfig.json'),
|
|
170
|
+
missingReference: '@servicetitan/log-service',
|
|
171
|
+
expectedPath: '../log-service/tsconfig.json',
|
|
172
|
+
},
|
|
173
|
+
},
|
|
174
|
+
{
|
|
175
|
+
id: 'require-tsconfig-references',
|
|
176
|
+
message: 'missing reference for dependency: @servicetitan/log-service',
|
|
177
|
+
location: path.normalize('packages/examples/tsconfig.json'),
|
|
178
|
+
fixable: 'normal',
|
|
179
|
+
data: {
|
|
180
|
+
tsconfigPath: path.normalize('packages/examples/tsconfig.json'),
|
|
181
|
+
missingReference: '@servicetitan/log-service',
|
|
182
|
+
expectedPath: '../log-service/tsconfig.json',
|
|
183
|
+
},
|
|
184
|
+
},
|
|
185
|
+
]);
|
|
186
|
+
});
|
|
187
|
+
});
|
|
188
|
+
|
|
189
|
+
describe('when fix is called with non-existent tsconfig file', () => {
|
|
190
|
+
const tsconfigPath = path.normalize('packages/nonexistent/tsconfig.json');
|
|
191
|
+
|
|
192
|
+
beforeEach(() => {
|
|
193
|
+
setupPackages(
|
|
194
|
+
[
|
|
195
|
+
{
|
|
196
|
+
name: '@servicetitan/runtime',
|
|
197
|
+
location: path.normalize('packages/runtime'),
|
|
198
|
+
devDependencies: { '@servicetitan/log-service': '1.0.0' },
|
|
199
|
+
},
|
|
200
|
+
{
|
|
201
|
+
name: '@servicetitan/log-service',
|
|
202
|
+
location: path.normalize('packages/log-service'),
|
|
203
|
+
},
|
|
204
|
+
],
|
|
205
|
+
{}
|
|
206
|
+
);
|
|
207
|
+
});
|
|
208
|
+
|
|
209
|
+
test('file remains non-existent', () => {
|
|
210
|
+
fixSubject();
|
|
211
|
+
|
|
212
|
+
expect(fs.existsSync(tsconfigPath)).toBe(false);
|
|
213
|
+
});
|
|
214
|
+
});
|
|
215
|
+
|
|
216
|
+
describe('when fix is called on tsconfig that already has references', () => {
|
|
217
|
+
const tsconfigFilePath = path.normalize('packages/runtime/tsconfig.json');
|
|
218
|
+
|
|
219
|
+
beforeEach(() => {
|
|
220
|
+
setupPackages(
|
|
221
|
+
[
|
|
222
|
+
{
|
|
223
|
+
name: '@servicetitan/runtime',
|
|
224
|
+
location: path.normalize('packages/runtime'),
|
|
225
|
+
dependencies: {
|
|
226
|
+
'@servicetitan/log-service': '1.0.0',
|
|
227
|
+
},
|
|
228
|
+
},
|
|
229
|
+
{
|
|
230
|
+
name: '@servicetitan/log-service',
|
|
231
|
+
location: path.normalize('packages/log-service'),
|
|
232
|
+
},
|
|
233
|
+
],
|
|
234
|
+
{
|
|
235
|
+
[tsconfigFilePath]: {
|
|
236
|
+
references: [{ path: '../existing/tsconfig.json' }],
|
|
237
|
+
},
|
|
238
|
+
}
|
|
239
|
+
);
|
|
240
|
+
});
|
|
241
|
+
|
|
242
|
+
test('appends to existing references', () => {
|
|
243
|
+
fixSubject();
|
|
244
|
+
|
|
245
|
+
const content = JSON.parse(fs.readFileSync(tsconfigFilePath, 'utf8') as string);
|
|
246
|
+
expect(content.references).toContainEqual({ path: '../existing/tsconfig.json' });
|
|
247
|
+
expect(content.references).toContainEqual({ path: '../log-service/tsconfig.json' });
|
|
248
|
+
});
|
|
249
|
+
|
|
250
|
+
test('runs prettier on the modified file', () => {
|
|
251
|
+
fixSubject();
|
|
252
|
+
|
|
253
|
+
expect(prettifySync).toHaveBeenCalled();
|
|
254
|
+
});
|
|
255
|
+
});
|
|
256
|
+
|
|
257
|
+
describe('when tsconfig reference omits .json extension', () => {
|
|
258
|
+
beforeEach(() => {
|
|
259
|
+
setupPackages(
|
|
260
|
+
[
|
|
261
|
+
{
|
|
262
|
+
name: '@servicetitan/runtime',
|
|
263
|
+
location: path.normalize('packages/runtime'),
|
|
264
|
+
dependencies: {
|
|
265
|
+
'@servicetitan/log-service': '1.0.0',
|
|
266
|
+
},
|
|
267
|
+
},
|
|
268
|
+
{
|
|
269
|
+
name: '@servicetitan/log-service',
|
|
270
|
+
location: path.normalize('packages/log-service'),
|
|
271
|
+
},
|
|
272
|
+
],
|
|
273
|
+
{
|
|
274
|
+
[path.normalize('packages/runtime/tsconfig.json')]: {
|
|
275
|
+
references: [{ path: '../log-service/tsconfig' }],
|
|
276
|
+
},
|
|
277
|
+
[path.normalize('packages/log-service/tsconfig.json')]: {},
|
|
278
|
+
}
|
|
279
|
+
);
|
|
280
|
+
});
|
|
281
|
+
|
|
282
|
+
test('reports no errors', () => {
|
|
283
|
+
expect(subject()).toEqual([]);
|
|
284
|
+
});
|
|
285
|
+
});
|
|
286
|
+
|
|
287
|
+
describe('when package is a workspace root', () => {
|
|
288
|
+
beforeEach(() => {
|
|
289
|
+
setupPackages(
|
|
290
|
+
[
|
|
291
|
+
{
|
|
292
|
+
name: 'my-monorepo',
|
|
293
|
+
location: '.',
|
|
294
|
+
workspaces: ['packages/*'],
|
|
295
|
+
dependencies: {
|
|
296
|
+
'@servicetitan/log-service': '1.0.0',
|
|
297
|
+
},
|
|
298
|
+
},
|
|
299
|
+
{
|
|
300
|
+
name: '@servicetitan/log-service',
|
|
301
|
+
location: path.normalize('packages/log-service'),
|
|
302
|
+
},
|
|
303
|
+
],
|
|
304
|
+
{
|
|
305
|
+
'tsconfig.json': {},
|
|
306
|
+
[path.normalize('packages/log-service/tsconfig.json')]: {},
|
|
307
|
+
}
|
|
308
|
+
);
|
|
309
|
+
});
|
|
310
|
+
|
|
311
|
+
test('skips the workspace root package', () => {
|
|
312
|
+
expect(subject()).toEqual([]);
|
|
313
|
+
});
|
|
314
|
+
});
|
|
315
|
+
});
|
|
@@ -14,6 +14,7 @@ import { RequireOneReactVersion } from './require-one-react-version';
|
|
|
14
14
|
import { RequireOneUikitVersion } from './require-one-uikit-version';
|
|
15
15
|
import { RequireProjectVersionInRootNodeModules } from './require-project-version-in-root-node-modules';
|
|
16
16
|
import { RequireServiceTitanScope } from './require-servicetitan-scope';
|
|
17
|
+
import { RequireTsconfigReferences } from './require-tsconfig-references';
|
|
17
18
|
|
|
18
19
|
export const rules: PackageRule[] = [
|
|
19
20
|
new RequireAllReactDependencies(),
|
|
@@ -31,4 +32,5 @@ export const rules: PackageRule[] = [
|
|
|
31
32
|
new RequireServiceTitanScope(),
|
|
32
33
|
new RequireExplicitSideEffects(),
|
|
33
34
|
new RequireNpmrc(),
|
|
35
|
+
new RequireTsconfigReferences(),
|
|
34
36
|
];
|