@servicetitan/startup 31.6.0 → 32.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (64) hide show
  1. package/dist/cli/commands/init.d.ts +2 -1
  2. package/dist/cli/commands/init.d.ts.map +1 -1
  3. package/dist/cli/commands/init.js +24 -43
  4. package/dist/cli/commands/init.js.map +1 -1
  5. package/dist/cli/commands/install.d.ts +4 -0
  6. package/dist/cli/commands/install.d.ts.map +1 -1
  7. package/dist/cli/commands/install.js +91 -3
  8. package/dist/cli/commands/install.js.map +1 -1
  9. package/dist/cli/commands/mfe-package-clean.d.ts.map +1 -1
  10. package/dist/cli/commands/mfe-package-clean.js +5 -7
  11. package/dist/cli/commands/mfe-package-clean.js.map +1 -1
  12. package/dist/cli/commands/mfe-package-publish.d.ts.map +1 -1
  13. package/dist/cli/commands/mfe-package-publish.js +11 -15
  14. package/dist/cli/commands/mfe-package-publish.js.map +1 -1
  15. package/dist/cli/commands/upload-sourcemaps.d.ts.map +1 -1
  16. package/dist/cli/commands/upload-sourcemaps.js +1 -1
  17. package/dist/cli/commands/upload-sourcemaps.js.map +1 -1
  18. package/dist/cli/index.js +1 -2
  19. package/dist/cli/index.js.map +1 -1
  20. package/dist/cli/utils/cli-git.d.ts +11 -2
  21. package/dist/cli/utils/cli-git.d.ts.map +1 -1
  22. package/dist/cli/utils/cli-git.js +60 -4
  23. package/dist/cli/utils/cli-git.js.map +1 -1
  24. package/dist/cli/utils/index.d.ts +6 -0
  25. package/dist/cli/utils/index.d.ts.map +1 -1
  26. package/dist/cli/utils/index.js +6 -0
  27. package/dist/cli/utils/index.js.map +1 -1
  28. package/dist/cli/utils/is-ci.d.ts +2 -0
  29. package/dist/cli/utils/is-ci.d.ts.map +1 -0
  30. package/dist/cli/utils/is-ci.js +15 -0
  31. package/dist/cli/utils/is-ci.js.map +1 -0
  32. package/dist/cli/utils/lerna-exec.d.ts.map +1 -1
  33. package/dist/cli/utils/lerna-exec.js +2 -1
  34. package/dist/cli/utils/lerna-exec.js.map +1 -1
  35. package/dist/utils/get-branch-configs.d.ts +1 -1
  36. package/dist/utils/get-branch-configs.d.ts.map +1 -1
  37. package/dist/utils/get-branch-configs.js +2 -2
  38. package/dist/utils/get-branch-configs.js.map +1 -1
  39. package/dist/utils/index.d.ts +1 -0
  40. package/dist/utils/index.d.ts.map +1 -1
  41. package/dist/utils/index.js +1 -0
  42. package/dist/utils/index.js.map +1 -1
  43. package/package.json +6 -6
  44. package/src/cli/commands/__tests__/init.test.ts +21 -87
  45. package/src/cli/commands/__tests__/install.test.ts +174 -12
  46. package/src/cli/commands/__tests__/mfe-package-clean.test.ts +3 -6
  47. package/src/cli/commands/__tests__/mfe-package-publish.test.ts +6 -8
  48. package/src/cli/commands/__tests__/upload-sourcemaps.test.ts +7 -3
  49. package/src/cli/commands/init.ts +17 -37
  50. package/src/cli/commands/install.ts +95 -6
  51. package/src/cli/commands/mfe-package-clean.ts +2 -4
  52. package/src/cli/commands/mfe-package-publish.ts +18 -6
  53. package/src/cli/commands/upload-sourcemaps.ts +2 -2
  54. package/src/cli/index.ts +1 -2
  55. package/src/cli/utils/__tests__/cli-git.test.ts +142 -6
  56. package/src/cli/utils/__tests__/eslint.test.ts +3 -2
  57. package/src/cli/utils/__tests__/is-ci.test.ts +40 -0
  58. package/src/cli/utils/__tests__/lerna-exec.test.ts +6 -3
  59. package/src/cli/utils/cli-git.ts +55 -5
  60. package/src/cli/utils/index.ts +6 -0
  61. package/src/cli/utils/is-ci.ts +3 -0
  62. package/src/cli/utils/lerna-exec.ts +2 -1
  63. package/src/utils/get-branch-configs.ts +1 -1
  64. package/src/utils/index.ts +1 -0
