@xylabs/ts-scripts-yarn3 6.0.6 → 6.0.8
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 -4
- package/dist/actions/build.mjs.map +1 -1
- package/dist/actions/index.mjs +25 -19
- package/dist/actions/index.mjs.map +1 -1
- package/dist/actions/package/compile/compile.mjs +20 -15
- package/dist/actions/package/compile/compile.mjs.map +1 -1
- package/dist/actions/package/compile/compileTypes.mjs +10 -1
- package/dist/actions/package/compile/compileTypes.mjs.map +1 -1
- package/dist/actions/package/compile/index.mjs +20 -15
- package/dist/actions/package/compile/index.mjs.map +1 -1
- package/dist/actions/package/compile/packageCompileTscTypes.mjs +10 -1
- package/dist/actions/package/compile/packageCompileTscTypes.mjs.map +1 -1
- package/dist/actions/package/compile/packageCompileTsup.mjs +10 -1
- package/dist/actions/package/compile/packageCompileTsup.mjs.map +1 -1
- package/dist/actions/package/index.mjs +20 -15
- package/dist/actions/package/index.mjs.map +1 -1
- package/dist/actions/package/recompile.mjs +20 -15
- package/dist/actions/package/recompile.mjs.map +1 -1
- package/dist/bin/package/build-only.mjs +20 -15
- package/dist/bin/package/build-only.mjs.map +1 -1
- package/dist/bin/package/build.mjs +20 -15
- package/dist/bin/package/build.mjs.map +1 -1
- package/dist/bin/package/compile-only.mjs +20 -15
- package/dist/bin/package/compile-only.mjs.map +1 -1
- package/dist/bin/package/compile-tsup.mjs +20 -11
- package/dist/bin/package/compile-tsup.mjs.map +1 -1
- package/dist/bin/package/compile-types.mjs +18 -9
- package/dist/bin/package/compile-types.mjs.map +1 -1
- package/dist/bin/package/compile.mjs +20 -15
- package/dist/bin/package/compile.mjs.map +1 -1
- package/dist/bin/package/recompile.mjs +20 -15
- package/dist/bin/package/recompile.mjs.map +1 -1
- package/dist/bin/xy.mjs +5 -4
- package/dist/bin/xy.mjs.map +1 -1
- package/dist/index.mjs +25 -19
- package/dist/index.mjs.map +1 -1
- package/dist/types/actions/package/compile/compile.d.ts.map +1 -1
- package/dist/types/actions/package/compile/packageCompileTscTypes.d.ts.map +1 -1
- package/dist/xy/index.mjs +5 -4
- package/dist/xy/index.mjs.map +1 -1
- package/dist/xy/xy.mjs +5 -4
- package/dist/xy/xy.mjs.map +1 -1
- package/dist/xy/xyBuildCommands.mjs +5 -4
- package/dist/xy/xyBuildCommands.mjs.map +1 -1
- package/package.json +4 -4
- package/src/actions/build.ts +1 -1
- package/src/actions/package/compile/compile.ts +0 -7
- package/src/actions/package/compile/packageCompileTscTypes.ts +3 -1
package/dist/actions/build.mjs
CHANGED
|
@@ -150,19 +150,20 @@ var build = /* @__PURE__ */ __name(async ({ incremental, jobs, target, verbose,
|
|
|
150
150
|
"yarn",
|
|
151
151
|
[
|
|
152
152
|
"xy",
|
|
153
|
-
"
|
|
153
|
+
"lint",
|
|
154
154
|
...pkgOptions,
|
|
155
155
|
...verboseOptions,
|
|
156
|
-
...
|
|
156
|
+
...incrementalOptions
|
|
157
157
|
]
|
|
158
158
|
],
|
|
159
159
|
[
|
|
160
160
|
"yarn",
|
|
161
161
|
[
|
|
162
162
|
"xy",
|
|
163
|
-
"
|
|
163
|
+
"deps",
|
|
164
164
|
...pkgOptions,
|
|
165
165
|
...verboseOptions,
|
|
166
|
+
...jobsOptions,
|
|
166
167
|
...incrementalOptions
|
|
167
168
|
]
|
|
168
169
|
],
|
|
@@ -170,7 +171,7 @@ var build = /* @__PURE__ */ __name(async ({ incremental, jobs, target, verbose,
|
|
|
170
171
|
"yarn",
|
|
171
172
|
[
|
|
172
173
|
"xy",
|
|
173
|
-
"
|
|
174
|
+
"publint",
|
|
174
175
|
...pkgOptions,
|
|
175
176
|
...verboseOptions,
|
|
176
177
|
...jobsOptions,
|
|
@@ -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 ? [pkg] : [] // must go first\n const incrementalOptions = incremental ? ['-i'] : []\n const verboseOptions = verbose ? ['-v'] : []\n const targetOptions = target ? ['-t', target] : []\n const jobsOptions = jobs ? ['-j', `${jobs}`] : []\n if (jobs) {\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', 'compile-types', ...pkgOptions, ...verboseOptions, ...jobsOptions]],\n ['yarn', ['xy', 'lint', ...pkgOptions, ...verboseOptions, ...incrementalOptions]],\n ['yarn', ['xy', 'deps', ...pkgOptions, ...verboseOptions, ...jobsOptions, ...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,OAAOC,WAAW;AAEX,IAAMC,cAAc,wBAACC,MAAcC,QAAgBC,QAA0B,SAASC,aAAa,UAAK;AAC7G,MAAIF,QAAQ;AACV,UAAMG,UAAUD,aAAa,sBAAsB;AACnD,UAAME,YAAYH,UAAU,UAAUI,MAAMC,MAAMD,MAAME;AACxDC,YAAQP,KAAAA,EAAOG,UAAU,GAAGL,IAAAA,QAAYC,MAAAA,aAAmBG,OAAAA,EAAS,CAAA;AACpE,QAAID,YAAY;AACdO,cAAQC,KAAKV,MAAAA;IACf;EACF;AACF,GAT2B;;;ACF3B,OAAOW,YAAW;;;ACAX,IAAMC,YAAY,wBAEvBC,IACAC,SACAC,YAAY,CAACF,QAAW,CAAC,CAACA,IAAGG,QAAQ,CAAC,CAACH,IAAGI,YAAQ;AAElD,SAAOF,UAAUF,EAAAA,IAAWC,QAAQD,EAAAA,IAAWK;AACjD,GAPyB;;;ACElB,IAAMC,qBAAqB,wBAChCC,IAAaC,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AAMC,MAAMC,YAAYiC,WAAWM,CAAAA,CAAE;IACpE;AACA,WAAOD;EACT,CAAA;AACF,GAV6B;;;AN9BtB,IAAMG,QAAQ,8BAAO,EAC1BC,aAAaC,MAAMC,QAAQC,SAASC,IAAG,MAC3B;AACZ,QAAMC,QAAQC,KAAKC,IAAG;AACtB,QAAMC,aAAaJ,MAAM;IAACA;MAAO,CAAA;AACjC,QAAMK,qBAAqBT,cAAc;IAAC;MAAQ,CAAA;AAClD,QAAMU,iBAAiBP,UAAU;IAAC;MAAQ,CAAA;AAC1C,QAAMQ,gBAAgBT,SAAS;IAAC;IAAMA;MAAU,CAAA;AAChD,QAAMU,cAAcX,OAAO;IAAC;IAAM,GAAGA,IAAAA;MAAU,CAAA;AAC/C,MAAIA,MAAM;AACRY,YAAQC,IAAIC,OAAMC,KAAK,gBAAgBf,IAAAA,GAAO,CAAA;EAChD;AAEA,QAAMgB,SAAS,MAAMC,cAAc,QAAQlB,cAAc,iBAAiB,EAAA,KAAOI,OAAO,KAAA,KAAU;IAChG;MAAC;MAAQ;QAAC;QAAM;WAAcI;WAAeG;WAAkBD;WAAmBE;WAAgBH;QAAoB;QAAW;;;IACjI;MAAC;MAAQ;QAAC;QAAM;WAAoBD;WAAeE;WAAmBE;;;IACtE;MAAC;MAAQ;QAAC;QAAM;WAAWJ;WAAeE;WAAmBD;;;IAC7D;MAAC;MAAQ;QAAC;QAAM;WAAWD;WAAeE;WAAmBE;WAAgBH;;;GAC9E;AACDI,UAAQC,IAAI,GAAGC,OAAMI,KAAK,UAAA,CAAA,KAAgBJ,OAAMK,UAAUd,KAAKC,IAAG,IAAKF,SAAS,KAAMgB,QAAQ,CAAA,CAAA,CAAA,KAAQN,OAAMI,KAAK,SAAA,CAAA,EAAY;AAC7H,SAAOF;AACT,GArBqB;","names":["chalk","chalk","checkResult","name","result","level","exitOnFail","exiting","chalkFunc","chalk","red","yellow","console","process","exit","chalk","withError","ex","closure","predicate","name","message","undefined","withErrnoException","ex","closure","withError","errno","undefined","processEx","ex","error","Error","exitCode","withErrnoException","code","console","chalk","red","path","errno","withError","name","message","JSON","stringify","process","exit","safeExitAsync","func","exitOnFail","result","process","exit","ex","processEx","spawn","existsSync","chalk","runStepAsync","name","step","exitOnFail","message","Promise","resolve","command","args","config","console","log","chalk","gray","argList","Array","isArray","split","existsSync","Error","spawn","env","FORCE_COLOR","process","shell","stdio","on","code","error","red","yellow","white","join","checkResult","runStepsAsync","steps","messages","safeExitAsync","pkgName","npm_package_name","green","result","i","entries","build","incremental","jobs","target","verbose","pkg","start","Date","now","pkgOptions","incrementalOptions","verboseOptions","targetOptions","jobsOptions","console","log","chalk","blue","result","runStepsAsync","gray","magenta","toFixed"]}
|
|
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 ? [pkg] : [] // must go first\n const incrementalOptions = incremental ? ['-i'] : []\n const verboseOptions = verbose ? ['-v'] : []\n const targetOptions = target ? ['-t', target] : []\n const jobsOptions = jobs ? ['-j', `${jobs}`] : []\n if (jobs) {\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', 'lint', ...pkgOptions, ...verboseOptions, ...incrementalOptions]],\n ['yarn', ['xy', 'deps', ...pkgOptions, ...verboseOptions, ...jobsOptions, ...incrementalOptions]],\n ['yarn', ['xy', 'publint', ...pkgOptions, ...verboseOptions, ...jobsOptions, ...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,OAAOC,WAAW;AA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AQ;QAAC;QAAM;WAAcI;WAAeG;WAAkBD;WAAmBE;WAAgBH;QAAoB;QAAW;;;IACjI;MAAC;MAAQ;QAAC;QAAM;WAAWD;WAAeE;WAAmBD;;;IAC7D;MAAC;MAAQ;QAAC;QAAM;WAAWD;WAAeE;WAAmBE;WAAgBH;;;IAC7E;MAAC;MAAQ;QAAC;QAAM;WAAcD;WAAeE;WAAmBE;WAAgBH;;;GACjF;AACDI,UAAQC,IAAI,GAAGC,OAAMI,KAAK,UAAA,CAAA,KAAgBJ,OAAMK,UAAUd,KAAKC,IAAG,IAAKF,SAAS,KAAMgB,QAAQ,CAAA,CAAA,CAAA,KAAQN,OAAMI,KAAK,SAAA,CAAA,EAAY;AAC7H,SAAOF;AACT,GArBqB;","names":["chalk","chalk","checkResult","name","result","level","exitOnFail","exiting","chalkFunc","chalk","red","yellow","console","process","exit","chalk","withError","ex","closure","predicate","name","message","undefined","withErrnoException","ex","closure","withError","errno","undefined","processEx","ex","error","Error","exitCode","withErrnoException","code","console","chalk","red","path","errno","withError","name","message","JSON","stringify","process","exit","safeExitAsync","func","exitOnFail","result","process","exit","ex","processEx","spawn","existsSync","chalk","runStepAsync","name","step","exitOnFail","message","Promise","resolve","command","args","config","console","log","chalk","gray","argList","Array","isArray","split","existsSync","Error","spawn","env","FORCE_COLOR","process","shell","stdio","on","code","error","red","yellow","white","join","checkResult","runStepsAsync","steps","messages","safeExitAsync","pkgName","npm_package_name","green","result","i","entries","build","incremental","jobs","target","verbose","pkg","start","Date","now","pkgOptions","incrementalOptions","verboseOptions","targetOptions","jobsOptions","console","log","chalk","blue","result","runStepsAsync","gray","magenta","toFixed"]}
|
package/dist/actions/index.mjs
CHANGED
|
@@ -476,19 +476,20 @@ var build = /* @__PURE__ */ __name(async ({ incremental, jobs, target, verbose,
|
|
|
476
476
|
"yarn",
|
|
477
477
|
[
|
|
478
478
|
"xy",
|
|
479
|
-
"
|
|
479
|
+
"lint",
|
|
480
480
|
...pkgOptions,
|
|
481
481
|
...verboseOptions,
|
|
482
|
-
...
|
|
482
|
+
...incrementalOptions
|
|
483
483
|
]
|
|
484
484
|
],
|
|
485
485
|
[
|
|
486
486
|
"yarn",
|
|
487
487
|
[
|
|
488
488
|
"xy",
|
|
489
|
-
"
|
|
489
|
+
"deps",
|
|
490
490
|
...pkgOptions,
|
|
491
491
|
...verboseOptions,
|
|
492
|
+
...jobsOptions,
|
|
492
493
|
...incrementalOptions
|
|
493
494
|
]
|
|
494
495
|
],
|
|
@@ -496,7 +497,7 @@ var build = /* @__PURE__ */ __name(async ({ incremental, jobs, target, verbose,
|
|
|
496
497
|
"yarn",
|
|
497
498
|
[
|
|
498
499
|
"xy",
|
|
499
|
-
"
|
|
500
|
+
"publint",
|
|
500
501
|
...pkgOptions,
|
|
501
502
|
...verboseOptions,
|
|
502
503
|
...jobsOptions,
|
|
@@ -1355,13 +1356,8 @@ var packagePublint = /* @__PURE__ */ __name(async (params) => {
|
|
|
1355
1356
|
return validMessages.filter((message) => message.type === "error").length;
|
|
1356
1357
|
}, "packagePublint");
|
|
1357
1358
|
|
|
1358
|
-
// src/actions/package/compile/
|
|
1359
|
-
import
|
|
1360
|
-
|
|
1361
|
-
// src/actions/package/compile/packageCompileTscTypes.ts
|
|
1362
|
-
import { cwd } from "node:process";
|
|
1363
|
-
import { createProgramFromConfig } from "tsc-prog";
|
|
1364
|
-
import { DiagnosticCategory, formatDiagnosticsWithColorAndContext, getPreEmitDiagnostics, sys as sys2 } from "typescript";
|
|
1359
|
+
// src/actions/package/compile/packageCompileTsup.ts
|
|
1360
|
+
import { build as build2, defineConfig } from "tsup";
|
|
1365
1361
|
|
|
1366
1362
|
// src/actions/package/compile/inputs.ts
|
|
1367
1363
|
import { glob as glob2 } from "glob";
|
|
@@ -1402,6 +1398,14 @@ var buildEntries = /* @__PURE__ */ __name((folder, entryMode = "single", verbose
|
|
|
1402
1398
|
return entries;
|
|
1403
1399
|
}, "buildEntries");
|
|
1404
1400
|
|
|
1401
|
+
// src/actions/package/compile/compileTypes.ts
|
|
1402
|
+
import chalk22 from "chalk";
|
|
1403
|
+
|
|
1404
|
+
// src/actions/package/compile/packageCompileTscTypes.ts
|
|
1405
|
+
import { cwd } from "node:process";
|
|
1406
|
+
import { createProgramFromConfig } from "tsc-prog";
|
|
1407
|
+
import { DiagnosticCategory, formatDiagnosticsWithColorAndContext, getPreEmitDiagnostics, sys as sys2 } from "typescript";
|
|
1408
|
+
|
|
1405
1409
|
// src/actions/package/compile/getCompilerOptions.ts
|
|
1406
1410
|
import { createRequire } from "node:module";
|
|
1407
1411
|
import deepmerge2 from "deepmerge";
|
|
@@ -1444,7 +1448,16 @@ var packageCompileTscTypes = /* @__PURE__ */ __name((folder = "src", config2 = {
|
|
|
1444
1448
|
emitDeclarationOnly: true,
|
|
1445
1449
|
noEmit: false
|
|
1446
1450
|
};
|
|
1447
|
-
const
|
|
1451
|
+
const validTsExt = [
|
|
1452
|
+
".ts",
|
|
1453
|
+
".tsx",
|
|
1454
|
+
".d.ts",
|
|
1455
|
+
".cts",
|
|
1456
|
+
".d.cts",
|
|
1457
|
+
".mts",
|
|
1458
|
+
".d.mts"
|
|
1459
|
+
];
|
|
1460
|
+
const files = buildEntries(folder, "all", verbose).filter((file) => validTsExt.find((ext) => file.endsWith(ext)));
|
|
1448
1461
|
const program = createProgramFromConfig({
|
|
1449
1462
|
basePath: pkg ?? cwd(),
|
|
1450
1463
|
compilerOptions,
|
|
@@ -1478,9 +1491,6 @@ var packageCompileTypes = /* @__PURE__ */ __name(async (inConfig = {}) => {
|
|
|
1478
1491
|
return packageCompileTscTypes(void 0, config2);
|
|
1479
1492
|
}, "packageCompileTypes");
|
|
1480
1493
|
|
|
1481
|
-
// src/actions/package/compile/packageCompileTsup.ts
|
|
1482
|
-
import { build as build2, defineConfig } from "tsup";
|
|
1483
|
-
|
|
1484
1494
|
// src/actions/package/compile/deepMerge.ts
|
|
1485
1495
|
function deepMerge(target, source) {
|
|
1486
1496
|
if (!source || typeof source !== "object") return target;
|
|
@@ -1643,10 +1653,6 @@ var packageCompile = /* @__PURE__ */ __name(async (inConfig = {}) => {
|
|
|
1643
1653
|
console.log(chalk23.green(`Compiling ${pkg}`));
|
|
1644
1654
|
const config2 = await loadConfig(inConfig);
|
|
1645
1655
|
const publint2 = config2.publint;
|
|
1646
|
-
const tscResults = await packageCompileTypes(config2);
|
|
1647
|
-
if (tscResults > 0) {
|
|
1648
|
-
return tscResults;
|
|
1649
|
-
}
|
|
1650
1656
|
const tsupResults = await packageCompileTsup(config2);
|
|
1651
1657
|
if (tsupResults > 0) {
|
|
1652
1658
|
return tsupResults;
|