@servicetitan/startup 32.1.0 → 32.3.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 +36 -7
- package/dist/cli/commands/build.d.ts.map +1 -1
- package/dist/cli/commands/build.js +35 -10
- package/dist/cli/commands/build.js.map +1 -1
- package/dist/cli/commands/bundle-package.d.ts +9 -10
- package/dist/cli/commands/bundle-package.d.ts.map +1 -1
- package/dist/cli/commands/bundle-package.js +6 -22
- package/dist/cli/commands/bundle-package.js.map +1 -1
- package/dist/cli/commands/clean.d.ts +2 -2
- package/dist/cli/commands/clean.d.ts.map +1 -1
- package/dist/cli/commands/clean.js +16 -4
- package/dist/cli/commands/clean.js.map +1 -1
- package/dist/cli/commands/convert-eslint-config.d.ts +2 -2
- package/dist/cli/commands/convert-eslint-config.d.ts.map +1 -1
- package/dist/cli/commands/convert-eslint-config.js +3 -4
- package/dist/cli/commands/convert-eslint-config.js.map +1 -1
- package/dist/cli/commands/eslint.d.ts +3 -5
- package/dist/cli/commands/eslint.d.ts.map +1 -1
- package/dist/cli/commands/eslint.js +2 -18
- 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 +2 -0
- package/dist/cli/commands/get-command.js.map +1 -1
- package/dist/cli/commands/index.d.ts +0 -1
- package/dist/cli/commands/index.d.ts.map +1 -1
- package/dist/cli/commands/index.js +0 -1
- 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 +9 -8
- package/dist/cli/commands/init.js.map +1 -1
- package/dist/cli/commands/install.d.ts +21 -7
- package/dist/cli/commands/install.d.ts.map +1 -1
- package/dist/cli/commands/install.js +33 -11
- package/dist/cli/commands/install.js.map +1 -1
- package/dist/cli/commands/kendo-ui-license.d.ts +3 -3
- package/dist/cli/commands/kendo-ui-license.d.ts.map +1 -1
- package/dist/cli/commands/kendo-ui-license.js +17 -5
- package/dist/cli/commands/kendo-ui-license.js.map +1 -1
- package/dist/cli/commands/lint.d.ts +31 -12
- package/dist/cli/commands/lint.d.ts.map +1 -1
- package/dist/cli/commands/lint.js +34 -13
- package/dist/cli/commands/lint.js.map +1 -1
- package/dist/cli/commands/mfe-list.d.ts +46 -0
- package/dist/cli/commands/mfe-list.d.ts.map +1 -0
- package/dist/cli/commands/mfe-list.js +200 -0
- package/dist/cli/commands/mfe-list.js.map +1 -0
- package/dist/cli/commands/mfe-package-clean.d.ts +29 -5
- package/dist/cli/commands/mfe-package-clean.d.ts.map +1 -1
- package/dist/cli/commands/mfe-package-clean.js +28 -5
- package/dist/cli/commands/mfe-package-clean.js.map +1 -1
- package/dist/cli/commands/mfe-package-publish.d.ts +37 -5
- package/dist/cli/commands/mfe-package-publish.d.ts.map +1 -1
- package/dist/cli/commands/mfe-package-publish.js +36 -5
- package/dist/cli/commands/mfe-package-publish.js.map +1 -1
- package/dist/cli/commands/mfe-publish.d.ts +17 -4
- package/dist/cli/commands/mfe-publish.d.ts.map +1 -1
- package/dist/cli/commands/mfe-publish.js +37 -7
- package/dist/cli/commands/mfe-publish.js.map +1 -1
- package/dist/cli/commands/prepare-package.d.ts +3 -5
- package/dist/cli/commands/prepare-package.d.ts.map +1 -1
- package/dist/cli/commands/prepare-package.js +2 -18
- package/dist/cli/commands/prepare-package.js.map +1 -1
- package/dist/cli/commands/review/review.d.ts +14 -6
- package/dist/cli/commands/review/review.d.ts.map +1 -1
- package/dist/cli/commands/review/review.js +27 -23
- package/dist/cli/commands/review/review.js.map +1 -1
- package/dist/cli/commands/run-task.d.ts +10 -6
- package/dist/cli/commands/run-task.d.ts.map +1 -1
- package/dist/cli/commands/run-task.js +16 -13
- package/dist/cli/commands/run-task.js.map +1 -1
- package/dist/cli/commands/start.d.ts +28 -7
- package/dist/cli/commands/start.d.ts.map +1 -1
- package/dist/cli/commands/start.js +27 -10
- package/dist/cli/commands/start.js.map +1 -1
- package/dist/cli/commands/styles-check.d.ts +2 -2
- package/dist/cli/commands/styles-check.d.ts.map +1 -1
- package/dist/cli/commands/styles-check.js +2 -1
- package/dist/cli/commands/styles-check.js.map +1 -1
- package/dist/cli/commands/test/runners/vitest.js +2 -1
- package/dist/cli/commands/test/runners/vitest.js.map +1 -1
- package/dist/cli/commands/test/tests.d.ts +14 -5
- package/dist/cli/commands/test/tests.d.ts.map +1 -1
- package/dist/cli/commands/test/tests.js +26 -13
- package/dist/cli/commands/test/tests.js.map +1 -1
- package/dist/cli/commands/types.d.ts +13 -4
- package/dist/cli/commands/types.d.ts.map +1 -1
- package/dist/cli/commands/types.js +28 -0
- package/dist/cli/commands/types.js.map +1 -1
- package/dist/cli/commands/upload-sourcemaps.d.ts +3 -5
- package/dist/cli/commands/upload-sourcemaps.d.ts.map +1 -1
- package/dist/cli/commands/upload-sourcemaps.js +5 -20
- package/dist/cli/commands/upload-sourcemaps.js.map +1 -1
- package/dist/cli/index.js +48 -39
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/tasks/swc-compile-package.d.ts +2 -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 +2 -2
- package/dist/cli/tasks/tsc-compile-package.d.ts.map +1 -1
- package/dist/cli/tasks/tsc-compile-package.js +1 -1
- package/dist/cli/tasks/tsc-compile-package.js.map +1 -1
- package/dist/cli/tasks/tsc-compile.d.ts +2 -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.js +2 -2
- package/dist/cli/utils/bundle.js.map +1 -1
- package/dist/cli/utils/cli-npm.d.ts +14 -0
- package/dist/cli/utils/cli-npm.d.ts.map +1 -1
- package/dist/cli/utils/cli-npm.js +44 -0
- package/dist/cli/utils/cli-npm.js.map +1 -1
- package/dist/cli/utils/cli-os.d.ts +2 -2
- package/dist/cli/utils/cli-os.d.ts.map +1 -1
- package/dist/cli/utils/cli-os.js +13 -9
- package/dist/cli/utils/cli-os.js.map +1 -1
- package/dist/cli/utils/eslint.d.ts +2 -1
- 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 +1 -0
- package/dist/cli/utils/index.d.ts.map +1 -1
- package/dist/cli/utils/index.js +1 -0
- package/dist/cli/utils/index.js.map +1 -1
- package/dist/cli/utils/is-tty.d.ts +2 -0
- package/dist/cli/utils/is-tty.d.ts.map +1 -0
- package/dist/cli/utils/is-tty.js +15 -0
- package/dist/cli/utils/is-tty.js.map +1 -0
- package/dist/cli/utils/maybe-create-git-folder.d.ts +1 -1
- package/dist/cli/utils/maybe-create-git-folder.d.ts.map +1 -1
- package/dist/cli/utils/maybe-create-git-folder.js +12 -6
- package/dist/cli/utils/maybe-create-git-folder.js.map +1 -1
- package/dist/cli/utils/process-tree.d.ts.map +1 -1
- package/dist/cli/utils/process-tree.js +2 -2
- package/dist/cli/utils/process-tree.js.map +1 -1
- package/dist/cli/utils/set-node-options.d.ts.map +1 -1
- package/dist/cli/utils/set-node-options.js +2 -1
- package/dist/cli/utils/set-node-options.js.map +1 -1
- package/dist/utils/find-packages.d.ts +1 -0
- package/dist/utils/find-packages.d.ts.map +1 -1
- package/dist/utils/find-packages.js.map +1 -1
- package/dist/utils/format-relative-date.d.ts +2 -0
- package/dist/utils/format-relative-date.d.ts.map +1 -0
- package/dist/utils/format-relative-date.js +60 -0
- package/dist/utils/format-relative-date.js.map +1 -0
- package/dist/utils/get-configuration.d.ts +10 -3
- 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/dist/utils/get-jest-config.d.ts.map +1 -1
- package/dist/utils/get-jest-config.js +20 -9
- package/dist/utils/get-jest-config.js.map +1 -1
- package/dist/utils/get-packages.d.ts +3 -5
- package/dist/utils/get-packages.d.ts.map +1 -1
- package/dist/utils/get-packages.js +1 -4
- package/dist/utils/get-packages.js.map +1 -1
- package/dist/utils/get-startup-version.d.ts.map +1 -1
- package/dist/utils/get-startup-version.js +1 -1
- package/dist/utils/get-startup-version.js.map +1 -1
- package/dist/utils/index.d.ts +2 -0
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/index.js +2 -0
- package/dist/utils/index.js.map +1 -1
- package/dist/utils/omit.d.ts +2 -0
- package/dist/utils/omit.d.ts.map +1 -0
- package/dist/utils/omit.js +28 -0
- package/dist/utils/omit.js.map +1 -0
- package/dist/webpack/configs/loaders/style-loader.d.ts +1 -1
- package/dist/webpack/configs/loaders/style-loader.d.ts.map +1 -1
- package/dist/webpack/configs/loaders/style-loader.js +2 -2
- package/dist/webpack/configs/loaders/style-loader.js.map +1 -1
- package/dist/webpack/configs/optimization-config.js +5 -5
- package/dist/webpack/configs/optimization-config.js.map +1 -1
- package/dist/webpack/configs/output-config.d.ts.map +1 -1
- package/dist/webpack/configs/output-config.js +14 -7
- 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 +10 -3
- package/dist/webpack/configs/plugins/assets-manifest-plugin.js.map +1 -1
- package/package.json +26 -20
- package/src/cli/commands/__tests__/build.test.ts +1 -1
- package/src/cli/commands/__tests__/bundle-package.test.ts +22 -2
- package/src/cli/commands/__tests__/install.test.ts +42 -4
- package/src/cli/commands/__tests__/lint.test.ts +1 -1
- package/src/cli/commands/__tests__/mfe-list.test.ts +394 -0
- package/src/cli/commands/__tests__/mfe-publish.test.ts +25 -0
- package/src/cli/commands/__tests__/start.test.ts +1 -1
- package/src/cli/commands/build.ts +14 -10
- package/src/cli/commands/bundle-package.ts +19 -13
- package/src/cli/commands/clean.ts +2 -4
- package/src/cli/commands/convert-eslint-config.ts +3 -5
- package/src/cli/commands/eslint.ts +3 -5
- package/src/cli/commands/get-command.ts +2 -0
- package/src/cli/commands/index.ts +0 -1
- package/src/cli/commands/init.ts +7 -8
- package/src/cli/commands/install.ts +24 -11
- package/src/cli/commands/kendo-ui-license.ts +4 -6
- package/src/cli/commands/lint.ts +19 -19
- package/src/cli/commands/mfe-list.ts +173 -0
- package/src/cli/commands/mfe-package-clean.ts +25 -4
- package/src/cli/commands/mfe-package-publish.ts +33 -4
- package/src/cli/commands/mfe-publish.ts +37 -6
- package/src/cli/commands/prepare-package.ts +3 -5
- package/src/cli/commands/review/review.ts +9 -9
- package/src/cli/commands/run-task.ts +15 -11
- package/src/cli/commands/start.ts +12 -10
- package/src/cli/commands/styles-check.ts +2 -2
- package/src/cli/commands/test/__tests__/tests.test.ts +1 -1
- package/src/cli/commands/test/runners/__tests__/vitest.test.ts +82 -13
- package/src/cli/commands/test/runners/vitest.ts +4 -2
- package/src/cli/commands/test/tests.ts +20 -10
- package/src/cli/commands/types.ts +14 -4
- package/src/cli/commands/upload-sourcemaps.ts +3 -5
- package/src/cli/index.ts +59 -36
- package/src/cli/tasks/swc-compile-package.ts +2 -2
- package/src/cli/tasks/tsc-compile-package.ts +4 -3
- package/src/cli/tasks/tsc-compile.ts +2 -2
- package/src/cli/utils/__tests__/bundle.test.ts +13 -0
- package/src/cli/utils/__tests__/cli-npm.test.ts +89 -0
- package/src/cli/utils/__tests__/is-tty.test.ts +17 -0
- package/src/cli/utils/__tests__/maybe-create-git-folder.test.ts +10 -17
- package/src/cli/utils/__tests__/set-node-options.test.ts +10 -10
- package/src/cli/utils/bundle.ts +2 -2
- package/src/cli/utils/cli-npm.ts +34 -0
- package/src/cli/utils/cli-os.ts +12 -25
- package/src/cli/utils/eslint.ts +2 -1
- package/src/cli/utils/index.ts +1 -0
- package/src/cli/utils/is-tty.ts +3 -0
- package/src/cli/utils/maybe-create-git-folder.ts +10 -8
- package/src/cli/utils/process-tree.ts +4 -2
- package/src/cli/utils/set-node-options.ts +2 -1
- package/src/utils/__tests__/format-relative-date.test.ts +61 -0
- package/src/utils/__tests__/get-jest-config.test.ts +44 -0
- package/src/utils/__tests__/get-packages.test.ts +3 -0
- package/src/utils/find-packages.ts +1 -0
- package/src/utils/format-relative-date.ts +33 -0
- package/src/utils/get-configuration.ts +7 -2
- package/src/utils/get-jest-config.ts +36 -18
- package/src/utils/get-packages.ts +3 -9
- package/src/utils/get-startup-version.ts +1 -3
- package/src/utils/index.ts +2 -0
- package/src/utils/omit.ts +12 -0
- package/src/webpack/__mocks__/style-rules.ts +3 -3
- package/src/webpack/__tests__/create-webpack-config-shared-dependencies.test.ts +6 -14
- package/src/webpack/__tests__/create-webpack-config-web-component.test.ts +52 -29
- package/src/webpack/configs/loaders/style-loader.ts +5 -2
- package/src/webpack/configs/optimization-config.ts +5 -5
- package/src/webpack/configs/output-config.ts +10 -5
- package/src/webpack/configs/plugins/assets-manifest-plugin.ts +11 -4
- package/dist/cli/commands/get-user-commands.d.ts +0 -7
- package/dist/cli/commands/get-user-commands.d.ts.map +0 -1
- package/dist/cli/commands/get-user-commands.js +0 -27
- package/dist/cli/commands/get-user-commands.js.map +0 -1
- package/src/cli/commands/__tests__/get-user-commands.test.ts +0 -27
- package/src/cli/commands/get-user-commands.ts +0 -19
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/cli/commands/start.ts"],"sourcesContent":["import { getPackages, log, logErrors, PackageType } from '../../utils';\nimport {\n checkArgs,\n lernaExec,\n compile,\n typeCheck,\n pipeStdout,\n watchStdout,\n ProcessTree,\n} from '../utils';\nimport { Command } from './types';\n\ninterface Args {\n 'config'?: string;\n 'code-coverage'?: boolean;\n 'ignore'?: string | string[];\n 'scope'?: string | string[];\n 'use-tsc'?: boolean;\n}\n\nenum StartProcesses {\n Compile,\n KendoUILicense,\n PreparePackage,\n PreparePackageWatch,\n TypeCheck,\n BundleExposedDependencies,\n BundlePackage,\n}\n\nexport class Start
|
|
1
|
+
{"version":3,"sources":["../../../src/cli/commands/start.ts"],"sourcesContent":["import { getPackages, log, logErrors, PackageType } from '../../utils';\nimport {\n checkArgs,\n lernaExec,\n compile,\n typeCheck,\n pipeStdout,\n watchStdout,\n ProcessTree,\n} from '../utils';\nimport { Command, CommandArgs } from './types';\n\ninterface Args extends CommandArgs {\n 'config'?: string;\n 'code-coverage'?: boolean;\n 'ignore'?: string | string[];\n 'scope'?: string | string[];\n 'use-tsc'?: boolean;\n}\n\nenum StartProcesses {\n Compile,\n KendoUILicense,\n PreparePackage,\n PreparePackageWatch,\n TypeCheck,\n BundleExposedDependencies,\n BundlePackage,\n}\n\nexport class Start extends Command<Args> {\n static readonly description = 'Run project in development mode';\n static readonly greedy = true;\n static readonly options = {\n 'config': { string: true, hidden: true, description: 'Use specified configuration' },\n 'code-coverage': { boolean: true, description: 'Instrument code for coverage analysis?' },\n 'ignore': { array: true, description: 'Packages to skip' },\n 'scope': { array: true, description: 'Packages to run and watch' },\n 'use-tsc': { boolean: true, description: 'Use tsc to compile packages?' },\n };\n\n @logErrors\n async execute() {\n checkArgs(this.args, { obsolete: ['--esbuild', '--experimental-bundlers'] });\n\n const useTsc = this.args['use-tsc'];\n\n const packages = getPackages({\n scope: this.args.scope,\n ignore: this.args.ignore,\n type: [PackageType.TSC, PackageType.Webpack],\n });\n if (packages.length === 0) {\n return;\n }\n\n const scope = packages.map(({ name }) => name);\n const webpackScope = packages\n .filter(({ type }) => type === PackageType.Webpack)\n .map(({ name }) => name);\n\n const processTree = new ProcessTree<typeof StartProcesses>();\n\n processTree.add(StartProcesses.Compile, () => {\n const process = compile({\n packages: scope,\n watch: true,\n useTsc,\n });\n\n pipeStdout(process);\n\n const onComplete = new Promise<void>(resolve => {\n let counter = 0;\n let timeout: NodeJS.Timeout;\n\n if (!useTsc) {\n /*\n * Running the timer as a fallback\n * In case there are no files in the package swc will not print out completion indicator\n */\n timeout = setTimeout(() => {\n log.warning('Compilation timeout exceeded. Proceeding without waiting.');\n resolve();\n unwatch();\n }, 30000);\n }\n\n const unwatch = watchStdout(\n process,\n useTsc\n ? 'Initial tsc-compile-package task completed'\n : 'Initial swc-compile-package task completed',\n count => {\n counter += count;\n\n if (counter === scope.length) {\n resolve();\n clearTimeout(timeout);\n }\n }\n );\n });\n\n return { process, onComplete };\n });\n processTree.add(StartProcesses.PreparePackage, () =>\n lernaExec({\n cmd: 'startup prepare-package',\n scope,\n stream: true,\n })\n );\n processTree.add(\n StartProcesses.PreparePackageWatch,\n () =>\n lernaExec({\n 'cmd': 'startup prepare-package',\n scope,\n 'parallel': true,\n 'stream': true,\n '--': ['--watch'],\n }),\n { dependsOn: [StartProcesses.PreparePackage] }\n );\n processTree.add(\n StartProcesses.TypeCheck,\n () => typeCheck({ packages: scope, watch: true }),\n { dependsOn: [StartProcesses.PreparePackage] }\n );\n processTree.add(\n StartProcesses.BundleExposedDependencies,\n () => {\n if (webpackScope.length === 0) {\n return Promise.resolve();\n }\n return lernaExec({\n 'cmd': 'startup bundle-package',\n 'scope': webpackScope,\n 'parallel': true,\n 'stream': true,\n '--': ['--exposed-dependencies', '--use-watch-config'],\n });\n },\n { dependsOn: [StartProcesses.Compile, StartProcesses.PreparePackage] }\n );\n processTree.add(\n StartProcesses.BundlePackage,\n () => {\n if (webpackScope.length === 0) {\n return Promise.resolve();\n }\n return lernaExec({\n 'cmd': 'startup bundle-package',\n 'scope': webpackScope,\n 'parallel': true,\n 'stream': true,\n '--': [\n '--watch',\n this.args.config ? `--config \"${this.args.config}\"` : undefined,\n this.args['code-coverage'] ? '--code-coverage' : undefined,\n ].filter(item => !!item) as string[],\n });\n },\n { dependsOn: [StartProcesses.BundleExposedDependencies] }\n );\n\n await processTree.run();\n }\n}\n"],"names":["Start","StartProcesses","Command","execute","checkArgs","args","obsolete","useTsc","packages","getPackages","scope","ignore","type","PackageType","TSC","Webpack","length","map","name","webpackScope","filter","processTree","ProcessTree","add","process","compile","watch","pipeStdout","onComplete","Promise","resolve","counter","timeout","setTimeout","log","warning","unwatch","watchStdout","count","clearTimeout","lernaExec","cmd","stream","dependsOn","typeCheck","config","undefined","item","run","description","greedy","options","string","hidden","boolean","array"],"mappings":";;;;+BA8BaA;;;eAAAA;;;uBA9B4C;wBASlD;uBAC8B;;;;;;;;;;;;;;;;;;;;;;;AAUrC,IAAA,AAAKC,wCAAAA;;;;;;;;WAAAA;EAAAA;AAUE,MAAMD,cAAcE,cAAO;IAW9B,MACMC,UAAU;QACZC,IAAAA,iBAAS,EAAC,IAAI,CAACC,IAAI,EAAE;YAAEC,UAAU;gBAAC;gBAAa;aAA0B;QAAC;QAE1E,MAAMC,SAAS,IAAI,CAACF,IAAI,CAAC,UAAU;QAEnC,MAAMG,WAAWC,IAAAA,kBAAW,EAAC;YACzBC,OAAO,IAAI,CAACL,IAAI,CAACK,KAAK;YACtBC,QAAQ,IAAI,CAACN,IAAI,CAACM,MAAM;YACxBC,MAAM;gBAACC,kBAAW,CAACC,GAAG;gBAAED,kBAAW,CAACE,OAAO;aAAC;QAChD;QACA,IAAIP,SAASQ,MAAM,KAAK,GAAG;YACvB;QACJ;QAEA,MAAMN,QAAQF,SAASS,GAAG,CAAC,CAAC,EAAEC,IAAI,EAAE,GAAKA;QACzC,MAAMC,eAAeX,SAChBY,MAAM,CAAC,CAAC,EAAER,IAAI,EAAE,GAAKA,SAASC,kBAAW,CAACE,OAAO,EACjDE,GAAG,CAAC,CAAC,EAAEC,IAAI,EAAE,GAAKA;QAEvB,MAAMG,cAAc,IAAIC,mBAAW;QAEnCD,YAAYE,GAAG,IAAyB;YACpC,MAAMC,UAAUC,IAAAA,eAAO,EAAC;gBACpBjB,UAAUE;gBACVgB,OAAO;gBACPnB;YACJ;YAEAoB,IAAAA,kBAAU,EAACH;YAEX,MAAMI,aAAa,IAAIC,QAAcC,CAAAA;gBACjC,IAAIC,UAAU;gBACd,IAAIC;gBAEJ,IAAI,CAACzB,QAAQ;oBACT;;;qBAGC,GACDyB,UAAUC,WAAW;wBACjBC,UAAG,CAACC,OAAO,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CAAC,CAAC,GAAGC;oBACtD,IAAI,CAACzC,IAAI,CAAC,gBAAgB,GAAG,oBAAoByC;iBACpD,CAAC1B,MAAM,CAAC2B,CAAAA,OAAQ,CAAC,CAACA;YACvB;QACJ,GACA;YAAEJ,WAAW;;aAA0C;QAAC;QAG5D,MAAMtB,YAAY2B,GAAG;IACzB;AACJ;AA1II,iBADShD,OACOiD,eAAc;AAC9B,iBAFSjD,OAEOkD,UAAS;AACzB,iBAHSlD,OAGOmD,WAAU;IACtB,UAAU;QAAEC,QAAQ;QAAMC,QAAQ;QAAMJ,aAAa;IAA8B;IACnF,iBAAiB;QAAEK,SAAS;QAAML,aAAa;IAAyC;IACxF,UAAU;QAAEM,OAAO;QAAMN,aAAa;IAAmB;IACzD,SAAS;QAAEM,OAAO;QAAMN,aAAa;IAA4B;IACjE,WAAW;QAAEK,SAAS;QAAML,aAAa;IAA+B;AAC5E"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"styles-check.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/styles-check.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAQlC,qBAAa,WAAY,
|
|
1
|
+
{"version":3,"file":"styles-check.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/styles-check.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAQlC,qBAAa,WAAY,SAAQ,OAAO;IAE9B,OAAO;CAiChB"}
|
|
@@ -12,6 +12,7 @@ const _fs = /*#__PURE__*/ _interop_require_default(require("fs"));
|
|
|
12
12
|
const _glob = require("glob");
|
|
13
13
|
const _path = /*#__PURE__*/ _interop_require_default(require("path"));
|
|
14
14
|
const _utils = require("../../utils");
|
|
15
|
+
const _types = require("./types");
|
|
15
16
|
function _interop_require_default(obj) {
|
|
16
17
|
return obj && obj.__esModule ? obj : {
|
|
17
18
|
default: obj
|
|
@@ -31,7 +32,7 @@ const patterns = [
|
|
|
31
32
|
"@import '~@servicetitan/anvil-fonts/dist/css/anvil-fonts.css';",
|
|
32
33
|
"@import '~@servicetitan/design-system/dist/system.min.css';"
|
|
33
34
|
];
|
|
34
|
-
class StylesCheck {
|
|
35
|
+
class StylesCheck extends _types.Command {
|
|
35
36
|
async execute() {
|
|
36
37
|
if ((0, _utils.isLegacy)() || !(0, _utils.isBundle)()) {
|
|
37
38
|
return;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/cli/commands/styles-check.ts"],"sourcesContent":["import fs from 'fs';\nimport { glob } from 'glob';\nimport path from 'path';\nimport { getFolders, isBundle, isLegacy, isStyleCheckDisabled, log, logErrors } from '../../utils';\nimport { Command } from './
|
|
1
|
+
{"version":3,"sources":["../../../src/cli/commands/styles-check.ts"],"sourcesContent":["import fs from 'fs';\nimport { glob } from 'glob';\nimport path from 'path';\nimport { getFolders, isBundle, isLegacy, isStyleCheckDisabled, log, logErrors } from '../../utils';\nimport { Command } from './types';\n\nconst patterns = [\n \"@import '~@servicetitan/tokens/core/tokens.css';\",\n \"@import '~@servicetitan/anvil-fonts/dist/css/anvil-fonts.css';\",\n \"@import '~@servicetitan/design-system/dist/system.min.css';\",\n];\n\nexport class StylesCheck extends Command {\n @logErrors\n async execute() {\n if (isLegacy() || !isBundle()) {\n return;\n }\n\n if (isStyleCheckDisabled()) {\n log.info('style check is disabled');\n return;\n }\n\n let ok = true;\n const { source } = getFolders();\n const files = await glob(`${source}/**/*.{css,less}`);\n\n for (const file of files) {\n const relativePath = path.relative(source, file);\n if (relativePath === 'design-system.css') {\n continue;\n }\n\n const content = fs.readFileSync(file, { encoding: 'utf-8' });\n patterns.forEach(pattern => {\n if (content.includes(pattern)) {\n log.error(`Error: file ${relativePath} contains \"${pattern}\"`);\n ok = false;\n }\n });\n }\n\n if (!ok) {\n throw new Error('style check failed, see errors above');\n }\n }\n}\n"],"names":["StylesCheck","patterns","Command","execute","isLegacy","isBundle","isStyleCheckDisabled","log","info","ok","source","getFolders","files","glob","file","relativePath","path","relative","content","fs","readFileSync","encoding","forEach","pattern","includes","error","Error"],"mappings":";;;;+BAYaA;;;eAAAA;;;2DAZE;sBACM;6DACJ;uBACoE;uBAC7D;;;;;;;;;;;;;;;AAExB,MAAMC,WAAW;IACb;IACA;IACA;CACH;AAEM,MAAMD,oBAAoBE,cAAO;IACpC,MACMC,UAAU;QACZ,IAAIC,IAAAA,eAAQ,OAAM,CAACC,IAAAA,eAAQ,KAAI;YAC3B;QACJ;QAEA,IAAIC,IAAAA,2BAAoB,KAAI;YACxBC,UAAG,CAACC,IAAI,CAAC;YACT;QACJ;QAEA,IAAIC,KAAK;QACT,MAAM,EAAEC,MAAM,EAAE,GAAGC,IAAAA,iBAAU;QAC7B,MAAMC,QAAQ,MAAMC,IAAAA,UAAI,EAAC,GAAGH,OAAO,gBAAgB,CAAC;QAEpD,KAAK,MAAMI,QAAQF,MAAO;YACtB,MAAMG,eAAeC,aAAI,CAACC,QAAQ,CAACP,QAAQI;YAC3C,IAAIC,iBAAiB,qBAAqB;gBACtC;YACJ;YAEA,MAAMG,UAAUC,WAAE,CAACC,YAAY,CAACN,MAAM;gBAAEO,UAAU;YAAQ;YAC1DpB,SAASqB,OAAO,CAACC,CAAAA;gBACb,IAAIL,QAAQM,QAAQ,CAACD,UAAU;oBAC3BhB,UAAG,CAACkB,KAAK,CAAC,CAAC,YAAY,EAAEV,aAAa,WAAW,EAAEQ,QAAQ,CAAC,CAAC;oBAC7Dd,KAAK;gBACT;YACJ;QACJ;QAEA,IAAI,CAACA,IAAI;YACL,MAAM,IAAIiB,MAAM;QACpB;IACJ;AACJ"}
|
|
@@ -75,8 +75,9 @@ function getDefaultConfig() {
|
|
|
75
75
|
}
|
|
76
76
|
async function getUserConfig() {
|
|
77
77
|
const { viteConfig } = await (0, _node.resolveConfig)();
|
|
78
|
+
const { omitDefault = [], ...config } = (0, _utils.getVitestConfiguration)();
|
|
78
79
|
var _viteConfig_test;
|
|
79
|
-
const result = (0, _config.mergeConfig)((0, _config.mergeConfig)(
|
|
80
|
+
const result = (0, _config.mergeConfig)((0, _config.mergeConfig)((0, _utils.omit)(getDefaultConfig(), omitDefault), config), (_viteConfig_test = viteConfig.test) !== null && _viteConfig_test !== void 0 ? _viteConfig_test : {});
|
|
80
81
|
/* istanbul ignore next: debug only */ _utils.log.debug('vitest:userConfig', ()=>JSON.stringify(result, null, 2));
|
|
81
82
|
return {
|
|
82
83
|
test: result
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../src/cli/commands/test/runners/vitest.ts"],"sourcesContent":["import { configDefaults, coverageConfigDefaults, mergeConfig, ViteUserConfig } from 'vitest/config';\nimport { startVitest, parseCLI, resolveConfig } from 'vitest/node';\nimport { getVitestConfiguration, log } from '../../../../utils';\n\ntype VitestConfig = NonNullable<ViteUserConfig['test']>;\n\nexport class Vitest {\n async run() {\n const cliOptions = getCliOptions();\n const userConfig = await getUserConfig();\n\n // startVitest sets process.exitCode to 1 when tests fail\n const vitest = await startVitest('test', cliOptions.filter, cliOptions.options, userConfig);\n await vitest.close();\n }\n}\n\nconst RUNNER_OPTION = '--runner';\n\nfunction excludeRunnerOption(args: string[]) {\n return args.reduce<string[]>((result, item, index) => {\n if (!item.startsWith(RUNNER_OPTION) && (index === 0 || args[index - 1] !== RUNNER_OPTION)) {\n result.push(item);\n }\n return result;\n }, []);\n}\n\nfunction getCliOptions() {\n // parseCLI requires the first element to be \"vitest\"\n const result = parseCLI(['vitest', ...excludeRunnerOption(process.argv.slice(3))]);\n\n /* istanbul ignore next: debug only */\n log.debug('vitest:cliOptions', () => JSON.stringify(result, null, 2));\n\n return result;\n}\n\nfunction getDefaultConfig(): VitestConfig {\n return {\n coverage: {\n exclude: [\n ...coverageConfigDefaults.exclude,\n '**/__mocks__/**',\n '**/*.stories.*',\n '\\\\.yalc',\n ],\n include: ['**/*.{ts,tsx}'],\n reporter: ['html-spa', 'text', 'json', 'cobertura', 'lcov'],\n },\n environment: 'jsdom',\n exclude: [...configDefaults.exclude, '\\\\.yalc'],\n restoreMocks: true,\n server: { deps: { inline: ['@servicetitan/anvil2'] } }, // fixes css parser errors\n };\n}\n\nasync function getUserConfig(): Promise<ViteUserConfig> {\n const { viteConfig } = await resolveConfig();\n\n const result = mergeConfig(\n mergeConfig(getDefaultConfig(),
|
|
1
|
+
{"version":3,"sources":["../../../../../src/cli/commands/test/runners/vitest.ts"],"sourcesContent":["import { configDefaults, coverageConfigDefaults, mergeConfig, ViteUserConfig } from 'vitest/config';\nimport { startVitest, parseCLI, resolveConfig } from 'vitest/node';\nimport { getVitestConfiguration, log, omit } from '../../../../utils';\n\ntype VitestConfig = NonNullable<ViteUserConfig['test']>;\n\nexport class Vitest {\n async run() {\n const cliOptions = getCliOptions();\n const userConfig = await getUserConfig();\n\n // startVitest sets process.exitCode to 1 when tests fail\n const vitest = await startVitest('test', cliOptions.filter, cliOptions.options, userConfig);\n await vitest.close();\n }\n}\n\nconst RUNNER_OPTION = '--runner';\n\nfunction excludeRunnerOption(args: string[]) {\n return args.reduce<string[]>((result, item, index) => {\n if (!item.startsWith(RUNNER_OPTION) && (index === 0 || args[index - 1] !== RUNNER_OPTION)) {\n result.push(item);\n }\n return result;\n }, []);\n}\n\nfunction getCliOptions() {\n // parseCLI requires the first element to be \"vitest\"\n const result = parseCLI(['vitest', ...excludeRunnerOption(process.argv.slice(3))]);\n\n /* istanbul ignore next: debug only */\n log.debug('vitest:cliOptions', () => JSON.stringify(result, null, 2));\n\n return result;\n}\n\nfunction getDefaultConfig(): VitestConfig {\n return {\n coverage: {\n exclude: [\n ...coverageConfigDefaults.exclude,\n '**/__mocks__/**',\n '**/*.stories.*',\n '\\\\.yalc',\n ],\n include: ['**/*.{ts,tsx}'],\n reporter: ['html-spa', 'text', 'json', 'cobertura', 'lcov'],\n },\n environment: 'jsdom',\n exclude: [...configDefaults.exclude, '\\\\.yalc'],\n restoreMocks: true,\n server: { deps: { inline: ['@servicetitan/anvil2'] } }, // fixes css parser errors\n };\n}\n\nasync function getUserConfig(): Promise<ViteUserConfig> {\n const { viteConfig } = await resolveConfig();\n\n const { omitDefault = [], ...config } = getVitestConfiguration();\n\n const result = mergeConfig(\n mergeConfig(omit(getDefaultConfig(), omitDefault), config),\n viteConfig.test ?? {}\n );\n\n /* istanbul ignore next: debug only */\n log.debug('vitest:userConfig', () => JSON.stringify(result, null, 2));\n\n return { test: result };\n}\n"],"names":["Vitest","run","cliOptions","getCliOptions","userConfig","getUserConfig","vitest","startVitest","filter","options","close","RUNNER_OPTION","excludeRunnerOption","args","reduce","result","item","index","startsWith","push","parseCLI","process","argv","slice","log","debug","JSON","stringify","getDefaultConfig","coverage","exclude","coverageConfigDefaults","include","reporter","environment","configDefaults","restoreMocks","server","deps","inline","viteConfig","resolveConfig","omitDefault","config","getVitestConfiguration","mergeConfig","omit","test"],"mappings":";;;;+BAMaA;;;eAAAA;;;wBANuE;sBAC/B;uBACH;AAI3C,MAAMA;IACT,MAAMC,MAAM;QACR,MAAMC,aAAaC;QACnB,MAAMC,aAAa,MAAMC;QAEzB,yDAAyD;QACzD,MAAMC,SAAS,MAAMC,IAAAA,iBAAW,EAAC,QAAQL,WAAWM,MAAM,EAAEN,WAAWO,OAAO,EAAEL;QAChF,MAAME,OAAOI,KAAK;IACtB;AACJ;AAEA,MAAMC,gBAAgB;AAEtB,SAASC,oBAAoBC,IAAc;IACvC,OAAOA,KAAKC,MAAM,CAAW,CAACC,QAAQC,MAAMC;QACxC,IAAI,CAACD,KAAKE,UAAU,CAACP,kBAAmBM,CAAAA,UAAU,KAAKJ,IAAI,CAACI,QAAQ,EAAE,KAAKN,aAAY,GAAI;YACvFI,OAAOI,IAAI,CAACH;QAChB;QACA,OAAOD;IACX,GAAG,EAAE;AACT;AAEA,SAASZ;IACL,qDAAqD;IACrD,MAAMY,SAASK,IAAAA,cAAQ,EAAC;QAAC;WAAaR,oBAAoBS,QAAQC,IAAI,CAACC,KAAK,CAAC;KAAI;IAEjF,oCAAoC,GACpCC,UAAG,CAACC,KAAK,CAAC,qBAAqB,IAAMC,KAAKC,SAAS,CAACZ,QAAQ,MAAM;IAElE,OAAOA;AACX;AAEA,SAASa;IACL,OAAO;QACHC,UAAU;YACNC,SAAS;mBACFC,8BAAsB,CAACD,OAAO;gBACjC;gBACA;gBACA;aACH;YACDE,SAAS;gBAAC;aAAgB;YAC1BC,UAAU;gBAAC;gBAAY;gBAAQ;gBAAQ;gBAAa;aAAO;QAC/D;QACAC,aAAa;QACbJ,SAAS;eAAIK,sBAAc,CAACL,OAAO;YAAE;SAAU;QAC/CM,cAAc;QACdC,QAAQ;YAAEC,MAAM;gBAAEC,QAAQ;oBAAC;iBAAuB;YAAC;QAAE;IACzD;AACJ;AAEA,eAAelC;IACX,MAAM,EAAEmC,UAAU,EAAE,GAAG,MAAMC,IAAAA,mBAAa;IAE1C,MAAM,EAAEC,cAAc,EAAE,EAAE,GAAGC,QAAQ,GAAGC,IAAAA,6BAAsB;QAI1DJ;IAFJ,MAAMzB,SAAS8B,IAAAA,mBAAW,EACtBA,IAAAA,mBAAW,EAACC,IAAAA,WAAI,EAAClB,oBAAoBc,cAAcC,SACnDH,CAAAA,mBAAAA,WAAWO,IAAI,cAAfP,8BAAAA,mBAAmB,CAAC;IAGxB,oCAAoC,GACpChB,UAAG,CAACC,KAAK,CAAC,qBAAqB,IAAMC,KAAKC,SAAS,CAACZ,QAAQ,MAAM;IAElE,OAAO;QAAEgC,MAAMhC;IAAO;AAC1B"}
|
|
@@ -2,16 +2,25 @@ import { Config } from '@jest/types';
|
|
|
2
2
|
import { Command } from '../types';
|
|
3
3
|
type Args = Config.Argv & {
|
|
4
4
|
runner?: 'jest' | 'vitest';
|
|
5
|
+
runnerArgs?: string[];
|
|
5
6
|
};
|
|
6
7
|
/**
|
|
7
8
|
* This class is named "Tests" instead of "Test" because the corresponding
|
|
8
9
|
* "test.ts" would be interpreted as a test file.
|
|
9
10
|
*/
|
|
10
|
-
export declare class Tests
|
|
11
|
-
|
|
12
|
-
readonly greedy = true;
|
|
13
|
-
|
|
14
|
-
|
|
11
|
+
export declare class Tests extends Command<Args> {
|
|
12
|
+
static readonly description = "Run tests";
|
|
13
|
+
static readonly greedy = true;
|
|
14
|
+
static readonly options: {
|
|
15
|
+
_: {
|
|
16
|
+
description: string;
|
|
17
|
+
};
|
|
18
|
+
runner: {
|
|
19
|
+
choices: string[];
|
|
20
|
+
description: string;
|
|
21
|
+
defaultDescription: string;
|
|
22
|
+
};
|
|
23
|
+
};
|
|
15
24
|
execute(): Promise<void>;
|
|
16
25
|
}
|
|
17
26
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tests.d.ts","sourceRoot":"","sources":["../../../../src/cli/commands/test/tests.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"tests.d.ts","sourceRoot":"","sources":["../../../../src/cli/commands/test/tests.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAErC,OAAO,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AAGnC,KAAK,IAAI,GAAG,MAAM,CAAC,IAAI,GAAG;IACtB,MAAM,CAAC,EAAE,MAAM,GAAG,QAAQ,CAAC;IAC3B,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;CACzB,CAAC;AAEF;;;GAGG;AACH,qBAAa,KAAM,SAAQ,OAAO,CAAC,IAAI,CAAC;IACpC,MAAM,CAAC,QAAQ,CAAC,WAAW,eAAe;IAC1C,MAAM,CAAC,QAAQ,CAAC,MAAM,QAAQ;IAC9B,MAAM,CAAC,QAAQ,CAAC,OAAO;;;;;;;;;MAOrB;IAGI,OAAO;CAehB"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";
|
|
1
|
+
/* eslint-disable @typescript-eslint/naming-convention */ "use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", {
|
|
3
3
|
value: true
|
|
4
4
|
});
|
|
@@ -9,6 +9,7 @@ Object.defineProperty(exports, "Tests", {
|
|
|
9
9
|
}
|
|
10
10
|
});
|
|
11
11
|
const _utils = require("../../../utils");
|
|
12
|
+
const _types = require("../types");
|
|
12
13
|
const _runners = require("./runners");
|
|
13
14
|
function _define_property(obj, key, value) {
|
|
14
15
|
if (key in obj) {
|
|
@@ -32,28 +33,40 @@ function _ts_decorate(decorators, target, key, desc) {
|
|
|
32
33
|
function _ts_metadata(k, v) {
|
|
33
34
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
34
35
|
}
|
|
35
|
-
class Tests {
|
|
36
|
-
description() {
|
|
37
|
-
return 'run tests';
|
|
38
|
-
}
|
|
36
|
+
class Tests extends _types.Command {
|
|
39
37
|
async execute() {
|
|
40
38
|
var _getConfiguration_testRunner;
|
|
41
|
-
const { runner = (_getConfiguration_testRunner = (0, _utils.getConfiguration)().testRunner) !== null && _getConfiguration_testRunner !== void 0 ? _getConfiguration_testRunner : 'jest', ...
|
|
39
|
+
const { _, runner = (_getConfiguration_testRunner = (0, _utils.getConfiguration)().testRunner) !== null && _getConfiguration_testRunner !== void 0 ? _getConfiguration_testRunner : 'jest', runnerArgs = [], ...restOptions } = this.args;
|
|
42
40
|
if (runner === 'jest') {
|
|
43
|
-
await new _runners.Jest(
|
|
41
|
+
await new _runners.Jest({
|
|
42
|
+
_: [
|
|
43
|
+
..._,
|
|
44
|
+
...runnerArgs
|
|
45
|
+
],
|
|
46
|
+
...restOptions
|
|
47
|
+
}).run();
|
|
44
48
|
} else if (runner === 'vitest') {
|
|
45
49
|
await new _runners.Vitest().run();
|
|
46
50
|
} else {
|
|
47
51
|
throw new Error(`unrecognized runner "${runner}"`);
|
|
48
52
|
}
|
|
49
53
|
}
|
|
50
|
-
constructor(args){
|
|
51
|
-
_define_property(this, "args", void 0);
|
|
52
|
-
_define_property(this, "greedy", void 0);
|
|
53
|
-
this.args = args;
|
|
54
|
-
this.greedy = true;
|
|
55
|
-
}
|
|
56
54
|
}
|
|
55
|
+
_define_property(Tests, "description", 'Run tests');
|
|
56
|
+
_define_property(Tests, "greedy", true);
|
|
57
|
+
_define_property(Tests, "options", {
|
|
58
|
+
_: {
|
|
59
|
+
description: '[runnerArgs...]'
|
|
60
|
+
},
|
|
61
|
+
runner: {
|
|
62
|
+
choices: [
|
|
63
|
+
'jest',
|
|
64
|
+
'vitest'
|
|
65
|
+
],
|
|
66
|
+
description: 'Test runner',
|
|
67
|
+
defaultDescription: 'jest'
|
|
68
|
+
}
|
|
69
|
+
});
|
|
57
70
|
_ts_decorate([
|
|
58
71
|
_utils.logErrors,
|
|
59
72
|
_ts_metadata("design:type", Function),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/cli/commands/test/tests.ts"],"sourcesContent":["
|
|
1
|
+
{"version":3,"sources":["../../../../src/cli/commands/test/tests.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/naming-convention */\nimport { Config } from '@jest/types';\nimport { getConfiguration, logErrors } from '../../../utils';\nimport { Command } from '../types';\nimport { Jest, Vitest } from './runners';\n\ntype Args = Config.Argv & {\n runner?: 'jest' | 'vitest';\n runnerArgs?: string[];\n};\n\n/**\n * This class is named \"Tests\" instead of \"Test\" because the corresponding\n * \"test.ts\" would be interpreted as a test file.\n */\nexport class Tests extends Command<Args> {\n static readonly description = 'Run tests';\n static readonly greedy = true;\n static readonly options = {\n _: { description: '[runnerArgs...]' },\n runner: {\n choices: ['jest', 'vitest'],\n description: 'Test runner',\n defaultDescription: 'jest',\n },\n };\n\n @logErrors\n async execute() {\n const {\n _,\n runner = getConfiguration().testRunner ?? 'jest',\n runnerArgs = [],\n ...restOptions\n } = this.args;\n if (runner === 'jest') {\n await new Jest({ _: [..._, ...runnerArgs], ...restOptions }).run();\n } else if (runner === 'vitest') {\n await new Vitest().run();\n } else {\n throw new Error(`unrecognized runner \"${runner}\"`);\n }\n }\n}\n"],"names":["Tests","Command","execute","getConfiguration","_","runner","testRunner","runnerArgs","restOptions","args","Jest","run","Vitest","Error","description","greedy","options","choices","defaultDescription"],"mappings":"AAAA,uDAAuD;;;;+BAe1CA;;;eAAAA;;;uBAb+B;uBACpB;yBACK;;;;;;;;;;;;;;;;;;;;;;;AAWtB,MAAMA,cAAcC,cAAO;IAY9B,MACMC,UAAU;YAGCC;QAFb,MAAM,EACFC,CAAC,EACDC,SAASF,CAAAA,+BAAAA,IAAAA,uBAAgB,IAAGG,UAAU,cAA7BH,0CAAAA,+BAAiC,MAAM,EAChDI,aAAa,EAAE,EACf,GAAGC,aACN,GAAG,IAAI,CAACC,IAAI;QACb,IAAIJ,WAAW,QAAQ;YACnB,MAAM,IAAIK,aAAI,CAAC;gBAAEN,GAAG;uBAAIA;uBAAMG;iBAAW;gBAAE,GAAGC,WAAW;YAAC,GAAGG,GAAG;QACpE,OAAO,IAAIN,WAAW,UAAU;YAC5B,MAAM,IAAIO,eAAM,GAAGD,GAAG;QAC1B,OAAO;YACH,MAAM,IAAIE,MAAM,CAAC,qBAAqB,EAAER,OAAO,CAAC,CAAC;QACrD;IACJ;AACJ;AA3BI,iBADSL,OACOc,eAAc;AAC9B,iBAFSd,OAEOe,UAAS;AACzB,iBAHSf,OAGOgB,WAAU;IACtBZ,GAAG;QAAEU,aAAa;IAAkB;IACpCT,QAAQ;QACJY,SAAS;YAAC;YAAQ;SAAS;QAC3BH,aAAa;QACbI,oBAAoB;IACxB;AACJ"}
|
|
@@ -1,7 +1,16 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import type { Options } from 'yargs';
|
|
2
|
+
export interface CommandArgs {
|
|
3
|
+
[key: string]: unknown;
|
|
4
|
+
}
|
|
5
|
+
export declare abstract class Command<T extends CommandArgs = CommandArgs> {
|
|
6
|
+
protected readonly args: T;
|
|
7
|
+
static readonly description?: string;
|
|
8
|
+
static readonly greedy?: boolean;
|
|
9
|
+
static readonly options?: {
|
|
10
|
+
[key: string]: Options;
|
|
11
|
+
};
|
|
12
|
+
constructor(args: T);
|
|
13
|
+
abstract execute(): Promise<void>;
|
|
5
14
|
}
|
|
6
15
|
export type Newable<T> = new (...args: any[]) => T;
|
|
7
16
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,OAAO;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAErC,MAAM,WAAW,WAAW;IACxB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CAC1B;AAED,8BAAsB,OAAO,CAAC,CAAC,SAAS,WAAW,GAAG,WAAW;IAKjD,SAAS,CAAC,QAAQ,CAAC,IAAI,EAAE,CAAC;IAJtC,MAAM,CAAC,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrC,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE,OAAO,CAAC;IACjC,MAAM,CAAC,QAAQ,CAAC,OAAO,CAAC,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAA;KAAE,CAAC;gBAEtB,IAAI,EAAE,CAAC;IAEtC,QAAQ,CAAC,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;CACpC;AAED,MAAM,MAAM,OAAO,CAAC,CAAC,IAAI,KAAK,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,CAAC,CAAC"}
|
|
@@ -2,5 +2,33 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", {
|
|
3
3
|
value: true
|
|
4
4
|
});
|
|
5
|
+
Object.defineProperty(exports, "Command", {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: function() {
|
|
8
|
+
return Command;
|
|
9
|
+
}
|
|
10
|
+
});
|
|
11
|
+
function _define_property(obj, key, value) {
|
|
12
|
+
if (key in obj) {
|
|
13
|
+
Object.defineProperty(obj, key, {
|
|
14
|
+
value: value,
|
|
15
|
+
enumerable: true,
|
|
16
|
+
configurable: true,
|
|
17
|
+
writable: true
|
|
18
|
+
});
|
|
19
|
+
} else {
|
|
20
|
+
obj[key] = value;
|
|
21
|
+
}
|
|
22
|
+
return obj;
|
|
23
|
+
}
|
|
24
|
+
class Command {
|
|
25
|
+
constructor(args){
|
|
26
|
+
_define_property(this, "args", void 0);
|
|
27
|
+
this.args = args;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
_define_property(Command, "description", void 0);
|
|
31
|
+
_define_property(Command, "greedy", void 0);
|
|
32
|
+
_define_property(Command, "options", void 0);
|
|
5
33
|
|
|
6
34
|
//# sourceMappingURL=types.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/cli/commands/types.ts"],"names":[],"mappings":""}
|
|
1
|
+
{"version":3,"sources":["../../../src/cli/commands/types.ts"],"sourcesContent":["import type { Options } from 'yargs';\n\nexport interface CommandArgs {\n [key: string]: unknown;\n}\n\nexport abstract class Command<T extends CommandArgs = CommandArgs> {\n static readonly description?: string;\n static readonly greedy?: boolean;\n static readonly options?: { [key: string]: Options };\n\n constructor(protected readonly args: T) {}\n\n abstract execute(): Promise<void>;\n}\n\nexport type Newable<T> = new (...args: any[]) => T;\n"],"names":["Command","args","description","greedy","options"],"mappings":";;;;+BAMsBA;;;eAAAA;;;;;;;;;;;;;;;;AAAf,MAAeA;IAKlB,YAAY,AAAmBC,IAAO,CAAE;;aAATA,OAAAA;IAAU;AAG7C;AAPI,iBADkBD,SACFE,eAAhB,KAAA;AACA,iBAFkBF,SAEFG,UAAhB,KAAA;AACA,iBAHkBH,SAGFI,WAAhB,KAAA"}
|
|
@@ -1,12 +1,10 @@
|
|
|
1
|
-
import { Command } from './types';
|
|
2
|
-
interface Args {
|
|
1
|
+
import { Command, CommandArgs } from './types';
|
|
2
|
+
interface Args extends CommandArgs {
|
|
3
3
|
dry?: boolean;
|
|
4
4
|
releaseVersion: string;
|
|
5
5
|
}
|
|
6
|
-
export declare class UploadSourcemaps
|
|
6
|
+
export declare class UploadSourcemaps extends Command<Args> {
|
|
7
7
|
#private;
|
|
8
|
-
private readonly args;
|
|
9
|
-
constructor(args: Args);
|
|
10
8
|
execute(): Promise<void>;
|
|
11
9
|
private checkArgs;
|
|
12
10
|
private checkLocation;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"upload-sourcemaps.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/upload-sourcemaps.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"upload-sourcemaps.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/upload-sourcemaps.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAE/C,UAAU,IAAK,SAAQ,WAAW;IAC9B,GAAG,CAAC,EAAE,OAAO,CAAC;IACd,cAAc,EAAE,MAAM,CAAC;CAC1B;AAMD,qBAAa,gBAAiB,SAAQ,OAAO,CAAC,IAAI,CAAC;;IAMzC,OAAO;IAWb,OAAO,CAAC,SAAS;IAiBjB,OAAO,CAAC,aAAa;IAMrB,OAAO,CAAC,YAAY;IAIpB,OAAO,CAAC,qBAAqB;IAM7B,OAAO,CAAC,UAAU;IAYlB,OAAO,CAAC,SAAS;IAYjB,OAAO,CAAC,cAAc;IAOtB,OAAO,CAAC,cAAc;IAKtB,OAAO,CAAC,GAAG;CAId"}
|
|
@@ -12,6 +12,7 @@ const _path = /*#__PURE__*/ _interop_require_default(require("path"));
|
|
|
12
12
|
const _child_process = require("child_process");
|
|
13
13
|
const _utils = require("../../utils");
|
|
14
14
|
const _utils1 = require("../utils");
|
|
15
|
+
const _types = require("./types");
|
|
15
16
|
function _check_private_redeclaration(obj, privateCollection) {
|
|
16
17
|
if (privateCollection.has(obj)) {
|
|
17
18
|
throw new TypeError("Cannot initialize the same private elements twice on an object");
|
|
@@ -52,19 +53,6 @@ function _class_private_field_set(receiver, privateMap, value) {
|
|
|
52
53
|
_class_apply_descriptor_set(receiver, descriptor, value);
|
|
53
54
|
return value;
|
|
54
55
|
}
|
|
55
|
-
function _define_property(obj, key, value) {
|
|
56
|
-
if (key in obj) {
|
|
57
|
-
Object.defineProperty(obj, key, {
|
|
58
|
-
value: value,
|
|
59
|
-
enumerable: true,
|
|
60
|
-
configurable: true,
|
|
61
|
-
writable: true
|
|
62
|
-
});
|
|
63
|
-
} else {
|
|
64
|
-
obj[key] = value;
|
|
65
|
-
}
|
|
66
|
-
return obj;
|
|
67
|
-
}
|
|
68
56
|
function _interop_require_default(obj) {
|
|
69
57
|
return obj && obj.__esModule ? obj : {
|
|
70
58
|
default: obj
|
|
@@ -80,7 +68,7 @@ function _ts_metadata(k, v) {
|
|
|
80
68
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
81
69
|
}
|
|
82
70
|
var _outDir = /*#__PURE__*/ new WeakMap(), _packageJson = /*#__PURE__*/ new WeakMap();
|
|
83
|
-
class UploadSourcemaps {
|
|
71
|
+
class UploadSourcemaps extends _types.Command {
|
|
84
72
|
async execute() {
|
|
85
73
|
this.checkLocation();
|
|
86
74
|
if (!this.checkArgs()) {
|
|
@@ -156,17 +144,14 @@ class UploadSourcemaps {
|
|
|
156
144
|
stdio: 'inherit'
|
|
157
145
|
});
|
|
158
146
|
}
|
|
159
|
-
constructor(args){
|
|
160
|
-
|
|
161
|
-
_class_private_field_init(this, _outDir, {
|
|
147
|
+
constructor(...args){
|
|
148
|
+
super(...args), _class_private_field_init(this, _outDir, {
|
|
162
149
|
writable: true,
|
|
163
150
|
value: void 0
|
|
164
|
-
})
|
|
165
|
-
_class_private_field_init(this, _packageJson, {
|
|
151
|
+
}), _class_private_field_init(this, _packageJson, {
|
|
166
152
|
writable: true,
|
|
167
153
|
value: void 0
|
|
168
154
|
});
|
|
169
|
-
this.args = args;
|
|
170
155
|
}
|
|
171
156
|
}
|
|
172
157
|
_ts_decorate([
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/cli/commands/upload-sourcemaps.ts"],"sourcesContent":["import path from 'path';\nimport { execSync } from 'child_process';\nimport { getTsConfig, isWebComponent, log, logErrors, readJson } from '../../utils';\nimport { isCI, TSConfig } from '../utils';\nimport { Command } from './types';\n\ninterface Args {\n dry?: boolean;\n releaseVersion: string;\n}\n\ninterface PackageJson {\n name: string;\n}\n\nexport class UploadSourcemaps
|
|
1
|
+
{"version":3,"sources":["../../../src/cli/commands/upload-sourcemaps.ts"],"sourcesContent":["import path from 'path';\nimport { execSync } from 'child_process';\nimport { getTsConfig, isWebComponent, log, logErrors, readJson } from '../../utils';\nimport { isCI, TSConfig } from '../utils';\nimport { Command, CommandArgs } from './types';\n\ninterface Args extends CommandArgs {\n dry?: boolean;\n releaseVersion: string;\n}\n\ninterface PackageJson {\n name: string;\n}\n\nexport class UploadSourcemaps extends Command<Args> {\n #outDir?: string;\n #packageJson?: PackageJson;\n\n @logErrors\n // eslint-disable-next-line @typescript-eslint/require-await\n async execute() {\n this.checkLocation();\n if (!this.checkArgs()) {\n return;\n }\n\n const bundleDir = this.getBundleDir();\n const options = this.getOptions().join(' ');\n this.run(`npx --yes @datadog/datadog-ci@3 sourcemaps upload ${bundleDir} ${options}`);\n }\n\n private checkArgs() {\n if (!process.env.DATADOG_API_KEY) {\n const message = 'DATADOG_API_KEY environment variable is not set';\n if (!isCI()) {\n throw new Error(message);\n }\n log.warning(`${message}; skipping sourcemaps`);\n return false;\n }\n\n if (!this.args.releaseVersion) {\n throw new Error('--release-version is required');\n }\n\n return true;\n }\n\n private checkLocation() {\n if (!isWebComponent()) {\n throw new Error(`this command must be run inside a web-component directory`);\n }\n }\n\n private getBundleDir() {\n return path.relative('.', path.join(this.getOutDir(), 'bundle'));\n }\n\n private getMinifiedPrefixPath() {\n const { name } = this.getPackageJson();\n const baseUrl = `https://unpkg.servicetitan.com/${name}@${this.args.releaseVersion}`;\n return `${baseUrl}/${this.getBundleDir().replace(/\\\\/g, '/')}`;\n }\n\n private getOptions() {\n const { dry, releaseVersion } = this.args;\n const service = this.getPackageJson().name.replace(/^[^/]+\\//, '');\n return [\n ...[dry && `--dry-run`],\n `--service=${service}`,\n `--release-version=${releaseVersion}`,\n `--minified-path-prefix=${this.getMinifiedPrefixPath()}`,\n `--project-path=${this.getProjectPath()}`,\n ].filter(item => !!item) as string[];\n }\n\n private getOutDir() {\n if (!this.#outDir) {\n const outDir = new TSConfig(getTsConfig()).getValue<string>('compilerOptions.outDir');\n if (!outDir) {\n throw new Error('compilerOptions.outDir is not configured');\n }\n\n this.#outDir = outDir;\n }\n return this.#outDir;\n }\n\n private getPackageJson() {\n if (!this.#packageJson) {\n this.#packageJson = readJson<PackageJson>('package.json');\n }\n return this.#packageJson;\n }\n\n private getProjectPath() {\n const name = readJson(path.join(this.getOutDir(), 'metadata.json')).name;\n return `${name}/`;\n }\n\n private run(command: string) {\n log.info(`Running: ${command}`);\n return execSync(command, { stdio: 'inherit' });\n }\n}\n"],"names":["UploadSourcemaps","Command","execute","checkLocation","checkArgs","bundleDir","getBundleDir","options","getOptions","join","run","process","env","DATADOG_API_KEY","message","isCI","Error","log","warning","args","releaseVersion","isWebComponent","path","relative","getOutDir","getMinifiedPrefixPath","name","getPackageJson","baseUrl","replace","dry","service","getProjectPath","filter","item","outDir","TSConfig","getTsConfig","getValue","readJson","command","info","execSync","stdio"],"mappings":";;;;+BAeaA;;;eAAAA;;;6DAfI;+BACQ;uBAC6C;wBACvC;uBACM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAYjC,uCACA;AAFG,MAAMA,yBAAyBC,cAAO;IAIzC,MAEMC,UAAU;QACZ,IAAI,CA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AC/D,OAAO;eACA;gBAACC,OAAO,CAAC,SAAS,CAAC;aAAC;YACvB,CAAC,UAAU,EAAEC,SAAS;YACtB,CAAC,kBAAkB,EAAEX,gBAAgB;YACrC,CAAC,uBAAuB,EAAE,IAAI,CAACK,qBAAqB,IAAI;YACxD,CAAC,eAAe,EAAE,IAAI,CAACO,cAAc,IAAI;SAC5C,CAACC,MAAM,CAACC,CAAAA,OAAQ,CAAC,CAACA;IACvB;IAEQV,YAAY;QAChB,IAAI,0BAAC,IAAI,EAAC,UAAS;YACf,MAAMW,SAAS,IAAIC,gBAAQ,CAACC,IAAAA,kBAAW,KAAIC,QAAQ,CAAS;YAC5D,IAAI,CAACH,QAAQ;gBACT,MAAM,IAAInB,MAAM;YACpB;2CAEK,SAAUmB;QACnB;QACA,gCAAO,IAAI,EAAC;IAChB;IAEQR,iBAAiB;QACrB,IAAI,0BAAC,IAAI,EAAC,eAAc;2CACf,cAAeY,IAAAA,eAAQ,EAAc;QAC9C;QACA,gCAAO,IAAI,EAAC;IAChB;IAEQP,iBAAiB;QACrB,MAAMN,OAAOa,IAAAA,eAAQ,EAACjB,aAAI,CAACb,IAAI,CAAC,IAAI,CAACe,SAAS,IAAI,kBAAkBE,IAAI;QACxE,OAAO,GAAGA,KAAK,CAAC,CAAC;IACrB;IAEQhB,IAAI8B,OAAe,EAAE;QACzBvB,UAAG,CAACwB,IAAI,CAAC,CAAC,SAAS,EAAED,SAAS;QAC9B,OAAOE,IAAAA,uBAAQ,EAACF,SAAS;YAAEG,OAAO;QAAU;IAChD;;QAzFG,gBACH,gCAAA;;mBAAA,KAAA;YACA,gCAAA;;mBAAA,KAAA;;;AAwFJ"}
|
package/dist/cli/index.js
CHANGED
|
@@ -2,9 +2,11 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", {
|
|
3
3
|
value: true
|
|
4
4
|
});
|
|
5
|
+
const _chalk = /*#__PURE__*/ _interop_require_default(require("chalk"));
|
|
5
6
|
const _execa = /*#__PURE__*/ _interop_require_default(require("execa"));
|
|
6
7
|
const _path = /*#__PURE__*/ _interop_require_default(require("path"));
|
|
7
|
-
const _yargs = require("yargs");
|
|
8
|
+
const _yargs = /*#__PURE__*/ _interop_require_default(require("yargs"));
|
|
9
|
+
const _helpers = require("yargs/helpers");
|
|
8
10
|
const _utils = require("../utils");
|
|
9
11
|
const _commands = require("./commands");
|
|
10
12
|
const _utils1 = require("./utils");
|
|
@@ -13,46 +15,53 @@ function _interop_require_default(obj) {
|
|
|
13
15
|
default: obj
|
|
14
16
|
};
|
|
15
17
|
}
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
}).catch((reason)=>{
|
|
42
|
-
process.exit(reason.exitCode);
|
|
43
|
-
});
|
|
44
|
-
} else {
|
|
45
|
-
command.execute().catch(()=>{
|
|
46
|
-
process.exit(1);
|
|
47
|
-
});
|
|
18
|
+
Object.values(_utils.CommandName).reduce((y, name)=>addCommand(name, y), (0, _yargs.default)((0, _helpers.hideBin)(process.argv))).usage('Usage: startup <command> [options]').epilogue(_chalk.default.bold.cyan(`startup cli v${(0, _utils.getStartupVersion)()}\n`) + `Run ${_chalk.default.bold.cyan('startup <command> --help')} to see command options.\n` + `For detailed documentation, see ${_chalk.default.bold.cyan('https://docs.st.dev/docs/frontend/uikit/startup')}.\n`).demandCommand(1, '').strictCommands().updateStrings({
|
|
19
|
+
'Unknown command: %s': {
|
|
20
|
+
one: _chalk.default.bold.red('Unknown command: %s'),
|
|
21
|
+
other: _chalk.default.bold.red('Unknown command: %s')
|
|
22
|
+
}
|
|
23
|
+
}).version().wrap(Math.min(100, _yargs.default.terminalWidth())).help().parse();
|
|
24
|
+
function addCommand(name, y) {
|
|
25
|
+
const klass = (0, _commands.getCommand)(name);
|
|
26
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
27
|
+
const { description, options: { _, ...options } = {} } = klass;
|
|
28
|
+
const nameWithArgs = name + ((_ === null || _ === void 0 ? void 0 : _.description) ? ` ${_.description}` : '');
|
|
29
|
+
const groupedOptions = Object.entries(options).reduce((result, [key, value])=>{
|
|
30
|
+
result[key] = {
|
|
31
|
+
group: 'Command Options:',
|
|
32
|
+
...value
|
|
33
|
+
};
|
|
34
|
+
return result;
|
|
35
|
+
}, {});
|
|
36
|
+
const handler = (argv)=>handleCommand(name, argv);
|
|
37
|
+
if (description) {
|
|
38
|
+
y.command(nameWithArgs, description, groupedOptions, handler);
|
|
39
|
+
} else {
|
|
40
|
+
y.command(nameWithArgs, false, groupedOptions, handler);
|
|
41
|
+
}
|
|
42
|
+
return y;
|
|
48
43
|
}
|
|
49
|
-
function
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
44
|
+
function handleCommand(name, argv) {
|
|
45
|
+
const Command = (0, _commands.getCommand)(name);
|
|
46
|
+
checkNodeVersion();
|
|
47
|
+
(0, _utils1.maybeCreateGitFolder)(Command);
|
|
48
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
49
|
+
const command = new Command({
|
|
50
|
+
...argv,
|
|
51
|
+
_: argv._.slice(1)
|
|
55
52
|
});
|
|
53
|
+
if ((0, _utils1.setNodeOptions)(name, command)) {
|
|
54
|
+
_utils.log.debug('run', `Running ${name} in child process with amended NODE_OPTIONS`);
|
|
55
|
+
(0, _execa.default)(process.argv[0], process.argv.slice(1), {
|
|
56
|
+
stdio: 'inherit'
|
|
57
|
+
}).catch((reason)=>{
|
|
58
|
+
process.exit(reason.exitCode);
|
|
59
|
+
});
|
|
60
|
+
} else {
|
|
61
|
+
command.execute().catch(()=>{
|
|
62
|
+
process.exit(1);
|
|
63
|
+
});
|
|
64
|
+
}
|
|
56
65
|
}
|
|
57
66
|
function checkNodeVersion() {
|
|
58
67
|
const nodeVersion = Number(process.versions.node.split('.')[0]);
|
package/dist/cli/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/cli/index.ts"],"sourcesContent":["import execa from 'execa';\nimport path from 'path';\nimport {
|
|
1
|
+
{"version":3,"sources":["../../src/cli/index.ts"],"sourcesContent":["import chalk from 'chalk';\nimport execa from 'execa';\nimport path from 'path';\nimport yargs from 'yargs';\nimport { hideBin } from 'yargs/helpers';\nimport { CommandName, getStartupVersion, log } from '../utils';\nimport { Command, getCommand } from './commands';\nimport { maybeCreateGitFolder, setNodeOptions } from './utils';\n\nObject.values(CommandName)\n .reduce((y, name) => addCommand(name, y), yargs(hideBin(process.argv)))\n .usage('Usage: startup <command> [options]')\n .epilogue(\n chalk.bold.cyan(`startup cli v${getStartupVersion()}\\n`) +\n `Run ${chalk.bold.cyan('startup <command> --help')} to see command options.\\n` +\n `For detailed documentation, see ${chalk.bold.cyan('https://docs.st.dev/docs/frontend/uikit/startup')}.\\n`\n )\n .demandCommand(1, '')\n .strictCommands()\n .updateStrings({\n 'Unknown command: %s': {\n one: chalk.bold.red('Unknown command: %s'),\n other: chalk.bold.red('Unknown command: %s'),\n } as any,\n })\n .version()\n .wrap(Math.min(100, yargs.terminalWidth()))\n .help()\n .parse();\n\nfunction addCommand(name: CommandName, y: typeof yargs) {\n const klass = getCommand(name)! as typeof Command;\n // eslint-disable-next-line @typescript-eslint/naming-convention\n const { description, options: { _, ...options } = {} } = klass;\n const nameWithArgs = name + (_?.description ? ` ${_.description}` : '');\n const groupedOptions = Object.entries(options).reduce(\n (result, [key, value]) => {\n result[key] = { group: 'Command Options:', ...value };\n return result;\n },\n {} as NonNullable<typeof klass.options>\n );\n const handler = (argv: any) => handleCommand(name, argv);\n if (description) {\n y.command(nameWithArgs, description, groupedOptions, handler);\n } else {\n y.command(nameWithArgs, false, groupedOptions, handler);\n }\n return y;\n}\n\nfunction handleCommand(name: CommandName, argv: any) {\n const Command = getCommand(name)!;\n\n checkNodeVersion();\n maybeCreateGitFolder(Command);\n\n // eslint-disable-next-line @typescript-eslint/naming-convention\n const command = new Command({ ...argv, _: argv._.slice(1) });\n if (setNodeOptions(name, command)) {\n log.debug('run', `Running ${name} in child process with amended NODE_OPTIONS`);\n execa(process.argv[0], process.argv.slice(1), { stdio: 'inherit' }).catch(reason => {\n process.exit(reason.exitCode);\n });\n } else {\n command.execute().catch(() => {\n process.exit(1);\n });\n }\n}\n\nfunction checkNodeVersion() {\n const nodeVersion = Number(process.versions.node.split('.')[0]);\n if (nodeVersion % 2 === 0 || process.env.SKIP_NODE_VERSION_CHECK) {\n return;\n }\n\n const { engines } = require(path.join(__dirname, '../../package.json'));\n log.error(\n `error: node v${nodeVersion} detected, only even-numbered LTS versions ${engines.node} are supported`\n );\n log.text('See https://nodejs.org/en/download for LTS versions');\n process.exit(127);\n}\n"],"names":["Object","values","CommandName","reduce","y","name","addCommand","yargs","hideBin","process","argv","usage","epilogue","chalk","bold","cyan","getStartupVersion","demandCommand","strictCommands","updateStrings","one","red","other","version","wrap","Math","min","terminalWidth","help","parse","klass","getCommand","description","options","_","nameWithArgs","groupedOptions","entries","result","key","value","group","handler","handleCommand","command","Command","checkNodeVersion","maybeCreateGitFolder","slice","setNodeOptions","log","debug","execa","stdio","catch","reason","exit","exitCode","execute","nodeVersion","Number","versions","node","split","env","SKIP_NODE_VERSION_CHECK","engines","require","path","join","__dirname","error","text"],"mappings":";;;;8DAAkB;8DACA;6DACD;8DACC;yBACM;uBAC4B;0BAChB;wBACiB;;;;;;AAErDA,OAAOC,MAAM,CAACC,kBAAW,EACpBC,MAAM,CAAC,CAACC,GAAGC,OAASC,WAAWD,MAAMD,IAAIG,IAAAA,cAAK,EAACC,IAAAA,gBAAO,EAACC,QAAQC,IAAI,IACn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|
1
|
-
{"version":3,"file":"swc-compile-package.d.ts","sourceRoot":"","sources":["../../../src/cli/tasks/swc-compile-package.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"swc-compile-package.d.ts","sourceRoot":"","sources":["../../../src/cli/tasks/swc-compile-package.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE1C,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAE9B,UAAU,IAAK,SAAQ,WAAW;IAC9B,KAAK,CAAC,EAAE,OAAO,CAAC;CACnB;AAQD,qBAAa,iBAAkB,SAAQ,IAAI;gBAC3B,EAAE,KAAK,EAAE,EAAE,IAAI;IAIrB,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;IAqC9B,OAAO,CAAC,SAAS;CAyDpB"}
|