@@ -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 { Command } from './types';\nimport { TSConfig } from '../utils';\n\ninterface Args {\n dry?: boolean;\n releaseVersion: string;\n}\n\ninterface PackageJson {\n name: string;\n}\n\nexport class UploadSourcemaps implements Command {\n #outDir?: string;\n #packageJson?: PackageJson;\n\n constructor(private readonly args: Args) {}\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 (!process.env.CI) {\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","execute","checkLocation","checkArgs","bundleDir","getBundleDir","options","getOptions","join","run","process","env","DATADOG_API_KEY","message","CI","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;wBAE7C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAYrB,uCACA;AAFG,MAAMA;IAMT,MAEMC,UAAU;QACZ,IAAI,CAACC,aAAa;QAClB,IAAI,CAAC,IAAI,CAACC,SAAS,IAAI;YACnB;QACJ;QAEA,MAAMC,YAAY,IAAI,CAACC,YAAY;QACnC,MAAMC,UAAU,IAAI,CAACC,UAAU,GAAGC,IAAI,CAAC;QACvC,IAAI,CAACC,GAAG,CAAC,CAAC,kDAAkD,EAAEL,UAAU,CAAC,EAAEE,SAAS;IACxF;IAEQH,YAAY;QAChB,IAAI,CAACO,QAAQC,GAAG,CAACC,eAAe,EAAE;YAC9B,MAAMC,UAAU;YAChB,IAAI,CAACH,QAAQC,GAAG,CAACG,EAAE,EAAE;gBACjB,MAAM,IAAIC,MAAMF;YACpB;YACAG,UAAG,CAACC,OAAO,CAAC,GAAGJ,QAAQ,qBAAqB,CAAC;YAC7C,OAAO;QACX;QAEA,IAAI,CAAC,IAAI,CAACK,IAAI,CAACC,cAAc,EAAE;YAC3B,MAAM,IAAIJ,MAAM;QACpB;QAEA,OAAO;IACX;IAEQb,gBAAgB;QACpB,IAAI,CAACkB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ACA,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;IAvFA,YAAY,AAAiBxB,IAAU,CAAE;;QAHzC,gCAAA;;mBAAA,KAAA;;QACA,gCAAA;;mBAAA,KAAA;;aAE6BA,OAAAA;IAAa;AAwF9C"}
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 implements Command {\n #outDir?: string;\n #packageJson?: PackageJson;\n\n constructor(private readonly args: Args) {}\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","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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAa3B,uCACA;AAFG,MAAMA;IAMT,MA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CAACG,OAAO,CAAC,YAAY;QAC/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;IAvFA,YAAY,AAAiBxB,IAAU,CAAE;;QAHzC,gCAAA;;mBAAA,KAAA;;QACA,gCAAA;;mBAAA,KAAA;;aAE6BA,OAAAA;IAAa;AAwF9C"}
package/dist/cli/index.js CHANGED
@@ -8,7 +8,6 @@ const _yargs = require("yargs");
8
8
  const _utils = require("../utils");
9
9
  const _commands = require("./commands");
10
10
  const _utils1 = require("./utils");
11
- const _maybecreategitfolder = require("./utils/maybe-create-git-folder");
12
11
  function _interop_require_default(obj) {
13
12
  return obj && obj.__esModule ? obj : {
14
13
  default: obj
@@ -29,7 +28,7 @@ if (!Command) {
29
28
  process.exit(127);
30
29
  }
31
30
  checkNodeVersion();
32
- (0, _maybecreategitfolder.maybeCreateGitFolder)(Command);
31
+ (0, _utils1.maybeCreateGitFolder)(Command);
33
32
  // eslint-disable-next-line @typescript-eslint/naming-convention
34
33
  const command = new Command({
35
34
  ...argvSync,
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/cli/index.ts"],"sourcesContent":["import execa from 'execa';\nimport path from 'path';\nimport { argv, Arguments } from 'yargs';\nimport { CommandName, getStartupVersion, log } from '../utils';\nimport { getCommand, getUserCommands } from './commands';\nimport { setNodeOptions } from './utils';\nimport { maybeCreateGitFolder } from './utils/maybe-create-git-folder';\n\nconst argvSync = argv as Arguments;\nconst name = argvSync._[0]?.toString() as CommandName;\nif (!name) {\n log.info(`startup cli v${getStartupVersion()}`);\n usage();\n process.exit(0);\n}\n\nconst Command = getCommand(name);\nif (!Command) {\n log.error(`Unknown command: \"${name}\"`);\n usage();\n process.exit(127);\n}\n\ncheckNodeVersion();\nmaybeCreateGitFolder(Command);\n\n// eslint-disable-next-line @typescript-eslint/naming-convention\nconst command = new Command({ ...argvSync, _: argvSync._.slice(1) });\nif (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\nfunction usage() {\n log.text('\\nUsage:');\n\n const commands = getUserCommands().filter(({ name }) => !!name);\n const maxNameLength = commands.reduce((result, { name }) => Math.max(result, name.length), 0);\n commands.forEach(({ name, description }) => {\n log.text(`startup ${name.padEnd(maxNameLength, ' ')} ${description}`);\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":["argvSync","argv","name","_","toString","log","info","getStartupVersion","usage","process","exit","Command","getCommand","error","checkNodeVersion","maybeCreateGitFolder","command","slice","setNodeOptions","debug","execa","stdio","catch","reason","exitCode","execute","text","commands","getUserCommands","filter","maxNameLength","reduce","result","Math","max","length","forEach","description","padEnd","nodeVersion","Number","versions","node","split","env","SKIP_NODE_VERSION_CHECK","engines","require","path","join","__dirname"],"mappings":";;;;8DAAkB;6DACD;uBACe;uBACoB;0BACR;wBACb;sCACM;;;;;;IAGxBA;AADb,MAAMA,WAAWC,WAAI;AACrB,MAAMC,QAAOF,eAAAA,SAASG,CAAC,CAAC,EAAE,cAAbH,mCAAAA,aAAeI,QAAQ;AACpC,IAAI,CAACF,MAAM;IACPG,UAAG,CAACC,IAAI,CAAC,CAAC,aAAa,EAAEC,IAAAA,wBAAiB,KAAI;IAC9CC;IACAC,QAAQC,IAAI,CAAC;AACjB;AAEA,MAAMC,UAAUC,IAAAA,oBAAU,EAACV;AAC3B,IAAI,CAACS,SAAS;IACVN,UAAG,CAACQ,KAAK,CAAC,CAAC,kBAAkB,EAAEX,KAAK,CAAC,CAAC;IACtCM;IACAC,QAAQC,IAAI,CAAC;AACjB;AAEAI;AACAC,IAAAA,0CAAoB,EAACJ;AAErB,gEAAgE;AAChE,MAAMK,UAAU,IAAIL,QAAQ;IAAE,GAAGX,QAAQ;IAAEG,GAAGH,SAASG,CAAC,CAACc,KAAK,CAAC;AAAG;AAClE,IAAIC,IAAAA,sBAAc,EAAChB,MAAMc,UAAU;IAC/BX,UAAG,CAACc,KAAK,CAAC,OAAO,CAAC,QAAQ,EAAEjB,KAAK,2CAA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esContent":["import execa from 'execa';\nimport path from 'path';\nimport { argv, Arguments } from 'yargs';\nimport { CommandName, getStartupVersion, log } from '../utils';\nimport { getCommand, getUserCommands } from './commands';\nimport { maybeCreateGitFolder, setNodeOptions } from './utils';\n\nconst argvSync = argv as Arguments;\nconst name = argvSync._[0]?.toString() as CommandName;\nif (!name) {\n log.info(`startup cli v${getStartupVersion()}`);\n usage();\n process.exit(0);\n}\n\nconst Command = getCommand(name);\nif (!Command) {\n log.error(`Unknown command: \"${name}\"`);\n usage();\n process.exit(127);\n}\n\ncheckNodeVersion();\nmaybeCreateGitFolder(Command);\n\n// eslint-disable-next-line @typescript-eslint/naming-convention\nconst command = new Command({ ...argvSync, _: argvSync._.slice(1) });\nif (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\nfunction usage() {\n log.text('\\nUsage:');\n\n const commands = getUserCommands().filter(({ name }) => !!name);\n const maxNameLength = commands.reduce((result, { name }) => Math.max(result, name.length), 0);\n commands.forEach(({ name, description }) => {\n log.text(`startup ${name.padEnd(maxNameLength, ' ')} ${description}`);\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":["argvSync","argv","name","_","toString","log","info","getStartupVersion","usage","process","exit","Command","getCommand","error","checkNodeVersion","maybeCreateGitFolder","command","slice","setNodeOptions","debug","execa","stdio","catch","reason","exitCode","execute","text","commands","getUserCommands","filter","maxNameLength","reduce","result","Math","max","length","forEach","description","padEnd","nodeVersion","Number","versions","node","split","env","SKIP_NODE_VERSION_CHECK","engines","require","path","join","__dirname"],"mappings":";;;;8DAAkB;6DACD;uBACe;uBACoB;0BACR;wBACS;;;;;;IAGxCA;AADb,MAAMA,WAAWC,WAAI;AACrB,MAAMC,QAAOF,eAAAA,SAASG,CAAC,CAAC,EAAE,cAAbH,mCAAAA,aAAeI,QAAQ;AACpC,IAAI,CAACF,MAAM;IACPG,UAAG,CAACC,IAAI,CAAC,CAAC,aAAa,EAAEC,IAAAA,wBAAiB,KAAI;IAC9CC;IACAC,QAAQC,IAAI,CAAC;AACjB;AAEA,MAAMC,UAAUC,IAAAA,oBAAU,EAACV;AAC3B,IAAI,CAACS,SAAS;IACVN,UAAG,CAACQ,KAAK,CAAC,CAAC,kBAAkB,EAAEX,KAAK,CAAC,CAAC;IACtCM;IACAC,QAAQC,IAAI,CAAC;AACjB;AAEAI;AACAC,IAAAA,4BAAoB,EAACJ;AAErB,gEAAgE;AAChE,MAAMK,UAAU,IAAIL,QAAQ;IAAE,GAAGX,QAAQ;IAAEG,GAAGH,SAASG,CAAC,CAACc,KAAK,CAAC;AAAG;AAClE,IAAIC,IAAAA,sBAAc,EAAChB,MAAMc,UAAU;IAC/BX,UAAG,CAACc,KAAK,CAAC,OAAO,CAAC,QAAQ,EAAEjB,KAAK,2CAA2C,CAAC;IAC7EkB,IAAAA,cAAK,EAACX,QAAQR,IAAI,CAAC,EAAE,EAAEQ,QAAQR,IAAI,CAACgB,KAAK,CAAC,IAAI;QAAEI,OAAO;IAAU,GAAGC,KAAK,CAACC,CAAAA;QACtEd,QAAQC,IAAI,CAACa,OAAOC,QAAQ;IAChC;AACJ,OAAO;IACHR,QAAQS,OAAO,GAAGH,KAAK,CAAC;QACpBb,QAAQC,IAAI,CAAC;IACjB;AACJ;AAEA,SAASF;IACLH,UAAG,CAACqB,IAAI,CAAC;IAET,MAAMC,WAAWC,IAAAA,yBAAe,IAAGC,MAAM,CAAC,CAAC,EAAE3B,IAAI,EAAE,GAAK,CAAC,CAACA;IAC1D,MAAM4B,gBAAgBH,SAASI,MAAM,CAAC,CAACC,QAAQ,EAAE9B,IAAI,EAAE,GAAK+B,KAAKC,GAAG,CAACF,QAAQ9B,KAAKiC,MAAM,GAAG;IAC3FR,SAASS,OAAO,CAAC,CAAC,EAAElC,IAAI,EAAEmC,WAAW,EAAE;QACnChC,UAAG,CAACqB,IAAI,CAAC,CAAC,QAAQ,EAAExB,KAAKoC,MAAM,CAACR,eAAe,KAAK,EAAE,EAAEO,aAAa;IACzE;AACJ;AAEA,SAASvB;IACL,MAAMyB,cAAcC,OAAO/B,QAAQgC,QAAQ,CAACC,IAAI,CAACC,KAAK,CAAC,IAAI,CAAC,EAAE;IAC9D,IAAIJ,cAAc,MAAM,KAAK9B,QAAQmC,GAAG,CAACC,uBAAuB,EAAE;QAC9D;IACJ;IAEA,MAAM,EAAEC,OAAO,EAAE,GAAGC,QAAQC,aAAI,CAACC,IAAI,CAACC,WAAW;IACjD7C,UAAG,CAACQ,KAAK,CACL,CAAC,aAAa,EAAE0B,YAAY,2CAA2C,EAAEO,QAAQJ,IAAI,CAAC,cAAc,CAAC;IAEzGrC,UAAG,CAACqB,IAAI,CAAC;IACTjB,QAAQC,IAAI,CAAC;AACjB"}
@@ -1,3 +1,12 @@
1
- export declare const gitGetBranch: () => string;
2
- export declare const gitGetCommitHash: () => string;
1
+ export declare function gitGetBranch(): string;
2
+ export declare function gitGetCommitHash(): string;
3
+ interface Repo {
4
+ owner?: string;
5
+ name: string;
6
+ }
7
+ export declare function gitCloneRepo(params: Repo & {
8
+ destination: string;
9
+ }): Promise<boolean>;
10
+ export declare function gitIsReachable({ owner, name }: Repo): boolean;
11
+ export {};
3
12
  //# sourceMappingURL=cli-git.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"cli-git.d.ts","sourceRoot":"","sources":["../../../src/cli/utils/cli-git.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,YAAY,QAAO,MAE/B,CAAC;AAEF,eAAO,MAAM,gBAAgB,QAAO,MAEnC,CAAC"}
1
+ {"version":3,"file":"cli-git.d.ts","sourceRoot":"","sources":["../../../src/cli/utils/cli-git.ts"],"names":[],"mappings":"AAIA,wBAAgB,YAAY,IAAI,MAAM,CAErC;AAED,wBAAgB,gBAAgB,IAAI,MAAM,CAEzC;AAED,UAAU,IAAI;IACV,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;CAChB;AAED,wBAAsB,YAAY,CAAC,MAAM,EAAE,IAAI,GAAG;IAAE,WAAW,EAAE,MAAM,CAAA;CAAE,oBAkBxE;AAED,wBAAgB,cAAc,CAAC,EAAE,KAAsB,EAAE,IAAI,EAAE,EAAE,IAAI,WASpE"}
@@ -9,19 +9,75 @@ function _export(target, all) {
9
9
  });
10
10
  }
11
11
  _export(exports, {
12
+ get gitCloneRepo () {
13
+ return gitCloneRepo;
14
+ },
12
15
  get gitGetBranch () {
13
16
  return gitGetBranch;
14
17
  },
15
18
  get gitGetCommitHash () {
16
19
  return gitGetCommitHash;
20
+ },
21
+ get gitIsReachable () {
22
+ return gitIsReachable;
17
23
  }
18
24
  });
25
+ const _utils = require("../../utils");
19
26
  const _clios = require("./cli-os");
20
- const gitGetBranch = ()=>{
27
+ const _isci = require("./is-ci");
28
+ function gitGetBranch() {
21
29
  return (0, _clios.runCommandOutput)('git rev-parse --abbrev-ref HEAD').trim();
22
- };
23
- const gitGetCommitHash = ()=>{
30
+ }
31
+ function gitGetCommitHash() {
24
32
  return (0, _clios.runCommandOutput)('git rev-parse --short HEAD').trim();
25
- };
33
+ }
34
+ async function gitCloneRepo(params) {
35
+ const { destination, name, owner = 'servicetitan' } = params;
36
+ const gitUrls = getGitUrls({
37
+ owner,
38
+ name
39
+ });
40
+ for (const url of gitUrls){
41
+ try {
42
+ const command = `git clone -q ${url} ${destination}`;
43
+ _utils.log.debug('git:clone-repo', `running ${command}`);
44
+ // eslint-disable-next-line no-await-in-loop
45
+ await (0, _clios.runCommand)(command, {
46
+ quiet: true
47
+ });
48
+ return true;
49
+ } catch (e) {
50
+ // ignore error
51
+ }
52
+ }
53
+ return false;
54
+ }
55
+ function gitIsReachable({ owner = 'servicetitan', name }) {
56
+ return getGitUrls({
57
+ owner,
58
+ name
59
+ }).some((url)=>{
60
+ try {
61
+ (0, _clios.runCommandOutput)(`git ls-remote -qt ${url}`, {
62
+ quiet: true
63
+ });
64
+ return true;
65
+ } catch (e) {
66
+ return false;
67
+ }
68
+ });
69
+ }
70
+ function getGitUrls({ owner, name }) {
71
+ const webUrl = `https://github.com/${owner}/${name}.git`;
72
+ const sshUrl = `git@github.com:${owner}/${name}.git`;
73
+ const urls = [
74
+ webUrl,
75
+ sshUrl
76
+ ];
77
+ if ((0, _isci.isCI)() && !!process.env.GITHUB_TOKEN) {
78
+ urls.unshift(webUrl.replace('github.com', `oauth2:${process.env.GITHUB_TOKEN}@github.com`));
79
+ }
80
+ return urls;
81
+ }
26
82
 
27
83
  //# sourceMappingURL=cli-git.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/cli/utils/cli-git.ts"],"sourcesContent":["import { runCommandOutput } from './cli-os';\n\nexport const gitGetBranch = (): string => {\n return runCommandOutput('git rev-parse --abbrev-ref HEAD').trim();\n};\n\nexport const gitGetCommitHash = (): string => {\n return runCommandOutput('git rev-parse --short HEAD').trim();\n};\n"],"names":["gitGetBranch","gitGetCommitHash","runCommandOutput","trim"],"mappings":";;;;;;;;;;;QAEaA;eAAAA;;QAIAC;eAAAA;;;uBANoB;AAE1B,MAAMD,eAAe;IACxB,OAAOE,IAAAA,uBAAgB,EAAC,mCAAmCC,IAAI;AACnE;AAEO,MAAMF,mBAAmB;IAC5B,OAAOC,IAAAA,uBAAgB,EAAC,8BAA8BC,IAAI;AAC9D"}
1
+ {"version":3,"sources":["../../../src/cli/utils/cli-git.ts"],"sourcesContent":["import { log } from '../../utils';\nimport { runCommand, runCommandOutput } from './cli-os';\nimport { isCI } from './is-ci';\n\nexport function gitGetBranch(): string {\n return runCommandOutput('git rev-parse --abbrev-ref HEAD').trim();\n}\n\nexport function gitGetCommitHash(): string {\n return runCommandOutput('git rev-parse --short HEAD').trim();\n}\n\ninterface Repo {\n owner?: string;\n name: string;\n}\n\nexport async function gitCloneRepo(params: Repo & { destination: string }) {\n const { destination, name, owner = 'servicetitan' } = params;\n const gitUrls = getGitUrls({ owner, name });\n\n for (const url of gitUrls) {\n try {\n const command = `git clone -q ${url} ${destination}`;\n log.debug('git:clone-repo', `running ${command}`);\n\n // eslint-disable-next-line no-await-in-loop\n await runCommand(command, { quiet: true });\n return true;\n } catch {\n // ignore error\n }\n }\n\n return false;\n}\n\nexport function gitIsReachable({ owner = 'servicetitan', name }: Repo) {\n return getGitUrls({ owner, name }).some(url => {\n try {\n runCommandOutput(`git ls-remote -qt ${url}`, { quiet: true });\n return true;\n } catch {\n return false;\n }\n });\n}\n\nfunction getGitUrls({ owner, name }: Repo) {\n const webUrl = `https://github.com/${owner}/${name}.git`;\n const sshUrl = `git@github.com:${owner}/${name}.git`;\n\n const urls = [webUrl, sshUrl];\n if (isCI() && !!process.env.GITHUB_TOKEN) {\n urls.unshift(webUrl.replace('github.com', `oauth2:${process.env.GITHUB_TOKEN}@github.com`));\n }\n\n return urls;\n}\n"],"names":["gitCloneRepo","gitGetBranch","gitGetCommitHash","gitIsReachable","runCommandOutput","trim","params","destination","name","owner","gitUrls","getGitUrls","url","command","log","debug","runCommand","quiet","some","webUrl","sshUrl","urls","isCI","process","env","GITHUB_TOKEN","unshift","replace"],"mappings":";;;;;;;;;;;QAiBsBA;eAAAA;;QAbNC;eAAAA;;QAIAC;eAAAA;;QA6BAC;eAAAA;;;uBArCI;uBACyB;sBACxB;AAEd,SAASF;IACZ,OAAOG,IAAAA,uBAAgB,EAAC,mCAAmCC,IAAI;AACnE;AAEO,SAASH;IACZ,OAAOE,IAAAA,uBAAgB,EAAC,8BAA8BC,IAAI;AAC9D;AAOO,eAAeL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';
2
2
  export * from './check-args';
3
+ export * from './cli-git';
4
+ export * from './cli-npm';
5
+ export * from './cli-os';
3
6
  export * from './compile';
4
7
  export * from './compile-less';
5
8
  export * from './compile-sass';
6
9
  export * from './copy-files';
7
10
  export * from './eslint';
8
11
  export * from './get-module-type';
12
+ export * from './is-ci';
9
13
  export * from './is-module-installed';
10
14
  export * from './lerna-exec';
15
+ export * from './maybe-create-git-folder';
11
16
  export * from './pipe-stdout';
12
17
  export * from './process-tree';
18
+ export * from './publish';
13
19
  export * from './set-node-options';
14
20
  export * from './ts-config';
15
21
  export * from './type-check';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/cli/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,cAAc,CAAC;AAC7B,cAAc,WAAW,CAAC;AAC1B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,cAAc,CAAC;AAC7B,cAAc,UAAU,CAAC;AACzB,cAAc,mBAAmB,CAAC;AAClC,cAAc,uBAAuB,CAAC;AACtC,cAAc,cAAc,CAAC;AAC7B,cAAc,eAAe,CAAC;AAC9B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,oBAAoB,CAAC;AACnC,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC;AAC7B,cAAc,gBAAgB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/cli/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,cAAc,CAAC;AAC7B,cAAc,WAAW,CAAC;AAC1B,cAAc,WAAW,CAAC;AAC1B,cAAc,UAAU,CAAC;AACzB,cAAc,WAAW,CAAC;AAC1B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,cAAc,CAAC;AAC7B,cAAc,UAAU,CAAC;AACzB,cAAc,mBAAmB,CAAC;AAClC,cAAc,SAAS,CAAC;AACxB,cAAc,uBAAuB,CAAC;AACtC,cAAc,cAAc,CAAC;AAC7B,cAAc,2BAA2B,CAAC;AAC1C,cAAc,eAAe,CAAC;AAC9B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,WAAW,CAAC;AAC1B,cAAc,oBAAoB,CAAC;AACnC,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC;AAC7B,cAAc,gBAAgB,CAAC"}
@@ -4,16 +4,22 @@ Object.defineProperty(exports, "__esModule", {
4
4
  });
5
5
  _export_star(require("./bundle"), exports);
6
6
  _export_star(require("./check-args"), exports);
7
+ _export_star(require("./cli-git"), exports);
8
+ _export_star(require("./cli-npm"), exports);
9
+ _export_star(require("./cli-os"), exports);
7
10
  _export_star(require("./compile"), exports);
8
11
  _export_star(require("./compile-less"), exports);
9
12
  _export_star(require("./compile-sass"), exports);
10
13
  _export_star(require("./copy-files"), exports);
11
14
  _export_star(require("./eslint"), exports);
12
15
  _export_star(require("./get-module-type"), exports);
16
+ _export_star(require("./is-ci"), exports);
13
17
  _export_star(require("./is-module-installed"), exports);
14
18
  _export_star(require("./lerna-exec"), exports);
19
+ _export_star(require("./maybe-create-git-folder"), exports);
15
20
  _export_star(require("./pipe-stdout"), exports);
16
21
  _export_star(require("./process-tree"), exports);
22
+ _export_star(require("./publish"), exports);
17
23
  _export_star(require("./set-node-options"), exports);
18
24
  _export_star(require("./ts-config"), exports);
19
25
  _export_star(require("./type-check"), exports);
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/cli/utils/index.ts"],"sourcesContent":["export * from './bundle';\nexport * from './check-args';\nexport * from './compile';\nexport * from './compile-less';\nexport * from './compile-sass';\nexport * from './copy-files';\nexport * from './eslint';\nexport * from './get-module-type';\nexport * from './is-module-installed';\nexport * from './lerna-exec';\nexport * from './pipe-stdout';\nexport * from './process-tree';\nexport * from './set-node-options';\nexport * from './ts-config';\nexport * from './type-check';\nexport * from './watch-stdout';\n"],"names":[],"mappings":";;;;qBAAc;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA"}
1
+ {"version":3,"sources":["../../../src/cli/utils/index.ts"],"sourcesContent":["export * from './bundle';\nexport * from './check-args';\nexport * from './cli-git';\nexport * from './cli-npm';\nexport * from './cli-os';\nexport * from './compile';\nexport * from './compile-less';\nexport * from './compile-sass';\nexport * from './copy-files';\nexport * from './eslint';\nexport * from './get-module-type';\nexport * from './is-ci';\nexport * from './is-module-installed';\nexport * from './lerna-exec';\nexport * from './maybe-create-git-folder';\nexport * from './pipe-stdout';\nexport * from './process-tree';\nexport * from './publish';\nexport * from './set-node-options';\nexport * from './ts-config';\nexport * from './type-check';\nexport * from './watch-stdout';\n"],"names":[],"mappings":";;;;qBAAc;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA"}
@@ -0,0 +1,2 @@
1
+ export declare function isCI(): boolean;
2
+ //# sourceMappingURL=is-ci.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"is-ci.d.ts","sourceRoot":"","sources":["../../../src/cli/utils/is-ci.ts"],"names":[],"mappings":"AAAA,wBAAgB,IAAI,YAEnB"}
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ Object.defineProperty(exports, "isCI", {
6
+ enumerable: true,
7
+ get: function() {
8
+ return isCI;
9
+ }
10
+ });
11
+ function isCI() {
12
+ return !!process.env.CI || !!process.env.TEAMCITY_VERSION;
13
+ }
14
+
15
+ //# sourceMappingURL=is-ci.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/cli/utils/is-ci.ts"],"sourcesContent":["export function isCI() {\n return !!process.env.CI || !!process.env.TEAMCITY_VERSION;\n}\n"],"names":["isCI","process","env","CI","TEAMCITY_VERSION"],"mappings":";;;;+BAAgBA;;;eAAAA;;;AAAT,SAASA;IACZ,OAAO,CAAC,CAACC,QAAQC,GAAG,CAACC,EAAE,IAAI,CAAC,CAACF,QAAQC,GAAG,CAACE,gBAAgB;AAC7D"}
@@ -1 +1 @@
1
- {"version":3,"file":"lerna-exec.d.ts","sourceRoot":"","sources":["../../../src/cli/utils/lerna-exec.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AAK3C,UAAU,IAAI;IACV,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IACnB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,UAAU,CAAC,EAAE,OAAO,GAAG,MAAM,CAAC;IAC9B,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,GAAG,QAAQ,GAAG,SAAS,GAAG,SAAS,WAAW,EAAE,CAAC;CACpE;AAED,wBAAgB,SAAS,CAAC,IAAI,EAAE,IAAI,mCAgBnC"}
1
+ {"version":3,"file":"lerna-exec.d.ts","sourceRoot":"","sources":["../../../src/cli/utils/lerna-exec.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AAM3C,UAAU,IAAI;IACV,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IACnB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,UAAU,CAAC,EAAE,OAAO,GAAG,MAAM,CAAC;IAC9B,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,GAAG,QAAQ,GAAG,SAAS,GAAG,SAAS,WAAW,EAAE,CAAC;CACpE;AAED,wBAAgB,SAAS,CAAC,IAAI,EAAE,IAAI,mCAgBnC"}
@@ -11,6 +11,7 @@ Object.defineProperty(exports, "lernaExec", {
11
11
  const _execa = /*#__PURE__*/ _interop_require_default(require("execa"));
12
12
  const _nodeos = /*#__PURE__*/ _interop_require_default(require("node:os"));
13
13
  const _utils = require("../../utils");
14
+ const _isci = require("./is-ci");
14
15
  function _interop_require_default(obj) {
15
16
  return obj && obj.__esModule ? obj : {
16
17
  default: obj
@@ -46,7 +47,7 @@ function getOptions(args) {
46
47
  result.push('--no-bail');
47
48
  }
48
49
  if (args.parallel === true) {
49
- result.push(process.env.CI ? `--concurrency=${_nodeos.default.availableParallelism()}` : '--parallel');
50
+ result.push((0, _isci.isCI)() ? `--concurrency=${_nodeos.default.availableParallelism()}` : '--parallel');
50
51
  } else if (typeof args.parallel === 'number') {
51
52
  result.push(`--concurrency=${args.parallel}`);
52
53
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/cli/utils/lerna-exec.ts"],"sourcesContent":["import execa, { StdioOption } from 'execa';\nimport os from 'node:os';\n\nimport { log } from '../../utils';\n\ninterface Args {\n 'bail'?: boolean;\n 'cmd': string;\n 'scope'?: string[];\n 'stream'?: boolean;\n 'parallel'?: boolean | number;\n '--'?: string[];\n 'stdio'?: 'pipe' | 'ignore' | 'inherit' | readonly StdioOption[];\n}\n\nexport function lernaExec(args: Args) {\n const lernaArguments = [\n 'exec',\n ...getOptions(args),\n '--',\n ...args.cmd.split(' '),\n ...(args['--'] ?? []).flatMap(arg => arg.split(' ')),\n ];\n log.info(`Running ${[args.cmd, ...(args['--'] ?? [])].join(' ')}`);\n return execa('lerna', lernaArguments, {\n stdio: args.stdio ?? 'inherit',\n env: {\n // eslint-disable-next-line @typescript-eslint/naming-convention\n FORCE_COLOR: 'true',\n },\n });\n}\n\nfunction getOptions(args: Args) {\n const result = (args.scope ?? []).map(name => `--scope=${name}`);\n if (args.bail === false) {\n result.push('--no-bail');\n }\n if (args.parallel === true) {\n result.push(process.env.CI ? `--concurrency=${os.availableParallelism()}` : '--parallel');\n } else if (typeof args.parallel === 'number') {\n result.push(`--concurrency=${args.parallel}`);\n }\n if (args.stream) {\n result.push('--stream');\n }\n return result;\n}\n"],"names":["lernaExec","args","lernaArguments","getOptions","cmd","split","flatMap","arg","log","info","join","execa","stdio","env","FORCE_COLOR","result","scope","map","name","bail","push","parallel","process","CI","os","availableParallelism","stream"],"mappings":";;;;+BAegBA;;;eAAAA;;;8DAfmB;+DACpB;uBAEK;;;;;;AAYb,SAASA,UAAUC,IAAU;QAMxBA;IALR,MAAMC,iBAAiB;QACnB;WACGC,WAAWF;QACd;WACGA,KAAKG,GAAG,CAACC,KAAK,CAAC;WACf,AAACJ,CAAAA,CAAAA,SAAAA,IAAI,CAAC,KAAK,cAAVA,oBAAAA,SAAc,EAAE,AAAD,EAAGK,OAAO,CAACC,CAAAA,MAAOA,IAAIF,KAAK,CAAC;KAClD;QACkCJ;IAAnCO,UAAG,CAACC,IAAI,CAAC,CAAC,QAAQ,EAAE;QAACR,KAAKG,GAAG;WAAMH,CAAAA,UAAAA,IAAI,CAAC,KAAK,cAAVA,qBAAAA,UAAc,EAAE;KAAE,CAACS,IAAI,CAAC,MAAM;QAEtDT;IADX,OAAOU,IAAAA,cAAK,EAAC,SAAST,gBAAgB;QAClCU,OAAOX,CAAAA,cAAAA,KAAKW,KAAK,cAAVX,yBAAAA,cAAc;QACrBY,KAAK;YACD,gEAAgE;YAChEC,aAAa;QACjB;IACJ;AACJ;AAEA,SAASX,WAAWF,IAAU;QACVA;IAAhB,MAAMc,SAAS,AAACd,CAAAA,CAAAA,cAAAA,KAAKe,KAAK,cAAVf,yBAAAA,cAAc,EAAE,AAAD,EAAGgB,GAAG,CAACC,CAAAA,OAAQ,CAAC,QAAQ,EAAEA,MAAM;IAC/D,IAAIjB,KAAKkB,IAAI,KAAK,OAAO;QACrBJ,OAAOK,IAAI,CAAC;IAChB;IACA,IAAInB,KAAKoB,QAAQ,KAAK,MAAM;QACxBN,OAAOK,IAAI,CAACE,QAAQT,GAAG,CAACU,EAAE,GAAG,CAAC,cAAc,EAAEC,eAAE,CAACC,oBAAoB,IAAI,GAAG;IAChF,OAAO,IAAI,OAAOxB,KAAKoB,QAAQ,KAAK,UAAU;QAC1CN,OAAOK,IAAI,CAAC,CAAC,cAAc,EAAEnB,KAAKoB,QAAQ,EAAE;IAChD;IACA,IAAIpB,KAAKyB,MAAM,EAAE;QACbX,OAAOK,IAAI,CAAC;IAChB;IACA,OAAOL;AACX"}
1
+ {"version":3,"sources":["../../../src/cli/utils/lerna-exec.ts"],"sourcesContent":["import execa, { StdioOption } from 'execa';\nimport os from 'node:os';\n\nimport { log } from '../../utils';\nimport { isCI } from './is-ci';\n\ninterface Args {\n 'bail'?: boolean;\n 'cmd': string;\n 'scope'?: string[];\n 'stream'?: boolean;\n 'parallel'?: boolean | number;\n '--'?: string[];\n 'stdio'?: 'pipe' | 'ignore' | 'inherit' | readonly StdioOption[];\n}\n\nexport function lernaExec(args: Args) {\n const lernaArguments = [\n 'exec',\n ...getOptions(args),\n '--',\n ...args.cmd.split(' '),\n ...(args['--'] ?? []).flatMap(arg => arg.split(' ')),\n ];\n log.info(`Running ${[args.cmd, ...(args['--'] ?? [])].join(' ')}`);\n return execa('lerna', lernaArguments, {\n stdio: args.stdio ?? 'inherit',\n env: {\n // eslint-disable-next-line @typescript-eslint/naming-convention\n FORCE_COLOR: 'true',\n },\n });\n}\n\nfunction getOptions(args: Args) {\n const result = (args.scope ?? []).map(name => `--scope=${name}`);\n if (args.bail === false) {\n result.push('--no-bail');\n }\n if (args.parallel === true) {\n result.push(isCI() ? `--concurrency=${os.availableParallelism()}` : '--parallel');\n } else if (typeof args.parallel === 'number') {\n result.push(`--concurrency=${args.parallel}`);\n }\n if (args.stream) {\n result.push('--stream');\n }\n return result;\n}\n"],"names":["lernaExec","args","lernaArguments","getOptions","cmd","split","flatMap","arg","log","info","join","execa","stdio","env","FORCE_COLOR","result","scope","map","name","bail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AE;IAChD;IACA,IAAIpB,KAAKwB,MAAM,EAAE;QACbV,OAAOK,IAAI,CAAC;IAChB;IACA,OAAOL;AACX"}
@@ -1,3 +1,3 @@
1
- import { WebComponentBranchConfigs } from './index';
1
+ import { WebComponentBranchConfigs } from './get-configuration';
2
2
  export declare function getBranchesConfigs(): Record<string, WebComponentBranchConfigs>;
3
3
  //# sourceMappingURL=get-branch-configs.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"get-branch-configs.d.ts","sourceRoot":"","sources":["../../src/utils/get-branch-configs.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgC,yBAAyB,EAAE,MAAM,SAAS,CAAC;AAWlF,wBAAgB,kBAAkB,IAAI,MAAM,CAAC,MAAM,EAAE,yBAAyB,CAAC,CAK9E"}
1
+ {"version":3,"file":"get-branch-configs.d.ts","sourceRoot":"","sources":["../../src/utils/get-branch-configs.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgC,yBAAyB,EAAE,MAAM,qBAAqB,CAAC;AAW9F,wBAAgB,kBAAkB,IAAI,MAAM,CAAC,MAAM,EAAE,yBAAyB,CAAC,CAK9E"}
@@ -8,7 +8,7 @@ Object.defineProperty(exports, "getBranchesConfigs", {
8
8
  return getBranchesConfigs;
9
9
  }
10
10
  });
11
- const _index = require("./index");
11
+ const _getconfiguration = require("./get-configuration");
12
12
  function getDefaultConfigs() {
13
13
  return {
14
14
  develop: {
@@ -26,7 +26,7 @@ function getDefaultConfigs() {
26
26
  };
27
27
  }
28
28
  function getBranchesConfigs() {
29
- const packageConfigs = (0, _index.getWebComponentBranchConfigs)();
29
+ const packageConfigs = (0, _getconfiguration.getWebComponentBranchConfigs)();
30
30
  const defaultConfigs = getDefaultConfigs();
31
31
  return packageConfigs !== null && packageConfigs !== void 0 ? packageConfigs : defaultConfigs;
32
32
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/utils/get-branch-configs.ts"],"sourcesContent":["import { getWebComponentBranchConfigs, WebComponentBranchConfigs } from './index';\n\nfunction getDefaultConfigs(): Record<string, WebComponentBranchConfigs> {\n return {\n develop: { publishTag: 'dev' },\n dev: { publishTag: 'dev' },\n next: { publishTag: 'next' },\n master: { publishTag: 'prod' },\n };\n}\n\nexport function getBranchesConfigs(): Record<string, WebComponentBranchConfigs> {\n const packageConfigs = getWebComponentBranchConfigs();\n const defaultConfigs = getDefaultConfigs();\n\n return packageConfigs ?? defaultConfigs;\n}\n"],"names":["getBranchesConfigs","getDefaultConfigs","develop","publishTag","dev","next","master","packageConfigs","getWebComponentBranchConfigs","defaultConfigs"],"mappings":";;;;+BAWgBA;;;eAAAA;;;uBAXwD;AAExE,SAASC;IACL,OAAO;QACHC,SAAS;YAAEC,YAAY;QAAM;QAC7BC,KAAK;YAAED,YAAY;QAAM;QACzBE,MAAM;YAAEF,YAAY;QAAO;QAC3BG,QAAQ;YAAEH,YAAY;QAAO;IACjC;AACJ;AAEO,SAASH;IACZ,MAAMO,iBAAiBC,IAAAA,mCAA4B;IACnD,MAAMC,iBAAiBR;IAEvB,OAAOM,2BAAAA,4BAAAA,iBAAkBE;AAC7B"}
1
+ {"version":3,"sources":["../../src/utils/get-branch-configs.ts"],"sourcesContent":["import { getWebComponentBranchConfigs, WebComponentBranchConfigs } from './get-configuration';\n\nfunction getDefaultConfigs(): Record<string, WebComponentBranchConfigs> {\n return {\n develop: { publishTag: 'dev' },\n dev: { publishTag: 'dev' },\n next: { publishTag: 'next' },\n master: { publishTag: 'prod' },\n };\n}\n\nexport function getBranchesConfigs(): Record<string, WebComponentBranchConfigs> {\n const packageConfigs = getWebComponentBranchConfigs();\n const defaultConfigs = getDefaultConfigs();\n\n return packageConfigs ?? defaultConfigs;\n}\n"],"names":["getBranchesConfigs","getDefaultConfigs","develop","publishTag","dev","next","master","packageConfigs","getWebComponentBranchConfigs","defaultConfigs"],"mappings":";;;;+BAWgBA;;;eAAAA;;;kCAXwD;AAExE,SAASC;IACL,OAAO;QACHC,SAAS;YAAEC,YAAY;QAAM;QAC7BC,KAAK;YAAED,YAAY;QAAM;QACzBE,MAAM;YAAEF,YAAY;QAAO;QAC3BG,QAAQ;YAAEH,YAAY;QAAO;IACjC;AACJ;AAEO,SAASH;IACZ,MAAMO,iBAAiBC,IAAAA,8CAA4B;IACnD,MAAMC,iBAAiBR;IAEvB,OAAOM,2BAAAA,4BAAAA,iBAAkBE;AAC7B"}
@@ -1,6 +1,7 @@
1
1
  export * from './find-packages';
2
2
  export * from './find-up';
3
3
  export * from './format-duration';
4
+ export * from './get-branch-configs';
4
5
  export * from './get-configuration';
5
6
  export * from './get-destination-folders';
6
7
  export * from './get-folders';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC;AAChC,cAAc,WAAW,CAAC;AAC1B,cAAc,mBAAmB,CAAC;AAClC,cAAc,qBAAqB,CAAC;AACpC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,eAAe,CAAC;AAC9B,cAAc,mBAAmB,CAAC;AAClC,cAAc,oBAAoB,CAAC;AACnC,cAAc,oBAAoB,CAAC;AACnC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,uBAAuB,CAAC;AACtC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,4BAA4B,CAAC;AAC3C,cAAc,OAAO,CAAC;AACtB,cAAc,cAAc,CAAC;AAC7B,cAAc,QAAQ,CAAC;AACvB,cAAc,aAAa,CAAC;AAC5B,cAAc,YAAY,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC;AAChC,cAAc,WAAW,CAAC;AAC1B,cAAc,mBAAmB,CAAC;AAClC,cAAc,sBAAsB,CAAC;AACrC,cAAc,qBAAqB,CAAC;AACpC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,eAAe,CAAC;AAC9B,cAAc,mBAAmB,CAAC;AAClC,cAAc,oBAAoB,CAAC;AACnC,cAAc,oBAAoB,CAAC;AACnC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,uBAAuB,CAAC;AACtC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,4BAA4B,CAAC;AAC3C,cAAc,OAAO,CAAC;AACtB,cAAc,cAAc,CAAC;AAC7B,cAAc,QAAQ,CAAC;AACvB,cAAc,aAAa,CAAC;AAC5B,cAAc,YAAY,CAAC"}
@@ -5,6 +5,7 @@ Object.defineProperty(exports, "__esModule", {
5
5
  _export_star(require("./find-packages"), exports);
6
6
  _export_star(require("./find-up"), exports);
7
7
  _export_star(require("./format-duration"), exports);
8
+ _export_star(require("./get-branch-configs"), exports);
8
9
  _export_star(require("./get-configuration"), exports);
9
10
  _export_star(require("./get-destination-folders"), exports);
10
11
  _export_star(require("./get-folders"), exports);
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/utils/index.ts"],"sourcesContent":["export * from './find-packages';\nexport * from './find-up';\nexport * from './format-duration';\nexport * from './get-configuration';\nexport * from './get-destination-folders';\nexport * from './get-folders';\nexport * from './get-jest-config';\nexport * from './get-package-data';\nexport * from './get-package-name';\nexport * from './get-packages';\nexport * from './get-startup-version';\nexport * from './get-tsconfig';\nexport * from './load-shared-dependencies';\nexport * from './log';\nexport * from './log-errors';\nexport * from './pick';\nexport * from './read-json';\nexport * from './to-array';\n"],"names":[],"mappings":";;;;qBAAc;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA"}
1
+ {"version":3,"sources":["../../src/utils/index.ts"],"sourcesContent":["export * from './find-packages';\nexport * from './find-up';\nexport * from './format-duration';\nexport * from './get-branch-configs';\nexport * from './get-configuration';\nexport * from './get-destination-folders';\nexport * from './get-folders';\nexport * from './get-jest-config';\nexport * from './get-package-data';\nexport * from './get-package-name';\nexport * from './get-packages';\nexport * from './get-startup-version';\nexport * from './get-tsconfig';\nexport * from './load-shared-dependencies';\nexport * from './log';\nexport * from './log-errors';\nexport * from './pick';\nexport * from './read-json';\nexport * from './to-array';\n"],"names":[],"mappings":";;;;qBAAc;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@servicetitan/startup",
3
- "version": "31.6.0",
3
+ "version": "32.0.0",
4
4
  "description": "",
5
5
  "homepage": "https://docs.st.dev/docs/frontend/startup",
6
6
  "repository": {
@@ -37,8 +37,8 @@
37
37
  "@jest/core": "~29.7.0",
38
38
  "@jest/types": "~29.6.3",
39
39
  "@jsdevtools/coverage-istanbul-loader": "^3.0.5",
40
- "@servicetitan/eslint-config": "31.6.0",
41
- "@servicetitan/stylelint-config": "31.6.0",
40
+ "@servicetitan/eslint-config": "32.0.0",
41
+ "@servicetitan/stylelint-config": "32.0.0",
42
42
  "@svgr/webpack": "^8.1.0",
43
43
  "@swc/cli": "^0.5.0",
44
44
  "@swc/core": "1.13.5",
@@ -50,7 +50,7 @@
50
50
  "css-loader": "~7.1.2",
51
51
  "css-minimizer-webpack-plugin": "^7.0.2",
52
52
  "debounce": "^2.2.0",
53
- "debug": "^4.4.1",
53
+ "debug": "^4.4.3",
54
54
  "deepmerge": "~4.3.1",
55
55
  "eslint": "~9.35.0",
56
56
  "execa": "~5.1.1",
@@ -72,7 +72,7 @@
72
72
  "mini-css-extract-plugin": "~2.9.4",
73
73
  "moment-locales-webpack-plugin": "~1.2.0",
74
74
  "multimatch": "~5.0.0",
75
- "portfinder": "~1.0.37",
75
+ "portfinder": "~1.0.38",
76
76
  "postcss": "~8.5.6",
77
77
  "prettier": "~3.6.2",
78
78
  "sass": "~1.92.1",
@@ -120,5 +120,5 @@
120
120
  "cli": {
121
121
  "webpack": false
122
122
  },
123
- "gitHead": "533bcbd267e11c88700b29f539ca1cb5de6440ae"
123
+ "gitHead": "af064114b3ec8c08a4b693a66c4062a52b03504c"
124
124
  }
@@ -2,40 +2,38 @@ import { fs, vol } from 'memfs';
2
2
  import { mkdirSync, rmSync } from 'fs';
3
3
  import path from 'path';
4
4
 
5
+ import { log } from '../../../utils';
6
+ import { gitCloneRepo, gitIsReachable } from '../../utils';
5
7
  import { Init } from '../init';
6
- import { runCommand, runCommandOutput } from '../../utils/cli-os';
7
8
 
8
9
  jest.mock('fs', () => fs);
9
- jest.mock('../../utils//cli-os', () => ({ runCommand: jest.fn(), runCommandOutput: jest.fn() }));
10
+ jest.mock('../../utils', () => ({
11
+ gitCloneRepo: jest.fn(),
12
+ gitIsReachable: jest.fn(),
13
+ }));
10
14
  jest.mock('../../../utils', () => ({
11
- log: { info: jest.fn() }, // suppress log output
15
+ log: { debug: jest.fn(), error: jest.fn(), info: jest.fn() },
12
16
  }));
13
17
 
14
- const webUrl = 'https://github.com/servicetitan/frontend-example.git';
15
- const sshUrl = 'git@github.com:servicetitan/frontend-example.git';
16
-
17
18
  describe(`[startup] ${Init.name}`, () => {
18
19
  let args: ConstructorParameters<typeof Init>[0];
19
20
 
20
21
  beforeEach(() => {
21
22
  args = {};
22
23
  vol.reset();
23
- jest.clearAllMocks();
24
- jest.mocked(runCommand).mockImplementation(jest.fn());
25
- jest.mocked(runCommandOutput).mockImplementation(jest.fn());
24
+ jest.mocked(gitCloneRepo).mockResolvedValue(true);
26
25
  jest.spyOn(fs, 'mkdirSync').mockImplementation(jest.fn());
27
26
  jest.spyOn(fs, 'rmSync').mockImplementation(jest.fn());
27
+ jest.spyOn(log, 'error').mockImplementation(jest.fn()); // suppress error output
28
28
  });
29
29
 
30
30
  const subject = async () => new Init(args).execute();
31
31
 
32
- test(`clones ${webUrl} to current directory`, async () => {
32
+ test('clones "frontend-example" to current directory', async () => {
33
33
  const cwd = path.resolve('.');
34
34
  await subject();
35
35
 
36
- expect(runCommand).toHaveBeenCalledWith(`git clone -q ${webUrl} ${cwd}`, {
37
- quiet: true,
38
- });
36
+ expect(gitCloneRepo).toHaveBeenCalledWith({ destination: cwd, name: 'frontend-example' });
39
37
  expect(rmSync).toHaveBeenCalledWith(path.join(cwd, '.git'), {
40
38
  recursive: true,
41
39
  force: true,
@@ -44,59 +42,18 @@ describe(`[startup] ${Init.name}`, () => {
44
42
  expect(rmSync).toHaveBeenCalledWith(path.join(cwd, 'package-lock.json'));
45
43
  });
46
44
 
47
- describe(`when cloning ${webUrl} fails`, () => {
48
- beforeEach(() => jest.mocked(runCommand).mockRejectedValueOnce('Nope!'));
49
-
50
- test(`clones ${sshUrl} to current directory`, async () => {
51
- await subject();
52
-
53
- expect(runCommand).toHaveBeenCalledWith(
54
- `git clone -q ${sshUrl} ${path.resolve('.')}`,
55
- expect.anything()
56
- );
57
- });
45
+ describe('when cloning fails', () => {
46
+ beforeEach(() => jest.mocked(gitCloneRepo).mockResolvedValue(false));
58
47
 
59
- describe(`when cloning ${sshUrl} also fails`, () => {
48
+ describe('when repo is not reachable', () => {
60
49
  beforeEach(() => {
61
- jest.mocked(runCommand).mockRejectedValue('Nope!');
62
- });
63
-
64
- test(`checks if ${webUrl} is reachable`, async () => {
65
- await subject();
66
-
67
- expect(runCommandOutput).toHaveBeenCalledWith(`git ls-remote -qt ${webUrl}`, {
68
- quiet: true,
69
- });
50
+ jest.mocked(gitIsReachable).mockReturnValue(false);
70
51
  });
71
52
 
72
- describe(`when ${webUrl} is not reachable`, () => {
73
- beforeEach(() => {
74
- jest.mocked(runCommandOutput).mockImplementationOnce(() => {
75
- throw new Error('Oops!');
76
- });
77
- });
78
-
79
- test(`checks if ${sshUrl} is reachable`, async () => {
80
- await subject();
81
-
82
- expect(runCommandOutput).toHaveBeenCalledWith(`git ls-remote -qt ${sshUrl}`, {
83
- quiet: true,
84
- });
85
- });
86
-
87
- describe(`when ${sshUrl} is also unreachable`, () => {
88
- beforeEach(() =>
89
- jest.mocked(runCommandOutput).mockImplementation(() => {
90
- throw new Error('Oops');
91
- })
92
- );
93
-
94
- test('raises error', async () => {
95
- await expect(subject()).rejects.toThrow(
96
- /could not read servicetitan\/frontend-example repository/
97
- );
98
- });
99
- });
53
+ test('raises error', async () => {
54
+ await expect(subject()).rejects.toThrow(
55
+ /could not read servicetitan\/frontend-example repository/
56
+ );
100
57
  });
101
58
  });
102
59
  });
@@ -104,15 +61,13 @@ describe(`[startup] ${Init.name}`, () => {
104
61
  describe('with an output location', () => {
105
62
  beforeEach(() => (args.output = 'foo/bar'));
106
63
 
107
- test(`clones ${webUrl} to output location`, async () => {
64
+ test('clones repo to output location', async () => {
108
65
  const destination = path.resolve(args.output!);
109
66
 
110
67
  await subject();
111
68
 
112
69
  expect(mkdirSync).toHaveBeenCalledWith(destination, { recursive: true });
113
- expect(runCommand).toHaveBeenCalledWith(`git clone -q ${webUrl} ${destination}`, {
114
- quiet: true,
115
- });
70
+ expect(gitCloneRepo).toHaveBeenCalledWith(expect.objectContaining({ destination }));
116
71
  });
117
72
 
118
73
  describe('when output location is a file', () => {
@@ -131,25 +86,4 @@ describe(`[startup] ${Init.name}`, () => {
131
86
  });
132
87
  });
133
88
  });
134
-
135
- describe('when running in CI environment with GITHUB_TOKEN', () => {
136
- const originalEnv = process.env;
137
- const token = 'foo-bar';
138
-
139
- beforeEach(() => {
140
- process.env.CI = 'true';
141
- process.env.GITHUB_TOKEN = token;
142
- });
143
- afterEach(() => (process.env = originalEnv));
144
-
145
- test(`adds token to ${webUrl}`, async () => {
146
- await subject();
147
-
148
- const urlWithToken = webUrl.replace('github.com', `oauth2:${token}@github.com`);
149
- expect(runCommand).toHaveBeenCalledWith(
150
- `git clone -q ${urlWithToken} ${path.resolve('.')}`,
151
- expect.anything()
152
- );
153
- });
154
- });
155
89
  });