@xylabs/ts-scripts-yarn3 6.0.4 → 6.0.5
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/fix.mjs +1 -7
- package/dist/actions/fix.mjs.map +1 -1
- package/dist/actions/index.mjs +3 -21
- package/dist/actions/index.mjs.map +1 -1
- package/dist/actions/lint.mjs +1 -7
- package/dist/actions/lint.mjs.map +1 -1
- package/dist/actions/recompile.mjs +1 -7
- package/dist/actions/recompile.mjs.map +1 -1
- package/dist/actions/relint.mjs +1 -7
- package/dist/actions/relint.mjs.map +1 -1
- package/dist/bin/xy.mjs +3 -21
- package/dist/bin/xy.mjs.map +1 -1
- package/dist/index.d.ts +3 -3
- package/dist/index.mjs +3 -21
- package/dist/index.mjs.map +1 -1
- package/dist/xy/index.mjs +3 -21
- package/dist/xy/index.mjs.map +1 -1
- package/dist/xy/xy.mjs +3 -21
- package/dist/xy/xy.mjs.map +1 -1
- package/dist/xy/xyBuildCommands.mjs +1 -7
- package/dist/xy/xyBuildCommands.mjs.map +1 -1
- package/dist/xy/xyLintCommands.mjs +2 -14
- package/dist/xy/xyLintCommands.mjs.map +1 -1
- package/package.json +4 -4
- package/src/actions/lint.ts +1 -5
- package/src/actions/recompile.ts +2 -5
- package/src/actions/relint.ts +1 -3
package/dist/actions/fix.mjs
CHANGED
|
@@ -98,21 +98,15 @@ var runSteps = /* @__PURE__ */ __name((name, steps, exitOnFail = true, messages)
|
|
|
98
98
|
}, "runSteps");
|
|
99
99
|
|
|
100
100
|
// src/actions/lint.ts
|
|
101
|
-
var lintPackage = /* @__PURE__ */ __name(({ pkg, fix: fix2
|
|
101
|
+
var lintPackage = /* @__PURE__ */ __name(({ pkg, fix: fix2 }) => {
|
|
102
102
|
console.log(chalk4.gray(`${fix2 ? "Fix" : "Lint"} [All-Packages]`));
|
|
103
103
|
const start = Date.now();
|
|
104
|
-
const verboseOptions = verbose ? [
|
|
105
|
-
"--verbose"
|
|
106
|
-
] : [
|
|
107
|
-
"--no-verbose"
|
|
108
|
-
];
|
|
109
104
|
const result = runSteps(`${fix2 ? "Fix" : "Lint"} [All-Packages]`, [
|
|
110
105
|
[
|
|
111
106
|
"yarn",
|
|
112
107
|
[
|
|
113
108
|
"workspace",
|
|
114
109
|
pkg,
|
|
115
|
-
...verboseOptions,
|
|
116
110
|
"run",
|
|
117
111
|
fix2 ? "package-fix" : "package-lint"
|
|
118
112
|
]
|
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 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 = ({\n pkg, fix, verbose,\n}: LintParams & Required<Pick<LintParams, 'pkg'>>) => {\n console.log(chalk.gray(`${fix ? 'Fix' : 'Lint'} [All-Packages]`))\n const start = Date.now()\n const verboseOptions = verbose ? ['--verbose'] : ['--no-verbose']\n\n const result = runSteps(`${fix ? 'Fix' : 'Lint'} [All-Packages]`, [\n ['yarn', ['workspace',\n pkg,\n ...verboseOptions,\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 ? lintPackage({ pkg, fix })\n : lintAllPackages({\n verbose, incremental, fix,\n })\n}\n\nexport const lintAllPackages = ({\n fix, verbose = true, incremental,\n}: 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\n const result = runSteps(`${fix ? 'Fix' : 'Lint'} [All-Packages]`, [\n ['yarn', ['workspaces',\n 'foreach',\n ...verboseOptions,\n ...incrementalOptions,\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","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,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,YAAAA;AAEb,SAAOC,UAAaF,IAAIC,SAAS,CAACD,QAAiBA,IAA6BG,UAAUC,MAAAA;AAC5F,GAJkC;;;AFG3B,IAAMC,YAAY,wBAACC,OAAAA;AACxB,QAAMC,QAAQ,OAAOD,OAAO,WAAW,IAAIE,MAAMF,EAAAA,IAAMA;AACvD,QAAMG,WACFC,mBAAmBH,OAAO,CAACA,WAAAA;AAC3B,QAAIA,OAAMI,SAAS,UAAU;AAC3BC,cAAQL,MAAMM,OAAMC,IAAI,IAAIP,OAAMQ,IAAI,cAAc,CAAA;IACtD,OAAO;AACLH,cAAQL,MAAMM,OAAMC,IAAI,UAAUP,OAAM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kB,wBAAC,EAC9BhB,KAAAA,MAAKC,UAAU,MAAMc,YAAW,IAClB,CAAC,MAAC;AAChBb,UAAQC,IAAIC,OAAMC,KAAK,GAAGL,OAAM,QAAQ,MAAA,iBAAuB,CAAA;AAC/D,QAAMM,QAAQC,KAAKC,IAAG;AACtB,QAAMC,iBAAiBR,UAAU;IAAC;MAAe;IAAC;;AAClD,QAAMgB,qBAAqBF,cAAc;IAAC;IAAW;MAAS;IAAC;IAAc;;AAE7E,QAAML,SAASC,SAAS,GAAGX,OAAM,QAAQ,MAAA,oBAA0B;IACjE;MAAC;MAAQ;QAAC;QACR;WACGS;WACAQ;QACH;QACAjB,OAAM,gBAAgB;;;GAEzB;AACDE,UAAQC,IAAIC,OAAMC,KAAK,GAAGL,OAAM,aAAa,WAAA,KAAgBI,OAAMQ,UAAUL,KAAKC,IAAG,IAAKF,SAAS,KAAMO,QAAQ,CAAA,CAAA,CAAA,KAAQT,OAAMC,KAAK,SAAA,CAAA,EAAY,CAAA;AAChJ,SAAOK;AACT,GAnB+B;;;AO1CxB,IAAMQ,MAAM,wBAACC,WAAAA;AAClB,SAAOC,KAAK;IAAE,GAAGD;IAAQD,KAAK;EAAK,CAAA;AACrC,GAFmB;","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","safeExit","func","exitOnFail","result","process","exit","ex","processEx","spawnSync","existsSync","chalk","runSteps","name","steps","exitOnFail","messages","safeExit","pkgName","process","env","npm_package_name","console","log","chalk","green","totalStatus","i","command","args","config","entries","gray","argList","Array","isArray","split","existsSync","Error","status","spawnSync","encoding","FORCE_COLOR","shell","stdio","checkResult","lintPackage","pkg","fix","verbose","console","log","chalk","gray","start","Date","now","verboseOptions","result","runSteps","magenta","toFixed","lint","incremental","lintAllPackages","incrementalOptions","fix","params","lint"]}
|
|
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 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'} [All-Packages]`))\n const start = Date.now()\n\n const result = runSteps(`${fix ? 'Fix' : 'Lint'} [All-Packages]`, [\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 ? lintPackage({ pkg, fix })\n : lintAllPackages({\n verbose, incremental, fix,\n })\n}\n\nexport const lintAllPackages = ({\n fix, verbose = true, incremental,\n}: 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\n const result = runSteps(`${fix ? 'Fix' : 'Lint'} [All-Packages]`, [\n ['yarn', ['workspaces',\n 'foreach',\n ...verboseOptions,\n ...incrementalOptions,\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","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,OAAOC,WAAW;AAEX,IAAMC,cAAc,wBAACC,MAAcC,QAAgBC,QAA0B,SAASC,aAAa,UAAK;AAC7G,MAAIF,QAAQ;AACV,UAAMG,UAAUD,aAAa,sBA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zB;AACDC,UAAQC,IAAIC,OAAMC,KAAK,GAAGJ,OAAM,aAAa,WAAA,KAAgBG,OAAMO,UAAUJ,KAAKC,IAAG,IAAKF,SAAS,KAAMM,QAAQ,CAAA,CAAA,CAAA,KAAQR,OAAMC,KAAK,SAAA,CAAA,EAAY,CAAA;AAChJ,SAAOI;AACT,GAnB+B;;;AOtCxB,IAAMU,MAAM,wBAACC,WAAAA;AAClB,SAAOC,KAAK;IAAE,GAAGD;IAAQD,KAAK;EAAK,CAAA;AACrC,GAFmB;","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","safeExit","func","exitOnFail","result","process","exit","ex","processEx","spawnSync","existsSync","chalk","runSteps","name","steps","exitOnFail","messages","safeExit","pkgName","process","env","npm_package_name","console","log","chalk","green","totalStatus","i","command","args","config","entries","gray","argList","Array","isArray","split","existsSync","Error","status","spawnSync","encoding","FORCE_COLOR","shell","stdio","checkResult","lintPackage","pkg","fix","console","log","chalk","gray","start","Date","now","result","runSteps","magenta","toFixed","lint","verbose","incremental","lintAllPackages","verboseOptions","incrementalOptions","fix","params","lint"]}
|
package/dist/actions/index.mjs
CHANGED
|
@@ -988,21 +988,15 @@ var dupdeps = /* @__PURE__ */ __name(() => {
|
|
|
988
988
|
|
|
989
989
|
// src/actions/lint.ts
|
|
990
990
|
import chalk15 from "chalk";
|
|
991
|
-
var lintPackage = /* @__PURE__ */ __name(({ pkg, fix: fix2
|
|
991
|
+
var lintPackage = /* @__PURE__ */ __name(({ pkg, fix: fix2 }) => {
|
|
992
992
|
console.log(chalk15.gray(`${fix2 ? "Fix" : "Lint"} [All-Packages]`));
|
|
993
993
|
const start = Date.now();
|
|
994
|
-
const verboseOptions = verbose ? [
|
|
995
|
-
"--verbose"
|
|
996
|
-
] : [
|
|
997
|
-
"--no-verbose"
|
|
998
|
-
];
|
|
999
994
|
const result = runSteps(`${fix2 ? "Fix" : "Lint"} [All-Packages]`, [
|
|
1000
995
|
[
|
|
1001
996
|
"yarn",
|
|
1002
997
|
[
|
|
1003
998
|
"workspace",
|
|
1004
999
|
pkg,
|
|
1005
|
-
...verboseOptions,
|
|
1006
1000
|
"run",
|
|
1007
1001
|
fix2 ? "package-fix" : "package-lint"
|
|
1008
1002
|
]
|
|
@@ -2210,23 +2204,17 @@ var recompile = /* @__PURE__ */ __name(async ({ verbose, target, pkg, incrementa
|
|
|
2210
2204
|
verbose
|
|
2211
2205
|
});
|
|
2212
2206
|
}, "recompile");
|
|
2213
|
-
var recompilePackage = /* @__PURE__ */ __name(({
|
|
2207
|
+
var recompilePackage = /* @__PURE__ */ __name(({ target, pkg }) => {
|
|
2214
2208
|
const targetOptions = target ? [
|
|
2215
2209
|
"-t",
|
|
2216
2210
|
target
|
|
2217
2211
|
] : [];
|
|
2218
|
-
const verboseOptions = verbose ? [
|
|
2219
|
-
"--verbose"
|
|
2220
|
-
] : [
|
|
2221
|
-
"--no-verbose"
|
|
2222
|
-
];
|
|
2223
2212
|
return runStepsAsync(`Recompile [${pkg}]`, [
|
|
2224
2213
|
[
|
|
2225
2214
|
"yarn",
|
|
2226
2215
|
[
|
|
2227
2216
|
"workspace",
|
|
2228
2217
|
pkg,
|
|
2229
|
-
...verboseOptions,
|
|
2230
2218
|
"run",
|
|
2231
2219
|
"package-recompile",
|
|
2232
2220
|
...targetOptions
|
|
@@ -2324,21 +2312,15 @@ var reinstall = /* @__PURE__ */ __name(() => {
|
|
|
2324
2312
|
|
|
2325
2313
|
// src/actions/relint.ts
|
|
2326
2314
|
import chalk31 from "chalk";
|
|
2327
|
-
var relintPackage = /* @__PURE__ */ __name(({ pkg
|
|
2315
|
+
var relintPackage = /* @__PURE__ */ __name(({ pkg }) => {
|
|
2328
2316
|
console.log(chalk31.gray(`${"Relint"} [All-Packages]`));
|
|
2329
2317
|
const start = Date.now();
|
|
2330
|
-
const verboseOptions = verbose ? [
|
|
2331
|
-
"--verbose"
|
|
2332
|
-
] : [
|
|
2333
|
-
"--no-verbose"
|
|
2334
|
-
];
|
|
2335
2318
|
const result = runSteps("Relint [All-Packages]", [
|
|
2336
2319
|
[
|
|
2337
2320
|
"yarn",
|
|
2338
2321
|
[
|
|
2339
2322
|
"workspace",
|
|
2340
2323
|
pkg,
|
|
2341
|
-
...verboseOptions,
|
|
2342
2324
|
"run",
|
|
2343
2325
|
"package-relint"
|
|
2344
2326
|
]
|