@servicetitan/startup 32.3.0 → 32.3.1

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/index.js CHANGED
@@ -44,7 +44,6 @@ function addCommand(name, y) {
44
44
  function handleCommand(name, argv) {
45
45
  const Command = (0, _commands.getCommand)(name);
46
46
  checkNodeVersion();
47
- (0, _utils1.maybeCreateGitFolder)(Command);
48
47
  // eslint-disable-next-line @typescript-eslint/naming-convention
49
48
  const command = new Command({
50
49
  ...argv,
@@ -1 +1 @@
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,IA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IACT/D,QAAQ+C,IAAI,CAAC;AACjB"}
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 { 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\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","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;wBACL;;;;;;AAE/BA,OAAOC,MAAM,CAACC,kBAAW,EACpBC,MAAM,CAAC,CAACC,GAAGC,OAASC,WAAWD,MAAMD,IAAIG,IAAAA,cAAK,EAACC,IAAAA,gBAAO,EAACC,QAAQC,IAAI,IACnEC,KAAK,CAAC,sCACNC,QAAQ,CACLC,cAAK,CAACC,IAAI,CAACC,IAAI,CAAC,CAAC,aAAa,EAAEC,IAAAA,wBAAiB,IAAG,EAAE,CAAC,IACnD,CAAC,IAAI,EAAEH,cAAK,CAACC,IAAI,CAACC,IAAI,CAAC,4BAA4B,0BAA0B,CAAC,GAC9E,CAAC,gCAAgC,EAAEF,cAAK,CAACC,IAAI,CAACC,IAAI,CAAC,mDAAmD,GAAG,CAAC,EAEjH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,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;AAO3C,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,mCAkBnC"}
@@ -12,12 +12,14 @@ 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
14
  const _isci = require("./is-ci");
15
+ const _maybecreategitfolder = require("./maybe-create-git-folder");
15
16
  function _interop_require_default(obj) {
16
17
  return obj && obj.__esModule ? obj : {
17
18
  default: obj
18
19
  };
19
20
  }
20
21
  function lernaExec(args) {
22
+ (0, _maybecreategitfolder.maybeCreateGitFolder)();
21
23
  var _args_;
22
24
  const lernaArguments = [
23
25
  'exec',
@@ -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';\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","push","parallel","isCI","os","availableParallelism","stream"],"mappings":";;;;+BAgBgBA;;;eAAAA;;;8DAhBmB;+DACpB;uBAEK;sBACC;;;;;;AAYd,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,IAAAA,UAAI,MAAK,CAAC,cAAc,EAAEC,eAAE,CAACC,oBAAoB,IAAI,GAAG;IACxE,OAAO,IAAI,OAAOvB,KAAKoB,QAAQ,KAAK,UAAU;QAC1CN,OAAOK,IAAI,CAAC,CAAC,cAAc,EAAEnB,KAAKoB,QAAQ,EAAE;IAChD;IACA,IAAIpB,KAAKwB,MAAM,EAAE;QACbV,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';\nimport { maybeCreateGitFolder } from './maybe-create-git-folder';\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 maybeCreateGitFolder();\n\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","maybeCreateGitFolder","lernaArguments","getOptions","cmd","split","flatMap","arg","log","info","join","execa","stdio","env","FORCE_COLOR","result","scope","map","name","bail","push","parallel","isCI","os","availableParallelism","stream"],"mappings":";;;;+BAiBgBA;;;eAAAA;;;8DAjBmB;+DACpB;uBAEK;sBACC;sCACgB;;;;;;AAY9B,SAASA,UAAUC,IAAU;IAChCC,IAAAA,0CAAoB;QAOZD;IALR,MAAME,iBAAiB;QACnB;WACGC,WAAWH;QACd;WACGA,KAAKI,GAAG,CAACC,KAAK,CAAC;WACf,AAACL,CAAAA,CAAAA,SAAAA,IAAI,CAAC,KAAK,cAAVA,oBAAAA,SAAc,EAAE,AAAD,EAAGM,OAAO,CAACC,CAAAA,MAAOA,IAAIF,KAAK,CAAC;KAClD;QACkCL;IAAnCQ,UAAG,CAACC,IAAI,CAAC,CAAC,QAAQ,EAAE;QAACT,KAAKI,GAAG;WAAMJ,CAAAA,UAAAA,IAAI,CAAC,KAAK,cAAVA,qBAAAA,UAAc,EAAE;KAAE,CAACU,IAAI,CAAC,MAAM;QAEtDV;IADX,OAAOW,IAAAA,cAAK,EAAC,SAAST,gBAAgB;QAClCU,OAAOZ,CAAAA,cAAAA,KAAKY,KAAK,cAAVZ,yBAAAA,cAAc;QACrBa,KAAK;YACD,gEAAgE;YAChEC,aAAa;QACjB;IACJ;AACJ;AAEA,SAASX,WAAWH,IAAU;QACVA;IAAhB,MAAMe,SAAS,AAACf,CAAAA,CAAAA,cAAAA,KAAKgB,KAAK,cAAVhB,yBAAAA,cAAc,EAAE,AAAD,EAAGiB,GAAG,CAACC,CAAAA,OAAQ,CAAC,QAAQ,EAAEA,MAAM;IAC/D,IAAIlB,KAAKmB,IAAI,KAAK,OAAO;QACrBJ,OAAOK,IAAI,CAAC;IAChB;IACA,IAAIpB,KAAKqB,QAAQ,KAAK,MAAM;QACxBN,OAAOK,IAAI,CAACE,IAAAA,UAAI,MAAK,CAAC,cAAc,EAAEC,eAAE,CAACC,oBAAoB,IAAI,GAAG;IACxE,OAAO,IAAI,OAAOxB,KAAKqB,QAAQ,KAAK,UAAU;QAC1CN,OAAOK,IAAI,CAAC,CAAC,cAAc,EAAEpB,KAAKqB,QAAQ,EAAE;IAChD;IACA,IAAIrB,KAAKyB,MAAM,EAAE;QACbV,OAAOK,IAAI,CAAC;IAChB;IACA,OAAOL;AACX"}
@@ -1,4 +1,3 @@
1
- import { Command, Newable } from '../commands/types';
2
1
  /**
3
2
  * Create empty .git folder to workaround issue where Lerna does not
4
3
  * detect workspace packages. The empty .git folder
@@ -7,5 +6,5 @@ import { Command, Newable } from '../commands/types';
7
6
  * keeps reappearing (e.g., https://github.com/nrwl/nx/issues/9584 and
8
7
  * https://github.com/nrwl/nx/issues/18094)
9
8
  */
10
- export declare function maybeCreateGitFolder(command: Newable<Command>): void;
9
+ export declare function maybeCreateGitFolder(): void;
11
10
  //# sourceMappingURL=maybe-create-git-folder.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"maybe-create-git-folder.d.ts","sourceRoot":"","sources":["../../../src/cli/utils/maybe-create-git-folder.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAIrD;;;;;;;GAOG;AACH,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,OAAO,CAAC,OAAO,CAAC,QAY7D"}
1
+ {"version":3,"file":"maybe-create-git-folder.d.ts","sourceRoot":"","sources":["../../../src/cli/utils/maybe-create-git-folder.ts"],"names":[],"mappings":"AAGA;;;;;;;GAOG;AACH,wBAAgB,oBAAoB,SAUnC"}
@@ -9,20 +9,15 @@ Object.defineProperty(exports, "maybeCreateGitFolder", {
9
9
  }
10
10
  });
11
11
  const _fs = /*#__PURE__*/ _interop_require_default(require("fs"));
12
+ const _utils = require("../../utils");
12
13
  function _interop_require_default(obj) {
13
14
  return obj && obj.__esModule ? obj : {
14
15
  default: obj
15
16
  };
16
17
  }
17
- const EXCLUDED_COMMANDS = [
18
- 'Init',
19
- 'Install'
20
- ];
21
- function maybeCreateGitFolder(command) {
22
- if (EXCLUDED_COMMANDS.includes(command.name)) {
23
- return;
24
- }
25
- if (!_fs.default.existsSync('.git')) {
18
+ function maybeCreateGitFolder() {
19
+ if (!_fs.default.existsSync('.git') && _fs.default.existsSync('lerna.json')) {
20
+ _utils.log.debug('maybe-create-git-folder', 'creating .git folder');
26
21
  /*
27
22
  * Using {recursive: true} to ignore if directory exists. This happens
28
23
  * when parallel process creates the directory after we've checked
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/cli/utils/maybe-create-git-folder.ts"],"sourcesContent":["import fs from 'fs';\nimport { Command, Newable } from '../commands/types';\n\nconst EXCLUDED_COMMANDS = ['Init', 'Install'];\n\n/**\n * Create empty .git folder to workaround issue where Lerna does not\n * detect workspace packages. The empty .git folder\n * causes nx to use the git-hasher when building the project graph.\n * Note this gets fixed (e.g., https://github.com/nrwl/nx/issues/8601) but\n * keeps reappearing (e.g., https://github.com/nrwl/nx/issues/9584 and\n * https://github.com/nrwl/nx/issues/18094)\n */\nexport function maybeCreateGitFolder(command: Newable<Command>) {\n if (EXCLUDED_COMMANDS.includes(command.name)) {\n return;\n }\n if (!fs.existsSync('.git')) {\n /*\n * Using {recursive: true} to ignore if directory exists. This happens\n * when parallel process creates the directory after we've checked\n * whether it exists.\n */\n fs.mkdirSync('.git', { recursive: true });\n }\n}\n"],"names":["maybeCreateGitFolder","EXCLUDED_COMMANDS","command","includes","name","fs","existsSync","mkdirSync","recursive"],"mappings":";;;;+BAagBA;;;eAAAA;;;2DAbD;;;;;;AAGf,MAAMC,oBAAoB;IAAC;IAAQ;CAAU;AAUtC,SAASD,qBAAqBE,OAAyB;IAC1D,IAAID,kBAAkBE,QAAQ,CAACD,QAAQE,IAAI,GAAG;QAC1C;IACJ;IACA,IAAI,CAACC,WAAE,CAACC,UAAU,CAAC,SAAS;QACxB;;;;SAIC,GACDD,WAAE,CAACE,SAAS,CAAC,QAAQ;YAAEC,WAAW;QAAK;IAC3C;AACJ"}
1
+ {"version":3,"sources":["../../../src/cli/utils/maybe-create-git-folder.ts"],"sourcesContent":["import fs from 'fs';\nimport { log } from '../../utils';\n\n/**\n * Create empty .git folder to workaround issue where Lerna does not\n * detect workspace packages. The empty .git folder\n * causes nx to use the git-hasher when building the project graph.\n * Note this gets fixed (e.g., https://github.com/nrwl/nx/issues/8601) but\n * keeps reappearing (e.g., https://github.com/nrwl/nx/issues/9584 and\n * https://github.com/nrwl/nx/issues/18094)\n */\nexport function maybeCreateGitFolder() {\n if (!fs.existsSync('.git') && fs.existsSync('lerna.json')) {\n log.debug('maybe-create-git-folder', 'creating .git folder');\n /*\n * Using {recursive: true} to ignore if directory exists. This happens\n * when parallel process creates the directory after we've checked\n * whether it exists.\n */\n fs.mkdirSync('.git', { recursive: true });\n }\n}\n"],"names":["maybeCreateGitFolder","fs","existsSync","log","debug","mkdirSync","recursive"],"mappings":";;;;+BAWgBA;;;eAAAA;;;2DAXD;uBACK;;;;;;AAUb,SAASA;IACZ,IAAI,CAACC,WAAE,CAACC,UAAU,CAAC,WAAWD,WAAE,CAACC,UAAU,CAAC,eAAe;QACvDC,UAAG,CAACC,KAAK,CAAC,2BAA2B;QACrC;;;;SAIC,GACDH,WAAE,CAACI,SAAS,CAAC,QAAQ;YAAEC,WAAW;QAAK;IAC3C;AACJ"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@servicetitan/startup",
3
- "version": "32.3.0",
3
+ "version": "32.3.1",
4
4
  "description": "",
5
5
  "homepage": "https://docs.st.dev/docs/frontend/startup",
6
6
  "repository": {
@@ -38,8 +38,8 @@
38
38
  "@jest/core": "~29.7.0",
39
39
  "@jest/types": "~29.6.3",
40
40
  "@jsdevtools/coverage-istanbul-loader": "^3.0.5",
41
- "@servicetitan/eslint-config": "32.3.0",
42
- "@servicetitan/stylelint-config": "32.3.0",
41
+ "@servicetitan/eslint-config": "32.3.1",
42
+ "@servicetitan/stylelint-config": "32.3.1",
43
43
  "@svgr/webpack": "^8.1.0",
44
44
  "@swc/cli": "^0.5.0",
45
45
  "@swc/core": "1.13.5",
@@ -126,5 +126,5 @@
126
126
  "cli": {
127
127
  "webpack": false
128
128
  },
129
- "gitHead": "201392862b3cb12500b3c8c4f6310b101b87201b"
129
+ "gitHead": "a2d0b80586285dbe4c657a4cf44b4c4fe69362c1"
130
130
  }
package/src/cli/index.ts CHANGED
@@ -5,7 +5,7 @@ import yargs from 'yargs';
5
5
  import { hideBin } from 'yargs/helpers';
6
6
  import { CommandName, getStartupVersion, log } from '../utils';
7
7
  import { Command, getCommand } from './commands';
8
- import { maybeCreateGitFolder, setNodeOptions } from './utils';
8
+ import { setNodeOptions } from './utils';
9
9
 
10
10
  Object.values(CommandName)
11
11
  .reduce((y, name) => addCommand(name, y), yargs(hideBin(process.argv)))
@@ -53,7 +53,6 @@ function handleCommand(name: CommandName, argv: any) {
53
53
  const Command = getCommand(name)!;
54
54
 
55
55
  checkNodeVersion();
56
- maybeCreateGitFolder(Command);
57
56
 
58
57
  // eslint-disable-next-line @typescript-eslint/naming-convention
59
58
  const command = new Command({ ...argv, _: argv._.slice(1) });
@@ -2,10 +2,12 @@ import execa from 'execa';
2
2
 
3
3
  import { log } from '../../../utils';
4
4
  import { isCI } from '../is-ci';
5
+ import { maybeCreateGitFolder } from '../maybe-create-git-folder';
5
6
  import { lernaExec } from '../lerna-exec';
6
7
 
7
8
  jest.mock('execa');
8
9
  jest.mock('../is-ci', () => ({ isCI: jest.fn() }));
10
+ jest.mock('../maybe-create-git-folder', () => ({ maybeCreateGitFolder: jest.fn() }));
9
11
 
10
12
  const AVAILABLE_PARALLELISM = 2;
11
13
 
@@ -46,6 +48,11 @@ describe(`${lernaExec.name}`, () => {
46
48
  });
47
49
  }
48
50
 
51
+ test('calls maybeCreateGitFolder', () => {
52
+ subject();
53
+ expect(maybeCreateGitFolder).toHaveBeenCalled();
54
+ });
55
+
49
56
  itRunsLernaExec();
50
57
 
51
58
  describe.each([
@@ -1,33 +1,21 @@
1
1
  import { fs, vol } from 'memfs';
2
2
 
3
3
  import { maybeCreateGitFolder } from '../maybe-create-git-folder';
4
- import { Init } from '../../commands/init';
5
- import { Install } from '../../commands/install';
6
- import { Start } from '../../commands/start';
7
4
 
8
5
  jest.mock('fs', () => fs);
9
6
 
10
7
  describe(`[startup] Utils`, () => {
11
8
  describe(`${maybeCreateGitFolder.name}`, () => {
12
- let command: Parameters<typeof maybeCreateGitFolder>[0];
13
9
  const mkdirSpy = jest.spyOn(fs, 'mkdirSync').mockImplementation(jest.fn());
14
10
 
15
11
  beforeEach(() => {
16
- command = Start;
17
- vol.fromJSON({});
12
+ jest.clearAllMocks();
13
+ vol.fromJSON({ 'lerna.json': '' });
18
14
  });
19
15
 
20
16
  afterEach(() => vol.reset);
21
17
 
22
- const subject = () => maybeCreateGitFolder(command);
23
-
24
- function itDoesNotCreateGitFolder() {
25
- test('does not create .git folder', () => {
26
- subject();
27
-
28
- expect(mkdirSpy).not.toHaveBeenCalledWith();
29
- });
30
- }
18
+ const subject = () => maybeCreateGitFolder();
31
19
 
32
20
  test('creates .git folder', () => {
33
21
  subject();
@@ -35,16 +23,14 @@ describe(`[startup] Utils`, () => {
35
23
  expect(mkdirSpy).toHaveBeenCalledWith('.git', { recursive: true });
36
24
  });
37
25
 
38
- describe('when command is Init', () => {
39
- beforeEach(() => (command = Init));
26
+ describe('when directory does not contain lerna.json', () => {
27
+ beforeEach(() => fs.rmSync('lerna.json'));
40
28
 
41
- itDoesNotCreateGitFolder();
42
- });
43
-
44
- describe('when command is Install', () => {
45
- beforeEach(() => (command = Install));
29
+ test('does not create .git folder', () => {
30
+ subject();
46
31
 
47
- itDoesNotCreateGitFolder();
32
+ expect(mkdirSpy).not.toHaveBeenCalled();
33
+ });
48
34
  });
49
35
  });
50
36
  });
@@ -3,6 +3,7 @@ import os from 'node:os';
3
3
 
4
4
  import { log } from '../../utils';
5
5
  import { isCI } from './is-ci';
6
+ import { maybeCreateGitFolder } from './maybe-create-git-folder';
6
7
 
7
8
  interface Args {
8
9
  'bail'?: boolean;
@@ -15,6 +16,8 @@ interface Args {
15
16
  }
16
17
 
17
18
  export function lernaExec(args: Args) {
19
+ maybeCreateGitFolder();
20
+
18
21
  const lernaArguments = [
19
22
  'exec',
20
23
  ...getOptions(args),
@@ -1,7 +1,5 @@
1
1
  import fs from 'fs';
2
- import { Command, Newable } from '../commands/types';
3
-
4
- const EXCLUDED_COMMANDS = ['Init', 'Install'];
2
+ import { log } from '../../utils';
5
3
 
6
4
  /**
7
5
  * Create empty .git folder to workaround issue where Lerna does not
@@ -11,11 +9,9 @@ const EXCLUDED_COMMANDS = ['Init', 'Install'];
11
9
  * keeps reappearing (e.g., https://github.com/nrwl/nx/issues/9584 and
12
10
  * https://github.com/nrwl/nx/issues/18094)
13
11
  */
14
- export function maybeCreateGitFolder(command: Newable<Command>) {
15
- if (EXCLUDED_COMMANDS.includes(command.name)) {
16
- return;
17
- }
18
- if (!fs.existsSync('.git')) {
12
+ export function maybeCreateGitFolder() {
13
+ if (!fs.existsSync('.git') && fs.existsSync('lerna.json')) {
14
+ log.debug('maybe-create-git-folder', 'creating .git folder');
19
15
  /*
20
16
  * Using {recursive: true} to ignore if directory exists. This happens
21
17
  * when parallel process creates the directory after we've checked