@servicetitan/startup 32.4.0 → 32.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli/commands/init.d.ts +1 -1
- package/dist/cli/commands/init.d.ts.map +1 -1
- package/dist/cli/commands/init.js +6 -5
- package/dist/cli/commands/init.js.map +1 -1
- package/dist/cli/commands/install.d.ts +1 -4
- package/dist/cli/commands/install.d.ts.map +1 -1
- package/dist/cli/commands/install.js +12 -118
- package/dist/cli/commands/install.js.map +1 -1
- package/dist/cli/commands/mfe-list.d.ts.map +1 -1
- package/dist/cli/commands/mfe-list.js +2 -1
- package/dist/cli/commands/mfe-list.js.map +1 -1
- package/dist/cli/commands/review/rules/index.d.ts.map +1 -1
- package/dist/cli/commands/review/rules/index.js +2 -0
- package/dist/cli/commands/review/rules/index.js.map +1 -1
- package/dist/cli/commands/review/rules/no-deprecated-startup-install.d.ts +7 -0
- package/dist/cli/commands/review/rules/no-deprecated-startup-install.d.ts.map +1 -0
- package/dist/cli/commands/review/rules/no-deprecated-startup-install.js +38 -0
- package/dist/cli/commands/review/rules/no-deprecated-startup-install.js.map +1 -0
- package/dist/cli/commands/review/types.d.ts +1 -0
- package/dist/cli/commands/review/types.d.ts.map +1 -1
- package/dist/cli/commands/review/types.js.map +1 -1
- package/dist/cli/commands/upload-sourcemaps.d.ts.map +1 -1
- package/dist/cli/commands/upload-sourcemaps.js +2 -1
- package/dist/cli/commands/upload-sourcemaps.js.map +1 -1
- package/dist/cli/utils/cli-git.d.ts +0 -9
- package/dist/cli/utils/cli-git.d.ts.map +1 -1
- package/dist/cli/utils/cli-git.js +0 -59
- package/dist/cli/utils/cli-git.js.map +1 -1
- package/dist/cli/utils/cli-npm.d.ts +0 -3
- package/dist/cli/utils/cli-npm.d.ts.map +1 -1
- package/dist/cli/utils/cli-npm.js +0 -22
- package/dist/cli/utils/cli-npm.js.map +1 -1
- package/dist/cli/utils/index.d.ts +0 -1
- package/dist/cli/utils/index.d.ts.map +1 -1
- package/dist/cli/utils/index.js +0 -1
- package/dist/cli/utils/index.js.map +1 -1
- package/dist/cli/utils/lerna-exec.d.ts.map +1 -1
- package/dist/cli/utils/lerna-exec.js +2 -2
- package/dist/cli/utils/lerna-exec.js.map +1 -1
- package/package.json +7 -8
- package/src/cli/commands/__tests__/init.test.ts +11 -14
- package/src/cli/commands/__tests__/install.test.ts +19 -224
- package/src/cli/commands/__tests__/mfe-list.test.ts +5 -4
- package/src/cli/commands/__tests__/upload-sourcemaps.test.ts +4 -7
- package/src/cli/commands/init.ts +6 -4
- package/src/cli/commands/install.ts +13 -116
- package/src/cli/commands/mfe-list.ts +2 -1
- package/src/cli/commands/review/rules/__tests__/no-deprecated-startup-install.test.ts +81 -0
- package/src/cli/commands/review/rules/index.ts +2 -0
- package/src/cli/commands/review/rules/no-deprecated-startup-install.ts +30 -0
- package/src/cli/commands/review/types.ts +1 -0
- package/src/cli/commands/upload-sourcemaps.ts +2 -1
- package/src/cli/utils/__tests__/cli-git.test.ts +4 -140
- package/src/cli/utils/__tests__/cli-npm.test.ts +0 -43
- package/src/cli/utils/__tests__/lerna-exec.test.ts +2 -2
- package/src/cli/utils/cli-git.ts +1 -52
- package/src/cli/utils/cli-npm.ts +0 -12
- package/src/cli/utils/index.ts +0 -1
- package/src/cli/utils/lerna-exec.ts +1 -1
- package/dist/cli/utils/is-ci.d.ts +0 -2
- package/dist/cli/utils/is-ci.d.ts.map +0 -1
- package/dist/cli/utils/is-ci.js +0 -15
- package/dist/cli/utils/is-ci.js.map +0 -1
- package/src/cli/utils/__tests__/is-ci.test.ts +0 -40
- package/src/cli/utils/is-ci.ts +0 -3
|
@@ -9,78 +9,19 @@ function _export(target, all) {
|
|
|
9
9
|
});
|
|
10
10
|
}
|
|
11
11
|
_export(exports, {
|
|
12
|
-
get gitCloneRepo () {
|
|
13
|
-
return gitCloneRepo;
|
|
14
|
-
},
|
|
15
12
|
get gitGetBranch () {
|
|
16
13
|
return gitGetBranch;
|
|
17
14
|
},
|
|
18
15
|
get gitGetCommitHash () {
|
|
19
16
|
return gitGetCommitHash;
|
|
20
|
-
},
|
|
21
|
-
get gitIsReachable () {
|
|
22
|
-
return gitIsReachable;
|
|
23
17
|
}
|
|
24
18
|
});
|
|
25
|
-
const _utils = require("../../utils");
|
|
26
19
|
const _clios = require("./cli-os");
|
|
27
|
-
const _isci = require("./is-ci");
|
|
28
20
|
function gitGetBranch() {
|
|
29
21
|
return (0, _clios.runCommandOutput)('git rev-parse --abbrev-ref HEAD').trim();
|
|
30
22
|
}
|
|
31
23
|
function gitGetCommitHash() {
|
|
32
24
|
return (0, _clios.runCommandOutput)('git rev-parse --short HEAD').trim();
|
|
33
25
|
}
|
|
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
|
-
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
48
|
-
env: {
|
|
49
|
-
...process.env,
|
|
50
|
-
GIT_TERMINAL_PROMPT: '0'
|
|
51
|
-
}
|
|
52
|
-
});
|
|
53
|
-
return true;
|
|
54
|
-
} catch (e) {
|
|
55
|
-
// ignore error
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
return false;
|
|
59
|
-
}
|
|
60
|
-
function gitIsReachable({ owner = 'servicetitan', name }) {
|
|
61
|
-
return getGitUrls({
|
|
62
|
-
owner,
|
|
63
|
-
name
|
|
64
|
-
}).some((url)=>{
|
|
65
|
-
try {
|
|
66
|
-
(0, _clios.runCommandOutput)(`git ls-remote -qt ${url}`, {
|
|
67
|
-
quiet: true
|
|
68
|
-
});
|
|
69
|
-
return true;
|
|
70
|
-
} catch (e) {
|
|
71
|
-
return false;
|
|
72
|
-
}
|
|
73
|
-
});
|
|
74
|
-
}
|
|
75
|
-
function getGitUrls({ owner, name }) {
|
|
76
|
-
const webUrl = `https://github.com/${owner}/${name}.git`;
|
|
77
|
-
const sshUrl = `git@github.com:${owner}/${name}.git`;
|
|
78
|
-
return (0, _isci.isCI)() && !!process.env.GITHUB_TOKEN ? [
|
|
79
|
-
webUrl.replace('github.com', `oauth2:${process.env.GITHUB_TOKEN}@github.com`)
|
|
80
|
-
] : [
|
|
81
|
-
sshUrl,
|
|
82
|
-
webUrl
|
|
83
|
-
];
|
|
84
|
-
}
|
|
85
26
|
|
|
86
27
|
//# sourceMappingURL=cli-git.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/cli/utils/cli-git.ts"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"sources":["../../../src/cli/utils/cli-git.ts"],"sourcesContent":["import { runCommandOutput } from './cli-os';\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"],"names":["gitGetBranch","gitGetCommitHash","runCommandOutput","trim"],"mappings":";;;;;;;;;;;QAEgBA;eAAAA;;QAIAC;eAAAA;;;uBANiB;AAE1B,SAASD;IACZ,OAAOE,IAAAA,uBAAgB,EAAC,mCAAmCC,IAAI;AACnE;AAEO,SAASF;IACZ,OAAOC,IAAAA,uBAAgB,EAAC,8BAA8BC,IAAI;AAC9D"}
|
|
@@ -28,7 +28,4 @@ export declare function npmView({ packageName, registry }: {
|
|
|
28
28
|
packageName: string;
|
|
29
29
|
registry?: string;
|
|
30
30
|
}): NPMPackageInfo | undefined;
|
|
31
|
-
export declare function npmWhoAmI({ registry }?: {
|
|
32
|
-
registry?: string;
|
|
33
|
-
}): string | undefined;
|
|
34
31
|
//# sourceMappingURL=cli-npm.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli-npm.d.ts","sourceRoot":"","sources":["../../../src/cli/utils/cli-npm.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,OAAO;IACpB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,IAAI,CAAC;IACX,GAAG,CAAC,EAAE,MAAM,CAAC;CAChB;AAID,wBAAgB,qBAAqB,CAAC,QAAQ,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,GAAG,MAAM,EAAE,CAWrF;AAED,wBAAgB,4BAA4B,CAAC,QAAQ,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,GAAG,OAAO,EAAE,CAmB7F;AAED,wBAAsB,YAAY,CAAC,QAAQ,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,iBAI/F;AAED,wBAAsB,UAAU,CAAC,EAAE,GAAG,EAAE,GAAG,EAAE,EAAE;IAAE,GAAG,CAAC,EAAE,OAAO,CAAC;IAAC,GAAG,CAAC,EAAE,MAAM,CAAA;CAAE,iBAE7E;AAED,wBAAsB,aAAa,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,iBAE7D;AAED,wBAAsB,aAAa,CAAC,EAChC,WAAW,EACX,cAAc,EACd,QAAQ,EACR,GAAG,GACN,EAAE;IACC,WAAW,EAAE,MAAM,CAAC;IACpB,cAAc,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,GAAG,EAAE,MAAM,CAAC;CACf,iBAMA;AAED,MAAM,WAAW,cAAc;IAC3B,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACrC,MAAM,CAAC,EAAE,MAAM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CAAC;IACf,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACrC,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAChC,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;CACzB;AAED,wBAAgB,OAAO,CAAC,EAAE,WAAW,EAAE,QAAQ,EAAE,EAAE;IAAE,WAAW,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,EAAE,MAAM,CAAA;CAAE,8BAY5F"}
|
|
@@ -29,9 +29,6 @@ _export(exports, {
|
|
|
29
29
|
},
|
|
30
30
|
get npmView () {
|
|
31
31
|
return npmView;
|
|
32
|
-
},
|
|
33
|
-
get npmWhoAmI () {
|
|
34
|
-
return npmWhoAmI;
|
|
35
32
|
}
|
|
36
33
|
});
|
|
37
34
|
const _clios = require("./cli-os");
|
|
@@ -107,24 +104,5 @@ function npmView({ packageName, registry }) {
|
|
|
107
104
|
// ignore
|
|
108
105
|
}
|
|
109
106
|
}
|
|
110
|
-
function npmWhoAmI({ registry } = {}) {
|
|
111
|
-
try {
|
|
112
|
-
return (0, _clios.runCommandOutput)([
|
|
113
|
-
'npm',
|
|
114
|
-
'whoami',
|
|
115
|
-
registry ? `--registry=${registry}` : ''
|
|
116
|
-
], {
|
|
117
|
-
quiet: true,
|
|
118
|
-
stdio: [
|
|
119
|
-
'pipe',
|
|
120
|
-
'pipe',
|
|
121
|
-
'ignore'
|
|
122
|
-
],
|
|
123
|
-
timeout: NPM_TIMEOUT
|
|
124
|
-
}).trim();
|
|
125
|
-
} catch (e) {
|
|
126
|
-
// ignore
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
107
|
|
|
130
108
|
//# sourceMappingURL=cli-npm.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/cli/utils/cli-npm.ts"],"sourcesContent":["import { runCommand, runCommandOutput } from './cli-os';\n\nexport interface Version {\n name: string;\n date: Date;\n tag?: string;\n}\n\nconst NPM_TIMEOUT = 10000;\n\nexport function npmGetPackageVersions(registry: string, packageName: string): string[] {\n try {\n const v = runCommandOutput(\n `npm show ${packageName} versions --registry ${registry} --json`,\n { timeout: NPM_TIMEOUT }\n );\n\n return JSON.parse(v);\n } catch {\n return [];\n }\n}\n\nexport function npmGetPackageVersionsDetails(registry: string, packageName: string): Version[] {\n try {\n const result = runCommandOutput(\n `npm view ${packageName} time dist-tags --registry ${registry} --json`,\n { timeout: NPM_TIMEOUT }\n );\n\n const { time, 'dist-tags': distTags } = JSON.parse(result);\n\n const tags = Object.fromEntries(\n Object.entries(distTags).map(([tag, version]) => [version, tag])\n );\n\n return Object.keys(time).reduce((out, version) => {\n return [...out, { name: version, date: new Date(time[version]), tag: tags[version] }];\n }, []);\n } catch {\n return [];\n }\n}\n\nexport async function npmUnpublish(registry: string, packageName: string, packageVersion: string) {\n await runCommand(`npm unpublish ${packageName}@${packageVersion} --registry ${registry}`, {\n timeout: NPM_TIMEOUT,\n });\n}\n\nexport async function npmPublish({ dry, tag }: { dry?: boolean; tag?: string }) {\n await runCommand(['npm publish', !!tag && `--tag ${tag}`, !!dry && `--dry-run`]);\n}\n\nexport async function npmPackageSet(key: string, value: string) {\n await runCommand(`npm pkg set ${key}=${value}`);\n}\n\nexport async function npmTagVersion({\n packageName,\n packageVersion,\n registry,\n tag,\n}: {\n packageName: string;\n packageVersion: string;\n registry?: string;\n tag: string;\n}) {\n await runCommand(\n `npm dist-tag ${\n registry ? `--registry=${registry} ` : ''\n }add ${packageName}@${packageVersion} ${tag}`\n );\n}\n\nexport interface NPMPackageInfo {\n 'name': string;\n 'version': string;\n 'dist-tags'?: Record<string, string>;\n 'time'?: Record<string, string>;\n 'versions'?: string[];\n}\n\nexport function npmView({ packageName, registry }: { packageName: string; registry?: string }) {\n try {\n const result = runCommandOutput(\n ['npm', 'view', '--json', registry ? `--registry=${registry}` : '', packageName],\n { quiet: true, timeout: NPM_TIMEOUT }\n );\n if (result) {\n return JSON.parse(result) as NPMPackageInfo;\n }\n } catch {\n // ignore\n }\n}\n
|
|
1
|
+
{"version":3,"sources":["../../../src/cli/utils/cli-npm.ts"],"sourcesContent":["import { runCommand, runCommandOutput } from './cli-os';\n\nexport interface Version {\n name: string;\n date: Date;\n tag?: string;\n}\n\nconst NPM_TIMEOUT = 10000;\n\nexport function npmGetPackageVersions(registry: string, packageName: string): string[] {\n try {\n const v = runCommandOutput(\n `npm show ${packageName} versions --registry ${registry} --json`,\n { timeout: NPM_TIMEOUT }\n );\n\n return JSON.parse(v);\n } catch {\n return [];\n }\n}\n\nexport function npmGetPackageVersionsDetails(registry: string, packageName: string): Version[] {\n try {\n const result = runCommandOutput(\n `npm view ${packageName} time dist-tags --registry ${registry} --json`,\n { timeout: NPM_TIMEOUT }\n );\n\n const { time, 'dist-tags': distTags } = JSON.parse(result);\n\n const tags = Object.fromEntries(\n Object.entries(distTags).map(([tag, version]) => [version, tag])\n );\n\n return Object.keys(time).reduce((out, version) => {\n return [...out, { name: version, date: new Date(time[version]), tag: tags[version] }];\n }, []);\n } catch {\n return [];\n }\n}\n\nexport async function npmUnpublish(registry: string, packageName: string, packageVersion: string) {\n await runCommand(`npm unpublish ${packageName}@${packageVersion} --registry ${registry}`, {\n timeout: NPM_TIMEOUT,\n });\n}\n\nexport async function npmPublish({ dry, tag }: { dry?: boolean; tag?: string }) {\n await runCommand(['npm publish', !!tag && `--tag ${tag}`, !!dry && `--dry-run`]);\n}\n\nexport async function npmPackageSet(key: string, value: string) {\n await runCommand(`npm pkg set ${key}=${value}`);\n}\n\nexport async function npmTagVersion({\n packageName,\n packageVersion,\n registry,\n tag,\n}: {\n packageName: string;\n packageVersion: string;\n registry?: string;\n tag: string;\n}) {\n await runCommand(\n `npm dist-tag ${\n registry ? `--registry=${registry} ` : ''\n }add ${packageName}@${packageVersion} ${tag}`\n );\n}\n\nexport interface NPMPackageInfo {\n 'name': string;\n 'version': string;\n 'dist-tags'?: Record<string, string>;\n 'time'?: Record<string, string>;\n 'versions'?: string[];\n}\n\nexport function npmView({ packageName, registry }: { packageName: string; registry?: string }) {\n try {\n const result = runCommandOutput(\n ['npm', 'view', '--json', registry ? `--registry=${registry}` : '', packageName],\n { quiet: true, timeout: NPM_TIMEOUT }\n );\n if (result) {\n return JSON.parse(result) as NPMPackageInfo;\n }\n } catch {\n // ignore\n }\n}\n"],"names":["npmGetPackageVersions","npmGetPackageVersionsDetails","npmPackageSet","npmPublish","npmTagVersion","npmUnpublish","npmView","NPM_TIMEOUT","registry","packageName","v","runCommandOutput","timeout","JSON","parse","result","time","distTags","tags","Object","fromEntries","entries","map","tag","version","keys","reduce","out","name","date","Date","packageVersion","runCommand","dry","key","value","quiet"],"mappings":";;;;;;;;;;;QAUgBA;eAAAA;;QAaAC;eAAAA;;QA+BMC;eAAAA;;QAJAC;eAAAA;;QAQAC;eAAAA;;QAdAC;eAAAA;;QAwCNC;eAAAA;;;uBApF6B;AAQ7C,MAAMC,cAAc;AAEb,SAASP,sBAAsBQ,QAAgB,EAAEC,WAAmB;IACvE,IAAI;QACA,MAAMC,IAAIC,IAAAA,uBAAgB,EACtB,CAAC,SAAS,EAAEF,YAAY,qBAAqB,EAAED,SAAS,OAAO,CAAC,EAChE;YAAEI,SAASL;QAAY;QAG3B,OAAOM,KAAKC,KAAK,CAACJ;IACtB,EAAE,UAAM;QACJ,OAAO,EAAE;IACb;AACJ;AAEO,SAAST,6BAA6BO,QAAgB,EAAEC,WAAmB;IAC9E,IAAI;QACA,MAAMM,SAASJ,IAAAA,uBAAgB,EAC3B,CAAC,SAAS,EAAEF,YAAY,2BAA2B,EAAED,SAAS,OAAO,CAAC,EACtE;YAAEI,SAASL;QAAY;QAG3B,MAAM,EAAES,IAAI,EAAE,aAAaC,QAAQ,EAAE,GAAGJ,KAAKC,KAAK,CAACC;QAEnD,MAAMG,OAAOC,OAAOC,WAAW,CAC3BD,OAAOE,OAAO,CAACJ,UAAUK,GA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AAUH,WAAW,CAAC,WAAW,EAAEA,UAAU,GAAG;YAAIC;SAAY,EAChF;YAAE2B,OAAO;YAAMxB,SAASL;QAAY;QAExC,IAAIQ,QAAQ;YACR,OAAOF,KAAKC,KAAK,CAACC;QACtB;IACJ,EAAE,UAAM;IACJ,SAAS;IACb;AACJ"}
|
|
@@ -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,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,
|
|
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,uBAAuB,CAAC;AACtC,cAAc,UAAU,CAAC;AACzB,cAAc,cAAc,CAAC;AAC7B,cAAc,2BAA2B,CAAC;AAC1C,cAAc,eAAe,CAAC;AAC9B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,WAAW,CAAC;AAC1B,cAAc,oBAAoB,CAAC;AAEnC,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC;AAC7B,cAAc,gBAAgB,CAAC"}
|
package/dist/cli/utils/index.js
CHANGED
|
@@ -13,7 +13,6 @@ _export_star(require("./compile-sass"), exports);
|
|
|
13
13
|
_export_star(require("./copy-files"), exports);
|
|
14
14
|
_export_star(require("./eslint"), exports);
|
|
15
15
|
_export_star(require("./get-module-type"), exports);
|
|
16
|
-
_export_star(require("./is-ci"), exports);
|
|
17
16
|
_export_star(require("./is-module-installed"), exports);
|
|
18
17
|
_export_star(require("./is-tty"), exports);
|
|
19
18
|
_export_star(require("./lerna-exec"), exports);
|
|
@@ -1 +1 @@
|
|
|
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-
|
|
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-module-installed';\nexport * from './is-tty';\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';\n// Don't export ./stylelint, it breaks tests using the default \"jsdom\" environment\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;qBAEA;qBACA;qBACA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lerna-exec.d.ts","sourceRoot":"","sources":["../../../src/cli/utils/lerna-exec.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"lerna-exec.d.ts","sourceRoot":"","sources":["../../../src/cli/utils/lerna-exec.ts"],"names":[],"mappings":"AACA,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,mCAkBnC"}
|
|
@@ -8,10 +8,10 @@ Object.defineProperty(exports, "lernaExec", {
|
|
|
8
8
|
return lernaExec;
|
|
9
9
|
}
|
|
10
10
|
});
|
|
11
|
+
const _install = require("@servicetitan/install");
|
|
11
12
|
const _execa = /*#__PURE__*/ _interop_require_default(require("execa"));
|
|
12
13
|
const _nodeos = /*#__PURE__*/ _interop_require_default(require("node:os"));
|
|
13
14
|
const _utils = require("../../utils");
|
|
14
|
-
const _isci = require("./is-ci");
|
|
15
15
|
const _maybecreategitfolder = require("./maybe-create-git-folder");
|
|
16
16
|
function _interop_require_default(obj) {
|
|
17
17
|
return obj && obj.__esModule ? obj : {
|
|
@@ -49,7 +49,7 @@ function getOptions(args) {
|
|
|
49
49
|
result.push('--no-bail');
|
|
50
50
|
}
|
|
51
51
|
if (args.parallel === true) {
|
|
52
|
-
result.push((0,
|
|
52
|
+
result.push((0, _install.isCI)() ? `--concurrency=${_nodeos.default.availableParallelism()}` : '--parallel');
|
|
53
53
|
} else if (typeof args.parallel === 'number') {
|
|
54
54
|
result.push(`--concurrency=${args.parallel}`);
|
|
55
55
|
}
|
|
@@ -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 {
|
|
1
|
+
{"version":3,"sources":["../../../src/cli/utils/lerna-exec.ts"],"sourcesContent":["import { isCI } from '@servicetitan/install';\nimport execa, { StdioOption } from 'execa';\nimport os from 'node:os';\n\nimport { log } from '../../utils';\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;;;e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B,KAAKyB,MAAM,EAAE;QACbV,OAAOK,IAAI,CAAC;IAChB;IACA,OAAOL;AACX"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@servicetitan/startup",
|
|
3
|
-
"version": "32.
|
|
3
|
+
"version": "32.5.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"homepage": "https://docs.st.dev/docs/frontend/startup",
|
|
6
6
|
"repository": {
|
|
@@ -38,8 +38,9 @@
|
|
|
38
38
|
"@jest/core": "~29.7.0",
|
|
39
39
|
"@jest/types": "~29.6.3",
|
|
40
40
|
"@jsdevtools/coverage-istanbul-loader": "^3.0.5",
|
|
41
|
-
"@servicetitan/eslint-config": "32.
|
|
42
|
-
"@servicetitan/
|
|
41
|
+
"@servicetitan/eslint-config": "32.5.0",
|
|
42
|
+
"@servicetitan/install": "32.5.0",
|
|
43
|
+
"@servicetitan/stylelint-config": "32.5.0",
|
|
43
44
|
"@svgr/webpack": "^8.1.0",
|
|
44
45
|
"@swc/cli": "^0.5.0",
|
|
45
46
|
"@swc/core": "1.13.5",
|
|
@@ -53,7 +54,7 @@
|
|
|
53
54
|
"debounce": "^2.2.0",
|
|
54
55
|
"debug": "^4.4.3",
|
|
55
56
|
"deepmerge": "~4.3.1",
|
|
56
|
-
"eslint": "~9.
|
|
57
|
+
"eslint": "~9.39.1",
|
|
57
58
|
"execa": "~5.1.1",
|
|
58
59
|
"glob": "~11.0.3",
|
|
59
60
|
"html-webpack-plugin": "~5.6.4",
|
|
@@ -77,7 +78,6 @@
|
|
|
77
78
|
"portfinder": "~1.0.38",
|
|
78
79
|
"postcss": "~8.5.6",
|
|
79
80
|
"prettier": "~3.6.2",
|
|
80
|
-
"rollup": "~4.49.0",
|
|
81
81
|
"sass": "~1.93.3",
|
|
82
82
|
"sass-loader": "~16.0.6",
|
|
83
83
|
"semver": "~7.7.3",
|
|
@@ -119,8 +119,7 @@
|
|
|
119
119
|
"jwa": [
|
|
120
120
|
"@progress/kendo-licensing@1.3.5 -> jsonwebtoken@9.0.2 -> jws@3.2.2 -> jwa@1.4.1",
|
|
121
121
|
"Forcing ^1.4.2 to fix Node v25 incompatibility in 1.4.1 (see https://github.com/auth0/node-jsonwebtoken/issues/992)"
|
|
122
|
-
]
|
|
123
|
-
"rollup": "Update/remove when https://github.com/rollup/rollup/issues/6168 is resolved"
|
|
122
|
+
]
|
|
124
123
|
},
|
|
125
124
|
"publishConfig": {
|
|
126
125
|
"access": "public"
|
|
@@ -128,5 +127,5 @@
|
|
|
128
127
|
"cli": {
|
|
129
128
|
"webpack": false
|
|
130
129
|
},
|
|
131
|
-
"gitHead": "
|
|
130
|
+
"gitHead": "9ba97491f520e7b5914179aa061d1c3c3285079d"
|
|
132
131
|
}
|
|
@@ -1,16 +1,13 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
1
|
+
import { gitCloneRepo, gitIsReachable } from '@servicetitan/install';
|
|
2
|
+
import fs from 'fs';
|
|
3
|
+
import { vol } from 'memfs';
|
|
3
4
|
import path from 'path';
|
|
4
5
|
|
|
5
6
|
import { log } from '../../../utils';
|
|
6
|
-
import { gitCloneRepo, gitIsReachable } from '../../utils';
|
|
7
7
|
import { Init } from '../init';
|
|
8
8
|
|
|
9
|
-
jest.mock('
|
|
10
|
-
jest.mock('
|
|
11
|
-
gitCloneRepo: jest.fn(),
|
|
12
|
-
gitIsReachable: jest.fn(),
|
|
13
|
-
}));
|
|
9
|
+
jest.mock('@servicetitan/install');
|
|
10
|
+
jest.mock('fs', () => require('memfs').fs);
|
|
14
11
|
jest.mock('../../../utils', () => ({
|
|
15
12
|
log: { debug: jest.fn(), error: jest.fn(), info: jest.fn() },
|
|
16
13
|
}));
|
|
@@ -21,7 +18,7 @@ describe(`[startup] ${Init.name}`, () => {
|
|
|
21
18
|
beforeEach(() => {
|
|
22
19
|
args = {};
|
|
23
20
|
vol.reset();
|
|
24
|
-
jest.mocked(gitCloneRepo).
|
|
21
|
+
jest.mocked(gitCloneRepo).mockReturnValue(true);
|
|
25
22
|
jest.spyOn(fs, 'mkdirSync').mockImplementation(jest.fn());
|
|
26
23
|
jest.spyOn(fs, 'rmSync').mockImplementation(jest.fn());
|
|
27
24
|
jest.spyOn(log, 'error').mockImplementation(jest.fn()); // suppress error output
|
|
@@ -34,16 +31,16 @@ describe(`[startup] ${Init.name}`, () => {
|
|
|
34
31
|
await subject();
|
|
35
32
|
|
|
36
33
|
expect(gitCloneRepo).toHaveBeenCalledWith({ destination: cwd, name: 'frontend-example' });
|
|
37
|
-
expect(rmSync).toHaveBeenCalledWith(path.join(cwd, '.git'), {
|
|
34
|
+
expect(fs.rmSync).toHaveBeenCalledWith(path.join(cwd, '.git'), {
|
|
38
35
|
recursive: true,
|
|
39
36
|
force: true,
|
|
40
37
|
});
|
|
41
|
-
expect(rmSync).toHaveBeenCalledWith(path.join(cwd, '.github', 'CODEOWNERS'));
|
|
42
|
-
expect(rmSync).toHaveBeenCalledWith(path.join(cwd, 'package-lock.json'));
|
|
38
|
+
expect(fs.rmSync).toHaveBeenCalledWith(path.join(cwd, '.github', 'CODEOWNERS'));
|
|
39
|
+
expect(fs.rmSync).toHaveBeenCalledWith(path.join(cwd, 'package-lock.json'));
|
|
43
40
|
});
|
|
44
41
|
|
|
45
42
|
describe('when cloning fails', () => {
|
|
46
|
-
beforeEach(() => jest.mocked(gitCloneRepo).
|
|
43
|
+
beforeEach(() => jest.mocked(gitCloneRepo).mockReturnValue(false));
|
|
47
44
|
|
|
48
45
|
describe('when repo is not reachable', () => {
|
|
49
46
|
beforeEach(() => {
|
|
@@ -66,7 +63,7 @@ describe(`[startup] ${Init.name}`, () => {
|
|
|
66
63
|
|
|
67
64
|
await subject();
|
|
68
65
|
|
|
69
|
-
expect(mkdirSync).toHaveBeenCalledWith(destination, { recursive: true });
|
|
66
|
+
expect(fs.mkdirSync).toHaveBeenCalledWith(destination, { recursive: true });
|
|
70
67
|
expect(gitCloneRepo).toHaveBeenCalledWith(expect.objectContaining({ destination }));
|
|
71
68
|
});
|
|
72
69
|
|