@xylabs/ts-scripts-yarn3 7.4.17 → 7.4.19
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/README.body.md +86 -0
- package/README.md +108 -0
- package/dist/actions/claude-commands.mjs +1 -1
- package/dist/actions/claude-commands.mjs.map +1 -1
- package/dist/actions/claude-rules.mjs +1 -1
- package/dist/actions/claude-rules.mjs.map +1 -1
- package/dist/actions/compile.mjs.map +1 -1
- package/dist/actions/cycle.mjs.map +1 -1
- package/dist/actions/dead.mjs.map +1 -1
- package/dist/actions/deplint/checkPackage/checkPackage.mjs +3 -0
- package/dist/actions/deplint/checkPackage/checkPackage.mjs.map +1 -1
- package/dist/actions/deplint/checkPackage/index.mjs +3 -0
- package/dist/actions/deplint/checkPackage/index.mjs.map +1 -1
- package/dist/actions/deplint/deplint.mjs +3 -0
- package/dist/actions/deplint/deplint.mjs.map +1 -1
- package/dist/actions/deplint/getExternalImportsFromFiles.mjs +3 -0
- package/dist/actions/deplint/getExternalImportsFromFiles.mjs.map +1 -1
- package/dist/actions/deplint/getImportsFromFile.mjs +3 -0
- package/dist/actions/deplint/getImportsFromFile.mjs.map +1 -1
- package/dist/actions/deplint/index.mjs +3 -0
- package/dist/actions/deplint/index.mjs.map +1 -1
- package/dist/actions/deploy-major.mjs.map +1 -1
- package/dist/actions/deploy-minor.mjs.map +1 -1
- package/dist/actions/deploy-next.mjs.map +1 -1
- package/dist/actions/deploy.mjs.map +1 -1
- package/dist/actions/fix.mjs.map +1 -1
- package/dist/actions/gen-docs.mjs.map +1 -1
- package/dist/actions/index.mjs +149 -41
- package/dist/actions/index.mjs.map +1 -1
- package/dist/actions/knip.mjs.map +1 -1
- package/dist/actions/lint.mjs.map +1 -1
- package/dist/actions/publint.mjs.map +1 -1
- package/dist/actions/publish.mjs.map +1 -1
- package/dist/actions/readme-gen.mjs +136 -20
- package/dist/actions/readme-gen.mjs.map +1 -1
- package/dist/actions/readme-init.mjs +83 -0
- package/dist/actions/readme-init.mjs.map +1 -0
- package/dist/actions/rebuild.mjs.map +1 -1
- package/dist/actions/reinstall.mjs.map +1 -1
- package/dist/actions/relint.mjs.map +1 -1
- package/dist/actions/retest.mjs +2 -2
- package/dist/actions/retest.mjs.map +1 -1
- package/dist/actions/sonar.mjs.map +1 -1
- package/dist/actions/test.mjs.map +1 -1
- package/dist/actions/up.mjs.map +1 -1
- package/dist/actions/updo.mjs.map +1 -1
- package/dist/actions/upplug.mjs.map +1 -1
- package/dist/actions/upyarn.mjs.map +1 -1
- package/dist/bin/xy.mjs +820 -576
- package/dist/bin/xy.mjs.map +1 -1
- package/dist/index.d.ts +42 -13
- package/dist/index.mjs +823 -573
- package/dist/index.mjs.map +1 -1
- package/dist/lib/claudeMdTemplate.mjs +1 -1
- package/dist/lib/claudeMdTemplate.mjs.map +1 -1
- package/dist/lib/generateReadmeFiles.mjs +118 -21
- package/dist/lib/generateReadmeFiles.mjs.map +1 -1
- package/dist/lib/index.mjs +120 -23
- package/dist/lib/index.mjs.map +1 -1
- package/dist/lib/runSteps.mjs.map +1 -1
- package/dist/lib/runXy.mjs.map +1 -1
- package/dist/xy/build/buildCommand.mjs +161 -0
- package/dist/xy/build/buildCommand.mjs.map +1 -0
- package/dist/xy/build/compileCommand.mjs +174 -0
- package/dist/xy/build/compileCommand.mjs.map +1 -0
- package/dist/xy/build/compileOnlyCommand.mjs +175 -0
- package/dist/xy/build/compileOnlyCommand.mjs.map +1 -0
- package/dist/xy/build/copyAssetsCommand.mjs +84 -0
- package/dist/xy/build/copyAssetsCommand.mjs.map +1 -0
- package/dist/xy/{xyBuildCommands.mjs → build/index.mjs} +111 -93
- package/dist/xy/build/index.mjs.map +1 -0
- package/dist/xy/build/rebuildCommand.mjs +114 -0
- package/dist/xy/build/rebuildCommand.mjs.map +1 -0
- package/dist/xy/build/recompileCommand.mjs +204 -0
- package/dist/xy/build/recompileCommand.mjs.map +1 -0
- package/dist/xy/common/claude/commandsCommand.mjs +107 -0
- package/dist/xy/common/claude/commandsCommand.mjs.map +1 -0
- package/dist/xy/common/claude/index.mjs +332 -0
- package/dist/xy/common/claude/index.mjs.map +1 -0
- package/dist/xy/common/claude/initCommand.mjs +283 -0
- package/dist/xy/common/claude/initCommand.mjs.map +1 -0
- package/dist/xy/common/claude/rulesCommand.mjs +129 -0
- package/dist/xy/common/claude/rulesCommand.mjs.map +1 -0
- package/dist/xy/common/claude/settingsCommand.mjs +90 -0
- package/dist/xy/common/claude/settingsCommand.mjs.map +1 -0
- package/dist/xy/common/cleanDocsCommand.mjs +45 -0
- package/dist/xy/common/cleanDocsCommand.mjs.map +1 -0
- package/dist/xy/common/deadCommand.mjs +116 -0
- package/dist/xy/common/deadCommand.mjs.map +1 -0
- package/dist/xy/common/genDocsCommand.mjs +125 -0
- package/dist/xy/common/genDocsCommand.mjs.map +1 -0
- package/dist/xy/common/gitignoreGenCommand.mjs +98 -0
- package/dist/xy/common/gitignoreGenCommand.mjs.map +1 -0
- package/dist/xy/common/gitlintCommand.mjs +82 -0
- package/dist/xy/common/gitlintCommand.mjs.map +1 -0
- package/dist/xy/{xyCommonCommands.mjs → common/index.mjs} +451 -241
- package/dist/xy/common/index.mjs.map +1 -0
- package/dist/xy/common/licenseCommand.mjs +100 -0
- package/dist/xy/common/licenseCommand.mjs.map +1 -0
- package/dist/xy/common/npmignoreGenCommand.mjs +98 -0
- package/dist/xy/common/npmignoreGenCommand.mjs.map +1 -0
- package/dist/xy/common/readme/genCommand.mjs +321 -0
- package/dist/xy/common/readme/genCommand.mjs.map +1 -0
- package/dist/xy/common/readme/index.mjs +361 -0
- package/dist/xy/common/readme/index.mjs.map +1 -0
- package/dist/xy/common/readme/initCommand.mjs +103 -0
- package/dist/xy/common/readme/initCommand.mjs.map +1 -0
- package/dist/xy/common/retestCommand.mjs +111 -0
- package/dist/xy/common/retestCommand.mjs.map +1 -0
- package/dist/xy/common/testCommand.mjs +108 -0
- package/dist/xy/common/testCommand.mjs.map +1 -0
- package/dist/xy/common/upplugCommand.mjs +113 -0
- package/dist/xy/common/upplugCommand.mjs.map +1 -0
- package/dist/xy/common/upyarnCommand.mjs +108 -0
- package/dist/xy/common/upyarnCommand.mjs.map +1 -0
- package/dist/xy/common/yarn3OnlyCommand.mjs +70 -0
- package/dist/xy/common/yarn3OnlyCommand.mjs.map +1 -0
- package/dist/xy/deploy/deployCommand.mjs +139 -0
- package/dist/xy/deploy/deployCommand.mjs.map +1 -0
- package/dist/xy/deploy/deployMajorCommand.mjs +139 -0
- package/dist/xy/deploy/deployMajorCommand.mjs.map +1 -0
- package/dist/xy/deploy/deployMinorCommand.mjs +139 -0
- package/dist/xy/deploy/deployMinorCommand.mjs.map +1 -0
- package/dist/xy/deploy/deployNextCommand.mjs +139 -0
- package/dist/xy/deploy/deployNextCommand.mjs.map +1 -0
- package/dist/xy/{xyDeployCommands.mjs → deploy/index.mjs} +53 -53
- package/dist/xy/deploy/index.mjs.map +1 -0
- package/dist/xy/deploy/publishCommand.mjs +108 -0
- package/dist/xy/deploy/publishCommand.mjs.map +1 -0
- package/dist/xy/index.mjs +820 -576
- package/dist/xy/index.mjs.map +1 -1
- package/dist/xy/install/cleanCommand.mjs +140 -0
- package/dist/xy/install/cleanCommand.mjs.map +1 -0
- package/dist/xy/install/dupdepsCommand.mjs +191 -0
- package/dist/xy/install/dupdepsCommand.mjs.map +1 -0
- package/dist/xy/{xyInstallCommands.mjs → install/index.mjs} +71 -68
- package/dist/xy/install/index.mjs.map +1 -0
- package/dist/xy/install/reinstallCommand.mjs +140 -0
- package/dist/xy/install/reinstallCommand.mjs.map +1 -0
- package/dist/xy/install/staticsCommand.mjs +191 -0
- package/dist/xy/install/staticsCommand.mjs.map +1 -0
- package/dist/{actions/clean-jest.mjs → xy/install/upCommand.mjs} +15 -6
- package/dist/xy/install/upCommand.mjs.map +1 -0
- package/dist/xy/install/updoCommand.mjs +112 -0
- package/dist/xy/install/updoCommand.mjs.map +1 -0
- package/dist/xy/lint/cycleCommand.mjs +163 -0
- package/dist/xy/lint/cycleCommand.mjs.map +1 -0
- package/dist/xy/lint/deplintCommand.mjs +814 -0
- package/dist/xy/lint/deplintCommand.mjs.map +1 -0
- package/dist/xy/lint/fixCommand.mjs +168 -0
- package/dist/xy/lint/fixCommand.mjs.map +1 -0
- package/dist/xy/{xyLintCommands.mjs → lint/index.mjs} +179 -145
- package/dist/xy/lint/index.mjs.map +1 -0
- package/dist/xy/lint/knipCommand.mjs +121 -0
- package/dist/xy/lint/knipCommand.mjs.map +1 -0
- package/dist/xy/lint/lintCommand.mjs +186 -0
- package/dist/xy/lint/lintCommand.mjs.map +1 -0
- package/dist/xy/lint/publintCommand.mjs +187 -0
- package/dist/xy/lint/publintCommand.mjs.map +1 -0
- package/dist/xy/lint/relintCommand.mjs +163 -0
- package/dist/xy/lint/relintCommand.mjs.map +1 -0
- package/dist/xy/lint/sonarCommand.mjs +121 -0
- package/dist/xy/lint/sonarCommand.mjs.map +1 -0
- package/dist/xy/xy.mjs +818 -574
- package/dist/xy/xy.mjs.map +1 -1
- package/package.json +2 -2
- package/templates/readme/README.body.md +11 -0
- package/templates/readme/README.template.md +22 -0
- package/dist/actions/clean-jest.mjs.map +0 -1
- package/dist/xy/xyBuildCommands.mjs.map +0 -1
- package/dist/xy/xyCommonCommands.mjs.map +0 -1
- package/dist/xy/xyDeployCommands.mjs.map +0 -1
- package/dist/xy/xyInstallCommands.mjs.map +0 -1
- package/dist/xy/xyLintCommands.mjs.map +0 -1
- /package/templates/{CLAUDE-project.md → claude/CLAUDE-project.md} +0 -0
- /package/templates/{commands → claude/commands}/xylabs-build.md +0 -0
- /package/templates/{commands → claude/commands}/xylabs-clean.md +0 -0
- /package/templates/{commands → claude/commands}/xylabs-compile.md +0 -0
- /package/templates/{commands → claude/commands}/xylabs-cycle.md +0 -0
- /package/templates/{commands → claude/commands}/xylabs-deplint.md +0 -0
- /package/templates/{commands → claude/commands}/xylabs-deploy-major.md +0 -0
- /package/templates/{commands → claude/commands}/xylabs-deploy-minor.md +0 -0
- /package/templates/{commands → claude/commands}/xylabs-deploy.md +0 -0
- /package/templates/{commands → claude/commands}/xylabs-fix.md +0 -0
- /package/templates/{commands → claude/commands}/xylabs-knip.md +0 -0
- /package/templates/{commands → claude/commands}/xylabs-lint.md +0 -0
- /package/templates/{commands → claude/commands}/xylabs-publint.md +0 -0
- /package/templates/{commands → claude/commands}/xylabs-rebuild.md +0 -0
- /package/templates/{commands → claude/commands}/xylabs-test.md +0 -0
- /package/templates/{rules → claude/rules}/xylabs-architecture.md +0 -0
- /package/templates/{rules → claude/rules}/xylabs-build.md +0 -0
- /package/templates/{rules → claude/rules}/xylabs-dependencies.md +0 -0
- /package/templates/{rules → claude/rules}/xylabs-error-handling.md +0 -0
- /package/templates/{rules → claude/rules}/xylabs-frameworks.md +0 -0
- /package/templates/{rules → claude/rules}/xylabs-git-workflow.md +0 -0
- /package/templates/{rules → claude/rules}/xylabs-linting.md +0 -0
- /package/templates/{rules → claude/rules}/xylabs-naming.md +0 -0
- /package/templates/{rules → claude/rules}/xylabs-style.md +0 -0
- /package/templates/{rules → claude/rules}/xylabs-typescript.md +0 -0
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
// src/lib/checkResult.ts
|
|
2
|
+
import chalk from "chalk";
|
|
3
|
+
var checkResult = (name, result, level = "error", exitOnFail = false) => {
|
|
4
|
+
if (result) {
|
|
5
|
+
const exiting = exitOnFail ? "[Exiting Process]" : "[Continuing]";
|
|
6
|
+
const chalkFunc = level === "error" ? chalk.red : chalk.yellow;
|
|
7
|
+
console[level](chalkFunc(`${name} had ${result} failures ${exiting}`));
|
|
8
|
+
if (exitOnFail) {
|
|
9
|
+
process.exit(result);
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
// src/lib/processEx.ts
|
|
15
|
+
import chalk2 from "chalk";
|
|
16
|
+
|
|
17
|
+
// src/lib/withError.ts
|
|
18
|
+
var withError = (ex, closure, predicate = (ex2) => !!ex2.name && !!ex2.message) => {
|
|
19
|
+
return predicate(ex) ? closure(ex) : void 0;
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
// src/lib/withErrnoException.ts
|
|
23
|
+
var withErrnoException = (ex, closure) => {
|
|
24
|
+
return withError(ex, closure, (ex2) => ex2.errno !== void 0);
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
// src/lib/processEx.ts
|
|
28
|
+
var processEx = (ex) => {
|
|
29
|
+
const error = typeof ex === "string" ? new Error(ex) : ex;
|
|
30
|
+
const exitCode = withErrnoException(error, (error2) => {
|
|
31
|
+
if (error2.code === "ENOENT") {
|
|
32
|
+
console.error(chalk2.red(`'${error2.path}' not found.`));
|
|
33
|
+
} else {
|
|
34
|
+
console.error(chalk2.red(`Errno: ${error2.code}`));
|
|
35
|
+
}
|
|
36
|
+
return error2.errno ?? -1;
|
|
37
|
+
}) ?? withError(error, (error2) => {
|
|
38
|
+
console.error(chalk2.red(`${error2.name}: ${error2.message}`));
|
|
39
|
+
return -1;
|
|
40
|
+
}) ?? (() => {
|
|
41
|
+
console.error(chalk2.red(`Unexpected Error: ${JSON.stringify(ex, null, 2)}`));
|
|
42
|
+
return -1;
|
|
43
|
+
})();
|
|
44
|
+
process.exit(process.exitCode ?? exitCode);
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
// src/lib/safeExit.ts
|
|
48
|
+
var safeExit = (func, exitOnFail = true) => {
|
|
49
|
+
try {
|
|
50
|
+
const result = func();
|
|
51
|
+
if (result && exitOnFail) {
|
|
52
|
+
process.exit(result);
|
|
53
|
+
}
|
|
54
|
+
return result;
|
|
55
|
+
} catch (ex) {
|
|
56
|
+
return processEx(ex);
|
|
57
|
+
}
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
// src/lib/yarn/workspace/yarnWorkspaces.ts
|
|
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";
|
|
74
|
+
import { existsSync } from "fs";
|
|
75
|
+
import chalk3 from "chalk";
|
|
76
|
+
var runSteps = (name, steps, exitOnFail = true, messages) => {
|
|
77
|
+
return safeExit(() => {
|
|
78
|
+
const pkgName = process.env.npm_package_name;
|
|
79
|
+
console.log(chalk3.green(`${name} [${pkgName}]`));
|
|
80
|
+
let totalStatus = 0;
|
|
81
|
+
for (const [i, [command, args, config]] of steps.entries()) {
|
|
82
|
+
if (messages?.[i]) {
|
|
83
|
+
console.log(chalk3.gray(messages?.[i]));
|
|
84
|
+
}
|
|
85
|
+
const argList = Array.isArray(args) ? args : args.split(" ");
|
|
86
|
+
if (command === "node" && !existsSync(argList[0])) {
|
|
87
|
+
throw new Error(`File not found [${argList[0]}]`);
|
|
88
|
+
}
|
|
89
|
+
const status = spawnSync2(command, Array.isArray(args) ? args : args.split(" "), {
|
|
90
|
+
...config,
|
|
91
|
+
encoding: "utf8",
|
|
92
|
+
env: { FORCE_COLOR: "3", ...process.env },
|
|
93
|
+
shell: true,
|
|
94
|
+
stdio: "inherit"
|
|
95
|
+
}).status ?? 0;
|
|
96
|
+
checkResult(name, status, "error", exitOnFail);
|
|
97
|
+
totalStatus += status ?? 0;
|
|
98
|
+
}
|
|
99
|
+
return totalStatus;
|
|
100
|
+
}, !!exitOnFail);
|
|
101
|
+
};
|
|
102
|
+
|
|
103
|
+
// src/actions/deploy-major.ts
|
|
104
|
+
import { readFileSync } from "fs";
|
|
105
|
+
var privatePackageExcludeList = () => {
|
|
106
|
+
const possibleDeployablePackages = yarnWorkspaces().map((workspace) => [
|
|
107
|
+
workspace,
|
|
108
|
+
JSON.parse(readFileSync(`${workspace.location}/package.json`, { encoding: "utf8" }))
|
|
109
|
+
]);
|
|
110
|
+
const privatePackages = possibleDeployablePackages.filter(([_, pkg]) => pkg.private).map(([workspace]) => workspace);
|
|
111
|
+
const excludeList = privatePackages.map((workspace) => `--exclude ${workspace.name}`);
|
|
112
|
+
return excludeList;
|
|
113
|
+
};
|
|
114
|
+
var deployMajor = () => {
|
|
115
|
+
const excludeList = privatePackageExcludeList();
|
|
116
|
+
if (excludeList.length > 0) {
|
|
117
|
+
console.log("Excluding private packages from deployment:", excludeList);
|
|
118
|
+
}
|
|
119
|
+
return runSteps("Deploy [Major]", [
|
|
120
|
+
["yarn", "workspaces foreach --all version major --deferred"],
|
|
121
|
+
["yarn", "xy clean"],
|
|
122
|
+
["yarn", "xy build"],
|
|
123
|
+
["yarn", "version apply --all"]
|
|
124
|
+
]);
|
|
125
|
+
};
|
|
126
|
+
|
|
127
|
+
// src/xy/deploy/deployMajorCommand.ts
|
|
128
|
+
var deployMajorCommand = {
|
|
129
|
+
command: "deploy-major",
|
|
130
|
+
describe: "Deploy - Deploy major",
|
|
131
|
+
handler: (argv) => {
|
|
132
|
+
if (argv.verbose) console.log("Deploy major");
|
|
133
|
+
process.exitCode = deployMajor();
|
|
134
|
+
}
|
|
135
|
+
};
|
|
136
|
+
export {
|
|
137
|
+
deployMajorCommand
|
|
138
|
+
};
|
|
139
|
+
//# sourceMappingURL=deployMajorCommand.mjs.map
|
|
@@ -0,0 +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/yarn/workspace/yarnWorkspaces.ts","../../../src/lib/runSteps.ts","../../../src/actions/deploy-major.ts","../../../src/xy/deploy/deployMajorCommand.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 { readFileSync } from 'node:fs'\n\nimport type { Workspace } from '../lib/index.ts'\nimport { runSteps, yarnWorkspaces } from '../lib/index.ts'\n\nconst privatePackageExcludeList = () => {\n const possibleDeployablePackages: [Workspace, { private?: boolean }][] = yarnWorkspaces().map(workspace => [workspace,\n JSON.parse(readFileSync(`${workspace.location}/package.json`, { encoding: 'utf8' })) as object])\n\n const privatePackages = possibleDeployablePackages.filter(([_, pkg]) => pkg.private).map(([workspace]) => workspace)\n const excludeList = privatePackages.map(workspace => `--exclude ${workspace.name}`)\n return excludeList\n}\n\nexport const deployMajor = () => {\n const excludeList = privatePackageExcludeList()\n if (excludeList.length > 0) {\n console.log('Excluding private packages from deployment:', excludeList)\n }\n return runSteps('Deploy [Major]', [\n ['yarn', 'workspaces foreach --all version major --deferred'],\n ['yarn', 'xy clean'],\n ['yarn', 'xy build'],\n ['yarn', 'version apply --all'],\n ])\n}\n","import type { CommandModule } from 'yargs'\n\nimport { deployMajor } from '../../actions/index.ts'\n\nexport const deployMajorCommand: CommandModule = {\n command: 'deploy-major',\n describe: 'Deploy - Deploy major',\n handler: (argv) => {\n if (argv.verbose) console.log('Deploy major')\n process.exitCode = deployMajor()\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,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A,IAC1G,KAAK,MAAM,aAAa,GAAG,UAAU,QAAQ,iBAAiB,EAAE,UAAU,OAAO,CAAC,CAAC;AAAA,EAAW,CAAC;AAEjG,QAAM,kBAAkB,2BAA2B,OAAO,CAAC,CAAC,GAAG,GAAG,MAAM,IAAI,OAAO,EAAE,IAAI,CAAC,CAAC,SAAS,MAAM,SAAS;AACnH,QAAM,cAAc,gBAAgB,IAAI,eAAa,aAAa,UAAU,IAAI,EAAE;AAClF,SAAO;AACT;AAEO,IAAM,cAAc,MAAM;AAC/B,QAAM,cAAc,0BAA0B;AAC9C,MAAI,YAAY,SAAS,GAAG;AAC1B,YAAQ,IAAI,+CAA+C,WAAW;AAAA,EACxE;AACA,SAAO,SAAS,kBAAkB;AAAA,IAChC,CAAC,QAAQ,mDAAmD;AAAA,IAC5D,CAAC,QAAQ,UAAU;AAAA,IACnB,CAAC,QAAQ,UAAU;AAAA,IACnB,CAAC,QAAQ,qBAAqB;AAAA,EAChC,CAAC;AACH;;;ACrBO,IAAM,qBAAoC;AAAA,EAC/C,SAAS;AAAA,EACT,UAAU;AAAA,EACV,SAAS,CAAC,SAAS;AACjB,QAAI,KAAK,QAAS,SAAQ,IAAI,cAAc;AAC5C,YAAQ,WAAW,YAAY;AAAA,EACjC;AACF;","names":["chalk","ex","ex","error","chalk","spawnSync","chalk","chalk","spawnSync"]}
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
// src/lib/checkResult.ts
|
|
2
|
+
import chalk from "chalk";
|
|
3
|
+
var checkResult = (name, result, level = "error", exitOnFail = false) => {
|
|
4
|
+
if (result) {
|
|
5
|
+
const exiting = exitOnFail ? "[Exiting Process]" : "[Continuing]";
|
|
6
|
+
const chalkFunc = level === "error" ? chalk.red : chalk.yellow;
|
|
7
|
+
console[level](chalkFunc(`${name} had ${result} failures ${exiting}`));
|
|
8
|
+
if (exitOnFail) {
|
|
9
|
+
process.exit(result);
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
// src/lib/processEx.ts
|
|
15
|
+
import chalk2 from "chalk";
|
|
16
|
+
|
|
17
|
+
// src/lib/withError.ts
|
|
18
|
+
var withError = (ex, closure, predicate = (ex2) => !!ex2.name && !!ex2.message) => {
|
|
19
|
+
return predicate(ex) ? closure(ex) : void 0;
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
// src/lib/withErrnoException.ts
|
|
23
|
+
var withErrnoException = (ex, closure) => {
|
|
24
|
+
return withError(ex, closure, (ex2) => ex2.errno !== void 0);
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
// src/lib/processEx.ts
|
|
28
|
+
var processEx = (ex) => {
|
|
29
|
+
const error = typeof ex === "string" ? new Error(ex) : ex;
|
|
30
|
+
const exitCode = withErrnoException(error, (error2) => {
|
|
31
|
+
if (error2.code === "ENOENT") {
|
|
32
|
+
console.error(chalk2.red(`'${error2.path}' not found.`));
|
|
33
|
+
} else {
|
|
34
|
+
console.error(chalk2.red(`Errno: ${error2.code}`));
|
|
35
|
+
}
|
|
36
|
+
return error2.errno ?? -1;
|
|
37
|
+
}) ?? withError(error, (error2) => {
|
|
38
|
+
console.error(chalk2.red(`${error2.name}: ${error2.message}`));
|
|
39
|
+
return -1;
|
|
40
|
+
}) ?? (() => {
|
|
41
|
+
console.error(chalk2.red(`Unexpected Error: ${JSON.stringify(ex, null, 2)}`));
|
|
42
|
+
return -1;
|
|
43
|
+
})();
|
|
44
|
+
process.exit(process.exitCode ?? exitCode);
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
// src/lib/safeExit.ts
|
|
48
|
+
var safeExit = (func, exitOnFail = true) => {
|
|
49
|
+
try {
|
|
50
|
+
const result = func();
|
|
51
|
+
if (result && exitOnFail) {
|
|
52
|
+
process.exit(result);
|
|
53
|
+
}
|
|
54
|
+
return result;
|
|
55
|
+
} catch (ex) {
|
|
56
|
+
return processEx(ex);
|
|
57
|
+
}
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
// src/lib/yarn/workspace/yarnWorkspaces.ts
|
|
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";
|
|
74
|
+
import { existsSync } from "fs";
|
|
75
|
+
import chalk3 from "chalk";
|
|
76
|
+
var runSteps = (name, steps, exitOnFail = true, messages) => {
|
|
77
|
+
return safeExit(() => {
|
|
78
|
+
const pkgName = process.env.npm_package_name;
|
|
79
|
+
console.log(chalk3.green(`${name} [${pkgName}]`));
|
|
80
|
+
let totalStatus = 0;
|
|
81
|
+
for (const [i, [command, args, config]] of steps.entries()) {
|
|
82
|
+
if (messages?.[i]) {
|
|
83
|
+
console.log(chalk3.gray(messages?.[i]));
|
|
84
|
+
}
|
|
85
|
+
const argList = Array.isArray(args) ? args : args.split(" ");
|
|
86
|
+
if (command === "node" && !existsSync(argList[0])) {
|
|
87
|
+
throw new Error(`File not found [${argList[0]}]`);
|
|
88
|
+
}
|
|
89
|
+
const status = spawnSync2(command, Array.isArray(args) ? args : args.split(" "), {
|
|
90
|
+
...config,
|
|
91
|
+
encoding: "utf8",
|
|
92
|
+
env: { FORCE_COLOR: "3", ...process.env },
|
|
93
|
+
shell: true,
|
|
94
|
+
stdio: "inherit"
|
|
95
|
+
}).status ?? 0;
|
|
96
|
+
checkResult(name, status, "error", exitOnFail);
|
|
97
|
+
totalStatus += status ?? 0;
|
|
98
|
+
}
|
|
99
|
+
return totalStatus;
|
|
100
|
+
}, !!exitOnFail);
|
|
101
|
+
};
|
|
102
|
+
|
|
103
|
+
// src/actions/deploy-minor.ts
|
|
104
|
+
import { readFileSync } from "fs";
|
|
105
|
+
var privatePackageExcludeList = () => {
|
|
106
|
+
const possibleDeployablePackages = yarnWorkspaces().map((workspace) => [
|
|
107
|
+
workspace,
|
|
108
|
+
JSON.parse(readFileSync(`${workspace.location}/package.json`, { encoding: "utf8" }))
|
|
109
|
+
]);
|
|
110
|
+
const privatePackages = possibleDeployablePackages.filter(([_, pkg]) => pkg.private).map(([workspace]) => workspace);
|
|
111
|
+
const excludeList = privatePackages.map((workspace) => `--exclude ${workspace.name}`);
|
|
112
|
+
return excludeList;
|
|
113
|
+
};
|
|
114
|
+
var deployMinor = () => {
|
|
115
|
+
const excludeList = privatePackageExcludeList();
|
|
116
|
+
if (excludeList.length > 0) {
|
|
117
|
+
console.log("Excluding private packages from deployment:", excludeList);
|
|
118
|
+
}
|
|
119
|
+
return runSteps("Deploy [Minor]", [
|
|
120
|
+
["yarn", "workspaces foreach --all version minor --deferred"],
|
|
121
|
+
["yarn", "xy clean"],
|
|
122
|
+
["yarn", "xy build"],
|
|
123
|
+
["yarn", "version apply --all"]
|
|
124
|
+
]);
|
|
125
|
+
};
|
|
126
|
+
|
|
127
|
+
// src/xy/deploy/deployMinorCommand.ts
|
|
128
|
+
var deployMinorCommand = {
|
|
129
|
+
command: "deploy-minor",
|
|
130
|
+
describe: "Deploy - Deploy minor",
|
|
131
|
+
handler: (argv) => {
|
|
132
|
+
if (argv.verbose) console.log("Deploy minor");
|
|
133
|
+
process.exitCode = deployMinor();
|
|
134
|
+
}
|
|
135
|
+
};
|
|
136
|
+
export {
|
|
137
|
+
deployMinorCommand
|
|
138
|
+
};
|
|
139
|
+
//# sourceMappingURL=deployMinorCommand.mjs.map
|
|
@@ -0,0 +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/yarn/workspace/yarnWorkspaces.ts","../../../src/lib/runSteps.ts","../../../src/actions/deploy-minor.ts","../../../src/xy/deploy/deployMinorCommand.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 { readFileSync } from 'node:fs'\n\nimport type { Workspace } from '../lib/index.ts'\nimport { runSteps, yarnWorkspaces } from '../lib/index.ts'\n\nconst privatePackageExcludeList = () => {\n const possibleDeployablePackages: [Workspace, { private?: boolean }][] = yarnWorkspaces().map(workspace => [workspace,\n JSON.parse(readFileSync(`${workspace.location}/package.json`, { encoding: 'utf8' })) as object])\n\n const privatePackages = possibleDeployablePackages.filter(([_, pkg]) => pkg.private).map(([workspace]) => workspace)\n const excludeList = privatePackages.map(workspace => `--exclude ${workspace.name}`)\n return excludeList\n}\n\nexport const deployMinor = () => {\n const excludeList = privatePackageExcludeList()\n if (excludeList.length > 0) {\n console.log('Excluding private packages from deployment:', excludeList)\n }\n return runSteps('Deploy [Minor]', [\n ['yarn', 'workspaces foreach --all version minor --deferred'],\n ['yarn', 'xy clean'],\n ['yarn', 'xy build'],\n ['yarn', 'version apply --all'],\n ])\n}\n","import type { CommandModule } from 'yargs'\n\nimport { deployMinor } from '../../actions/index.ts'\n\nexport const deployMinorCommand: CommandModule = {\n command: 'deploy-minor',\n describe: 'Deploy - Deploy minor',\n handler: (argv) => {\n if (argv.verbose) console.log('Deploy minor')\n process.exitCode = deployMinor()\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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AAA,EACT,GAAG,CAAC,CAAC,UAAU;AACjB;;;ACvCA,SAAS,oBAAoB;AAK7B,IAAM,4BAA4B,MAAM;AACtC,QAAM,6BAAmE,eAAe,EAAE,IAAI,eAAa;AAAA,IAAC;AAAA,IAC1G,KAAK,MAAM,aAAa,GAAG,UAAU,QAAQ,iBAAiB,EAAE,UAAU,OAAO,CAAC,CAAC;AAAA,EAAW,CAAC;AAEjG,QAAM,kBAAkB,2BAA2B,OAAO,CAAC,CAAC,GAAG,GAAG,MAAM,IAAI,OAAO,EAAE,IAAI,CAAC,CAAC,SAAS,MAAM,SAAS;AACnH,QAAM,cAAc,gBAAgB,IAAI,eAAa,aAAa,UAAU,IAAI,EAAE;AAClF,SAAO;AACT;AAEO,IAAM,cAAc,MAAM;AAC/B,QAAM,cAAc,0BAA0B;AAC9C,MAAI,YAAY,SAAS,GAAG;AAC1B,YAAQ,IAAI,+CAA+C,WAAW;AAAA,EACxE;AACA,SAAO,SAAS,kBAAkB;AAAA,IAChC,CAAC,QAAQ,mDAAmD;AAAA,IAC5D,CAAC,QAAQ,UAAU;AAAA,IACnB,CAAC,QAAQ,UAAU;AAAA,IACnB,CAAC,QAAQ,qBAAqB;AAAA,EAChC,CAAC;AACH;;;ACrBO,IAAM,qBAAoC;AAAA,EAC/C,SAAS;AAAA,EACT,UAAU;AAAA,EACV,SAAS,CAAC,SAAS;AACjB,QAAI,KAAK,QAAS,SAAQ,IAAI,cAAc;AAC5C,YAAQ,WAAW,YAAY;AAAA,EACjC;AACF;","names":["chalk","ex","ex","error","chalk","spawnSync","chalk","chalk","spawnSync"]}
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
// src/lib/checkResult.ts
|
|
2
|
+
import chalk from "chalk";
|
|
3
|
+
var checkResult = (name, result, level = "error", exitOnFail = false) => {
|
|
4
|
+
if (result) {
|
|
5
|
+
const exiting = exitOnFail ? "[Exiting Process]" : "[Continuing]";
|
|
6
|
+
const chalkFunc = level === "error" ? chalk.red : chalk.yellow;
|
|
7
|
+
console[level](chalkFunc(`${name} had ${result} failures ${exiting}`));
|
|
8
|
+
if (exitOnFail) {
|
|
9
|
+
process.exit(result);
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
// src/lib/processEx.ts
|
|
15
|
+
import chalk2 from "chalk";
|
|
16
|
+
|
|
17
|
+
// src/lib/withError.ts
|
|
18
|
+
var withError = (ex, closure, predicate = (ex2) => !!ex2.name && !!ex2.message) => {
|
|
19
|
+
return predicate(ex) ? closure(ex) : void 0;
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
// src/lib/withErrnoException.ts
|
|
23
|
+
var withErrnoException = (ex, closure) => {
|
|
24
|
+
return withError(ex, closure, (ex2) => ex2.errno !== void 0);
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
// src/lib/processEx.ts
|
|
28
|
+
var processEx = (ex) => {
|
|
29
|
+
const error = typeof ex === "string" ? new Error(ex) : ex;
|
|
30
|
+
const exitCode = withErrnoException(error, (error2) => {
|
|
31
|
+
if (error2.code === "ENOENT") {
|
|
32
|
+
console.error(chalk2.red(`'${error2.path}' not found.`));
|
|
33
|
+
} else {
|
|
34
|
+
console.error(chalk2.red(`Errno: ${error2.code}`));
|
|
35
|
+
}
|
|
36
|
+
return error2.errno ?? -1;
|
|
37
|
+
}) ?? withError(error, (error2) => {
|
|
38
|
+
console.error(chalk2.red(`${error2.name}: ${error2.message}`));
|
|
39
|
+
return -1;
|
|
40
|
+
}) ?? (() => {
|
|
41
|
+
console.error(chalk2.red(`Unexpected Error: ${JSON.stringify(ex, null, 2)}`));
|
|
42
|
+
return -1;
|
|
43
|
+
})();
|
|
44
|
+
process.exit(process.exitCode ?? exitCode);
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
// src/lib/safeExit.ts
|
|
48
|
+
var safeExit = (func, exitOnFail = true) => {
|
|
49
|
+
try {
|
|
50
|
+
const result = func();
|
|
51
|
+
if (result && exitOnFail) {
|
|
52
|
+
process.exit(result);
|
|
53
|
+
}
|
|
54
|
+
return result;
|
|
55
|
+
} catch (ex) {
|
|
56
|
+
return processEx(ex);
|
|
57
|
+
}
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
// src/lib/yarn/workspace/yarnWorkspaces.ts
|
|
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";
|
|
74
|
+
import { existsSync } from "fs";
|
|
75
|
+
import chalk3 from "chalk";
|
|
76
|
+
var runSteps = (name, steps, exitOnFail = true, messages) => {
|
|
77
|
+
return safeExit(() => {
|
|
78
|
+
const pkgName = process.env.npm_package_name;
|
|
79
|
+
console.log(chalk3.green(`${name} [${pkgName}]`));
|
|
80
|
+
let totalStatus = 0;
|
|
81
|
+
for (const [i, [command, args, config]] of steps.entries()) {
|
|
82
|
+
if (messages?.[i]) {
|
|
83
|
+
console.log(chalk3.gray(messages?.[i]));
|
|
84
|
+
}
|
|
85
|
+
const argList = Array.isArray(args) ? args : args.split(" ");
|
|
86
|
+
if (command === "node" && !existsSync(argList[0])) {
|
|
87
|
+
throw new Error(`File not found [${argList[0]}]`);
|
|
88
|
+
}
|
|
89
|
+
const status = spawnSync2(command, Array.isArray(args) ? args : args.split(" "), {
|
|
90
|
+
...config,
|
|
91
|
+
encoding: "utf8",
|
|
92
|
+
env: { FORCE_COLOR: "3", ...process.env },
|
|
93
|
+
shell: true,
|
|
94
|
+
stdio: "inherit"
|
|
95
|
+
}).status ?? 0;
|
|
96
|
+
checkResult(name, status, "error", exitOnFail);
|
|
97
|
+
totalStatus += status ?? 0;
|
|
98
|
+
}
|
|
99
|
+
return totalStatus;
|
|
100
|
+
}, !!exitOnFail);
|
|
101
|
+
};
|
|
102
|
+
|
|
103
|
+
// src/actions/deploy-next.ts
|
|
104
|
+
import { readFileSync } from "fs";
|
|
105
|
+
var privatePackageExcludeList = () => {
|
|
106
|
+
const possibleDeployablePackages = yarnWorkspaces().map((workspace) => [
|
|
107
|
+
workspace,
|
|
108
|
+
JSON.parse(readFileSync(`${workspace.location}/package.json`, { encoding: "utf8" }))
|
|
109
|
+
]);
|
|
110
|
+
const privatePackages = possibleDeployablePackages.filter(([_, pkg]) => pkg.private).map(([workspace]) => workspace);
|
|
111
|
+
const excludeList = privatePackages.map((workspace) => `--exclude ${workspace.name}`);
|
|
112
|
+
return excludeList;
|
|
113
|
+
};
|
|
114
|
+
var deployNext = () => {
|
|
115
|
+
const excludeList = privatePackageExcludeList();
|
|
116
|
+
if (excludeList.length > 0) {
|
|
117
|
+
console.log("Excluding private packages from deployment:", excludeList);
|
|
118
|
+
}
|
|
119
|
+
return runSteps("Deploy [Next]", [
|
|
120
|
+
["yarn", "workspaces foreach --all version minor --deferred"],
|
|
121
|
+
["yarn", "xy clean"],
|
|
122
|
+
["yarn", "xy build"],
|
|
123
|
+
["yarn", "version apply --all --prerelease"]
|
|
124
|
+
]);
|
|
125
|
+
};
|
|
126
|
+
|
|
127
|
+
// src/xy/deploy/deployNextCommand.ts
|
|
128
|
+
var deployNextCommand = {
|
|
129
|
+
command: "deploy-next",
|
|
130
|
+
describe: "Deploy - Deploy next",
|
|
131
|
+
handler: (argv) => {
|
|
132
|
+
if (argv.verbose) console.log("Deploy next");
|
|
133
|
+
process.exitCode = deployNext();
|
|
134
|
+
}
|
|
135
|
+
};
|
|
136
|
+
export {
|
|
137
|
+
deployNextCommand
|
|
138
|
+
};
|
|
139
|
+
//# sourceMappingURL=deployNextCommand.mjs.map
|
|
@@ -0,0 +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/yarn/workspace/yarnWorkspaces.ts","../../../src/lib/runSteps.ts","../../../src/actions/deploy-next.ts","../../../src/xy/deploy/deployNextCommand.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 { readFileSync } from 'node:fs'\n\nimport type { Workspace } from '../lib/index.ts'\nimport { runSteps, yarnWorkspaces } from '../lib/index.ts'\n\nconst privatePackageExcludeList = () => {\n const possibleDeployablePackages: [Workspace, { private?: boolean }][] = yarnWorkspaces().map(workspace => [workspace,\n JSON.parse(readFileSync(`${workspace.location}/package.json`, { encoding: 'utf8' })) as object])\n\n const privatePackages = possibleDeployablePackages.filter(([_, pkg]) => pkg.private).map(([workspace]) => workspace)\n const excludeList = privatePackages.map(workspace => `--exclude ${workspace.name}`)\n return excludeList\n}\n\nexport const deployNext = () => {\n const excludeList = privatePackageExcludeList()\n if (excludeList.length > 0) {\n console.log('Excluding private packages from deployment:', excludeList)\n }\n return runSteps('Deploy [Next]', [\n ['yarn', 'workspaces foreach --all version minor --deferred'],\n ['yarn', 'xy clean'],\n ['yarn', 'xy build'],\n ['yarn', 'version apply --all --prerelease'],\n ])\n}\n","import type { CommandModule } from 'yargs'\n\nimport { deployNext } from '../../actions/index.ts'\n\nexport const deployNextCommand: CommandModule = {\n command: 'deploy-next',\n describe: 'Deploy - Deploy next',\n handler: (argv) => {\n if (argv.verbose) console.log('Deploy next')\n process.exitCode = deployNext()\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,E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xC,OAAO;AAAA,QACP,OAAO;AAAA,MACT,CAAC,EAAE,UAAU;AACf,kBAAY,MAAM,QAAQ,SAAS,UAAU;AAC7C,qBAAe,UAAU;AAAA,IAC3B;AACA,WAAO;AAAA,EACT,GAAG,CAAC,CAAC,UAAU;AACjB;;;ACvCA,SAAS,oBAAoB;AAK7B,IAAM,4BAA4B,MAAM;AACtC,QAAM,6BAAmE,eAAe,EAAE,IAAI,eAAa;AAAA,IAAC;AAAA,IAC1G,KAAK,MAAM,aAAa,GAAG,UAAU,QAAQ,iBAAiB,EAAE,UAAU,OAAO,CAAC,CAAC;AAAA,EAAW,CAAC;AAEjG,QAAM,kBAAkB,2BAA2B,OAAO,CAAC,CAAC,GAAG,GAAG,MAAM,IAAI,OAAO,EAAE,IAAI,CAAC,CAAC,SAAS,MAAM,SAAS;AACnH,QAAM,cAAc,gBAAgB,IAAI,eAAa,aAAa,UAAU,IAAI,EAAE;AAClF,SAAO;AACT;AAEO,IAAM,aAAa,MAAM;AAC9B,QAAM,cAAc,0BAA0B;AAC9C,MAAI,YAAY,SAAS,GAAG;AAC1B,YAAQ,IAAI,+CAA+C,WAAW;AAAA,EACxE;AACA,SAAO,SAAS,iBAAiB;AAAA,IAC/B,CAAC,QAAQ,mDAAmD;AAAA,IAC5D,CAAC,QAAQ,UAAU;AAAA,IACnB,CAAC,QAAQ,UAAU;AAAA,IACnB,CAAC,QAAQ,kCAAkC;AAAA,EAC7C,CAAC;AACH;;;ACrBO,IAAM,oBAAmC;AAAA,EAC9C,SAAS;AAAA,EACT,UAAU;AAAA,EACV,SAAS,CAAC,SAAS;AACjB,QAAI,KAAK,QAAS,SAAQ,IAAI,aAAa;AAC3C,YAAQ,WAAW,WAAW;AAAA,EAChC;AACF;","names":["chalk","ex","ex","error","chalk","spawnSync","chalk","chalk","spawnSync"]}
|
|
@@ -201,61 +201,61 @@ var publish = () => {
|
|
|
201
201
|
return runSteps("Publish", [["npm", ["publish", "--workspaces"]]]);
|
|
202
202
|
};
|
|
203
203
|
|
|
204
|
-
// src/xy/
|
|
204
|
+
// src/xy/deploy/deployCommand.ts
|
|
205
|
+
var deployCommand = {
|
|
206
|
+
command: "deploy",
|
|
207
|
+
describe: "Deploy - Deploy patch",
|
|
208
|
+
handler: (argv) => {
|
|
209
|
+
if (argv.verbose) console.log("Deploy patch");
|
|
210
|
+
process.exitCode = deploy();
|
|
211
|
+
}
|
|
212
|
+
};
|
|
213
|
+
|
|
214
|
+
// src/xy/deploy/deployMajorCommand.ts
|
|
215
|
+
var deployMajorCommand = {
|
|
216
|
+
command: "deploy-major",
|
|
217
|
+
describe: "Deploy - Deploy major",
|
|
218
|
+
handler: (argv) => {
|
|
219
|
+
if (argv.verbose) console.log("Deploy major");
|
|
220
|
+
process.exitCode = deployMajor();
|
|
221
|
+
}
|
|
222
|
+
};
|
|
223
|
+
|
|
224
|
+
// src/xy/deploy/deployMinorCommand.ts
|
|
225
|
+
var deployMinorCommand = {
|
|
226
|
+
command: "deploy-minor",
|
|
227
|
+
describe: "Deploy - Deploy minor",
|
|
228
|
+
handler: (argv) => {
|
|
229
|
+
if (argv.verbose) console.log("Deploy minor");
|
|
230
|
+
process.exitCode = deployMinor();
|
|
231
|
+
}
|
|
232
|
+
};
|
|
233
|
+
|
|
234
|
+
// src/xy/deploy/deployNextCommand.ts
|
|
235
|
+
var deployNextCommand = {
|
|
236
|
+
command: "deploy-next",
|
|
237
|
+
describe: "Deploy - Deploy next",
|
|
238
|
+
handler: (argv) => {
|
|
239
|
+
if (argv.verbose) console.log("Deploy next");
|
|
240
|
+
process.exitCode = deployNext();
|
|
241
|
+
}
|
|
242
|
+
};
|
|
243
|
+
|
|
244
|
+
// src/xy/deploy/publishCommand.ts
|
|
245
|
+
var publishCommand = {
|
|
246
|
+
command: "publish",
|
|
247
|
+
describe: "Publish - Publish packages to npmjs",
|
|
248
|
+
handler: (argv) => {
|
|
249
|
+
if (argv.verbose) console.log("Publish packages to npmjs");
|
|
250
|
+
process.exitCode = publish();
|
|
251
|
+
}
|
|
252
|
+
};
|
|
253
|
+
|
|
254
|
+
// src/xy/deploy/index.ts
|
|
205
255
|
var xyDeployCommands = (args) => {
|
|
206
|
-
return args.command(
|
|
207
|
-
"deploy",
|
|
208
|
-
"Deploy - Deploy patch",
|
|
209
|
-
(yargs) => {
|
|
210
|
-
return yargs;
|
|
211
|
-
},
|
|
212
|
-
(argv) => {
|
|
213
|
-
if (argv.verbose) console.log("Deploy patch");
|
|
214
|
-
process.exitCode = deploy();
|
|
215
|
-
}
|
|
216
|
-
).command(
|
|
217
|
-
"deploy-minor",
|
|
218
|
-
"Deploy - Deploy minor",
|
|
219
|
-
(yargs) => {
|
|
220
|
-
return yargs;
|
|
221
|
-
},
|
|
222
|
-
(argv) => {
|
|
223
|
-
if (argv.verbose) console.log("Deploy minor");
|
|
224
|
-
process.exitCode = deployMinor();
|
|
225
|
-
}
|
|
226
|
-
).command(
|
|
227
|
-
"deploy-major",
|
|
228
|
-
"Deploy - Deploy major",
|
|
229
|
-
(yargs) => {
|
|
230
|
-
return yargs;
|
|
231
|
-
},
|
|
232
|
-
(argv) => {
|
|
233
|
-
if (argv.verbose) console.log("Deploy major");
|
|
234
|
-
process.exitCode = deployMajor();
|
|
235
|
-
}
|
|
236
|
-
).command(
|
|
237
|
-
"deploy-next",
|
|
238
|
-
"Deploy - Deploy next",
|
|
239
|
-
(yargs) => {
|
|
240
|
-
return yargs;
|
|
241
|
-
},
|
|
242
|
-
(argv) => {
|
|
243
|
-
if (argv.verbose) console.log("Deploy next");
|
|
244
|
-
process.exitCode = deployNext();
|
|
245
|
-
}
|
|
246
|
-
).command(
|
|
247
|
-
"publish",
|
|
248
|
-
"Publish - Publish packages to npmjs",
|
|
249
|
-
(yargs) => {
|
|
250
|
-
return yargs;
|
|
251
|
-
},
|
|
252
|
-
(argv) => {
|
|
253
|
-
if (argv.verbose) console.log("Publish packages to npmjs");
|
|
254
|
-
process.exitCode = publish();
|
|
255
|
-
}
|
|
256
|
-
);
|
|
256
|
+
return args.command(deployCommand).command(deployMinorCommand).command(deployMajorCommand).command(deployNextCommand).command(publishCommand);
|
|
257
257
|
};
|
|
258
258
|
export {
|
|
259
259
|
xyDeployCommands
|
|
260
260
|
};
|
|
261
|
-
//# sourceMappingURL=
|
|
261
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +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/yarn/workspace/yarnWorkspaces.ts","../../../src/lib/runSteps.ts","../../../src/actions/deploy.ts","../../../src/actions/deploy-major.ts","../../../src/actions/deploy-minor.ts","../../../src/actions/deploy-next.ts","../../../src/actions/publish.ts","../../../src/xy/deploy/deployCommand.ts","../../../src/xy/deploy/deployMajorCommand.ts","../../../src/xy/deploy/deployMinorCommand.ts","../../../src/xy/deploy/deployNextCommand.ts","../../../src/xy/deploy/publishCommand.ts","../../../src/xy/deploy/index.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 { readFileSync } from 'node:fs'\n\nimport type { Workspace } from '../lib/index.ts'\nimport { runSteps, yarnWorkspaces } from '../lib/index.ts'\n\nconst privatePackageExcludeList = () => {\n const possibleDeployablePackages: [Workspace, { private?: boolean }][] = yarnWorkspaces().map(workspace => [workspace,\n JSON.parse(readFileSync(`${workspace.location}/package.json`, { encoding: 'utf8' })) as object])\n\n const privatePackages = possibleDeployablePackages.filter(([_, pkg]) => pkg.private).map(([workspace]) => workspace)\n const excludeList = privatePackages.map(workspace => `--exclude ${workspace.name}`)\n return excludeList\n}\n\nexport const deploy = () => {\n const excludeList = privatePackageExcludeList()\n if (excludeList.length > 0) {\n console.log('Excluding private packages from deployment:', excludeList)\n }\n\n return runSteps('Deploy [Patch]', [\n ['yarn', 'workspaces foreach --all version patch --deferred'],\n ['yarn', 'xy clean'],\n ['yarn', 'xy build'],\n ['yarn', 'version apply --all'],\n ])\n}\n","import { readFileSync } from 'node:fs'\n\nimport type { Workspace } from '../lib/index.ts'\nimport { runSteps, yarnWorkspaces } from '../lib/index.ts'\n\nconst privatePackageExcludeList = () => {\n const possibleDeployablePackages: [Workspace, { private?: boolean }][] = yarnWorkspaces().map(workspace => [workspace,\n JSON.parse(readFileSync(`${workspace.location}/package.json`, { encoding: 'utf8' })) as object])\n\n const privatePackages = possibleDeployablePackages.filter(([_, pkg]) => pkg.private).map(([workspace]) => workspace)\n const excludeList = privatePackages.map(workspace => `--exclude ${workspace.name}`)\n return excludeList\n}\n\nexport const deployMajor = () => {\n const excludeList = privatePackageExcludeList()\n if (excludeList.length > 0) {\n console.log('Excluding private packages from deployment:', excludeList)\n }\n return runSteps('Deploy [Major]', [\n ['yarn', 'workspaces foreach --all version major --deferred'],\n ['yarn', 'xy clean'],\n ['yarn', 'xy build'],\n ['yarn', 'version apply --all'],\n ])\n}\n","import { readFileSync } from 'node:fs'\n\nimport type { Workspace } from '../lib/index.ts'\nimport { runSteps, yarnWorkspaces } from '../lib/index.ts'\n\nconst privatePackageExcludeList = () => {\n const possibleDeployablePackages: [Workspace, { private?: boolean }][] = yarnWorkspaces().map(workspace => [workspace,\n JSON.parse(readFileSync(`${workspace.location}/package.json`, { encoding: 'utf8' })) as object])\n\n const privatePackages = possibleDeployablePackages.filter(([_, pkg]) => pkg.private).map(([workspace]) => workspace)\n const excludeList = privatePackages.map(workspace => `--exclude ${workspace.name}`)\n return excludeList\n}\n\nexport const deployMinor = () => {\n const excludeList = privatePackageExcludeList()\n if (excludeList.length > 0) {\n console.log('Excluding private packages from deployment:', excludeList)\n }\n return runSteps('Deploy [Minor]', [\n ['yarn', 'workspaces foreach --all version minor --deferred'],\n ['yarn', 'xy clean'],\n ['yarn', 'xy build'],\n ['yarn', 'version apply --all'],\n ])\n}\n","import { readFileSync } from 'node:fs'\n\nimport type { Workspace } from '../lib/index.ts'\nimport { runSteps, yarnWorkspaces } from '../lib/index.ts'\n\nconst privatePackageExcludeList = () => {\n const possibleDeployablePackages: [Workspace, { private?: boolean }][] = yarnWorkspaces().map(workspace => [workspace,\n JSON.parse(readFileSync(`${workspace.location}/package.json`, { encoding: 'utf8' })) as object])\n\n const privatePackages = possibleDeployablePackages.filter(([_, pkg]) => pkg.private).map(([workspace]) => workspace)\n const excludeList = privatePackages.map(workspace => `--exclude ${workspace.name}`)\n return excludeList\n}\n\nexport const deployNext = () => {\n const excludeList = privatePackageExcludeList()\n if (excludeList.length > 0) {\n console.log('Excluding private packages from deployment:', excludeList)\n }\n return runSteps('Deploy [Next]', [\n ['yarn', 'workspaces foreach --all version minor --deferred'],\n ['yarn', 'xy clean'],\n ['yarn', 'xy build'],\n ['yarn', 'version apply --all --prerelease'],\n ])\n}\n","import { runSteps } from '../lib/index.ts'\n\nexport const publish = () => {\n return runSteps('Publish', [['npm', ['publish', '--workspaces']]])\n}\n","import type { CommandModule } from 'yargs'\n\nimport { deploy } from '../../actions/index.ts'\n\nexport const deployCommand: CommandModule = {\n command: 'deploy',\n describe: 'Deploy - Deploy patch',\n handler: (argv) => {\n if (argv.verbose) console.log('Deploy patch')\n process.exitCode = deploy()\n },\n}\n","import type { CommandModule } from 'yargs'\n\nimport { deployMajor } from '../../actions/index.ts'\n\nexport const deployMajorCommand: CommandModule = {\n command: 'deploy-major',\n describe: 'Deploy - Deploy major',\n handler: (argv) => {\n if (argv.verbose) console.log('Deploy major')\n process.exitCode = deployMajor()\n },\n}\n","import type { CommandModule } from 'yargs'\n\nimport { deployMinor } from '../../actions/index.ts'\n\nexport const deployMinorCommand: CommandModule = {\n command: 'deploy-minor',\n describe: 'Deploy - Deploy minor',\n handler: (argv) => {\n if (argv.verbose) console.log('Deploy minor')\n process.exitCode = deployMinor()\n },\n}\n","import type { CommandModule } from 'yargs'\n\nimport { deployNext } from '../../actions/index.ts'\n\nexport const deployNextCommand: CommandModule = {\n command: 'deploy-next',\n describe: 'Deploy - Deploy next',\n handler: (argv) => {\n if (argv.verbose) console.log('Deploy next')\n process.exitCode = deployNext()\n },\n}\n","import type { CommandModule } from 'yargs'\n\nimport { publish } from '../../actions/index.ts'\n\nexport const publishCommand: CommandModule = {\n command: 'publish',\n describe: 'Publish - Publish packages to npmjs',\n handler: (argv) => {\n if (argv.verbose) console.log('Publish packages to npmjs')\n process.exitCode = publish()\n },\n}\n","import type { Argv } from 'yargs'\n\nimport { deployCommand } from './deployCommand.ts'\nimport { deployMajorCommand } from './deployMajorCommand.ts'\nimport { deployMinorCommand } from './deployMinorCommand.ts'\nimport { deployNextCommand } from './deployNextCommand.ts'\nimport { publishCommand } from './publishCommand.ts'\n\nexport const xyDeployCommands = (args: Argv) => {\n return args\n .command(deployCommand)\n .command(deployMinorCommand)\n .command(deployMajorCommand)\n .command(deployNextCommand)\n .command(publishCommand)\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,QAAI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B,EAC1B,QAAQ,iBAAiB,EACzB,QAAQ,cAAc;AAC3B;","names":["chalk","ex","ex","error","chalk","spawnSync","chalk","chalk","spawnSync","readFileSync","privatePackageExcludeList","readFileSync","readFileSync","privatePackageExcludeList","readFileSync","readFileSync","privatePackageExcludeList","readFileSync"]}
|