@xylabs/ts-scripts-yarn3 6.5.12 → 6.5.14
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/fix.mjs +2 -2
- package/dist/actions/fix.mjs.map +1 -1
- package/dist/actions/index.mjs +10 -10
- package/dist/actions/index.mjs.map +1 -1
- package/dist/actions/lint.mjs +2 -2
- package/dist/actions/lint.mjs.map +1 -1
- package/dist/actions/package/compile/compile.mjs +1 -1
- package/dist/actions/package/compile/compile.mjs.map +1 -1
- package/dist/actions/package/compile/compileTypes.mjs +1 -1
- package/dist/actions/package/compile/compileTypes.mjs.map +1 -1
- package/dist/actions/package/compile/index.mjs +1 -1
- package/dist/actions/package/compile/index.mjs.map +1 -1
- package/dist/actions/package/compile/packageCompileTscTypes.mjs +1 -1
- package/dist/actions/package/compile/packageCompileTscTypes.mjs.map +1 -1
- package/dist/actions/package/compile/packageCompileTsup.mjs +1 -1
- package/dist/actions/package/compile/packageCompileTsup.mjs.map +1 -1
- package/dist/actions/package/index.mjs +3 -3
- package/dist/actions/package/index.mjs.map +1 -1
- package/dist/actions/package/lint.mjs +2 -2
- package/dist/actions/package/lint.mjs.map +1 -1
- package/dist/actions/package/recompile.mjs +1 -1
- package/dist/actions/package/recompile.mjs.map +1 -1
- package/dist/bin/package/build-only.mjs +1 -1
- package/dist/bin/package/build-only.mjs.map +1 -1
- package/dist/bin/package/build.mjs +1 -1
- package/dist/bin/package/build.mjs.map +1 -1
- package/dist/bin/package/compile-only.mjs +1 -1
- package/dist/bin/package/compile-only.mjs.map +1 -1
- package/dist/bin/package/compile-tsup.mjs +1 -1
- package/dist/bin/package/compile-tsup.mjs.map +1 -1
- package/dist/bin/package/compile-types.mjs +1 -1
- package/dist/bin/package/compile-types.mjs.map +1 -1
- package/dist/bin/package/compile.mjs +1 -1
- package/dist/bin/package/compile.mjs.map +1 -1
- package/dist/bin/package/fix.mjs +2 -2
- package/dist/bin/package/fix.mjs.map +1 -1
- package/dist/bin/package/lint.mjs +2 -2
- package/dist/bin/package/lint.mjs.map +1 -1
- package/dist/bin/package/recompile.mjs +1 -1
- package/dist/bin/package/recompile.mjs.map +1 -1
- package/dist/bin/package/relint.mjs +2 -2
- package/dist/bin/package/relint.mjs.map +1 -1
- package/dist/bin/xy.mjs +7 -7
- package/dist/bin/xy.mjs.map +1 -1
- package/dist/index.mjs +10 -10
- package/dist/index.mjs.map +1 -1
- package/dist/xy/index.mjs +7 -7
- package/dist/xy/index.mjs.map +1 -1
- package/dist/xy/xy.mjs +7 -7
- package/dist/xy/xy.mjs.map +1 -1
- package/dist/xy/xyBuildCommands.mjs +5 -5
- package/dist/xy/xyBuildCommands.mjs.map +1 -1
- package/dist/xy/xyLintCommands.mjs +2 -2
- package/dist/xy/xyLintCommands.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,IA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AAW,SAAa,CAAC,IAAI,CAAC,MAAM,MAAM;AACjE,QAAM,cAAe,SAAS,SAAa,CAAC,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/fix.mjs
CHANGED
|
@@ -112,11 +112,11 @@ var lint = ({
|
|
|
112
112
|
incremental,
|
|
113
113
|
fix: fix2
|
|
114
114
|
} = {}) => {
|
|
115
|
-
return pkg
|
|
115
|
+
return pkg === void 0 ? lintAllPackages({
|
|
116
116
|
verbose,
|
|
117
117
|
incremental,
|
|
118
118
|
fix: fix2
|
|
119
|
-
});
|
|
119
|
+
}) : lintPackage({ pkg, fix: fix2 });
|
|
120
120
|
};
|
|
121
121
|
var lintAllPackages = ({ fix: fix2 = false } = {}) => {
|
|
122
122
|
console.log(chalk4.gray(`${fix2 ? "Fix" : "Lint"} [All-Packages]`));
|
package/dist/actions/fix.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/actions/lint.ts","../../src/lib/checkResult.ts","../../src/lib/processEx.ts","../../src/lib/withError.ts","../../src/lib/withErrnoException.ts","../../src/lib/safeExit.ts","../../src/lib/runSteps.ts","../../src/actions/fix.ts"],"sourcesContent":["import chalk from 'chalk'\n\nimport { runSteps } from '../lib/index.ts'\n\nexport interface LintParams {\n cache?: boolean\n fix?: boolean\n incremental?: boolean\n pkg?: string\n verbose?: boolean\n}\n\nexport interface LintPackageParams {\n pkg: string\n verbose?: boolean\n}\n\nexport const lintPackage = ({ pkg, fix }: LintParams & Required<Pick<LintParams, 'pkg'>>) => {\n console.log(chalk.gray(`${fix ? 'Fix' : 'Lint'} [${pkg}]`))\n const start = Date.now()\n\n const result = runSteps(`${fix ? 'Fix' : 'Lint'} [${pkg}]`, [\n ['yarn', ['workspace',\n pkg,\n 'run',\n fix ? 'package-fix' : 'package-lint',\n ]],\n ])\n console.log(chalk.gray(`${fix ? 'Fixed in' : 'Linted in'} [${chalk.magenta(((Date.now() - start) / 1000).toFixed(2))}] ${chalk.gray('seconds')}`))\n return result\n}\n\nexport const lint = ({\n pkg, verbose, incremental, fix,\n}: LintParams = {}) => {\n return pkg\n ?
|
|
1
|
+
{"version":3,"sources":["../../src/actions/lint.ts","../../src/lib/checkResult.ts","../../src/lib/processEx.ts","../../src/lib/withError.ts","../../src/lib/withErrnoException.ts","../../src/lib/safeExit.ts","../../src/lib/runSteps.ts","../../src/actions/fix.ts"],"sourcesContent":["import chalk from 'chalk'\n\nimport { runSteps } from '../lib/index.ts'\n\nexport interface LintParams {\n cache?: boolean\n fix?: boolean\n incremental?: boolean\n pkg?: string\n verbose?: boolean\n}\n\nexport interface LintPackageParams {\n pkg: string\n verbose?: boolean\n}\n\nexport const lintPackage = ({ pkg, fix }: LintParams & Required<Pick<LintParams, 'pkg'>>) => {\n console.log(chalk.gray(`${fix ? 'Fix' : 'Lint'} [${pkg}]`))\n const start = Date.now()\n\n const result = runSteps(`${fix ? 'Fix' : 'Lint'} [${pkg}]`, [\n ['yarn', ['workspace',\n pkg,\n 'run',\n fix ? 'package-fix' : 'package-lint',\n ]],\n ])\n console.log(chalk.gray(`${fix ? 'Fixed in' : 'Linted in'} [${chalk.magenta(((Date.now() - start) / 1000).toFixed(2))}] ${chalk.gray('seconds')}`))\n return result\n}\n\nexport const lint = ({\n pkg, verbose, incremental, fix,\n}: LintParams = {}) => {\n return pkg === undefined\n ? lintAllPackages({\n verbose, incremental, fix,\n })\n : lintPackage({ pkg, fix })\n}\n\nexport const lintAllPackages = ({ fix = false }: LintParams = {}) => {\n console.log(chalk.gray(`${fix ? 'Fix' : 'Lint'} [All-Packages]`))\n const start = Date.now()\n // const verboseOptions = verbose ? ['--verbose'] : ['--no-verbose']\n // const incrementalOptions = incremental ? ['--since', '-Ap'] : ['--parallel', '-Ap']\n const fixOptions = fix ? ['--fix'] : []\n\n const result = runSteps(`${fix ? 'Fix' : 'Lint'} [All-Packages]`, [\n ['yarn', ['eslint', ...fixOptions]],\n ])\n console.log(chalk.gray(`${fix ? 'Fixed in' : 'Linted 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 type { SpawnSyncOptionsWithBufferEncoding } from 'node:child_process'\nimport { spawnSync } from 'node:child_process'\nimport { existsSync } from 'node:fs'\n\nimport chalk from 'chalk'\n\nimport { checkResult } from './checkResult.ts'\nimport { safeExit } from './safeExit.ts'\n\nexport type ScriptStep\n = | [/* command */ 'yarn' | 'node' | 'ts-node-script' | 'tsc' | 'jest', /* arg */ string | string[]]\n | [/* command */ string, /* arg */ string | string[], /* config */ SpawnSyncOptionsWithBufferEncoding]\n\nexport const runSteps = (name: string, steps: ScriptStep[], exitOnFail = true, messages?: string[]): number => {\n return safeExit(() => {\n const pkgName = process.env.npm_package_name\n console.log(chalk.green(`${name} [${pkgName}]`))\n let totalStatus = 0\n for (const [i, [command, args, config]] of steps.entries()) {\n if (messages?.[i]) {\n console.log(chalk.gray(messages?.[i]))\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 const status\n = spawnSync(command, Array.isArray(args) ? args : args.split(' '), {\n ...config,\n encoding: 'utf8',\n env: { FORCE_COLOR: '3', ...process.env },\n shell: true,\n stdio: 'inherit',\n }).status ?? 0\n checkResult(name, status, 'error', exitOnFail)\n totalStatus += status ?? 0\n }\n return totalStatus\n }, !!exitOnFail)\n}\n","import type { LintParams } from './lint.ts'\nimport { lint } from './lint.ts'\n\nexport const fix = (params?: LintParams) => {\n return lint({ ...params, fix: true })\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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AK,IAAI,IAAI,SAAS,KAAM,QAAQ,CAAC,CAAC,CAAC,KAAKA,OAAM,KAAK,SAAS,CAAC,EAAE,CAAC;AACjJ,SAAO;AACT;AAEO,IAAM,OAAO,CAAC;AAAA,EACnB;AAAA,EAAK;AAAA,EAAS;AAAA,EAAa,KAAAD;AAC7B,IAAgB,CAAC,MAAM;AACrB,SAAO,QAAQ,SACX,gBAAgB;AAAA,IACd;AAAA,IAAS;AAAA,IAAa,KAAAA;AAAA,EACxB,CAAC,IACD,YAAY,EAAE,KAAK,KAAAA,KAAI,CAAC;AAC9B;AAEO,IAAM,kBAAkB,CAAC,EAAE,KAAAA,OAAM,MAAM,IAAgB,CAAC,MAAM;AACnE,UAAQ,IAAIC,OAAM,KAAK,GAAGD,OAAM,QAAQ,MAAM,iBAAiB,CAAC;AAChE,QAAM,QAAQ,KAAK,IAAI;AAGvB,QAAM,aAAaA,OAAM,CAAC,OAAO,IAAI,CAAC;AAEtC,QAAM,SAAS,SAAS,GAAGA,OAAM,QAAQ,MAAM,oBAAoB;AAAA,IACjE,CAAC,QAAQ,CAAC,UAAU,GAAG,UAAU,CAAC;AAAA,EACpC,CAAC;AACD,UAAQ,IAAIC,OAAM,KAAK,GAAGD,OAAM,aAAa,WAAW,KAAKC,OAAM,UAAU,KAAK,IAAI,IAAI,SAAS,KAAM,QAAQ,CAAC,CAAC,CAAC,KAAKA,OAAM,KAAK,SAAS,CAAC,EAAE,CAAC;AACjJ,SAAO;AACT;;;AOnDO,IAAM,MAAM,CAAC,WAAwB;AAC1C,SAAO,KAAK,EAAE,GAAG,QAAQ,KAAK,KAAK,CAAC;AACtC;","names":["chalk","chalk","ex","ex","error","chalk","chalk","chalk","fix","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")}`);
|
|
@@ -1081,11 +1081,11 @@ var lint = ({
|
|
|
1081
1081
|
incremental,
|
|
1082
1082
|
fix: fix2
|
|
1083
1083
|
} = {}) => {
|
|
1084
|
-
return pkg
|
|
1084
|
+
return pkg === void 0 ? lintAllPackages({
|
|
1085
1085
|
verbose,
|
|
1086
1086
|
incremental,
|
|
1087
1087
|
fix: fix2
|
|
1088
|
-
});
|
|
1088
|
+
}) : lintPackage({ pkg, fix: fix2 });
|
|
1089
1089
|
};
|
|
1090
1090
|
var lintAllPackages = ({ fix: fix2 = false } = {}) => {
|
|
1091
1091
|
console.log(chalk19.gray(`${fix2 ? "Fix" : "Lint"} [All-Packages]`));
|
|
@@ -1431,7 +1431,7 @@ var packageCompileTscTypes = (folder = "src", config2 = {}, compilerOptionsParam
|
|
|
1431
1431
|
noEmit: false
|
|
1432
1432
|
};
|
|
1433
1433
|
const validTsExt = [".ts", ".tsx", ".d.ts", ".cts", ".d.cts", ".mts", ".d.mts"];
|
|
1434
|
-
const excludes = [".stories.", ".spec."];
|
|
1434
|
+
const excludes = [".stories.", ".spec.", "/stories/", "/spec/"];
|
|
1435
1435
|
const files = buildEntries(folder, "all", verbose).filter((file) => validTsExt.find((ext) => file.endsWith(ext)) && !excludes.some((exclude) => file.includes(exclude)));
|
|
1436
1436
|
console.log(chalk26.green(`Compiling Types ${pkg}: ${files.length}`));
|
|
1437
1437
|
if (files.length > 0) {
|
|
@@ -1901,7 +1901,7 @@ ${lintResult.filePath}`));
|
|
|
1901
1901
|
};
|
|
1902
1902
|
async function getRootESLintConfig() {
|
|
1903
1903
|
const configPath = await findUp("eslint.config.mjs");
|
|
1904
|
-
if (
|
|
1904
|
+
if (configPath === void 0) {
|
|
1905
1905
|
throw new Error("eslint.config.mjs not found in the monorepo");
|
|
1906
1906
|
}
|
|
1907
1907
|
return pathToFileURL(configPath);
|
|
@@ -1912,7 +1912,7 @@ function getFiles(dir, ignoreFolders) {
|
|
|
1912
1912
|
if (ignoreFolders.includes(subDirectory)) return [];
|
|
1913
1913
|
return readdirSync(dir, { withFileTypes: true }).flatMap((dirent) => {
|
|
1914
1914
|
const res = path9.resolve(dir, dirent.name);
|
|
1915
|
-
const relativePath = subDirectory ? `${subDirectory}/${dirent.name}
|
|
1915
|
+
const relativePath = subDirectory === void 0 ? dirent.name : `${subDirectory}/${dirent.name}`;
|
|
1916
1916
|
const ignoreMatchers = ignoreFolders.map((pattern) => picomatch(pattern));
|
|
1917
1917
|
if (ignoreMatchers.some((isMatch) => isMatch(relativePath))) return [];
|
|
1918
1918
|
return dirent.isDirectory() ? getFiles(res, ignoreFolders) : [res];
|