@xylabs/ts-scripts-yarn3 5.1.14 → 6.0.0
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/compile-types.mjs +176 -0
- package/dist/actions/compile-types.mjs.map +1 -0
- package/dist/actions/fix.mjs +2 -2
- package/dist/actions/fix.mjs.map +1 -1
- package/dist/actions/index.mjs +251 -139
- package/dist/actions/index.mjs.map +1 -1
- package/dist/actions/lint-clean.mjs +2 -2
- package/dist/actions/lint-clean.mjs.map +1 -1
- package/dist/actions/lint.mjs +2 -2
- package/dist/actions/lint.mjs.map +1 -1
- package/dist/actions/package/compile/compile.mjs +88 -64
- package/dist/actions/package/compile/compile.mjs.map +1 -1
- package/dist/actions/package/compile/compileTypes.mjs +164 -0
- package/dist/actions/package/compile/compileTypes.mjs.map +1 -0
- package/dist/actions/package/compile/deepMerge.mjs +31 -0
- package/dist/actions/package/compile/deepMerge.mjs.map +1 -0
- package/dist/actions/package/compile/index.mjs +101 -65
- package/dist/actions/package/compile/index.mjs.map +1 -1
- package/dist/actions/package/compile/packageCompileTscTypes.mjs +3 -2
- package/dist/actions/package/compile/packageCompileTscTypes.mjs.map +1 -1
- package/dist/actions/package/compile/packageCompileTsup.mjs +90 -65
- package/dist/actions/package/compile/packageCompileTsup.mjs.map +1 -1
- package/dist/actions/package/index.mjs +116 -80
- package/dist/actions/package/index.mjs.map +1 -1
- package/dist/actions/package/recompile.mjs +88 -64
- package/dist/actions/package/recompile.mjs.map +1 -1
- package/dist/bin/package/build-only.mjs +88 -64
- package/dist/bin/package/build-only.mjs.map +1 -1
- package/dist/bin/package/build.mjs +88 -64
- package/dist/bin/package/build.mjs.map +1 -1
- package/dist/bin/package/compile-only.mjs +88 -64
- package/dist/bin/package/compile-only.mjs.map +1 -1
- package/dist/bin/package/compile-tsup.mjs +88 -64
- package/dist/bin/package/compile-tsup.mjs.map +1 -1
- package/dist/bin/package/compile-types.mjs +173 -0
- package/dist/bin/package/compile-types.mjs.map +1 -0
- package/dist/bin/package/compile.mjs +88 -64
- package/dist/bin/package/compile.mjs.map +1 -1
- package/dist/bin/package/recompile.mjs +88 -64
- package/dist/bin/package/recompile.mjs.map +1 -1
- package/dist/bin/xy.mjs +132 -45
- package/dist/bin/xy.mjs.map +1 -1
- package/dist/index.d.ts +21 -1
- package/dist/index.mjs +275 -149
- package/dist/index.mjs.map +1 -1
- package/dist/xy/index.mjs +132 -45
- package/dist/xy/index.mjs.map +1 -1
- package/dist/xy/xy.mjs +132 -45
- package/dist/xy/xy.mjs.map +1 -1
- package/dist/xy/xyBuildCommands.mjs +92 -5
- package/dist/xy/xyBuildCommands.mjs.map +1 -1
- package/dist/xy/xyLintCommands.mjs +2 -2
- package/dist/xy/xyLintCommands.mjs.map +1 -1
- package/package.json +18 -49
- package/src/actions/compile-types.ts +67 -0
- package/src/actions/index.ts +1 -0
- package/src/actions/lint.ts +1 -1
- package/src/actions/package/compile/compileTypes.ts +13 -0
- package/src/actions/package/compile/deepMerge.ts +33 -0
- package/src/actions/package/compile/index.ts +2 -0
- package/src/actions/package/compile/packageCompileTscTypes.ts +3 -2
- package/src/actions/package/compile/packageCompileTsup.ts +39 -53
- package/src/bin/package/compile-types.ts +16 -0
- package/src/bin/xy.ts +1 -1
- package/src/xy/xyBuildCommands.ts +19 -1
- package/dist/bin/build.mjs +0 -17
- package/dist/bin/build.mjs.map +0 -1
- package/dist/bin/clean.mjs +0 -17
- package/dist/bin/clean.mjs.map +0 -1
- package/dist/bin/compile-only.mjs +0 -17
- package/dist/bin/compile-only.mjs.map +0 -1
- package/dist/bin/compile.mjs +0 -17
- package/dist/bin/compile.mjs.map +0 -1
- package/dist/bin/cycle.mjs +0 -17
- package/dist/bin/cycle.mjs.map +0 -1
- package/dist/bin/dead.mjs +0 -17
- package/dist/bin/dead.mjs.map +0 -1
- package/dist/bin/deploy-major.mjs +0 -17
- package/dist/bin/deploy-major.mjs.map +0 -1
- package/dist/bin/deploy-minor.mjs +0 -17
- package/dist/bin/deploy-minor.mjs.map +0 -1
- package/dist/bin/deploy-next.mjs +0 -17
- package/dist/bin/deploy-next.mjs.map +0 -1
- package/dist/bin/deploy.mjs +0 -17
- package/dist/bin/deploy.mjs.map +0 -1
- package/dist/bin/deps.mjs +0 -17
- package/dist/bin/deps.mjs.map +0 -1
- package/dist/bin/fix.mjs +0 -17
- package/dist/bin/fix.mjs.map +0 -1
- package/dist/bin/gen-docs.mjs +0 -17
- package/dist/bin/gen-docs.mjs.map +0 -1
- package/dist/bin/gitlint-fix.mjs +0 -17
- package/dist/bin/gitlint-fix.mjs.map +0 -1
- package/dist/bin/gitlint.mjs +0 -17
- package/dist/bin/gitlint.mjs.map +0 -1
- package/dist/bin/license.mjs +0 -17
- package/dist/bin/license.mjs.map +0 -1
- package/dist/bin/lint-clean.mjs +0 -17
- package/dist/bin/lint-clean.mjs.map +0 -1
- package/dist/bin/lint-fast.mjs +0 -17
- package/dist/bin/lint-fast.mjs.map +0 -1
- package/dist/bin/lint-profile.mjs +0 -17
- package/dist/bin/lint-profile.mjs.map +0 -1
- package/dist/bin/lint.mjs +0 -17
- package/dist/bin/lint.mjs.map +0 -1
- package/dist/bin/publint.mjs +0 -17
- package/dist/bin/publint.mjs.map +0 -1
- package/dist/bin/rebuild.mjs +0 -17
- package/dist/bin/rebuild.mjs.map +0 -1
- package/dist/bin/recompile.mjs +0 -17
- package/dist/bin/recompile.mjs.map +0 -1
- package/dist/bin/reinstall.mjs +0 -17
- package/dist/bin/reinstall.mjs.map +0 -1
- package/dist/bin/relint.mjs +0 -17
- package/dist/bin/relint.mjs.map +0 -1
- package/dist/bin/sonar.mjs +0 -17
- package/dist/bin/sonar.mjs.map +0 -1
- package/dist/bin/test.mjs +0 -17
- package/dist/bin/test.mjs.map +0 -1
- package/dist/bin/up.mjs +0 -17
- package/dist/bin/up.mjs.map +0 -1
- package/dist/bin/updo.mjs +0 -17
- package/dist/bin/updo.mjs.map +0 -1
- package/dist/bin/upplug.mjs +0 -17
- package/dist/bin/upplug.mjs.map +0 -1
- package/dist/bin/upyarn.mjs +0 -17
- package/dist/bin/upyarn.mjs.map +0 -1
- package/dist/bin/xy-ts.mjs +0 -1930
- package/dist/bin/xy-ts.mjs.map +0 -1
- package/dist/bin/yarn3only.mjs +0 -17
- package/dist/bin/yarn3only.mjs.map +0 -1
- package/src/bin/build.ts +0 -5
- package/src/bin/clean.ts +0 -5
- package/src/bin/compile-only.ts +0 -5
- package/src/bin/compile.ts +0 -5
- package/src/bin/cycle.ts +0 -5
- package/src/bin/dead.ts +0 -5
- package/src/bin/deploy-major.ts +0 -5
- package/src/bin/deploy-minor.ts +0 -5
- package/src/bin/deploy-next.ts +0 -5
- package/src/bin/deploy.ts +0 -5
- package/src/bin/deps.ts +0 -5
- package/src/bin/fix.ts +0 -5
- package/src/bin/gen-docs.ts +0 -5
- package/src/bin/gitlint-fix.ts +0 -5
- package/src/bin/gitlint.ts +0 -5
- package/src/bin/license.ts +0 -5
- package/src/bin/lint-clean.ts +0 -5
- package/src/bin/lint-fast.ts +0 -5
- package/src/bin/lint-profile.ts +0 -5
- package/src/bin/lint.ts +0 -5
- package/src/bin/publint.ts +0 -5
- package/src/bin/rebuild.ts +0 -5
- package/src/bin/recompile.ts +0 -5
- package/src/bin/reinstall.ts +0 -5
- package/src/bin/relint.ts +0 -5
- package/src/bin/sonar.ts +0 -5
- package/src/bin/test.ts +0 -5
- package/src/bin/up.ts +0 -5
- package/src/bin/updo.ts +0 -5
- package/src/bin/upplug.ts +0 -5
- package/src/bin/upyarn.ts +0 -5
- package/src/bin/xy-ts.ts +0 -12
- package/src/bin/yarn3only.ts +0 -5
package/dist/bin/xy-ts.mjs
DELETED
|
@@ -1,1930 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env ts-node
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
4
|
-
|
|
5
|
-
// src/xy/xy.ts
|
|
6
|
-
import chalk20 from "chalk";
|
|
7
|
-
|
|
8
|
-
// src/actions/build.ts
|
|
9
|
-
import chalk7 from "chalk";
|
|
10
|
-
|
|
11
|
-
// src/lib/checkResult.ts
|
|
12
|
-
import chalk from "chalk";
|
|
13
|
-
var checkResult = /* @__PURE__ */ __name((name, result, level = "error", exitOnFail = false) => {
|
|
14
|
-
if (result) {
|
|
15
|
-
const exiting = exitOnFail ? "[Exiting Process]" : "[Continuing]";
|
|
16
|
-
const chalkFunc = level === "error" ? chalk.red : chalk.yellow;
|
|
17
|
-
console[level](chalkFunc(`${name} had ${result} failures ${exiting}`));
|
|
18
|
-
if (exitOnFail) {
|
|
19
|
-
process.exit(result);
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
}, "checkResult");
|
|
23
|
-
|
|
24
|
-
// src/lib/deleteGlob.ts
|
|
25
|
-
import fs from "node:fs";
|
|
26
|
-
import { glob } from "glob";
|
|
27
|
-
var deleteGlob = /* @__PURE__ */ __name((globPath) => {
|
|
28
|
-
const files = glob.sync(globPath);
|
|
29
|
-
for (const file of files) {
|
|
30
|
-
fs.rmSync(file, {
|
|
31
|
-
recursive: true,
|
|
32
|
-
force: true
|
|
33
|
-
});
|
|
34
|
-
}
|
|
35
|
-
}, "deleteGlob");
|
|
36
|
-
|
|
37
|
-
// src/lib/dependencies/detectDuplicateDependencies.ts
|
|
38
|
-
import { execSync } from "node:child_process";
|
|
39
|
-
|
|
40
|
-
// src/lib/processEx.ts
|
|
41
|
-
import chalk2 from "chalk";
|
|
42
|
-
|
|
43
|
-
// src/lib/withError.ts
|
|
44
|
-
var withError = /* @__PURE__ */ __name((ex, closure, predicate = (ex2) => !!ex2.name && !!ex2.message) => {
|
|
45
|
-
return predicate(ex) ? closure(ex) : void 0;
|
|
46
|
-
}, "withError");
|
|
47
|
-
|
|
48
|
-
// src/lib/withErrnoException.ts
|
|
49
|
-
var withErrnoException = /* @__PURE__ */ __name((ex, closure) => {
|
|
50
|
-
return withError(ex, closure, (ex2) => ex2.errno !== void 0);
|
|
51
|
-
}, "withErrnoException");
|
|
52
|
-
|
|
53
|
-
// src/lib/processEx.ts
|
|
54
|
-
var processEx = /* @__PURE__ */ __name((ex) => {
|
|
55
|
-
const error = typeof ex === "string" ? new Error(ex) : ex;
|
|
56
|
-
const exitCode = withErrnoException(error, (error2) => {
|
|
57
|
-
if (error2.code === "ENOENT") {
|
|
58
|
-
console.error(chalk2.red(`'${error2.path}' not found.`));
|
|
59
|
-
} else {
|
|
60
|
-
console.error(chalk2.red(`Errno: ${error2.code}`));
|
|
61
|
-
}
|
|
62
|
-
return error2.errno ?? -1;
|
|
63
|
-
}) ?? withError(error, (error2) => {
|
|
64
|
-
console.error(chalk2.red(`${error2.name}: ${error2.message}`));
|
|
65
|
-
return -1;
|
|
66
|
-
}) ?? (() => {
|
|
67
|
-
console.error(chalk2.red(`Unexpected Error: ${JSON.stringify(ex, null, 2)}`));
|
|
68
|
-
return -1;
|
|
69
|
-
})();
|
|
70
|
-
process.exit(process.exitCode ?? exitCode);
|
|
71
|
-
}, "processEx");
|
|
72
|
-
|
|
73
|
-
// src/lib/safeExit.ts
|
|
74
|
-
var safeExit = /* @__PURE__ */ __name((func, exitOnFail = true) => {
|
|
75
|
-
try {
|
|
76
|
-
const result = func();
|
|
77
|
-
if (result && exitOnFail) {
|
|
78
|
-
process.exit(result);
|
|
79
|
-
}
|
|
80
|
-
return result;
|
|
81
|
-
} catch (ex) {
|
|
82
|
-
return processEx(ex);
|
|
83
|
-
}
|
|
84
|
-
}, "safeExit");
|
|
85
|
-
var safeExitAsync = /* @__PURE__ */ __name(async (func, exitOnFail = true) => {
|
|
86
|
-
try {
|
|
87
|
-
const result = await func();
|
|
88
|
-
if (result && exitOnFail) {
|
|
89
|
-
process.exit(result);
|
|
90
|
-
}
|
|
91
|
-
return result;
|
|
92
|
-
} catch (ex) {
|
|
93
|
-
return processEx(ex);
|
|
94
|
-
}
|
|
95
|
-
}, "safeExitAsync");
|
|
96
|
-
|
|
97
|
-
// src/lib/dependencies/DuplicateDetector.ts
|
|
98
|
-
import { EOL } from "node:os";
|
|
99
|
-
import chalk3 from "chalk";
|
|
100
|
-
|
|
101
|
-
// src/lib/jsonFormatters.ts
|
|
102
|
-
var multiLineToJSONArray = /* @__PURE__ */ __name((output) => {
|
|
103
|
-
const withCommas = output.replaceAll("\r\n", "").replaceAll("\n", ",");
|
|
104
|
-
const cleanCollection = withCommas.slice(0, Math.max(0, withCommas.length - 1));
|
|
105
|
-
const collection = `[${cleanCollection}]`;
|
|
106
|
-
return JSON.parse(collection);
|
|
107
|
-
}, "multiLineToJSONArray");
|
|
108
|
-
|
|
109
|
-
// src/lib/dependencies/DuplicateDetector.ts
|
|
110
|
-
var trimVirtualMeta = /* @__PURE__ */ __name((value) => {
|
|
111
|
-
const virtualParts = value.split("virtual:");
|
|
112
|
-
if (virtualParts.length > 1) {
|
|
113
|
-
const hashParts = virtualParts[1].split("#");
|
|
114
|
-
return virtualParts[0] + hashParts[1];
|
|
115
|
-
} else {
|
|
116
|
-
return value;
|
|
117
|
-
}
|
|
118
|
-
}, "trimVirtualMeta");
|
|
119
|
-
var trimObjectDependencyVirtualMeta = /* @__PURE__ */ __name((obj) => {
|
|
120
|
-
const resultObj = {};
|
|
121
|
-
for (const [key, value] of Object.entries(obj)) {
|
|
122
|
-
resultObj[trimVirtualMeta(key)] = {
|
|
123
|
-
descriptor: trimVirtualMeta(value.descriptor),
|
|
124
|
-
locator: trimVirtualMeta(value.locator)
|
|
125
|
-
};
|
|
126
|
-
}
|
|
127
|
-
return resultObj;
|
|
128
|
-
}, "trimObjectDependencyVirtualMeta");
|
|
129
|
-
var trimDependencyVirtualMeta = /* @__PURE__ */ __name((dependencies) => {
|
|
130
|
-
return dependencies.map((dependency) => {
|
|
131
|
-
return {
|
|
132
|
-
children: trimObjectDependencyVirtualMeta(dependency.children),
|
|
133
|
-
value: trimVirtualMeta(dependency.value)
|
|
134
|
-
};
|
|
135
|
-
});
|
|
136
|
-
}, "trimDependencyVirtualMeta");
|
|
137
|
-
var DuplicateDetector = class {
|
|
138
|
-
static {
|
|
139
|
-
__name(this, "DuplicateDetector");
|
|
140
|
-
}
|
|
141
|
-
dependency;
|
|
142
|
-
dependencyEntries;
|
|
143
|
-
constructor(output, dependency) {
|
|
144
|
-
this.dependency = dependency;
|
|
145
|
-
this.dependencyEntries = trimDependencyVirtualMeta(multiLineToJSONArray(output));
|
|
146
|
-
}
|
|
147
|
-
detect() {
|
|
148
|
-
const result = this.dependencyEntries.reduce(this.detectReducer, this.resultsFactory(this.dependency));
|
|
149
|
-
if (result.duplicateVersions.length > 0) {
|
|
150
|
-
console.log(chalk3.yellow(`${EOL}Duplicates found for: ${this.dependency}`));
|
|
151
|
-
const duplicateVersions = result.duplicateVersions.toString().replaceAll(",", `${EOL} `);
|
|
152
|
-
console.log(chalk3.grey(` ${duplicateVersions}`, EOL));
|
|
153
|
-
return 1;
|
|
154
|
-
} else {
|
|
155
|
-
console.log(`${this.dependency} - OK`);
|
|
156
|
-
return 0;
|
|
157
|
-
}
|
|
158
|
-
}
|
|
159
|
-
detectReducer(acc, entry) {
|
|
160
|
-
const version = Object.entries(entry.children).map(([k]) => k)[0];
|
|
161
|
-
if (!acc.currentVersion) {
|
|
162
|
-
acc.currentVersion = version;
|
|
163
|
-
return acc;
|
|
164
|
-
}
|
|
165
|
-
if (acc.currentVersion && acc.currentVersion !== version && !version.includes("@virtual:")) {
|
|
166
|
-
if (acc.duplicateVersions.length === 0) {
|
|
167
|
-
acc.duplicateVersions.push(acc.currentVersion);
|
|
168
|
-
}
|
|
169
|
-
acc.duplicateVersions.push(version);
|
|
170
|
-
acc.duplicateVersions = [
|
|
171
|
-
...new Set(acc.duplicateVersions)
|
|
172
|
-
];
|
|
173
|
-
}
|
|
174
|
-
return acc;
|
|
175
|
-
}
|
|
176
|
-
resultsFactory = /* @__PURE__ */ __name((dependency) => ({
|
|
177
|
-
currentVersion: void 0,
|
|
178
|
-
dependency,
|
|
179
|
-
duplicateVersions: []
|
|
180
|
-
}), "resultsFactory");
|
|
181
|
-
};
|
|
182
|
-
|
|
183
|
-
// src/lib/dependencies/detectDuplicateDependencies.ts
|
|
184
|
-
var detectDuplicateDependencies = /* @__PURE__ */ __name((depsFromPackageJSON, DefaultDependencies2) => {
|
|
185
|
-
let exitCode = 0;
|
|
186
|
-
const dependencies = depsFromPackageJSON?.length ? depsFromPackageJSON : DefaultDependencies2;
|
|
187
|
-
return safeExit(() => {
|
|
188
|
-
if (dependencies) {
|
|
189
|
-
for (const dependency of dependencies) {
|
|
190
|
-
let output;
|
|
191
|
-
try {
|
|
192
|
-
const cmd = `yarn why ${dependency} --json`;
|
|
193
|
-
output = execSync(cmd).toString();
|
|
194
|
-
} catch (e) {
|
|
195
|
-
console.error(`Error running yarn why: ${e}`);
|
|
196
|
-
exitCode = 1;
|
|
197
|
-
continue;
|
|
198
|
-
}
|
|
199
|
-
if (output) {
|
|
200
|
-
exitCode = new DuplicateDetector(output, dependency).detect();
|
|
201
|
-
} else {
|
|
202
|
-
console.log(`${dependency} - N/A`);
|
|
203
|
-
if (depsFromPackageJSON) {
|
|
204
|
-
exitCode = 1;
|
|
205
|
-
console.log(`\u{1F6A8} Library ${dependency} was requested in package.json but not found`);
|
|
206
|
-
}
|
|
207
|
-
}
|
|
208
|
-
}
|
|
209
|
-
return exitCode;
|
|
210
|
-
} else {
|
|
211
|
-
console.log("\u{1F6A8} No dependencies where passed");
|
|
212
|
-
return exitCode;
|
|
213
|
-
}
|
|
214
|
-
});
|
|
215
|
-
}, "detectDuplicateDependencies");
|
|
216
|
-
|
|
217
|
-
// src/lib/file/constants.ts
|
|
218
|
-
var WINDOWS_NEWLINE_REGEX = /\r\n/g;
|
|
219
|
-
var CROSS_PLATFORM_NEWLINE = "\n";
|
|
220
|
-
|
|
221
|
-
// src/lib/file/fileLines.ts
|
|
222
|
-
import { existsSync, readFileSync, writeFileSync } from "node:fs";
|
|
223
|
-
|
|
224
|
-
// src/lib/string/empty.ts
|
|
225
|
-
var empty = /* @__PURE__ */ __name((value) => value?.trim().length === 0, "empty");
|
|
226
|
-
var notEmpty = /* @__PURE__ */ __name((value) => !empty(value), "notEmpty");
|
|
227
|
-
|
|
228
|
-
// src/lib/string/union.ts
|
|
229
|
-
var union = /* @__PURE__ */ __name((a, b) => /* @__PURE__ */ new Set([
|
|
230
|
-
...new Set(a),
|
|
231
|
-
...new Set(b)
|
|
232
|
-
]), "union");
|
|
233
|
-
|
|
234
|
-
// src/lib/file/ReadFileSyncOptions.ts
|
|
235
|
-
var defaultReadFileSyncOptions = {
|
|
236
|
-
encoding: "utf8"
|
|
237
|
-
};
|
|
238
|
-
|
|
239
|
-
// src/lib/file/fileLines.ts
|
|
240
|
-
var readLines = /* @__PURE__ */ __name((uri, options = defaultReadFileSyncOptions) => existsSync(uri) ? readFileSync(uri, options).replace(WINDOWS_NEWLINE_REGEX, CROSS_PLATFORM_NEWLINE).split(CROSS_PLATFORM_NEWLINE) : [], "readLines");
|
|
241
|
-
var readNonEmptyLines = /* @__PURE__ */ __name((uri, options = defaultReadFileSyncOptions) => readLines(uri, options).filter(notEmpty), "readNonEmptyLines");
|
|
242
|
-
var writeLines = /* @__PURE__ */ __name((uri, lines, options = defaultReadFileSyncOptions) => {
|
|
243
|
-
const existing = existsSync(uri) ? readFileSync(uri, options) : void 0;
|
|
244
|
-
const desired = lines.join(CROSS_PLATFORM_NEWLINE);
|
|
245
|
-
if (existing !== desired) writeFileSync(uri, desired, options);
|
|
246
|
-
}, "writeLines");
|
|
247
|
-
|
|
248
|
-
// src/lib/generateIgnoreFiles.ts
|
|
249
|
-
import chalk4 from "chalk";
|
|
250
|
-
|
|
251
|
-
// src/lib/yarn/isYarnVersionOrGreater.ts
|
|
252
|
-
import { spawnSync } from "node:child_process";
|
|
253
|
-
var isYarnVersionOrGreater = /* @__PURE__ */ __name((major, minor, patch) => {
|
|
254
|
-
const result = spawnSync("yarn", [
|
|
255
|
-
"-v"
|
|
256
|
-
], {
|
|
257
|
-
encoding: "utf8",
|
|
258
|
-
shell: true
|
|
259
|
-
});
|
|
260
|
-
const version = result.stdout.toString().replaceAll("\n", "");
|
|
261
|
-
const versionNumbers = version.split(".").map((ver) => Number.parseInt(ver));
|
|
262
|
-
const majorDelta = versionNumbers[0] - major;
|
|
263
|
-
const minorDelta = versionNumbers[1] - (minor ?? versionNumbers[1]);
|
|
264
|
-
const patchDelta = versionNumbers[2] - (patch ?? versionNumbers[2]);
|
|
265
|
-
const majorOk = majorDelta >= 0;
|
|
266
|
-
const minorOk = majorDelta > 0 || minorDelta >= 0;
|
|
267
|
-
const patchOk = majorDelta > 0 || minorDelta > 0 || patchDelta >= 0;
|
|
268
|
-
return [
|
|
269
|
-
majorOk && minorOk && patchOk,
|
|
270
|
-
version
|
|
271
|
-
];
|
|
272
|
-
}, "isYarnVersionOrGreater");
|
|
273
|
-
|
|
274
|
-
// src/lib/yarn/workspace/yarnWorkspaces.ts
|
|
275
|
-
import { spawnSync as spawnSync2 } from "node:child_process";
|
|
276
|
-
var yarnWorkspaces = /* @__PURE__ */ __name(() => {
|
|
277
|
-
const result = spawnSync2("yarn", [
|
|
278
|
-
"workspaces",
|
|
279
|
-
"list",
|
|
280
|
-
"--json",
|
|
281
|
-
"--recursive"
|
|
282
|
-
], {
|
|
283
|
-
encoding: "utf8",
|
|
284
|
-
shell: true
|
|
285
|
-
});
|
|
286
|
-
if (result.error) {
|
|
287
|
-
throw result.error;
|
|
288
|
-
}
|
|
289
|
-
return result.stdout.toString().split("\n").slice(0, -1).map((item) => {
|
|
290
|
-
return JSON.parse(item);
|
|
291
|
-
});
|
|
292
|
-
}, "yarnWorkspaces");
|
|
293
|
-
|
|
294
|
-
// src/lib/yarn/workspace/yarnWorkspace.ts
|
|
295
|
-
var yarnWorkspace = /* @__PURE__ */ __name((pkg) => {
|
|
296
|
-
const workspace = yarnWorkspaces().find(({ name }) => name === pkg);
|
|
297
|
-
if (!workspace) throw new Error(`Workspace ${pkg} not found`);
|
|
298
|
-
return workspace;
|
|
299
|
-
}, "yarnWorkspace");
|
|
300
|
-
|
|
301
|
-
// src/lib/yarn/yarnInitCwd.ts
|
|
302
|
-
var INIT_CWD = /* @__PURE__ */ __name(() => {
|
|
303
|
-
if (!process.env.INIT_CWD) console.error("Missing INIT_CWD");
|
|
304
|
-
return process.env.INIT_CWD;
|
|
305
|
-
}, "INIT_CWD");
|
|
306
|
-
|
|
307
|
-
// src/lib/generateIgnoreFiles.ts
|
|
308
|
-
var localeCompare = /* @__PURE__ */ __name((a, b) => a.localeCompare(b), "localeCompare");
|
|
309
|
-
var mergeEntries = /* @__PURE__ */ __name((a, b) => [
|
|
310
|
-
...union(a, b)
|
|
311
|
-
].sort(localeCompare), "mergeEntries");
|
|
312
|
-
var generateIgnoreFiles = /* @__PURE__ */ __name((filename3, pkg) => {
|
|
313
|
-
console.log(chalk4.green(`Generate ${filename3} Files`));
|
|
314
|
-
const cwd = INIT_CWD() ?? ".";
|
|
315
|
-
const workspaces = pkg ? [
|
|
316
|
-
yarnWorkspace(pkg)
|
|
317
|
-
] : yarnWorkspaces();
|
|
318
|
-
const readEntries = /* @__PURE__ */ __name((location) => readNonEmptyLines(`${location}/${filename3}`), "readEntries");
|
|
319
|
-
const writeEntries = /* @__PURE__ */ __name((location, entries) => writeLines(`${location}/${filename3}`, entries), "writeEntries");
|
|
320
|
-
const results = workspaces.map(({ location, name }) => {
|
|
321
|
-
try {
|
|
322
|
-
writeEntries(location, mergeEntries(readEntries(cwd), readEntries(location)));
|
|
323
|
-
return 0;
|
|
324
|
-
} catch (ex) {
|
|
325
|
-
const error = ex;
|
|
326
|
-
console.error(`Generate ${filename3} Files [${name}] [${error.message}]`);
|
|
327
|
-
return 1;
|
|
328
|
-
}
|
|
329
|
-
});
|
|
330
|
-
const succeeded = results.every((result) => result === 0);
|
|
331
|
-
return succeeded ? 0 : 1;
|
|
332
|
-
}, "generateIgnoreFiles");
|
|
333
|
-
|
|
334
|
-
// src/lib/parsedPackageJSON.ts
|
|
335
|
-
import { readFileSync as readFileSync2 } from "node:fs";
|
|
336
|
-
var parsedPackageJSON = /* @__PURE__ */ __name((path3) => {
|
|
337
|
-
const pathToPackageJSON = path3 ?? process.env.npm_package_json ?? "";
|
|
338
|
-
const packageJSON = readFileSync2(pathToPackageJSON).toString();
|
|
339
|
-
return JSON.parse(packageJSON);
|
|
340
|
-
}, "parsedPackageJSON");
|
|
341
|
-
|
|
342
|
-
// src/lib/runSteps.ts
|
|
343
|
-
import { spawnSync as spawnSync3 } from "node:child_process";
|
|
344
|
-
import { existsSync as existsSync2 } from "node:fs";
|
|
345
|
-
import chalk5 from "chalk";
|
|
346
|
-
var runSteps = /* @__PURE__ */ __name((name, steps, exitOnFail = true, messages) => {
|
|
347
|
-
return safeExit(() => {
|
|
348
|
-
const pkgName = process.env.npm_package_name;
|
|
349
|
-
console.log(chalk5.green(`${name} [${pkgName}]`));
|
|
350
|
-
let totalStatus = 0;
|
|
351
|
-
for (const [i, [command, args, config]] of steps.entries()) {
|
|
352
|
-
if (messages?.[i]) {
|
|
353
|
-
console.log(chalk5.gray(messages?.[i]));
|
|
354
|
-
}
|
|
355
|
-
const argList = Array.isArray(args) ? args : args.split(" ");
|
|
356
|
-
if (command === "node" && !existsSync2(argList[0])) {
|
|
357
|
-
throw new Error(`File not found [${argList[0]}]`);
|
|
358
|
-
}
|
|
359
|
-
const status = spawnSync3(command, Array.isArray(args) ? args : args.split(" "), {
|
|
360
|
-
...config,
|
|
361
|
-
encoding: "utf8",
|
|
362
|
-
env: {
|
|
363
|
-
FORCE_COLOR: "3",
|
|
364
|
-
...process.env
|
|
365
|
-
},
|
|
366
|
-
shell: true,
|
|
367
|
-
stdio: "inherit"
|
|
368
|
-
}).status ?? 0;
|
|
369
|
-
checkResult(name, status, "error", exitOnFail);
|
|
370
|
-
totalStatus += status ?? 0;
|
|
371
|
-
}
|
|
372
|
-
return totalStatus;
|
|
373
|
-
}, !!exitOnFail);
|
|
374
|
-
}, "runSteps");
|
|
375
|
-
|
|
376
|
-
// src/lib/runStepsAsync.ts
|
|
377
|
-
import { spawn } from "node:child_process";
|
|
378
|
-
import { existsSync as existsSync3 } from "node:fs";
|
|
379
|
-
import chalk6 from "chalk";
|
|
380
|
-
var runStepAsync = /* @__PURE__ */ __name((name, step, exitOnFail = true, message) => {
|
|
381
|
-
return new Promise((resolve) => {
|
|
382
|
-
const [command, args, config] = step;
|
|
383
|
-
if (message) {
|
|
384
|
-
console.log(chalk6.gray(message));
|
|
385
|
-
}
|
|
386
|
-
const argList = Array.isArray(args) ? args : args.split(" ");
|
|
387
|
-
if (command === "node" && !existsSync3(argList[0])) {
|
|
388
|
-
throw new Error(`File not found [${argList[0]}]`);
|
|
389
|
-
}
|
|
390
|
-
spawn(command, Array.isArray(args) ? args : args.split(" "), {
|
|
391
|
-
...config,
|
|
392
|
-
env: {
|
|
393
|
-
FORCE_COLOR: "3",
|
|
394
|
-
...process.env
|
|
395
|
-
},
|
|
396
|
-
shell: true,
|
|
397
|
-
stdio: "inherit"
|
|
398
|
-
}).on("close", (code) => {
|
|
399
|
-
if (code) {
|
|
400
|
-
console.error(chalk6.red(`Command Exited With Non-Zero Result [${chalk6.gray(code)}] | ${chalk6.yellow(command)} ${chalk6.white(Array.isArray(args) ? args.join(" ") : args)}`));
|
|
401
|
-
checkResult(name, code, "error", exitOnFail);
|
|
402
|
-
resolve(code);
|
|
403
|
-
} else {
|
|
404
|
-
resolve(0);
|
|
405
|
-
}
|
|
406
|
-
});
|
|
407
|
-
});
|
|
408
|
-
}, "runStepAsync");
|
|
409
|
-
var runStepsAsync = /* @__PURE__ */ __name(async (name, steps, exitOnFail = true, messages) => {
|
|
410
|
-
return await safeExitAsync(async () => {
|
|
411
|
-
const pkgName = process.env.npm_package_name;
|
|
412
|
-
console.log(chalk6.green(`${name} [${pkgName}]`));
|
|
413
|
-
let result = 0;
|
|
414
|
-
for (const [i, step] of steps.entries()) {
|
|
415
|
-
result += await runStepAsync(name, step, exitOnFail, messages?.[i]);
|
|
416
|
-
}
|
|
417
|
-
return result;
|
|
418
|
-
});
|
|
419
|
-
}, "runStepsAsync");
|
|
420
|
-
|
|
421
|
-
// src/actions/build.ts
|
|
422
|
-
var build = /* @__PURE__ */ __name(async ({ incremental, jobs, target, verbose, pkg }) => {
|
|
423
|
-
const start = Date.now();
|
|
424
|
-
const pkgOptions = pkg ? [
|
|
425
|
-
pkg
|
|
426
|
-
] : [];
|
|
427
|
-
const incrementalOptions = incremental ? [
|
|
428
|
-
"-i"
|
|
429
|
-
] : [];
|
|
430
|
-
const verboseOptions = verbose ? [
|
|
431
|
-
"-v"
|
|
432
|
-
] : [];
|
|
433
|
-
const targetOptions = target ? [
|
|
434
|
-
"-t",
|
|
435
|
-
target
|
|
436
|
-
] : [];
|
|
437
|
-
const jobsOptions = jobs ? [
|
|
438
|
-
"-j",
|
|
439
|
-
`${jobs}`
|
|
440
|
-
] : [];
|
|
441
|
-
if (jobs) {
|
|
442
|
-
console.log(chalk7.blue(`Jobs set to [${jobs}]`));
|
|
443
|
-
}
|
|
444
|
-
const result = await runStepsAsync(`Build${incremental ? "-Incremental" : ""} [${pkg ?? "All"}]`, [
|
|
445
|
-
[
|
|
446
|
-
"yarn",
|
|
447
|
-
[
|
|
448
|
-
"xy",
|
|
449
|
-
"compile",
|
|
450
|
-
...pkgOptions,
|
|
451
|
-
...targetOptions,
|
|
452
|
-
...verboseOptions,
|
|
453
|
-
...jobsOptions,
|
|
454
|
-
...incrementalOptions,
|
|
455
|
-
"--types",
|
|
456
|
-
"tsup"
|
|
457
|
-
]
|
|
458
|
-
],
|
|
459
|
-
[
|
|
460
|
-
"yarn",
|
|
461
|
-
[
|
|
462
|
-
"xy",
|
|
463
|
-
"lint",
|
|
464
|
-
...pkgOptions,
|
|
465
|
-
...verboseOptions,
|
|
466
|
-
...incrementalOptions
|
|
467
|
-
]
|
|
468
|
-
],
|
|
469
|
-
[
|
|
470
|
-
"yarn",
|
|
471
|
-
[
|
|
472
|
-
"xy",
|
|
473
|
-
"deps",
|
|
474
|
-
...pkgOptions,
|
|
475
|
-
...verboseOptions,
|
|
476
|
-
...jobsOptions,
|
|
477
|
-
...incrementalOptions
|
|
478
|
-
]
|
|
479
|
-
]
|
|
480
|
-
]);
|
|
481
|
-
console.log(`${chalk7.gray("Built in")} [${chalk7.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk7.gray("seconds")}`);
|
|
482
|
-
return result;
|
|
483
|
-
}, "build");
|
|
484
|
-
|
|
485
|
-
// src/actions/clean.ts
|
|
486
|
-
var clean = /* @__PURE__ */ __name(async ({ verbose, pkg }) => {
|
|
487
|
-
return pkg ? await cleanPackage({
|
|
488
|
-
pkg,
|
|
489
|
-
verbose
|
|
490
|
-
}) : cleanAll({
|
|
491
|
-
verbose
|
|
492
|
-
});
|
|
493
|
-
}, "clean");
|
|
494
|
-
var cleanPackage = /* @__PURE__ */ __name(({ pkg }) => {
|
|
495
|
-
return runStepsAsync(`Clean [${pkg}]`, [
|
|
496
|
-
[
|
|
497
|
-
"yarn",
|
|
498
|
-
[
|
|
499
|
-
"workspace",
|
|
500
|
-
pkg,
|
|
501
|
-
"run",
|
|
502
|
-
"package-clean"
|
|
503
|
-
]
|
|
504
|
-
]
|
|
505
|
-
]);
|
|
506
|
-
}, "cleanPackage");
|
|
507
|
-
var cleanAll = /* @__PURE__ */ __name(({ verbose }) => {
|
|
508
|
-
const verboseOptions = verbose ? [
|
|
509
|
-
"--verbose"
|
|
510
|
-
] : [
|
|
511
|
-
"--no-verbose"
|
|
512
|
-
];
|
|
513
|
-
return runStepsAsync("Clean", [
|
|
514
|
-
[
|
|
515
|
-
"yarn",
|
|
516
|
-
[
|
|
517
|
-
"workspaces foreach",
|
|
518
|
-
"-pA",
|
|
519
|
-
"--jobs 64",
|
|
520
|
-
...verboseOptions,
|
|
521
|
-
"run",
|
|
522
|
-
"package-clean"
|
|
523
|
-
]
|
|
524
|
-
]
|
|
525
|
-
]);
|
|
526
|
-
}, "cleanAll");
|
|
527
|
-
|
|
528
|
-
// src/actions/clean-docs.ts
|
|
529
|
-
import path from "node:path";
|
|
530
|
-
import chalk8 from "chalk";
|
|
531
|
-
var cleanDocs = /* @__PURE__ */ __name(() => {
|
|
532
|
-
const pkgName = process.env.npm_package_name;
|
|
533
|
-
console.log(chalk8.green(`Cleaning Docs [${pkgName}]`));
|
|
534
|
-
for (const { location } of yarnWorkspaces()) deleteGlob(path.join(location, "docs"));
|
|
535
|
-
return 0;
|
|
536
|
-
}, "cleanDocs");
|
|
537
|
-
|
|
538
|
-
// src/actions/compile.ts
|
|
539
|
-
import chalk9 from "chalk";
|
|
540
|
-
var compile = /* @__PURE__ */ __name(({ verbose, target, pkg, incremental, publint: publint2, jobs, types }) => {
|
|
541
|
-
return pkg ? compilePackage({
|
|
542
|
-
pkg,
|
|
543
|
-
publint: publint2,
|
|
544
|
-
target,
|
|
545
|
-
verbose,
|
|
546
|
-
types
|
|
547
|
-
}) : compileAll({
|
|
548
|
-
incremental,
|
|
549
|
-
publint: publint2,
|
|
550
|
-
target,
|
|
551
|
-
verbose,
|
|
552
|
-
jobs,
|
|
553
|
-
types
|
|
554
|
-
});
|
|
555
|
-
}, "compile");
|
|
556
|
-
var compilePackage = /* @__PURE__ */ __name(({ target, pkg, types }) => {
|
|
557
|
-
const targetOptions = target ? [
|
|
558
|
-
"-t",
|
|
559
|
-
target
|
|
560
|
-
] : [];
|
|
561
|
-
return runSteps(`Compile [${pkg}]`, [
|
|
562
|
-
[
|
|
563
|
-
"yarn",
|
|
564
|
-
[
|
|
565
|
-
"workspace",
|
|
566
|
-
pkg,
|
|
567
|
-
"run",
|
|
568
|
-
types === "tsup" ? "package-compile" : "package-build",
|
|
569
|
-
...targetOptions
|
|
570
|
-
]
|
|
571
|
-
]
|
|
572
|
-
]);
|
|
573
|
-
}, "compilePackage");
|
|
574
|
-
var compileAll = /* @__PURE__ */ __name(({ jobs, verbose, target, incremental, types }) => {
|
|
575
|
-
const start = Date.now();
|
|
576
|
-
const verboseOptions = verbose ? [
|
|
577
|
-
"--verbose"
|
|
578
|
-
] : [
|
|
579
|
-
"--no-verbose"
|
|
580
|
-
];
|
|
581
|
-
const targetOptions = target ? [
|
|
582
|
-
"-t",
|
|
583
|
-
target
|
|
584
|
-
] : [];
|
|
585
|
-
const incrementalOptions = incremental ? [
|
|
586
|
-
"--since",
|
|
587
|
-
"-Apt",
|
|
588
|
-
"--topological-dev"
|
|
589
|
-
] : [
|
|
590
|
-
"--parallel",
|
|
591
|
-
"-Apt",
|
|
592
|
-
"--topological-dev"
|
|
593
|
-
];
|
|
594
|
-
const jobsOptions = jobs ? [
|
|
595
|
-
"-j",
|
|
596
|
-
`${jobs}`
|
|
597
|
-
] : [];
|
|
598
|
-
if (jobs) {
|
|
599
|
-
console.log(chalk9.blue(`Jobs set to [${jobs}]`));
|
|
600
|
-
}
|
|
601
|
-
const result = runSteps(`Compile${incremental ? "-Incremental" : ""} [All]`, [
|
|
602
|
-
[
|
|
603
|
-
"yarn",
|
|
604
|
-
[
|
|
605
|
-
"workspaces",
|
|
606
|
-
"foreach",
|
|
607
|
-
...incrementalOptions,
|
|
608
|
-
...jobsOptions,
|
|
609
|
-
...verboseOptions,
|
|
610
|
-
"run",
|
|
611
|
-
types === "tsup" ? "package-compile" : "package-build",
|
|
612
|
-
...targetOptions
|
|
613
|
-
]
|
|
614
|
-
]
|
|
615
|
-
]);
|
|
616
|
-
console.log(`${chalk9.gray("Compiled in")} [${chalk9.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk9.gray("seconds")}`);
|
|
617
|
-
return result;
|
|
618
|
-
}, "compileAll");
|
|
619
|
-
|
|
620
|
-
// src/actions/copy-assets.ts
|
|
621
|
-
import path2 from "node:path/posix";
|
|
622
|
-
import chalk10 from "chalk";
|
|
623
|
-
import cpy from "cpy";
|
|
624
|
-
var copyPackageTargetAssets = /* @__PURE__ */ __name(async (target, name, location) => {
|
|
625
|
-
try {
|
|
626
|
-
const values = await cpy([
|
|
627
|
-
"**/*.jpg",
|
|
628
|
-
"**/*.png",
|
|
629
|
-
"**/*.gif",
|
|
630
|
-
"**/*.svg",
|
|
631
|
-
"**/*.webp",
|
|
632
|
-
"**/*.sass",
|
|
633
|
-
"**/*.scss",
|
|
634
|
-
"**/*.gif",
|
|
635
|
-
"**/*.css"
|
|
636
|
-
], `../dist/${target}`, {
|
|
637
|
-
cwd: path2.join(process.cwd(), location, "src"),
|
|
638
|
-
flat: false
|
|
639
|
-
});
|
|
640
|
-
for (const value of values) {
|
|
641
|
-
console.log(`${value.split("/").pop()} => ./dist/${target}`);
|
|
642
|
-
}
|
|
643
|
-
return 0;
|
|
644
|
-
} catch (reason) {
|
|
645
|
-
console.log(`Copy Failed: ${name}: ${reason}`);
|
|
646
|
-
return 1;
|
|
647
|
-
}
|
|
648
|
-
}, "copyPackageTargetAssets");
|
|
649
|
-
var copyTargetAssets = /* @__PURE__ */ __name(async (target, pkg) => {
|
|
650
|
-
const workspaces = yarnWorkspaces();
|
|
651
|
-
console.log(chalk10.green(`Copying Assets [${target.toUpperCase()}]`));
|
|
652
|
-
const workspaceList = workspaces.filter(({ name }) => {
|
|
653
|
-
return pkg === void 0 || name === pkg;
|
|
654
|
-
});
|
|
655
|
-
if (workspaceList.length === 0) {
|
|
656
|
-
console.error(`Package not found [${pkg}]`);
|
|
657
|
-
} else {
|
|
658
|
-
const results = await Promise.all(workspaceList.map(async (workspace) => {
|
|
659
|
-
const { location, name } = workspace;
|
|
660
|
-
return await copyPackageTargetAssets(target, name, location);
|
|
661
|
-
}));
|
|
662
|
-
return results.reduce((prev, result) => prev || result, 0);
|
|
663
|
-
}
|
|
664
|
-
return 0;
|
|
665
|
-
}, "copyTargetAssets");
|
|
666
|
-
var copyAssets = /* @__PURE__ */ __name(async ({ target, pkg }) => {
|
|
667
|
-
switch (target) {
|
|
668
|
-
case "esm": {
|
|
669
|
-
return await copyTargetAssets("esm", pkg);
|
|
670
|
-
}
|
|
671
|
-
case "cjs": {
|
|
672
|
-
return await copyTargetAssets("cjs", pkg);
|
|
673
|
-
}
|
|
674
|
-
default: {
|
|
675
|
-
return await copyTargetAssets("esm", pkg) || await copyTargetAssets("cjs", pkg);
|
|
676
|
-
}
|
|
677
|
-
}
|
|
678
|
-
}, "copyAssets");
|
|
679
|
-
|
|
680
|
-
// src/actions/cycle.ts
|
|
681
|
-
import { ESLint } from "eslint";
|
|
682
|
-
var cycle = /* @__PURE__ */ __name(async () => {
|
|
683
|
-
const eslint = new ESLint({
|
|
684
|
-
fix: false,
|
|
685
|
-
overrideConfig: {
|
|
686
|
-
rules: {
|
|
687
|
-
"import-x/no-cycle": [
|
|
688
|
-
"error",
|
|
689
|
-
{
|
|
690
|
-
maxDepth: 10
|
|
691
|
-
}
|
|
692
|
-
]
|
|
693
|
-
}
|
|
694
|
-
}
|
|
695
|
-
});
|
|
696
|
-
const results = await eslint.lintFiles([
|
|
697
|
-
"src/**/*.ts*",
|
|
698
|
-
"packages/**/src/**/*.ts*"
|
|
699
|
-
]);
|
|
700
|
-
const formatter = await eslint.loadFormatter("stylish");
|
|
701
|
-
const resultText = formatter.format(results);
|
|
702
|
-
console.log(resultText);
|
|
703
|
-
return results.length;
|
|
704
|
-
}, "cycle");
|
|
705
|
-
|
|
706
|
-
// src/actions/dead.ts
|
|
707
|
-
var dead = /* @__PURE__ */ __name(() => {
|
|
708
|
-
return runSteps("Dead", [
|
|
709
|
-
[
|
|
710
|
-
"yarn",
|
|
711
|
-
[
|
|
712
|
-
"ts-prune",
|
|
713
|
-
"-p",
|
|
714
|
-
"tsconfig.json"
|
|
715
|
-
]
|
|
716
|
-
]
|
|
717
|
-
]);
|
|
718
|
-
}, "dead");
|
|
719
|
-
|
|
720
|
-
// src/actions/deploy.ts
|
|
721
|
-
var deploy = /* @__PURE__ */ __name(() => {
|
|
722
|
-
return runSteps("Deploy [Patch]", [
|
|
723
|
-
[
|
|
724
|
-
"yarn",
|
|
725
|
-
"workspaces foreach --all version patch --deferred"
|
|
726
|
-
],
|
|
727
|
-
[
|
|
728
|
-
"yarn",
|
|
729
|
-
"xy clean"
|
|
730
|
-
],
|
|
731
|
-
[
|
|
732
|
-
"yarn",
|
|
733
|
-
"xy build"
|
|
734
|
-
],
|
|
735
|
-
[
|
|
736
|
-
"yarn",
|
|
737
|
-
"version apply --all"
|
|
738
|
-
],
|
|
739
|
-
[
|
|
740
|
-
"yarn",
|
|
741
|
-
"workspaces foreach --all --parallel npm publish"
|
|
742
|
-
]
|
|
743
|
-
]);
|
|
744
|
-
}, "deploy");
|
|
745
|
-
|
|
746
|
-
// src/actions/deploy-major.ts
|
|
747
|
-
var deployMajor = /* @__PURE__ */ __name(() => {
|
|
748
|
-
return runSteps("Deploy [Major]", [
|
|
749
|
-
[
|
|
750
|
-
"yarn",
|
|
751
|
-
"workspaces foreach --all version major --deferred"
|
|
752
|
-
],
|
|
753
|
-
[
|
|
754
|
-
"yarn",
|
|
755
|
-
"xy clean"
|
|
756
|
-
],
|
|
757
|
-
[
|
|
758
|
-
"yarn",
|
|
759
|
-
"xy build"
|
|
760
|
-
],
|
|
761
|
-
[
|
|
762
|
-
"yarn",
|
|
763
|
-
"version apply --all"
|
|
764
|
-
],
|
|
765
|
-
[
|
|
766
|
-
"yarn",
|
|
767
|
-
"workspaces foreach --all --parallel npm publish"
|
|
768
|
-
]
|
|
769
|
-
]);
|
|
770
|
-
}, "deployMajor");
|
|
771
|
-
|
|
772
|
-
// src/actions/deploy-minor.ts
|
|
773
|
-
var deployMinor = /* @__PURE__ */ __name(() => {
|
|
774
|
-
return runSteps("Deploy [Minor]", [
|
|
775
|
-
[
|
|
776
|
-
"yarn",
|
|
777
|
-
"workspaces foreach --all version minor --deferred"
|
|
778
|
-
],
|
|
779
|
-
[
|
|
780
|
-
"yarn",
|
|
781
|
-
"xy clean"
|
|
782
|
-
],
|
|
783
|
-
[
|
|
784
|
-
"yarn",
|
|
785
|
-
"xy build"
|
|
786
|
-
],
|
|
787
|
-
[
|
|
788
|
-
"yarn",
|
|
789
|
-
"version apply --all"
|
|
790
|
-
],
|
|
791
|
-
[
|
|
792
|
-
"yarn",
|
|
793
|
-
"workspaces foreach --all --parallel npm publish"
|
|
794
|
-
]
|
|
795
|
-
]);
|
|
796
|
-
}, "deployMinor");
|
|
797
|
-
|
|
798
|
-
// src/actions/deploy-next.ts
|
|
799
|
-
var deployNext = /* @__PURE__ */ __name(() => {
|
|
800
|
-
return runSteps("Deploy [Next]", [
|
|
801
|
-
[
|
|
802
|
-
"yarn",
|
|
803
|
-
"workspaces foreach --all version minor --deferred"
|
|
804
|
-
],
|
|
805
|
-
[
|
|
806
|
-
"yarn",
|
|
807
|
-
"xy clean"
|
|
808
|
-
],
|
|
809
|
-
[
|
|
810
|
-
"yarn",
|
|
811
|
-
"xy build"
|
|
812
|
-
],
|
|
813
|
-
[
|
|
814
|
-
"yarn",
|
|
815
|
-
"version apply --all --prerelease"
|
|
816
|
-
],
|
|
817
|
-
[
|
|
818
|
-
"yarn",
|
|
819
|
-
"workspaces foreach --all --parallel npm publish --tag next"
|
|
820
|
-
]
|
|
821
|
-
]);
|
|
822
|
-
}, "deployNext");
|
|
823
|
-
|
|
824
|
-
// src/actions/deps.ts
|
|
825
|
-
import chalk11 from "chalk";
|
|
826
|
-
var deps = /* @__PURE__ */ __name(({ pkg, incremental }) => {
|
|
827
|
-
pkg ? depsPackage({
|
|
828
|
-
pkg
|
|
829
|
-
}) : depsAll({
|
|
830
|
-
incremental
|
|
831
|
-
});
|
|
832
|
-
return 0;
|
|
833
|
-
}, "deps");
|
|
834
|
-
var depsPackage = /* @__PURE__ */ __name(({ pkg }) => {
|
|
835
|
-
const steps = [
|
|
836
|
-
[
|
|
837
|
-
"yarn",
|
|
838
|
-
[
|
|
839
|
-
"workspace",
|
|
840
|
-
pkg,
|
|
841
|
-
"run",
|
|
842
|
-
"package-deps"
|
|
843
|
-
]
|
|
844
|
-
]
|
|
845
|
-
];
|
|
846
|
-
return runSteps(`Deps [${pkg}]`, [
|
|
847
|
-
...steps
|
|
848
|
-
]);
|
|
849
|
-
}, "depsPackage");
|
|
850
|
-
var depsAll = /* @__PURE__ */ __name(({ incremental, jobs, verbose }) => {
|
|
851
|
-
const start = Date.now();
|
|
852
|
-
const jobsOptions = jobs ? [
|
|
853
|
-
"-j",
|
|
854
|
-
`${jobs}`
|
|
855
|
-
] : [];
|
|
856
|
-
const verboseOptions = verbose ? [
|
|
857
|
-
"--verbose"
|
|
858
|
-
] : [
|
|
859
|
-
"--no-verbose"
|
|
860
|
-
];
|
|
861
|
-
if (jobs) {
|
|
862
|
-
console.log(chalk11.blue(`Jobs set to [${jobs}]`));
|
|
863
|
-
}
|
|
864
|
-
const incrementalOptions = incremental ? [
|
|
865
|
-
"--since",
|
|
866
|
-
"-pA"
|
|
867
|
-
] : [
|
|
868
|
-
"-pA"
|
|
869
|
-
];
|
|
870
|
-
const steps = [
|
|
871
|
-
[
|
|
872
|
-
"yarn",
|
|
873
|
-
[
|
|
874
|
-
"workspaces",
|
|
875
|
-
"foreach",
|
|
876
|
-
...jobsOptions,
|
|
877
|
-
...incrementalOptions,
|
|
878
|
-
...verboseOptions,
|
|
879
|
-
"run",
|
|
880
|
-
"package-deps"
|
|
881
|
-
]
|
|
882
|
-
]
|
|
883
|
-
];
|
|
884
|
-
const result = runSteps(`Deps${incremental ? "-Incremental" : ""} [All]`, [
|
|
885
|
-
...steps
|
|
886
|
-
]);
|
|
887
|
-
console.log(`${chalk11.gray("Dep checked in")} [${chalk11.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk11.gray("seconds")}`);
|
|
888
|
-
return result;
|
|
889
|
-
}, "depsAll");
|
|
890
|
-
|
|
891
|
-
// src/actions/dupdeps.ts
|
|
892
|
-
import chalk12 from "chalk";
|
|
893
|
-
var dupdeps = /* @__PURE__ */ __name(() => {
|
|
894
|
-
console.log(chalk12.green("Checking all Dependencies for Duplicates"));
|
|
895
|
-
const allDependencies = parsedPackageJSON()?.dependencies;
|
|
896
|
-
const dependencies = Object.entries(allDependencies).map(([k]) => k);
|
|
897
|
-
return detectDuplicateDependencies(dependencies);
|
|
898
|
-
}, "dupdeps");
|
|
899
|
-
|
|
900
|
-
// src/actions/lint.ts
|
|
901
|
-
import chalk13 from "chalk";
|
|
902
|
-
import { ESLint as ESLint2 } from "eslint";
|
|
903
|
-
var dumpMessages = /* @__PURE__ */ __name((lintResults) => {
|
|
904
|
-
const colors = [
|
|
905
|
-
"white",
|
|
906
|
-
"yellow",
|
|
907
|
-
"red"
|
|
908
|
-
];
|
|
909
|
-
const severity = [
|
|
910
|
-
"none",
|
|
911
|
-
"warning",
|
|
912
|
-
"error"
|
|
913
|
-
];
|
|
914
|
-
for (const lintResult of lintResults) {
|
|
915
|
-
if (lintResult.messages.length > 0) {
|
|
916
|
-
console.log(chalk13.gray(`${lintResult.filePath}`));
|
|
917
|
-
for (const message of lintResult.messages) {
|
|
918
|
-
console.log(chalk13.gray(` ${message.line}:${message.column}`), chalk13[colors[message.severity]](` ${severity[message.severity]}`), chalk13.white(` ${message.message}`), chalk13.gray(` ${message.ruleId}`));
|
|
919
|
-
}
|
|
920
|
-
}
|
|
921
|
-
}
|
|
922
|
-
}, "dumpMessages");
|
|
923
|
-
var lintPackage = /* @__PURE__ */ __name(async ({ pkg, fix: fix2 }) => {
|
|
924
|
-
const workspace = yarnWorkspaces().find((workspace2) => workspace2.name === pkg);
|
|
925
|
-
if (!workspace) {
|
|
926
|
-
console.error(chalk13.red(`Unable to locate package [${chalk13.magenta(pkg)}]`));
|
|
927
|
-
process.exit(1);
|
|
928
|
-
}
|
|
929
|
-
const engine = new ESLint2({
|
|
930
|
-
cache: true,
|
|
931
|
-
fix: fix2
|
|
932
|
-
});
|
|
933
|
-
const lintResults = await engine.lintFiles(workspace.location);
|
|
934
|
-
dumpMessages(lintResults);
|
|
935
|
-
return lintResults.reduce((prev, lintResult) => prev + lintResult.errorCount, 0);
|
|
936
|
-
}, "lintPackage");
|
|
937
|
-
var lint = /* @__PURE__ */ __name(async ({ pkg, verbose, incremental, fix: fix2 } = {}) => {
|
|
938
|
-
return pkg ? await lintPackage({
|
|
939
|
-
pkg,
|
|
940
|
-
fix: fix2
|
|
941
|
-
}) : lintAllPackages({
|
|
942
|
-
verbose,
|
|
943
|
-
incremental,
|
|
944
|
-
fix: fix2
|
|
945
|
-
});
|
|
946
|
-
}, "lint");
|
|
947
|
-
var lintAllPackages = /* @__PURE__ */ __name(({ fix: fix2, verbose = true, incremental } = {}) => {
|
|
948
|
-
console.log(chalk13.gray(`${fix2 ? "Fix" : "Lint"} [All-Packages]`));
|
|
949
|
-
const start = Date.now();
|
|
950
|
-
const verboseOptions = verbose ? [
|
|
951
|
-
"--verbose"
|
|
952
|
-
] : [
|
|
953
|
-
"--no-verbose"
|
|
954
|
-
];
|
|
955
|
-
const incrementalOptions = incremental ? [
|
|
956
|
-
"--since",
|
|
957
|
-
"-Apt"
|
|
958
|
-
] : [
|
|
959
|
-
"--parallel",
|
|
960
|
-
"-Apt"
|
|
961
|
-
];
|
|
962
|
-
const result = runSteps(`${fix2 ? "Fix" : "Lint"} [All-Packages]`, [
|
|
963
|
-
[
|
|
964
|
-
"yarn",
|
|
965
|
-
[
|
|
966
|
-
"workspaces",
|
|
967
|
-
"foreach",
|
|
968
|
-
...verboseOptions,
|
|
969
|
-
...incrementalOptions,
|
|
970
|
-
"run",
|
|
971
|
-
fix2 ? "package-fix" : "package-lint"
|
|
972
|
-
]
|
|
973
|
-
]
|
|
974
|
-
]);
|
|
975
|
-
console.log(chalk13.gray(`${fix2 ? "Fixed in" : "Linted in"} [${chalk13.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk13.gray("seconds")}`));
|
|
976
|
-
return result;
|
|
977
|
-
}, "lintAllPackages");
|
|
978
|
-
|
|
979
|
-
// src/actions/fix.ts
|
|
980
|
-
var fix = /* @__PURE__ */ __name(async () => {
|
|
981
|
-
return await lint({
|
|
982
|
-
fix: true
|
|
983
|
-
});
|
|
984
|
-
}, "fix");
|
|
985
|
-
|
|
986
|
-
// src/actions/gen-docs.ts
|
|
987
|
-
var genDocs = /* @__PURE__ */ __name(({ pkg, incremental }) => {
|
|
988
|
-
return pkg ? genDocsPackage({
|
|
989
|
-
pkg
|
|
990
|
-
}) : genDocsAll({
|
|
991
|
-
incremental
|
|
992
|
-
});
|
|
993
|
-
}, "genDocs");
|
|
994
|
-
var genDocsPackage = /* @__PURE__ */ __name(({ pkg }) => {
|
|
995
|
-
const steps = [
|
|
996
|
-
[
|
|
997
|
-
"yarn",
|
|
998
|
-
[
|
|
999
|
-
"workspace",
|
|
1000
|
-
pkg,
|
|
1001
|
-
"run",
|
|
1002
|
-
"package-gen-docs"
|
|
1003
|
-
]
|
|
1004
|
-
]
|
|
1005
|
-
];
|
|
1006
|
-
return runSteps(`GenDocs [${pkg}]`, [
|
|
1007
|
-
...steps
|
|
1008
|
-
]);
|
|
1009
|
-
}, "genDocsPackage");
|
|
1010
|
-
var genDocsAll = /* @__PURE__ */ __name(({ incremental }) => {
|
|
1011
|
-
const incrementalOptions = incremental ? [
|
|
1012
|
-
"--since",
|
|
1013
|
-
"-pA"
|
|
1014
|
-
] : [
|
|
1015
|
-
"-pA"
|
|
1016
|
-
];
|
|
1017
|
-
const steps = [
|
|
1018
|
-
[
|
|
1019
|
-
"yarn",
|
|
1020
|
-
[
|
|
1021
|
-
"workspaces",
|
|
1022
|
-
"foreach",
|
|
1023
|
-
...incrementalOptions,
|
|
1024
|
-
"run",
|
|
1025
|
-
"package-gen-docs"
|
|
1026
|
-
]
|
|
1027
|
-
]
|
|
1028
|
-
];
|
|
1029
|
-
return runSteps(`GenDocs [All${incremental ? "-Incremental" : ""}]`, [
|
|
1030
|
-
...steps
|
|
1031
|
-
]);
|
|
1032
|
-
}, "genDocsAll");
|
|
1033
|
-
|
|
1034
|
-
// src/actions/gitignore-gen.ts
|
|
1035
|
-
var filename = ".gitignore";
|
|
1036
|
-
var gitignoreGen = /* @__PURE__ */ __name((pkg) => generateIgnoreFiles(filename, pkg), "gitignoreGen");
|
|
1037
|
-
|
|
1038
|
-
// src/actions/gitlint.ts
|
|
1039
|
-
import chalk14 from "chalk";
|
|
1040
|
-
import ParseGitConfig from "parse-git-config";
|
|
1041
|
-
var gitlint = /* @__PURE__ */ __name(() => {
|
|
1042
|
-
console.log(`
|
|
1043
|
-
Gitlint Start [${process.cwd()}]
|
|
1044
|
-
`);
|
|
1045
|
-
let valid = 0;
|
|
1046
|
-
let warnings = 0;
|
|
1047
|
-
const errors = 0;
|
|
1048
|
-
const gitConfig = ParseGitConfig.sync();
|
|
1049
|
-
const warn = /* @__PURE__ */ __name((message) => {
|
|
1050
|
-
console.warn(chalk14.yellow(`Warning: ${message}`));
|
|
1051
|
-
warnings++;
|
|
1052
|
-
}, "warn");
|
|
1053
|
-
if (gitConfig.core.ignorecase) {
|
|
1054
|
-
warn("Please set core.ignorecase to FALSE in .git/config file [run yarn gitlint-fix]");
|
|
1055
|
-
} else {
|
|
1056
|
-
valid++;
|
|
1057
|
-
}
|
|
1058
|
-
if (gitConfig.core.autocrlf === false) {
|
|
1059
|
-
valid++;
|
|
1060
|
-
} else {
|
|
1061
|
-
warn("Please set core.autocrlf to FALSE in .git/config file [run yarn gitlint-fix]");
|
|
1062
|
-
}
|
|
1063
|
-
if (gitConfig.core.eol === "lf") {
|
|
1064
|
-
valid++;
|
|
1065
|
-
} else {
|
|
1066
|
-
warn('Please set core.eol to "lf" in .git/config file [run yarn gitlint-fix]');
|
|
1067
|
-
}
|
|
1068
|
-
const resultMessages = [];
|
|
1069
|
-
if (valid > 0) {
|
|
1070
|
-
resultMessages.push(chalk14.green(`Passed: ${valid}`));
|
|
1071
|
-
}
|
|
1072
|
-
if (warnings > 0) {
|
|
1073
|
-
resultMessages.push(chalk14.yellow(`Warnings: ${warnings}`));
|
|
1074
|
-
}
|
|
1075
|
-
if (errors > 0) {
|
|
1076
|
-
resultMessages.push(chalk14.red(` Errors: ${errors}`));
|
|
1077
|
-
}
|
|
1078
|
-
console.warn(`Gitlint Finish [ ${resultMessages.join(" | ")} ]
|
|
1079
|
-
`);
|
|
1080
|
-
return warnings + errors === 0 ? 1 : 0;
|
|
1081
|
-
}, "gitlint");
|
|
1082
|
-
|
|
1083
|
-
// src/actions/gitlint-fix.ts
|
|
1084
|
-
import { execSync as execSync2 } from "node:child_process";
|
|
1085
|
-
import chalk15 from "chalk";
|
|
1086
|
-
import ParseGitConfig2 from "parse-git-config";
|
|
1087
|
-
var gitlintFix = /* @__PURE__ */ __name(() => {
|
|
1088
|
-
console.log(`
|
|
1089
|
-
Gitlint Fix Start [${process.cwd()}]
|
|
1090
|
-
`);
|
|
1091
|
-
const gitConfig = ParseGitConfig2.sync();
|
|
1092
|
-
if (gitConfig.core.ignorecase) {
|
|
1093
|
-
execSync2("git config core.ignorecase false", {
|
|
1094
|
-
stdio: "inherit"
|
|
1095
|
-
});
|
|
1096
|
-
console.warn(chalk15.yellow("\nGitlint Fix: Updated core.ignorecase to be false\n"));
|
|
1097
|
-
}
|
|
1098
|
-
if (gitConfig.core.autocrlf !== false) {
|
|
1099
|
-
execSync2("git config core.autocrlf false", {
|
|
1100
|
-
stdio: "inherit"
|
|
1101
|
-
});
|
|
1102
|
-
console.warn(chalk15.yellow("\nGitlint Fix: Updated core.autocrlf to be false\n"));
|
|
1103
|
-
}
|
|
1104
|
-
if (gitConfig.core.eol !== "lf") {
|
|
1105
|
-
execSync2("git config core.eol lf", {
|
|
1106
|
-
stdio: "inherit"
|
|
1107
|
-
});
|
|
1108
|
-
console.warn(chalk15.yellow('\nGitlint Fix: Updated core.eol to be "lf"\n'));
|
|
1109
|
-
}
|
|
1110
|
-
return 1;
|
|
1111
|
-
}, "gitlintFix");
|
|
1112
|
-
|
|
1113
|
-
// src/actions/license.ts
|
|
1114
|
-
import chalk16 from "chalk";
|
|
1115
|
-
import { init } from "license-checker";
|
|
1116
|
-
var license = /* @__PURE__ */ __name(async (pkg) => {
|
|
1117
|
-
const workspaces = yarnWorkspaces();
|
|
1118
|
-
const workspaceList = workspaces.filter(({ name }) => {
|
|
1119
|
-
return pkg === void 0 || name === pkg;
|
|
1120
|
-
});
|
|
1121
|
-
const exclude = /* @__PURE__ */ new Set([
|
|
1122
|
-
"MIT",
|
|
1123
|
-
"MIT*",
|
|
1124
|
-
"ISC",
|
|
1125
|
-
"Apache-2.0",
|
|
1126
|
-
"BSD",
|
|
1127
|
-
"BSD*",
|
|
1128
|
-
"BSD-2-Clause",
|
|
1129
|
-
"BSD-3-Clause",
|
|
1130
|
-
"CC-BY-4.0",
|
|
1131
|
-
"Unlicense",
|
|
1132
|
-
"CC-BY-3.0",
|
|
1133
|
-
"CC0-1.0",
|
|
1134
|
-
"LGPL-3.0-only",
|
|
1135
|
-
"LGPL-3.0",
|
|
1136
|
-
"LGPL-3.0-or-later",
|
|
1137
|
-
"Python-2.0"
|
|
1138
|
-
]);
|
|
1139
|
-
console.log(chalk16.green("License Checker"));
|
|
1140
|
-
return (await Promise.all(workspaceList.map(({ location, name }) => {
|
|
1141
|
-
return new Promise((resolve) => {
|
|
1142
|
-
init({
|
|
1143
|
-
production: true,
|
|
1144
|
-
start: location
|
|
1145
|
-
}, (error, packages) => {
|
|
1146
|
-
if (error) {
|
|
1147
|
-
console.error(chalk16.red(`License Checker [${name}] Error`));
|
|
1148
|
-
console.error(chalk16.gray(error));
|
|
1149
|
-
console.log("\n");
|
|
1150
|
-
resolve(1);
|
|
1151
|
-
} else {
|
|
1152
|
-
console.log(chalk16.green(`License Checker [${name}]`));
|
|
1153
|
-
let count = 0;
|
|
1154
|
-
for (const [name2, info] of Object.entries(packages)) {
|
|
1155
|
-
const licenses = Array.isArray(info.licenses) ? info.licenses : [
|
|
1156
|
-
info.licenses
|
|
1157
|
-
];
|
|
1158
|
-
for (let license2 of licenses) {
|
|
1159
|
-
if (license2) {
|
|
1160
|
-
const processedLicense = license2[0] === "(" && license2.at(-1) === ")" ? license2.slice(1, -2) : license2;
|
|
1161
|
-
const orLicenses = processedLicense.split(" OR ");
|
|
1162
|
-
let orLicenseFound = false;
|
|
1163
|
-
for (const orLicense of orLicenses) {
|
|
1164
|
-
if (exclude.has(orLicense)) {
|
|
1165
|
-
orLicenseFound = true;
|
|
1166
|
-
}
|
|
1167
|
-
}
|
|
1168
|
-
if (!orLicenseFound) {
|
|
1169
|
-
count++;
|
|
1170
|
-
console.warn(chalk16.yellow(`${name2}: Package License not allowed [${license2}]`));
|
|
1171
|
-
}
|
|
1172
|
-
}
|
|
1173
|
-
}
|
|
1174
|
-
}
|
|
1175
|
-
console.log("\n");
|
|
1176
|
-
resolve(count);
|
|
1177
|
-
}
|
|
1178
|
-
});
|
|
1179
|
-
});
|
|
1180
|
-
}))).reduce((prev, value) => prev || value, 0);
|
|
1181
|
-
}, "license");
|
|
1182
|
-
|
|
1183
|
-
// src/actions/lint-profile.ts
|
|
1184
|
-
var lintProfile = /* @__PURE__ */ __name(() => {
|
|
1185
|
-
return runSteps("Lint Profile", [
|
|
1186
|
-
[
|
|
1187
|
-
"yarn",
|
|
1188
|
-
[
|
|
1189
|
-
"xy",
|
|
1190
|
-
"lint"
|
|
1191
|
-
],
|
|
1192
|
-
{
|
|
1193
|
-
env: {
|
|
1194
|
-
...process.env,
|
|
1195
|
-
TIMING: "1"
|
|
1196
|
-
}
|
|
1197
|
-
}
|
|
1198
|
-
]
|
|
1199
|
-
]);
|
|
1200
|
-
}, "lintProfile");
|
|
1201
|
-
|
|
1202
|
-
// src/actions/npmignore-gen.ts
|
|
1203
|
-
var filename2 = ".npmignore";
|
|
1204
|
-
var npmignoreGen = /* @__PURE__ */ __name((pkg) => generateIgnoreFiles(filename2, pkg), "npmignoreGen");
|
|
1205
|
-
|
|
1206
|
-
// src/actions/publint.ts
|
|
1207
|
-
var publint = /* @__PURE__ */ __name(async ({ verbose, pkg }) => {
|
|
1208
|
-
return pkg ? await publintPackage({
|
|
1209
|
-
pkg,
|
|
1210
|
-
verbose
|
|
1211
|
-
}) : publintAll({
|
|
1212
|
-
verbose
|
|
1213
|
-
});
|
|
1214
|
-
}, "publint");
|
|
1215
|
-
var publintPackage = /* @__PURE__ */ __name(({ pkg }) => {
|
|
1216
|
-
return runStepsAsync(`Publint [${pkg}]`, [
|
|
1217
|
-
[
|
|
1218
|
-
"yarn",
|
|
1219
|
-
[
|
|
1220
|
-
"workspace",
|
|
1221
|
-
pkg,
|
|
1222
|
-
"run",
|
|
1223
|
-
"package-publint"
|
|
1224
|
-
]
|
|
1225
|
-
]
|
|
1226
|
-
]);
|
|
1227
|
-
}, "publintPackage");
|
|
1228
|
-
var publintAll = /* @__PURE__ */ __name(({ verbose }) => {
|
|
1229
|
-
const verboseOptions = verbose ? [
|
|
1230
|
-
"--verbose"
|
|
1231
|
-
] : [
|
|
1232
|
-
"--no-verbose"
|
|
1233
|
-
];
|
|
1234
|
-
return runSteps("Publint", [
|
|
1235
|
-
[
|
|
1236
|
-
"yarn",
|
|
1237
|
-
[
|
|
1238
|
-
"workspaces",
|
|
1239
|
-
"foreach",
|
|
1240
|
-
"-pA",
|
|
1241
|
-
...verboseOptions,
|
|
1242
|
-
"run",
|
|
1243
|
-
"package-publint"
|
|
1244
|
-
]
|
|
1245
|
-
]
|
|
1246
|
-
]);
|
|
1247
|
-
}, "publintAll");
|
|
1248
|
-
|
|
1249
|
-
// src/actions/rebuild.ts
|
|
1250
|
-
var rebuild = /* @__PURE__ */ __name(({ target }) => {
|
|
1251
|
-
return runSteps("Rebuild", [
|
|
1252
|
-
[
|
|
1253
|
-
"yarn",
|
|
1254
|
-
"xy clean"
|
|
1255
|
-
],
|
|
1256
|
-
[
|
|
1257
|
-
"yarn",
|
|
1258
|
-
target ? `xy build -t ${target}` : "xy build"
|
|
1259
|
-
]
|
|
1260
|
-
]);
|
|
1261
|
-
}, "rebuild");
|
|
1262
|
-
|
|
1263
|
-
// src/actions/recompile.ts
|
|
1264
|
-
import chalk17 from "chalk";
|
|
1265
|
-
var recompile = /* @__PURE__ */ __name(async ({ verbose, target, pkg, incremental }) => {
|
|
1266
|
-
return pkg ? await recompilePackage({
|
|
1267
|
-
pkg,
|
|
1268
|
-
target,
|
|
1269
|
-
verbose
|
|
1270
|
-
}) : await recompileAll({
|
|
1271
|
-
incremental,
|
|
1272
|
-
target,
|
|
1273
|
-
verbose
|
|
1274
|
-
});
|
|
1275
|
-
}, "recompile");
|
|
1276
|
-
var recompilePackage = /* @__PURE__ */ __name(({ verbose, target, pkg }) => {
|
|
1277
|
-
const targetOptions = target ? [
|
|
1278
|
-
"-t",
|
|
1279
|
-
target
|
|
1280
|
-
] : [];
|
|
1281
|
-
const verboseOptions = verbose ? [
|
|
1282
|
-
"--verbose"
|
|
1283
|
-
] : [
|
|
1284
|
-
"--no-verbose"
|
|
1285
|
-
];
|
|
1286
|
-
return runStepsAsync(`Recompile [${pkg}]`, [
|
|
1287
|
-
[
|
|
1288
|
-
"yarn",
|
|
1289
|
-
[
|
|
1290
|
-
"workspace",
|
|
1291
|
-
pkg,
|
|
1292
|
-
...verboseOptions,
|
|
1293
|
-
"run",
|
|
1294
|
-
"package-recompile",
|
|
1295
|
-
...targetOptions
|
|
1296
|
-
]
|
|
1297
|
-
]
|
|
1298
|
-
]);
|
|
1299
|
-
}, "recompilePackage");
|
|
1300
|
-
var recompileAll = /* @__PURE__ */ __name(async ({ jobs, verbose, target, incremental }) => {
|
|
1301
|
-
const start = Date.now();
|
|
1302
|
-
const verboseOptions = verbose ? [
|
|
1303
|
-
"--verbose"
|
|
1304
|
-
] : [
|
|
1305
|
-
"--no-verbose"
|
|
1306
|
-
];
|
|
1307
|
-
const targetOptions = target ? [
|
|
1308
|
-
"-t",
|
|
1309
|
-
target
|
|
1310
|
-
] : [];
|
|
1311
|
-
const incrementalOptions = incremental ? [
|
|
1312
|
-
"--since",
|
|
1313
|
-
"-Apt",
|
|
1314
|
-
"--topological-dev"
|
|
1315
|
-
] : [
|
|
1316
|
-
"--parallel",
|
|
1317
|
-
"-Apt",
|
|
1318
|
-
"--topological-dev"
|
|
1319
|
-
];
|
|
1320
|
-
const jobsOptions = jobs ? [
|
|
1321
|
-
"-j",
|
|
1322
|
-
`${jobs}`
|
|
1323
|
-
] : [];
|
|
1324
|
-
if (jobs) {
|
|
1325
|
-
console.log(chalk17.blue(`Jobs set to [${jobs}]`));
|
|
1326
|
-
}
|
|
1327
|
-
const result = await runStepsAsync(`Recompile${incremental ? "-Incremental" : ""} [All]`, [
|
|
1328
|
-
[
|
|
1329
|
-
"yarn",
|
|
1330
|
-
[
|
|
1331
|
-
"workspaces",
|
|
1332
|
-
"foreach",
|
|
1333
|
-
...incrementalOptions,
|
|
1334
|
-
...jobsOptions,
|
|
1335
|
-
...verboseOptions,
|
|
1336
|
-
"run",
|
|
1337
|
-
"package-clean",
|
|
1338
|
-
...targetOptions
|
|
1339
|
-
]
|
|
1340
|
-
],
|
|
1341
|
-
[
|
|
1342
|
-
"yarn",
|
|
1343
|
-
[
|
|
1344
|
-
"workspaces",
|
|
1345
|
-
"foreach",
|
|
1346
|
-
...incrementalOptions,
|
|
1347
|
-
...jobsOptions,
|
|
1348
|
-
...verboseOptions,
|
|
1349
|
-
"run",
|
|
1350
|
-
"package-compile",
|
|
1351
|
-
...targetOptions
|
|
1352
|
-
]
|
|
1353
|
-
]
|
|
1354
|
-
]);
|
|
1355
|
-
console.log(`${chalk17.gray("Recompiled in")} [${chalk17.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk17.gray("seconds")}`);
|
|
1356
|
-
return result;
|
|
1357
|
-
}, "recompileAll");
|
|
1358
|
-
|
|
1359
|
-
// src/actions/reinstall.ts
|
|
1360
|
-
import { closeSync, openSync, rmSync } from "node:fs";
|
|
1361
|
-
var reinstall = /* @__PURE__ */ __name(() => {
|
|
1362
|
-
console.log("Reinstall [Clear Lock File]");
|
|
1363
|
-
closeSync(openSync("./yarn.lock", "w"));
|
|
1364
|
-
console.log("Reinstall [Clear Node Modules]");
|
|
1365
|
-
const workspaces = yarnWorkspaces();
|
|
1366
|
-
const result = workspaces.map(({ location, name }) => {
|
|
1367
|
-
const dist = `${location}/node_modules`;
|
|
1368
|
-
try {
|
|
1369
|
-
rmSync(dist, {
|
|
1370
|
-
force: true,
|
|
1371
|
-
recursive: true
|
|
1372
|
-
});
|
|
1373
|
-
return 0;
|
|
1374
|
-
} catch (ex) {
|
|
1375
|
-
const error = ex;
|
|
1376
|
-
console.error(`Reinstall [Clear Node Modules] Failed [${name}, ${error.message}]`);
|
|
1377
|
-
return 1;
|
|
1378
|
-
}
|
|
1379
|
-
}).reduce((prev, result2) => prev || result2, 0);
|
|
1380
|
-
return result || runSteps("Reinstall", [
|
|
1381
|
-
[
|
|
1382
|
-
"yarn",
|
|
1383
|
-
"install --network-timeout 10000"
|
|
1384
|
-
]
|
|
1385
|
-
]);
|
|
1386
|
-
}, "reinstall");
|
|
1387
|
-
|
|
1388
|
-
// src/actions/relint.ts
|
|
1389
|
-
import { rmSync as rmSync2 } from "node:fs";
|
|
1390
|
-
var relint = /* @__PURE__ */ __name(() => {
|
|
1391
|
-
console.log("Relint - Cleaning [.eslintcache]");
|
|
1392
|
-
const workspaces = yarnWorkspaces();
|
|
1393
|
-
const result = workspaces.map(({ location, name }) => {
|
|
1394
|
-
const dist = `${location}/.eslintcache`;
|
|
1395
|
-
try {
|
|
1396
|
-
rmSync2(dist, {
|
|
1397
|
-
force: true,
|
|
1398
|
-
recursive: true
|
|
1399
|
-
});
|
|
1400
|
-
return 0;
|
|
1401
|
-
} catch (ex) {
|
|
1402
|
-
const error = ex;
|
|
1403
|
-
console.error(`Relint - Cleaning [.eslintcache] Failed [${name}, ${error.message}]`);
|
|
1404
|
-
return 1;
|
|
1405
|
-
}
|
|
1406
|
-
}).reduce((prev, result2) => prev || result2, 0);
|
|
1407
|
-
return result || runSteps("Relint", [
|
|
1408
|
-
[
|
|
1409
|
-
"yarn",
|
|
1410
|
-
[
|
|
1411
|
-
"eslint",
|
|
1412
|
-
".",
|
|
1413
|
-
"--cache"
|
|
1414
|
-
]
|
|
1415
|
-
]
|
|
1416
|
-
]);
|
|
1417
|
-
}, "relint");
|
|
1418
|
-
|
|
1419
|
-
// src/actions/retest.ts
|
|
1420
|
-
var retest = /* @__PURE__ */ __name(() => {
|
|
1421
|
-
return runSteps("Test", [
|
|
1422
|
-
[
|
|
1423
|
-
"yarn",
|
|
1424
|
-
[
|
|
1425
|
-
"jest",
|
|
1426
|
-
"--clearCache"
|
|
1427
|
-
]
|
|
1428
|
-
],
|
|
1429
|
-
[
|
|
1430
|
-
"yarn",
|
|
1431
|
-
[
|
|
1432
|
-
"jest",
|
|
1433
|
-
"."
|
|
1434
|
-
]
|
|
1435
|
-
]
|
|
1436
|
-
]);
|
|
1437
|
-
}, "retest");
|
|
1438
|
-
|
|
1439
|
-
// src/actions/sonar.ts
|
|
1440
|
-
var sonar = /* @__PURE__ */ __name(() => {
|
|
1441
|
-
return runSteps("Sonar", [
|
|
1442
|
-
[
|
|
1443
|
-
"yarn",
|
|
1444
|
-
[
|
|
1445
|
-
"eslint",
|
|
1446
|
-
"-c",
|
|
1447
|
-
"sonar.eslintrc",
|
|
1448
|
-
"."
|
|
1449
|
-
]
|
|
1450
|
-
]
|
|
1451
|
-
]);
|
|
1452
|
-
}, "sonar");
|
|
1453
|
-
|
|
1454
|
-
// src/actions/statics.ts
|
|
1455
|
-
import chalk18 from "chalk";
|
|
1456
|
-
var DefaultDependencies = [
|
|
1457
|
-
"axios",
|
|
1458
|
-
"@xylabs/pixel",
|
|
1459
|
-
"react",
|
|
1460
|
-
"graphql",
|
|
1461
|
-
"react-router",
|
|
1462
|
-
"@mui/material",
|
|
1463
|
-
"@mui/system"
|
|
1464
|
-
];
|
|
1465
|
-
var statics = /* @__PURE__ */ __name(() => {
|
|
1466
|
-
console.log(chalk18.green("Check Required Static Dependencies"));
|
|
1467
|
-
const statics2 = parsedPackageJSON()?.xy?.deps?.statics;
|
|
1468
|
-
return detectDuplicateDependencies(statics2, DefaultDependencies);
|
|
1469
|
-
}, "statics");
|
|
1470
|
-
|
|
1471
|
-
// src/actions/test.ts
|
|
1472
|
-
var test = /* @__PURE__ */ __name(() => {
|
|
1473
|
-
return runSteps("Test", [
|
|
1474
|
-
[
|
|
1475
|
-
"yarn",
|
|
1476
|
-
[
|
|
1477
|
-
"vitest",
|
|
1478
|
-
"."
|
|
1479
|
-
]
|
|
1480
|
-
]
|
|
1481
|
-
]);
|
|
1482
|
-
}, "test");
|
|
1483
|
-
|
|
1484
|
-
// src/actions/up.ts
|
|
1485
|
-
var up = /* @__PURE__ */ __name(() => {
|
|
1486
|
-
return runSteps("Up", [
|
|
1487
|
-
[
|
|
1488
|
-
"yarn",
|
|
1489
|
-
"outdated"
|
|
1490
|
-
]
|
|
1491
|
-
]);
|
|
1492
|
-
}, "up");
|
|
1493
|
-
|
|
1494
|
-
// src/actions/updo.ts
|
|
1495
|
-
var updo = /* @__PURE__ */ __name(() => {
|
|
1496
|
-
return runSteps("Updo", [
|
|
1497
|
-
[
|
|
1498
|
-
"yarn",
|
|
1499
|
-
"install"
|
|
1500
|
-
],
|
|
1501
|
-
[
|
|
1502
|
-
"yarn",
|
|
1503
|
-
"upgrade-interactive"
|
|
1504
|
-
],
|
|
1505
|
-
[
|
|
1506
|
-
"yarn",
|
|
1507
|
-
"dedupe"
|
|
1508
|
-
]
|
|
1509
|
-
]);
|
|
1510
|
-
}, "updo");
|
|
1511
|
-
|
|
1512
|
-
// src/actions/upplug.ts
|
|
1513
|
-
var updateYarnPlugins = /* @__PURE__ */ __name(() => {
|
|
1514
|
-
return runSteps("Update Yarn Plugins", [
|
|
1515
|
-
[
|
|
1516
|
-
"yarn",
|
|
1517
|
-
[
|
|
1518
|
-
"plugin",
|
|
1519
|
-
"import",
|
|
1520
|
-
"https://mskelton.dev/yarn-outdated/v3"
|
|
1521
|
-
]
|
|
1522
|
-
],
|
|
1523
|
-
[
|
|
1524
|
-
"yarn",
|
|
1525
|
-
[
|
|
1526
|
-
"plugin",
|
|
1527
|
-
"import",
|
|
1528
|
-
"version"
|
|
1529
|
-
]
|
|
1530
|
-
],
|
|
1531
|
-
[
|
|
1532
|
-
"yarn",
|
|
1533
|
-
[
|
|
1534
|
-
"plugin",
|
|
1535
|
-
"import",
|
|
1536
|
-
"interactive-tools"
|
|
1537
|
-
]
|
|
1538
|
-
],
|
|
1539
|
-
[
|
|
1540
|
-
"yarn",
|
|
1541
|
-
[
|
|
1542
|
-
"plugin",
|
|
1543
|
-
"import",
|
|
1544
|
-
"workspace-tools"
|
|
1545
|
-
]
|
|
1546
|
-
]
|
|
1547
|
-
]);
|
|
1548
|
-
}, "updateYarnPlugins");
|
|
1549
|
-
|
|
1550
|
-
// src/actions/upyarn.ts
|
|
1551
|
-
var updateYarnVersion = /* @__PURE__ */ __name(() => {
|
|
1552
|
-
return runSteps("Update Yarn Version", [
|
|
1553
|
-
[
|
|
1554
|
-
"yarn",
|
|
1555
|
-
[
|
|
1556
|
-
"set",
|
|
1557
|
-
"version",
|
|
1558
|
-
"latest"
|
|
1559
|
-
]
|
|
1560
|
-
]
|
|
1561
|
-
]);
|
|
1562
|
-
}, "updateYarnVersion");
|
|
1563
|
-
|
|
1564
|
-
// src/actions/yarn3only.ts
|
|
1565
|
-
var yarn3Only = /* @__PURE__ */ __name(() => {
|
|
1566
|
-
const [valid, version] = isYarnVersionOrGreater(3);
|
|
1567
|
-
if (!valid) {
|
|
1568
|
-
processEx(`Invalid Yarn version [${version}]`);
|
|
1569
|
-
}
|
|
1570
|
-
return 0;
|
|
1571
|
-
}, "yarn3Only");
|
|
1572
|
-
|
|
1573
|
-
// src/xy/xyBuildCommands.ts
|
|
1574
|
-
var xyBuildCommands = /* @__PURE__ */ __name((args) => {
|
|
1575
|
-
return args.command("build [package]", "Build - Compile & Lint", (yargs2) => {
|
|
1576
|
-
return yargs2.positional("package", {
|
|
1577
|
-
describe: "Specific package to build"
|
|
1578
|
-
});
|
|
1579
|
-
}, async (argv) => {
|
|
1580
|
-
if (argv.verbose) {
|
|
1581
|
-
console.log(`Building: ${argv.package ?? "all"}`);
|
|
1582
|
-
}
|
|
1583
|
-
process.exitCode = await build({
|
|
1584
|
-
incremental: !!argv.incremental,
|
|
1585
|
-
jobs: argv.jobs,
|
|
1586
|
-
pkg: argv.package,
|
|
1587
|
-
target: argv.target,
|
|
1588
|
-
verbose: !!argv.verbose
|
|
1589
|
-
});
|
|
1590
|
-
}).command("compile [package]", "Compile with Typescript & Copy Images", (yargs2) => {
|
|
1591
|
-
return yargs2.positional("package", {
|
|
1592
|
-
describe: "Specific package to compile"
|
|
1593
|
-
});
|
|
1594
|
-
}, (argv) => {
|
|
1595
|
-
if (argv.verbose) {
|
|
1596
|
-
console.log(`Compiling: ${argv.package ?? "all"}`);
|
|
1597
|
-
}
|
|
1598
|
-
process.exitCode = compile({
|
|
1599
|
-
incremental: !!argv.incremental,
|
|
1600
|
-
jobs: argv.jobs,
|
|
1601
|
-
pkg: argv.package,
|
|
1602
|
-
target: argv.target,
|
|
1603
|
-
types: argv.types,
|
|
1604
|
-
verbose: !!argv.verbose
|
|
1605
|
-
});
|
|
1606
|
-
}).command("compile-only [package]", "Compile with Typescript & Copy Images (No Publint)", (yargs2) => {
|
|
1607
|
-
return yargs2.positional("package", {
|
|
1608
|
-
describe: "Specific package to compile"
|
|
1609
|
-
});
|
|
1610
|
-
}, (argv) => {
|
|
1611
|
-
if (argv.verbose) {
|
|
1612
|
-
console.log(`Compiling: ${argv.package ?? "all"}`);
|
|
1613
|
-
}
|
|
1614
|
-
process.exitCode = compile({
|
|
1615
|
-
incremental: !!argv.incremental,
|
|
1616
|
-
jobs: argv.jobs,
|
|
1617
|
-
pkg: argv.package,
|
|
1618
|
-
publint: false,
|
|
1619
|
-
target: argv.target,
|
|
1620
|
-
verbose: !!argv.verbose
|
|
1621
|
-
});
|
|
1622
|
-
}).command("recompile [package]", "Re-compile with Typescript & Copy Images", (yargs2) => {
|
|
1623
|
-
return yargs2.positional("package", {
|
|
1624
|
-
describe: "Specific package to re-compile"
|
|
1625
|
-
});
|
|
1626
|
-
}, async (argv) => {
|
|
1627
|
-
if (argv.verbose) {
|
|
1628
|
-
console.log(`Re-compiling: ${argv.package ?? "all"}`);
|
|
1629
|
-
}
|
|
1630
|
-
process.exitCode = await recompile({
|
|
1631
|
-
incremental: !!argv.incremental,
|
|
1632
|
-
jobs: argv.jobs,
|
|
1633
|
-
pkg: argv.package,
|
|
1634
|
-
target: argv.target,
|
|
1635
|
-
verbose: !!argv.verbose
|
|
1636
|
-
});
|
|
1637
|
-
}).command("rebuild [package]", "Rebuild - Clean, Compile & Lint", (yargs2) => {
|
|
1638
|
-
return yargs2.positional("package", {
|
|
1639
|
-
describe: "Specific package to rebuild"
|
|
1640
|
-
});
|
|
1641
|
-
}, (argv) => {
|
|
1642
|
-
if (argv.verbose) console.log(`Rebuilding: ${argv.package ?? "all"}`);
|
|
1643
|
-
process.exitCode = rebuild({
|
|
1644
|
-
target: argv.target
|
|
1645
|
-
});
|
|
1646
|
-
}).command("copy-assets [package]", "Copy Assets - Copy the assets from src to dist", (yargs2) => {
|
|
1647
|
-
return yargs2.positional("package", {
|
|
1648
|
-
describe: "Specific package to copy assets"
|
|
1649
|
-
});
|
|
1650
|
-
}, async (argv) => {
|
|
1651
|
-
if (argv.verbose) console.log(`Copying Assets: ${argv.package ?? "all"}`);
|
|
1652
|
-
process.exitCode = await copyAssets({
|
|
1653
|
-
target: argv.target
|
|
1654
|
-
});
|
|
1655
|
-
});
|
|
1656
|
-
}, "xyBuildCommands");
|
|
1657
|
-
|
|
1658
|
-
// src/xy/param.ts
|
|
1659
|
-
var packagePositionalParam = /* @__PURE__ */ __name((yargs2) => {
|
|
1660
|
-
return yargs2.positional("package", {
|
|
1661
|
-
describe: "Specific package to target"
|
|
1662
|
-
});
|
|
1663
|
-
}, "packagePositionalParam");
|
|
1664
|
-
|
|
1665
|
-
// src/xy/xyCommonCommands.ts
|
|
1666
|
-
var xyCommonCommands = /* @__PURE__ */ __name((args) => {
|
|
1667
|
-
return args.command("license [package]", "License - Check licenses of dependencies", (yargs2) => {
|
|
1668
|
-
return packagePositionalParam(yargs2);
|
|
1669
|
-
}, async (argv) => {
|
|
1670
|
-
if (argv.verbose) console.log(`License: ${argv.package ?? "all"}`);
|
|
1671
|
-
process.exitCode = await license();
|
|
1672
|
-
}).command("dead [package]", "Dead - Check for dead code", (yargs2) => {
|
|
1673
|
-
return packagePositionalParam(yargs2);
|
|
1674
|
-
}, (argv) => {
|
|
1675
|
-
if (argv.verbose) console.log("Dead");
|
|
1676
|
-
process.exitCode = dead();
|
|
1677
|
-
}).command("deps [package]", "Deps - Check for unused or missing dependencies", (yargs2) => {
|
|
1678
|
-
return packagePositionalParam(yargs2);
|
|
1679
|
-
}, (argv) => {
|
|
1680
|
-
if (argv.verbose) console.log(`Checking Dependencies: ${argv.package ?? "all"}`);
|
|
1681
|
-
process.exitCode = deps({
|
|
1682
|
-
incremental: !!argv.incremental,
|
|
1683
|
-
jobs: argv.jobs,
|
|
1684
|
-
pkg: argv.package
|
|
1685
|
-
});
|
|
1686
|
-
}).command("gen-docs [package]", "GenDocs - Generate TypeDocs", (yargs2) => {
|
|
1687
|
-
return packagePositionalParam(yargs2);
|
|
1688
|
-
}, (argv) => {
|
|
1689
|
-
if (argv.verbose) console.log(`Generating TypeDocs: ${argv.package ?? "all"}`);
|
|
1690
|
-
process.exitCode = genDocs({
|
|
1691
|
-
incremental: !!argv.incremental,
|
|
1692
|
-
pkg: argv.package
|
|
1693
|
-
});
|
|
1694
|
-
}).command("clean-docs", "CleanDocs - Clean TypeDocs", (yargs2) => yargs2, (argv) => {
|
|
1695
|
-
if (argv.verbose) console.log("Cleaning TypeDocs: all");
|
|
1696
|
-
process.exitCode = cleanDocs();
|
|
1697
|
-
}).command("gitlint [package]", "Gitlint - Lint your git config", (yargs2) => {
|
|
1698
|
-
return yargs2;
|
|
1699
|
-
}, (argv) => {
|
|
1700
|
-
if (argv.verbose) console.log("Gitlint");
|
|
1701
|
-
process.exitCode = argv.fix ? gitlintFix() : gitlint();
|
|
1702
|
-
}).command("gitignore-gen", "GitIgnore Gen - Generate .gitignore files", (yargs2) => {
|
|
1703
|
-
return yargs2;
|
|
1704
|
-
}, (argv) => {
|
|
1705
|
-
if (argv.verbose) console.log("GitIgnore Gen");
|
|
1706
|
-
process.exitCode = gitignoreGen();
|
|
1707
|
-
}).command("npmignore-gen", "NpmIgnore Gen - Generate .npmignore files", (yargs2) => {
|
|
1708
|
-
return yargs2;
|
|
1709
|
-
}, (argv) => {
|
|
1710
|
-
if (argv.verbose) console.log("NpmIgnore Gen");
|
|
1711
|
-
process.exitCode = npmignoreGen();
|
|
1712
|
-
}).command("retest", "Re-Test - Run Jest Tests with cleaned cache", (yargs2) => {
|
|
1713
|
-
return yargs2;
|
|
1714
|
-
}, (argv) => {
|
|
1715
|
-
if (argv.verbose) console.log("Re-Testing");
|
|
1716
|
-
process.exitCode = retest();
|
|
1717
|
-
}).command("test", "Test - Run Jest Tests", (yargs2) => {
|
|
1718
|
-
return yargs2;
|
|
1719
|
-
}, (argv) => {
|
|
1720
|
-
if (argv.verbose) console.log("Testing");
|
|
1721
|
-
process.exitCode = test();
|
|
1722
|
-
}).command("upplug", "UpPlug - Update Yarn Plugins", (yargs2) => {
|
|
1723
|
-
return yargs2;
|
|
1724
|
-
}, (argv) => {
|
|
1725
|
-
if (argv.verbose) console.log("UpPlug");
|
|
1726
|
-
process.exitCode = updateYarnPlugins();
|
|
1727
|
-
}).command("upyarn", "UpYarn - Update Yarn Version", (yargs2) => {
|
|
1728
|
-
return yargs2;
|
|
1729
|
-
}, (argv) => {
|
|
1730
|
-
if (argv.verbose) console.log("UpYarn");
|
|
1731
|
-
process.exitCode = updateYarnVersion();
|
|
1732
|
-
}).command("yarn3only", "Yarn3Only - Check if using Yarn v3", (yargs2) => {
|
|
1733
|
-
return yargs2;
|
|
1734
|
-
}, (argv) => {
|
|
1735
|
-
if (argv.verbose) console.log("Yarn 3 Check");
|
|
1736
|
-
process.exitCode = yarn3Only();
|
|
1737
|
-
});
|
|
1738
|
-
}, "xyCommonCommands");
|
|
1739
|
-
|
|
1740
|
-
// src/xy/xyDeployCommands.ts
|
|
1741
|
-
var xyDeployCommands = /* @__PURE__ */ __name((args) => {
|
|
1742
|
-
return args.command("deploy", "Deploy - Deploy patch", (yargs2) => {
|
|
1743
|
-
return yargs2;
|
|
1744
|
-
}, (argv) => {
|
|
1745
|
-
if (argv.verbose) console.log("Deploy patch");
|
|
1746
|
-
process.exitCode = deploy();
|
|
1747
|
-
}).command("deploy-minor", "Deploy - Deploy minor", (yargs2) => {
|
|
1748
|
-
return yargs2;
|
|
1749
|
-
}, (argv) => {
|
|
1750
|
-
if (argv.verbose) console.log("Deploy minor");
|
|
1751
|
-
process.exitCode = deployMinor();
|
|
1752
|
-
}).command("deploy-major", "Deploy - Deploy major", (yargs2) => {
|
|
1753
|
-
return yargs2;
|
|
1754
|
-
}, (argv) => {
|
|
1755
|
-
if (argv.verbose) console.log("Deploy major");
|
|
1756
|
-
process.exitCode = deployMajor();
|
|
1757
|
-
}).command("deploy-next", "Deploy - Deploy next", (yargs2) => {
|
|
1758
|
-
return yargs2;
|
|
1759
|
-
}, (argv) => {
|
|
1760
|
-
if (argv.verbose) console.log("Deploy next");
|
|
1761
|
-
process.exitCode = deployNext();
|
|
1762
|
-
});
|
|
1763
|
-
}, "xyDeployCommands");
|
|
1764
|
-
|
|
1765
|
-
// src/xy/xyInstallCommands.ts
|
|
1766
|
-
var xyInstallCommands = /* @__PURE__ */ __name((args) => {
|
|
1767
|
-
return args.command("clean [package]", "Clean", (yargs2) => {
|
|
1768
|
-
return yargs2.positional("package", {
|
|
1769
|
-
describe: "Specific package to clean"
|
|
1770
|
-
});
|
|
1771
|
-
}, async (argv) => {
|
|
1772
|
-
if (argv.verbose) {
|
|
1773
|
-
console.log(`Cleaning: ${argv.package ?? "all"}`);
|
|
1774
|
-
}
|
|
1775
|
-
process.exitCode = await clean({
|
|
1776
|
-
pkg: argv.package,
|
|
1777
|
-
verbose: !!argv.verbose
|
|
1778
|
-
});
|
|
1779
|
-
}).command("reinstall", "Reinstall - Clean & Install", (yargs2) => {
|
|
1780
|
-
return yargs2;
|
|
1781
|
-
}, (argv) => {
|
|
1782
|
-
if (argv.verbose) console.log("Reinstalling");
|
|
1783
|
-
process.exitCode = reinstall();
|
|
1784
|
-
}).command("up", "Up - Update dependencies", (yargs2) => {
|
|
1785
|
-
return yargs2;
|
|
1786
|
-
}, (argv) => {
|
|
1787
|
-
if (argv.verbose) console.log("Up");
|
|
1788
|
-
process.exitCode = up();
|
|
1789
|
-
}).command("updo", "Updo - Update dependencies [Interactive]", (yargs2) => {
|
|
1790
|
-
return yargs2;
|
|
1791
|
-
}, (argv) => {
|
|
1792
|
-
if (argv.verbose) console.log("Updo");
|
|
1793
|
-
process.exitCode = updo();
|
|
1794
|
-
}).command("statics", "Statics - Confirming Static Packages", (yargs2) => {
|
|
1795
|
-
return yargs2;
|
|
1796
|
-
}, (argv) => {
|
|
1797
|
-
if (argv.verbose) console.log("Statics");
|
|
1798
|
-
process.exitCode = statics();
|
|
1799
|
-
}).command("dupdeps", "Dupdeps - Duplicate Dependencies in package.json", (yargs2) => {
|
|
1800
|
-
return yargs2;
|
|
1801
|
-
}, (argv) => {
|
|
1802
|
-
if (argv.verbose) console.log("Dupdeps");
|
|
1803
|
-
process.exitCode = dupdeps();
|
|
1804
|
-
});
|
|
1805
|
-
}, "xyInstallCommands");
|
|
1806
|
-
|
|
1807
|
-
// src/xy/xyLintCommands.ts
|
|
1808
|
-
import chalk19 from "chalk";
|
|
1809
|
-
var xyLintCommands = /* @__PURE__ */ __name((args) => {
|
|
1810
|
-
return args.command("cycle [package]", "Cycle - Check for dependency cycles", (yargs2) => {
|
|
1811
|
-
return packagePositionalParam(yargs2);
|
|
1812
|
-
}, async (argv) => {
|
|
1813
|
-
const start = Date.now();
|
|
1814
|
-
if (argv.verbose) console.log("Cycle");
|
|
1815
|
-
process.exitCode = await cycle();
|
|
1816
|
-
console.log(chalk19.blue(`Finished in ${Date.now() - start}ms`));
|
|
1817
|
-
}).command("lint [package]", "Lint - Run Eslint", (yargs2) => {
|
|
1818
|
-
return packagePositionalParam(yargs2);
|
|
1819
|
-
}, async (argv) => {
|
|
1820
|
-
if (argv.verbose) console.log("Lint");
|
|
1821
|
-
const start = Date.now();
|
|
1822
|
-
process.exitCode = argv.fix ? await fix() : argv.profile ? lintProfile() : await lint({
|
|
1823
|
-
pkg: argv.package
|
|
1824
|
-
});
|
|
1825
|
-
console.log(chalk19.blue(`Finished in ${Date.now() - start}ms`));
|
|
1826
|
-
}).command("fix [package]", "Fix - Run Eslint w/fix", (yargs2) => {
|
|
1827
|
-
return packagePositionalParam(yargs2);
|
|
1828
|
-
}, async (argv) => {
|
|
1829
|
-
const start = Date.now();
|
|
1830
|
-
if (argv.verbose) console.log("Fix");
|
|
1831
|
-
process.exitCode = await fix();
|
|
1832
|
-
console.log(chalk19.blue(`Finished in ${Date.now() - start}ms`));
|
|
1833
|
-
}).command("relint [package]", "Relint - Clean & Lint", (yargs2) => {
|
|
1834
|
-
return packagePositionalParam(yargs2);
|
|
1835
|
-
}, (argv) => {
|
|
1836
|
-
if (argv.verbose) console.log("Relinting");
|
|
1837
|
-
const start = Date.now();
|
|
1838
|
-
process.exitCode = relint();
|
|
1839
|
-
console.log(chalk19.blue(`Finished in ${Date.now() - start}ms`));
|
|
1840
|
-
}).command("publint [package]", "Publint - Run Publint", (yargs2) => {
|
|
1841
|
-
return packagePositionalParam(yargs2);
|
|
1842
|
-
}, async (argv) => {
|
|
1843
|
-
if (argv.verbose) console.log("Publint");
|
|
1844
|
-
const start = Date.now();
|
|
1845
|
-
process.exitCode = await publint({
|
|
1846
|
-
pkg: argv.package,
|
|
1847
|
-
verbose: !!argv.verbose
|
|
1848
|
-
});
|
|
1849
|
-
console.log(chalk19.blue(`Finished in ${Date.now() - start}ms`));
|
|
1850
|
-
}).command("sonar", "Sonar - Run Sonar Check", (yargs2) => {
|
|
1851
|
-
return packagePositionalParam(yargs2);
|
|
1852
|
-
}, (argv) => {
|
|
1853
|
-
const start = Date.now();
|
|
1854
|
-
if (argv.verbose) console.log("Sonar Check");
|
|
1855
|
-
process.exitCode = sonar();
|
|
1856
|
-
console.log(chalk19.blue(`Finished in ${Date.now() - start}ms`));
|
|
1857
|
-
});
|
|
1858
|
-
}, "xyLintCommands");
|
|
1859
|
-
|
|
1860
|
-
// src/xy/xyParseOptions.ts
|
|
1861
|
-
import yargs from "yargs";
|
|
1862
|
-
import { hideBin } from "yargs/helpers";
|
|
1863
|
-
var xyParseOptions = /* @__PURE__ */ __name(() => {
|
|
1864
|
-
return yargs(hideBin(process.argv)).scriptName("yarn xy").option("jobs", {
|
|
1865
|
-
alias: "j",
|
|
1866
|
-
default: void 0,
|
|
1867
|
-
description: "Max parallel jobs",
|
|
1868
|
-
type: "number"
|
|
1869
|
-
}).option("verbose", {
|
|
1870
|
-
alias: "v",
|
|
1871
|
-
default: false,
|
|
1872
|
-
description: "Run with verbose logging",
|
|
1873
|
-
type: "boolean"
|
|
1874
|
-
}).option("target", {
|
|
1875
|
-
alias: "t",
|
|
1876
|
-
default: "esm",
|
|
1877
|
-
choices: [
|
|
1878
|
-
"esm",
|
|
1879
|
-
"cjs"
|
|
1880
|
-
],
|
|
1881
|
-
description: "Limit output to specific target",
|
|
1882
|
-
type: "string"
|
|
1883
|
-
}).option("incremental", {
|
|
1884
|
-
alias: "i",
|
|
1885
|
-
default: false,
|
|
1886
|
-
description: "Attempt to perform the action only on changed packages",
|
|
1887
|
-
type: "boolean"
|
|
1888
|
-
}).option("fix", {
|
|
1889
|
-
alias: "f",
|
|
1890
|
-
default: false,
|
|
1891
|
-
description: "Try to fix errors",
|
|
1892
|
-
type: "boolean"
|
|
1893
|
-
}).option("cache", {
|
|
1894
|
-
alias: "c",
|
|
1895
|
-
default: false,
|
|
1896
|
-
description: "Use caching for performance",
|
|
1897
|
-
type: "boolean"
|
|
1898
|
-
}).option("profile", {
|
|
1899
|
-
alias: "p",
|
|
1900
|
-
default: false,
|
|
1901
|
-
description: "Profile action",
|
|
1902
|
-
type: "boolean"
|
|
1903
|
-
}).option("types", {
|
|
1904
|
-
default: "tsc",
|
|
1905
|
-
choices: [
|
|
1906
|
-
"tsc",
|
|
1907
|
-
"tsup"
|
|
1908
|
-
],
|
|
1909
|
-
description: "Tool to generate Typescript types",
|
|
1910
|
-
type: "string"
|
|
1911
|
-
});
|
|
1912
|
-
}, "xyParseOptions");
|
|
1913
|
-
|
|
1914
|
-
// src/xy/xy.ts
|
|
1915
|
-
var xy = /* @__PURE__ */ __name(async () => {
|
|
1916
|
-
const options = xyParseOptions();
|
|
1917
|
-
return await xyBuildCommands(xyCommonCommands(xyInstallCommands(xyDeployCommands(xyLintCommands(options))))).demandCommand(1).command("*", "", () => {
|
|
1918
|
-
console.error(chalk20.yellow(`Command not found [${chalk20.magenta(process.argv[2])}]`));
|
|
1919
|
-
console.log(chalk20.gray("Try 'yarn xy --help' for list of commands"));
|
|
1920
|
-
}).version().help().argv;
|
|
1921
|
-
}, "xy");
|
|
1922
|
-
|
|
1923
|
-
// src/bin/xy-ts.ts
|
|
1924
|
-
xy().then(() => {
|
|
1925
|
-
process.exit(0);
|
|
1926
|
-
}).catch((error) => {
|
|
1927
|
-
console.error(error);
|
|
1928
|
-
process.exit(1);
|
|
1929
|
-
});
|
|
1930
|
-
//# sourceMappingURL=xy-ts.mjs.map
|