@servicetitan/startup 32.3.0 → 32.3.2
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/eslint.d.ts +7 -0
- package/dist/cli/commands/eslint.d.ts.map +1 -1
- package/dist/cli/commands/eslint.js +28 -4
- package/dist/cli/commands/eslint.js.map +1 -1
- package/dist/cli/index.js +0 -1
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/utils/lerna-exec.d.ts.map +1 -1
- package/dist/cli/utils/lerna-exec.js +2 -0
- package/dist/cli/utils/lerna-exec.js.map +1 -1
- package/dist/cli/utils/maybe-create-git-folder.d.ts +1 -2
- package/dist/cli/utils/maybe-create-git-folder.d.ts.map +1 -1
- package/dist/cli/utils/maybe-create-git-folder.js +4 -9
- package/dist/cli/utils/maybe-create-git-folder.js.map +1 -1
- package/package.json +8 -6
- package/src/cli/commands/__tests__/eslint.test.ts +13 -0
- package/src/cli/commands/eslint.ts +12 -3
- package/src/cli/index.ts +1 -2
- package/src/cli/utils/__tests__/lerna-exec.test.ts +7 -0
- package/src/cli/utils/__tests__/maybe-create-git-folder.test.ts +9 -23
- package/src/cli/utils/lerna-exec.ts +3 -0
- package/src/cli/utils/maybe-create-git-folder.ts +4 -8
|
@@ -2,9 +2,16 @@ import { Command, CommandArgs } from './types';
|
|
|
2
2
|
interface Args extends CommandArgs {
|
|
3
3
|
_: string[];
|
|
4
4
|
fix?: boolean;
|
|
5
|
+
paths?: string[];
|
|
5
6
|
}
|
|
6
7
|
export declare class ESLintCommand extends Command<Args> {
|
|
8
|
+
static readonly options: {
|
|
9
|
+
_: {
|
|
10
|
+
description: string;
|
|
11
|
+
};
|
|
12
|
+
};
|
|
7
13
|
execute(): Promise<void>;
|
|
14
|
+
private get paths();
|
|
8
15
|
}
|
|
9
16
|
export {};
|
|
10
17
|
//# sourceMappingURL=eslint.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"eslint.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/eslint.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"eslint.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/eslint.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAE/C,UAAU,IAAK,SAAQ,WAAW;IAC9B,CAAC,EAAE,MAAM,EAAE,CAAC;IACZ,GAAG,CAAC,EAAE,OAAO,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;CACpB;AAED,qBAAa,aAAc,SAAQ,OAAO,CAAC,IAAI,CAAC;IAC5C,MAAM,CAAC,QAAQ,CAAC,OAAO;;;;MAErB;IAGI,OAAO;IAIb,OAAO,KAAK,KAAK,GAGhB;CACJ"}
|
|
@@ -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
|
});
|
|
@@ -11,6 +11,19 @@ Object.defineProperty(exports, "ESLintCommand", {
|
|
|
11
11
|
const _utils = require("../../utils");
|
|
12
12
|
const _utils1 = require("../utils");
|
|
13
13
|
const _types = require("./types");
|
|
14
|
+
function _define_property(obj, key, value) {
|
|
15
|
+
if (key in obj) {
|
|
16
|
+
Object.defineProperty(obj, key, {
|
|
17
|
+
value: value,
|
|
18
|
+
enumerable: true,
|
|
19
|
+
configurable: true,
|
|
20
|
+
writable: true
|
|
21
|
+
});
|
|
22
|
+
} else {
|
|
23
|
+
obj[key] = value;
|
|
24
|
+
}
|
|
25
|
+
return obj;
|
|
26
|
+
}
|
|
14
27
|
function _ts_decorate(decorators, target, key, desc) {
|
|
15
28
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
16
29
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -22,13 +35,24 @@ function _ts_metadata(k, v) {
|
|
|
22
35
|
}
|
|
23
36
|
class ESLintCommand extends _types.Command {
|
|
24
37
|
async execute() {
|
|
25
|
-
const { _: paths, fix } = this.args;
|
|
26
38
|
await (0, _utils1.eslint)({
|
|
27
|
-
fix,
|
|
28
|
-
paths
|
|
39
|
+
fix: this.args.fix,
|
|
40
|
+
paths: this.paths
|
|
29
41
|
});
|
|
30
42
|
}
|
|
43
|
+
get paths() {
|
|
44
|
+
const { _, paths = [] } = this.args;
|
|
45
|
+
return [
|
|
46
|
+
..._,
|
|
47
|
+
...paths
|
|
48
|
+
];
|
|
49
|
+
}
|
|
31
50
|
}
|
|
51
|
+
_define_property(ESLintCommand, "options", {
|
|
52
|
+
_: {
|
|
53
|
+
description: '[paths...]'
|
|
54
|
+
}
|
|
55
|
+
});
|
|
32
56
|
_ts_decorate([
|
|
33
57
|
_utils.logErrors,
|
|
34
58
|
_ts_metadata("design:type", Function),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/cli/commands/eslint.ts"],"sourcesContent":["
|
|
1
|
+
{"version":3,"sources":["../../../src/cli/commands/eslint.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/naming-convention */\nimport { logErrors } from '../../utils';\nimport { eslint } from '../utils';\nimport { Command, CommandArgs } from './types';\n\ninterface Args extends CommandArgs {\n _: string[];\n fix?: boolean;\n paths?: string[];\n}\n\nexport class ESLintCommand extends Command<Args> {\n static readonly options = {\n _: { description: '[paths...]' },\n };\n\n @logErrors\n async execute() {\n await eslint({ fix: this.args.fix, paths: this.paths });\n }\n\n private get paths() {\n const { _, paths = [] } = this.args;\n return [..._, ...paths];\n }\n}\n"],"names":["ESLintCommand","Command","execute","eslint","fix","args","paths","_","options","description"],"mappings":"AAAA,uDAAuD;;;;+BAW1CA;;;eAAAA;;;uBAVa;wBACH;uBACc;;;;;;;;;;;;;;;;;;;;;;;AAQ9B,MAAMA,sBAAsBC,cAAO;IAKtC,MACMC,UAAU;QACZ,MAAMC,IAAAA,cAAM,EAAC;YAAEC,KAAK,IAAI,CAACC,IAAI,CAACD,GAAG;YAAEE,OAAO,IAAI,CAACA,KAAK;QAAC;IACzD;IAEA,IAAYA,QAAQ;QAChB,MAAM,EAAEC,CAAC,EAAED,QAAQ,EAAE,EAAE,GAAG,IAAI,CAACD,IAAI;QACnC,OAAO;eAAIE;eAAMD;SAAM;IAC3B;AACJ;AAbI,iBADSN,eACOQ,WAAU;IACtBD,GAAG;QAAEE,aAAa;IAAa;AACnC"}
|
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,
|
package/dist/cli/index.js.map
CHANGED
|
@@ -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 {
|
|
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,EAEjHE,aAAa,CAAC,GAAG,IACjBC,cAAc,GACdC,aAAa,CAAC;IACX,uBAAuB;QACnBC,KAAKP,cAAK,CAACC,IAAI,CAACO,GAAG,CAAC;QACpBC,OAAOT,cAAK,CAACC,IAAI,CAACO,GAAG,CAAC;IAC1B;AACJ,GACCE,OAAO,GACPC,IAAI,CAACC,KAAKC,GAAG,CAAC,KAAKnB,cAAK,CAACoB,aAAa,KACtCC,IAAI,GACJC,KAAK;AAEV,SAASvB,WAAWD,IAAiB,EAAED,CAAe;IAClD,MAAM0B,QAAQC,IAAAA,oBAAU,EAAC1B;IACzB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AAGJ,KAAK,CAAC;YACpB5C,QAAQ8C,IAAI,CAAC;QACjB;IACJ;AACJ;AAEA,SAAST;IACL,MAAMY,cAAcC,OAAOlD,QAAQmD,QAAQ,CAACC,IAAI,CAACC,KAAK,CAAC,IAAI,CAAC,EAAE;IAC9D,IAAIJ,cAAc,MAAM,KAAKjD,QAAQsD,GAAG,CAACC,uBAAuB,EAAE;QAC9D;IACJ;IAEA,MAAM,EAAEC,OAAO,EAAE,GAAGC,QAAQC,aAAI,CAACC,IAAI,CAACC,WAAW;IACjDpB,UAAG,CAACqB,KAAK,CACL,CAAC,aAAa,EAAEZ,YAAY,2CAA2C,EAAEO,QAAQJ,IAAI,CAAC,cAAc,CAAC;IAEzGZ,UAAG,CAACsB,IAAI,CAAC;IACT9D,QAAQ8C,IAAI,CAAC;AACjB"}
|
|
@@ -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;
|
|
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":";;;;+
|
|
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":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AE;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(
|
|
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":"
|
|
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
|
-
|
|
18
|
-
'
|
|
19
|
-
|
|
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 {
|
|
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.
|
|
3
|
+
"version": "32.3.2",
|
|
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.
|
|
42
|
-
"@servicetitan/stylelint-config": "32.3.
|
|
41
|
+
"@servicetitan/eslint-config": "32.3.2",
|
|
42
|
+
"@servicetitan/stylelint-config": "32.3.2",
|
|
43
43
|
"@svgr/webpack": "^8.1.0",
|
|
44
44
|
"@swc/cli": "^0.5.0",
|
|
45
45
|
"@swc/core": "1.13.5",
|
|
@@ -70,13 +70,14 @@
|
|
|
70
70
|
"less-loader": "~12.3.0",
|
|
71
71
|
"less-plugin-npm-import": "~2.1.0",
|
|
72
72
|
"lodash.memoize": "^4.1.2",
|
|
73
|
-
"memfs": "~4.
|
|
73
|
+
"memfs": "~4.50.0",
|
|
74
74
|
"mini-css-extract-plugin": "~2.9.4",
|
|
75
75
|
"moment-locales-webpack-plugin": "~1.2.0",
|
|
76
76
|
"multimatch": "~5.0.0",
|
|
77
77
|
"portfinder": "~1.0.38",
|
|
78
78
|
"postcss": "~8.5.6",
|
|
79
79
|
"prettier": "~3.6.2",
|
|
80
|
+
"rollup": "~4.49.0",
|
|
80
81
|
"sass": "~1.93.2",
|
|
81
82
|
"sass-loader": "~16.0.6",
|
|
82
83
|
"semver": "~7.7.3",
|
|
@@ -118,7 +119,8 @@
|
|
|
118
119
|
"jwa": [
|
|
119
120
|
"@progress/kendo-licensing@1.3.5 -> jsonwebtoken@9.0.2 -> jws@3.2.2 -> jwa@1.4.1",
|
|
120
121
|
"Forcing ^1.4.2 to fix Node v25 incompatibility in 1.4.1 (see https://github.com/auth0/node-jsonwebtoken/issues/992)"
|
|
121
|
-
]
|
|
122
|
+
],
|
|
123
|
+
"rollup": "Update/remove when https://github.com/rollup/rollup/issues/6168 is resolved"
|
|
122
124
|
},
|
|
123
125
|
"publishConfig": {
|
|
124
126
|
"access": "public"
|
|
@@ -126,5 +128,5 @@
|
|
|
126
128
|
"cli": {
|
|
127
129
|
"webpack": false
|
|
128
130
|
},
|
|
129
|
-
"gitHead": "
|
|
131
|
+
"gitHead": "06eacdb0bdeb763f5aeead1437443d794aeb80b4"
|
|
130
132
|
}
|
|
@@ -16,4 +16,17 @@ describe(`[startup] ${ESLintCommand.name}`, () => {
|
|
|
16
16
|
|
|
17
17
|
expect(eslint).toHaveBeenCalledWith({ fix: args.fix, paths: args._ });
|
|
18
18
|
});
|
|
19
|
+
|
|
20
|
+
describe('with paths', () => {
|
|
21
|
+
beforeEach(() => (args.paths = ['bar.ts']));
|
|
22
|
+
|
|
23
|
+
test('appends paths to args', async () => {
|
|
24
|
+
await subject();
|
|
25
|
+
|
|
26
|
+
expect(eslint).toHaveBeenCalledWith({
|
|
27
|
+
fix: args.fix,
|
|
28
|
+
paths: [...args._, ...args.paths!],
|
|
29
|
+
});
|
|
30
|
+
});
|
|
31
|
+
});
|
|
19
32
|
});
|
|
@@ -1,17 +1,26 @@
|
|
|
1
|
+
/* eslint-disable @typescript-eslint/naming-convention */
|
|
1
2
|
import { logErrors } from '../../utils';
|
|
2
3
|
import { eslint } from '../utils';
|
|
3
4
|
import { Command, CommandArgs } from './types';
|
|
4
5
|
|
|
5
6
|
interface Args extends CommandArgs {
|
|
6
|
-
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
7
7
|
_: string[];
|
|
8
8
|
fix?: boolean;
|
|
9
|
+
paths?: string[];
|
|
9
10
|
}
|
|
10
11
|
|
|
11
12
|
export class ESLintCommand extends Command<Args> {
|
|
13
|
+
static readonly options = {
|
|
14
|
+
_: { description: '[paths...]' },
|
|
15
|
+
};
|
|
16
|
+
|
|
12
17
|
@logErrors
|
|
13
18
|
async execute() {
|
|
14
|
-
|
|
15
|
-
|
|
19
|
+
await eslint({ fix: this.args.fix, paths: this.paths });
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
private get paths() {
|
|
23
|
+
const { _, paths = [] } = this.args;
|
|
24
|
+
return [..._, ...paths];
|
|
16
25
|
}
|
|
17
26
|
}
|
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 {
|
|
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
|
-
|
|
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(
|
|
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
|
|
39
|
-
beforeEach(() => (
|
|
26
|
+
describe('when directory does not contain lerna.json', () => {
|
|
27
|
+
beforeEach(() => fs.rmSync('lerna.json'));
|
|
40
28
|
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
describe('when command is Install', () => {
|
|
45
|
-
beforeEach(() => (command = Install));
|
|
29
|
+
test('does not create .git folder', () => {
|
|
30
|
+
subject();
|
|
46
31
|
|
|
47
|
-
|
|
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 {
|
|
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(
|
|
15
|
-
if (
|
|
16
|
-
|
|
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
|