@xylabs/ts-scripts-yarn3 7.4.22 → 7.4.24
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/claude-settings.mjs +2 -2
- package/dist/actions/claude-settings.mjs.map +1 -1
- package/dist/actions/index.mjs +168 -12
- package/dist/actions/index.mjs.map +1 -1
- package/dist/actions/package-lint.mjs +178 -0
- package/dist/actions/package-lint.mjs.map +1 -0
- package/dist/bin/xy.mjs +204 -32
- package/dist/bin/xy.mjs.map +1 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.mjs +205 -32
- package/dist/index.mjs.map +1 -1
- package/dist/xy/common/claude/index.mjs +2 -2
- package/dist/xy/common/claude/index.mjs.map +1 -1
- package/dist/xy/common/claude/initCommand.mjs +2 -2
- package/dist/xy/common/claude/initCommand.mjs.map +1 -1
- package/dist/xy/common/claude/settingsCommand.mjs +2 -2
- package/dist/xy/common/claude/settingsCommand.mjs.map +1 -1
- package/dist/xy/common/index.mjs +2 -2
- package/dist/xy/common/index.mjs.map +1 -1
- package/dist/xy/index.mjs +204 -32
- package/dist/xy/index.mjs.map +1 -1
- package/dist/xy/lint/index.mjs +200 -22
- package/dist/xy/lint/index.mjs.map +1 -1
- package/dist/xy/lint/packageLintCommand.mjs +193 -0
- package/dist/xy/lint/packageLintCommand.mjs.map +1 -0
- package/dist/xy/xy.mjs +204 -32
- package/dist/xy/xy.mjs.map +1 -1
- package/package.json +2 -2
- package/templates/gitignore/template.gitignore +11 -0
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
// src/actions/package-lint.ts
|
|
2
|
+
import { readFileSync, writeFileSync } from "fs";
|
|
3
|
+
import PATH from "path";
|
|
4
|
+
import chalk from "chalk";
|
|
5
|
+
import picomatch from "picomatch";
|
|
6
|
+
|
|
7
|
+
// src/lib/yarn/workspace/yarnWorkspaces.ts
|
|
8
|
+
import { spawnSync } from "child_process";
|
|
9
|
+
var yarnWorkspaces = () => {
|
|
10
|
+
const result = spawnSync("yarn", ["workspaces", "list", "--json", "--recursive"], { encoding: "utf8", shell: true });
|
|
11
|
+
if (result.error) {
|
|
12
|
+
throw result.error;
|
|
13
|
+
}
|
|
14
|
+
return result.stdout.toString().split("\n").slice(0, -1).map((item) => {
|
|
15
|
+
return JSON.parse(item);
|
|
16
|
+
});
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
// src/lib/yarn/yarnInitCwd.ts
|
|
20
|
+
var INIT_CWD = () => {
|
|
21
|
+
if (!process.env.INIT_CWD) console.error("Missing INIT_CWD");
|
|
22
|
+
return process.env.INIT_CWD;
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
// src/actions/package-lint.ts
|
|
26
|
+
function emptyResult() {
|
|
27
|
+
return {
|
|
28
|
+
errors: [],
|
|
29
|
+
fixable: [],
|
|
30
|
+
warnings: []
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
function readRootPackageJson(cwd) {
|
|
34
|
+
const raw = readFileSync(PATH.resolve(cwd, "package.json"), "utf8");
|
|
35
|
+
return JSON.parse(raw);
|
|
36
|
+
}
|
|
37
|
+
function writeRootPackageJson(cwd, pkg) {
|
|
38
|
+
const path = PATH.resolve(cwd, "package.json");
|
|
39
|
+
writeFileSync(path, `${JSON.stringify(pkg, null, 2)}
|
|
40
|
+
`, "utf8");
|
|
41
|
+
}
|
|
42
|
+
function isMonorepo(pkg) {
|
|
43
|
+
const workspaces = pkg.workspaces;
|
|
44
|
+
return Array.isArray(workspaces) && workspaces.length > 0;
|
|
45
|
+
}
|
|
46
|
+
function checkPackagesFolder(workspaces) {
|
|
47
|
+
const result = emptyResult();
|
|
48
|
+
for (const { location, name } of workspaces) {
|
|
49
|
+
if (location === ".") continue;
|
|
50
|
+
if (!location.startsWith("packages/") && !location.startsWith("packages\\")) {
|
|
51
|
+
result.errors.push(`${name} (${location}) is not inside a packages/ folder`);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
return result;
|
|
55
|
+
}
|
|
56
|
+
function checkRootPrivate(pkg) {
|
|
57
|
+
const result = emptyResult();
|
|
58
|
+
if (!pkg.private) {
|
|
59
|
+
result.fixable.push("Root package.json must be private to prevent accidental publishing");
|
|
60
|
+
}
|
|
61
|
+
return result;
|
|
62
|
+
}
|
|
63
|
+
function fixRootPrivate(cwd, pkg) {
|
|
64
|
+
pkg.private = true;
|
|
65
|
+
writeRootPackageJson(cwd, pkg);
|
|
66
|
+
console.log(chalk.green(' \u2714 Fixed: set "private": true in root package.json'));
|
|
67
|
+
}
|
|
68
|
+
function checkNoPublishConfigOnPrivate(pkg) {
|
|
69
|
+
const result = emptyResult();
|
|
70
|
+
if (pkg.private && pkg.publishConfig) {
|
|
71
|
+
result.fixable.push("Root package.json has publishConfig but is private \u2014 publishConfig is unnecessary");
|
|
72
|
+
}
|
|
73
|
+
return result;
|
|
74
|
+
}
|
|
75
|
+
function fixNoPublishConfigOnPrivate(cwd, pkg) {
|
|
76
|
+
delete pkg.publishConfig;
|
|
77
|
+
writeRootPackageJson(cwd, pkg);
|
|
78
|
+
console.log(chalk.green(" \u2714 Fixed: removed publishConfig from private root package.json"));
|
|
79
|
+
}
|
|
80
|
+
function checkDiscoverable(pkg, workspaces) {
|
|
81
|
+
const result = emptyResult();
|
|
82
|
+
const globs = pkg.workspaces;
|
|
83
|
+
const matchers = globs.map((glob) => picomatch(glob));
|
|
84
|
+
const isMatch = (location) => matchers.some((m) => m(location));
|
|
85
|
+
for (const { location, name } of workspaces) {
|
|
86
|
+
if (location === ".") continue;
|
|
87
|
+
if (!isMatch(location)) {
|
|
88
|
+
result.errors.push(`${name} (${location}) is not matched by any workspace glob in package.json`);
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
return result;
|
|
92
|
+
}
|
|
93
|
+
function logResults(label, result, fix) {
|
|
94
|
+
let errors = 0;
|
|
95
|
+
let fixed = 0;
|
|
96
|
+
for (const error of result.errors) {
|
|
97
|
+
console.log(chalk.red(` \u2717 ${error}`));
|
|
98
|
+
errors++;
|
|
99
|
+
}
|
|
100
|
+
for (const fixable of result.fixable) {
|
|
101
|
+
if (fix) {
|
|
102
|
+
fixed++;
|
|
103
|
+
} else {
|
|
104
|
+
console.log(chalk.red(` \u2717 ${fixable} (fixable)`));
|
|
105
|
+
errors++;
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
for (const warning of result.warnings) {
|
|
109
|
+
console.log(chalk.yellow(` \u26A0 ${warning}`));
|
|
110
|
+
}
|
|
111
|
+
if (errors === 0 && fixed === 0 && result.warnings.length === 0) {
|
|
112
|
+
console.log(chalk.green(` \u2713 ${label}`));
|
|
113
|
+
}
|
|
114
|
+
return { errors, fixed };
|
|
115
|
+
}
|
|
116
|
+
function runChecks(entries, cwd, pkg, fix) {
|
|
117
|
+
let totalErrors = 0;
|
|
118
|
+
let totalFixed = 0;
|
|
119
|
+
for (const entry of entries) {
|
|
120
|
+
const result = entry.check();
|
|
121
|
+
const log = logResults(entry.label, result, fix);
|
|
122
|
+
if (fix && entry.fix && result.fixable.length > 0) {
|
|
123
|
+
entry.fix(cwd, pkg);
|
|
124
|
+
}
|
|
125
|
+
totalErrors += log.errors;
|
|
126
|
+
totalFixed += log.fixed;
|
|
127
|
+
}
|
|
128
|
+
return { errors: totalErrors, fixed: totalFixed };
|
|
129
|
+
}
|
|
130
|
+
function logSummary(errors, fixed) {
|
|
131
|
+
if (fixed > 0) {
|
|
132
|
+
console.log(chalk.green(`
|
|
133
|
+
Fixed ${fixed} issue(s)`));
|
|
134
|
+
}
|
|
135
|
+
if (errors > 0) {
|
|
136
|
+
console.log(chalk.red(`
|
|
137
|
+
${errors} error(s) found`));
|
|
138
|
+
} else if (fixed === 0) {
|
|
139
|
+
console.log(chalk.green("\n All checks passed"));
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
function packageLintMonorepo(fix = false) {
|
|
143
|
+
const cwd = INIT_CWD() ?? process.cwd();
|
|
144
|
+
let pkg;
|
|
145
|
+
try {
|
|
146
|
+
pkg = readRootPackageJson(cwd);
|
|
147
|
+
} catch {
|
|
148
|
+
console.error(chalk.red("Could not read package.json"));
|
|
149
|
+
return 1;
|
|
150
|
+
}
|
|
151
|
+
if (!isMonorepo(pkg)) {
|
|
152
|
+
console.log(chalk.gray("Not a monorepo \u2014 skipping package-lint checks"));
|
|
153
|
+
return 0;
|
|
154
|
+
}
|
|
155
|
+
console.log(chalk.green("Package Lint"));
|
|
156
|
+
const workspaces = yarnWorkspaces();
|
|
157
|
+
const checks = [
|
|
158
|
+
{
|
|
159
|
+
check: () => checkRootPrivate(pkg),
|
|
160
|
+
fix: fixRootPrivate,
|
|
161
|
+
label: "Root package is private"
|
|
162
|
+
},
|
|
163
|
+
{
|
|
164
|
+
check: () => checkNoPublishConfigOnPrivate(pkg),
|
|
165
|
+
fix: fixNoPublishConfigOnPrivate,
|
|
166
|
+
label: "No publishConfig on private root"
|
|
167
|
+
},
|
|
168
|
+
{ check: () => checkPackagesFolder(workspaces), label: "All packages are in packages/ folder" },
|
|
169
|
+
{ check: () => checkDiscoverable(pkg, workspaces), label: "All packages are discoverable from workspace globs" }
|
|
170
|
+
];
|
|
171
|
+
const { errors, fixed } = runChecks(checks, cwd, pkg, fix);
|
|
172
|
+
logSummary(errors, fixed);
|
|
173
|
+
return errors > 0 ? 1 : 0;
|
|
174
|
+
}
|
|
175
|
+
export {
|
|
176
|
+
packageLintMonorepo
|
|
177
|
+
};
|
|
178
|
+
//# sourceMappingURL=package-lint.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/actions/package-lint.ts","../../src/lib/yarn/workspace/yarnWorkspaces.ts","../../src/lib/yarn/yarnInitCwd.ts"],"sourcesContent":["import { readFileSync, writeFileSync } from 'node:fs'\nimport PATH from 'node:path'\n\nimport chalk from 'chalk'\nimport picomatch from 'picomatch'\n\nimport { INIT_CWD, yarnWorkspaces } from '../lib/yarn/index.ts'\n\ninterface LintResult {\n errors: string[]\n fixable: string[]\n warnings: string[]\n}\n\nfunction emptyResult(): LintResult {\n return {\n errors: [], fixable: [], warnings: [],\n }\n}\n\nfunction readRootPackageJson(cwd: string) {\n const raw = readFileSync(PATH.resolve(cwd, 'package.json'), 'utf8')\n return JSON.parse(raw)\n}\n\nfunction writeRootPackageJson(cwd: string, pkg: Record<string, unknown>) {\n const path = PATH.resolve(cwd, 'package.json')\n writeFileSync(path, `${JSON.stringify(pkg, null, 2)}\\n`, 'utf8')\n}\n\nfunction isMonorepo(pkg: Record<string, unknown>): boolean {\n const workspaces = pkg.workspaces\n return Array.isArray(workspaces) && workspaces.length > 0\n}\n\nfunction checkPackagesFolder(workspaces: { location: string; name: string }[]): LintResult {\n const result = emptyResult()\n\n for (const { location, name } of workspaces) {\n if (location === '.') continue\n if (!location.startsWith('packages/') && !location.startsWith('packages\\\\')) {\n result.errors.push(`${name} (${location}) is not inside a packages/ folder`)\n }\n }\n\n return result\n}\n\nfunction checkRootPrivate(pkg: Record<string, unknown>): LintResult {\n const result = emptyResult()\n\n if (!pkg.private) {\n result.fixable.push('Root package.json must be private to prevent accidental publishing')\n }\n\n return result\n}\n\nfunction fixRootPrivate(cwd: string, pkg: Record<string, unknown>) {\n pkg.private = true\n writeRootPackageJson(cwd, pkg)\n console.log(chalk.green(' ✔ Fixed: set \"private\": true in root package.json'))\n}\n\nfunction checkNoPublishConfigOnPrivate(pkg: Record<string, unknown>): LintResult {\n const result = emptyResult()\n\n if (pkg.private && pkg.publishConfig) {\n result.fixable.push('Root package.json has publishConfig but is private — publishConfig is unnecessary')\n }\n\n return result\n}\n\nfunction fixNoPublishConfigOnPrivate(cwd: string, pkg: Record<string, unknown>) {\n delete pkg.publishConfig\n writeRootPackageJson(cwd, pkg)\n console.log(chalk.green(' ✔ Fixed: removed publishConfig from private root package.json'))\n}\n\nfunction checkDiscoverable(\n pkg: Record<string, unknown>,\n workspaces: { location: string; name: string }[],\n): LintResult {\n const result = emptyResult()\n\n const globs = pkg.workspaces as string[]\n const matchers = globs.map(glob => picomatch(glob))\n const isMatch = (location: string) => matchers.some(m => m(location))\n\n for (const { location, name } of workspaces) {\n if (location === '.') continue\n if (!isMatch(location)) {\n result.errors.push(`${name} (${location}) is not matched by any workspace glob in package.json`)\n }\n }\n\n return result\n}\n\nfunction logResults(label: string, result: LintResult, fix: boolean): { errors: number; fixed: number } {\n let errors = 0\n let fixed = 0\n\n for (const error of result.errors) {\n console.log(chalk.red(` ✗ ${error}`))\n errors++\n }\n for (const fixable of result.fixable) {\n if (fix) {\n fixed++\n } else {\n console.log(chalk.red(` ✗ ${fixable} (fixable)`))\n errors++\n }\n }\n for (const warning of result.warnings) {\n console.log(chalk.yellow(` ⚠ ${warning}`))\n }\n if (errors === 0 && fixed === 0 && result.warnings.length === 0) {\n console.log(chalk.green(` ✓ ${label}`))\n }\n\n return { errors, fixed }\n}\n\ninterface CheckEntry {\n check: () => LintResult\n fix?: (cwd: string, pkg: Record<string, unknown>) => void\n label: string\n}\n\nfunction runChecks(entries: CheckEntry[], cwd: string, pkg: Record<string, unknown>, fix: boolean): { errors: number; fixed: number } {\n let totalErrors = 0\n let totalFixed = 0\n\n for (const entry of entries) {\n const result = entry.check()\n const log = logResults(entry.label, result, fix)\n if (fix && entry.fix && result.fixable.length > 0) {\n entry.fix(cwd, pkg)\n }\n totalErrors += log.errors\n totalFixed += log.fixed\n }\n\n return { errors: totalErrors, fixed: totalFixed }\n}\n\nfunction logSummary(errors: number, fixed: number) {\n if (fixed > 0) {\n console.log(chalk.green(`\\n Fixed ${fixed} issue(s)`))\n }\n if (errors > 0) {\n console.log(chalk.red(`\\n ${errors} error(s) found`))\n } else if (fixed === 0) {\n console.log(chalk.green('\\n All checks passed'))\n }\n}\n\nexport function packageLintMonorepo(fix = false): number {\n const cwd = INIT_CWD() ?? process.cwd()\n\n let pkg: Record<string, unknown>\n try {\n pkg = readRootPackageJson(cwd)\n } catch {\n console.error(chalk.red('Could not read package.json'))\n return 1\n }\n\n if (!isMonorepo(pkg)) {\n console.log(chalk.gray('Not a monorepo — skipping package-lint checks'))\n return 0\n }\n\n console.log(chalk.green('Package Lint'))\n\n const workspaces = yarnWorkspaces()\n\n const checks: CheckEntry[] = [\n {\n check: () => checkRootPrivate(pkg), fix: fixRootPrivate, label: 'Root package is private',\n },\n {\n check: () => checkNoPublishConfigOnPrivate(pkg), fix: fixNoPublishConfigOnPrivate, label: 'No publishConfig on private root',\n },\n { check: () => checkPackagesFolder(workspaces), label: 'All packages are in packages/ folder' },\n { check: () => checkDiscoverable(pkg, workspaces), label: 'All packages are discoverable from workspace globs' },\n ]\n\n const { errors, fixed } = runChecks(checks, cwd, pkg, fix)\n logSummary(errors, fixed)\n\n return errors > 0 ? 1 : 0\n}\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","export const INIT_CWD = () => {\n if (!process.env.INIT_CWD) console.error('Missing INIT_CWD')\n return process.env.INIT_CWD\n}\n"],"mappings":";AAAA,SAAS,cAAc,qBAAqB;AAC5C,OAAO,UAAU;AAEjB,OAAO,WAAW;AAClB,OAAO,eAAe;;;ACJtB,SAAS,iBAAiB;AAInB,IAAM,iBAAiB,MAAmB;AAC/C,QAAM,SAAS,UAAU,QAAQ,CAAC,cAAc,QAAQ,UAAU,aAAa,GAAG,EAAE,UAAU,QAAQ,OAAO,KAAK,CAAC;AACnH,MAAI,OAAO,OAAO;AAChB,UAAM,OAAO;AAAA,EACf;AACA,SACE,OAAO,OACJ,SAAS,EAGT,MAAM,IAAI,EACV,MAAM,GAAG,EAAE,EACX,IAAI,CAAC,SAAS;AACb,WAAO,KAA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AA,MAAgB,OAAO;AAAA,IAClE;AAAA,IACA;AAAA,MACE,OAAO,MAAM,8BAA8B,GAAG;AAAA,MAAG,KAAK;AAAA,MAA6B,OAAO;AAAA,IAC5F;AAAA,IACA,EAAE,OAAO,MAAM,oBAAoB,UAAU,GAAG,OAAO,uCAAuC;AAAA,IAC9F,EAAE,OAAO,MAAM,kBAAkB,KAAK,UAAU,GAAG,OAAO,qDAAqD;AAAA,EACjH;AAEA,QAAM,EAAE,QAAQ,MAAM,IAAI,UAAU,QAAQ,KAAK,KAAK,GAAG;AACzD,aAAW,QAAQ,KAAK;AAExB,SAAO,SAAS,IAAI,IAAI;AAC1B;","names":[]}
|
package/dist/bin/xy.mjs
CHANGED
|
@@ -990,8 +990,8 @@ var DEFAULT_SETTINGS = {
|
|
|
990
990
|
"Skill"
|
|
991
991
|
],
|
|
992
992
|
deny: [
|
|
993
|
-
"Bash(git push --force*)",
|
|
994
|
-
"Bash(git reset --hard*)",
|
|
993
|
+
"Bash(git push --force *)",
|
|
994
|
+
"Bash(git reset --hard *)",
|
|
995
995
|
"Bash(rm -rf /*)"
|
|
996
996
|
]
|
|
997
997
|
}
|
|
@@ -2419,6 +2419,161 @@ var license = async (pkg) => {
|
|
|
2419
2419
|
var filename = ".npmignore";
|
|
2420
2420
|
var npmignoreGen = (pkg) => generateIgnoreFiles(filename, pkg);
|
|
2421
2421
|
|
|
2422
|
+
// src/actions/package-lint.ts
|
|
2423
|
+
import { readFileSync as readFileSync13, writeFileSync as writeFileSync6 } from "fs";
|
|
2424
|
+
import PATH9 from "path";
|
|
2425
|
+
import chalk30 from "chalk";
|
|
2426
|
+
import picomatch from "picomatch";
|
|
2427
|
+
function emptyResult() {
|
|
2428
|
+
return {
|
|
2429
|
+
errors: [],
|
|
2430
|
+
fixable: [],
|
|
2431
|
+
warnings: []
|
|
2432
|
+
};
|
|
2433
|
+
}
|
|
2434
|
+
function readRootPackageJson(cwd) {
|
|
2435
|
+
const raw = readFileSync13(PATH9.resolve(cwd, "package.json"), "utf8");
|
|
2436
|
+
return JSON.parse(raw);
|
|
2437
|
+
}
|
|
2438
|
+
function writeRootPackageJson(cwd, pkg) {
|
|
2439
|
+
const path8 = PATH9.resolve(cwd, "package.json");
|
|
2440
|
+
writeFileSync6(path8, `${JSON.stringify(pkg, null, 2)}
|
|
2441
|
+
`, "utf8");
|
|
2442
|
+
}
|
|
2443
|
+
function isMonorepo(pkg) {
|
|
2444
|
+
const workspaces = pkg.workspaces;
|
|
2445
|
+
return Array.isArray(workspaces) && workspaces.length > 0;
|
|
2446
|
+
}
|
|
2447
|
+
function checkPackagesFolder(workspaces) {
|
|
2448
|
+
const result = emptyResult();
|
|
2449
|
+
for (const { location, name } of workspaces) {
|
|
2450
|
+
if (location === ".") continue;
|
|
2451
|
+
if (!location.startsWith("packages/") && !location.startsWith("packages\\")) {
|
|
2452
|
+
result.errors.push(`${name} (${location}) is not inside a packages/ folder`);
|
|
2453
|
+
}
|
|
2454
|
+
}
|
|
2455
|
+
return result;
|
|
2456
|
+
}
|
|
2457
|
+
function checkRootPrivate(pkg) {
|
|
2458
|
+
const result = emptyResult();
|
|
2459
|
+
if (!pkg.private) {
|
|
2460
|
+
result.fixable.push("Root package.json must be private to prevent accidental publishing");
|
|
2461
|
+
}
|
|
2462
|
+
return result;
|
|
2463
|
+
}
|
|
2464
|
+
function fixRootPrivate(cwd, pkg) {
|
|
2465
|
+
pkg.private = true;
|
|
2466
|
+
writeRootPackageJson(cwd, pkg);
|
|
2467
|
+
console.log(chalk30.green(' \u2714 Fixed: set "private": true in root package.json'));
|
|
2468
|
+
}
|
|
2469
|
+
function checkNoPublishConfigOnPrivate(pkg) {
|
|
2470
|
+
const result = emptyResult();
|
|
2471
|
+
if (pkg.private && pkg.publishConfig) {
|
|
2472
|
+
result.fixable.push("Root package.json has publishConfig but is private \u2014 publishConfig is unnecessary");
|
|
2473
|
+
}
|
|
2474
|
+
return result;
|
|
2475
|
+
}
|
|
2476
|
+
function fixNoPublishConfigOnPrivate(cwd, pkg) {
|
|
2477
|
+
delete pkg.publishConfig;
|
|
2478
|
+
writeRootPackageJson(cwd, pkg);
|
|
2479
|
+
console.log(chalk30.green(" \u2714 Fixed: removed publishConfig from private root package.json"));
|
|
2480
|
+
}
|
|
2481
|
+
function checkDiscoverable(pkg, workspaces) {
|
|
2482
|
+
const result = emptyResult();
|
|
2483
|
+
const globs = pkg.workspaces;
|
|
2484
|
+
const matchers = globs.map((glob2) => picomatch(glob2));
|
|
2485
|
+
const isMatch = (location) => matchers.some((m) => m(location));
|
|
2486
|
+
for (const { location, name } of workspaces) {
|
|
2487
|
+
if (location === ".") continue;
|
|
2488
|
+
if (!isMatch(location)) {
|
|
2489
|
+
result.errors.push(`${name} (${location}) is not matched by any workspace glob in package.json`);
|
|
2490
|
+
}
|
|
2491
|
+
}
|
|
2492
|
+
return result;
|
|
2493
|
+
}
|
|
2494
|
+
function logResults(label, result, fix2) {
|
|
2495
|
+
let errors = 0;
|
|
2496
|
+
let fixed = 0;
|
|
2497
|
+
for (const error of result.errors) {
|
|
2498
|
+
console.log(chalk30.red(` \u2717 ${error}`));
|
|
2499
|
+
errors++;
|
|
2500
|
+
}
|
|
2501
|
+
for (const fixable of result.fixable) {
|
|
2502
|
+
if (fix2) {
|
|
2503
|
+
fixed++;
|
|
2504
|
+
} else {
|
|
2505
|
+
console.log(chalk30.red(` \u2717 ${fixable} (fixable)`));
|
|
2506
|
+
errors++;
|
|
2507
|
+
}
|
|
2508
|
+
}
|
|
2509
|
+
for (const warning of result.warnings) {
|
|
2510
|
+
console.log(chalk30.yellow(` \u26A0 ${warning}`));
|
|
2511
|
+
}
|
|
2512
|
+
if (errors === 0 && fixed === 0 && result.warnings.length === 0) {
|
|
2513
|
+
console.log(chalk30.green(` \u2713 ${label}`));
|
|
2514
|
+
}
|
|
2515
|
+
return { errors, fixed };
|
|
2516
|
+
}
|
|
2517
|
+
function runChecks(entries, cwd, pkg, fix2) {
|
|
2518
|
+
let totalErrors = 0;
|
|
2519
|
+
let totalFixed = 0;
|
|
2520
|
+
for (const entry of entries) {
|
|
2521
|
+
const result = entry.check();
|
|
2522
|
+
const log = logResults(entry.label, result, fix2);
|
|
2523
|
+
if (fix2 && entry.fix && result.fixable.length > 0) {
|
|
2524
|
+
entry.fix(cwd, pkg);
|
|
2525
|
+
}
|
|
2526
|
+
totalErrors += log.errors;
|
|
2527
|
+
totalFixed += log.fixed;
|
|
2528
|
+
}
|
|
2529
|
+
return { errors: totalErrors, fixed: totalFixed };
|
|
2530
|
+
}
|
|
2531
|
+
function logSummary(errors, fixed) {
|
|
2532
|
+
if (fixed > 0) {
|
|
2533
|
+
console.log(chalk30.green(`
|
|
2534
|
+
Fixed ${fixed} issue(s)`));
|
|
2535
|
+
}
|
|
2536
|
+
if (errors > 0) {
|
|
2537
|
+
console.log(chalk30.red(`
|
|
2538
|
+
${errors} error(s) found`));
|
|
2539
|
+
} else if (fixed === 0) {
|
|
2540
|
+
console.log(chalk30.green("\n All checks passed"));
|
|
2541
|
+
}
|
|
2542
|
+
}
|
|
2543
|
+
function packageLintMonorepo(fix2 = false) {
|
|
2544
|
+
const cwd = INIT_CWD() ?? process.cwd();
|
|
2545
|
+
let pkg;
|
|
2546
|
+
try {
|
|
2547
|
+
pkg = readRootPackageJson(cwd);
|
|
2548
|
+
} catch {
|
|
2549
|
+
console.error(chalk30.red("Could not read package.json"));
|
|
2550
|
+
return 1;
|
|
2551
|
+
}
|
|
2552
|
+
if (!isMonorepo(pkg)) {
|
|
2553
|
+
console.log(chalk30.gray("Not a monorepo \u2014 skipping package-lint checks"));
|
|
2554
|
+
return 0;
|
|
2555
|
+
}
|
|
2556
|
+
console.log(chalk30.green("Package Lint"));
|
|
2557
|
+
const workspaces = yarnWorkspaces();
|
|
2558
|
+
const checks = [
|
|
2559
|
+
{
|
|
2560
|
+
check: () => checkRootPrivate(pkg),
|
|
2561
|
+
fix: fixRootPrivate,
|
|
2562
|
+
label: "Root package is private"
|
|
2563
|
+
},
|
|
2564
|
+
{
|
|
2565
|
+
check: () => checkNoPublishConfigOnPrivate(pkg),
|
|
2566
|
+
fix: fixNoPublishConfigOnPrivate,
|
|
2567
|
+
label: "No publishConfig on private root"
|
|
2568
|
+
},
|
|
2569
|
+
{ check: () => checkPackagesFolder(workspaces), label: "All packages are in packages/ folder" },
|
|
2570
|
+
{ check: () => checkDiscoverable(pkg, workspaces), label: "All packages are discoverable from workspace globs" }
|
|
2571
|
+
];
|
|
2572
|
+
const { errors, fixed } = runChecks(checks, cwd, pkg, fix2);
|
|
2573
|
+
logSummary(errors, fixed);
|
|
2574
|
+
return errors > 0 ? 1 : 0;
|
|
2575
|
+
}
|
|
2576
|
+
|
|
2422
2577
|
// src/actions/publint.ts
|
|
2423
2578
|
var publint = async ({ verbose, pkg }) => {
|
|
2424
2579
|
return pkg === void 0 ? publintAll({ verbose }) : await publintPackage({ pkg, verbose });
|
|
@@ -2472,7 +2627,7 @@ var rebuild = ({ target }) => {
|
|
|
2472
2627
|
};
|
|
2473
2628
|
|
|
2474
2629
|
// src/actions/recompile.ts
|
|
2475
|
-
import
|
|
2630
|
+
import chalk31 from "chalk";
|
|
2476
2631
|
var recompile = async ({
|
|
2477
2632
|
verbose,
|
|
2478
2633
|
target,
|
|
@@ -2508,7 +2663,7 @@ var recompileAll = async ({
|
|
|
2508
2663
|
const incrementalOptions = incremental ? ["--since", "-Apt", "--topological-dev"] : ["--parallel", "-Apt", "--topological-dev"];
|
|
2509
2664
|
const jobsOptions = jobs ? ["-j", `${jobs}`] : [];
|
|
2510
2665
|
if (jobs) {
|
|
2511
|
-
console.log(
|
|
2666
|
+
console.log(chalk31.blue(`Jobs set to [${jobs}]`));
|
|
2512
2667
|
}
|
|
2513
2668
|
const result = await runStepsAsync(`Recompile${incremental ? "-Incremental" : ""} [All]`, [
|
|
2514
2669
|
[
|
|
@@ -2539,7 +2694,7 @@ var recompileAll = async ({
|
|
|
2539
2694
|
]
|
|
2540
2695
|
]);
|
|
2541
2696
|
console.log(
|
|
2542
|
-
`${
|
|
2697
|
+
`${chalk31.gray("Recompiled in")} [${chalk31.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk31.gray("seconds")}`
|
|
2543
2698
|
);
|
|
2544
2699
|
return result;
|
|
2545
2700
|
};
|
|
@@ -2570,13 +2725,13 @@ var reinstall = () => {
|
|
|
2570
2725
|
};
|
|
2571
2726
|
|
|
2572
2727
|
// src/actions/relint.ts
|
|
2573
|
-
import
|
|
2728
|
+
import chalk32 from "chalk";
|
|
2574
2729
|
var relintPackage = ({
|
|
2575
2730
|
pkg,
|
|
2576
2731
|
fix: fix2,
|
|
2577
2732
|
verbose
|
|
2578
2733
|
}) => {
|
|
2579
|
-
console.log(
|
|
2734
|
+
console.log(chalk32.gray(`${fix2 ? "Fix" : "Lint"} [${pkg}]`));
|
|
2580
2735
|
const start = Date.now();
|
|
2581
2736
|
const result = runSteps(`${fix2 ? "Fix" : "Lint"} [${pkg}]`, [
|
|
2582
2737
|
["yarn", [
|
|
@@ -2586,7 +2741,7 @@ var relintPackage = ({
|
|
|
2586
2741
|
fix2 ? "package-fix" : verbose ? "package-lint-verbose" : "package-lint"
|
|
2587
2742
|
]]
|
|
2588
2743
|
]);
|
|
2589
|
-
console.log(
|
|
2744
|
+
console.log(chalk32.gray(`${fix2 ? "Fixed in" : "Linted in"} [${chalk32.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk32.gray("seconds")}`));
|
|
2590
2745
|
return result;
|
|
2591
2746
|
};
|
|
2592
2747
|
var relint = ({
|
|
@@ -2606,13 +2761,13 @@ var relint = ({
|
|
|
2606
2761
|
});
|
|
2607
2762
|
};
|
|
2608
2763
|
var relintAllPackages = ({ fix: fix2 = false } = {}) => {
|
|
2609
|
-
console.log(
|
|
2764
|
+
console.log(chalk32.gray(`${fix2 ? "Fix" : "Lint"} [All-Packages]`));
|
|
2610
2765
|
const start = Date.now();
|
|
2611
2766
|
const fixOptions = fix2 ? ["--fix"] : [];
|
|
2612
2767
|
const result = runSteps(`${fix2 ? "Fix" : "Lint"} [All-Packages]`, [
|
|
2613
2768
|
["yarn", ["eslint", ...fixOptions]]
|
|
2614
2769
|
]);
|
|
2615
|
-
console.log(
|
|
2770
|
+
console.log(chalk32.gray(`${fix2 ? "Fixed in" : "Linted in"} [${chalk32.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk32.gray("seconds")}`));
|
|
2616
2771
|
return result;
|
|
2617
2772
|
};
|
|
2618
2773
|
|
|
@@ -2630,10 +2785,10 @@ var sonar = () => {
|
|
|
2630
2785
|
};
|
|
2631
2786
|
|
|
2632
2787
|
// src/actions/statics.ts
|
|
2633
|
-
import
|
|
2788
|
+
import chalk33 from "chalk";
|
|
2634
2789
|
var DefaultDependencies = ["axios", "@xylabs/pixel", "react", "graphql", "react-router", "@mui/material", "@mui/system"];
|
|
2635
2790
|
var statics = () => {
|
|
2636
|
-
console.log(
|
|
2791
|
+
console.log(chalk33.green("Check Required Static Dependencies"));
|
|
2637
2792
|
const statics2 = parsedPackageJSON()?.xy?.deps?.statics;
|
|
2638
2793
|
return detectDuplicateDependencies(statics2, DefaultDependencies);
|
|
2639
2794
|
};
|
|
@@ -3214,7 +3369,7 @@ var xyInstallCommands = (args) => {
|
|
|
3214
3369
|
};
|
|
3215
3370
|
|
|
3216
3371
|
// src/xy/lint/cycleCommand.ts
|
|
3217
|
-
import
|
|
3372
|
+
import chalk34 from "chalk";
|
|
3218
3373
|
var cycleCommand = {
|
|
3219
3374
|
command: "cycle [package]",
|
|
3220
3375
|
describe: "Cycle - Check for dependency cycles",
|
|
@@ -3225,12 +3380,12 @@ var cycleCommand = {
|
|
|
3225
3380
|
const start = Date.now();
|
|
3226
3381
|
if (argv.verbose) console.log("Cycle");
|
|
3227
3382
|
process.exitCode = await cycle({ pkg: argv.package });
|
|
3228
|
-
console.log(
|
|
3383
|
+
console.log(chalk34.blue(`Finished in ${Date.now() - start}ms`));
|
|
3229
3384
|
}
|
|
3230
3385
|
};
|
|
3231
3386
|
|
|
3232
3387
|
// src/xy/lint/deplintCommand.ts
|
|
3233
|
-
import
|
|
3388
|
+
import chalk35 from "chalk";
|
|
3234
3389
|
var deplintCommand = {
|
|
3235
3390
|
command: "deplint [package]",
|
|
3236
3391
|
describe: "Deplint - Run Deplint",
|
|
@@ -3268,12 +3423,12 @@ var deplintCommand = {
|
|
|
3268
3423
|
peerDeps: !!argv.peerDeps,
|
|
3269
3424
|
verbose: !!argv.verbose
|
|
3270
3425
|
});
|
|
3271
|
-
console.log(
|
|
3426
|
+
console.log(chalk35.blue(`Finished in ${Date.now() - start}ms`));
|
|
3272
3427
|
}
|
|
3273
3428
|
};
|
|
3274
3429
|
|
|
3275
3430
|
// src/xy/lint/fixCommand.ts
|
|
3276
|
-
import
|
|
3431
|
+
import chalk36 from "chalk";
|
|
3277
3432
|
var fixCommand = {
|
|
3278
3433
|
command: "fix [package]",
|
|
3279
3434
|
describe: "Fix - Run Eslint w/fix",
|
|
@@ -3284,12 +3439,12 @@ var fixCommand = {
|
|
|
3284
3439
|
const start = Date.now();
|
|
3285
3440
|
if (argv.verbose) console.log("Fix");
|
|
3286
3441
|
process.exitCode = fix();
|
|
3287
|
-
console.log(
|
|
3442
|
+
console.log(chalk36.blue(`Finished in ${Date.now() - start}ms`));
|
|
3288
3443
|
}
|
|
3289
3444
|
};
|
|
3290
3445
|
|
|
3291
3446
|
// src/xy/lint/knipCommand.ts
|
|
3292
|
-
import
|
|
3447
|
+
import chalk37 from "chalk";
|
|
3293
3448
|
var knipCommand = {
|
|
3294
3449
|
command: "knip",
|
|
3295
3450
|
describe: "Knip - Run Knip",
|
|
@@ -3300,12 +3455,12 @@ var knipCommand = {
|
|
|
3300
3455
|
if (argv.verbose) console.log("Knip");
|
|
3301
3456
|
const start = Date.now();
|
|
3302
3457
|
process.exitCode = knip();
|
|
3303
|
-
console.log(
|
|
3458
|
+
console.log(chalk37.blue(`Knip finished in ${Date.now() - start}ms`));
|
|
3304
3459
|
}
|
|
3305
3460
|
};
|
|
3306
3461
|
|
|
3307
3462
|
// src/xy/lint/lintCommand.ts
|
|
3308
|
-
import
|
|
3463
|
+
import chalk38 from "chalk";
|
|
3309
3464
|
var lintCommand = {
|
|
3310
3465
|
command: "lint [package]",
|
|
3311
3466
|
describe: "Lint - Run Eslint",
|
|
@@ -3334,12 +3489,29 @@ var lintCommand = {
|
|
|
3334
3489
|
cache: argv.cache,
|
|
3335
3490
|
verbose: !!argv.verbose
|
|
3336
3491
|
});
|
|
3337
|
-
console.log(
|
|
3492
|
+
console.log(chalk38.blue(`Finished in ${Date.now() - start}ms`));
|
|
3493
|
+
}
|
|
3494
|
+
};
|
|
3495
|
+
|
|
3496
|
+
// src/xy/lint/packageLintCommand.ts
|
|
3497
|
+
var packageLintCommand = {
|
|
3498
|
+
builder: (yargs2) => {
|
|
3499
|
+
return yargs2.option("fix", {
|
|
3500
|
+
default: false,
|
|
3501
|
+
description: "Auto-fix fixable issues",
|
|
3502
|
+
type: "boolean"
|
|
3503
|
+
});
|
|
3504
|
+
},
|
|
3505
|
+
command: "package-lint",
|
|
3506
|
+
describe: "Package Lint - Check monorepo package structure",
|
|
3507
|
+
handler: (argv) => {
|
|
3508
|
+
if (argv.verbose) console.log("Package Lint");
|
|
3509
|
+
process.exitCode = packageLintMonorepo(!!argv.fix);
|
|
3338
3510
|
}
|
|
3339
3511
|
};
|
|
3340
3512
|
|
|
3341
3513
|
// src/xy/lint/publintCommand.ts
|
|
3342
|
-
import
|
|
3514
|
+
import chalk39 from "chalk";
|
|
3343
3515
|
var publintCommand = {
|
|
3344
3516
|
command: "publint [package]",
|
|
3345
3517
|
describe: "Publint - Run Publint",
|
|
@@ -3350,12 +3522,12 @@ var publintCommand = {
|
|
|
3350
3522
|
if (argv.verbose) console.log("Publint");
|
|
3351
3523
|
const start = Date.now();
|
|
3352
3524
|
process.exitCode = await publint({ pkg: argv.package, verbose: !!argv.verbose });
|
|
3353
|
-
console.log(
|
|
3525
|
+
console.log(chalk39.blue(`Finished in ${Date.now() - start}ms`));
|
|
3354
3526
|
}
|
|
3355
3527
|
};
|
|
3356
3528
|
|
|
3357
3529
|
// src/xy/lint/relintCommand.ts
|
|
3358
|
-
import
|
|
3530
|
+
import chalk40 from "chalk";
|
|
3359
3531
|
var relintCommand = {
|
|
3360
3532
|
command: "relint [package]",
|
|
3361
3533
|
describe: "Relint - Clean & Lint",
|
|
@@ -3366,12 +3538,12 @@ var relintCommand = {
|
|
|
3366
3538
|
if (argv.verbose) console.log("Relinting");
|
|
3367
3539
|
const start = Date.now();
|
|
3368
3540
|
process.exitCode = relint();
|
|
3369
|
-
console.log(
|
|
3541
|
+
console.log(chalk40.blue(`Finished in ${Date.now() - start}ms`));
|
|
3370
3542
|
}
|
|
3371
3543
|
};
|
|
3372
3544
|
|
|
3373
3545
|
// src/xy/lint/sonarCommand.ts
|
|
3374
|
-
import
|
|
3546
|
+
import chalk41 from "chalk";
|
|
3375
3547
|
var sonarCommand = {
|
|
3376
3548
|
command: "sonar",
|
|
3377
3549
|
describe: "Sonar - Run Sonar Check",
|
|
@@ -3382,17 +3554,17 @@ var sonarCommand = {
|
|
|
3382
3554
|
const start = Date.now();
|
|
3383
3555
|
if (argv.verbose) console.log("Sonar Check");
|
|
3384
3556
|
process.exitCode = sonar();
|
|
3385
|
-
console.log(
|
|
3557
|
+
console.log(chalk41.blue(`Finished in ${Date.now() - start}ms`));
|
|
3386
3558
|
}
|
|
3387
3559
|
};
|
|
3388
3560
|
|
|
3389
3561
|
// src/xy/lint/index.ts
|
|
3390
3562
|
var xyLintCommands = (args) => {
|
|
3391
|
-
return args.command(cycleCommand).command(lintCommand).command(deplintCommand).command(fixCommand).command(relintCommand).command(publintCommand).command(knipCommand).command(sonarCommand);
|
|
3563
|
+
return args.command(cycleCommand).command(lintCommand).command(deplintCommand).command(fixCommand).command(relintCommand).command(publintCommand).command(knipCommand).command(packageLintCommand).command(sonarCommand);
|
|
3392
3564
|
};
|
|
3393
3565
|
|
|
3394
3566
|
// src/xy/xy.ts
|
|
3395
|
-
import
|
|
3567
|
+
import chalk42 from "chalk";
|
|
3396
3568
|
|
|
3397
3569
|
// src/xy/xyParseOptions.ts
|
|
3398
3570
|
import yargs from "yargs";
|
|
@@ -3425,8 +3597,8 @@ var xyParseOptions = () => {
|
|
|
3425
3597
|
var xy = async () => {
|
|
3426
3598
|
const options = xyParseOptions();
|
|
3427
3599
|
return await xyBuildCommands(xyCommonCommands(xyInstallCommands(xyDeployCommands(xyLintCommands(options))))).demandCommand(1).command("*", "", () => {
|
|
3428
|
-
console.error(
|
|
3429
|
-
console.log(
|
|
3600
|
+
console.error(chalk42.yellow(`Command not found [${chalk42.magenta(process.argv[2])}]`));
|
|
3601
|
+
console.log(chalk42.gray("Try 'yarn xy --help' for list of commands"));
|
|
3430
3602
|
}).version().help().argv;
|
|
3431
3603
|
};
|
|
3432
3604
|
|