@servicetitan/startup 31.6.0 → 32.0.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/commands/init.d.ts +2 -1
- package/dist/cli/commands/init.d.ts.map +1 -1
- package/dist/cli/commands/init.js +24 -43
- package/dist/cli/commands/init.js.map +1 -1
- package/dist/cli/commands/install.d.ts +4 -0
- package/dist/cli/commands/install.d.ts.map +1 -1
- package/dist/cli/commands/install.js +91 -3
- package/dist/cli/commands/install.js.map +1 -1
- package/dist/cli/commands/mfe-package-clean.d.ts.map +1 -1
- package/dist/cli/commands/mfe-package-clean.js +5 -7
- package/dist/cli/commands/mfe-package-clean.js.map +1 -1
- package/dist/cli/commands/mfe-package-publish.d.ts.map +1 -1
- package/dist/cli/commands/mfe-package-publish.js +11 -15
- package/dist/cli/commands/mfe-package-publish.js.map +1 -1
- package/dist/cli/commands/upload-sourcemaps.d.ts.map +1 -1
- package/dist/cli/commands/upload-sourcemaps.js +1 -1
- package/dist/cli/commands/upload-sourcemaps.js.map +1 -1
- package/dist/cli/index.js +1 -2
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/utils/cli-git.d.ts +11 -2
- package/dist/cli/utils/cli-git.d.ts.map +1 -1
- package/dist/cli/utils/cli-git.js +60 -4
- package/dist/cli/utils/cli-git.js.map +1 -1
- package/dist/cli/utils/cli-os.d.ts.map +1 -1
- package/dist/cli/utils/cli-os.js +3 -0
- package/dist/cli/utils/cli-os.js.map +1 -1
- package/dist/cli/utils/index.d.ts +6 -0
- package/dist/cli/utils/index.d.ts.map +1 -1
- package/dist/cli/utils/index.js +6 -0
- package/dist/cli/utils/index.js.map +1 -1
- package/dist/cli/utils/is-ci.d.ts +2 -0
- package/dist/cli/utils/is-ci.d.ts.map +1 -0
- package/dist/cli/utils/is-ci.js +15 -0
- package/dist/cli/utils/is-ci.js.map +1 -0
- package/dist/cli/utils/lerna-exec.d.ts.map +1 -1
- package/dist/cli/utils/lerna-exec.js +2 -1
- package/dist/cli/utils/lerna-exec.js.map +1 -1
- package/dist/utils/get-branch-configs.d.ts +1 -1
- package/dist/utils/get-branch-configs.d.ts.map +1 -1
- package/dist/utils/get-branch-configs.js +2 -2
- package/dist/utils/get-branch-configs.js.map +1 -1
- package/dist/utils/index.d.ts +1 -0
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/index.js +1 -0
- package/dist/utils/index.js.map +1 -1
- package/package.json +6 -6
- package/src/cli/commands/__tests__/init.test.ts +21 -87
- package/src/cli/commands/__tests__/install.test.ts +174 -12
- package/src/cli/commands/__tests__/mfe-package-clean.test.ts +3 -6
- package/src/cli/commands/__tests__/mfe-package-publish.test.ts +6 -8
- package/src/cli/commands/__tests__/upload-sourcemaps.test.ts +7 -3
- package/src/cli/commands/init.ts +17 -37
- package/src/cli/commands/install.ts +95 -6
- package/src/cli/commands/mfe-package-clean.ts +2 -4
- package/src/cli/commands/mfe-package-publish.ts +18 -6
- package/src/cli/commands/upload-sourcemaps.ts +2 -2
- package/src/cli/index.ts +1 -2
- package/src/cli/utils/__tests__/cli-git.test.ts +142 -6
- package/src/cli/utils/__tests__/eslint.test.ts +3 -2
- package/src/cli/utils/__tests__/is-ci.test.ts +40 -0
- package/src/cli/utils/__tests__/lerna-exec.test.ts +6 -3
- package/src/cli/utils/cli-git.ts +55 -5
- package/src/cli/utils/cli-os.ts +4 -1
- package/src/cli/utils/index.ts +6 -0
- package/src/cli/utils/is-ci.ts +3 -0
- package/src/cli/utils/lerna-exec.ts +2 -1
- package/src/utils/get-branch-configs.ts +1 -1
- 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 {
|
|
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,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,CAACC,IAAAA,YAAI,KAAI;gBACT,MAAM,IAAIC,MAAMF;YACpB;YACAG,UAAG,CAACC,OAAO,CAAC,GAAGJ,QAAQ,qBAAqB,CAAC;YAC7C,OAAO;QACX;QAEA,IAAI,CAAC,IAAI,CAACK,IAA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AC;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,
|
|
31
|
+
(0, _utils1.maybeCreateGitFolder)(Command);
|
|
33
32
|
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
34
33
|
const command = new Command({
|
|
35
34
|
...argvSync,
|
package/dist/cli/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/cli/index.ts"],"sourcesContent":["import execa from 'execa';\nimport path from 'path';\nimport { argv, Arguments } from 'yargs';\nimport { CommandName, getStartupVersion, log } from '../utils';\nimport { getCommand, getUserCommands } from './commands';\nimport { setNodeOptions } from './utils';\
|
|
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 { 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
|
|
2
|
-
export declare
|
|
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":"
|
|
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
|
|
27
|
+
const _isci = require("./is-ci");
|
|
28
|
+
function gitGetBranch() {
|
|
21
29
|
return (0, _clios.runCommandOutput)('git rev-parse --abbrev-ref HEAD').trim();
|
|
22
|
-
}
|
|
23
|
-
|
|
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
|
|
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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,CAAC;IAEpD,MAAMa,OAAO;QAACF;QAAQC;KAAO;IAC7B,IAAIE,IAAAA,UAAI,OAAM,CAAC,CAACC,QAAQC,GAAG,CAACC,YAAY,EAAE;QACtCJ,KAAKK,OAAO,CAACP,OAAOQ,OAAO,CAAC,cAAc,CAAC,OAAO,EAAEJ,QAAQC,GAAG,CAACC,YAAY,CAAC,WAAW,CAAC;IAC7F;IAEA,OAAOJ;AACX"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli-os.d.ts","sourceRoot":"","sources":["../../../src/cli/utils/cli-os.ts"],"names":[],"mappings":"AAAA,OAAO,EAEH,iCAAiC,EAEjC,wBAAwB,EAC3B,MAAM,eAAe,CAAC;AAGvB,KAAK,iBAAiB,GAAG,wBAAwB,GAAG;IAAE,KAAK,CAAC,EAAE,OAAO,CAAA;CAAE,CAAC;AAExE,eAAO,MAAM,UAAU,GACnB,SAAS,MAAM,GAAG,CAAC,MAAM,GAAG,KAAK,CAAC,EAAE,EACpC,6BAA4B,iBAAsB,KACnD,OAAO,CAAC,IAAI,
|
|
1
|
+
{"version":3,"file":"cli-os.d.ts","sourceRoot":"","sources":["../../../src/cli/utils/cli-os.ts"],"names":[],"mappings":"AAAA,OAAO,EAEH,iCAAiC,EAEjC,wBAAwB,EAC3B,MAAM,eAAe,CAAC;AAGvB,KAAK,iBAAiB,GAAG,wBAAwB,GAAG;IAAE,KAAK,CAAC,EAAE,OAAO,CAAA;CAAE,CAAC;AAExE,eAAO,MAAM,UAAU,GACnB,SAAS,MAAM,GAAG,CAAC,MAAM,GAAG,KAAK,CAAC,EAAE,EACpC,6BAA4B,iBAAsB,KACnD,OAAO,CAAC,IAAI,CA8Cd,CAAC;AAEF,KAAK,uBAAuB,GAAG,iCAAiC,GAAG;IAAE,KAAK,CAAC,EAAE,OAAO,CAAA;CAAE,CAAC;AAEvF,eAAO,MAAM,gBAAgB,GACzB,SAAS,MAAM,GAAG,CAAC,MAAM,GAAG,KAAK,CAAC,EAAE,EACpC,gCAA+B,uBAA4B,KAC5D,MA2BF,CAAC"}
|
package/dist/cli/utils/cli-os.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/cli/utils/cli-os.ts"],"sourcesContent":["import {\n execSync,\n ExecSyncOptionsWithBufferEncoding,\n spawn,\n SpawnOptionsWithoutStdio,\n} from 'child_process';\nimport { log } from '../../utils';\n\ntype RunCommandOptions = SpawnOptionsWithoutStdio & { quiet?: boolean };\n\nexport const runCommand = (\n command: string | (string | false)[],\n { quiet, ...spawnOptions }: RunCommandOptions = {}\n): Promise<void> => {\n return new Promise((resolve, reject) => {\n const commandArray: string[] = Array.isArray(command)\n ? command\n .filter(c => !!c)\n .map(c => c.toString())\n .join(' ')\n .split(' ')\n : command.split(' ');\n const fullCommand = commandArray.join(' ');\n\n const commandName = commandArray.shift();\n\n if (!commandName) {\n reject(new Error('invalid command'));\n\n return;\n }\n\n if (!quiet) {\n log.info(`Running: ${fullCommand}`);\n }\n\n const proc = spawn(commandName, commandArray, {\n shell: process.platform === 'win32',\n ...spawnOptions,\n });\n\n proc.stdout.pipe(process.stdout);\n proc.stderr.pipe(process.stderr);\n\n proc.on('exit', function (code
|
|
1
|
+
{"version":3,"sources":["../../../src/cli/utils/cli-os.ts"],"sourcesContent":["import {\n execSync,\n ExecSyncOptionsWithBufferEncoding,\n spawn,\n SpawnOptionsWithoutStdio,\n} from 'child_process';\nimport { log } from '../../utils';\n\ntype RunCommandOptions = SpawnOptionsWithoutStdio & { quiet?: boolean };\n\nexport const runCommand = (\n command: string | (string | false)[],\n { quiet, ...spawnOptions }: RunCommandOptions = {}\n): Promise<void> => {\n return new Promise((resolve, reject) => {\n const commandArray: string[] = Array.isArray(command)\n ? command\n .filter(c => !!c)\n .map(c => c.toString())\n .join(' ')\n .split(' ')\n : command.split(' ');\n const fullCommand = commandArray.join(' ');\n\n const commandName = commandArray.shift();\n\n if (!commandName) {\n reject(new Error('invalid command'));\n\n return;\n }\n\n if (!quiet) {\n log.info(`Running: ${fullCommand}`);\n }\n\n const proc = spawn(commandName, commandArray, {\n shell: process.platform === 'win32',\n ...spawnOptions,\n });\n\n proc.stdout.pipe(process.stdout);\n proc.stderr.pipe(process.stderr);\n\n proc.on('exit', function (code) {\n if (!quiet) {\n log.info(`command finished with code ${code}`, fullCommand);\n }\n\n if (code) {\n reject(new Error(`command exited with code: ${code}`));\n } else {\n resolve();\n }\n });\n proc.on('error', function (e) {\n reject(e);\n });\n });\n};\n\ntype RunCommandOutputOptions = ExecSyncOptionsWithBufferEncoding & { quiet?: boolean };\n\nexport const runCommandOutput = (\n command: string | (string | false)[],\n { quiet, ...execSyncOptions }: RunCommandOutputOptions = {}\n): string => {\n const commandArray: string[] = Array.isArray(command)\n ? command\n .filter(c => !!c)\n .map(c => c.toString())\n .join(' ')\n .split(' ')\n : command.split(' ');\n const fullCommand = commandArray.join(' ');\n\n const commandName = commandArray.shift();\n\n if (!commandName) {\n throw new Error();\n }\n\n if (!quiet) {\n log.info(`Running: ${fullCommand}`);\n }\n\n const result = execSync(fullCommand, execSyncOptions).toString();\n\n if (!quiet) {\n log.info('command finished', result);\n }\n\n return result;\n};\n"],"names":["runCommand","runCommandOutput","command","quiet","spawnOptions","Promise","resolve","reject","commandArray","Array","isArray","filter","c","map","toString","join","split","fullCommand","commandName","shift","Error","log","info","proc","spawn","shell","process","platform","stdout","pipe","stderr","on","code","e","execSyncOptions","result","execSync"],"mappings":";;;;;;;;;;;QAUaA;eAAAA;;QAqDAC;eAAAA;;;+BA1DN;uBACa;AAIb,MAAMD,aAAa,CACtBE,SACA,EAAEC,KAAK,EAAE,GAAGC,cAAiC,GAAG,CAAC,CAAC;IAElD,OAAO,IAAIC,QAAQ,CAACC,SAASC;QACzB,MAAMC,eAAyBC,MAAMC,OAAO,CAACR,WACvCA,QACKS,MAAM,CAACC,CAAAA,IAAK,CAAC,CAACA,GACdC,GAAG,CAACD,CAAAA,IAAKA,EAAEE,QAAQ,IAC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AACD,aAAa;QACd,MAAM,IAAIE;IACd;IAEA,IAAI,CAACjB,OAAO;QACRkB,UAAG,CAACC,IAAI,CAAC,CAAC,SAAS,EAAEL,aAAa;IACtC;IAEA,MAAMkB,SAASC,IAAAA,uBAAQ,EAACnB,aAAaiB,iBAAiBpB,QAAQ;IAE9D,IAAI,CAACX,OAAO;QACRkB,UAAG,CAACC,IAAI,CAAC,oBAAoBa;IACjC;IAEA,OAAOA;AACX"}
|
|
@@ -1,15 +1,21 @@
|
|
|
1
1
|
export * from './bundle';
|
|
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"}
|
package/dist/cli/utils/index.js
CHANGED
|
@@ -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 @@
|
|
|
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;
|
|
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(
|
|
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(
|
|
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 +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,
|
|
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
|
|
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,
|
|
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 './
|
|
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"}
|
package/dist/utils/index.d.ts
CHANGED
|
@@ -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"}
|
package/dist/utils/index.js
CHANGED
|
@@ -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);
|
package/dist/utils/index.js.map
CHANGED
|
@@ -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": "
|
|
3
|
+
"version": "32.0.1",
|
|
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": "
|
|
41
|
-
"@servicetitan/stylelint-config": "
|
|
40
|
+
"@servicetitan/eslint-config": "32.0.1",
|
|
41
|
+
"@servicetitan/stylelint-config": "32.0.1",
|
|
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.
|
|
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.
|
|
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": "
|
|
123
|
+
"gitHead": "2b74dd72d39c2023151699d1cf7a6e6130d64279"
|
|
124
124
|
}
|