@servicetitan/startup 32.3.2 → 32.5.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/get-command.d.ts.map +1 -1
- package/dist/cli/commands/get-command.js +2 -0
- package/dist/cli/commands/get-command.js.map +1 -1
- package/dist/cli/commands/init.d.ts +1 -1
- package/dist/cli/commands/init.d.ts.map +1 -1
- package/dist/cli/commands/init.js +6 -5
- package/dist/cli/commands/init.js.map +1 -1
- package/dist/cli/commands/install.d.ts +1 -4
- package/dist/cli/commands/install.d.ts.map +1 -1
- package/dist/cli/commands/install.js +12 -118
- package/dist/cli/commands/install.js.map +1 -1
- package/dist/cli/commands/lint.d.ts.map +1 -1
- package/dist/cli/commands/lint.js +7 -55
- package/dist/cli/commands/lint.js.map +1 -1
- package/dist/cli/commands/mfe-list.d.ts.map +1 -1
- package/dist/cli/commands/mfe-list.js +2 -1
- package/dist/cli/commands/mfe-list.js.map +1 -1
- package/dist/cli/commands/review/rules/index.d.ts.map +1 -1
- package/dist/cli/commands/review/rules/index.js +2 -0
- package/dist/cli/commands/review/rules/index.js.map +1 -1
- package/dist/cli/commands/review/rules/no-deprecated-startup-install.d.ts +7 -0
- package/dist/cli/commands/review/rules/no-deprecated-startup-install.d.ts.map +1 -0
- package/dist/cli/commands/review/rules/no-deprecated-startup-install.js +38 -0
- package/dist/cli/commands/review/rules/no-deprecated-startup-install.js.map +1 -0
- package/dist/cli/commands/review/types.d.ts +1 -0
- package/dist/cli/commands/review/types.d.ts.map +1 -1
- package/dist/cli/commands/review/types.js.map +1 -1
- package/dist/cli/commands/stylelint.d.ts +17 -0
- package/dist/cli/commands/stylelint.d.ts.map +1 -0
- package/dist/cli/commands/stylelint.js +63 -0
- package/dist/cli/commands/stylelint.js.map +1 -0
- package/dist/cli/commands/upload-sourcemaps.d.ts.map +1 -1
- package/dist/cli/commands/upload-sourcemaps.js +2 -1
- package/dist/cli/commands/upload-sourcemaps.js.map +1 -1
- package/dist/cli/utils/cli-git.d.ts +0 -9
- package/dist/cli/utils/cli-git.d.ts.map +1 -1
- package/dist/cli/utils/cli-git.js +0 -59
- package/dist/cli/utils/cli-git.js.map +1 -1
- package/dist/cli/utils/cli-npm.d.ts +0 -3
- package/dist/cli/utils/cli-npm.d.ts.map +1 -1
- package/dist/cli/utils/cli-npm.js +0 -22
- package/dist/cli/utils/cli-npm.js.map +1 -1
- package/dist/cli/utils/index.d.ts +0 -1
- package/dist/cli/utils/index.d.ts.map +1 -1
- package/dist/cli/utils/index.js +0 -1
- package/dist/cli/utils/index.js.map +1 -1
- package/dist/cli/utils/lerna-exec.d.ts.map +1 -1
- package/dist/cli/utils/lerna-exec.js +2 -2
- package/dist/cli/utils/lerna-exec.js.map +1 -1
- package/dist/cli/utils/stylelint.d.ts +8 -0
- package/dist/cli/utils/stylelint.d.ts.map +1 -0
- package/dist/cli/utils/stylelint.js +67 -0
- package/dist/cli/utils/stylelint.js.map +1 -0
- package/dist/utils/get-configuration.d.ts +1 -0
- package/dist/utils/get-configuration.d.ts.map +1 -1
- package/dist/utils/get-configuration.js +1 -0
- package/dist/utils/get-configuration.js.map +1 -1
- package/package.json +8 -9
- package/src/cli/commands/__tests__/init.test.ts +11 -14
- package/src/cli/commands/__tests__/install.test.ts +19 -224
- package/src/cli/commands/__tests__/lint.test.ts +52 -10
- package/src/cli/commands/__tests__/mfe-list.test.ts +5 -4
- package/src/cli/commands/__tests__/stylelint.test.ts +32 -0
- package/src/cli/commands/__tests__/upload-sourcemaps.test.ts +4 -7
- package/src/cli/commands/get-command.ts +2 -0
- package/src/cli/commands/init.ts +6 -4
- package/src/cli/commands/install.ts +13 -116
- package/src/cli/commands/lint.ts +5 -57
- package/src/cli/commands/mfe-list.ts +2 -1
- package/src/cli/commands/review/rules/__tests__/no-deprecated-startup-install.test.ts +81 -0
- package/src/cli/commands/review/rules/index.ts +2 -0
- package/src/cli/commands/review/rules/no-deprecated-startup-install.ts +30 -0
- package/src/cli/commands/review/types.ts +1 -0
- package/src/cli/commands/stylelint.ts +26 -0
- package/src/cli/commands/upload-sourcemaps.ts +2 -1
- package/src/cli/utils/__tests__/cli-git.test.ts +4 -140
- package/src/cli/utils/__tests__/cli-npm.test.ts +0 -43
- package/src/cli/utils/__tests__/lerna-exec.test.ts +2 -2
- package/src/cli/utils/__tests__/stylelint.test.ts +164 -0
- package/src/cli/utils/cli-git.ts +1 -52
- package/src/cli/utils/cli-npm.ts +0 -12
- package/src/cli/utils/index.ts +1 -1
- package/src/cli/utils/lerna-exec.ts +1 -1
- package/src/cli/utils/stylelint.ts +55 -0
- package/src/utils/get-configuration.ts +1 -0
- package/dist/cli/utils/is-ci.d.ts +0 -2
- package/dist/cli/utils/is-ci.d.ts.map +0 -1
- package/dist/cli/utils/is-ci.js +0 -15
- package/dist/cli/utils/is-ci.js.map +0 -1
- package/src/cli/utils/__tests__/is-ci.test.ts +0 -40
- package/src/cli/utils/is-ci.ts +0 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-configuration.d.ts","sourceRoot":"","sources":["../../src/utils/get-configuration.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAGhC,OAAO,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAC/C,OAAO,EAAE,aAAa,IAAI,6BAA6B,EAAE,MAAM,oBAAoB,CAAC;AAEpF,OAAO,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAK7D,eAAO,MAAM,8BAA8B,iDAAkD,CAAC;AAE9F,KAAK,WAAW,CAAC,CAAC,IAAI,CAAC,SAAS,SAAS,CAAC,MAAM,WAAW,CAAC,EAAE,GAAG,WAAW,GAAG,KAAK,CAAC;AA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gB,4BAA4B,CAAC,cAAc,GAAE,cAAqB,yDAIjF;AAED,wBAAgB,iBAAiB,YAShC;AAED,wBAAgB,iCAAiC,+BAEhD;AAED,wBAAgB,QAAQ,CAAC,cAAc,CAAC,EAAE,cAAc,WAEvD;AAED,wBAAgB,kBAAkB,YAEjC;AAED,wBAAgB,mBAAmB,YAGlC;AAED,wBAAgB,0BAA0B,YAEzC;AAED,wBAAgB,QAAQ,CAAC,cAAc,CAAC,EAAE,cAAc,WAEvD;AAED,wBAAgB,YAAY,YAE3B;AAED,wBAAgB,oBAAoB,YAEnC;AAED,wBAAgB,cAAc,CAAC,cAAc,GAAE,cAAqB,WAEnE"}
|
|
@@ -109,6 +109,7 @@ var CommandName = /*#__PURE__*/ function(CommandName) {
|
|
|
109
109
|
CommandName["prepare-package"] = "prepare-package";
|
|
110
110
|
CommandName["review"] = "review";
|
|
111
111
|
CommandName["start"] = "start";
|
|
112
|
+
CommandName["stylelint"] = "stylelint";
|
|
112
113
|
CommandName["styles-check"] = "styles-check";
|
|
113
114
|
CommandName["test"] = "test";
|
|
114
115
|
CommandName["task"] = "task";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/utils/get-configuration.ts"],"sourcesContent":["import { Config } from '@jest/types';\nimport { swcDir } from '@swc/cli';\nimport { ESLint } from 'eslint';\nimport fs from 'fs';\nimport path from 'path';\nimport { LinterOptions } from 'stylelint';\nimport { ViteUserConfig } from 'vitest/config';\nimport { Configuration as WebpackDevServerConfiguration } from 'webpack-dev-server';\n\nimport { ReviewConfiguration } from '../cli/commands/review';\nimport { log } from './log';\nimport { getFolders } from './get-folders';\nimport { readJson, readJsonSafe } from './read-json';\n\nexport const allowedWebpackDevServerOptions = ['headers', 'port', 'proxy', 'static'] as const;\n\ntype ElementType<T> = T extends readonly (infer ElementType)[] ? ElementType : never;\n\nexport interface MinifyJSOptions {\n compress?: boolean;\n mangle?: boolean;\n}\n\nexport interface MinifyCssOptions {}\n\nexport interface MinifyOptions {\n css?: boolean | MinifyCssOptions;\n js?: boolean | MinifyJSOptions;\n}\n\nexport interface WebpackConfiguration\n extends Omit<\n Pick<WebpackDevServerConfiguration, ElementType<typeof allowedWebpackDevServerOptions>>,\n 'proxy'\n > {\n 'contentBase'?: boolean | string | string[] | number; // deprecated 2024-07\n 'custom-style-rules'?: boolean;\n 'expose-shared-dependencies'?: boolean;\n 'devServer'?: false | WebpackDevServerConfiguration;\n 'disable-style-check'?: boolean;\n 'minify'?: MinifyOptions;\n 'proxy'?: WebpackDevServerConfiguration['proxy'] | string;\n}\n\nexport interface ESLintConfiguration extends ESLint.Options {\n disabled?: boolean;\n}\n\nexport interface StylelintConfiguration extends Partial<LinterOptions> {\n ignorePattern?: string[];\n disabled?: boolean;\n}\n\nexport interface JestConfiguration extends Omit<Config.Argv, '_' | '$0'> {\n omitDefault?: string[];\n}\n\nexport interface NodeConfiguration {\n // eslint-disable-next-line @typescript-eslint/naming-convention\n NODE_OPTIONS?: string[];\n}\n\n/* eslint-disable @typescript-eslint/naming-convention */\nexport enum CommandName {\n 'build' = 'build',\n 'bundle-package' = 'bundle-package',\n 'clean' = 'clean',\n 'convert-eslint-config' = 'convert-eslint-config',\n 'eslint' = 'eslint',\n 'init' = 'init',\n 'install' = 'install',\n 'kendo-ui-license' = 'kendo-ui-license',\n 'lint' = 'lint',\n 'mfe-list' = 'mfe-list',\n 'mfe-package-clean' = 'mfe-package-clean',\n 'mfe-package-publish' = 'mfe-package-publish',\n 'mfe-publish' = 'mfe-publish',\n 'prepare-package' = 'prepare-package',\n 'review' = 'review',\n 'start' = 'start',\n 'styles-check' = 'styles-check',\n 'test' = 'test',\n 'task' = 'task',\n 'upload-sourcemaps' = 'upload-sourcemaps',\n}\n/* eslint-enable @typescript-eslint/naming-convention */\n\nexport type VitestConfiguration = ViteUserConfig['test'] & {\n omitDefault?: string[];\n};\n\nexport interface WebComponentBranchConfigs {\n publishTag?: string;\n uploadSourcemaps?: boolean;\n}\n\ninterface WebComponentOptions {\n legacyRoot?: boolean;\n /**\n * mapping of git branches to configs.\n * Used to separate configs (ex publish tag) depending on current branch\n */\n branches?: Record<string, WebComponentBranchConfigs>;\n}\n\ntype Configuration = {\n 'jest'?: JestConfiguration;\n 'legacy'?: boolean;\n 'lint'?: { eslint: ESLintConfiguration; stylelint: StylelintConfiguration };\n 'review'?: ReviewConfiguration;\n 'swc-compile-package'?: Parameters<typeof swcDir>[0];\n 'test'?: JestConfiguration; // for backward-compatibility\n 'testRunner'?: string;\n 'vitest'?: VitestConfiguration;\n 'web-component'?: boolean | string | WebComponentOptions;\n 'webpack'?: false | WebpackConfiguration;\n} & {\n [key in CommandName]?: NodeConfiguration;\n} & NodeConfiguration;\n\ntype LocationOrJson = string | Record<string, any>;\n\nexport function getConfiguration(locationOrJson: LocationOrJson = './'): Configuration {\n const json =\n typeof locationOrJson === 'string'\n ? readJson(path.join(locationOrJson, 'package.json'))\n : locationOrJson;\n return json?.cli ?? {};\n}\n\nexport function getConfigurationSafe(locationOrJson: LocationOrJson = './'): Configuration {\n const json =\n typeof locationOrJson === 'string'\n ? readJsonSafe(path.join(locationOrJson, 'package.json'))\n : locationOrJson;\n return json?.cli ?? {};\n}\n\nexport function getESLintConfiguration() {\n return getConfiguration().lint?.eslint ?? {};\n}\n\nexport function getJestConfiguration() {\n const configuration = getConfiguration();\n return configuration.jest ?? configuration.test ?? {};\n}\n\nexport function getReviewConfiguration() {\n return getConfiguration().review ?? {};\n}\n\nexport function getStylelintConfiguration() {\n return getConfiguration().lint?.stylelint ?? {};\n}\n\nexport function getVitestConfiguration() {\n return getConfiguration().vitest ?? {};\n}\n\nexport function getWebpackConfiguration(locationOrJson?: LocationOrJson) {\n const { webpack } = getConfiguration(locationOrJson);\n return typeof webpack === 'object' ? webpack : {};\n}\n\nexport function getWebComponentConfiguration(\n locationOrJson: LocationOrJson = './'\n): WebComponentOptions | undefined {\n const config = getConfigurationSafe(locationOrJson)['web-component'];\n\n if (config === true) {\n return {};\n }\n\n if (typeof config === 'object') {\n return config;\n }\n\n if (typeof config === 'string') {\n const configPath = path.resolve(\n typeof locationOrJson === 'string' ? path.join(locationOrJson, config) : config\n );\n if (fs.existsSync(configPath)) {\n return require(path.resolve(configPath));\n }\n log.warning(`could not find web-component configuration: \"${config}\"`);\n\n return undefined;\n }\n}\n\nexport function getWebComponentBranchConfigs(locationOrJson: LocationOrJson = './') {\n const config = getWebComponentConfiguration(locationOrJson);\n\n return config?.branches;\n}\n\nexport function hasHeadlessBundle() {\n let source: string;\n try {\n source = getFolders().source;\n } catch {\n return false;\n }\n const headlessPath = path.join(source, 'headless.ts');\n return fs.existsSync(headlessPath);\n}\n\nexport function getSwcCompilePackageConfiguration() {\n return getConfiguration()['swc-compile-package'] ?? {};\n}\n\nexport function isBundle(locationOrJson?: LocationOrJson) {\n return getConfiguration(locationOrJson).webpack !== false;\n}\n\nexport function isCustomStyleRules() {\n return getWebpackConfiguration()['custom-style-rules'] === true;\n}\n\nexport function isDevServerDisabled() {\n const webpackConfiguration = getWebpackConfiguration();\n return webpackConfiguration.devServer === false;\n}\n\nexport function isExposeSharedDependencies() {\n return getWebpackConfiguration()['expose-shared-dependencies'] === true;\n}\n\nexport function isLegacy(locationOrJson?: LocationOrJson) {\n return getConfiguration(locationOrJson).legacy === true;\n}\n\nexport function isLegacyRoot() {\n return getWebComponentConfiguration()?.legacyRoot === true;\n}\n\nexport function isStyleCheckDisabled() {\n return getWebpackConfiguration()['disable-style-check'] === true;\n}\n\nexport function isWebComponent(locationOrJson: LocationOrJson = './') {\n return !!getWebComponentConfiguration(locationOrJson);\n}\n"],"names":["CommandName","allowedWebpackDevServerOptions","getConfiguration","getConfigurationSafe","getESLintConfiguration","getJestConfiguration","getReviewConfiguration","getStylelintConfiguration","getSwcCompilePackageConfiguration","getVitestConfiguration","getWebComponentBranchConfigs","getWebComponentConfiguration","getWebpackConfiguration","hasHeadlessBundle","isBundle","isCustomStyleRules","isDevServerDisabled","isExposeSharedDependencies","isLegacy","isLegacyRoot","isStyleCheckDisabled","isWebComponent","locationOrJson","json","readJson","path","join","cli","readJsonSafe","lint","eslint","configuration","jest","test","review","stylelint","vitest","webpack","config","configPath","resolve","fs","existsSync","require","log","warning","undefined","branches","source","getFolders","headlessPath","webpackConfiguration","devServer","legacy","legacyRoot"],"mappings":";;;;;;;;;;;QA+DYA;eAAAA;;QAjDCC;eAAAA;;QA4GGC;eAAAA;;QAQAC;eAAAA;;QAQAC;eAAAA;;QAIAC;eAAAA;;QAKAC;eAAAA;;QAIAC;eAAAA;;QAwDAC;eAAAA;;QApDAC;eAAAA;;QAmCAC;eAAAA;;QA1BAC;eAAAA;;QALAC;eAAAA;;QAqCAC;eAAAA;;QAeAC;eAAAA;;QAIAC;eAAAA;;QAIAC;eAAAA;;QAKAC;eAAAA;;QAIAC;eAAAA;;QAIAC;eAAAA;;QAIAC;eAAAA;;QAIAC;eAAAA;;;2DA7OD;6DACE;qBAMG;4BACO;0BACY;;;;;;AAEhC,MAAMpB,iCAAiC;IAAC;IAAW;IAAQ;IAAS;CAAS;AAiD7E,IAAA,AAAKD,qCAAAA;;;;;;;;;;;;;;;;;;;;;WAAAA;;AA2DL,SAASE,iBAAiBoB,iBAAiC,IAAI;IAClE,MAAMC,OACF,OAAOD,mBAAmB,WACpBE,IAAAA,kBAAQ,EAACC,aAAI,CAACC,IAAI,CAACJ,gBAAgB,mBACnCA;QACHC;IAAP,OAAOA,CAAAA,YAAAA,iBAAAA,2BAAAA,KAAMI,GAAG,cAATJ,uBAAAA,YAAa,CAAC;AACzB;AAEO,SAASpB,qBAAqBmB,iBAAiC,IAAI;IACtE,MAAMC,OACF,OAAOD,mBAAmB,WACpBM,IAAAA,sBAAY,EAACH,aAAI,CAACC,IAAI,CAACJ,gBAAgB,mBACvCA;QACHC;IAAP,OAAOA,CAAAA,YAAAA,iBAAAA,2BAAAA,KAAMI,GAAG,cAATJ,uBAAAA,YAAa,CAAC;AACzB;AAEO,SAASnB;QACLF;QAAAA;IAAP,OAAO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QAAG,CAACC,OAAO,CAAC,CAAC,6CAA6C,EAAEP,OAAO,CAAC,CAAC;QAErE,OAAOQ;IACX;AACJ;AAEO,SAASpC,6BAA6BY,iBAAiC,IAAI;IAC9E,MAAMgB,SAAS3B,6BAA6BW;IAE5C,OAAOgB,mBAAAA,6BAAAA,OAAQS,QAAQ;AAC3B;AAEO,SAASlC;IACZ,IAAImC;IACJ,IAAI;QACAA,SAASC,IAAAA,sBAAU,IAAGD,MAAM;IAChC,EAAE,UAAM;QACJ,OAAO;IACX;IACA,MAAME,eAAezB,aAAI,CAACC,IAAI,CAACsB,QAAQ;IACvC,OAAOP,WAAE,CAACC,UAAU,CAACQ;AACzB;AAEO,SAAS1C;QACLN;IAAP,OAAOA,CAAAA,sCAAAA,kBAAkB,CAAC,sBAAsB,cAAzCA,iDAAAA,sCAA6C,CAAC;AACzD;AAEO,SAASY,SAASQ,cAA+B;IACpD,OAAOpB,iBAAiBoB,gBAAgBe,OAAO,KAAK;AACxD;AAEO,SAAStB;IACZ,OAAOH,yBAAyB,CAAC,qBAAqB,KAAK;AAC/D;AAEO,SAASI;IACZ,MAAMmC,uBAAuBvC;IAC7B,OAAOuC,qBAAqBC,SAAS,KAAK;AAC9C;AAEO,SAASnC;IACZ,OAAOL,yBAAyB,CAAC,6BAA6B,KAAK;AACvE;AAEO,SAASM,SAASI,cAA+B;IACpD,OAAOpB,iBAAiBoB,gBAAgB+B,MAAM,KAAK;AACvD;AAEO,SAASlC;QACLR;IAAP,OAAOA,EAAAA,gCAAAA,4CAAAA,oDAAAA,8BAAgC2C,UAAU,MAAK;AAC1D;AAEO,SAASlC;IACZ,OAAOR,yBAAyB,CAAC,sBAAsB,KAAK;AAChE;AAEO,SAASS,eAAeC,iBAAiC,IAAI;IAChE,OAAO,CAAC,CAACX,6BAA6BW;AAC1C"}
|
|
1
|
+
{"version":3,"sources":["../../src/utils/get-configuration.ts"],"sourcesContent":["import { Config } from '@jest/types';\nimport { swcDir } from '@swc/cli';\nimport { ESLint } from 'eslint';\nimport fs from 'fs';\nimport path from 'path';\nimport { LinterOptions } from 'stylelint';\nimport { ViteUserConfig } from 'vitest/config';\nimport { Configuration as WebpackDevServerConfiguration } from 'webpack-dev-server';\n\nimport { ReviewConfiguration } from '../cli/commands/review';\nimport { log } from './log';\nimport { getFolders } from './get-folders';\nimport { readJson, readJsonSafe } from './read-json';\n\nexport const allowedWebpackDevServerOptions = ['headers', 'port', 'proxy', 'static'] as const;\n\ntype ElementType<T> = T extends readonly (infer ElementType)[] ? ElementType : never;\n\nexport interface MinifyJSOptions {\n compress?: boolean;\n mangle?: boolean;\n}\n\nexport interface MinifyCssOptions {}\n\nexport interface MinifyOptions {\n css?: boolean | MinifyCssOptions;\n js?: boolean | MinifyJSOptions;\n}\n\nexport interface WebpackConfiguration\n extends Omit<\n Pick<WebpackDevServerConfiguration, ElementType<typeof allowedWebpackDevServerOptions>>,\n 'proxy'\n > {\n 'contentBase'?: boolean | string | string[] | number; // deprecated 2024-07\n 'custom-style-rules'?: boolean;\n 'expose-shared-dependencies'?: boolean;\n 'devServer'?: false | WebpackDevServerConfiguration;\n 'disable-style-check'?: boolean;\n 'minify'?: MinifyOptions;\n 'proxy'?: WebpackDevServerConfiguration['proxy'] | string;\n}\n\nexport interface ESLintConfiguration extends ESLint.Options {\n disabled?: boolean;\n}\n\nexport interface StylelintConfiguration extends Partial<LinterOptions> {\n ignorePattern?: string[];\n disabled?: boolean;\n}\n\nexport interface JestConfiguration extends Omit<Config.Argv, '_' | '$0'> {\n omitDefault?: string[];\n}\n\nexport interface NodeConfiguration {\n // eslint-disable-next-line @typescript-eslint/naming-convention\n NODE_OPTIONS?: string[];\n}\n\n/* eslint-disable @typescript-eslint/naming-convention */\nexport enum CommandName {\n 'build' = 'build',\n 'bundle-package' = 'bundle-package',\n 'clean' = 'clean',\n 'convert-eslint-config' = 'convert-eslint-config',\n 'eslint' = 'eslint',\n 'init' = 'init',\n 'install' = 'install',\n 'kendo-ui-license' = 'kendo-ui-license',\n 'lint' = 'lint',\n 'mfe-list' = 'mfe-list',\n 'mfe-package-clean' = 'mfe-package-clean',\n 'mfe-package-publish' = 'mfe-package-publish',\n 'mfe-publish' = 'mfe-publish',\n 'prepare-package' = 'prepare-package',\n 'review' = 'review',\n 'start' = 'start',\n 'stylelint' = 'stylelint',\n 'styles-check' = 'styles-check',\n 'test' = 'test',\n 'task' = 'task',\n 'upload-sourcemaps' = 'upload-sourcemaps',\n}\n/* eslint-enable @typescript-eslint/naming-convention */\n\nexport type VitestConfiguration = ViteUserConfig['test'] & {\n omitDefault?: string[];\n};\n\nexport interface WebComponentBranchConfigs {\n publishTag?: string;\n uploadSourcemaps?: boolean;\n}\n\ninterface WebComponentOptions {\n legacyRoot?: boolean;\n /**\n * mapping of git branches to configs.\n * Used to separate configs (ex publish tag) depending on current branch\n */\n branches?: Record<string, WebComponentBranchConfigs>;\n}\n\ntype Configuration = {\n 'jest'?: JestConfiguration;\n 'legacy'?: boolean;\n 'lint'?: { eslint: ESLintConfiguration; stylelint: StylelintConfiguration };\n 'review'?: ReviewConfiguration;\n 'swc-compile-package'?: Parameters<typeof swcDir>[0];\n 'test'?: JestConfiguration; // for backward-compatibility\n 'testRunner'?: string;\n 'vitest'?: VitestConfiguration;\n 'web-component'?: boolean | string | WebComponentOptions;\n 'webpack'?: false | WebpackConfiguration;\n} & {\n [key in CommandName]?: NodeConfiguration;\n} & NodeConfiguration;\n\ntype LocationOrJson = string | Record<string, any>;\n\nexport function getConfiguration(locationOrJson: LocationOrJson = './'): Configuration {\n const json =\n typeof locationOrJson === 'string'\n ? readJson(path.join(locationOrJson, 'package.json'))\n : locationOrJson;\n return json?.cli ?? {};\n}\n\nexport function getConfigurationSafe(locationOrJson: LocationOrJson = './'): Configuration {\n const json =\n typeof locationOrJson === 'string'\n ? readJsonSafe(path.join(locationOrJson, 'package.json'))\n : locationOrJson;\n return json?.cli ?? {};\n}\n\nexport function getESLintConfiguration() {\n return getConfiguration().lint?.eslint ?? {};\n}\n\nexport function getJestConfiguration() {\n const configuration = getConfiguration();\n return configuration.jest ?? configuration.test ?? {};\n}\n\nexport function getReviewConfiguration() {\n return getConfiguration().review ?? {};\n}\n\nexport function getStylelintConfiguration() {\n return getConfiguration().lint?.stylelint ?? {};\n}\n\nexport function getVitestConfiguration() {\n return getConfiguration().vitest ?? {};\n}\n\nexport function getWebpackConfiguration(locationOrJson?: LocationOrJson) {\n const { webpack } = getConfiguration(locationOrJson);\n return typeof webpack === 'object' ? webpack : {};\n}\n\nexport function getWebComponentConfiguration(\n locationOrJson: LocationOrJson = './'\n): WebComponentOptions | undefined {\n const config = getConfigurationSafe(locationOrJson)['web-component'];\n\n if (config === true) {\n return {};\n }\n\n if (typeof config === 'object') {\n return config;\n }\n\n if (typeof config === 'string') {\n const configPath = path.resolve(\n typeof locationOrJson === 'string' ? path.join(locationOrJson, config) : config\n );\n if (fs.existsSync(configPath)) {\n return require(path.resolve(configPath));\n }\n log.warning(`could not find web-component configuration: \"${config}\"`);\n\n return undefined;\n }\n}\n\nexport function getWebComponentBranchConfigs(locationOrJson: LocationOrJson = './') {\n const config = getWebComponentConfiguration(locationOrJson);\n\n return config?.branches;\n}\n\nexport function hasHeadlessBundle() {\n let source: string;\n try {\n source = getFolders().source;\n } catch {\n return false;\n }\n const headlessPath = path.join(source, 'headless.ts');\n return fs.existsSync(headlessPath);\n}\n\nexport function getSwcCompilePackageConfiguration() {\n return getConfiguration()['swc-compile-package'] ?? {};\n}\n\nexport function isBundle(locationOrJson?: LocationOrJson) {\n return getConfiguration(locationOrJson).webpack !== false;\n}\n\nexport function isCustomStyleRules() {\n return getWebpackConfiguration()['custom-style-rules'] === true;\n}\n\nexport function isDevServerDisabled() {\n const webpackConfiguration = getWebpackConfiguration();\n return webpackConfiguration.devServer === false;\n}\n\nexport function isExposeSharedDependencies() {\n return getWebpackConfiguration()['expose-shared-dependencies'] === true;\n}\n\nexport function isLegacy(locationOrJson?: LocationOrJson) {\n return getConfiguration(locationOrJson).legacy === true;\n}\n\nexport function isLegacyRoot() {\n return getWebComponentConfiguration()?.legacyRoot === true;\n}\n\nexport function isStyleCheckDisabled() {\n return getWebpackConfiguration()['disable-style-check'] === true;\n}\n\nexport function isWebComponent(locationOrJson: LocationOrJson = './') {\n return !!getWebComponentConfiguration(locationOrJson);\n}\n"],"names":["CommandName","allowedWebpackDevServerOptions","getConfiguration","getConfigurationSafe","getESLintConfiguration","getJestConfiguration","getReviewConfiguration","getStylelintConfiguration","getSwcCompilePackageConfiguration","getVitestConfiguration","getWebComponentBranchConfigs","getWebComponentConfiguration","getWebpackConfiguration","hasHeadlessBundle","isBundle","isCustomStyleRules","isDevServerDisabled","isExposeSharedDependencies","isLegacy","isLegacyRoot","isStyleCheckDisabled","isWebComponent","locationOrJson","json","readJson","path","join","cli","readJsonSafe","lint","eslint","configuration","jest","test","review","stylelint","vitest","webpack","config","configPath","resolve","fs","existsSync","require","log","warning","undefined","branches","source","getFolders","headlessPath","webpackConfiguration","devServer","legacy","legacyRoot"],"mappings":";;;;;;;;;;;QA+DYA;eAAAA;;QAjDCC;eAAAA;;QA6GGC;eAAAA;;QAQAC;eAAAA;;QAQAC;eAAAA;;QAIAC;eAAAA;;QAKAC;eAAAA;;QAIAC;eAAAA;;QAwDAC;eAAAA;;QApDAC;eAAAA;;QAmCAC;eAAAA;;QA1BAC;eAAAA;;QALAC;eAAAA;;QAqCAC;eAAAA;;QAeAC;eAAAA;;QAIAC;eAAAA;;QAIAC;eAAAA;;QAKAC;eAAAA;;QAIAC;eAAAA;;QAIAC;eAAAA;;QAIAC;eAAAA;;QAIAC;eAAAA;;;2DA9OD;6DACE;qBAMG;4BACO;0BACY;;;;;;AAEhC,MAAMpB,iCAAiC;IAAC;IAAW;IAAQ;IAAS;CAAS;AAiD7E,IAAA,AAAKD,qCAAAA;;;;;;;;;;;;;;;;;;;;;;WAAAA;;AA4DL,SAASE,iBAAiBoB,iBAAiC,IAAI;IAClE,MAAMC,OACF,OAAOD,mBAAmB,WACpBE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AC,6BAA6B,KAAK;AACvE;AAEO,SAASM,SAASI,cAA+B;IACpD,OAAOpB,iBAAiBoB,gBAAgB+B,MAAM,KAAK;AACvD;AAEO,SAASlC;QACLR;IAAP,OAAOA,EAAAA,gCAAAA,4CAAAA,oDAAAA,8BAAgC2C,UAAU,MAAK;AAC1D;AAEO,SAASlC;IACZ,OAAOR,yBAAyB,CAAC,sBAAsB,KAAK;AAChE;AAEO,SAASS,eAAeC,iBAAiC,IAAI;IAChE,OAAO,CAAC,CAACX,6BAA6BW;AAC1C"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@servicetitan/startup",
|
|
3
|
-
"version": "32.
|
|
3
|
+
"version": "32.5.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"homepage": "https://docs.st.dev/docs/frontend/startup",
|
|
6
6
|
"repository": {
|
|
@@ -38,8 +38,9 @@
|
|
|
38
38
|
"@jest/core": "~29.7.0",
|
|
39
39
|
"@jest/types": "~29.6.3",
|
|
40
40
|
"@jsdevtools/coverage-istanbul-loader": "^3.0.5",
|
|
41
|
-
"@servicetitan/eslint-config": "32.
|
|
42
|
-
"@servicetitan/
|
|
41
|
+
"@servicetitan/eslint-config": "32.5.0",
|
|
42
|
+
"@servicetitan/install": "32.5.0",
|
|
43
|
+
"@servicetitan/stylelint-config": "32.5.0",
|
|
43
44
|
"@svgr/webpack": "^8.1.0",
|
|
44
45
|
"@swc/cli": "^0.5.0",
|
|
45
46
|
"@swc/core": "1.13.5",
|
|
@@ -53,7 +54,7 @@
|
|
|
53
54
|
"debounce": "^2.2.0",
|
|
54
55
|
"debug": "^4.4.3",
|
|
55
56
|
"deepmerge": "~4.3.1",
|
|
56
|
-
"eslint": "~9.
|
|
57
|
+
"eslint": "~9.39.1",
|
|
57
58
|
"execa": "~5.1.1",
|
|
58
59
|
"glob": "~11.0.3",
|
|
59
60
|
"html-webpack-plugin": "~5.6.4",
|
|
@@ -77,8 +78,7 @@
|
|
|
77
78
|
"portfinder": "~1.0.38",
|
|
78
79
|
"postcss": "~8.5.6",
|
|
79
80
|
"prettier": "~3.6.2",
|
|
80
|
-
"
|
|
81
|
-
"sass": "~1.93.2",
|
|
81
|
+
"sass": "~1.93.3",
|
|
82
82
|
"sass-loader": "~16.0.6",
|
|
83
83
|
"semver": "~7.7.3",
|
|
84
84
|
"source-map-loader": "~5.0.0",
|
|
@@ -119,8 +119,7 @@
|
|
|
119
119
|
"jwa": [
|
|
120
120
|
"@progress/kendo-licensing@1.3.5 -> jsonwebtoken@9.0.2 -> jws@3.2.2 -> jwa@1.4.1",
|
|
121
121
|
"Forcing ^1.4.2 to fix Node v25 incompatibility in 1.4.1 (see https://github.com/auth0/node-jsonwebtoken/issues/992)"
|
|
122
|
-
]
|
|
123
|
-
"rollup": "Update/remove when https://github.com/rollup/rollup/issues/6168 is resolved"
|
|
122
|
+
]
|
|
124
123
|
},
|
|
125
124
|
"publishConfig": {
|
|
126
125
|
"access": "public"
|
|
@@ -128,5 +127,5 @@
|
|
|
128
127
|
"cli": {
|
|
129
128
|
"webpack": false
|
|
130
129
|
},
|
|
131
|
-
"gitHead": "
|
|
130
|
+
"gitHead": "9ba97491f520e7b5914179aa061d1c3c3285079d"
|
|
132
131
|
}
|
|
@@ -1,16 +1,13 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
1
|
+
import { gitCloneRepo, gitIsReachable } from '@servicetitan/install';
|
|
2
|
+
import fs from 'fs';
|
|
3
|
+
import { vol } from 'memfs';
|
|
3
4
|
import path from 'path';
|
|
4
5
|
|
|
5
6
|
import { log } from '../../../utils';
|
|
6
|
-
import { gitCloneRepo, gitIsReachable } from '../../utils';
|
|
7
7
|
import { Init } from '../init';
|
|
8
8
|
|
|
9
|
-
jest.mock('
|
|
10
|
-
jest.mock('
|
|
11
|
-
gitCloneRepo: jest.fn(),
|
|
12
|
-
gitIsReachable: jest.fn(),
|
|
13
|
-
}));
|
|
9
|
+
jest.mock('@servicetitan/install');
|
|
10
|
+
jest.mock('fs', () => require('memfs').fs);
|
|
14
11
|
jest.mock('../../../utils', () => ({
|
|
15
12
|
log: { debug: jest.fn(), error: jest.fn(), info: jest.fn() },
|
|
16
13
|
}));
|
|
@@ -21,7 +18,7 @@ describe(`[startup] ${Init.name}`, () => {
|
|
|
21
18
|
beforeEach(() => {
|
|
22
19
|
args = {};
|
|
23
20
|
vol.reset();
|
|
24
|
-
jest.mocked(gitCloneRepo).
|
|
21
|
+
jest.mocked(gitCloneRepo).mockReturnValue(true);
|
|
25
22
|
jest.spyOn(fs, 'mkdirSync').mockImplementation(jest.fn());
|
|
26
23
|
jest.spyOn(fs, 'rmSync').mockImplementation(jest.fn());
|
|
27
24
|
jest.spyOn(log, 'error').mockImplementation(jest.fn()); // suppress error output
|
|
@@ -34,16 +31,16 @@ describe(`[startup] ${Init.name}`, () => {
|
|
|
34
31
|
await subject();
|
|
35
32
|
|
|
36
33
|
expect(gitCloneRepo).toHaveBeenCalledWith({ destination: cwd, name: 'frontend-example' });
|
|
37
|
-
expect(rmSync).toHaveBeenCalledWith(path.join(cwd, '.git'), {
|
|
34
|
+
expect(fs.rmSync).toHaveBeenCalledWith(path.join(cwd, '.git'), {
|
|
38
35
|
recursive: true,
|
|
39
36
|
force: true,
|
|
40
37
|
});
|
|
41
|
-
expect(rmSync).toHaveBeenCalledWith(path.join(cwd, '.github', 'CODEOWNERS'));
|
|
42
|
-
expect(rmSync).toHaveBeenCalledWith(path.join(cwd, 'package-lock.json'));
|
|
38
|
+
expect(fs.rmSync).toHaveBeenCalledWith(path.join(cwd, '.github', 'CODEOWNERS'));
|
|
39
|
+
expect(fs.rmSync).toHaveBeenCalledWith(path.join(cwd, 'package-lock.json'));
|
|
43
40
|
});
|
|
44
41
|
|
|
45
42
|
describe('when cloning fails', () => {
|
|
46
|
-
beforeEach(() => jest.mocked(gitCloneRepo).
|
|
43
|
+
beforeEach(() => jest.mocked(gitCloneRepo).mockReturnValue(false));
|
|
47
44
|
|
|
48
45
|
describe('when repo is not reachable', () => {
|
|
49
46
|
beforeEach(() => {
|
|
@@ -66,7 +63,7 @@ describe(`[startup] ${Init.name}`, () => {
|
|
|
66
63
|
|
|
67
64
|
await subject();
|
|
68
65
|
|
|
69
|
-
expect(mkdirSync).toHaveBeenCalledWith(destination, { recursive: true });
|
|
66
|
+
expect(fs.mkdirSync).toHaveBeenCalledWith(destination, { recursive: true });
|
|
70
67
|
expect(gitCloneRepo).toHaveBeenCalledWith(expect.objectContaining({ destination }));
|
|
71
68
|
});
|
|
72
69
|
|
|
@@ -1,277 +1,72 @@
|
|
|
1
|
-
import { vol, fs } from 'memfs';
|
|
2
1
|
import { execSync } from 'child_process';
|
|
3
2
|
import { getStartupVersion, log } from '../../../utils';
|
|
4
|
-
import { gitCloneRepo, isCI, npmWhoAmI } from '../../utils';
|
|
5
3
|
|
|
6
4
|
import { Install } from '../install';
|
|
7
5
|
|
|
8
|
-
jest.mock('fs', () => fs);
|
|
9
6
|
jest.mock('child_process', () => ({ execSync: jest.fn() }));
|
|
10
|
-
jest.mock('../../utils', () => ({
|
|
11
|
-
...jest.requireActual('../../utils'),
|
|
12
|
-
gitCloneRepo: jest.fn(),
|
|
13
|
-
isCI: jest.fn(),
|
|
14
|
-
npmWhoAmI: jest.fn(),
|
|
15
|
-
}));
|
|
16
7
|
jest.mock('../../../utils', () => ({
|
|
17
8
|
...jest.requireActual('../../../utils'),
|
|
18
9
|
getStartupVersion: jest.fn(),
|
|
19
|
-
log: { debug: jest.fn(), info: jest.fn()
|
|
10
|
+
log: { debug: jest.fn(), info: jest.fn() }, // suppress log output
|
|
20
11
|
}));
|
|
21
12
|
|
|
22
13
|
describe(`${Install.name}`, () => {
|
|
23
|
-
const mockNpmToken = 'npm_Foo';
|
|
24
|
-
const npmOptions = ['--audit=false', '--fund=false', '--legacy-peer-deps'];
|
|
25
14
|
const startupVersion = '1.2.3';
|
|
26
|
-
const tempDirPath = 'tempDirPath';
|
|
27
15
|
let args: ConstructorParameters<typeof Install>[0];
|
|
28
16
|
|
|
29
|
-
function volFromJSON(overrides?: Record<string, string>) {
|
|
30
|
-
vol.fromJSON({
|
|
31
|
-
'.npmrc': '',
|
|
32
|
-
// Mock cloned Github repo with .npm.json containing readOnlyToken
|
|
33
|
-
[`${tempDirPath}/.npm.json`]: JSON.stringify({
|
|
34
|
-
readOnlyToken: Buffer.from(mockNpmToken).toString('base64'),
|
|
35
|
-
}),
|
|
36
|
-
...overrides,
|
|
37
|
-
});
|
|
38
|
-
}
|
|
39
|
-
|
|
40
17
|
beforeEach(() => {
|
|
41
18
|
args = {};
|
|
42
19
|
jest.clearAllMocks();
|
|
43
|
-
jest.mocked(gitCloneRepo).mockResolvedValue(true);
|
|
44
20
|
jest.mocked(getStartupVersion).mockReturnValue(startupVersion);
|
|
45
|
-
jest.mocked(isCI).mockReturnValue(false);
|
|
46
|
-
jest.mocked(npmWhoAmI).mockReturnValue(undefined);
|
|
47
|
-
jest.spyOn(fs, 'mkdtempSync').mockImplementation(() => tempDirPath);
|
|
48
|
-
volFromJSON();
|
|
49
21
|
});
|
|
50
22
|
|
|
51
|
-
afterEach(() => vol.reset());
|
|
52
|
-
|
|
53
23
|
const subject = async () => new Install(args).execute();
|
|
54
24
|
|
|
55
|
-
test('
|
|
56
|
-
await subject();
|
|
57
|
-
|
|
58
|
-
expect(gitCloneRepo).toHaveBeenCalledWith({
|
|
59
|
-
destination: tempDirPath,
|
|
60
|
-
name: 'frontend-dev-config',
|
|
61
|
-
});
|
|
62
|
-
});
|
|
63
|
-
|
|
64
|
-
test('configures NPM token with value from cloned repo', async () => {
|
|
65
|
-
await subject();
|
|
66
|
-
|
|
67
|
-
expect(execSync).toHaveBeenCalledWith(
|
|
68
|
-
`npm config set "//registry.npmjs.org/:_authToken"="${mockNpmToken}"`
|
|
69
|
-
);
|
|
70
|
-
});
|
|
71
|
-
|
|
72
|
-
test('deletes NPM token from project .npmrc', async () => {
|
|
25
|
+
test('runs install', async () => {
|
|
73
26
|
await subject();
|
|
74
27
|
|
|
75
|
-
expect(execSync).toHaveBeenCalledWith(
|
|
76
|
-
`npm config delete --location=project "//registry.npmjs.org/:_authToken"`
|
|
77
|
-
);
|
|
28
|
+
expect(execSync).toHaveBeenCalledWith(`npx @servicetitan/install`, { stdio: 'inherit' });
|
|
78
29
|
});
|
|
79
30
|
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
await subject();
|
|
84
|
-
|
|
85
|
-
expect(rmSpy).toHaveBeenCalledWith(tempDirPath, { recursive: true, force: true });
|
|
86
|
-
});
|
|
87
|
-
|
|
88
|
-
test(`runs npm i ${npmOptions.join(' ')}`, async () => {
|
|
89
|
-
await subject();
|
|
90
|
-
|
|
91
|
-
expect(execSync).toHaveBeenCalledWith(`npm i ${npmOptions.join(' ')}`, {
|
|
92
|
-
stdio: 'inherit',
|
|
93
|
-
});
|
|
94
|
-
});
|
|
95
|
-
|
|
96
|
-
test('logs progress', async () => {
|
|
97
|
-
await subject();
|
|
31
|
+
describe.each(['fix', 'quiet', 'token'])('with --%s', option => {
|
|
32
|
+
beforeEach(() => (args[option] = true));
|
|
98
33
|
|
|
99
|
-
|
|
100
|
-
message => {
|
|
101
|
-
expect(log.info).toHaveBeenCalledWith(expect.stringMatching(message));
|
|
102
|
-
}
|
|
103
|
-
);
|
|
104
|
-
});
|
|
105
|
-
|
|
106
|
-
function itDoesNotConfigureNpmToken() {
|
|
107
|
-
test('does not configure NPM token', async () => {
|
|
108
|
-
await subject();
|
|
109
|
-
|
|
110
|
-
expect(gitCloneRepo).not.toHaveBeenCalled();
|
|
111
|
-
expect(execSync).not.toHaveBeenCalledWith(
|
|
112
|
-
expect.stringMatching(/npm config/),
|
|
113
|
-
expect.anything()
|
|
114
|
-
);
|
|
115
|
-
});
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
function itDoesNotDeleteProjectToken() {
|
|
119
|
-
test('does not delete project token', async () => {
|
|
34
|
+
test(`runs install with --${option}`, async () => {
|
|
120
35
|
await subject();
|
|
121
36
|
|
|
122
|
-
expect(execSync).
|
|
123
|
-
expect.
|
|
37
|
+
expect(execSync).toHaveBeenCalledWith(
|
|
38
|
+
expect.stringContaining(`--${option}`),
|
|
124
39
|
expect.anything()
|
|
125
40
|
);
|
|
126
41
|
});
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
describe('when "st-team" is already logged in', () => {
|
|
130
|
-
beforeEach(() => jest.mocked(npmWhoAmI).mockReturnValue('st-team'));
|
|
131
|
-
|
|
132
|
-
itDoesNotConfigureNpmToken();
|
|
133
|
-
|
|
134
|
-
describe('with --token', () => {
|
|
135
|
-
beforeEach(() => (args = { token: true }));
|
|
136
|
-
|
|
137
|
-
test('configures NPM token', async () => {
|
|
138
|
-
await subject();
|
|
139
|
-
|
|
140
|
-
expect(execSync).toHaveBeenCalledWith(expect.stringMatching(/npm config set/));
|
|
141
|
-
});
|
|
142
|
-
});
|
|
143
|
-
});
|
|
144
|
-
|
|
145
|
-
describe('when .npmrc uses an environment variable', () => {
|
|
146
|
-
beforeEach(() => {
|
|
147
|
-
volFromJSON({
|
|
148
|
-
'.npmrc': [
|
|
149
|
-
// eslint-disable-next-line no-template-curly-in-string
|
|
150
|
-
'#//registry.npmjs.org/:_authToken=${NPM_READONLY_TOKEN}', // should ignore this comment
|
|
151
|
-
// eslint-disable-next-line no-template-curly-in-string
|
|
152
|
-
'//registry.npmjs.org/:_authToken=${ST_NPM_READONLY_TOKEN}',
|
|
153
|
-
].join('\n'),
|
|
154
|
-
});
|
|
155
|
-
});
|
|
156
|
-
|
|
157
|
-
test('runs npm i with environment variable', async () => {
|
|
158
|
-
await subject();
|
|
159
|
-
|
|
160
|
-
expect(execSync).toHaveBeenCalledWith(`npm i ${npmOptions.join(' ')}`, {
|
|
161
|
-
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
162
|
-
env: expect.objectContaining({ ST_NPM_READONLY_TOKEN: mockNpmToken }),
|
|
163
|
-
stdio: 'inherit',
|
|
164
|
-
});
|
|
165
|
-
});
|
|
166
|
-
|
|
167
|
-
itDoesNotDeleteProjectToken();
|
|
168
42
|
});
|
|
169
43
|
|
|
170
|
-
describe('with no
|
|
171
|
-
beforeEach(() =>
|
|
172
|
-
|
|
173
|
-
itDoesNotDeleteProjectToken();
|
|
174
|
-
});
|
|
175
|
-
|
|
176
|
-
describe('when in CI environment', () => {
|
|
177
|
-
beforeEach(() => jest.mocked(isCI).mockReturnValue(true));
|
|
178
|
-
|
|
179
|
-
test('runs npm ci', async () => {
|
|
180
|
-
await subject();
|
|
181
|
-
|
|
182
|
-
expect(execSync).toHaveBeenCalledWith(`npm ci ${npmOptions.join(' ')}`, {
|
|
183
|
-
stdio: 'inherit',
|
|
184
|
-
});
|
|
185
|
-
});
|
|
186
|
-
|
|
187
|
-
itDoesNotConfigureNpmToken();
|
|
188
|
-
});
|
|
189
|
-
|
|
190
|
-
describe('with --quite', () => {
|
|
191
|
-
beforeEach(() => (args = { quiet: true }));
|
|
192
|
-
|
|
193
|
-
test('does not log progress', async () => {
|
|
194
|
-
await subject();
|
|
195
|
-
|
|
196
|
-
expect(log.info).not.toHaveBeenCalled();
|
|
197
|
-
});
|
|
198
|
-
});
|
|
199
|
-
|
|
200
|
-
describe('with --fix', () => {
|
|
201
|
-
const fixOptions = [...npmOptions, '--package-lock-only', '--prefer-dedupe'];
|
|
202
|
-
|
|
203
|
-
beforeEach(() => (args = { fix: true }));
|
|
44
|
+
describe('with --no-token', () => {
|
|
45
|
+
beforeEach(() => (args.token = false));
|
|
204
46
|
|
|
205
|
-
test(
|
|
47
|
+
test('runs install with --no-token', async () => {
|
|
206
48
|
await subject();
|
|
207
49
|
|
|
208
50
|
expect(execSync).toHaveBeenCalledWith(
|
|
209
|
-
|
|
51
|
+
expect.stringContaining('--no-token'),
|
|
210
52
|
expect.anything()
|
|
211
53
|
);
|
|
212
54
|
});
|
|
213
|
-
|
|
214
|
-
itDoesNotConfigureNpmToken();
|
|
215
55
|
});
|
|
216
56
|
|
|
217
|
-
|
|
218
|
-
|
|
57
|
+
test('logs progress', async () => {
|
|
58
|
+
await subject();
|
|
219
59
|
|
|
220
|
-
|
|
60
|
+
expect(log.info).toHaveBeenCalledWith(`startup cli v${startupVersion}`);
|
|
221
61
|
});
|
|
222
62
|
|
|
223
|
-
describe('with --
|
|
224
|
-
beforeEach(() => (args = {
|
|
225
|
-
|
|
226
|
-
test('does not run "npm i"', async () => {
|
|
227
|
-
await subject();
|
|
228
|
-
|
|
229
|
-
expect(execSync).not.toHaveBeenCalledWith(
|
|
230
|
-
expect.stringMatching(/npm i/),
|
|
231
|
-
expect.anything()
|
|
232
|
-
);
|
|
233
|
-
});
|
|
234
|
-
});
|
|
63
|
+
describe('with --quiet', () => {
|
|
64
|
+
beforeEach(() => (args = { quiet: true }));
|
|
235
65
|
|
|
236
|
-
|
|
237
|
-
test('logs error', async () => {
|
|
66
|
+
test('does not log progress', async () => {
|
|
238
67
|
await subject();
|
|
239
68
|
|
|
240
|
-
expect(log.
|
|
69
|
+
expect(log.info).not.toHaveBeenCalled();
|
|
241
70
|
});
|
|
242
|
-
}
|
|
243
|
-
|
|
244
|
-
describe('when error occurs fetching token', () => {
|
|
245
|
-
beforeEach(() => jest.mocked(gitCloneRepo).mockResolvedValue(false));
|
|
246
|
-
|
|
247
|
-
itLogsError(/could not clone servicetitan\/frontend-dev-config/);
|
|
248
|
-
});
|
|
249
|
-
|
|
250
|
-
describe('when .npm.json is not an object', () => {
|
|
251
|
-
beforeEach(() => volFromJSON({ [`${tempDirPath}/.npm.json`]: JSON.stringify('') }));
|
|
252
|
-
|
|
253
|
-
itLogsError(/is not an object/);
|
|
254
|
-
});
|
|
255
|
-
|
|
256
|
-
describe('when .npm.json omits readOnlyToken', () => {
|
|
257
|
-
beforeEach(() => volFromJSON({ [`${tempDirPath}/.npm.json`]: JSON.stringify({}) }));
|
|
258
|
-
|
|
259
|
-
itLogsError(/does not contain auth token/);
|
|
260
|
-
});
|
|
261
|
-
|
|
262
|
-
describe('when readOnlyToken is blank', () => {
|
|
263
|
-
beforeEach(() =>
|
|
264
|
-
volFromJSON({ [`${tempDirPath}/.npm.json`]: JSON.stringify({ readOnlyToken: '' }) })
|
|
265
|
-
);
|
|
266
|
-
|
|
267
|
-
itLogsError(/does not contain auth token/);
|
|
268
|
-
});
|
|
269
|
-
|
|
270
|
-
describe('when readOnlyToken is not a string', () => {
|
|
271
|
-
beforeEach(() =>
|
|
272
|
-
volFromJSON({ [`${tempDirPath}/.npm.json`]: JSON.stringify({ readOnlyToken: {} }) })
|
|
273
|
-
);
|
|
274
|
-
|
|
275
|
-
itLogsError(/token is not a string/);
|
|
276
71
|
});
|
|
277
72
|
});
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import { Lint } from '../lint';
|
|
2
2
|
import { eslint, lernaExec } from '../../utils';
|
|
3
3
|
import { getPackages } from '../../../utils';
|
|
4
|
+
import { stylelint } from '../../utils/stylelint';
|
|
4
5
|
|
|
5
|
-
jest.mock('
|
|
6
|
-
jest.mock('stylelint', () => ({ lint: jest.fn(() => ({ report: '' })) }));
|
|
6
|
+
jest.mock('stylelint', () => ({ lint: jest.fn() }));
|
|
7
7
|
|
|
8
8
|
jest.mock('../../utils');
|
|
9
|
+
jest.mock('../../utils/stylelint');
|
|
9
10
|
jest.mock('../../../utils', () => ({
|
|
10
|
-
log: { info: jest.fn() },
|
|
11
|
+
log: { debug: jest.fn(), info: jest.fn() },
|
|
11
12
|
getConfiguration: jest.fn(() => ({})),
|
|
12
13
|
getDestinationFolders: jest.fn(() => []),
|
|
13
14
|
getPackages: jest.fn(() => []),
|
|
@@ -22,7 +23,7 @@ describe(`[startup] ${Lint.name}`, () => {
|
|
|
22
23
|
jest.clearAllMocks();
|
|
23
24
|
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
24
25
|
args = { _: [] };
|
|
25
|
-
(getPackages
|
|
26
|
+
jest.mocked(getPackages).mockReturnValue(packages.map(name => ({ name }) as any));
|
|
26
27
|
});
|
|
27
28
|
|
|
28
29
|
const subject = async () => new Lint(args).execute();
|
|
@@ -30,12 +31,41 @@ describe(`[startup] ${Lint.name}`, () => {
|
|
|
30
31
|
test('runs styles-check', async () => {
|
|
31
32
|
await subject();
|
|
32
33
|
|
|
33
|
-
expect(lernaExec).toHaveBeenCalledWith(
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
34
|
+
expect(lernaExec).toHaveBeenCalledWith({ cmd: 'startup styles-check', stream: true });
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
describe('with "scope"', () => {
|
|
38
|
+
beforeEach(() => (args.scope = ['package-a']));
|
|
39
|
+
|
|
40
|
+
test('filters styles-check packages', async () => {
|
|
41
|
+
await subject();
|
|
42
|
+
|
|
43
|
+
expect(getPackages).toHaveBeenCalledWith({ scope: args.scope });
|
|
44
|
+
|
|
45
|
+
expect(lernaExec).toHaveBeenCalledWith(
|
|
46
|
+
expect.objectContaining({
|
|
47
|
+
cmd: 'startup styles-check',
|
|
48
|
+
scope: packages,
|
|
49
|
+
})
|
|
50
|
+
);
|
|
51
|
+
});
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
describe('with "ignore"', () => {
|
|
55
|
+
beforeEach(() => (args.ignore = ['package-a']));
|
|
56
|
+
|
|
57
|
+
test('filters styles-check packages', async () => {
|
|
58
|
+
await subject();
|
|
59
|
+
|
|
60
|
+
expect(getPackages).toHaveBeenCalledWith({ ignore: args.ignore });
|
|
61
|
+
|
|
62
|
+
expect(lernaExec).toHaveBeenCalledWith(
|
|
63
|
+
expect.objectContaining({
|
|
64
|
+
cmd: 'startup styles-check',
|
|
65
|
+
scope: packages,
|
|
66
|
+
})
|
|
67
|
+
);
|
|
68
|
+
});
|
|
39
69
|
});
|
|
40
70
|
|
|
41
71
|
test('command is greedy', () => {
|
|
@@ -48,6 +78,12 @@ describe(`[startup] ${Lint.name}`, () => {
|
|
|
48
78
|
expect(eslint).toHaveBeenCalledWith({ paths: [] });
|
|
49
79
|
});
|
|
50
80
|
|
|
81
|
+
test('runs stylelint', async () => {
|
|
82
|
+
await subject();
|
|
83
|
+
|
|
84
|
+
expect(stylelint).toHaveBeenCalledWith({ paths: [] });
|
|
85
|
+
});
|
|
86
|
+
|
|
51
87
|
describe('when instructed to fix issues', () => {
|
|
52
88
|
beforeEach(() => (args.fix = true));
|
|
53
89
|
|
|
@@ -56,6 +92,12 @@ describe(`[startup] ${Lint.name}`, () => {
|
|
|
56
92
|
|
|
57
93
|
expect(eslint).toHaveBeenCalledWith({ fix: true, paths: [] });
|
|
58
94
|
});
|
|
95
|
+
|
|
96
|
+
test('instructs stylelint to fix issues', async () => {
|
|
97
|
+
await subject();
|
|
98
|
+
|
|
99
|
+
expect(stylelint).toHaveBeenCalledWith({ fix: true, paths: [] });
|
|
100
|
+
});
|
|
59
101
|
});
|
|
60
102
|
|
|
61
103
|
function itRunsLernaExec() {
|
|
@@ -1,13 +1,15 @@
|
|
|
1
|
+
import { npmWhoAmI } from '@servicetitan/install';
|
|
1
2
|
import chalk from 'chalk';
|
|
2
3
|
import Table from 'cli-table3';
|
|
3
|
-
import {
|
|
4
|
+
import { vol } from 'memfs';
|
|
4
5
|
import { createInterface } from 'readline/promises';
|
|
5
6
|
import { formatRelativeDate, toArray } from '../../../utils';
|
|
6
|
-
import { isTTY, npmView,
|
|
7
|
+
import { isTTY, npmView, runCommand } from '../../utils';
|
|
7
8
|
import { MFEList } from '../mfe-list';
|
|
8
9
|
|
|
10
|
+
jest.mock('@servicetitan/install');
|
|
9
11
|
jest.mock('cli-table3');
|
|
10
|
-
jest.mock('fs', () => fs);
|
|
12
|
+
jest.mock('fs', () => require('memfs').fs);
|
|
11
13
|
jest.mock('readline/promises', () => ({
|
|
12
14
|
createInterface: jest.fn(),
|
|
13
15
|
}));
|
|
@@ -15,7 +17,6 @@ jest.mock('../../utils', () => ({
|
|
|
15
17
|
...jest.requireActual('../../utils'),
|
|
16
18
|
isTTY: jest.fn(),
|
|
17
19
|
npmView: jest.fn(),
|
|
18
|
-
npmWhoAmI: jest.fn(),
|
|
19
20
|
runCommand: jest.fn(),
|
|
20
21
|
}));
|
|
21
22
|
|