@xylabs/ts-scripts-yarn3 7.4.18 → 7.4.20
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.body.md +86 -0
- package/README.md +108 -0
- package/dist/actions/claude-commands.mjs +6 -2
- package/dist/actions/claude-commands.mjs.map +1 -1
- package/dist/actions/claude-rules.mjs +6 -2
- package/dist/actions/claude-rules.mjs.map +1 -1
- package/dist/actions/claude-skills.mjs +120 -0
- package/dist/actions/claude-skills.mjs.map +1 -0
- package/dist/actions/compile.mjs.map +1 -1
- package/dist/actions/cycle.mjs.map +1 -1
- package/dist/actions/dead.mjs.map +1 -1
- package/dist/actions/deploy-major.mjs.map +1 -1
- package/dist/actions/deploy-minor.mjs.map +1 -1
- package/dist/actions/deploy-next.mjs.map +1 -1
- package/dist/actions/deploy.mjs.map +1 -1
- package/dist/actions/fix.mjs.map +1 -1
- package/dist/actions/gen-docs.mjs.map +1 -1
- package/dist/actions/index.mjs +367 -160
- package/dist/actions/index.mjs.map +1 -1
- package/dist/actions/knip.mjs.map +1 -1
- package/dist/actions/lint.mjs.map +1 -1
- package/dist/actions/publint.mjs.map +1 -1
- package/dist/actions/publish.mjs.map +1 -1
- package/dist/actions/readme-gen.mjs +136 -20
- package/dist/actions/readme-gen.mjs.map +1 -1
- package/dist/actions/readme-init.mjs +83 -0
- package/dist/actions/readme-init.mjs.map +1 -0
- package/dist/actions/rebuild.mjs.map +1 -1
- package/dist/actions/reinstall.mjs.map +1 -1
- package/dist/actions/relint.mjs.map +1 -1
- package/dist/actions/retest.mjs +2 -2
- package/dist/actions/retest.mjs.map +1 -1
- package/dist/actions/sonar.mjs.map +1 -1
- package/dist/actions/test.mjs.map +1 -1
- package/dist/actions/up.mjs.map +1 -1
- package/dist/actions/updo.mjs.map +1 -1
- package/dist/actions/upplug.mjs.map +1 -1
- package/dist/actions/upyarn.mjs.map +1 -1
- package/dist/bin/xy.mjs +982 -642
- package/dist/bin/xy.mjs.map +1 -1
- package/dist/index.d.ts +46 -13
- package/dist/index.mjs +1044 -695
- package/dist/index.mjs.map +1 -1
- package/dist/lib/claudeMdTemplate.mjs +28 -3
- package/dist/lib/claudeMdTemplate.mjs.map +1 -1
- package/dist/lib/generateReadmeFiles.mjs +118 -21
- package/dist/lib/generateReadmeFiles.mjs.map +1 -1
- package/dist/lib/index.mjs +146 -24
- package/dist/lib/index.mjs.map +1 -1
- package/dist/lib/runSteps.mjs.map +1 -1
- package/dist/lib/runXy.mjs.map +1 -1
- package/dist/xy/{xyBuildCommands.mjs → build-commands/build.mjs} +107 -94
- package/dist/xy/build-commands/build.mjs.map +1 -0
- package/dist/xy/build-commands/index.mjs +502 -0
- package/dist/xy/build-commands/index.mjs.map +1 -0
- package/dist/xy/common/claude/commandsCommand.mjs +111 -0
- package/dist/xy/common/claude/commandsCommand.mjs.map +1 -0
- package/dist/xy/common/claude/index.mjs +441 -0
- package/dist/xy/common/claude/index.mjs.map +1 -0
- package/dist/xy/common/claude/initCommand.mjs +393 -0
- package/dist/xy/common/claude/initCommand.mjs.map +1 -0
- package/dist/xy/common/claude/rulesCommand.mjs +133 -0
- package/dist/xy/common/claude/rulesCommand.mjs.map +1 -0
- package/dist/xy/common/claude/settingsCommand.mjs +90 -0
- package/dist/xy/common/claude/settingsCommand.mjs.map +1 -0
- package/dist/xy/common/claude/skillsCommand.mjs +129 -0
- package/dist/xy/common/claude/skillsCommand.mjs.map +1 -0
- package/dist/xy/common/cleanDocsCommand.mjs +45 -0
- package/dist/xy/common/cleanDocsCommand.mjs.map +1 -0
- package/dist/xy/common/deadCommand.mjs +116 -0
- package/dist/xy/common/deadCommand.mjs.map +1 -0
- package/dist/xy/common/genDocsCommand.mjs +125 -0
- package/dist/xy/common/genDocsCommand.mjs.map +1 -0
- package/dist/xy/common/gitignoreGenCommand.mjs +98 -0
- package/dist/xy/common/gitignoreGenCommand.mjs.map +1 -0
- package/dist/xy/common/gitlintCommand.mjs +82 -0
- package/dist/xy/common/gitlintCommand.mjs.map +1 -0
- package/dist/xy/{xyCommonCommands.mjs → common/index.mjs} +561 -242
- package/dist/xy/common/index.mjs.map +1 -0
- package/dist/xy/common/licenseCommand.mjs +100 -0
- package/dist/xy/common/licenseCommand.mjs.map +1 -0
- package/dist/xy/common/npmignoreGenCommand.mjs +98 -0
- package/dist/xy/common/npmignoreGenCommand.mjs.map +1 -0
- package/dist/xy/common/readme/genCommand.mjs +321 -0
- package/dist/xy/common/readme/genCommand.mjs.map +1 -0
- package/dist/xy/common/readme/index.mjs +361 -0
- package/dist/xy/common/readme/index.mjs.map +1 -0
- package/dist/xy/common/readme/initCommand.mjs +103 -0
- package/dist/xy/common/readme/initCommand.mjs.map +1 -0
- package/dist/xy/common/retestCommand.mjs +111 -0
- package/dist/xy/common/retestCommand.mjs.map +1 -0
- package/dist/xy/common/testCommand.mjs +108 -0
- package/dist/xy/common/testCommand.mjs.map +1 -0
- package/dist/xy/common/upplugCommand.mjs +113 -0
- package/dist/xy/common/upplugCommand.mjs.map +1 -0
- package/dist/xy/common/upyarnCommand.mjs +108 -0
- package/dist/xy/common/upyarnCommand.mjs.map +1 -0
- package/dist/xy/common/yarn3OnlyCommand.mjs +70 -0
- package/dist/xy/common/yarn3OnlyCommand.mjs.map +1 -0
- package/dist/xy/deploy/deployCommand.mjs +139 -0
- package/dist/xy/deploy/deployCommand.mjs.map +1 -0
- package/dist/xy/deploy/deployMajorCommand.mjs +139 -0
- package/dist/xy/deploy/deployMajorCommand.mjs.map +1 -0
- package/dist/xy/deploy/deployMinorCommand.mjs +139 -0
- package/dist/xy/deploy/deployMinorCommand.mjs.map +1 -0
- package/dist/xy/deploy/deployNextCommand.mjs +139 -0
- package/dist/xy/deploy/deployNextCommand.mjs.map +1 -0
- package/dist/xy/{xyDeployCommands.mjs → deploy/index.mjs} +53 -53
- package/dist/xy/deploy/index.mjs.map +1 -0
- package/dist/xy/deploy/publishCommand.mjs +108 -0
- package/dist/xy/deploy/publishCommand.mjs.map +1 -0
- package/dist/xy/index.mjs +982 -642
- package/dist/xy/index.mjs.map +1 -1
- package/dist/xy/install/cleanCommand.mjs +140 -0
- package/dist/xy/install/cleanCommand.mjs.map +1 -0
- package/dist/xy/install/dupdepsCommand.mjs +191 -0
- package/dist/xy/install/dupdepsCommand.mjs.map +1 -0
- package/dist/xy/{xyInstallCommands.mjs → install/index.mjs} +71 -68
- package/dist/xy/install/index.mjs.map +1 -0
- package/dist/xy/install/reinstallCommand.mjs +140 -0
- package/dist/xy/install/reinstallCommand.mjs.map +1 -0
- package/dist/xy/install/staticsCommand.mjs +191 -0
- package/dist/xy/install/staticsCommand.mjs.map +1 -0
- package/dist/{actions/clean-jest.mjs → xy/install/upCommand.mjs} +15 -6
- package/dist/xy/install/upCommand.mjs.map +1 -0
- package/dist/xy/install/updoCommand.mjs +112 -0
- package/dist/xy/install/updoCommand.mjs.map +1 -0
- package/dist/xy/lint/cycleCommand.mjs +163 -0
- package/dist/xy/lint/cycleCommand.mjs.map +1 -0
- package/dist/xy/lint/deplintCommand.mjs +814 -0
- package/dist/xy/lint/deplintCommand.mjs.map +1 -0
- package/dist/xy/lint/fixCommand.mjs +168 -0
- package/dist/xy/lint/fixCommand.mjs.map +1 -0
- package/dist/xy/{xyLintCommands.mjs → lint/index.mjs} +176 -145
- package/dist/xy/lint/index.mjs.map +1 -0
- package/dist/xy/lint/knipCommand.mjs +121 -0
- package/dist/xy/lint/knipCommand.mjs.map +1 -0
- package/dist/xy/lint/lintCommand.mjs +186 -0
- package/dist/xy/lint/lintCommand.mjs.map +1 -0
- package/dist/xy/lint/publintCommand.mjs +187 -0
- package/dist/xy/lint/publintCommand.mjs.map +1 -0
- package/dist/xy/lint/relintCommand.mjs +163 -0
- package/dist/xy/lint/relintCommand.mjs.map +1 -0
- package/dist/xy/lint/sonarCommand.mjs +121 -0
- package/dist/xy/lint/sonarCommand.mjs.map +1 -0
- package/dist/xy/xy.mjs +980 -640
- package/dist/xy/xy.mjs.map +1 -1
- package/package.json +2 -2
- package/templates/claude/skills/xylabs-e2e-setup/SKILL.md +196 -0
- package/templates/readme/README.body.md +11 -0
- package/templates/readme/README.template.md +22 -0
- package/dist/actions/clean-jest.mjs.map +0 -1
- package/dist/xy/xyBuildCommands.mjs.map +0 -1
- package/dist/xy/xyCommonCommands.mjs.map +0 -1
- package/dist/xy/xyDeployCommands.mjs.map +0 -1
- package/dist/xy/xyInstallCommands.mjs.map +0 -1
- package/dist/xy/xyLintCommands.mjs.map +0 -1
- /package/templates/{CLAUDE-project.md → claude/CLAUDE-project.md} +0 -0
- /package/templates/{commands → claude/commands}/xylabs-build.md +0 -0
- /package/templates/{commands → claude/commands}/xylabs-clean.md +0 -0
- /package/templates/{commands → claude/commands}/xylabs-compile.md +0 -0
- /package/templates/{commands → claude/commands}/xylabs-cycle.md +0 -0
- /package/templates/{commands → claude/commands}/xylabs-deplint.md +0 -0
- /package/templates/{commands → claude/commands}/xylabs-deploy-major.md +0 -0
- /package/templates/{commands → claude/commands}/xylabs-deploy-minor.md +0 -0
- /package/templates/{commands → claude/commands}/xylabs-deploy.md +0 -0
- /package/templates/{commands → claude/commands}/xylabs-fix.md +0 -0
- /package/templates/{commands → claude/commands}/xylabs-knip.md +0 -0
- /package/templates/{commands → claude/commands}/xylabs-lint.md +0 -0
- /package/templates/{commands → claude/commands}/xylabs-publint.md +0 -0
- /package/templates/{commands → claude/commands}/xylabs-rebuild.md +0 -0
- /package/templates/{commands → claude/commands}/xylabs-test.md +0 -0
- /package/templates/{rules → claude/rules}/xylabs-architecture.md +0 -0
- /package/templates/{rules → claude/rules}/xylabs-build.md +0 -0
- /package/templates/{rules → claude/rules}/xylabs-dependencies.md +0 -0
- /package/templates/{rules → claude/rules}/xylabs-error-handling.md +0 -0
- /package/templates/{rules → claude/rules}/xylabs-frameworks.md +0 -0
- /package/templates/{rules → claude/rules}/xylabs-git-workflow.md +0 -0
- /package/templates/{rules → claude/rules}/xylabs-linting.md +0 -0
- /package/templates/{rules → claude/rules}/xylabs-naming.md +0 -0
- /package/templates/{rules → claude/rules}/xylabs-style.md +0 -0
- /package/templates/{rules → claude/rules}/xylabs-typescript.md +0 -0
package/dist/bin/xy.mjs
CHANGED
|
@@ -1,8 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
|
-
// src/xy/xy.ts
|
|
4
|
-
import chalk31 from "chalk";
|
|
5
|
-
|
|
6
3
|
// src/actions/build.ts
|
|
7
4
|
import chalk9 from "chalk";
|
|
8
5
|
|
|
@@ -20,14 +17,19 @@ var checkResult = (name, result, level = "error", exitOnFail = false) => {
|
|
|
20
17
|
};
|
|
21
18
|
|
|
22
19
|
// src/lib/claudeMdTemplate.ts
|
|
23
|
-
import {
|
|
20
|
+
import {
|
|
21
|
+
readdirSync,
|
|
22
|
+
readFileSync,
|
|
23
|
+
statSync
|
|
24
|
+
} from "fs";
|
|
24
25
|
import { createRequire } from "module";
|
|
25
26
|
import PATH from "path";
|
|
26
27
|
var require2 = createRequire(import.meta.url);
|
|
27
28
|
var packageRoot = PATH.dirname(require2.resolve("@xylabs/ts-scripts-yarn3/package.json"));
|
|
28
|
-
var templatesDir = PATH.resolve(packageRoot, "templates");
|
|
29
|
+
var templatesDir = PATH.resolve(packageRoot, "templates", "claude");
|
|
29
30
|
var XYLABS_RULES_PREFIX = "xylabs-";
|
|
30
31
|
var XYLABS_COMMANDS_PREFIX = "xylabs-";
|
|
32
|
+
var XYLABS_SKILLS_PREFIX = "xylabs-";
|
|
31
33
|
var claudeMdRuleTemplates = () => {
|
|
32
34
|
const rulesDir = PATH.resolve(templatesDir, "rules");
|
|
33
35
|
const files = readdirSync(rulesDir).filter((f) => f.startsWith(XYLABS_RULES_PREFIX) && f.endsWith(".md"));
|
|
@@ -46,6 +48,24 @@ var claudeCommandTemplates = () => {
|
|
|
46
48
|
}
|
|
47
49
|
return result;
|
|
48
50
|
};
|
|
51
|
+
var claudeSkillTemplates = () => {
|
|
52
|
+
const skillsDir = PATH.resolve(templatesDir, "skills");
|
|
53
|
+
const dirs = readdirSync(skillsDir).filter(
|
|
54
|
+
(f) => f.startsWith(XYLABS_SKILLS_PREFIX) && statSync(PATH.resolve(skillsDir, f)).isDirectory()
|
|
55
|
+
);
|
|
56
|
+
const result = {};
|
|
57
|
+
for (const dir of dirs) {
|
|
58
|
+
const dirPath = PATH.resolve(skillsDir, dir);
|
|
59
|
+
const files = readdirSync(dirPath, { recursive: true, encoding: "utf8" });
|
|
60
|
+
result[dir] = {};
|
|
61
|
+
for (const file of files) {
|
|
62
|
+
if (statSync(PATH.resolve(dirPath, file)).isFile()) {
|
|
63
|
+
result[dir][file] = readFileSync(PATH.resolve(dirPath, file), "utf8");
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
return result;
|
|
68
|
+
};
|
|
49
69
|
var claudeMdProjectTemplate = () => readFileSync(PATH.resolve(templatesDir, "CLAUDE-project.md"), "utf8");
|
|
50
70
|
|
|
51
71
|
// src/lib/deleteGlob.ts
|
|
@@ -328,10 +348,19 @@ var generateIgnoreFiles = (filename3, pkg) => {
|
|
|
328
348
|
|
|
329
349
|
// src/lib/generateReadmeFiles.ts
|
|
330
350
|
import { execSync as execSync2 } from "child_process";
|
|
331
|
-
import FS from "fs";
|
|
332
|
-
import {
|
|
351
|
+
import FS, { readFileSync as readFileSync3 } from "fs";
|
|
352
|
+
import {
|
|
353
|
+
mkdir,
|
|
354
|
+
readFile,
|
|
355
|
+
writeFile
|
|
356
|
+
} from "fs/promises";
|
|
357
|
+
import { createRequire as createRequire2 } from "module";
|
|
333
358
|
import PATH2 from "path";
|
|
359
|
+
import { createInterface } from "readline";
|
|
334
360
|
import chalk5 from "chalk";
|
|
361
|
+
var require3 = createRequire2(import.meta.url);
|
|
362
|
+
var packageRoot2 = PATH2.dirname(require3.resolve("@xylabs/ts-scripts-yarn3/package.json"));
|
|
363
|
+
var readmeTemplatesDir = PATH2.resolve(packageRoot2, "templates", "readme");
|
|
335
364
|
function fillTemplate(template, data) {
|
|
336
365
|
const additionalData = { ...data, safeName: data.name.replaceAll("/", "__").replaceAll("@", "") };
|
|
337
366
|
return template.replaceAll(/\{\{(.*?)\}\}/g, (_, key) => additionalData[key.trim()] ?? "");
|
|
@@ -421,37 +450,120 @@ ${indent}### ${item.name}
|
|
|
421
450
|
}
|
|
422
451
|
return content;
|
|
423
452
|
}
|
|
453
|
+
function askConfirmation(question) {
|
|
454
|
+
const rl = createInterface({ input: process.stdin, output: process.stdout });
|
|
455
|
+
return new Promise((resolve) => {
|
|
456
|
+
rl.question(question, (answer) => {
|
|
457
|
+
rl.close();
|
|
458
|
+
resolve(answer.toLowerCase() === "y" || answer.toLowerCase() === "yes");
|
|
459
|
+
});
|
|
460
|
+
});
|
|
461
|
+
}
|
|
462
|
+
var DEFAULT_README_TEMPLATE = readFileSync3(PATH2.resolve(readmeTemplatesDir, "README.template.md"), "utf8");
|
|
463
|
+
var DEFAULT_README_BODY = readFileSync3(PATH2.resolve(readmeTemplatesDir, "README.body.md"), "utf8");
|
|
464
|
+
function applyLogoConfig(template, logoUrl, logoLinkUrl) {
|
|
465
|
+
let result = template;
|
|
466
|
+
if (logoUrl) {
|
|
467
|
+
result = result.replace(/\[logo]: .+/, `[logo]: ${logoUrl}`);
|
|
468
|
+
if (logoLinkUrl) {
|
|
469
|
+
result = result.replace(/\[!\[logo]\[]][^)]*\)/, `[![logo][]](${logoLinkUrl})`);
|
|
470
|
+
}
|
|
471
|
+
} else {
|
|
472
|
+
result = result.replace(/\[!\[logo]\[]][^\n]*\n*/, "");
|
|
473
|
+
result = result.replace(/\[logo]: [^\n]*\n?/, "");
|
|
474
|
+
}
|
|
475
|
+
return result;
|
|
476
|
+
}
|
|
477
|
+
function resolveTemplatePath(templatePath) {
|
|
478
|
+
const cwd = INIT_CWD() ?? ".";
|
|
479
|
+
return templatePath ?? PATH2.join(cwd, ".xy", "README.template.md");
|
|
480
|
+
}
|
|
481
|
+
async function loadOrCreateTemplate(resolvedTemplatePath) {
|
|
482
|
+
try {
|
|
483
|
+
const template = await readFile(resolvedTemplatePath, "utf8");
|
|
484
|
+
return { created: false, template };
|
|
485
|
+
} catch {
|
|
486
|
+
console.log(chalk5.yellow(`Template not found: ${resolvedTemplatePath}`));
|
|
487
|
+
const shouldCreate = await askConfirmation("Would you like to create a stock template? (y/N) ");
|
|
488
|
+
if (!shouldCreate) {
|
|
489
|
+
throw new Error("Template creation declined");
|
|
490
|
+
}
|
|
491
|
+
const template = DEFAULT_README_TEMPLATE;
|
|
492
|
+
await scaffoldTemplate(resolvedTemplatePath, template);
|
|
493
|
+
return { created: true, template };
|
|
494
|
+
}
|
|
495
|
+
}
|
|
496
|
+
async function scaffoldTemplate(resolvedTemplatePath, template) {
|
|
497
|
+
const xyDir = PATH2.dirname(resolvedTemplatePath);
|
|
498
|
+
await mkdir(xyDir, { recursive: true });
|
|
499
|
+
await writeFile(resolvedTemplatePath, template);
|
|
500
|
+
console.log(chalk5.green(`Created template: ${resolvedTemplatePath}`));
|
|
501
|
+
const bodyPath = PATH2.join(xyDir, "README.body.md");
|
|
502
|
+
await writeFile(bodyPath, DEFAULT_README_BODY);
|
|
503
|
+
console.log(chalk5.green(`Created body template: ${bodyPath}`));
|
|
504
|
+
}
|
|
505
|
+
async function resolveBody(location, defaultBody) {
|
|
506
|
+
const localBodyPath = PATH2.join(location, "README.body.md");
|
|
507
|
+
try {
|
|
508
|
+
return await readFile(localBodyPath, "utf8");
|
|
509
|
+
} catch {
|
|
510
|
+
return defaultBody;
|
|
511
|
+
}
|
|
512
|
+
}
|
|
513
|
+
async function generateReadmeForWorkspace(location, name, template, defaultBody, typedoc, verbose) {
|
|
514
|
+
try {
|
|
515
|
+
const pkgJsonPath = PATH2.join(location, "package.json");
|
|
516
|
+
const pkgJson = JSON.parse(await readFile(pkgJsonPath, "utf8"));
|
|
517
|
+
const body = await resolveBody(location, defaultBody);
|
|
518
|
+
const typedocContent = typedoc ? generateTypedoc(location, ["src/index*.ts"]) : "";
|
|
519
|
+
const readmeContent = fillTemplate(template, {
|
|
520
|
+
...pkgJson,
|
|
521
|
+
body,
|
|
522
|
+
typedoc: typedocContent
|
|
523
|
+
});
|
|
524
|
+
await writeFile(PATH2.join(location, "README.md"), readmeContent);
|
|
525
|
+
if (verbose) console.log(chalk5.green(` ${name}`));
|
|
526
|
+
return true;
|
|
527
|
+
} catch (ex) {
|
|
528
|
+
const error = ex;
|
|
529
|
+
console.warn(chalk5.yellow(` Skipped ${location}: ${error.message}`));
|
|
530
|
+
return false;
|
|
531
|
+
}
|
|
532
|
+
}
|
|
424
533
|
async function generateReadmeFiles({
|
|
534
|
+
logoLinkUrl,
|
|
535
|
+
logoUrl,
|
|
425
536
|
pkg,
|
|
426
537
|
templatePath,
|
|
427
538
|
typedoc = false,
|
|
428
|
-
verbose
|
|
539
|
+
verbose = false
|
|
429
540
|
}) {
|
|
430
541
|
console.log(chalk5.green("Generate README Files"));
|
|
431
|
-
const
|
|
432
|
-
const resolvedTemplatePath = templatePath ?? PATH2.join(cwd, "scripts", "README.template.md");
|
|
542
|
+
const resolvedTemplatePath = resolveTemplatePath(templatePath);
|
|
433
543
|
let template;
|
|
544
|
+
let templateCreated;
|
|
434
545
|
try {
|
|
435
|
-
template = await
|
|
546
|
+
({ template, created: templateCreated } = await loadOrCreateTemplate(resolvedTemplatePath));
|
|
436
547
|
} catch {
|
|
437
|
-
console.error(chalk5.red(`Template not found: ${resolvedTemplatePath}`));
|
|
438
548
|
return 1;
|
|
439
549
|
}
|
|
440
|
-
|
|
550
|
+
template = applyLogoConfig(template, logoUrl, logoLinkUrl);
|
|
551
|
+
if (templateCreated) {
|
|
552
|
+
console.log(chalk5.green("Generating README files for all packages..."));
|
|
553
|
+
}
|
|
554
|
+
const xyDir = PATH2.dirname(resolvedTemplatePath);
|
|
555
|
+
const xyBodyPath = PATH2.join(xyDir, "README.body.md");
|
|
556
|
+
let defaultBody;
|
|
557
|
+
try {
|
|
558
|
+
defaultBody = await readFile(xyBodyPath, "utf8");
|
|
559
|
+
} catch {
|
|
560
|
+
defaultBody = DEFAULT_README_BODY;
|
|
561
|
+
}
|
|
562
|
+
const workspaces = pkg && !templateCreated ? [yarnWorkspace(pkg)] : yarnWorkspaces();
|
|
441
563
|
let failed = false;
|
|
442
564
|
for (const { location, name } of workspaces) {
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
const pkgJson = JSON.parse(await readFile(pkgJsonPath, "utf8"));
|
|
446
|
-
const typedocContent = typedoc ? generateTypedoc(location, ["src/index*.ts"]) : "";
|
|
447
|
-
const readmeContent = fillTemplate(template, { ...pkgJson, typedoc: typedocContent });
|
|
448
|
-
await writeFile(PATH2.join(location, "README.md"), readmeContent);
|
|
449
|
-
if (verbose) console.log(chalk5.green(` ${name}`));
|
|
450
|
-
} catch (ex) {
|
|
451
|
-
const error = ex;
|
|
452
|
-
console.warn(chalk5.yellow(` Skipped ${location}: ${error.message}`));
|
|
453
|
-
failed = true;
|
|
454
|
-
}
|
|
565
|
+
const success = await generateReadmeForWorkspace(location, name, template, defaultBody, typedoc, verbose);
|
|
566
|
+
if (!success) failed = true;
|
|
455
567
|
}
|
|
456
568
|
return failed ? 1 : 0;
|
|
457
569
|
}
|
|
@@ -478,10 +590,10 @@ var loadConfig = async (params) => {
|
|
|
478
590
|
};
|
|
479
591
|
|
|
480
592
|
// src/lib/parsedPackageJSON.ts
|
|
481
|
-
import { readFileSync as
|
|
593
|
+
import { readFileSync as readFileSync4 } from "fs";
|
|
482
594
|
var parsedPackageJSON = (path8) => {
|
|
483
595
|
const pathToPackageJSON = path8 ?? process.env.npm_package_json ?? "";
|
|
484
|
-
const packageJSON =
|
|
596
|
+
const packageJSON = readFileSync4(pathToPackageJSON).toString();
|
|
485
597
|
return JSON.parse(packageJSON);
|
|
486
598
|
};
|
|
487
599
|
|
|
@@ -596,7 +708,7 @@ import {
|
|
|
596
708
|
existsSync as existsSync4,
|
|
597
709
|
mkdirSync,
|
|
598
710
|
readdirSync as readdirSync2,
|
|
599
|
-
readFileSync as
|
|
711
|
+
readFileSync as readFileSync5,
|
|
600
712
|
unlinkSync,
|
|
601
713
|
writeFileSync as writeFileSync2
|
|
602
714
|
} from "fs";
|
|
@@ -609,7 +721,7 @@ var syncCommandFiles = (commandsDir) => {
|
|
|
609
721
|
let created = 0;
|
|
610
722
|
for (const [filename3, content] of Object.entries(templates)) {
|
|
611
723
|
const targetPath = PATH3.resolve(commandsDir, filename3);
|
|
612
|
-
const existing = existsSync4(targetPath) ?
|
|
724
|
+
const existing = existsSync4(targetPath) ? readFileSync5(targetPath, "utf8") : void 0;
|
|
613
725
|
if (existing === content) continue;
|
|
614
726
|
writeFileSync2(targetPath, content, "utf8");
|
|
615
727
|
if (existing) {
|
|
@@ -666,7 +778,7 @@ import {
|
|
|
666
778
|
existsSync as existsSync5,
|
|
667
779
|
mkdirSync as mkdirSync2,
|
|
668
780
|
readdirSync as readdirSync3,
|
|
669
|
-
readFileSync as
|
|
781
|
+
readFileSync as readFileSync6,
|
|
670
782
|
unlinkSync as unlinkSync2,
|
|
671
783
|
writeFileSync as writeFileSync3
|
|
672
784
|
} from "fs";
|
|
@@ -679,7 +791,7 @@ var syncRuleFiles = (rulesDir) => {
|
|
|
679
791
|
let created = 0;
|
|
680
792
|
for (const [filename3, content] of Object.entries(templates)) {
|
|
681
793
|
const targetPath = PATH4.resolve(rulesDir, filename3);
|
|
682
|
-
const existing = existsSync5(targetPath) ?
|
|
794
|
+
const existing = existsSync5(targetPath) ? readFileSync6(targetPath, "utf8") : void 0;
|
|
683
795
|
if (existing === content) continue;
|
|
684
796
|
writeFileSync3(targetPath, content, "utf8");
|
|
685
797
|
if (existing) {
|
|
@@ -751,7 +863,7 @@ import {
|
|
|
751
863
|
writeFileSync as writeFileSync4
|
|
752
864
|
} from "fs";
|
|
753
865
|
import PATH5 from "path";
|
|
754
|
-
import { createInterface } from "readline";
|
|
866
|
+
import { createInterface as createInterface2 } from "readline";
|
|
755
867
|
import chalk12 from "chalk";
|
|
756
868
|
var DEFAULT_SETTINGS = {
|
|
757
869
|
permissions: {
|
|
@@ -786,8 +898,8 @@ var DEFAULT_SETTINGS = {
|
|
|
786
898
|
]
|
|
787
899
|
}
|
|
788
900
|
};
|
|
789
|
-
function
|
|
790
|
-
const rl =
|
|
901
|
+
function askConfirmation2(question) {
|
|
902
|
+
const rl = createInterface2({ input: process.stdin, output: process.stdout });
|
|
791
903
|
return new Promise((resolve) => {
|
|
792
904
|
rl.question(question, (answer) => {
|
|
793
905
|
rl.close();
|
|
@@ -801,7 +913,7 @@ async function claudeSettings() {
|
|
|
801
913
|
const settingsPath = PATH5.resolve(claudeDir, "settings.local.json");
|
|
802
914
|
mkdirSync3(claudeDir, { recursive: true });
|
|
803
915
|
if (existsSync6(settingsPath)) {
|
|
804
|
-
const confirmed = await
|
|
916
|
+
const confirmed = await askConfirmation2(
|
|
805
917
|
chalk12.yellow(`${settingsPath} already exists. Replace it? (y/N) `)
|
|
806
918
|
);
|
|
807
919
|
if (!confirmed) {
|
|
@@ -815,6 +927,84 @@ async function claudeSettings() {
|
|
|
815
927
|
return 0;
|
|
816
928
|
}
|
|
817
929
|
|
|
930
|
+
// src/actions/claude-skills.ts
|
|
931
|
+
import {
|
|
932
|
+
existsSync as existsSync7,
|
|
933
|
+
mkdirSync as mkdirSync4,
|
|
934
|
+
readdirSync as readdirSync4,
|
|
935
|
+
readFileSync as readFileSync7,
|
|
936
|
+
rmSync,
|
|
937
|
+
statSync as statSync2,
|
|
938
|
+
writeFileSync as writeFileSync5
|
|
939
|
+
} from "fs";
|
|
940
|
+
import PATH6 from "path";
|
|
941
|
+
import chalk13 from "chalk";
|
|
942
|
+
var syncSkillFiles = (skillsDir) => {
|
|
943
|
+
const templates = claudeSkillTemplates();
|
|
944
|
+
const templateNames = new Set(Object.keys(templates));
|
|
945
|
+
let updated = 0;
|
|
946
|
+
let created = 0;
|
|
947
|
+
for (const [skillName, files] of Object.entries(templates)) {
|
|
948
|
+
const skillDir = PATH6.resolve(skillsDir, skillName);
|
|
949
|
+
mkdirSync4(skillDir, { recursive: true });
|
|
950
|
+
for (const [filename3, content] of Object.entries(files)) {
|
|
951
|
+
const targetPath = PATH6.resolve(skillDir, filename3);
|
|
952
|
+
mkdirSync4(PATH6.dirname(targetPath), { recursive: true });
|
|
953
|
+
const existing = existsSync7(targetPath) ? readFileSync7(targetPath, "utf8") : void 0;
|
|
954
|
+
if (existing === content) continue;
|
|
955
|
+
writeFileSync5(targetPath, content, "utf8");
|
|
956
|
+
if (existing) {
|
|
957
|
+
updated++;
|
|
958
|
+
} else {
|
|
959
|
+
created++;
|
|
960
|
+
}
|
|
961
|
+
}
|
|
962
|
+
}
|
|
963
|
+
return {
|
|
964
|
+
created,
|
|
965
|
+
templateNames,
|
|
966
|
+
updated
|
|
967
|
+
};
|
|
968
|
+
};
|
|
969
|
+
var removeStaleSkills = (skillsDir, templateNames) => {
|
|
970
|
+
const existingSkills = readdirSync4(skillsDir).filter(
|
|
971
|
+
(f) => f.startsWith(XYLABS_SKILLS_PREFIX) && statSync2(PATH6.resolve(skillsDir, f)).isDirectory()
|
|
972
|
+
);
|
|
973
|
+
let removed = 0;
|
|
974
|
+
for (const dir of existingSkills) {
|
|
975
|
+
if (!templateNames.has(dir)) {
|
|
976
|
+
rmSync(PATH6.resolve(skillsDir, dir), { recursive: true });
|
|
977
|
+
removed++;
|
|
978
|
+
}
|
|
979
|
+
}
|
|
980
|
+
return removed;
|
|
981
|
+
};
|
|
982
|
+
var logSkillsResult = (created, updated, removed) => {
|
|
983
|
+
if (created || updated || removed) {
|
|
984
|
+
const parts = [
|
|
985
|
+
created ? `${created} created` : "",
|
|
986
|
+
updated ? `${updated} updated` : "",
|
|
987
|
+
removed ? `${removed} removed` : ""
|
|
988
|
+
].filter(Boolean);
|
|
989
|
+
console.log(chalk13.green(`.claude/skills/${XYLABS_SKILLS_PREFIX}*/: ${parts.join(", ")}`));
|
|
990
|
+
} else {
|
|
991
|
+
console.log(chalk13.gray(`.claude/skills/${XYLABS_SKILLS_PREFIX}*/: already up to date`));
|
|
992
|
+
}
|
|
993
|
+
};
|
|
994
|
+
var claudeSkills = () => {
|
|
995
|
+
const cwd = INIT_CWD() ?? process.cwd();
|
|
996
|
+
const skillsDir = PATH6.resolve(cwd, ".claude", "skills");
|
|
997
|
+
mkdirSync4(skillsDir, { recursive: true });
|
|
998
|
+
const {
|
|
999
|
+
created,
|
|
1000
|
+
templateNames,
|
|
1001
|
+
updated
|
|
1002
|
+
} = syncSkillFiles(skillsDir);
|
|
1003
|
+
const removed = removeStaleSkills(skillsDir, templateNames);
|
|
1004
|
+
logSkillsResult(created, updated, removed);
|
|
1005
|
+
return 0;
|
|
1006
|
+
};
|
|
1007
|
+
|
|
818
1008
|
// src/actions/clean.ts
|
|
819
1009
|
var clean = async ({ verbose, pkg }) => {
|
|
820
1010
|
return pkg ? await cleanPackage({ pkg, verbose }) : cleanAll({ verbose });
|
|
@@ -829,16 +1019,16 @@ var cleanAll = ({ verbose }) => {
|
|
|
829
1019
|
|
|
830
1020
|
// src/actions/clean-docs.ts
|
|
831
1021
|
import path from "path";
|
|
832
|
-
import
|
|
1022
|
+
import chalk14 from "chalk";
|
|
833
1023
|
var cleanDocs = () => {
|
|
834
1024
|
const pkgName = process.env.npm_package_name;
|
|
835
|
-
console.log(
|
|
1025
|
+
console.log(chalk14.green(`Cleaning Docs [${pkgName}]`));
|
|
836
1026
|
for (const { location } of yarnWorkspaces()) deleteGlob(path.join(location, "docs"));
|
|
837
1027
|
return 0;
|
|
838
1028
|
};
|
|
839
1029
|
|
|
840
1030
|
// src/actions/compile.ts
|
|
841
|
-
import
|
|
1031
|
+
import chalk15 from "chalk";
|
|
842
1032
|
var compile = ({
|
|
843
1033
|
verbose,
|
|
844
1034
|
target,
|
|
@@ -879,7 +1069,7 @@ var compileAll = ({
|
|
|
879
1069
|
const incrementalOptions = incremental ? ["--since", "-Ap", "--topological-dev"] : ["--parallel", "-Ap", "--topological-dev"];
|
|
880
1070
|
const jobsOptions = jobs ? ["-j", `${jobs}`] : [];
|
|
881
1071
|
if (jobs) {
|
|
882
|
-
console.log(
|
|
1072
|
+
console.log(chalk15.blue(`Jobs set to [${jobs}]`));
|
|
883
1073
|
}
|
|
884
1074
|
const result = runSteps(`Compile${incremental ? "-Incremental" : ""} [All]`, [
|
|
885
1075
|
["yarn", [
|
|
@@ -893,13 +1083,13 @@ var compileAll = ({
|
|
|
893
1083
|
...targetOptions
|
|
894
1084
|
]]
|
|
895
1085
|
]);
|
|
896
|
-
console.log(`${
|
|
1086
|
+
console.log(`${chalk15.gray("Compiled in")} [${chalk15.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk15.gray("seconds")}`);
|
|
897
1087
|
return result;
|
|
898
1088
|
};
|
|
899
1089
|
|
|
900
1090
|
// src/actions/copy-assets.ts
|
|
901
1091
|
import path2 from "path/posix";
|
|
902
|
-
import
|
|
1092
|
+
import chalk16 from "chalk";
|
|
903
1093
|
import cpy from "cpy";
|
|
904
1094
|
var copyPackageTargetAssets = async (target, name, location) => {
|
|
905
1095
|
try {
|
|
@@ -922,7 +1112,7 @@ var copyPackageTargetAssets = async (target, name, location) => {
|
|
|
922
1112
|
};
|
|
923
1113
|
var copyTargetAssets = async (target, pkg) => {
|
|
924
1114
|
const workspaces = yarnWorkspaces();
|
|
925
|
-
console.log(
|
|
1115
|
+
console.log(chalk16.green(`Copying Assets [${target.toUpperCase()}]`));
|
|
926
1116
|
const workspaceList = workspaces.filter(({ name }) => {
|
|
927
1117
|
return pkg === void 0 || name === pkg;
|
|
928
1118
|
});
|
|
@@ -1006,7 +1196,7 @@ var dead = () => {
|
|
|
1006
1196
|
};
|
|
1007
1197
|
|
|
1008
1198
|
// src/actions/deplint/deplint.ts
|
|
1009
|
-
import
|
|
1199
|
+
import chalk22 from "chalk";
|
|
1010
1200
|
|
|
1011
1201
|
// src/actions/deplint/findFiles.ts
|
|
1012
1202
|
import fs2 from "fs";
|
|
@@ -1211,7 +1401,7 @@ function getExternalImportsFromFiles({
|
|
|
1211
1401
|
|
|
1212
1402
|
// src/actions/deplint/checkPackage/getUnlistedDependencies.ts
|
|
1213
1403
|
import { builtinModules } from "module";
|
|
1214
|
-
import
|
|
1404
|
+
import chalk17 from "chalk";
|
|
1215
1405
|
function isRuntimeImportListed(imp, name, dependencies, peerDependencies) {
|
|
1216
1406
|
return dependencies.includes(imp) || imp === name || peerDependencies.includes(imp) || builtinModules.includes(imp);
|
|
1217
1407
|
}
|
|
@@ -1219,7 +1409,7 @@ function isTypeImportListed(imp, name, dependencies, devDependencies, peerDepend
|
|
|
1219
1409
|
return dependencies.includes(imp) || imp === name || dependencies.includes(`@types/${imp}`) || peerDependencies.includes(imp) || peerDependencies.includes(`@types/${imp}`) || devDependencies.includes(`@types/${imp}`) || builtinModules.includes(imp);
|
|
1220
1410
|
}
|
|
1221
1411
|
function logMissing(name, imp, importPaths) {
|
|
1222
|
-
console.log(`[${
|
|
1412
|
+
console.log(`[${chalk17.blue(name)}] Missing dependency in package.json: ${chalk17.red(imp)}`);
|
|
1223
1413
|
if (importPaths[imp]) {
|
|
1224
1414
|
console.log(` ${importPaths[imp].join("\n ")}`);
|
|
1225
1415
|
}
|
|
@@ -1248,7 +1438,7 @@ function getUnlistedDependencies({ name, location }, {
|
|
|
1248
1438
|
}
|
|
1249
1439
|
if (unlistedDependencies > 0) {
|
|
1250
1440
|
const packageLocation = `${location}/package.json`;
|
|
1251
|
-
console.log(` ${
|
|
1441
|
+
console.log(` ${chalk17.yellow(packageLocation)}
|
|
1252
1442
|
`);
|
|
1253
1443
|
}
|
|
1254
1444
|
return unlistedDependencies;
|
|
@@ -1256,7 +1446,7 @@ function getUnlistedDependencies({ name, location }, {
|
|
|
1256
1446
|
|
|
1257
1447
|
// src/actions/deplint/checkPackage/getUnlistedDevDependencies.ts
|
|
1258
1448
|
import { builtinModules as builtinModules2 } from "module";
|
|
1259
|
-
import
|
|
1449
|
+
import chalk18 from "chalk";
|
|
1260
1450
|
function getUnlistedDevDependencies({ name, location }, {
|
|
1261
1451
|
devDependencies,
|
|
1262
1452
|
dependencies,
|
|
@@ -1270,7 +1460,7 @@ function getUnlistedDevDependencies({ name, location }, {
|
|
|
1270
1460
|
for (const imp of externalAllImports) {
|
|
1271
1461
|
if (!distImports.includes(imp) && imp !== name && !dependencies.includes(imp) && !dependencies.includes(`@types/${imp}`) && !peerDependencies.includes(imp) && !peerDependencies.includes(`@types/${imp}`) && !devDependencies.includes(imp) && !devDependencies.includes(`@types/${imp}`) && !builtinModules2.includes(imp)) {
|
|
1272
1462
|
unlistedDevDependencies++;
|
|
1273
|
-
console.log(`[${
|
|
1463
|
+
console.log(`[${chalk18.blue(name)}] Missing devDependency in package.json: ${chalk18.red(imp)}`);
|
|
1274
1464
|
if (allImportPaths[imp]) {
|
|
1275
1465
|
console.log(` ${allImportPaths[imp].join("\n ")}`);
|
|
1276
1466
|
}
|
|
@@ -1278,14 +1468,14 @@ function getUnlistedDevDependencies({ name, location }, {
|
|
|
1278
1468
|
}
|
|
1279
1469
|
if (unlistedDevDependencies > 0) {
|
|
1280
1470
|
const packageLocation = `${location}/package.json`;
|
|
1281
|
-
console.log(` ${
|
|
1471
|
+
console.log(` ${chalk18.yellow(packageLocation)}
|
|
1282
1472
|
`);
|
|
1283
1473
|
}
|
|
1284
1474
|
return unlistedDevDependencies;
|
|
1285
1475
|
}
|
|
1286
1476
|
|
|
1287
1477
|
// src/actions/deplint/checkPackage/getUnusedDependencies.ts
|
|
1288
|
-
import
|
|
1478
|
+
import chalk19 from "chalk";
|
|
1289
1479
|
function getUnusedDependencies({ name, location }, { dependencies }, {
|
|
1290
1480
|
externalDistImports,
|
|
1291
1481
|
externalDistTypeImports,
|
|
@@ -1297,22 +1487,22 @@ function getUnusedDependencies({ name, location }, { dependencies }, {
|
|
|
1297
1487
|
if (!externalDistImports.includes(dep) && !externalDistImports.includes(dep.replace(/^@types\//, "")) && !externalDistTypeImports.includes(dep) && !externalDistTypeImports.includes(dep.replace(/^@types\//, ""))) {
|
|
1298
1488
|
unusedDependencies++;
|
|
1299
1489
|
if (externalAllImports.includes(dep)) {
|
|
1300
|
-
console.log(`[${
|
|
1490
|
+
console.log(`[${chalk19.blue(name)}] dependency should be devDependency in package.json: ${chalk19.red(dep)}`);
|
|
1301
1491
|
} else {
|
|
1302
|
-
console.log(`[${
|
|
1492
|
+
console.log(`[${chalk19.blue(name)}] Unused dependency in package.json: ${chalk19.red(dep)}`);
|
|
1303
1493
|
}
|
|
1304
1494
|
}
|
|
1305
1495
|
}
|
|
1306
1496
|
if (unusedDependencies > 0) {
|
|
1307
1497
|
const packageLocation = `${location}/package.json`;
|
|
1308
|
-
console.log(` ${
|
|
1498
|
+
console.log(` ${chalk19.yellow(packageLocation)}
|
|
1309
1499
|
`);
|
|
1310
1500
|
}
|
|
1311
1501
|
return unusedDependencies;
|
|
1312
1502
|
}
|
|
1313
1503
|
|
|
1314
1504
|
// src/actions/deplint/checkPackage/getUnusedDevDependencies.ts
|
|
1315
|
-
import
|
|
1505
|
+
import chalk20 from "chalk";
|
|
1316
1506
|
|
|
1317
1507
|
// src/actions/deplint/getCliReferencedPackagesFromFiles.ts
|
|
1318
1508
|
import fs8 from "fs";
|
|
@@ -1596,19 +1786,19 @@ function getUnusedDevDependencies({ name, location }, {
|
|
|
1596
1786
|
if (dependencies.includes(dep) || peerDependencies.includes(dep)) continue;
|
|
1597
1787
|
if (!isDevDepUsed(dep, allImports, implicitDeps, requiredPeers, scriptRefs, cliRefs)) {
|
|
1598
1788
|
unusedDevDependencies++;
|
|
1599
|
-
console.log(`[${
|
|
1789
|
+
console.log(`[${chalk20.blue(name)}] Unused devDependency in package.json: ${chalk20.red(dep)}`);
|
|
1600
1790
|
}
|
|
1601
1791
|
}
|
|
1602
1792
|
if (unusedDevDependencies > 0) {
|
|
1603
1793
|
const packageLocation = `${location}/package.json`;
|
|
1604
|
-
console.log(` ${
|
|
1794
|
+
console.log(` ${chalk20.yellow(packageLocation)}
|
|
1605
1795
|
`);
|
|
1606
1796
|
}
|
|
1607
1797
|
return unusedDevDependencies;
|
|
1608
1798
|
}
|
|
1609
1799
|
|
|
1610
1800
|
// src/actions/deplint/checkPackage/getUnusedPeerDependencies.ts
|
|
1611
|
-
import
|
|
1801
|
+
import chalk21 from "chalk";
|
|
1612
1802
|
function getUnusedPeerDependencies({ name, location }, { peerDependencies, dependencies }, { externalDistImports, externalDistTypeImports }, exclude) {
|
|
1613
1803
|
let unusedDependencies = 0;
|
|
1614
1804
|
for (const dep of peerDependencies) {
|
|
@@ -1616,15 +1806,15 @@ function getUnusedPeerDependencies({ name, location }, { peerDependencies, depen
|
|
|
1616
1806
|
if (!externalDistImports.includes(dep) && !externalDistImports.includes(dep.replace(/^@types\//, "")) && !externalDistTypeImports.includes(dep) && !externalDistTypeImports.includes(dep.replace(/^@types\//, ""))) {
|
|
1617
1807
|
unusedDependencies++;
|
|
1618
1808
|
if (dependencies.includes(dep)) {
|
|
1619
|
-
console.log(`[${
|
|
1809
|
+
console.log(`[${chalk21.blue(name)}] Unused peerDependency [already a dependency] in package.json: ${chalk21.red(dep)}`);
|
|
1620
1810
|
} else {
|
|
1621
|
-
console.log(`[${
|
|
1811
|
+
console.log(`[${chalk21.blue(name)}] Unused peerDependency in package.json: ${chalk21.red(dep)}`);
|
|
1622
1812
|
}
|
|
1623
1813
|
}
|
|
1624
1814
|
}
|
|
1625
1815
|
if (unusedDependencies > 0) {
|
|
1626
1816
|
const packageLocation = `${location}/package.json`;
|
|
1627
|
-
console.log(` ${
|
|
1817
|
+
console.log(` ${chalk21.yellow(packageLocation)}
|
|
1628
1818
|
`);
|
|
1629
1819
|
}
|
|
1630
1820
|
return unusedDependencies;
|
|
@@ -1719,19 +1909,19 @@ var deplint = async ({
|
|
|
1719
1909
|
});
|
|
1720
1910
|
}
|
|
1721
1911
|
if (totalErrors > 0) {
|
|
1722
|
-
console.warn(`Deplint: Found ${
|
|
1912
|
+
console.warn(`Deplint: Found ${chalk22.red(totalErrors)} dependency problems. ${chalk22.red("\u2716")}`);
|
|
1723
1913
|
} else {
|
|
1724
|
-
console.info(`Deplint: Found no dependency problems. ${
|
|
1914
|
+
console.info(`Deplint: Found no dependency problems. ${chalk22.green("\u2714")}`);
|
|
1725
1915
|
}
|
|
1726
1916
|
return 0;
|
|
1727
1917
|
};
|
|
1728
1918
|
|
|
1729
1919
|
// src/actions/deploy.ts
|
|
1730
|
-
import { readFileSync as
|
|
1920
|
+
import { readFileSync as readFileSync8 } from "fs";
|
|
1731
1921
|
var privatePackageExcludeList = () => {
|
|
1732
1922
|
const possibleDeployablePackages = yarnWorkspaces().map((workspace) => [
|
|
1733
1923
|
workspace,
|
|
1734
|
-
JSON.parse(
|
|
1924
|
+
JSON.parse(readFileSync8(`${workspace.location}/package.json`, { encoding: "utf8" }))
|
|
1735
1925
|
]);
|
|
1736
1926
|
const privatePackages = possibleDeployablePackages.filter(([_, pkg]) => pkg.private).map(([workspace]) => workspace);
|
|
1737
1927
|
const excludeList = privatePackages.map((workspace) => `--exclude ${workspace.name}`);
|
|
@@ -1751,11 +1941,11 @@ var deploy = () => {
|
|
|
1751
1941
|
};
|
|
1752
1942
|
|
|
1753
1943
|
// src/actions/deploy-major.ts
|
|
1754
|
-
import { readFileSync as
|
|
1944
|
+
import { readFileSync as readFileSync9 } from "fs";
|
|
1755
1945
|
var privatePackageExcludeList2 = () => {
|
|
1756
1946
|
const possibleDeployablePackages = yarnWorkspaces().map((workspace) => [
|
|
1757
1947
|
workspace,
|
|
1758
|
-
JSON.parse(
|
|
1948
|
+
JSON.parse(readFileSync9(`${workspace.location}/package.json`, { encoding: "utf8" }))
|
|
1759
1949
|
]);
|
|
1760
1950
|
const privatePackages = possibleDeployablePackages.filter(([_, pkg]) => pkg.private).map(([workspace]) => workspace);
|
|
1761
1951
|
const excludeList = privatePackages.map((workspace) => `--exclude ${workspace.name}`);
|
|
@@ -1775,11 +1965,11 @@ var deployMajor = () => {
|
|
|
1775
1965
|
};
|
|
1776
1966
|
|
|
1777
1967
|
// src/actions/deploy-minor.ts
|
|
1778
|
-
import { readFileSync as
|
|
1968
|
+
import { readFileSync as readFileSync10 } from "fs";
|
|
1779
1969
|
var privatePackageExcludeList3 = () => {
|
|
1780
1970
|
const possibleDeployablePackages = yarnWorkspaces().map((workspace) => [
|
|
1781
1971
|
workspace,
|
|
1782
|
-
JSON.parse(
|
|
1972
|
+
JSON.parse(readFileSync10(`${workspace.location}/package.json`, { encoding: "utf8" }))
|
|
1783
1973
|
]);
|
|
1784
1974
|
const privatePackages = possibleDeployablePackages.filter(([_, pkg]) => pkg.private).map(([workspace]) => workspace);
|
|
1785
1975
|
const excludeList = privatePackages.map((workspace) => `--exclude ${workspace.name}`);
|
|
@@ -1799,11 +1989,11 @@ var deployMinor = () => {
|
|
|
1799
1989
|
};
|
|
1800
1990
|
|
|
1801
1991
|
// src/actions/deploy-next.ts
|
|
1802
|
-
import { readFileSync as
|
|
1992
|
+
import { readFileSync as readFileSync11 } from "fs";
|
|
1803
1993
|
var privatePackageExcludeList4 = () => {
|
|
1804
1994
|
const possibleDeployablePackages = yarnWorkspaces().map((workspace) => [
|
|
1805
1995
|
workspace,
|
|
1806
|
-
JSON.parse(
|
|
1996
|
+
JSON.parse(readFileSync11(`${workspace.location}/package.json`, { encoding: "utf8" }))
|
|
1807
1997
|
]);
|
|
1808
1998
|
const privatePackages = possibleDeployablePackages.filter(([_, pkg]) => pkg.private).map(([workspace]) => workspace);
|
|
1809
1999
|
const excludeList = privatePackages.map((workspace) => `--exclude ${workspace.name}`);
|
|
@@ -1823,22 +2013,22 @@ var deployNext = () => {
|
|
|
1823
2013
|
};
|
|
1824
2014
|
|
|
1825
2015
|
// src/actions/dupdeps.ts
|
|
1826
|
-
import
|
|
2016
|
+
import chalk23 from "chalk";
|
|
1827
2017
|
var dupdeps = () => {
|
|
1828
|
-
console.log(
|
|
2018
|
+
console.log(chalk23.green("Checking all Dependencies for Duplicates"));
|
|
1829
2019
|
const allDependencies = parsedPackageJSON()?.dependencies;
|
|
1830
2020
|
const dependencies = Object.entries(allDependencies).map(([k]) => k);
|
|
1831
2021
|
return detectDuplicateDependencies(dependencies);
|
|
1832
2022
|
};
|
|
1833
2023
|
|
|
1834
2024
|
// src/actions/lint.ts
|
|
1835
|
-
import
|
|
2025
|
+
import chalk24 from "chalk";
|
|
1836
2026
|
var lintPackage = ({
|
|
1837
2027
|
pkg,
|
|
1838
2028
|
fix: fix2,
|
|
1839
2029
|
verbose
|
|
1840
2030
|
}) => {
|
|
1841
|
-
console.log(
|
|
2031
|
+
console.log(chalk24.gray(`${fix2 ? "Fix" : "Lint"} [${pkg}]`));
|
|
1842
2032
|
const start = Date.now();
|
|
1843
2033
|
const result = runSteps(`${fix2 ? "Fix" : "Lint"} [${pkg}]`, [
|
|
1844
2034
|
["yarn", [
|
|
@@ -1848,7 +2038,7 @@ var lintPackage = ({
|
|
|
1848
2038
|
fix2 ? "package-fix" : verbose ? "package-lint-verbose" : "package-lint"
|
|
1849
2039
|
]]
|
|
1850
2040
|
]);
|
|
1851
|
-
console.log(
|
|
2041
|
+
console.log(chalk24.gray(`${fix2 ? "Fixed in" : "Linted in"} [${chalk24.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk24.gray("seconds")}`));
|
|
1852
2042
|
return result;
|
|
1853
2043
|
};
|
|
1854
2044
|
var lint = ({
|
|
@@ -1868,13 +2058,13 @@ var lint = ({
|
|
|
1868
2058
|
});
|
|
1869
2059
|
};
|
|
1870
2060
|
var lintAllPackages = ({ fix: fix2 = false } = {}) => {
|
|
1871
|
-
console.log(
|
|
2061
|
+
console.log(chalk24.gray(`${fix2 ? "Fix" : "Lint"} [All-Packages]`));
|
|
1872
2062
|
const start = Date.now();
|
|
1873
2063
|
const fixOptions = fix2 ? ["--fix"] : [];
|
|
1874
2064
|
const result = runSteps(`${fix2 ? "Fix" : "Lint"} [All-Packages]`, [
|
|
1875
2065
|
["yarn", ["eslint", "--cache", "--cache-location", ".eslintcache", "--cache-strategy", "content", ...fixOptions]]
|
|
1876
2066
|
]);
|
|
1877
|
-
console.log(
|
|
2067
|
+
console.log(chalk24.gray(`${fix2 ? "Fixed in" : "Linted in"} [${chalk24.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk24.gray("seconds")}`));
|
|
1878
2068
|
return result;
|
|
1879
2069
|
};
|
|
1880
2070
|
|
|
@@ -1902,7 +2092,7 @@ var filename = ".gitignore";
|
|
|
1902
2092
|
var gitignoreGen = (pkg) => generateIgnoreFiles(filename, pkg);
|
|
1903
2093
|
|
|
1904
2094
|
// src/actions/gitlint.ts
|
|
1905
|
-
import
|
|
2095
|
+
import chalk25 from "chalk";
|
|
1906
2096
|
import ParseGitConfig from "parse-git-config";
|
|
1907
2097
|
var gitlint = () => {
|
|
1908
2098
|
console.log(`
|
|
@@ -1913,7 +2103,7 @@ Gitlint Start [${process.cwd()}]
|
|
|
1913
2103
|
const errors = 0;
|
|
1914
2104
|
const gitConfig = ParseGitConfig.sync();
|
|
1915
2105
|
const warn = (message) => {
|
|
1916
|
-
console.warn(
|
|
2106
|
+
console.warn(chalk25.yellow(`Warning: ${message}`));
|
|
1917
2107
|
warnings++;
|
|
1918
2108
|
};
|
|
1919
2109
|
if (gitConfig.core.ignorecase) {
|
|
@@ -1933,13 +2123,13 @@ Gitlint Start [${process.cwd()}]
|
|
|
1933
2123
|
}
|
|
1934
2124
|
const resultMessages = [];
|
|
1935
2125
|
if (valid > 0) {
|
|
1936
|
-
resultMessages.push(
|
|
2126
|
+
resultMessages.push(chalk25.green(`Passed: ${valid}`));
|
|
1937
2127
|
}
|
|
1938
2128
|
if (warnings > 0) {
|
|
1939
|
-
resultMessages.push(
|
|
2129
|
+
resultMessages.push(chalk25.yellow(`Warnings: ${warnings}`));
|
|
1940
2130
|
}
|
|
1941
2131
|
if (errors > 0) {
|
|
1942
|
-
resultMessages.push(
|
|
2132
|
+
resultMessages.push(chalk25.red(` Errors: ${errors}`));
|
|
1943
2133
|
}
|
|
1944
2134
|
console.warn(`Gitlint Finish [ ${resultMessages.join(" | ")} ]
|
|
1945
2135
|
`);
|
|
@@ -1948,7 +2138,7 @@ Gitlint Start [${process.cwd()}]
|
|
|
1948
2138
|
|
|
1949
2139
|
// src/actions/gitlint-fix.ts
|
|
1950
2140
|
import { execSync as execSync3 } from "child_process";
|
|
1951
|
-
import
|
|
2141
|
+
import chalk26 from "chalk";
|
|
1952
2142
|
import ParseGitConfig2 from "parse-git-config";
|
|
1953
2143
|
var gitlintFix = () => {
|
|
1954
2144
|
console.log(`
|
|
@@ -1957,15 +2147,15 @@ Gitlint Fix Start [${process.cwd()}]
|
|
|
1957
2147
|
const gitConfig = ParseGitConfig2.sync();
|
|
1958
2148
|
if (gitConfig.core.ignorecase) {
|
|
1959
2149
|
execSync3("git config core.ignorecase false", { stdio: "inherit" });
|
|
1960
|
-
console.warn(
|
|
2150
|
+
console.warn(chalk26.yellow("\nGitlint Fix: Updated core.ignorecase to be false\n"));
|
|
1961
2151
|
}
|
|
1962
2152
|
if (gitConfig.core.autocrlf !== false) {
|
|
1963
2153
|
execSync3("git config core.autocrlf false", { stdio: "inherit" });
|
|
1964
|
-
console.warn(
|
|
2154
|
+
console.warn(chalk26.yellow("\nGitlint Fix: Updated core.autocrlf to be false\n"));
|
|
1965
2155
|
}
|
|
1966
2156
|
if (gitConfig.core.eol !== "lf") {
|
|
1967
2157
|
execSync3("git config core.eol lf", { stdio: "inherit" });
|
|
1968
|
-
console.warn(
|
|
2158
|
+
console.warn(chalk26.yellow('\nGitlint Fix: Updated core.eol to be "lf"\n'));
|
|
1969
2159
|
}
|
|
1970
2160
|
return 1;
|
|
1971
2161
|
};
|
|
@@ -1976,7 +2166,7 @@ var knip = () => {
|
|
|
1976
2166
|
};
|
|
1977
2167
|
|
|
1978
2168
|
// src/actions/license.ts
|
|
1979
|
-
import
|
|
2169
|
+
import chalk27 from "chalk";
|
|
1980
2170
|
import { init } from "license-checker";
|
|
1981
2171
|
var license = async (pkg) => {
|
|
1982
2172
|
const workspaces = yarnWorkspaces();
|
|
@@ -2001,18 +2191,18 @@ var license = async (pkg) => {
|
|
|
2001
2191
|
"LGPL-3.0-or-later",
|
|
2002
2192
|
"Python-2.0"
|
|
2003
2193
|
]);
|
|
2004
|
-
console.log(
|
|
2194
|
+
console.log(chalk27.green("License Checker"));
|
|
2005
2195
|
return (await Promise.all(
|
|
2006
2196
|
workspaceList.map(({ location, name }) => {
|
|
2007
2197
|
return new Promise((resolve) => {
|
|
2008
2198
|
init({ production: true, start: location }, (error, packages) => {
|
|
2009
2199
|
if (error) {
|
|
2010
|
-
console.error(
|
|
2011
|
-
console.error(
|
|
2200
|
+
console.error(chalk27.red(`License Checker [${name}] Error`));
|
|
2201
|
+
console.error(chalk27.gray(error));
|
|
2012
2202
|
console.log("\n");
|
|
2013
2203
|
resolve(1);
|
|
2014
2204
|
} else {
|
|
2015
|
-
console.log(
|
|
2205
|
+
console.log(chalk27.green(`License Checker [${name}]`));
|
|
2016
2206
|
let count = 0;
|
|
2017
2207
|
for (const [name2, info] of Object.entries(packages)) {
|
|
2018
2208
|
const licenses = Array.isArray(info.licenses) ? info.licenses : [info.licenses];
|
|
@@ -2028,7 +2218,7 @@ var license = async (pkg) => {
|
|
|
2028
2218
|
}
|
|
2029
2219
|
if (!orLicenseFound) {
|
|
2030
2220
|
count++;
|
|
2031
|
-
console.warn(
|
|
2221
|
+
console.warn(chalk27.yellow(`${name2}: Package License not allowed [${license2}]`));
|
|
2032
2222
|
}
|
|
2033
2223
|
}
|
|
2034
2224
|
}
|
|
@@ -2070,7 +2260,10 @@ async function readmeGen({
|
|
|
2070
2260
|
typedoc,
|
|
2071
2261
|
verbose
|
|
2072
2262
|
}) {
|
|
2263
|
+
const config2 = await loadConfig();
|
|
2073
2264
|
return await generateReadmeFiles({
|
|
2265
|
+
logoLinkUrl: config2.readme?.logoLinkUrl,
|
|
2266
|
+
logoUrl: config2.readme?.logoUrl,
|
|
2074
2267
|
pkg,
|
|
2075
2268
|
templatePath,
|
|
2076
2269
|
typedoc,
|
|
@@ -2078,6 +2271,15 @@ async function readmeGen({
|
|
|
2078
2271
|
});
|
|
2079
2272
|
}
|
|
2080
2273
|
|
|
2274
|
+
// src/actions/readme-init.ts
|
|
2275
|
+
async function readmeInit({ templatePath }) {
|
|
2276
|
+
const config2 = await loadConfig();
|
|
2277
|
+
const template = applyLogoConfig(DEFAULT_README_TEMPLATE, config2.readme?.logoUrl, config2.readme?.logoLinkUrl);
|
|
2278
|
+
const resolvedTemplatePath = resolveTemplatePath(templatePath);
|
|
2279
|
+
await scaffoldTemplate(resolvedTemplatePath, template);
|
|
2280
|
+
return 0;
|
|
2281
|
+
}
|
|
2282
|
+
|
|
2081
2283
|
// src/actions/rebuild.ts
|
|
2082
2284
|
var rebuild = ({ target }) => {
|
|
2083
2285
|
return runSteps("Rebuild", [
|
|
@@ -2087,7 +2289,7 @@ var rebuild = ({ target }) => {
|
|
|
2087
2289
|
};
|
|
2088
2290
|
|
|
2089
2291
|
// src/actions/recompile.ts
|
|
2090
|
-
import
|
|
2292
|
+
import chalk28 from "chalk";
|
|
2091
2293
|
var recompile = async ({
|
|
2092
2294
|
verbose,
|
|
2093
2295
|
target,
|
|
@@ -2123,7 +2325,7 @@ var recompileAll = async ({
|
|
|
2123
2325
|
const incrementalOptions = incremental ? ["--since", "-Apt", "--topological-dev"] : ["--parallel", "-Apt", "--topological-dev"];
|
|
2124
2326
|
const jobsOptions = jobs ? ["-j", `${jobs}`] : [];
|
|
2125
2327
|
if (jobs) {
|
|
2126
|
-
console.log(
|
|
2328
|
+
console.log(chalk28.blue(`Jobs set to [${jobs}]`));
|
|
2127
2329
|
}
|
|
2128
2330
|
const result = await runStepsAsync(`Recompile${incremental ? "-Incremental" : ""} [All]`, [
|
|
2129
2331
|
[
|
|
@@ -2154,7 +2356,7 @@ var recompileAll = async ({
|
|
|
2154
2356
|
]
|
|
2155
2357
|
]);
|
|
2156
2358
|
console.log(
|
|
2157
|
-
`${
|
|
2359
|
+
`${chalk28.gray("Recompiled in")} [${chalk28.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk28.gray("seconds")}`
|
|
2158
2360
|
);
|
|
2159
2361
|
return result;
|
|
2160
2362
|
};
|
|
@@ -2163,7 +2365,7 @@ var recompileAll = async ({
|
|
|
2163
2365
|
import {
|
|
2164
2366
|
closeSync,
|
|
2165
2367
|
openSync,
|
|
2166
|
-
rmSync
|
|
2368
|
+
rmSync as rmSync2
|
|
2167
2369
|
} from "fs";
|
|
2168
2370
|
var reinstall = () => {
|
|
2169
2371
|
console.log("Reinstall [Clear Lock File]");
|
|
@@ -2173,7 +2375,7 @@ var reinstall = () => {
|
|
|
2173
2375
|
const result = workspaces.map(({ location, name }) => {
|
|
2174
2376
|
const dist = `${location}/node_modules`;
|
|
2175
2377
|
try {
|
|
2176
|
-
|
|
2378
|
+
rmSync2(dist, { force: true, recursive: true });
|
|
2177
2379
|
return 0;
|
|
2178
2380
|
} catch (ex) {
|
|
2179
2381
|
const error = ex;
|
|
@@ -2185,13 +2387,13 @@ var reinstall = () => {
|
|
|
2185
2387
|
};
|
|
2186
2388
|
|
|
2187
2389
|
// src/actions/relint.ts
|
|
2188
|
-
import
|
|
2390
|
+
import chalk29 from "chalk";
|
|
2189
2391
|
var relintPackage = ({
|
|
2190
2392
|
pkg,
|
|
2191
2393
|
fix: fix2,
|
|
2192
2394
|
verbose
|
|
2193
2395
|
}) => {
|
|
2194
|
-
console.log(
|
|
2396
|
+
console.log(chalk29.gray(`${fix2 ? "Fix" : "Lint"} [${pkg}]`));
|
|
2195
2397
|
const start = Date.now();
|
|
2196
2398
|
const result = runSteps(`${fix2 ? "Fix" : "Lint"} [${pkg}]`, [
|
|
2197
2399
|
["yarn", [
|
|
@@ -2201,7 +2403,7 @@ var relintPackage = ({
|
|
|
2201
2403
|
fix2 ? "package-fix" : verbose ? "package-lint-verbose" : "package-lint"
|
|
2202
2404
|
]]
|
|
2203
2405
|
]);
|
|
2204
|
-
console.log(
|
|
2406
|
+
console.log(chalk29.gray(`${fix2 ? "Fixed in" : "Linted in"} [${chalk29.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk29.gray("seconds")}`));
|
|
2205
2407
|
return result;
|
|
2206
2408
|
};
|
|
2207
2409
|
var relint = ({
|
|
@@ -2221,21 +2423,21 @@ var relint = ({
|
|
|
2221
2423
|
});
|
|
2222
2424
|
};
|
|
2223
2425
|
var relintAllPackages = ({ fix: fix2 = false } = {}) => {
|
|
2224
|
-
console.log(
|
|
2426
|
+
console.log(chalk29.gray(`${fix2 ? "Fix" : "Lint"} [All-Packages]`));
|
|
2225
2427
|
const start = Date.now();
|
|
2226
2428
|
const fixOptions = fix2 ? ["--fix"] : [];
|
|
2227
2429
|
const result = runSteps(`${fix2 ? "Fix" : "Lint"} [All-Packages]`, [
|
|
2228
2430
|
["yarn", ["eslint", ...fixOptions]]
|
|
2229
2431
|
]);
|
|
2230
|
-
console.log(
|
|
2432
|
+
console.log(chalk29.gray(`${fix2 ? "Fixed in" : "Linted in"} [${chalk29.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk29.gray("seconds")}`));
|
|
2231
2433
|
return result;
|
|
2232
2434
|
};
|
|
2233
2435
|
|
|
2234
2436
|
// src/actions/retest.ts
|
|
2235
2437
|
var retest = () => {
|
|
2236
2438
|
return runSteps("Test", [
|
|
2237
|
-
["yarn", ["
|
|
2238
|
-
["yarn", ["
|
|
2439
|
+
["yarn", ["vitest", "--clearCache"]],
|
|
2440
|
+
["yarn", ["vitest", "."]]
|
|
2239
2441
|
]);
|
|
2240
2442
|
};
|
|
2241
2443
|
|
|
@@ -2245,10 +2447,10 @@ var sonar = () => {
|
|
|
2245
2447
|
};
|
|
2246
2448
|
|
|
2247
2449
|
// src/actions/statics.ts
|
|
2248
|
-
import
|
|
2450
|
+
import chalk30 from "chalk";
|
|
2249
2451
|
var DefaultDependencies = ["axios", "@xylabs/pixel", "react", "graphql", "react-router", "@mui/material", "@mui/system"];
|
|
2250
2452
|
var statics = () => {
|
|
2251
|
-
console.log(
|
|
2453
|
+
console.log(chalk30.green("Check Required Static Dependencies"));
|
|
2252
2454
|
const statics2 = parsedPackageJSON()?.xy?.deps?.statics;
|
|
2253
2455
|
return detectDuplicateDependencies(statics2, DefaultDependencies);
|
|
2254
2456
|
};
|
|
@@ -2296,558 +2498,696 @@ var yarn3Only = () => {
|
|
|
2296
2498
|
return 0;
|
|
2297
2499
|
};
|
|
2298
2500
|
|
|
2299
|
-
// src/xy/xyBuildCommands.ts
|
|
2300
|
-
var xyBuildCommands = (args) => {
|
|
2301
|
-
return args.command(
|
|
2302
|
-
"build [package]",
|
|
2303
|
-
"Build - Compile & Lint",
|
|
2304
|
-
(yargs2) => {
|
|
2305
|
-
return yargs2.positional("package", { describe: "Specific package to build" });
|
|
2306
|
-
},
|
|
2307
|
-
async (argv) => {
|
|
2308
|
-
if (argv.verbose) {
|
|
2309
|
-
console.log(`Building: ${argv.package ?? "all"}`);
|
|
2310
|
-
}
|
|
2311
|
-
process.exitCode = await build({
|
|
2312
|
-
incremental: !!argv.incremental,
|
|
2313
|
-
jobs: argv.jobs,
|
|
2314
|
-
pkg: argv.package,
|
|
2315
|
-
target: argv.target,
|
|
2316
|
-
verbose: !!argv.verbose
|
|
2317
|
-
});
|
|
2318
|
-
}
|
|
2319
|
-
).command(
|
|
2320
|
-
"compile [package]",
|
|
2321
|
-
"Compile with Typescript & Copy Images",
|
|
2322
|
-
(yargs2) => {
|
|
2323
|
-
return yargs2.positional("package", { describe: "Specific package to compile" });
|
|
2324
|
-
},
|
|
2325
|
-
(argv) => {
|
|
2326
|
-
if (argv.verbose) {
|
|
2327
|
-
console.log(`Compiling: ${argv.package ?? "all"}`);
|
|
2328
|
-
}
|
|
2329
|
-
process.exitCode = compile({
|
|
2330
|
-
incremental: !!argv.incremental,
|
|
2331
|
-
jobs: argv.jobs,
|
|
2332
|
-
pkg: argv.package,
|
|
2333
|
-
target: argv.target,
|
|
2334
|
-
verbose: !!argv.verbose
|
|
2335
|
-
});
|
|
2336
|
-
}
|
|
2337
|
-
).command(
|
|
2338
|
-
"compile-only [package]",
|
|
2339
|
-
"Compile with Typescript & Copy Images (No Publint)",
|
|
2340
|
-
(yargs2) => {
|
|
2341
|
-
return yargs2.positional("package", { describe: "Specific package to compile" });
|
|
2342
|
-
},
|
|
2343
|
-
(argv) => {
|
|
2344
|
-
if (argv.verbose) {
|
|
2345
|
-
console.log(`Compiling: ${argv.package ?? "all"}`);
|
|
2346
|
-
}
|
|
2347
|
-
process.exitCode = compile({
|
|
2348
|
-
incremental: !!argv.incremental,
|
|
2349
|
-
jobs: argv.jobs,
|
|
2350
|
-
pkg: argv.package,
|
|
2351
|
-
publint: false,
|
|
2352
|
-
target: argv.target,
|
|
2353
|
-
verbose: !!argv.verbose
|
|
2354
|
-
});
|
|
2355
|
-
}
|
|
2356
|
-
).command(
|
|
2357
|
-
"recompile [package]",
|
|
2358
|
-
"Re-compile with Typescript & Copy Images",
|
|
2359
|
-
(yargs2) => {
|
|
2360
|
-
return yargs2.positional("package", { describe: "Specific package to re-compile" });
|
|
2361
|
-
},
|
|
2362
|
-
async (argv) => {
|
|
2363
|
-
if (argv.verbose) {
|
|
2364
|
-
console.log(`Re-compiling: ${argv.package ?? "all"}`);
|
|
2365
|
-
}
|
|
2366
|
-
process.exitCode = await recompile({
|
|
2367
|
-
incremental: !!argv.incremental,
|
|
2368
|
-
jobs: argv.jobs,
|
|
2369
|
-
pkg: argv.package,
|
|
2370
|
-
target: argv.target,
|
|
2371
|
-
verbose: !!argv.verbose
|
|
2372
|
-
});
|
|
2373
|
-
}
|
|
2374
|
-
).command(
|
|
2375
|
-
"rebuild [package]",
|
|
2376
|
-
"Rebuild - Clean, Compile & Lint",
|
|
2377
|
-
(yargs2) => {
|
|
2378
|
-
return yargs2.positional("package", { describe: "Specific package to rebuild" });
|
|
2379
|
-
},
|
|
2380
|
-
(argv) => {
|
|
2381
|
-
if (argv.verbose) console.log(`Rebuilding: ${argv.package ?? "all"}`);
|
|
2382
|
-
process.exitCode = rebuild({ target: argv.target });
|
|
2383
|
-
}
|
|
2384
|
-
).command(
|
|
2385
|
-
"copy-assets [package]",
|
|
2386
|
-
"Copy Assets - Copy the assets from src to dist",
|
|
2387
|
-
(yargs2) => {
|
|
2388
|
-
return yargs2.positional("package", { describe: "Specific package to copy assets" });
|
|
2389
|
-
},
|
|
2390
|
-
async (argv) => {
|
|
2391
|
-
if (argv.verbose) console.log(`Copying Assets: ${argv.package ?? "all"}`);
|
|
2392
|
-
process.exitCode = await copyAssets({ target: argv.target });
|
|
2393
|
-
}
|
|
2394
|
-
);
|
|
2395
|
-
};
|
|
2396
|
-
|
|
2397
2501
|
// src/xy/param.ts
|
|
2398
2502
|
var packagePositionalParam = (yargs2) => {
|
|
2399
2503
|
return yargs2.positional("package", { describe: "Specific package to target", type: "string" });
|
|
2400
2504
|
};
|
|
2401
2505
|
|
|
2402
|
-
// src/xy/
|
|
2506
|
+
// src/xy/build-commands/build.ts
|
|
2507
|
+
var buildCommand = {
|
|
2508
|
+
builder: (yargs2) => {
|
|
2509
|
+
return packagePositionalParam(yargs2);
|
|
2510
|
+
},
|
|
2511
|
+
command: "build [package]",
|
|
2512
|
+
describe: "Build - Compile & Lint",
|
|
2513
|
+
handler: async (argv) => {
|
|
2514
|
+
if (argv.verbose) {
|
|
2515
|
+
console.log(`Building: ${argv.package ?? "all"}`);
|
|
2516
|
+
}
|
|
2517
|
+
process.exitCode = await build({
|
|
2518
|
+
incremental: !!argv.incremental,
|
|
2519
|
+
jobs: argv.jobs,
|
|
2520
|
+
pkg: argv.package,
|
|
2521
|
+
target: argv.target,
|
|
2522
|
+
verbose: !!argv.verbose
|
|
2523
|
+
});
|
|
2524
|
+
}
|
|
2525
|
+
};
|
|
2526
|
+
var compileCommand = {
|
|
2527
|
+
builder: (yargs2) => {
|
|
2528
|
+
return packagePositionalParam(yargs2);
|
|
2529
|
+
},
|
|
2530
|
+
command: "compile [package]",
|
|
2531
|
+
describe: "Compile with Typescript & Copy Images",
|
|
2532
|
+
handler: (argv) => {
|
|
2533
|
+
if (argv.verbose) {
|
|
2534
|
+
console.log(`Compiling: ${argv.package ?? "all"}`);
|
|
2535
|
+
}
|
|
2536
|
+
process.exitCode = compile({
|
|
2537
|
+
incremental: !!argv.incremental,
|
|
2538
|
+
jobs: argv.jobs,
|
|
2539
|
+
pkg: argv.package,
|
|
2540
|
+
target: argv.target,
|
|
2541
|
+
verbose: !!argv.verbose
|
|
2542
|
+
});
|
|
2543
|
+
}
|
|
2544
|
+
};
|
|
2545
|
+
var compileOnlyCommand = {
|
|
2546
|
+
builder: (yargs2) => {
|
|
2547
|
+
return packagePositionalParam(yargs2);
|
|
2548
|
+
},
|
|
2549
|
+
command: "compile-only [package]",
|
|
2550
|
+
describe: "Compile with Typescript & Copy Images (No Publint)",
|
|
2551
|
+
handler: (argv) => {
|
|
2552
|
+
if (argv.verbose) {
|
|
2553
|
+
console.log(`Compiling: ${argv.package ?? "all"}`);
|
|
2554
|
+
}
|
|
2555
|
+
process.exitCode = compile({
|
|
2556
|
+
incremental: !!argv.incremental,
|
|
2557
|
+
jobs: argv.jobs,
|
|
2558
|
+
pkg: argv.package,
|
|
2559
|
+
publint: false,
|
|
2560
|
+
target: argv.target,
|
|
2561
|
+
verbose: !!argv.verbose
|
|
2562
|
+
});
|
|
2563
|
+
}
|
|
2564
|
+
};
|
|
2565
|
+
var recompileCommand = {
|
|
2566
|
+
builder: (yargs2) => {
|
|
2567
|
+
return packagePositionalParam(yargs2);
|
|
2568
|
+
},
|
|
2569
|
+
command: "recompile [package]",
|
|
2570
|
+
describe: "Re-compile with Typescript & Copy Images",
|
|
2571
|
+
handler: async (argv) => {
|
|
2572
|
+
if (argv.verbose) {
|
|
2573
|
+
console.log(`Re-compiling: ${argv.package ?? "all"}`);
|
|
2574
|
+
}
|
|
2575
|
+
process.exitCode = await recompile({
|
|
2576
|
+
incremental: !!argv.incremental,
|
|
2577
|
+
jobs: argv.jobs,
|
|
2578
|
+
pkg: argv.package,
|
|
2579
|
+
target: argv.target,
|
|
2580
|
+
verbose: !!argv.verbose
|
|
2581
|
+
});
|
|
2582
|
+
}
|
|
2583
|
+
};
|
|
2584
|
+
var rebuildCommand = {
|
|
2585
|
+
builder: (yargs2) => {
|
|
2586
|
+
return packagePositionalParam(yargs2);
|
|
2587
|
+
},
|
|
2588
|
+
command: "rebuild [package]",
|
|
2589
|
+
describe: "Rebuild - Clean, Compile & Lint",
|
|
2590
|
+
handler: (argv) => {
|
|
2591
|
+
if (argv.verbose) console.log(`Rebuilding: ${argv.package ?? "all"}`);
|
|
2592
|
+
process.exitCode = rebuild({ target: argv.target });
|
|
2593
|
+
}
|
|
2594
|
+
};
|
|
2595
|
+
var copyAssetsCommand = {
|
|
2596
|
+
builder: (yargs2) => {
|
|
2597
|
+
return packagePositionalParam(yargs2);
|
|
2598
|
+
},
|
|
2599
|
+
command: "copy-assets [package]",
|
|
2600
|
+
describe: "Copy Assets - Copy the assets from src to dist",
|
|
2601
|
+
handler: async (argv) => {
|
|
2602
|
+
if (argv.verbose) console.log(`Copying Assets: ${argv.package ?? "all"}`);
|
|
2603
|
+
process.exitCode = await copyAssets({ target: argv.target });
|
|
2604
|
+
}
|
|
2605
|
+
};
|
|
2606
|
+
|
|
2607
|
+
// src/xy/build-commands/index.ts
|
|
2608
|
+
var xyBuildCommands = (args) => {
|
|
2609
|
+
return args.command(buildCommand).command(compileCommand).command(compileOnlyCommand).command(rebuildCommand).command(recompileCommand).command(copyAssetsCommand);
|
|
2610
|
+
};
|
|
2611
|
+
|
|
2612
|
+
// src/xy/common/claude/commandsCommand.ts
|
|
2613
|
+
var commandsCommand = {
|
|
2614
|
+
command: "commands",
|
|
2615
|
+
describe: "Sync XY Labs standard Claude slash commands to .claude/commands/",
|
|
2616
|
+
handler: (argv) => {
|
|
2617
|
+
if (argv.verbose) console.log("Claude Commands");
|
|
2618
|
+
process.exitCode = claudeCommands();
|
|
2619
|
+
}
|
|
2620
|
+
};
|
|
2621
|
+
|
|
2622
|
+
// src/xy/common/claude/initCommand.ts
|
|
2623
|
+
var initCommand = {
|
|
2624
|
+
builder: (yargs2) => {
|
|
2625
|
+
return yargs2.option("force", {
|
|
2626
|
+
alias: "f",
|
|
2627
|
+
default: false,
|
|
2628
|
+
description: "Overwrite existing CLAUDE.md",
|
|
2629
|
+
type: "boolean"
|
|
2630
|
+
});
|
|
2631
|
+
},
|
|
2632
|
+
command: "init",
|
|
2633
|
+
describe: "Initialize all Claude configuration (commands, rules, settings)",
|
|
2634
|
+
handler: async (argv) => {
|
|
2635
|
+
if (argv.verbose) console.log("Claude Init");
|
|
2636
|
+
const commandsResult = claudeCommands();
|
|
2637
|
+
const rulesResult = claudeRules({ force: argv.force });
|
|
2638
|
+
const settingsResult = await claudeSettings();
|
|
2639
|
+
process.exitCode = commandsResult || rulesResult || settingsResult;
|
|
2640
|
+
}
|
|
2641
|
+
};
|
|
2642
|
+
var initClaudeSkillsCommand = {
|
|
2643
|
+
command: "init:skills",
|
|
2644
|
+
describe: "Initialize Claude skills configuration",
|
|
2645
|
+
handler: () => {
|
|
2646
|
+
const result = claudeSkills();
|
|
2647
|
+
process.exitCode = result;
|
|
2648
|
+
}
|
|
2649
|
+
};
|
|
2650
|
+
|
|
2651
|
+
// src/xy/common/claude/rulesCommand.ts
|
|
2652
|
+
var rulesCommand = {
|
|
2653
|
+
builder: (yargs2) => {
|
|
2654
|
+
return yargs2.option("force", {
|
|
2655
|
+
alias: "f",
|
|
2656
|
+
default: false,
|
|
2657
|
+
description: "Overwrite existing CLAUDE.md",
|
|
2658
|
+
type: "boolean"
|
|
2659
|
+
});
|
|
2660
|
+
},
|
|
2661
|
+
command: "rules",
|
|
2662
|
+
describe: "Sync XY Labs standard Claude rules to .claude/rules/",
|
|
2663
|
+
handler: (argv) => {
|
|
2664
|
+
if (argv.verbose) console.log("Claude Rules");
|
|
2665
|
+
process.exitCode = claudeRules({ force: argv.force });
|
|
2666
|
+
}
|
|
2667
|
+
};
|
|
2668
|
+
|
|
2669
|
+
// src/xy/common/claude/settingsCommand.ts
|
|
2670
|
+
var settingsCommand = {
|
|
2671
|
+
command: "settings",
|
|
2672
|
+
describe: "Initialize .claude/settings.local.json with XY Labs defaults",
|
|
2673
|
+
handler: async (argv) => {
|
|
2674
|
+
if (argv.verbose) console.log("Claude Settings");
|
|
2675
|
+
process.exitCode = await claudeSettings();
|
|
2676
|
+
}
|
|
2677
|
+
};
|
|
2678
|
+
|
|
2679
|
+
// src/xy/common/claude/index.ts
|
|
2680
|
+
var claudeCommand = {
|
|
2681
|
+
builder: (yargs2) => {
|
|
2682
|
+
return yargs2.command(commandsCommand).command(initCommand).command(rulesCommand).command(settingsCommand).command(initClaudeSkillsCommand).demandCommand(1, "Please specify a claude subcommand");
|
|
2683
|
+
},
|
|
2684
|
+
command: "claude",
|
|
2685
|
+
describe: "Claude - Claude Code configuration utilities",
|
|
2686
|
+
handler: () => {
|
|
2687
|
+
}
|
|
2688
|
+
};
|
|
2689
|
+
|
|
2690
|
+
// src/xy/common/cleanDocsCommand.ts
|
|
2691
|
+
var cleanDocsCommand = {
|
|
2692
|
+
command: "clean-docs",
|
|
2693
|
+
describe: "CleanDocs - Clean TypeDocs",
|
|
2694
|
+
handler: (argv) => {
|
|
2695
|
+
if (argv.verbose) console.log("Cleaning TypeDocs: all");
|
|
2696
|
+
process.exitCode = cleanDocs();
|
|
2697
|
+
}
|
|
2698
|
+
};
|
|
2699
|
+
|
|
2700
|
+
// src/xy/common/deadCommand.ts
|
|
2701
|
+
var deadCommand = {
|
|
2702
|
+
builder: (yargs2) => {
|
|
2703
|
+
return packagePositionalParam(yargs2);
|
|
2704
|
+
},
|
|
2705
|
+
command: "dead [package]",
|
|
2706
|
+
describe: "Dead - Check for dead code",
|
|
2707
|
+
handler: (argv) => {
|
|
2708
|
+
if (argv.verbose) console.log("Dead");
|
|
2709
|
+
process.exitCode = dead();
|
|
2710
|
+
}
|
|
2711
|
+
};
|
|
2712
|
+
|
|
2713
|
+
// src/xy/common/genDocsCommand.ts
|
|
2714
|
+
var genDocsCommand = {
|
|
2715
|
+
builder: (yargs2) => {
|
|
2716
|
+
return packagePositionalParam(yargs2);
|
|
2717
|
+
},
|
|
2718
|
+
command: "gen-docs [package]",
|
|
2719
|
+
describe: "GenDocs - Generate TypeDocs",
|
|
2720
|
+
handler: (argv) => {
|
|
2721
|
+
if (argv.verbose) console.log(`Generating TypeDocs: ${argv.package ?? "all"}`);
|
|
2722
|
+
process.exitCode = genDocs({ incremental: !!argv.incremental, pkg: argv.package });
|
|
2723
|
+
}
|
|
2724
|
+
};
|
|
2725
|
+
|
|
2726
|
+
// src/xy/common/gitignoreGenCommand.ts
|
|
2727
|
+
var gitignoreGenCommand = {
|
|
2728
|
+
command: "gitignore-gen",
|
|
2729
|
+
describe: "GitIgnore Gen - Generate .gitignore files",
|
|
2730
|
+
handler: (argv) => {
|
|
2731
|
+
if (argv.verbose) console.log("GitIgnore Gen");
|
|
2732
|
+
process.exitCode = gitignoreGen();
|
|
2733
|
+
}
|
|
2734
|
+
};
|
|
2735
|
+
|
|
2736
|
+
// src/xy/common/gitlintCommand.ts
|
|
2737
|
+
var gitlintCommand = {
|
|
2738
|
+
command: "gitlint [package]",
|
|
2739
|
+
describe: "Gitlint - Lint your git config",
|
|
2740
|
+
handler: (argv) => {
|
|
2741
|
+
if (argv.verbose) console.log("Gitlint");
|
|
2742
|
+
process.exitCode = argv.fix ? gitlintFix() : gitlint();
|
|
2743
|
+
}
|
|
2744
|
+
};
|
|
2745
|
+
|
|
2746
|
+
// src/xy/common/licenseCommand.ts
|
|
2747
|
+
var licenseCommand = {
|
|
2748
|
+
builder: (yargs2) => {
|
|
2749
|
+
return packagePositionalParam(yargs2);
|
|
2750
|
+
},
|
|
2751
|
+
command: "license [package]",
|
|
2752
|
+
describe: "License - Check licenses of dependencies",
|
|
2753
|
+
handler: async (argv) => {
|
|
2754
|
+
if (argv.verbose) console.log(`License: ${argv.package ?? "all"}`);
|
|
2755
|
+
process.exitCode = await license();
|
|
2756
|
+
}
|
|
2757
|
+
};
|
|
2758
|
+
|
|
2759
|
+
// src/xy/common/npmignoreGenCommand.ts
|
|
2760
|
+
var npmignoreGenCommand = {
|
|
2761
|
+
command: "npmignore-gen",
|
|
2762
|
+
describe: "NpmIgnore Gen - Generate .npmignore files",
|
|
2763
|
+
handler: (argv) => {
|
|
2764
|
+
if (argv.verbose) console.log("NpmIgnore Gen");
|
|
2765
|
+
process.exitCode = npmignoreGen();
|
|
2766
|
+
}
|
|
2767
|
+
};
|
|
2768
|
+
|
|
2769
|
+
// src/xy/common/readme/genCommand.ts
|
|
2770
|
+
var genCommand = {
|
|
2771
|
+
builder: (yargs2) => {
|
|
2772
|
+
return packagePositionalParam(yargs2).option("template", {
|
|
2773
|
+
alias: "t",
|
|
2774
|
+
description: "Path to README.template.md",
|
|
2775
|
+
type: "string"
|
|
2776
|
+
}).option("typedoc", {
|
|
2777
|
+
default: false,
|
|
2778
|
+
description: "Generate TypeDoc reference sections",
|
|
2779
|
+
type: "boolean"
|
|
2780
|
+
});
|
|
2781
|
+
},
|
|
2782
|
+
aliases: ["$0"],
|
|
2783
|
+
command: "gen [package]",
|
|
2784
|
+
describe: "Generate README.md files from template",
|
|
2785
|
+
handler: async (argv) => {
|
|
2786
|
+
if (argv.verbose) console.log("Readme Gen");
|
|
2787
|
+
process.exitCode = await readmeGen({
|
|
2788
|
+
pkg: argv.package,
|
|
2789
|
+
templatePath: argv.template,
|
|
2790
|
+
typedoc: argv.typedoc,
|
|
2791
|
+
verbose: !!argv.verbose
|
|
2792
|
+
});
|
|
2793
|
+
}
|
|
2794
|
+
};
|
|
2795
|
+
|
|
2796
|
+
// src/xy/common/readme/initCommand.ts
|
|
2797
|
+
var initCommand2 = {
|
|
2798
|
+
builder: (yargs2) => {
|
|
2799
|
+
return yargs2.option("template", {
|
|
2800
|
+
alias: "t",
|
|
2801
|
+
description: "Path to README.template.md",
|
|
2802
|
+
type: "string"
|
|
2803
|
+
});
|
|
2804
|
+
},
|
|
2805
|
+
command: "init",
|
|
2806
|
+
describe: "Initialize README template and logo files",
|
|
2807
|
+
handler: async (argv) => {
|
|
2808
|
+
if (argv.verbose) console.log("Readme Init");
|
|
2809
|
+
process.exitCode = await readmeInit({
|
|
2810
|
+
templatePath: argv.template,
|
|
2811
|
+
verbose: !!argv.verbose
|
|
2812
|
+
});
|
|
2813
|
+
}
|
|
2814
|
+
};
|
|
2815
|
+
|
|
2816
|
+
// src/xy/common/readme/index.ts
|
|
2817
|
+
var readmeCommand = {
|
|
2818
|
+
builder: (yargs2) => {
|
|
2819
|
+
return yargs2.command(genCommand).command(initCommand2);
|
|
2820
|
+
},
|
|
2821
|
+
command: "readme",
|
|
2822
|
+
describe: "Readme - README file utilities",
|
|
2823
|
+
handler: () => {
|
|
2824
|
+
}
|
|
2825
|
+
};
|
|
2826
|
+
|
|
2827
|
+
// src/xy/common/retestCommand.ts
|
|
2828
|
+
var retestCommand = {
|
|
2829
|
+
command: "retest",
|
|
2830
|
+
describe: "Re-Test - Run Jest Tests with cleaned cache",
|
|
2831
|
+
handler: (argv) => {
|
|
2832
|
+
if (argv.verbose) console.log("Re-Testing");
|
|
2833
|
+
process.exitCode = retest();
|
|
2834
|
+
}
|
|
2835
|
+
};
|
|
2836
|
+
|
|
2837
|
+
// src/xy/common/testCommand.ts
|
|
2838
|
+
var testCommand = {
|
|
2839
|
+
command: "test",
|
|
2840
|
+
describe: "Test - Run Jest Tests",
|
|
2841
|
+
handler: (argv) => {
|
|
2842
|
+
if (argv.verbose) console.log("Testing");
|
|
2843
|
+
process.exitCode = test();
|
|
2844
|
+
}
|
|
2845
|
+
};
|
|
2846
|
+
|
|
2847
|
+
// src/xy/common/upplugCommand.ts
|
|
2848
|
+
var upplugCommand = {
|
|
2849
|
+
command: "upplug",
|
|
2850
|
+
describe: "UpPlug - Update Yarn Plugins",
|
|
2851
|
+
handler: (argv) => {
|
|
2852
|
+
if (argv.verbose) console.log("UpPlug");
|
|
2853
|
+
process.exitCode = updateYarnPlugins();
|
|
2854
|
+
}
|
|
2855
|
+
};
|
|
2856
|
+
|
|
2857
|
+
// src/xy/common/upyarnCommand.ts
|
|
2858
|
+
var upyarnCommand = {
|
|
2859
|
+
command: "upyarn",
|
|
2860
|
+
describe: "UpYarn - Update Yarn Version",
|
|
2861
|
+
handler: (argv) => {
|
|
2862
|
+
if (argv.verbose) console.log("UpYarn");
|
|
2863
|
+
process.exitCode = updateYarnVersion();
|
|
2864
|
+
}
|
|
2865
|
+
};
|
|
2866
|
+
|
|
2867
|
+
// src/xy/common/yarn3OnlyCommand.ts
|
|
2868
|
+
var yarn3OnlyCommand = {
|
|
2869
|
+
command: "yarn3only",
|
|
2870
|
+
describe: "Yarn3Only - Check if using Yarn v3",
|
|
2871
|
+
handler: (argv) => {
|
|
2872
|
+
if (argv.verbose) console.log("Yarn 3 Check");
|
|
2873
|
+
process.exitCode = yarn3Only();
|
|
2874
|
+
}
|
|
2875
|
+
};
|
|
2876
|
+
|
|
2877
|
+
// src/xy/common/index.ts
|
|
2403
2878
|
var xyCommonCommands = (args) => {
|
|
2404
|
-
return args.command(
|
|
2405
|
-
"claude-commands",
|
|
2406
|
-
"Claude Commands - Sync XY Labs standard Claude slash commands to .claude/commands/",
|
|
2407
|
-
(yargs2) => yargs2,
|
|
2408
|
-
(argv) => {
|
|
2409
|
-
if (argv.verbose) console.log("Claude Commands");
|
|
2410
|
-
process.exitCode = claudeCommands();
|
|
2411
|
-
}
|
|
2412
|
-
).command(
|
|
2413
|
-
"claude-settings",
|
|
2414
|
-
"Claude Settings - Initialize .claude/settings.local.json with XY Labs defaults",
|
|
2415
|
-
(yargs2) => yargs2,
|
|
2416
|
-
async (argv) => {
|
|
2417
|
-
if (argv.verbose) console.log("Claude Settings");
|
|
2418
|
-
process.exitCode = await claudeSettings();
|
|
2419
|
-
}
|
|
2420
|
-
).command(
|
|
2421
|
-
"claude-rules",
|
|
2422
|
-
"Claude Rules - Sync XY Labs standard Claude rules to .claude/rules/",
|
|
2423
|
-
(yargs2) => {
|
|
2424
|
-
return yargs2.option("force", {
|
|
2425
|
-
alias: "f",
|
|
2426
|
-
default: false,
|
|
2427
|
-
description: "Overwrite existing CLAUDE.md",
|
|
2428
|
-
type: "boolean"
|
|
2429
|
-
});
|
|
2430
|
-
},
|
|
2431
|
-
(argv) => {
|
|
2432
|
-
if (argv.verbose) console.log("Claude Rules");
|
|
2433
|
-
process.exitCode = claudeRules({ force: argv.force });
|
|
2434
|
-
}
|
|
2435
|
-
).command(
|
|
2436
|
-
"license [package]",
|
|
2437
|
-
"License - Check licenses of dependencies",
|
|
2438
|
-
(yargs2) => {
|
|
2439
|
-
return packagePositionalParam(yargs2);
|
|
2440
|
-
},
|
|
2441
|
-
async (argv) => {
|
|
2442
|
-
if (argv.verbose) console.log(`License: ${argv.package ?? "all"}`);
|
|
2443
|
-
process.exitCode = await license();
|
|
2444
|
-
}
|
|
2445
|
-
).command(
|
|
2446
|
-
"dead [package]",
|
|
2447
|
-
"Dead - Check for dead code",
|
|
2448
|
-
(yargs2) => {
|
|
2449
|
-
return packagePositionalParam(yargs2);
|
|
2450
|
-
},
|
|
2451
|
-
(argv) => {
|
|
2452
|
-
if (argv.verbose) console.log("Dead");
|
|
2453
|
-
process.exitCode = dead();
|
|
2454
|
-
}
|
|
2455
|
-
).command(
|
|
2456
|
-
"gen-docs [package]",
|
|
2457
|
-
"GenDocs - Generate TypeDocs",
|
|
2458
|
-
(yargs2) => {
|
|
2459
|
-
return packagePositionalParam(yargs2);
|
|
2460
|
-
},
|
|
2461
|
-
(argv) => {
|
|
2462
|
-
if (argv.verbose) console.log(`Generating TypeDocs: ${argv.package ?? "all"}`);
|
|
2463
|
-
process.exitCode = genDocs({ incremental: !!argv.incremental, pkg: argv.package });
|
|
2464
|
-
}
|
|
2465
|
-
).command(
|
|
2466
|
-
"clean-docs",
|
|
2467
|
-
"CleanDocs - Clean TypeDocs",
|
|
2468
|
-
(yargs2) => yargs2,
|
|
2469
|
-
(argv) => {
|
|
2470
|
-
if (argv.verbose) console.log("Cleaning TypeDocs: all");
|
|
2471
|
-
process.exitCode = cleanDocs();
|
|
2472
|
-
}
|
|
2473
|
-
).command(
|
|
2474
|
-
"gitlint [package]",
|
|
2475
|
-
"Gitlint - Lint your git config",
|
|
2476
|
-
(yargs2) => {
|
|
2477
|
-
return yargs2;
|
|
2478
|
-
},
|
|
2479
|
-
(argv) => {
|
|
2480
|
-
if (argv.verbose) console.log("Gitlint");
|
|
2481
|
-
process.exitCode = argv.fix ? gitlintFix() : gitlint();
|
|
2482
|
-
}
|
|
2483
|
-
).command(
|
|
2484
|
-
"gitignore-gen",
|
|
2485
|
-
"GitIgnore Gen - Generate .gitignore files",
|
|
2486
|
-
(yargs2) => {
|
|
2487
|
-
return yargs2;
|
|
2488
|
-
},
|
|
2489
|
-
(argv) => {
|
|
2490
|
-
if (argv.verbose) console.log("GitIgnore Gen");
|
|
2491
|
-
process.exitCode = gitignoreGen();
|
|
2492
|
-
}
|
|
2493
|
-
).command(
|
|
2494
|
-
"npmignore-gen",
|
|
2495
|
-
"NpmIgnore Gen - Generate .npmignore files",
|
|
2496
|
-
(yargs2) => {
|
|
2497
|
-
return yargs2;
|
|
2498
|
-
},
|
|
2499
|
-
(argv) => {
|
|
2500
|
-
if (argv.verbose) console.log("NpmIgnore Gen");
|
|
2501
|
-
process.exitCode = npmignoreGen();
|
|
2502
|
-
}
|
|
2503
|
-
).command(
|
|
2504
|
-
"readme-gen [package]",
|
|
2505
|
-
"Readme Gen - Generate README.md files from template",
|
|
2506
|
-
(yargs2) => {
|
|
2507
|
-
return packagePositionalParam(yargs2).option("template", {
|
|
2508
|
-
alias: "t",
|
|
2509
|
-
description: "Path to README.template.md",
|
|
2510
|
-
type: "string"
|
|
2511
|
-
}).option("typedoc", {
|
|
2512
|
-
default: false,
|
|
2513
|
-
description: "Generate TypeDoc reference sections",
|
|
2514
|
-
type: "boolean"
|
|
2515
|
-
});
|
|
2516
|
-
},
|
|
2517
|
-
async (argv) => {
|
|
2518
|
-
if (argv.verbose) console.log("Readme Gen");
|
|
2519
|
-
process.exitCode = await readmeGen({
|
|
2520
|
-
pkg: argv.package,
|
|
2521
|
-
templatePath: argv.template,
|
|
2522
|
-
typedoc: argv.typedoc,
|
|
2523
|
-
verbose: !!argv.verbose
|
|
2524
|
-
});
|
|
2525
|
-
}
|
|
2526
|
-
).command(
|
|
2527
|
-
"retest",
|
|
2528
|
-
"Re-Test - Run Jest Tests with cleaned cache",
|
|
2529
|
-
(yargs2) => {
|
|
2530
|
-
return yargs2;
|
|
2531
|
-
},
|
|
2532
|
-
(argv) => {
|
|
2533
|
-
if (argv.verbose) console.log("Re-Testing");
|
|
2534
|
-
process.exitCode = retest();
|
|
2535
|
-
}
|
|
2536
|
-
).command(
|
|
2537
|
-
"test",
|
|
2538
|
-
"Test - Run Jest Tests",
|
|
2539
|
-
(yargs2) => {
|
|
2540
|
-
return yargs2;
|
|
2541
|
-
},
|
|
2542
|
-
(argv) => {
|
|
2543
|
-
if (argv.verbose) console.log("Testing");
|
|
2544
|
-
process.exitCode = test();
|
|
2545
|
-
}
|
|
2546
|
-
).command(
|
|
2547
|
-
"upplug",
|
|
2548
|
-
"UpPlug - Update Yarn Plugins",
|
|
2549
|
-
(yargs2) => {
|
|
2550
|
-
return yargs2;
|
|
2551
|
-
},
|
|
2552
|
-
(argv) => {
|
|
2553
|
-
if (argv.verbose) console.log("UpPlug");
|
|
2554
|
-
process.exitCode = updateYarnPlugins();
|
|
2555
|
-
}
|
|
2556
|
-
).command(
|
|
2557
|
-
"upyarn",
|
|
2558
|
-
"UpYarn - Update Yarn Version",
|
|
2559
|
-
(yargs2) => {
|
|
2560
|
-
return yargs2;
|
|
2561
|
-
},
|
|
2562
|
-
(argv) => {
|
|
2563
|
-
if (argv.verbose) console.log("UpYarn");
|
|
2564
|
-
process.exitCode = updateYarnVersion();
|
|
2565
|
-
}
|
|
2566
|
-
).command(
|
|
2567
|
-
"yarn3only",
|
|
2568
|
-
"Yarn3Only - Check if using Yarn v3",
|
|
2569
|
-
(yargs2) => {
|
|
2570
|
-
return yargs2;
|
|
2571
|
-
},
|
|
2572
|
-
(argv) => {
|
|
2573
|
-
if (argv.verbose) console.log("Yarn 3 Check");
|
|
2574
|
-
process.exitCode = yarn3Only();
|
|
2575
|
-
}
|
|
2576
|
-
);
|
|
2879
|
+
return args.command(claudeCommand).command(licenseCommand).command(deadCommand).command(genDocsCommand).command(cleanDocsCommand).command(gitlintCommand).command(gitignoreGenCommand).command(npmignoreGenCommand).command(readmeCommand).command(retestCommand).command(testCommand).command(upplugCommand).command(upyarnCommand).command(yarn3OnlyCommand);
|
|
2577
2880
|
};
|
|
2578
2881
|
|
|
2579
|
-
// src/xy/
|
|
2882
|
+
// src/xy/deploy/deployCommand.ts
|
|
2883
|
+
var deployCommand = {
|
|
2884
|
+
command: "deploy",
|
|
2885
|
+
describe: "Deploy - Deploy patch",
|
|
2886
|
+
handler: (argv) => {
|
|
2887
|
+
if (argv.verbose) console.log("Deploy patch");
|
|
2888
|
+
process.exitCode = deploy();
|
|
2889
|
+
}
|
|
2890
|
+
};
|
|
2891
|
+
|
|
2892
|
+
// src/xy/deploy/deployMajorCommand.ts
|
|
2893
|
+
var deployMajorCommand = {
|
|
2894
|
+
command: "deploy-major",
|
|
2895
|
+
describe: "Deploy - Deploy major",
|
|
2896
|
+
handler: (argv) => {
|
|
2897
|
+
if (argv.verbose) console.log("Deploy major");
|
|
2898
|
+
process.exitCode = deployMajor();
|
|
2899
|
+
}
|
|
2900
|
+
};
|
|
2901
|
+
|
|
2902
|
+
// src/xy/deploy/deployMinorCommand.ts
|
|
2903
|
+
var deployMinorCommand = {
|
|
2904
|
+
command: "deploy-minor",
|
|
2905
|
+
describe: "Deploy - Deploy minor",
|
|
2906
|
+
handler: (argv) => {
|
|
2907
|
+
if (argv.verbose) console.log("Deploy minor");
|
|
2908
|
+
process.exitCode = deployMinor();
|
|
2909
|
+
}
|
|
2910
|
+
};
|
|
2911
|
+
|
|
2912
|
+
// src/xy/deploy/deployNextCommand.ts
|
|
2913
|
+
var deployNextCommand = {
|
|
2914
|
+
command: "deploy-next",
|
|
2915
|
+
describe: "Deploy - Deploy next",
|
|
2916
|
+
handler: (argv) => {
|
|
2917
|
+
if (argv.verbose) console.log("Deploy next");
|
|
2918
|
+
process.exitCode = deployNext();
|
|
2919
|
+
}
|
|
2920
|
+
};
|
|
2921
|
+
|
|
2922
|
+
// src/xy/deploy/publishCommand.ts
|
|
2923
|
+
var publishCommand = {
|
|
2924
|
+
command: "publish",
|
|
2925
|
+
describe: "Publish - Publish packages to npmjs",
|
|
2926
|
+
handler: (argv) => {
|
|
2927
|
+
if (argv.verbose) console.log("Publish packages to npmjs");
|
|
2928
|
+
process.exitCode = publish();
|
|
2929
|
+
}
|
|
2930
|
+
};
|
|
2931
|
+
|
|
2932
|
+
// src/xy/deploy/index.ts
|
|
2580
2933
|
var xyDeployCommands = (args) => {
|
|
2581
|
-
return args.command(
|
|
2582
|
-
|
|
2583
|
-
|
|
2584
|
-
|
|
2585
|
-
|
|
2586
|
-
|
|
2587
|
-
|
|
2588
|
-
|
|
2589
|
-
|
|
2590
|
-
|
|
2591
|
-
)
|
|
2592
|
-
|
|
2593
|
-
|
|
2594
|
-
(yargs2) => {
|
|
2595
|
-
return yargs2;
|
|
2596
|
-
},
|
|
2597
|
-
(argv) => {
|
|
2598
|
-
if (argv.verbose) console.log("Deploy minor");
|
|
2599
|
-
process.exitCode = deployMinor();
|
|
2600
|
-
}
|
|
2601
|
-
).command(
|
|
2602
|
-
"deploy-major",
|
|
2603
|
-
"Deploy - Deploy major",
|
|
2604
|
-
(yargs2) => {
|
|
2605
|
-
return yargs2;
|
|
2606
|
-
},
|
|
2607
|
-
(argv) => {
|
|
2608
|
-
if (argv.verbose) console.log("Deploy major");
|
|
2609
|
-
process.exitCode = deployMajor();
|
|
2610
|
-
}
|
|
2611
|
-
).command(
|
|
2612
|
-
"deploy-next",
|
|
2613
|
-
"Deploy - Deploy next",
|
|
2614
|
-
(yargs2) => {
|
|
2615
|
-
return yargs2;
|
|
2616
|
-
},
|
|
2617
|
-
(argv) => {
|
|
2618
|
-
if (argv.verbose) console.log("Deploy next");
|
|
2619
|
-
process.exitCode = deployNext();
|
|
2620
|
-
}
|
|
2621
|
-
).command(
|
|
2622
|
-
"publish",
|
|
2623
|
-
"Publish - Publish packages to npmjs",
|
|
2624
|
-
(yargs2) => {
|
|
2625
|
-
return yargs2;
|
|
2626
|
-
},
|
|
2627
|
-
(argv) => {
|
|
2628
|
-
if (argv.verbose) console.log("Publish packages to npmjs");
|
|
2629
|
-
process.exitCode = publish();
|
|
2934
|
+
return args.command(deployCommand).command(deployMinorCommand).command(deployMajorCommand).command(deployNextCommand).command(publishCommand);
|
|
2935
|
+
};
|
|
2936
|
+
|
|
2937
|
+
// src/xy/install/cleanCommand.ts
|
|
2938
|
+
var cleanCommand = {
|
|
2939
|
+
command: "clean [package]",
|
|
2940
|
+
describe: "Clean",
|
|
2941
|
+
builder: (yargs2) => {
|
|
2942
|
+
return yargs2.positional("package", { describe: "Specific package to clean" });
|
|
2943
|
+
},
|
|
2944
|
+
handler: async (argv) => {
|
|
2945
|
+
if (argv.verbose) {
|
|
2946
|
+
console.log(`Cleaning: ${argv.package ?? "all"}`);
|
|
2630
2947
|
}
|
|
2631
|
-
|
|
2948
|
+
process.exitCode = await clean({
|
|
2949
|
+
pkg: argv.package,
|
|
2950
|
+
verbose: !!argv.verbose
|
|
2951
|
+
});
|
|
2952
|
+
}
|
|
2632
2953
|
};
|
|
2633
2954
|
|
|
2634
|
-
// src/xy/
|
|
2955
|
+
// src/xy/install/dupdepsCommand.ts
|
|
2956
|
+
var dupdepsCommand = {
|
|
2957
|
+
command: "dupdeps",
|
|
2958
|
+
describe: "Dupdeps - Duplicate Dependencies in package.json",
|
|
2959
|
+
handler: (argv) => {
|
|
2960
|
+
if (argv.verbose) console.log("Dupdeps");
|
|
2961
|
+
process.exitCode = dupdeps();
|
|
2962
|
+
}
|
|
2963
|
+
};
|
|
2964
|
+
|
|
2965
|
+
// src/xy/install/reinstallCommand.ts
|
|
2966
|
+
var reinstallCommand = {
|
|
2967
|
+
command: "reinstall",
|
|
2968
|
+
describe: "Reinstall - Clean & Install",
|
|
2969
|
+
handler: (argv) => {
|
|
2970
|
+
if (argv.verbose) console.log("Reinstalling");
|
|
2971
|
+
process.exitCode = reinstall();
|
|
2972
|
+
}
|
|
2973
|
+
};
|
|
2974
|
+
|
|
2975
|
+
// src/xy/install/staticsCommand.ts
|
|
2976
|
+
var staticsCommand = {
|
|
2977
|
+
command: "statics",
|
|
2978
|
+
describe: "Statics - Confirming Static Packages",
|
|
2979
|
+
handler: (argv) => {
|
|
2980
|
+
if (argv.verbose) console.log("Statics");
|
|
2981
|
+
process.exitCode = statics();
|
|
2982
|
+
}
|
|
2983
|
+
};
|
|
2984
|
+
|
|
2985
|
+
// src/xy/install/upCommand.ts
|
|
2986
|
+
var upCommand = {
|
|
2987
|
+
command: "up",
|
|
2988
|
+
describe: "Up - Update dependencies",
|
|
2989
|
+
handler: (argv) => {
|
|
2990
|
+
if (argv.verbose) console.log("Up");
|
|
2991
|
+
process.exitCode = up();
|
|
2992
|
+
}
|
|
2993
|
+
};
|
|
2994
|
+
|
|
2995
|
+
// src/xy/install/updoCommand.ts
|
|
2996
|
+
var updoCommand = {
|
|
2997
|
+
command: "updo",
|
|
2998
|
+
describe: "Updo - Update dependencies [Interactive]",
|
|
2999
|
+
handler: (argv) => {
|
|
3000
|
+
if (argv.verbose) console.log("Updo");
|
|
3001
|
+
process.exitCode = updo();
|
|
3002
|
+
}
|
|
3003
|
+
};
|
|
3004
|
+
|
|
3005
|
+
// src/xy/install/index.ts
|
|
2635
3006
|
var xyInstallCommands = (args) => {
|
|
2636
|
-
return args.command(
|
|
2637
|
-
"clean [package]",
|
|
2638
|
-
"Clean",
|
|
2639
|
-
(yargs2) => {
|
|
2640
|
-
return yargs2.positional("package", { describe: "Specific package to clean" });
|
|
2641
|
-
},
|
|
2642
|
-
async (argv) => {
|
|
2643
|
-
if (argv.verbose) {
|
|
2644
|
-
console.log(`Cleaning: ${argv.package ?? "all"}`);
|
|
2645
|
-
}
|
|
2646
|
-
process.exitCode = await clean({
|
|
2647
|
-
pkg: argv.package,
|
|
2648
|
-
verbose: !!argv.verbose
|
|
2649
|
-
});
|
|
2650
|
-
}
|
|
2651
|
-
).command(
|
|
2652
|
-
"reinstall",
|
|
2653
|
-
"Reinstall - Clean & Install",
|
|
2654
|
-
(yargs2) => {
|
|
2655
|
-
return yargs2;
|
|
2656
|
-
},
|
|
2657
|
-
(argv) => {
|
|
2658
|
-
if (argv.verbose) console.log("Reinstalling");
|
|
2659
|
-
process.exitCode = reinstall();
|
|
2660
|
-
}
|
|
2661
|
-
).command(
|
|
2662
|
-
"up",
|
|
2663
|
-
"Up - Update dependencies",
|
|
2664
|
-
(yargs2) => {
|
|
2665
|
-
return yargs2;
|
|
2666
|
-
},
|
|
2667
|
-
(argv) => {
|
|
2668
|
-
if (argv.verbose) console.log("Up");
|
|
2669
|
-
process.exitCode = up();
|
|
2670
|
-
}
|
|
2671
|
-
).command(
|
|
2672
|
-
"updo",
|
|
2673
|
-
"Updo - Update dependencies [Interactive]",
|
|
2674
|
-
(yargs2) => {
|
|
2675
|
-
return yargs2;
|
|
2676
|
-
},
|
|
2677
|
-
(argv) => {
|
|
2678
|
-
if (argv.verbose) console.log("Updo");
|
|
2679
|
-
process.exitCode = updo();
|
|
2680
|
-
}
|
|
2681
|
-
).command(
|
|
2682
|
-
"statics",
|
|
2683
|
-
"Statics - Confirming Static Packages",
|
|
2684
|
-
(yargs2) => {
|
|
2685
|
-
return yargs2;
|
|
2686
|
-
},
|
|
2687
|
-
(argv) => {
|
|
2688
|
-
if (argv.verbose) console.log("Statics");
|
|
2689
|
-
process.exitCode = statics();
|
|
2690
|
-
}
|
|
2691
|
-
).command(
|
|
2692
|
-
"dupdeps",
|
|
2693
|
-
"Dupdeps - Duplicate Dependencies in package.json",
|
|
2694
|
-
(yargs2) => {
|
|
2695
|
-
return yargs2;
|
|
2696
|
-
},
|
|
2697
|
-
(argv) => {
|
|
2698
|
-
if (argv.verbose) console.log("Dupdeps");
|
|
2699
|
-
process.exitCode = dupdeps();
|
|
2700
|
-
}
|
|
2701
|
-
);
|
|
3007
|
+
return args.command(cleanCommand).command(reinstallCommand).command(upCommand).command(updoCommand).command(staticsCommand).command(dupdepsCommand);
|
|
2702
3008
|
};
|
|
2703
3009
|
|
|
2704
|
-
// src/xy/
|
|
2705
|
-
import
|
|
3010
|
+
// src/xy/lint/cycleCommand.ts
|
|
3011
|
+
import chalk31 from "chalk";
|
|
3012
|
+
var cycleCommand = {
|
|
3013
|
+
command: "cycle [package]",
|
|
3014
|
+
describe: "Cycle - Check for dependency cycles",
|
|
3015
|
+
builder: (yargs2) => {
|
|
3016
|
+
return packagePositionalParam(yargs2);
|
|
3017
|
+
},
|
|
3018
|
+
handler: async (argv) => {
|
|
3019
|
+
const start = Date.now();
|
|
3020
|
+
if (argv.verbose) console.log("Cycle");
|
|
3021
|
+
process.exitCode = await cycle({ pkg: argv.package });
|
|
3022
|
+
console.log(chalk31.blue(`Finished in ${Date.now() - start}ms`));
|
|
3023
|
+
}
|
|
3024
|
+
};
|
|
3025
|
+
|
|
3026
|
+
// src/xy/lint/deplintCommand.ts
|
|
3027
|
+
import chalk32 from "chalk";
|
|
3028
|
+
var deplintCommand = {
|
|
3029
|
+
command: "deplint [package]",
|
|
3030
|
+
describe: "Deplint - Run Deplint",
|
|
3031
|
+
builder: (yargs2) => {
|
|
3032
|
+
return packagePositionalParam(yargs2).option("deps", {
|
|
3033
|
+
alias: "d",
|
|
3034
|
+
default: false,
|
|
3035
|
+
description: "Check dependencies",
|
|
3036
|
+
type: "boolean"
|
|
3037
|
+
}).option("devDeps", {
|
|
3038
|
+
alias: "v",
|
|
3039
|
+
default: false,
|
|
3040
|
+
description: "Check devDependencies",
|
|
3041
|
+
type: "boolean"
|
|
3042
|
+
}).option("peerDeps", {
|
|
3043
|
+
alias: "p",
|
|
3044
|
+
default: false,
|
|
3045
|
+
description: "Check peerDependencies",
|
|
3046
|
+
type: "boolean"
|
|
3047
|
+
}).option("exclude", {
|
|
3048
|
+
alias: "e",
|
|
3049
|
+
description: "Package names to exclude from unused checks (comma-separated or repeated)",
|
|
3050
|
+
type: "array"
|
|
3051
|
+
});
|
|
3052
|
+
},
|
|
3053
|
+
handler: async (argv) => {
|
|
3054
|
+
if (argv.verbose) console.log("Deplint");
|
|
3055
|
+
const start = Date.now();
|
|
3056
|
+
const cliExclude = argv.exclude?.flatMap((v) => String(v).split(",")).map((v) => v.trim()).filter(Boolean);
|
|
3057
|
+
process.exitCode = await deplint({
|
|
3058
|
+
cliExclude,
|
|
3059
|
+
pkg: argv.package,
|
|
3060
|
+
deps: !!argv.deps,
|
|
3061
|
+
devDeps: !!argv.devDeps,
|
|
3062
|
+
peerDeps: !!argv.peerDeps,
|
|
3063
|
+
verbose: !!argv.verbose
|
|
3064
|
+
});
|
|
3065
|
+
console.log(chalk32.blue(`Finished in ${Date.now() - start}ms`));
|
|
3066
|
+
}
|
|
3067
|
+
};
|
|
3068
|
+
|
|
3069
|
+
// src/xy/lint/fixCommand.ts
|
|
3070
|
+
import chalk33 from "chalk";
|
|
3071
|
+
var fixCommand = {
|
|
3072
|
+
command: "fix [package]",
|
|
3073
|
+
describe: "Fix - Run Eslint w/fix",
|
|
3074
|
+
builder: (yargs2) => {
|
|
3075
|
+
return packagePositionalParam(yargs2);
|
|
3076
|
+
},
|
|
3077
|
+
handler: (argv) => {
|
|
3078
|
+
const start = Date.now();
|
|
3079
|
+
if (argv.verbose) console.log("Fix");
|
|
3080
|
+
process.exitCode = fix();
|
|
3081
|
+
console.log(chalk33.blue(`Finished in ${Date.now() - start}ms`));
|
|
3082
|
+
}
|
|
3083
|
+
};
|
|
3084
|
+
|
|
3085
|
+
// src/xy/lint/knipCommand.ts
|
|
3086
|
+
import chalk34 from "chalk";
|
|
3087
|
+
var knipCommand = {
|
|
3088
|
+
command: "knip",
|
|
3089
|
+
describe: "Knip - Run Knip",
|
|
3090
|
+
builder: (yargs2) => {
|
|
3091
|
+
return packagePositionalParam(yargs2);
|
|
3092
|
+
},
|
|
3093
|
+
handler: (argv) => {
|
|
3094
|
+
if (argv.verbose) console.log("Knip");
|
|
3095
|
+
const start = Date.now();
|
|
3096
|
+
process.exitCode = knip();
|
|
3097
|
+
console.log(chalk34.blue(`Knip finished in ${Date.now() - start}ms`));
|
|
3098
|
+
}
|
|
3099
|
+
};
|
|
3100
|
+
|
|
3101
|
+
// src/xy/lint/lintCommand.ts
|
|
3102
|
+
import chalk35 from "chalk";
|
|
3103
|
+
var lintCommand = {
|
|
3104
|
+
command: "lint [package]",
|
|
3105
|
+
describe: "Lint - Run Eslint",
|
|
3106
|
+
builder: (yargs2) => {
|
|
3107
|
+
return packagePositionalParam(yargs2).option("fix", {
|
|
3108
|
+
alias: "f",
|
|
3109
|
+
default: false,
|
|
3110
|
+
description: "Fix fixable issues",
|
|
3111
|
+
type: "boolean"
|
|
3112
|
+
}).option("cache", {
|
|
3113
|
+
alias: "c",
|
|
3114
|
+
default: false,
|
|
3115
|
+
description: "Use caching for performance",
|
|
3116
|
+
type: "boolean"
|
|
3117
|
+
});
|
|
3118
|
+
},
|
|
3119
|
+
handler: (argv) => {
|
|
3120
|
+
if (argv.verbose) console.log("Lint");
|
|
3121
|
+
const start = Date.now();
|
|
3122
|
+
process.exitCode = argv.fix ? fix({
|
|
3123
|
+
pkg: argv.package,
|
|
3124
|
+
cache: argv.cache,
|
|
3125
|
+
verbose: !!argv.verbose
|
|
3126
|
+
}) : lint({
|
|
3127
|
+
pkg: argv.package,
|
|
3128
|
+
cache: argv.cache,
|
|
3129
|
+
verbose: !!argv.verbose
|
|
3130
|
+
});
|
|
3131
|
+
console.log(chalk35.blue(`Finished in ${Date.now() - start}ms`));
|
|
3132
|
+
}
|
|
3133
|
+
};
|
|
3134
|
+
|
|
3135
|
+
// src/xy/lint/publintCommand.ts
|
|
3136
|
+
import chalk36 from "chalk";
|
|
3137
|
+
var publintCommand = {
|
|
3138
|
+
command: "publint [package]",
|
|
3139
|
+
describe: "Publint - Run Publint",
|
|
3140
|
+
builder: (yargs2) => {
|
|
3141
|
+
return packagePositionalParam(yargs2);
|
|
3142
|
+
},
|
|
3143
|
+
handler: async (argv) => {
|
|
3144
|
+
if (argv.verbose) console.log("Publint");
|
|
3145
|
+
const start = Date.now();
|
|
3146
|
+
process.exitCode = await publint({ pkg: argv.package, verbose: !!argv.verbose });
|
|
3147
|
+
console.log(chalk36.blue(`Finished in ${Date.now() - start}ms`));
|
|
3148
|
+
}
|
|
3149
|
+
};
|
|
3150
|
+
|
|
3151
|
+
// src/xy/lint/relintCommand.ts
|
|
3152
|
+
import chalk37 from "chalk";
|
|
3153
|
+
var relintCommand = {
|
|
3154
|
+
command: "relint [package]",
|
|
3155
|
+
describe: "Relint - Clean & Lint",
|
|
3156
|
+
builder: (yargs2) => {
|
|
3157
|
+
return packagePositionalParam(yargs2);
|
|
3158
|
+
},
|
|
3159
|
+
handler: (argv) => {
|
|
3160
|
+
if (argv.verbose) console.log("Relinting");
|
|
3161
|
+
const start = Date.now();
|
|
3162
|
+
process.exitCode = relint();
|
|
3163
|
+
console.log(chalk37.blue(`Finished in ${Date.now() - start}ms`));
|
|
3164
|
+
}
|
|
3165
|
+
};
|
|
3166
|
+
|
|
3167
|
+
// src/xy/lint/sonarCommand.ts
|
|
3168
|
+
import chalk38 from "chalk";
|
|
3169
|
+
var sonarCommand = {
|
|
3170
|
+
command: "sonar",
|
|
3171
|
+
describe: "Sonar - Run Sonar Check",
|
|
3172
|
+
builder: (yargs2) => {
|
|
3173
|
+
return packagePositionalParam(yargs2);
|
|
3174
|
+
},
|
|
3175
|
+
handler: (argv) => {
|
|
3176
|
+
const start = Date.now();
|
|
3177
|
+
if (argv.verbose) console.log("Sonar Check");
|
|
3178
|
+
process.exitCode = sonar();
|
|
3179
|
+
console.log(chalk38.blue(`Finished in ${Date.now() - start}ms`));
|
|
3180
|
+
}
|
|
3181
|
+
};
|
|
3182
|
+
|
|
3183
|
+
// src/xy/lint/index.ts
|
|
2706
3184
|
var xyLintCommands = (args) => {
|
|
2707
|
-
return args.command(
|
|
2708
|
-
"cycle [package]",
|
|
2709
|
-
"Cycle - Check for dependency cycles",
|
|
2710
|
-
(yargs2) => {
|
|
2711
|
-
return packagePositionalParam(yargs2);
|
|
2712
|
-
},
|
|
2713
|
-
async (argv) => {
|
|
2714
|
-
const start = Date.now();
|
|
2715
|
-
if (argv.verbose) console.log("Cycle");
|
|
2716
|
-
process.exitCode = await cycle({ pkg: argv.package });
|
|
2717
|
-
console.log(chalk30.blue(`Finished in ${Date.now() - start}ms`));
|
|
2718
|
-
}
|
|
2719
|
-
).command(
|
|
2720
|
-
"lint [package]",
|
|
2721
|
-
"Lint - Run Eslint",
|
|
2722
|
-
(yargs2) => {
|
|
2723
|
-
return packagePositionalParam(yargs2).option("fix", {
|
|
2724
|
-
alias: "f",
|
|
2725
|
-
default: false,
|
|
2726
|
-
description: "Fix fixable issues",
|
|
2727
|
-
type: "boolean"
|
|
2728
|
-
}).option("cache", {
|
|
2729
|
-
alias: "c",
|
|
2730
|
-
default: false,
|
|
2731
|
-
description: "Use caching for performance",
|
|
2732
|
-
type: "boolean"
|
|
2733
|
-
});
|
|
2734
|
-
},
|
|
2735
|
-
(argv) => {
|
|
2736
|
-
if (argv.verbose) console.log("Lint");
|
|
2737
|
-
const start = Date.now();
|
|
2738
|
-
process.exitCode = argv.fix ? fix({
|
|
2739
|
-
pkg: argv.package,
|
|
2740
|
-
cache: argv.cache,
|
|
2741
|
-
verbose: !!argv.verbose
|
|
2742
|
-
}) : lint({
|
|
2743
|
-
pkg: argv.package,
|
|
2744
|
-
cache: argv.cache,
|
|
2745
|
-
verbose: !!argv.verbose
|
|
2746
|
-
});
|
|
2747
|
-
console.log(chalk30.blue(`Finished in ${Date.now() - start}ms`));
|
|
2748
|
-
}
|
|
2749
|
-
).command(
|
|
2750
|
-
"deplint [package]",
|
|
2751
|
-
"Deplint - Run Deplint",
|
|
2752
|
-
(yargs2) => {
|
|
2753
|
-
return packagePositionalParam(yargs2).option("deps", {
|
|
2754
|
-
alias: "d",
|
|
2755
|
-
default: false,
|
|
2756
|
-
description: "Check dependencies",
|
|
2757
|
-
type: "boolean"
|
|
2758
|
-
}).option("devDeps", {
|
|
2759
|
-
alias: "v",
|
|
2760
|
-
default: false,
|
|
2761
|
-
description: "Check devDependencies",
|
|
2762
|
-
type: "boolean"
|
|
2763
|
-
}).option("peerDeps", {
|
|
2764
|
-
alias: "p",
|
|
2765
|
-
default: false,
|
|
2766
|
-
description: "Check peerDependencies",
|
|
2767
|
-
type: "boolean"
|
|
2768
|
-
}).option("exclude", {
|
|
2769
|
-
alias: "e",
|
|
2770
|
-
description: "Package names to exclude from unused checks (comma-separated or repeated)",
|
|
2771
|
-
type: "array"
|
|
2772
|
-
});
|
|
2773
|
-
},
|
|
2774
|
-
async (argv) => {
|
|
2775
|
-
if (argv.verbose) console.log("Deplint");
|
|
2776
|
-
const start = Date.now();
|
|
2777
|
-
const cliExclude = argv.exclude?.flatMap((v) => String(v).split(",")).map((v) => v.trim()).filter(Boolean);
|
|
2778
|
-
process.exitCode = await deplint({
|
|
2779
|
-
cliExclude,
|
|
2780
|
-
pkg: argv.package,
|
|
2781
|
-
deps: !!argv.deps,
|
|
2782
|
-
devDeps: !!argv.devDeps,
|
|
2783
|
-
peerDeps: !!argv.peerDeps,
|
|
2784
|
-
verbose: !!argv.verbose
|
|
2785
|
-
});
|
|
2786
|
-
console.log(chalk30.blue(`Finished in ${Date.now() - start}ms`));
|
|
2787
|
-
}
|
|
2788
|
-
).command(
|
|
2789
|
-
"fix [package]",
|
|
2790
|
-
"Fix - Run Eslint w/fix",
|
|
2791
|
-
(yargs2) => {
|
|
2792
|
-
return packagePositionalParam(yargs2);
|
|
2793
|
-
},
|
|
2794
|
-
(argv) => {
|
|
2795
|
-
const start = Date.now();
|
|
2796
|
-
if (argv.verbose) console.log("Fix");
|
|
2797
|
-
process.exitCode = fix();
|
|
2798
|
-
console.log(chalk30.blue(`Finished in ${Date.now() - start}ms`));
|
|
2799
|
-
}
|
|
2800
|
-
).command(
|
|
2801
|
-
"relint [package]",
|
|
2802
|
-
"Relint - Clean & Lint",
|
|
2803
|
-
(yargs2) => {
|
|
2804
|
-
return packagePositionalParam(yargs2);
|
|
2805
|
-
},
|
|
2806
|
-
(argv) => {
|
|
2807
|
-
if (argv.verbose) console.log("Relinting");
|
|
2808
|
-
const start = Date.now();
|
|
2809
|
-
process.exitCode = relint();
|
|
2810
|
-
console.log(chalk30.blue(`Finished in ${Date.now() - start}ms`));
|
|
2811
|
-
}
|
|
2812
|
-
).command(
|
|
2813
|
-
"publint [package]",
|
|
2814
|
-
"Publint - Run Publint",
|
|
2815
|
-
(yargs2) => {
|
|
2816
|
-
return packagePositionalParam(yargs2);
|
|
2817
|
-
},
|
|
2818
|
-
async (argv) => {
|
|
2819
|
-
if (argv.verbose) console.log("Publint");
|
|
2820
|
-
const start = Date.now();
|
|
2821
|
-
process.exitCode = await publint({ pkg: argv.package, verbose: !!argv.verbose });
|
|
2822
|
-
console.log(chalk30.blue(`Finished in ${Date.now() - start}ms`));
|
|
2823
|
-
}
|
|
2824
|
-
).command(
|
|
2825
|
-
"knip",
|
|
2826
|
-
"Knip - Run Knip",
|
|
2827
|
-
(yargs2) => {
|
|
2828
|
-
return packagePositionalParam(yargs2);
|
|
2829
|
-
},
|
|
2830
|
-
(argv) => {
|
|
2831
|
-
if (argv.verbose) console.log("Knip");
|
|
2832
|
-
const start = Date.now();
|
|
2833
|
-
process.exitCode = knip();
|
|
2834
|
-
console.log(chalk30.blue(`Knip finished in ${Date.now() - start}ms`));
|
|
2835
|
-
}
|
|
2836
|
-
).command(
|
|
2837
|
-
"sonar",
|
|
2838
|
-
"Sonar - Run Sonar Check",
|
|
2839
|
-
(yargs2) => {
|
|
2840
|
-
return packagePositionalParam(yargs2);
|
|
2841
|
-
},
|
|
2842
|
-
(argv) => {
|
|
2843
|
-
const start = Date.now();
|
|
2844
|
-
if (argv.verbose) console.log("Sonar Check");
|
|
2845
|
-
process.exitCode = sonar();
|
|
2846
|
-
console.log(chalk30.blue(`Finished in ${Date.now() - start}ms`));
|
|
2847
|
-
}
|
|
2848
|
-
);
|
|
3185
|
+
return args.command(cycleCommand).command(lintCommand).command(deplintCommand).command(fixCommand).command(relintCommand).command(publintCommand).command(knipCommand).command(sonarCommand);
|
|
2849
3186
|
};
|
|
2850
3187
|
|
|
3188
|
+
// src/xy/xy.ts
|
|
3189
|
+
import chalk39 from "chalk";
|
|
3190
|
+
|
|
2851
3191
|
// src/xy/xyParseOptions.ts
|
|
2852
3192
|
import yargs from "yargs";
|
|
2853
3193
|
import { hideBin } from "yargs/helpers";
|
|
@@ -2879,8 +3219,8 @@ var xyParseOptions = () => {
|
|
|
2879
3219
|
var xy = async () => {
|
|
2880
3220
|
const options = xyParseOptions();
|
|
2881
3221
|
return await xyBuildCommands(xyCommonCommands(xyInstallCommands(xyDeployCommands(xyLintCommands(options))))).demandCommand(1).command("*", "", () => {
|
|
2882
|
-
console.error(
|
|
2883
|
-
console.log(
|
|
3222
|
+
console.error(chalk39.yellow(`Command not found [${chalk39.magenta(process.argv[2])}]`));
|
|
3223
|
+
console.log(chalk39.gray("Try 'yarn xy --help' for list of commands"));
|
|
2884
3224
|
}).version().help().argv;
|
|
2885
3225
|
};
|
|
2886
3226
|
|