@xylabs/ts-scripts-yarn3 7.4.25 → 7.4.27
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/index.mjs +22 -5
- package/dist/actions/index.mjs.map +1 -1
- package/dist/actions/retest.mjs +27 -5
- package/dist/actions/retest.mjs.map +1 -1
- package/dist/actions/test.mjs +23 -4
- package/dist/actions/test.mjs.map +1 -1
- package/dist/bin/xy.mjs +36 -13
- package/dist/bin/xy.mjs.map +1 -1
- package/dist/index.d.ts +9 -3
- package/dist/index.mjs +36 -13
- package/dist/index.mjs.map +1 -1
- package/dist/xy/common/index.mjs +36 -13
- package/dist/xy/common/index.mjs.map +1 -1
- package/dist/xy/common/retestCommand.mjs +34 -9
- package/dist/xy/common/retestCommand.mjs.map +1 -1
- package/dist/xy/common/testCommand.mjs +30 -8
- package/dist/xy/common/testCommand.mjs.map +1 -1
- package/dist/xy/index.mjs +36 -13
- package/dist/xy/index.mjs.map +1 -1
- package/dist/xy/xy.mjs +36 -13
- package/dist/xy/xy.mjs.map +1 -1
- package/dist/xy/xyParseOptions.mjs.map +1 -1
- package/package.json +2 -2
|
@@ -57,8 +57,20 @@ var safeExit = (func, exitOnFail = true) => {
|
|
|
57
57
|
}
|
|
58
58
|
};
|
|
59
59
|
|
|
60
|
-
// src/lib/
|
|
60
|
+
// src/lib/yarn/workspace/yarnWorkspaces.ts
|
|
61
61
|
import { spawnSync } from "child_process";
|
|
62
|
+
var yarnWorkspaces = () => {
|
|
63
|
+
const result = spawnSync("yarn", ["workspaces", "list", "--json", "--recursive"], { encoding: "utf8", shell: true });
|
|
64
|
+
if (result.error) {
|
|
65
|
+
throw result.error;
|
|
66
|
+
}
|
|
67
|
+
return result.stdout.toString().split("\n").slice(0, -1).map((item) => {
|
|
68
|
+
return JSON.parse(item);
|
|
69
|
+
});
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
// src/lib/runSteps.ts
|
|
73
|
+
import { spawnSync as spawnSync2 } from "child_process";
|
|
62
74
|
import { existsSync } from "fs";
|
|
63
75
|
import chalk3 from "chalk";
|
|
64
76
|
var runSteps = (name, steps, exitOnFail = true, messages) => {
|
|
@@ -74,7 +86,7 @@ var runSteps = (name, steps, exitOnFail = true, messages) => {
|
|
|
74
86
|
if (command === "node" && !existsSync(argList[0])) {
|
|
75
87
|
throw new Error(`File not found [${argList[0]}]`);
|
|
76
88
|
}
|
|
77
|
-
const status =
|
|
89
|
+
const status = spawnSync2(command, Array.isArray(args) ? args : args.split(" "), {
|
|
78
90
|
...config,
|
|
79
91
|
encoding: "utf8",
|
|
80
92
|
env: { FORCE_COLOR: "3", ...process.env },
|
|
@@ -89,20 +101,33 @@ var runSteps = (name, steps, exitOnFail = true, messages) => {
|
|
|
89
101
|
};
|
|
90
102
|
|
|
91
103
|
// src/actions/retest.ts
|
|
92
|
-
|
|
93
|
-
return
|
|
104
|
+
function isWorkspace(target) {
|
|
105
|
+
return yarnWorkspaces().some((ws) => ws.name === target);
|
|
106
|
+
}
|
|
107
|
+
var retest = ({ target } = {}) => {
|
|
108
|
+
if (target && isWorkspace(target)) {
|
|
109
|
+
return runSteps(`Re-Test [${target}]`, [
|
|
110
|
+
["yarn", ["workspace", target, "run", "vitest", "--clearCache"]],
|
|
111
|
+
["yarn", ["workspace", target, "run", "vitest", "."]]
|
|
112
|
+
]);
|
|
113
|
+
}
|
|
114
|
+
const path = target ?? ".";
|
|
115
|
+
return runSteps("Re-Test", [
|
|
94
116
|
["yarn", ["vitest", "--clearCache"]],
|
|
95
|
-
["yarn", ["vitest",
|
|
117
|
+
["yarn", ["vitest", path]]
|
|
96
118
|
]);
|
|
97
119
|
};
|
|
98
120
|
|
|
99
121
|
// src/xy/common/retestCommand.ts
|
|
100
122
|
var retestCommand = {
|
|
101
|
-
command: "retest",
|
|
102
|
-
describe: "Re-Test - Run
|
|
123
|
+
command: "retest [target]",
|
|
124
|
+
describe: "Re-Test - Run Vitest Tests with cleaned cache",
|
|
125
|
+
builder: (yargs) => {
|
|
126
|
+
return yargs.positional("target", { describe: "Package name or file/folder path to test" });
|
|
127
|
+
},
|
|
103
128
|
handler: (argv) => {
|
|
104
|
-
if (argv.verbose) console.log(
|
|
105
|
-
process.exitCode = retest();
|
|
129
|
+
if (argv.verbose) console.log(`Re-Testing: ${argv.target ?? "all"}`);
|
|
130
|
+
process.exitCode = retest({ target: argv.target });
|
|
106
131
|
}
|
|
107
132
|
};
|
|
108
133
|
export {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../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/retest.ts","../../../src/xy/common/retestCommand.ts"],"sourcesContent":["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' | 'npm' | 'vitest', /* 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 { runSteps } from '../lib/index.ts'\n\nexport const retest = () => {\n return runSteps('Test', [\n ['yarn', ['vitest', '--clearCache']],\n ['yarn', ['vitest',
|
|
1
|
+
{"version":3,"sources":["../../../src/lib/checkResult.ts","../../../src/lib/processEx.ts","../../../src/lib/withError.ts","../../../src/lib/withErrnoException.ts","../../../src/lib/safeExit.ts","../../../src/lib/yarn/workspace/yarnWorkspaces.ts","../../../src/lib/runSteps.ts","../../../src/actions/retest.ts","../../../src/xy/common/retestCommand.ts"],"sourcesContent":["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 { spawnSync } from 'node:child_process'\n\nimport type { Workspace } from './Workspace.ts'\n\nexport const yarnWorkspaces = (): Workspace[] => {\n const result = spawnSync('yarn', ['workspaces', 'list', '--json', '--recursive'], { encoding: 'utf8', shell: true })\n if (result.error) {\n throw result.error\n }\n return (\n result.stdout\n .toString()\n // NOTE: This probably doesn't work on Windows\n // TODO: Replace /r/n with /n first\n .split('\\n')\n .slice(0, -1)\n .map((item) => {\n return JSON.parse(item)\n })\n )\n}\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' | 'npm' | 'vitest', /* 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 { runSteps, yarnWorkspaces } from '../lib/index.ts'\n\nexport interface RetestParams {\n target?: string\n}\n\nfunction isWorkspace(target: string): boolean {\n return yarnWorkspaces().some(ws => ws.name === target)\n}\n\nexport const retest = ({ target }: RetestParams = {}) => {\n if (target && isWorkspace(target)) {\n return runSteps(`Re-Test [${target}]`, [\n ['yarn', ['workspace', target, 'run', 'vitest', '--clearCache']],\n ['yarn', ['workspace', target, 'run', 'vitest', '.']],\n ])\n }\n const path = target ?? '.'\n return runSteps('Re-Test', [\n ['yarn', ['vitest', '--clearCache']],\n ['yarn', ['vitest', path]],\n ])\n}\n","import type { CommandModule } from 'yargs'\n\nimport { retest } from '../../actions/index.ts'\n\nexport const retestCommand: CommandModule = {\n command: 'retest [target]',\n describe: 'Re-Test - Run Vitest Tests with cleaned cache',\n builder: (yargs) => {\n return yargs.positional('target', { describe: 'Package name or file/folder path to test' })\n },\n handler: (argv) => {\n if (argv.verbose) console.log(`Re-Testing: ${argv.target ?? 'all'}`)\n process.exitCode = retest({ target: argv.target as string })\n },\n}\n"],"mappings":";AAAA,OAAO,WAAW;AAEX,IAAM,cAAc,CAAC,MAAc,QAAgB,QAA0B,SAAS,aAAa,UAAU;AAClH,M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","ex","ex","error","chalk","spawnSync","chalk","chalk","spawnSync"]}
|
|
@@ -57,8 +57,20 @@ var safeExit = (func, exitOnFail = true) => {
|
|
|
57
57
|
}
|
|
58
58
|
};
|
|
59
59
|
|
|
60
|
-
// src/lib/
|
|
60
|
+
// src/lib/yarn/workspace/yarnWorkspaces.ts
|
|
61
61
|
import { spawnSync } from "child_process";
|
|
62
|
+
var yarnWorkspaces = () => {
|
|
63
|
+
const result = spawnSync("yarn", ["workspaces", "list", "--json", "--recursive"], { encoding: "utf8", shell: true });
|
|
64
|
+
if (result.error) {
|
|
65
|
+
throw result.error;
|
|
66
|
+
}
|
|
67
|
+
return result.stdout.toString().split("\n").slice(0, -1).map((item) => {
|
|
68
|
+
return JSON.parse(item);
|
|
69
|
+
});
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
// src/lib/runSteps.ts
|
|
73
|
+
import { spawnSync as spawnSync2 } from "child_process";
|
|
62
74
|
import { existsSync } from "fs";
|
|
63
75
|
import chalk3 from "chalk";
|
|
64
76
|
var runSteps = (name, steps, exitOnFail = true, messages) => {
|
|
@@ -74,7 +86,7 @@ var runSteps = (name, steps, exitOnFail = true, messages) => {
|
|
|
74
86
|
if (command === "node" && !existsSync(argList[0])) {
|
|
75
87
|
throw new Error(`File not found [${argList[0]}]`);
|
|
76
88
|
}
|
|
77
|
-
const status =
|
|
89
|
+
const status = spawnSync2(command, Array.isArray(args) ? args : args.split(" "), {
|
|
78
90
|
...config,
|
|
79
91
|
encoding: "utf8",
|
|
80
92
|
env: { FORCE_COLOR: "3", ...process.env },
|
|
@@ -89,17 +101,27 @@ var runSteps = (name, steps, exitOnFail = true, messages) => {
|
|
|
89
101
|
};
|
|
90
102
|
|
|
91
103
|
// src/actions/test.ts
|
|
92
|
-
|
|
93
|
-
return
|
|
104
|
+
function isWorkspace(target) {
|
|
105
|
+
return yarnWorkspaces().some((ws) => ws.name === target);
|
|
106
|
+
}
|
|
107
|
+
var test = ({ target } = {}) => {
|
|
108
|
+
if (target && isWorkspace(target)) {
|
|
109
|
+
return runSteps(`Test [${target}]`, [["yarn", ["workspace", target, "run", "vitest", "."]]]);
|
|
110
|
+
}
|
|
111
|
+
const path = target ?? ".";
|
|
112
|
+
return runSteps("Test", [["yarn", ["vitest", path]]]);
|
|
94
113
|
};
|
|
95
114
|
|
|
96
115
|
// src/xy/common/testCommand.ts
|
|
97
116
|
var testCommand = {
|
|
98
|
-
command: "test",
|
|
99
|
-
describe: "Test - Run
|
|
117
|
+
command: "test [target]",
|
|
118
|
+
describe: "Test - Run Vitest Tests",
|
|
119
|
+
builder: (yargs) => {
|
|
120
|
+
return yargs.positional("target", { describe: "Package name or file/folder path to test" });
|
|
121
|
+
},
|
|
100
122
|
handler: (argv) => {
|
|
101
|
-
if (argv.verbose) console.log(
|
|
102
|
-
process.exitCode = test();
|
|
123
|
+
if (argv.verbose) console.log(`Testing: ${argv.target ?? "all"}`);
|
|
124
|
+
process.exitCode = test({ target: argv.target });
|
|
103
125
|
}
|
|
104
126
|
};
|
|
105
127
|
export {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../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/test.ts","../../../src/xy/common/testCommand.ts"],"sourcesContent":["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' | 'npm' | 'vitest', /* 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 { runSteps } from '../lib/index.ts'\n\nexport const test = () => {\n return runSteps(
|
|
1
|
+
{"version":3,"sources":["../../../src/lib/checkResult.ts","../../../src/lib/processEx.ts","../../../src/lib/withError.ts","../../../src/lib/withErrnoException.ts","../../../src/lib/safeExit.ts","../../../src/lib/yarn/workspace/yarnWorkspaces.ts","../../../src/lib/runSteps.ts","../../../src/actions/test.ts","../../../src/xy/common/testCommand.ts"],"sourcesContent":["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 { spawnSync } from 'node:child_process'\n\nimport type { Workspace } from './Workspace.ts'\n\nexport const yarnWorkspaces = (): Workspace[] => {\n const result = spawnSync('yarn', ['workspaces', 'list', '--json', '--recursive'], { encoding: 'utf8', shell: true })\n if (result.error) {\n throw result.error\n }\n return (\n result.stdout\n .toString()\n // NOTE: This probably doesn't work on Windows\n // TODO: Replace /r/n with /n first\n .split('\\n')\n .slice(0, -1)\n .map((item) => {\n return JSON.parse(item)\n })\n )\n}\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' | 'npm' | 'vitest', /* 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 { runSteps, yarnWorkspaces } from '../lib/index.ts'\n\nexport interface TestParams {\n target?: string\n}\n\nfunction isWorkspace(target: string): boolean {\n return yarnWorkspaces().some(ws => ws.name === target)\n}\n\nexport const test = ({ target }: TestParams = {}) => {\n if (target && isWorkspace(target)) {\n return runSteps(`Test [${target}]`, [['yarn', ['workspace', target, 'run', 'vitest', '.']]])\n }\n const path = target ?? '.'\n return runSteps('Test', [['yarn', ['vitest', path]]])\n}\n","import type { CommandModule } from 'yargs'\n\nimport { test } from '../../actions/index.ts'\n\nexport const testCommand: CommandModule = {\n command: 'test [target]',\n describe: 'Test - Run Vitest Tests',\n builder: (yargs) => {\n return yargs.positional('target', { describe: 'Package name or file/folder path to test' })\n },\n handler: (argv) => {\n if (argv.verbose) console.log(`Testing: ${argv.target ?? 'all'}`)\n process.exitCode = test({ target: argv.target as string })\n },\n}\n"],"mappings":";AAAA,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,OAAOA,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,OAAM,IAAI,EAAE,CAAC;AAAA,IACjD;AACA,WAAOA,OAAM,SAAS;AAAA,EACxB,CAAC,KACE,UAAU,OAAO,CAACA,WAAU;AAC7B,YAAQ,MAAMC,OAAM,IAAI,GAAGD,OAAM,IAAI,KAAKA,OAAM,OAAO,EAAE,CAAC;AAC1D,WAAO;AAAA,EACT,CAAC,MACG,MAAM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AAiB,CAAC;AAAA,EAC3D;AACF;","names":["chalk","ex","ex","error","chalk","spawnSync","chalk","chalk","spawnSync"]}
|
package/dist/xy/index.mjs
CHANGED
|
@@ -2803,10 +2803,20 @@ var relintAllPackages = ({ fix: fix2 = false } = {}) => {
|
|
|
2803
2803
|
};
|
|
2804
2804
|
|
|
2805
2805
|
// src/actions/retest.ts
|
|
2806
|
-
|
|
2807
|
-
return
|
|
2806
|
+
function isWorkspace(target) {
|
|
2807
|
+
return yarnWorkspaces().some((ws) => ws.name === target);
|
|
2808
|
+
}
|
|
2809
|
+
var retest = ({ target } = {}) => {
|
|
2810
|
+
if (target && isWorkspace(target)) {
|
|
2811
|
+
return runSteps(`Re-Test [${target}]`, [
|
|
2812
|
+
["yarn", ["workspace", target, "run", "vitest", "--clearCache"]],
|
|
2813
|
+
["yarn", ["workspace", target, "run", "vitest", "."]]
|
|
2814
|
+
]);
|
|
2815
|
+
}
|
|
2816
|
+
const path8 = target ?? ".";
|
|
2817
|
+
return runSteps("Re-Test", [
|
|
2808
2818
|
["yarn", ["vitest", "--clearCache"]],
|
|
2809
|
-
["yarn", ["vitest",
|
|
2819
|
+
["yarn", ["vitest", path8]]
|
|
2810
2820
|
]);
|
|
2811
2821
|
};
|
|
2812
2822
|
|
|
@@ -2825,8 +2835,15 @@ var statics = () => {
|
|
|
2825
2835
|
};
|
|
2826
2836
|
|
|
2827
2837
|
// src/actions/test.ts
|
|
2828
|
-
|
|
2829
|
-
return
|
|
2838
|
+
function isWorkspace2(target) {
|
|
2839
|
+
return yarnWorkspaces().some((ws) => ws.name === target);
|
|
2840
|
+
}
|
|
2841
|
+
var test = ({ target } = {}) => {
|
|
2842
|
+
if (target && isWorkspace2(target)) {
|
|
2843
|
+
return runSteps(`Test [${target}]`, [["yarn", ["workspace", target, "run", "vitest", "."]]]);
|
|
2844
|
+
}
|
|
2845
|
+
const path8 = target ?? ".";
|
|
2846
|
+
return runSteps("Test", [["yarn", ["vitest", path8]]]);
|
|
2830
2847
|
};
|
|
2831
2848
|
|
|
2832
2849
|
// src/actions/up.ts
|
|
@@ -3218,21 +3235,27 @@ var readmeCommand = {
|
|
|
3218
3235
|
|
|
3219
3236
|
// src/xy/common/retestCommand.ts
|
|
3220
3237
|
var retestCommand = {
|
|
3221
|
-
command: "retest",
|
|
3222
|
-
describe: "Re-Test - Run
|
|
3238
|
+
command: "retest [target]",
|
|
3239
|
+
describe: "Re-Test - Run Vitest Tests with cleaned cache",
|
|
3240
|
+
builder: (yargs2) => {
|
|
3241
|
+
return yargs2.positional("target", { describe: "Package name or file/folder path to test" });
|
|
3242
|
+
},
|
|
3223
3243
|
handler: (argv) => {
|
|
3224
|
-
if (argv.verbose) console.log(
|
|
3225
|
-
process.exitCode = retest();
|
|
3244
|
+
if (argv.verbose) console.log(`Re-Testing: ${argv.target ?? "all"}`);
|
|
3245
|
+
process.exitCode = retest({ target: argv.target });
|
|
3226
3246
|
}
|
|
3227
3247
|
};
|
|
3228
3248
|
|
|
3229
3249
|
// src/xy/common/testCommand.ts
|
|
3230
3250
|
var testCommand = {
|
|
3231
|
-
command: "test",
|
|
3232
|
-
describe: "Test - Run
|
|
3251
|
+
command: "test [target]",
|
|
3252
|
+
describe: "Test - Run Vitest Tests",
|
|
3253
|
+
builder: (yargs2) => {
|
|
3254
|
+
return yargs2.positional("target", { describe: "Package name or file/folder path to test" });
|
|
3255
|
+
},
|
|
3233
3256
|
handler: (argv) => {
|
|
3234
|
-
if (argv.verbose) console.log(
|
|
3235
|
-
process.exitCode = test();
|
|
3257
|
+
if (argv.verbose) console.log(`Testing: ${argv.target ?? "all"}`);
|
|
3258
|
+
process.exitCode = test({ target: argv.target });
|
|
3236
3259
|
}
|
|
3237
3260
|
};
|
|
3238
3261
|
|