@xylabs/ts-scripts-yarn3 6.5.12 → 6.5.13
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/actions/build.mjs +5 -5
- package/dist/actions/build.mjs.map +1 -1
- package/dist/actions/index.mjs +5 -5
- package/dist/actions/index.mjs.map +1 -1
- package/dist/bin/xy.mjs +5 -5
- package/dist/bin/xy.mjs.map +1 -1
- package/dist/index.mjs +5 -5
- package/dist/index.mjs.map +1 -1
- package/dist/xy/index.mjs +5 -5
- package/dist/xy/index.mjs.map +1 -1
- package/dist/xy/xy.mjs +5 -5
- package/dist/xy/xy.mjs.map +1 -1
- package/dist/xy/xyBuildCommands.mjs +5 -5
- package/dist/xy/xyBuildCommands.mjs.map +1 -1
- package/package.json +9 -9
package/dist/actions/build.mjs
CHANGED
|
@@ -117,18 +117,18 @@ var build = async ({
|
|
|
117
117
|
pkg
|
|
118
118
|
}) => {
|
|
119
119
|
const start = Date.now();
|
|
120
|
-
const pkgOptions = pkg ? [
|
|
120
|
+
const pkgOptions = pkg === void 0 ? [] : [pkg];
|
|
121
121
|
const incrementalOptions = incremental ? ["-i"] : [];
|
|
122
122
|
const verboseOptions = verbose ? ["-v"] : [];
|
|
123
|
-
const targetOptions = target ? ["-t", target]
|
|
124
|
-
const jobsOptions = jobs ? ["-j", `${jobs}`]
|
|
125
|
-
if (jobs) {
|
|
123
|
+
const targetOptions = target === void 0 ? [] : ["-t", target];
|
|
124
|
+
const jobsOptions = jobs === void 0 ? [] : ["-j", `${jobs}`];
|
|
125
|
+
if (jobs !== void 0) {
|
|
126
126
|
console.log(chalk4.blue(`Jobs set to [${jobs}]`));
|
|
127
127
|
}
|
|
128
128
|
const result = await runStepsAsync(`Build${incremental ? "-Incremental" : ""} [${pkg ?? "All"}]`, [
|
|
129
129
|
["yarn", ["xy", "compile", ...pkgOptions, ...targetOptions, ...verboseOptions, ...jobsOptions, ...incrementalOptions, "--types", "tsup"]],
|
|
130
130
|
["yarn", ["xy", "publint", ...pkgOptions, ...verboseOptions, ...jobsOptions, ...incrementalOptions]],
|
|
131
|
-
["yarn", ["xy", "
|
|
131
|
+
["yarn", ["xy", "deplint", ...pkgOptions, ...verboseOptions, ...jobsOptions, ...incrementalOptions]],
|
|
132
132
|
["yarn", ["xy", "lint", ...pkgOptions, ...verboseOptions, ...incrementalOptions]]
|
|
133
133
|
]);
|
|
134
134
|
console.log(`${chalk4.gray("Built in")} [${chalk4.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk4.gray("seconds")}`);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/actions/build.ts","../../src/lib/checkResult.ts","../../src/lib/processEx.ts","../../src/lib/withError.ts","../../src/lib/withErrnoException.ts","../../src/lib/safeExit.ts","../../src/lib/runStepsAsync.ts"],"sourcesContent":["import chalk from 'chalk'\n\nimport { runStepsAsync } from '../lib/index.ts'\n\nexport interface BuildParams {\n incremental?: boolean\n jobs?: number\n pkg?: string\n target?: 'esm' | 'cjs'\n verbose?: boolean\n}\n\nexport const build = async ({\n incremental, jobs, target, verbose, pkg,\n}: BuildParams) => {\n const start = Date.now()\n const pkgOptions = pkg ? [
|
|
1
|
+
{"version":3,"sources":["../../src/actions/build.ts","../../src/lib/checkResult.ts","../../src/lib/processEx.ts","../../src/lib/withError.ts","../../src/lib/withErrnoException.ts","../../src/lib/safeExit.ts","../../src/lib/runStepsAsync.ts"],"sourcesContent":["import chalk from 'chalk'\n\nimport { runStepsAsync } from '../lib/index.ts'\n\nexport interface BuildParams {\n incremental?: boolean\n jobs?: number\n pkg?: string\n target?: 'esm' | 'cjs'\n verbose?: boolean\n}\n\nexport const build = async ({\n incremental, jobs, target, verbose, pkg,\n}: BuildParams) => {\n const start = Date.now()\n const pkgOptions = (pkg === undefined) ? [] : [pkg] // must go first\n const incrementalOptions = incremental ? ['-i'] : []\n const verboseOptions = verbose ? ['-v'] : []\n const targetOptions = (target === undefined) ? [] : ['-t', target]\n const jobsOptions = (jobs === undefined) ? [] : ['-j', `${jobs}`]\n if (jobs !== undefined) {\n console.log(chalk.blue(`Jobs set to [${jobs}]`))\n }\n\n const result = await runStepsAsync(`Build${incremental ? '-Incremental' : ''} [${pkg ?? 'All'}]`, [\n ['yarn', ['xy', 'compile', ...pkgOptions, ...targetOptions, ...verboseOptions, ...jobsOptions, ...incrementalOptions, '--types', 'tsup']],\n ['yarn', ['xy', 'publint', ...pkgOptions, ...verboseOptions, ...jobsOptions, ...incrementalOptions]],\n ['yarn', ['xy', 'deplint', ...pkgOptions, ...verboseOptions, ...jobsOptions, ...incrementalOptions]],\n ['yarn', ['xy', 'lint', ...pkgOptions, ...verboseOptions, ...incrementalOptions]],\n ])\n console.log(`${chalk.gray('Built in')} [${chalk.magenta(((Date.now() - start) / 1000).toFixed(2))}] ${chalk.gray('seconds')}`)\n return result\n}\n","import chalk from 'chalk'\n\nexport const checkResult = (name: string, result: number, level: 'error' | 'warn' = 'error', exitOnFail = false) => {\n if (result) {\n const exiting = exitOnFail ? '[Exiting Process]' : '[Continuing]'\n const chalkFunc = level === 'error' ? chalk.red : chalk.yellow\n console[level](chalkFunc(`${name} had ${result} failures ${exiting}`))\n if (exitOnFail) {\n process.exit(result)\n }\n }\n}\n","import chalk from 'chalk'\n\nimport { withErrnoException } from './withErrnoException.ts'\nimport { withError } from './withError.ts'\n\nexport const processEx = (ex: unknown) => {\n const error = typeof ex === 'string' ? new Error(ex) : ex\n const exitCode\n = withErrnoException(error, (error) => {\n if (error.code === 'ENOENT') {\n console.error(chalk.red(`'${error.path}' not found.`))\n } else {\n console.error(chalk.red(`Errno: ${error.code}`))\n }\n return error.errno ?? -1\n })\n ?? withError(error, (error) => {\n console.error(chalk.red(`${error.name}: ${error.message}`))\n return -1\n })\n ?? (() => {\n console.error(chalk.red(`Unexpected Error: ${JSON.stringify(ex, null, 2)}`))\n return -1\n })()\n // This allows us to use a previously set exit code\n process.exit(process.exitCode ?? exitCode)\n}\n","export const withError = <T extends Error = Error>(\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n ex: any,\n closure: (error: T) => number,\n predicate = (ex: T) => (!!ex.name && !!ex.message),\n) => {\n return predicate(ex as T) ? closure(ex as T) : undefined\n}\n","import { withError } from './withError.ts'\n\nexport const withErrnoException = <T extends NodeJS.ErrnoException = NodeJS.ErrnoException>(\n ex: unknown, closure: (error: T) => number,\n) => {\n return withError<T>(ex, closure, (ex: unknown) => (ex as NodeJS.ErrnoException).errno !== undefined)\n}\n","/** Catch child process a crash and returns the code */\n\nimport { processEx } from './processEx.ts'\n\nconst safeExit = (func: () => number, exitOnFail = true): number => {\n try {\n const result = func()\n if (result && exitOnFail) {\n process.exit(result)\n }\n return result\n } catch (ex) {\n return processEx(ex)\n }\n}\n\nconst safeExitAsync = async (func: () => Promise<number>, exitOnFail = true): Promise<number> => {\n try {\n const result = await func()\n if (result && exitOnFail) {\n process.exit(result)\n }\n return result\n } catch (ex) {\n return processEx(ex)\n }\n}\n\nexport { safeExit, safeExitAsync }\n","import { spawn } from 'node:child_process'\nimport { existsSync } from 'node:fs'\n\nimport chalk from 'chalk'\n\nimport { checkResult } from './checkResult.ts'\nimport type { ScriptStep } from './runSteps.ts'\nimport { safeExitAsync } from './safeExit.ts'\n\nexport const runStepAsync = (name: string, step: ScriptStep, exitOnFail = true, message?: string) => {\n return new Promise<number>((resolve) => {\n const [command, args, config] = step\n if (message) {\n console.log(chalk.gray(message))\n }\n const argList = Array.isArray(args) ? args : args.split(' ')\n if (command === 'node' && !existsSync(argList[0])) {\n throw new Error(`File not found [${argList[0]}]`)\n }\n spawn(command, Array.isArray(args) ? args : args.split(' '), {\n ...config,\n env: { FORCE_COLOR: '3', ...process.env },\n shell: true,\n stdio: 'inherit',\n }).on('close', (code) => {\n if (code) {\n console.error(\n chalk.red(\n `Command Exited With Non-Zero Result [${chalk.gray(code)}] | ${chalk.yellow(command)} ${chalk.white(\n Array.isArray(args) ? args.join(' ') : args,\n )}`,\n ),\n )\n checkResult(name, code, 'error', exitOnFail)\n resolve(code)\n } else {\n resolve(0)\n }\n })\n })\n}\n\nexport const runStepsAsync = async (name: string, steps: ScriptStep[], exitOnFail = true, messages?: string[]) => {\n return await safeExitAsync(async () => {\n const pkgName = process.env.npm_package_name\n console.log(chalk.green(`${name} [${pkgName}]`))\n let result = 0\n for (const [i, step] of steps.entries()) {\n result += await runStepAsync(name, step, exitOnFail, messages?.[i])\n }\n return result\n })\n}\n"],"mappings":";AAAA,OAAOA,YAAW;;;ACAlB,OAAO,WAAW;AAEX,IAAM,cAAc,CAAC,MAAc,QAAgB,QAA0B,SAAS,aAAa,UAAU;AAClH,MAAI,QAAQ;AACV,UAAM,UAAU,aAAa,sBAAsB;AACnD,UAAM,YAAY,UAAU,UAAU,MAAM,MAAM,MAAM;AACxD,YAAQ,KAAK,EAAE,UAAU,GAAG,IAAI,QAAQ,MAAM,aAAa,OAAO,EAAE,CAAC;AACrE,QAAI,YAAY;AACd,cAAQ,KAAK,MAAM;AAAA,IACrB;AAAA,EACF;AACF;;;ACXA,OAAOC,YAAW;;;ACAX,IAAM,YAAY,CAEvB,IACA,SACA,YAAY,CAACC,QAAW,CAAC,CAACA,IAAG,QAAQ,CAAC,CAACA,IAAG,YACvC;AACH,SAAO,UAAU,EAAO,IAAI,QAAQ,EAAO,IAAI;AACjD;;;ACLO,IAAM,qBAAqB,CAChC,IAAa,YACV;AACH,SAAO,UAAa,IAAI,SAAS,CAACC,QAAiBA,IAA6B,UAAU,MAAS;AACrG;;;AFDO,IAAM,YAAY,CAAC,OAAgB;AACxC,QAAM,QAAQ,OAAO,OAAO,WAAW,IAAI,MAAM,EAAE,IAAI;AACvD,QAAM,WACF,mBAAmB,OAAO,CAACC,WAAU;AACrC,QAAIA,OAAM,SAAS,UAAU;AAC3B,cAAQ,MAAMC,OAAM,IAAI,IAAID,OAAM,IAAI,cAAc,CAAC;AAAA,IACvD,OAAO;AACL,cAAQ,MAAMC,OAAM,IAAI,UAAUD,OA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C,IAAI,CAAC,MAAM,GAAG,IAAI,EAAE;AAChE,MAAI,SAAS,QAAW;AACtB,YAAQ,IAAIC,OAAM,KAAK,gBAAgB,IAAI,GAAG,CAAC;AAAA,EACjD;AAEA,QAAM,SAAS,MAAM,cAAc,QAAQ,cAAc,iBAAiB,EAAE,KAAK,OAAO,KAAK,KAAK;AAAA,IAChG,CAAC,QAAQ,CAAC,MAAM,WAAW,GAAG,YAAY,GAAG,eAAe,GAAG,gBAAgB,GAAG,aAAa,GAAG,oBAAoB,WAAW,MAAM,CAAC;AAAA,IACxI,CAAC,QAAQ,CAAC,MAAM,WAAW,GAAG,YAAY,GAAG,gBAAgB,GAAG,aAAa,GAAG,kBAAkB,CAAC;AAAA,IACnG,CAAC,QAAQ,CAAC,MAAM,WAAW,GAAG,YAAY,GAAG,gBAAgB,GAAG,aAAa,GAAG,kBAAkB,CAAC;AAAA,IACnG,CAAC,QAAQ,CAAC,MAAM,QAAQ,GAAG,YAAY,GAAG,gBAAgB,GAAG,kBAAkB,CAAC;AAAA,EAClF,CAAC;AACD,UAAQ,IAAI,GAAGA,OAAM,KAAK,UAAU,CAAC,KAAKA,OAAM,UAAU,KAAK,IAAI,IAAI,SAAS,KAAM,QAAQ,CAAC,CAAC,CAAC,KAAKA,OAAM,KAAK,SAAS,CAAC,EAAE;AAC7H,SAAO;AACT;","names":["chalk","chalk","ex","ex","error","chalk","chalk","chalk","chalk"]}
|
package/dist/actions/index.mjs
CHANGED
|
@@ -407,18 +407,18 @@ var build = async ({
|
|
|
407
407
|
pkg
|
|
408
408
|
}) => {
|
|
409
409
|
const start = Date.now();
|
|
410
|
-
const pkgOptions = pkg ? [
|
|
410
|
+
const pkgOptions = pkg === void 0 ? [] : [pkg];
|
|
411
411
|
const incrementalOptions = incremental ? ["-i"] : [];
|
|
412
412
|
const verboseOptions = verbose ? ["-v"] : [];
|
|
413
|
-
const targetOptions = target ? ["-t", target]
|
|
414
|
-
const jobsOptions = jobs ? ["-j", `${jobs}`]
|
|
415
|
-
if (jobs) {
|
|
413
|
+
const targetOptions = target === void 0 ? [] : ["-t", target];
|
|
414
|
+
const jobsOptions = jobs === void 0 ? [] : ["-j", `${jobs}`];
|
|
415
|
+
if (jobs !== void 0) {
|
|
416
416
|
console.log(chalk8.blue(`Jobs set to [${jobs}]`));
|
|
417
417
|
}
|
|
418
418
|
const result = await runStepsAsync(`Build${incremental ? "-Incremental" : ""} [${pkg ?? "All"}]`, [
|
|
419
419
|
["yarn", ["xy", "compile", ...pkgOptions, ...targetOptions, ...verboseOptions, ...jobsOptions, ...incrementalOptions, "--types", "tsup"]],
|
|
420
420
|
["yarn", ["xy", "publint", ...pkgOptions, ...verboseOptions, ...jobsOptions, ...incrementalOptions]],
|
|
421
|
-
["yarn", ["xy", "
|
|
421
|
+
["yarn", ["xy", "deplint", ...pkgOptions, ...verboseOptions, ...jobsOptions, ...incrementalOptions]],
|
|
422
422
|
["yarn", ["xy", "lint", ...pkgOptions, ...verboseOptions, ...incrementalOptions]]
|
|
423
423
|
]);
|
|
424
424
|
console.log(`${chalk8.gray("Built in")} [${chalk8.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk8.gray("seconds")}`);
|