@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/index.mjs
CHANGED
|
@@ -15,14 +15,19 @@ var checkResult = (name, result, level = "error", exitOnFail = false) => {
|
|
|
15
15
|
};
|
|
16
16
|
|
|
17
17
|
// src/lib/claudeMdTemplate.ts
|
|
18
|
-
import {
|
|
18
|
+
import {
|
|
19
|
+
readdirSync,
|
|
20
|
+
readFileSync,
|
|
21
|
+
statSync
|
|
22
|
+
} from "fs";
|
|
19
23
|
import { createRequire } from "module";
|
|
20
24
|
import PATH from "path";
|
|
21
25
|
var require2 = createRequire(import.meta.url);
|
|
22
26
|
var packageRoot = PATH.dirname(require2.resolve("@xylabs/ts-scripts-yarn3/package.json"));
|
|
23
|
-
var templatesDir = PATH.resolve(packageRoot, "templates");
|
|
27
|
+
var templatesDir = PATH.resolve(packageRoot, "templates", "claude");
|
|
24
28
|
var XYLABS_RULES_PREFIX = "xylabs-";
|
|
25
29
|
var XYLABS_COMMANDS_PREFIX = "xylabs-";
|
|
30
|
+
var XYLABS_SKILLS_PREFIX = "xylabs-";
|
|
26
31
|
var claudeMdRuleTemplates = () => {
|
|
27
32
|
const rulesDir = PATH.resolve(templatesDir, "rules");
|
|
28
33
|
const files = readdirSync(rulesDir).filter((f) => f.startsWith(XYLABS_RULES_PREFIX) && f.endsWith(".md"));
|
|
@@ -41,6 +46,24 @@ var claudeCommandTemplates = () => {
|
|
|
41
46
|
}
|
|
42
47
|
return result;
|
|
43
48
|
};
|
|
49
|
+
var claudeSkillTemplates = () => {
|
|
50
|
+
const skillsDir = PATH.resolve(templatesDir, "skills");
|
|
51
|
+
const dirs = readdirSync(skillsDir).filter(
|
|
52
|
+
(f) => f.startsWith(XYLABS_SKILLS_PREFIX) && statSync(PATH.resolve(skillsDir, f)).isDirectory()
|
|
53
|
+
);
|
|
54
|
+
const result = {};
|
|
55
|
+
for (const dir of dirs) {
|
|
56
|
+
const dirPath = PATH.resolve(skillsDir, dir);
|
|
57
|
+
const files = readdirSync(dirPath, { recursive: true, encoding: "utf8" });
|
|
58
|
+
result[dir] = {};
|
|
59
|
+
for (const file of files) {
|
|
60
|
+
if (statSync(PATH.resolve(dirPath, file)).isFile()) {
|
|
61
|
+
result[dir][file] = readFileSync(PATH.resolve(dirPath, file), "utf8");
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
return result;
|
|
66
|
+
};
|
|
44
67
|
var claudeMdProjectTemplate = () => readFileSync(PATH.resolve(templatesDir, "CLAUDE-project.md"), "utf8");
|
|
45
68
|
|
|
46
69
|
// src/lib/createBuildConfig.ts
|
|
@@ -381,10 +404,19 @@ var generateIgnoreFiles = (filename3, pkg) => {
|
|
|
381
404
|
|
|
382
405
|
// src/lib/generateReadmeFiles.ts
|
|
383
406
|
import { execSync as execSync2 } from "child_process";
|
|
384
|
-
import FS from "fs";
|
|
385
|
-
import {
|
|
407
|
+
import FS, { readFileSync as readFileSync5 } from "fs";
|
|
408
|
+
import {
|
|
409
|
+
mkdir,
|
|
410
|
+
readFile,
|
|
411
|
+
writeFile
|
|
412
|
+
} from "fs/promises";
|
|
413
|
+
import { createRequire as createRequire2 } from "module";
|
|
386
414
|
import PATH2 from "path";
|
|
415
|
+
import { createInterface } from "readline";
|
|
387
416
|
import chalk5 from "chalk";
|
|
417
|
+
var require3 = createRequire2(import.meta.url);
|
|
418
|
+
var packageRoot2 = PATH2.dirname(require3.resolve("@xylabs/ts-scripts-yarn3/package.json"));
|
|
419
|
+
var readmeTemplatesDir = PATH2.resolve(packageRoot2, "templates", "readme");
|
|
388
420
|
function fillTemplate(template, data) {
|
|
389
421
|
const additionalData = { ...data, safeName: data.name.replaceAll("/", "__").replaceAll("@", "") };
|
|
390
422
|
return template.replaceAll(/\{\{(.*?)\}\}/g, (_, key) => additionalData[key.trim()] ?? "");
|
|
@@ -474,37 +506,120 @@ ${indent}### ${item.name}
|
|
|
474
506
|
}
|
|
475
507
|
return content;
|
|
476
508
|
}
|
|
509
|
+
function askConfirmation(question) {
|
|
510
|
+
const rl = createInterface({ input: process.stdin, output: process.stdout });
|
|
511
|
+
return new Promise((resolve) => {
|
|
512
|
+
rl.question(question, (answer) => {
|
|
513
|
+
rl.close();
|
|
514
|
+
resolve(answer.toLowerCase() === "y" || answer.toLowerCase() === "yes");
|
|
515
|
+
});
|
|
516
|
+
});
|
|
517
|
+
}
|
|
518
|
+
var DEFAULT_README_TEMPLATE = readFileSync5(PATH2.resolve(readmeTemplatesDir, "README.template.md"), "utf8");
|
|
519
|
+
var DEFAULT_README_BODY = readFileSync5(PATH2.resolve(readmeTemplatesDir, "README.body.md"), "utf8");
|
|
520
|
+
function applyLogoConfig(template, logoUrl, logoLinkUrl) {
|
|
521
|
+
let result = template;
|
|
522
|
+
if (logoUrl) {
|
|
523
|
+
result = result.replace(/\[logo]: .+/, `[logo]: ${logoUrl}`);
|
|
524
|
+
if (logoLinkUrl) {
|
|
525
|
+
result = result.replace(/\[!\[logo]\[]][^)]*\)/, `[![logo][]](${logoLinkUrl})`);
|
|
526
|
+
}
|
|
527
|
+
} else {
|
|
528
|
+
result = result.replace(/\[!\[logo]\[]][^\n]*\n*/, "");
|
|
529
|
+
result = result.replace(/\[logo]: [^\n]*\n?/, "");
|
|
530
|
+
}
|
|
531
|
+
return result;
|
|
532
|
+
}
|
|
533
|
+
function resolveTemplatePath(templatePath) {
|
|
534
|
+
const cwd5 = INIT_CWD() ?? ".";
|
|
535
|
+
return templatePath ?? PATH2.join(cwd5, ".xy", "README.template.md");
|
|
536
|
+
}
|
|
537
|
+
async function loadOrCreateTemplate(resolvedTemplatePath) {
|
|
538
|
+
try {
|
|
539
|
+
const template = await readFile(resolvedTemplatePath, "utf8");
|
|
540
|
+
return { created: false, template };
|
|
541
|
+
} catch {
|
|
542
|
+
console.log(chalk5.yellow(`Template not found: ${resolvedTemplatePath}`));
|
|
543
|
+
const shouldCreate = await askConfirmation("Would you like to create a stock template? (y/N) ");
|
|
544
|
+
if (!shouldCreate) {
|
|
545
|
+
throw new Error("Template creation declined");
|
|
546
|
+
}
|
|
547
|
+
const template = DEFAULT_README_TEMPLATE;
|
|
548
|
+
await scaffoldTemplate(resolvedTemplatePath, template);
|
|
549
|
+
return { created: true, template };
|
|
550
|
+
}
|
|
551
|
+
}
|
|
552
|
+
async function scaffoldTemplate(resolvedTemplatePath, template) {
|
|
553
|
+
const xyDir = PATH2.dirname(resolvedTemplatePath);
|
|
554
|
+
await mkdir(xyDir, { recursive: true });
|
|
555
|
+
await writeFile(resolvedTemplatePath, template);
|
|
556
|
+
console.log(chalk5.green(`Created template: ${resolvedTemplatePath}`));
|
|
557
|
+
const bodyPath = PATH2.join(xyDir, "README.body.md");
|
|
558
|
+
await writeFile(bodyPath, DEFAULT_README_BODY);
|
|
559
|
+
console.log(chalk5.green(`Created body template: ${bodyPath}`));
|
|
560
|
+
}
|
|
561
|
+
async function resolveBody(location, defaultBody) {
|
|
562
|
+
const localBodyPath = PATH2.join(location, "README.body.md");
|
|
563
|
+
try {
|
|
564
|
+
return await readFile(localBodyPath, "utf8");
|
|
565
|
+
} catch {
|
|
566
|
+
return defaultBody;
|
|
567
|
+
}
|
|
568
|
+
}
|
|
569
|
+
async function generateReadmeForWorkspace(location, name, template, defaultBody, typedoc, verbose) {
|
|
570
|
+
try {
|
|
571
|
+
const pkgJsonPath = PATH2.join(location, "package.json");
|
|
572
|
+
const pkgJson = JSON.parse(await readFile(pkgJsonPath, "utf8"));
|
|
573
|
+
const body = await resolveBody(location, defaultBody);
|
|
574
|
+
const typedocContent = typedoc ? generateTypedoc(location, ["src/index*.ts"]) : "";
|
|
575
|
+
const readmeContent = fillTemplate(template, {
|
|
576
|
+
...pkgJson,
|
|
577
|
+
body,
|
|
578
|
+
typedoc: typedocContent
|
|
579
|
+
});
|
|
580
|
+
await writeFile(PATH2.join(location, "README.md"), readmeContent);
|
|
581
|
+
if (verbose) console.log(chalk5.green(` ${name}`));
|
|
582
|
+
return true;
|
|
583
|
+
} catch (ex) {
|
|
584
|
+
const error = ex;
|
|
585
|
+
console.warn(chalk5.yellow(` Skipped ${location}: ${error.message}`));
|
|
586
|
+
return false;
|
|
587
|
+
}
|
|
588
|
+
}
|
|
477
589
|
async function generateReadmeFiles({
|
|
590
|
+
logoLinkUrl,
|
|
591
|
+
logoUrl,
|
|
478
592
|
pkg,
|
|
479
593
|
templatePath,
|
|
480
594
|
typedoc = false,
|
|
481
|
-
verbose
|
|
595
|
+
verbose = false
|
|
482
596
|
}) {
|
|
483
597
|
console.log(chalk5.green("Generate README Files"));
|
|
484
|
-
const
|
|
485
|
-
const resolvedTemplatePath = templatePath ?? PATH2.join(cwd5, "scripts", "README.template.md");
|
|
598
|
+
const resolvedTemplatePath = resolveTemplatePath(templatePath);
|
|
486
599
|
let template;
|
|
600
|
+
let templateCreated;
|
|
487
601
|
try {
|
|
488
|
-
template = await
|
|
602
|
+
({ template, created: templateCreated } = await loadOrCreateTemplate(resolvedTemplatePath));
|
|
489
603
|
} catch {
|
|
490
|
-
console.error(chalk5.red(`Template not found: ${resolvedTemplatePath}`));
|
|
491
604
|
return 1;
|
|
492
605
|
}
|
|
493
|
-
|
|
606
|
+
template = applyLogoConfig(template, logoUrl, logoLinkUrl);
|
|
607
|
+
if (templateCreated) {
|
|
608
|
+
console.log(chalk5.green("Generating README files for all packages..."));
|
|
609
|
+
}
|
|
610
|
+
const xyDir = PATH2.dirname(resolvedTemplatePath);
|
|
611
|
+
const xyBodyPath = PATH2.join(xyDir, "README.body.md");
|
|
612
|
+
let defaultBody;
|
|
613
|
+
try {
|
|
614
|
+
defaultBody = await readFile(xyBodyPath, "utf8");
|
|
615
|
+
} catch {
|
|
616
|
+
defaultBody = DEFAULT_README_BODY;
|
|
617
|
+
}
|
|
618
|
+
const workspaces = pkg && !templateCreated ? [yarnWorkspace(pkg)] : yarnWorkspaces();
|
|
494
619
|
let failed = false;
|
|
495
620
|
for (const { location, name } of workspaces) {
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
const pkgJson = JSON.parse(await readFile(pkgJsonPath, "utf8"));
|
|
499
|
-
const typedocContent = typedoc ? generateTypedoc(location, ["src/index*.ts"]) : "";
|
|
500
|
-
const readmeContent = fillTemplate(template, { ...pkgJson, typedoc: typedocContent });
|
|
501
|
-
await writeFile(PATH2.join(location, "README.md"), readmeContent);
|
|
502
|
-
if (verbose) console.log(chalk5.green(` ${name}`));
|
|
503
|
-
} catch (ex) {
|
|
504
|
-
const error = ex;
|
|
505
|
-
console.warn(chalk5.yellow(` Skipped ${location}: ${error.message}`));
|
|
506
|
-
failed = true;
|
|
507
|
-
}
|
|
621
|
+
const success = await generateReadmeForWorkspace(location, name, template, defaultBody, typedoc, verbose);
|
|
622
|
+
if (!success) failed = true;
|
|
508
623
|
}
|
|
509
624
|
return failed ? 1 : 0;
|
|
510
625
|
}
|
|
@@ -531,10 +646,10 @@ var loadConfig = async (params) => {
|
|
|
531
646
|
};
|
|
532
647
|
|
|
533
648
|
// src/lib/parsedPackageJSON.ts
|
|
534
|
-
import { readFileSync as
|
|
649
|
+
import { readFileSync as readFileSync6 } from "fs";
|
|
535
650
|
var parsedPackageJSON = (path14) => {
|
|
536
651
|
const pathToPackageJSON = path14 ?? process.env.npm_package_json ?? "";
|
|
537
|
-
const packageJSON =
|
|
652
|
+
const packageJSON = readFileSync6(pathToPackageJSON).toString();
|
|
538
653
|
return JSON.parse(packageJSON);
|
|
539
654
|
};
|
|
540
655
|
|
|
@@ -667,7 +782,7 @@ import {
|
|
|
667
782
|
existsSync as existsSync5,
|
|
668
783
|
mkdirSync,
|
|
669
784
|
readdirSync as readdirSync2,
|
|
670
|
-
readFileSync as
|
|
785
|
+
readFileSync as readFileSync7,
|
|
671
786
|
unlinkSync,
|
|
672
787
|
writeFileSync as writeFileSync2
|
|
673
788
|
} from "fs";
|
|
@@ -680,7 +795,7 @@ var syncCommandFiles = (commandsDir) => {
|
|
|
680
795
|
let created = 0;
|
|
681
796
|
for (const [filename3, content] of Object.entries(templates)) {
|
|
682
797
|
const targetPath = PATH3.resolve(commandsDir, filename3);
|
|
683
|
-
const existing = existsSync5(targetPath) ?
|
|
798
|
+
const existing = existsSync5(targetPath) ? readFileSync7(targetPath, "utf8") : void 0;
|
|
684
799
|
if (existing === content) continue;
|
|
685
800
|
writeFileSync2(targetPath, content, "utf8");
|
|
686
801
|
if (existing) {
|
|
@@ -737,7 +852,7 @@ import {
|
|
|
737
852
|
existsSync as existsSync6,
|
|
738
853
|
mkdirSync as mkdirSync2,
|
|
739
854
|
readdirSync as readdirSync3,
|
|
740
|
-
readFileSync as
|
|
855
|
+
readFileSync as readFileSync8,
|
|
741
856
|
unlinkSync as unlinkSync2,
|
|
742
857
|
writeFileSync as writeFileSync3
|
|
743
858
|
} from "fs";
|
|
@@ -750,7 +865,7 @@ var syncRuleFiles = (rulesDir) => {
|
|
|
750
865
|
let created = 0;
|
|
751
866
|
for (const [filename3, content] of Object.entries(templates)) {
|
|
752
867
|
const targetPath = PATH4.resolve(rulesDir, filename3);
|
|
753
|
-
const existing = existsSync6(targetPath) ?
|
|
868
|
+
const existing = existsSync6(targetPath) ? readFileSync8(targetPath, "utf8") : void 0;
|
|
754
869
|
if (existing === content) continue;
|
|
755
870
|
writeFileSync3(targetPath, content, "utf8");
|
|
756
871
|
if (existing) {
|
|
@@ -822,7 +937,7 @@ import {
|
|
|
822
937
|
writeFileSync as writeFileSync4
|
|
823
938
|
} from "fs";
|
|
824
939
|
import PATH5 from "path";
|
|
825
|
-
import { createInterface } from "readline";
|
|
940
|
+
import { createInterface as createInterface2 } from "readline";
|
|
826
941
|
import chalk13 from "chalk";
|
|
827
942
|
var DEFAULT_SETTINGS = {
|
|
828
943
|
permissions: {
|
|
@@ -857,8 +972,8 @@ var DEFAULT_SETTINGS = {
|
|
|
857
972
|
]
|
|
858
973
|
}
|
|
859
974
|
};
|
|
860
|
-
function
|
|
861
|
-
const rl =
|
|
975
|
+
function askConfirmation2(question) {
|
|
976
|
+
const rl = createInterface2({ input: process.stdin, output: process.stdout });
|
|
862
977
|
return new Promise((resolve) => {
|
|
863
978
|
rl.question(question, (answer) => {
|
|
864
979
|
rl.close();
|
|
@@ -872,7 +987,7 @@ async function claudeSettings() {
|
|
|
872
987
|
const settingsPath = PATH5.resolve(claudeDir, "settings.local.json");
|
|
873
988
|
mkdirSync3(claudeDir, { recursive: true });
|
|
874
989
|
if (existsSync7(settingsPath)) {
|
|
875
|
-
const confirmed = await
|
|
990
|
+
const confirmed = await askConfirmation2(
|
|
876
991
|
chalk13.yellow(`${settingsPath} already exists. Replace it? (y/N) `)
|
|
877
992
|
);
|
|
878
993
|
if (!confirmed) {
|
|
@@ -886,6 +1001,84 @@ async function claudeSettings() {
|
|
|
886
1001
|
return 0;
|
|
887
1002
|
}
|
|
888
1003
|
|
|
1004
|
+
// src/actions/claude-skills.ts
|
|
1005
|
+
import {
|
|
1006
|
+
existsSync as existsSync8,
|
|
1007
|
+
mkdirSync as mkdirSync4,
|
|
1008
|
+
readdirSync as readdirSync4,
|
|
1009
|
+
readFileSync as readFileSync9,
|
|
1010
|
+
rmSync,
|
|
1011
|
+
statSync as statSync2,
|
|
1012
|
+
writeFileSync as writeFileSync5
|
|
1013
|
+
} from "fs";
|
|
1014
|
+
import PATH6 from "path";
|
|
1015
|
+
import chalk14 from "chalk";
|
|
1016
|
+
var syncSkillFiles = (skillsDir) => {
|
|
1017
|
+
const templates = claudeSkillTemplates();
|
|
1018
|
+
const templateNames = new Set(Object.keys(templates));
|
|
1019
|
+
let updated = 0;
|
|
1020
|
+
let created = 0;
|
|
1021
|
+
for (const [skillName, files] of Object.entries(templates)) {
|
|
1022
|
+
const skillDir = PATH6.resolve(skillsDir, skillName);
|
|
1023
|
+
mkdirSync4(skillDir, { recursive: true });
|
|
1024
|
+
for (const [filename3, content] of Object.entries(files)) {
|
|
1025
|
+
const targetPath = PATH6.resolve(skillDir, filename3);
|
|
1026
|
+
mkdirSync4(PATH6.dirname(targetPath), { recursive: true });
|
|
1027
|
+
const existing = existsSync8(targetPath) ? readFileSync9(targetPath, "utf8") : void 0;
|
|
1028
|
+
if (existing === content) continue;
|
|
1029
|
+
writeFileSync5(targetPath, content, "utf8");
|
|
1030
|
+
if (existing) {
|
|
1031
|
+
updated++;
|
|
1032
|
+
} else {
|
|
1033
|
+
created++;
|
|
1034
|
+
}
|
|
1035
|
+
}
|
|
1036
|
+
}
|
|
1037
|
+
return {
|
|
1038
|
+
created,
|
|
1039
|
+
templateNames,
|
|
1040
|
+
updated
|
|
1041
|
+
};
|
|
1042
|
+
};
|
|
1043
|
+
var removeStaleSkills = (skillsDir, templateNames) => {
|
|
1044
|
+
const existingSkills = readdirSync4(skillsDir).filter(
|
|
1045
|
+
(f) => f.startsWith(XYLABS_SKILLS_PREFIX) && statSync2(PATH6.resolve(skillsDir, f)).isDirectory()
|
|
1046
|
+
);
|
|
1047
|
+
let removed = 0;
|
|
1048
|
+
for (const dir of existingSkills) {
|
|
1049
|
+
if (!templateNames.has(dir)) {
|
|
1050
|
+
rmSync(PATH6.resolve(skillsDir, dir), { recursive: true });
|
|
1051
|
+
removed++;
|
|
1052
|
+
}
|
|
1053
|
+
}
|
|
1054
|
+
return removed;
|
|
1055
|
+
};
|
|
1056
|
+
var logSkillsResult = (created, updated, removed) => {
|
|
1057
|
+
if (created || updated || removed) {
|
|
1058
|
+
const parts = [
|
|
1059
|
+
created ? `${created} created` : "",
|
|
1060
|
+
updated ? `${updated} updated` : "",
|
|
1061
|
+
removed ? `${removed} removed` : ""
|
|
1062
|
+
].filter(Boolean);
|
|
1063
|
+
console.log(chalk14.green(`.claude/skills/${XYLABS_SKILLS_PREFIX}*/: ${parts.join(", ")}`));
|
|
1064
|
+
} else {
|
|
1065
|
+
console.log(chalk14.gray(`.claude/skills/${XYLABS_SKILLS_PREFIX}*/: already up to date`));
|
|
1066
|
+
}
|
|
1067
|
+
};
|
|
1068
|
+
var claudeSkills = () => {
|
|
1069
|
+
const cwd5 = INIT_CWD() ?? process.cwd();
|
|
1070
|
+
const skillsDir = PATH6.resolve(cwd5, ".claude", "skills");
|
|
1071
|
+
mkdirSync4(skillsDir, { recursive: true });
|
|
1072
|
+
const {
|
|
1073
|
+
created,
|
|
1074
|
+
templateNames,
|
|
1075
|
+
updated
|
|
1076
|
+
} = syncSkillFiles(skillsDir);
|
|
1077
|
+
const removed = removeStaleSkills(skillsDir, templateNames);
|
|
1078
|
+
logSkillsResult(created, updated, removed);
|
|
1079
|
+
return 0;
|
|
1080
|
+
};
|
|
1081
|
+
|
|
889
1082
|
// src/actions/clean.ts
|
|
890
1083
|
var clean = async ({ verbose, pkg }) => {
|
|
891
1084
|
return pkg ? await cleanPackage({ pkg, verbose }) : cleanAll({ verbose });
|
|
@@ -900,16 +1093,16 @@ var cleanAll = ({ verbose }) => {
|
|
|
900
1093
|
|
|
901
1094
|
// src/actions/clean-docs.ts
|
|
902
1095
|
import path from "path";
|
|
903
|
-
import
|
|
1096
|
+
import chalk15 from "chalk";
|
|
904
1097
|
var cleanDocs = () => {
|
|
905
1098
|
const pkgName = process.env.npm_package_name;
|
|
906
|
-
console.log(
|
|
1099
|
+
console.log(chalk15.green(`Cleaning Docs [${pkgName}]`));
|
|
907
1100
|
for (const { location } of yarnWorkspaces()) deleteGlob(path.join(location, "docs"));
|
|
908
1101
|
return 0;
|
|
909
1102
|
};
|
|
910
1103
|
|
|
911
1104
|
// src/actions/compile.ts
|
|
912
|
-
import
|
|
1105
|
+
import chalk16 from "chalk";
|
|
913
1106
|
var compile = ({
|
|
914
1107
|
verbose,
|
|
915
1108
|
target,
|
|
@@ -950,7 +1143,7 @@ var compileAll = ({
|
|
|
950
1143
|
const incrementalOptions = incremental ? ["--since", "-Ap", "--topological-dev"] : ["--parallel", "-Ap", "--topological-dev"];
|
|
951
1144
|
const jobsOptions = jobs ? ["-j", `${jobs}`] : [];
|
|
952
1145
|
if (jobs) {
|
|
953
|
-
console.log(
|
|
1146
|
+
console.log(chalk16.blue(`Jobs set to [${jobs}]`));
|
|
954
1147
|
}
|
|
955
1148
|
const result = runSteps(`Compile${incremental ? "-Incremental" : ""} [All]`, [
|
|
956
1149
|
["yarn", [
|
|
@@ -964,13 +1157,13 @@ var compileAll = ({
|
|
|
964
1157
|
...targetOptions
|
|
965
1158
|
]]
|
|
966
1159
|
]);
|
|
967
|
-
console.log(`${
|
|
1160
|
+
console.log(`${chalk16.gray("Compiled in")} [${chalk16.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk16.gray("seconds")}`);
|
|
968
1161
|
return result;
|
|
969
1162
|
};
|
|
970
1163
|
|
|
971
1164
|
// src/actions/copy-assets.ts
|
|
972
1165
|
import path2 from "path/posix";
|
|
973
|
-
import
|
|
1166
|
+
import chalk17 from "chalk";
|
|
974
1167
|
import cpy from "cpy";
|
|
975
1168
|
var copyPackageTargetAssets = async (target, name, location) => {
|
|
976
1169
|
try {
|
|
@@ -993,7 +1186,7 @@ var copyPackageTargetAssets = async (target, name, location) => {
|
|
|
993
1186
|
};
|
|
994
1187
|
var copyTargetAssets = async (target, pkg) => {
|
|
995
1188
|
const workspaces = yarnWorkspaces();
|
|
996
|
-
console.log(
|
|
1189
|
+
console.log(chalk17.green(`Copying Assets [${target.toUpperCase()}]`));
|
|
997
1190
|
const workspaceList = workspaces.filter(({ name }) => {
|
|
998
1191
|
return pkg === void 0 || name === pkg;
|
|
999
1192
|
});
|
|
@@ -1077,7 +1270,7 @@ var dead = () => {
|
|
|
1077
1270
|
};
|
|
1078
1271
|
|
|
1079
1272
|
// src/actions/deplint/deplint.ts
|
|
1080
|
-
import
|
|
1273
|
+
import chalk23 from "chalk";
|
|
1081
1274
|
|
|
1082
1275
|
// src/actions/deplint/findFiles.ts
|
|
1083
1276
|
import fs2 from "fs";
|
|
@@ -1282,7 +1475,7 @@ function getExternalImportsFromFiles({
|
|
|
1282
1475
|
|
|
1283
1476
|
// src/actions/deplint/checkPackage/getUnlistedDependencies.ts
|
|
1284
1477
|
import { builtinModules } from "module";
|
|
1285
|
-
import
|
|
1478
|
+
import chalk18 from "chalk";
|
|
1286
1479
|
function isRuntimeImportListed(imp, name, dependencies, peerDependencies) {
|
|
1287
1480
|
return dependencies.includes(imp) || imp === name || peerDependencies.includes(imp) || builtinModules.includes(imp);
|
|
1288
1481
|
}
|
|
@@ -1290,7 +1483,7 @@ function isTypeImportListed(imp, name, dependencies, devDependencies, peerDepend
|
|
|
1290
1483
|
return dependencies.includes(imp) || imp === name || dependencies.includes(`@types/${imp}`) || peerDependencies.includes(imp) || peerDependencies.includes(`@types/${imp}`) || devDependencies.includes(`@types/${imp}`) || builtinModules.includes(imp);
|
|
1291
1484
|
}
|
|
1292
1485
|
function logMissing(name, imp, importPaths) {
|
|
1293
|
-
console.log(`[${
|
|
1486
|
+
console.log(`[${chalk18.blue(name)}] Missing dependency in package.json: ${chalk18.red(imp)}`);
|
|
1294
1487
|
if (importPaths[imp]) {
|
|
1295
1488
|
console.log(` ${importPaths[imp].join("\n ")}`);
|
|
1296
1489
|
}
|
|
@@ -1319,7 +1512,7 @@ function getUnlistedDependencies({ name, location }, {
|
|
|
1319
1512
|
}
|
|
1320
1513
|
if (unlistedDependencies > 0) {
|
|
1321
1514
|
const packageLocation = `${location}/package.json`;
|
|
1322
|
-
console.log(` ${
|
|
1515
|
+
console.log(` ${chalk18.yellow(packageLocation)}
|
|
1323
1516
|
`);
|
|
1324
1517
|
}
|
|
1325
1518
|
return unlistedDependencies;
|
|
@@ -1327,7 +1520,7 @@ function getUnlistedDependencies({ name, location }, {
|
|
|
1327
1520
|
|
|
1328
1521
|
// src/actions/deplint/checkPackage/getUnlistedDevDependencies.ts
|
|
1329
1522
|
import { builtinModules as builtinModules2 } from "module";
|
|
1330
|
-
import
|
|
1523
|
+
import chalk19 from "chalk";
|
|
1331
1524
|
function getUnlistedDevDependencies({ name, location }, {
|
|
1332
1525
|
devDependencies,
|
|
1333
1526
|
dependencies,
|
|
@@ -1341,7 +1534,7 @@ function getUnlistedDevDependencies({ name, location }, {
|
|
|
1341
1534
|
for (const imp of externalAllImports) {
|
|
1342
1535
|
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)) {
|
|
1343
1536
|
unlistedDevDependencies++;
|
|
1344
|
-
console.log(`[${
|
|
1537
|
+
console.log(`[${chalk19.blue(name)}] Missing devDependency in package.json: ${chalk19.red(imp)}`);
|
|
1345
1538
|
if (allImportPaths[imp]) {
|
|
1346
1539
|
console.log(` ${allImportPaths[imp].join("\n ")}`);
|
|
1347
1540
|
}
|
|
@@ -1349,14 +1542,14 @@ function getUnlistedDevDependencies({ name, location }, {
|
|
|
1349
1542
|
}
|
|
1350
1543
|
if (unlistedDevDependencies > 0) {
|
|
1351
1544
|
const packageLocation = `${location}/package.json`;
|
|
1352
|
-
console.log(` ${
|
|
1545
|
+
console.log(` ${chalk19.yellow(packageLocation)}
|
|
1353
1546
|
`);
|
|
1354
1547
|
}
|
|
1355
1548
|
return unlistedDevDependencies;
|
|
1356
1549
|
}
|
|
1357
1550
|
|
|
1358
1551
|
// src/actions/deplint/checkPackage/getUnusedDependencies.ts
|
|
1359
|
-
import
|
|
1552
|
+
import chalk20 from "chalk";
|
|
1360
1553
|
function getUnusedDependencies({ name, location }, { dependencies }, {
|
|
1361
1554
|
externalDistImports,
|
|
1362
1555
|
externalDistTypeImports,
|
|
@@ -1368,22 +1561,22 @@ function getUnusedDependencies({ name, location }, { dependencies }, {
|
|
|
1368
1561
|
if (!externalDistImports.includes(dep) && !externalDistImports.includes(dep.replace(/^@types\//, "")) && !externalDistTypeImports.includes(dep) && !externalDistTypeImports.includes(dep.replace(/^@types\//, ""))) {
|
|
1369
1562
|
unusedDependencies++;
|
|
1370
1563
|
if (externalAllImports.includes(dep)) {
|
|
1371
|
-
console.log(`[${
|
|
1564
|
+
console.log(`[${chalk20.blue(name)}] dependency should be devDependency in package.json: ${chalk20.red(dep)}`);
|
|
1372
1565
|
} else {
|
|
1373
|
-
console.log(`[${
|
|
1566
|
+
console.log(`[${chalk20.blue(name)}] Unused dependency in package.json: ${chalk20.red(dep)}`);
|
|
1374
1567
|
}
|
|
1375
1568
|
}
|
|
1376
1569
|
}
|
|
1377
1570
|
if (unusedDependencies > 0) {
|
|
1378
1571
|
const packageLocation = `${location}/package.json`;
|
|
1379
|
-
console.log(` ${
|
|
1572
|
+
console.log(` ${chalk20.yellow(packageLocation)}
|
|
1380
1573
|
`);
|
|
1381
1574
|
}
|
|
1382
1575
|
return unusedDependencies;
|
|
1383
1576
|
}
|
|
1384
1577
|
|
|
1385
1578
|
// src/actions/deplint/checkPackage/getUnusedDevDependencies.ts
|
|
1386
|
-
import
|
|
1579
|
+
import chalk21 from "chalk";
|
|
1387
1580
|
|
|
1388
1581
|
// src/actions/deplint/getCliReferencedPackagesFromFiles.ts
|
|
1389
1582
|
import fs8 from "fs";
|
|
@@ -1667,19 +1860,19 @@ function getUnusedDevDependencies({ name, location }, {
|
|
|
1667
1860
|
if (dependencies.includes(dep) || peerDependencies.includes(dep)) continue;
|
|
1668
1861
|
if (!isDevDepUsed(dep, allImports, implicitDeps, requiredPeers, scriptRefs, cliRefs)) {
|
|
1669
1862
|
unusedDevDependencies++;
|
|
1670
|
-
console.log(`[${
|
|
1863
|
+
console.log(`[${chalk21.blue(name)}] Unused devDependency in package.json: ${chalk21.red(dep)}`);
|
|
1671
1864
|
}
|
|
1672
1865
|
}
|
|
1673
1866
|
if (unusedDevDependencies > 0) {
|
|
1674
1867
|
const packageLocation = `${location}/package.json`;
|
|
1675
|
-
console.log(` ${
|
|
1868
|
+
console.log(` ${chalk21.yellow(packageLocation)}
|
|
1676
1869
|
`);
|
|
1677
1870
|
}
|
|
1678
1871
|
return unusedDevDependencies;
|
|
1679
1872
|
}
|
|
1680
1873
|
|
|
1681
1874
|
// src/actions/deplint/checkPackage/getUnusedPeerDependencies.ts
|
|
1682
|
-
import
|
|
1875
|
+
import chalk22 from "chalk";
|
|
1683
1876
|
function getUnusedPeerDependencies({ name, location }, { peerDependencies, dependencies }, { externalDistImports, externalDistTypeImports }, exclude) {
|
|
1684
1877
|
let unusedDependencies = 0;
|
|
1685
1878
|
for (const dep of peerDependencies) {
|
|
@@ -1687,15 +1880,15 @@ function getUnusedPeerDependencies({ name, location }, { peerDependencies, depen
|
|
|
1687
1880
|
if (!externalDistImports.includes(dep) && !externalDistImports.includes(dep.replace(/^@types\//, "")) && !externalDistTypeImports.includes(dep) && !externalDistTypeImports.includes(dep.replace(/^@types\//, ""))) {
|
|
1688
1881
|
unusedDependencies++;
|
|
1689
1882
|
if (dependencies.includes(dep)) {
|
|
1690
|
-
console.log(`[${
|
|
1883
|
+
console.log(`[${chalk22.blue(name)}] Unused peerDependency [already a dependency] in package.json: ${chalk22.red(dep)}`);
|
|
1691
1884
|
} else {
|
|
1692
|
-
console.log(`[${
|
|
1885
|
+
console.log(`[${chalk22.blue(name)}] Unused peerDependency in package.json: ${chalk22.red(dep)}`);
|
|
1693
1886
|
}
|
|
1694
1887
|
}
|
|
1695
1888
|
}
|
|
1696
1889
|
if (unusedDependencies > 0) {
|
|
1697
1890
|
const packageLocation = `${location}/package.json`;
|
|
1698
|
-
console.log(` ${
|
|
1891
|
+
console.log(` ${chalk22.yellow(packageLocation)}
|
|
1699
1892
|
`);
|
|
1700
1893
|
}
|
|
1701
1894
|
return unusedDependencies;
|
|
@@ -1790,19 +1983,19 @@ var deplint = async ({
|
|
|
1790
1983
|
});
|
|
1791
1984
|
}
|
|
1792
1985
|
if (totalErrors > 0) {
|
|
1793
|
-
console.warn(`Deplint: Found ${
|
|
1986
|
+
console.warn(`Deplint: Found ${chalk23.red(totalErrors)} dependency problems. ${chalk23.red("\u2716")}`);
|
|
1794
1987
|
} else {
|
|
1795
|
-
console.info(`Deplint: Found no dependency problems. ${
|
|
1988
|
+
console.info(`Deplint: Found no dependency problems. ${chalk23.green("\u2714")}`);
|
|
1796
1989
|
}
|
|
1797
1990
|
return 0;
|
|
1798
1991
|
};
|
|
1799
1992
|
|
|
1800
1993
|
// src/actions/deploy.ts
|
|
1801
|
-
import { readFileSync as
|
|
1994
|
+
import { readFileSync as readFileSync10 } from "fs";
|
|
1802
1995
|
var privatePackageExcludeList = () => {
|
|
1803
1996
|
const possibleDeployablePackages = yarnWorkspaces().map((workspace) => [
|
|
1804
1997
|
workspace,
|
|
1805
|
-
JSON.parse(
|
|
1998
|
+
JSON.parse(readFileSync10(`${workspace.location}/package.json`, { encoding: "utf8" }))
|
|
1806
1999
|
]);
|
|
1807
2000
|
const privatePackages = possibleDeployablePackages.filter(([_, pkg]) => pkg.private).map(([workspace]) => workspace);
|
|
1808
2001
|
const excludeList = privatePackages.map((workspace) => `--exclude ${workspace.name}`);
|
|
@@ -1822,11 +2015,11 @@ var deploy = () => {
|
|
|
1822
2015
|
};
|
|
1823
2016
|
|
|
1824
2017
|
// src/actions/deploy-major.ts
|
|
1825
|
-
import { readFileSync as
|
|
2018
|
+
import { readFileSync as readFileSync11 } from "fs";
|
|
1826
2019
|
var privatePackageExcludeList2 = () => {
|
|
1827
2020
|
const possibleDeployablePackages = yarnWorkspaces().map((workspace) => [
|
|
1828
2021
|
workspace,
|
|
1829
|
-
JSON.parse(
|
|
2022
|
+
JSON.parse(readFileSync11(`${workspace.location}/package.json`, { encoding: "utf8" }))
|
|
1830
2023
|
]);
|
|
1831
2024
|
const privatePackages = possibleDeployablePackages.filter(([_, pkg]) => pkg.private).map(([workspace]) => workspace);
|
|
1832
2025
|
const excludeList = privatePackages.map((workspace) => `--exclude ${workspace.name}`);
|
|
@@ -1846,11 +2039,11 @@ var deployMajor = () => {
|
|
|
1846
2039
|
};
|
|
1847
2040
|
|
|
1848
2041
|
// src/actions/deploy-minor.ts
|
|
1849
|
-
import { readFileSync as
|
|
2042
|
+
import { readFileSync as readFileSync12 } from "fs";
|
|
1850
2043
|
var privatePackageExcludeList3 = () => {
|
|
1851
2044
|
const possibleDeployablePackages = yarnWorkspaces().map((workspace) => [
|
|
1852
2045
|
workspace,
|
|
1853
|
-
JSON.parse(
|
|
2046
|
+
JSON.parse(readFileSync12(`${workspace.location}/package.json`, { encoding: "utf8" }))
|
|
1854
2047
|
]);
|
|
1855
2048
|
const privatePackages = possibleDeployablePackages.filter(([_, pkg]) => pkg.private).map(([workspace]) => workspace);
|
|
1856
2049
|
const excludeList = privatePackages.map((workspace) => `--exclude ${workspace.name}`);
|
|
@@ -1870,11 +2063,11 @@ var deployMinor = () => {
|
|
|
1870
2063
|
};
|
|
1871
2064
|
|
|
1872
2065
|
// src/actions/deploy-next.ts
|
|
1873
|
-
import { readFileSync as
|
|
2066
|
+
import { readFileSync as readFileSync13 } from "fs";
|
|
1874
2067
|
var privatePackageExcludeList4 = () => {
|
|
1875
2068
|
const possibleDeployablePackages = yarnWorkspaces().map((workspace) => [
|
|
1876
2069
|
workspace,
|
|
1877
|
-
JSON.parse(
|
|
2070
|
+
JSON.parse(readFileSync13(`${workspace.location}/package.json`, { encoding: "utf8" }))
|
|
1878
2071
|
]);
|
|
1879
2072
|
const privatePackages = possibleDeployablePackages.filter(([_, pkg]) => pkg.private).map(([workspace]) => workspace);
|
|
1880
2073
|
const excludeList = privatePackages.map((workspace) => `--exclude ${workspace.name}`);
|
|
@@ -1894,22 +2087,22 @@ var deployNext = () => {
|
|
|
1894
2087
|
};
|
|
1895
2088
|
|
|
1896
2089
|
// src/actions/dupdeps.ts
|
|
1897
|
-
import
|
|
2090
|
+
import chalk24 from "chalk";
|
|
1898
2091
|
var dupdeps = () => {
|
|
1899
|
-
console.log(
|
|
2092
|
+
console.log(chalk24.green("Checking all Dependencies for Duplicates"));
|
|
1900
2093
|
const allDependencies = parsedPackageJSON()?.dependencies;
|
|
1901
2094
|
const dependencies = Object.entries(allDependencies).map(([k]) => k);
|
|
1902
2095
|
return detectDuplicateDependencies(dependencies);
|
|
1903
2096
|
};
|
|
1904
2097
|
|
|
1905
2098
|
// src/actions/lint.ts
|
|
1906
|
-
import
|
|
2099
|
+
import chalk25 from "chalk";
|
|
1907
2100
|
var lintPackage = ({
|
|
1908
2101
|
pkg,
|
|
1909
2102
|
fix: fix2,
|
|
1910
2103
|
verbose
|
|
1911
2104
|
}) => {
|
|
1912
|
-
console.log(
|
|
2105
|
+
console.log(chalk25.gray(`${fix2 ? "Fix" : "Lint"} [${pkg}]`));
|
|
1913
2106
|
const start = Date.now();
|
|
1914
2107
|
const result = runSteps(`${fix2 ? "Fix" : "Lint"} [${pkg}]`, [
|
|
1915
2108
|
["yarn", [
|
|
@@ -1919,7 +2112,7 @@ var lintPackage = ({
|
|
|
1919
2112
|
fix2 ? "package-fix" : verbose ? "package-lint-verbose" : "package-lint"
|
|
1920
2113
|
]]
|
|
1921
2114
|
]);
|
|
1922
|
-
console.log(
|
|
2115
|
+
console.log(chalk25.gray(`${fix2 ? "Fixed in" : "Linted in"} [${chalk25.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk25.gray("seconds")}`));
|
|
1923
2116
|
return result;
|
|
1924
2117
|
};
|
|
1925
2118
|
var lint = ({
|
|
@@ -1939,13 +2132,13 @@ var lint = ({
|
|
|
1939
2132
|
});
|
|
1940
2133
|
};
|
|
1941
2134
|
var lintAllPackages = ({ fix: fix2 = false } = {}) => {
|
|
1942
|
-
console.log(
|
|
2135
|
+
console.log(chalk25.gray(`${fix2 ? "Fix" : "Lint"} [All-Packages]`));
|
|
1943
2136
|
const start = Date.now();
|
|
1944
2137
|
const fixOptions = fix2 ? ["--fix"] : [];
|
|
1945
2138
|
const result = runSteps(`${fix2 ? "Fix" : "Lint"} [All-Packages]`, [
|
|
1946
2139
|
["yarn", ["eslint", "--cache", "--cache-location", ".eslintcache", "--cache-strategy", "content", ...fixOptions]]
|
|
1947
2140
|
]);
|
|
1948
|
-
console.log(
|
|
2141
|
+
console.log(chalk25.gray(`${fix2 ? "Fixed in" : "Linted in"} [${chalk25.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk25.gray("seconds")}`));
|
|
1949
2142
|
return result;
|
|
1950
2143
|
};
|
|
1951
2144
|
|
|
@@ -1973,7 +2166,7 @@ var filename = ".gitignore";
|
|
|
1973
2166
|
var gitignoreGen = (pkg) => generateIgnoreFiles(filename, pkg);
|
|
1974
2167
|
|
|
1975
2168
|
// src/actions/gitlint.ts
|
|
1976
|
-
import
|
|
2169
|
+
import chalk26 from "chalk";
|
|
1977
2170
|
import ParseGitConfig from "parse-git-config";
|
|
1978
2171
|
var gitlint = () => {
|
|
1979
2172
|
console.log(`
|
|
@@ -1984,7 +2177,7 @@ Gitlint Start [${process.cwd()}]
|
|
|
1984
2177
|
const errors = 0;
|
|
1985
2178
|
const gitConfig = ParseGitConfig.sync();
|
|
1986
2179
|
const warn = (message) => {
|
|
1987
|
-
console.warn(
|
|
2180
|
+
console.warn(chalk26.yellow(`Warning: ${message}`));
|
|
1988
2181
|
warnings++;
|
|
1989
2182
|
};
|
|
1990
2183
|
if (gitConfig.core.ignorecase) {
|
|
@@ -2004,13 +2197,13 @@ Gitlint Start [${process.cwd()}]
|
|
|
2004
2197
|
}
|
|
2005
2198
|
const resultMessages = [];
|
|
2006
2199
|
if (valid > 0) {
|
|
2007
|
-
resultMessages.push(
|
|
2200
|
+
resultMessages.push(chalk26.green(`Passed: ${valid}`));
|
|
2008
2201
|
}
|
|
2009
2202
|
if (warnings > 0) {
|
|
2010
|
-
resultMessages.push(
|
|
2203
|
+
resultMessages.push(chalk26.yellow(`Warnings: ${warnings}`));
|
|
2011
2204
|
}
|
|
2012
2205
|
if (errors > 0) {
|
|
2013
|
-
resultMessages.push(
|
|
2206
|
+
resultMessages.push(chalk26.red(` Errors: ${errors}`));
|
|
2014
2207
|
}
|
|
2015
2208
|
console.warn(`Gitlint Finish [ ${resultMessages.join(" | ")} ]
|
|
2016
2209
|
`);
|
|
@@ -2019,7 +2212,7 @@ Gitlint Start [${process.cwd()}]
|
|
|
2019
2212
|
|
|
2020
2213
|
// src/actions/gitlint-fix.ts
|
|
2021
2214
|
import { execSync as execSync3 } from "child_process";
|
|
2022
|
-
import
|
|
2215
|
+
import chalk27 from "chalk";
|
|
2023
2216
|
import ParseGitConfig2 from "parse-git-config";
|
|
2024
2217
|
var gitlintFix = () => {
|
|
2025
2218
|
console.log(`
|
|
@@ -2028,15 +2221,15 @@ Gitlint Fix Start [${process.cwd()}]
|
|
|
2028
2221
|
const gitConfig = ParseGitConfig2.sync();
|
|
2029
2222
|
if (gitConfig.core.ignorecase) {
|
|
2030
2223
|
execSync3("git config core.ignorecase false", { stdio: "inherit" });
|
|
2031
|
-
console.warn(
|
|
2224
|
+
console.warn(chalk27.yellow("\nGitlint Fix: Updated core.ignorecase to be false\n"));
|
|
2032
2225
|
}
|
|
2033
2226
|
if (gitConfig.core.autocrlf !== false) {
|
|
2034
2227
|
execSync3("git config core.autocrlf false", { stdio: "inherit" });
|
|
2035
|
-
console.warn(
|
|
2228
|
+
console.warn(chalk27.yellow("\nGitlint Fix: Updated core.autocrlf to be false\n"));
|
|
2036
2229
|
}
|
|
2037
2230
|
if (gitConfig.core.eol !== "lf") {
|
|
2038
2231
|
execSync3("git config core.eol lf", { stdio: "inherit" });
|
|
2039
|
-
console.warn(
|
|
2232
|
+
console.warn(chalk27.yellow('\nGitlint Fix: Updated core.eol to be "lf"\n'));
|
|
2040
2233
|
}
|
|
2041
2234
|
return 1;
|
|
2042
2235
|
};
|
|
@@ -2047,7 +2240,7 @@ var knip = () => {
|
|
|
2047
2240
|
};
|
|
2048
2241
|
|
|
2049
2242
|
// src/actions/license.ts
|
|
2050
|
-
import
|
|
2243
|
+
import chalk28 from "chalk";
|
|
2051
2244
|
import { init } from "license-checker";
|
|
2052
2245
|
var license = async (pkg) => {
|
|
2053
2246
|
const workspaces = yarnWorkspaces();
|
|
@@ -2072,18 +2265,18 @@ var license = async (pkg) => {
|
|
|
2072
2265
|
"LGPL-3.0-or-later",
|
|
2073
2266
|
"Python-2.0"
|
|
2074
2267
|
]);
|
|
2075
|
-
console.log(
|
|
2268
|
+
console.log(chalk28.green("License Checker"));
|
|
2076
2269
|
return (await Promise.all(
|
|
2077
2270
|
workspaceList.map(({ location, name }) => {
|
|
2078
2271
|
return new Promise((resolve) => {
|
|
2079
2272
|
init({ production: true, start: location }, (error, packages) => {
|
|
2080
2273
|
if (error) {
|
|
2081
|
-
console.error(
|
|
2082
|
-
console.error(
|
|
2274
|
+
console.error(chalk28.red(`License Checker [${name}] Error`));
|
|
2275
|
+
console.error(chalk28.gray(error));
|
|
2083
2276
|
console.log("\n");
|
|
2084
2277
|
resolve(1);
|
|
2085
2278
|
} else {
|
|
2086
|
-
console.log(
|
|
2279
|
+
console.log(chalk28.green(`License Checker [${name}]`));
|
|
2087
2280
|
let count = 0;
|
|
2088
2281
|
for (const [name2, info] of Object.entries(packages)) {
|
|
2089
2282
|
const licenses = Array.isArray(info.licenses) ? info.licenses : [info.licenses];
|
|
@@ -2099,7 +2292,7 @@ var license = async (pkg) => {
|
|
|
2099
2292
|
}
|
|
2100
2293
|
if (!orLicenseFound) {
|
|
2101
2294
|
count++;
|
|
2102
|
-
console.warn(
|
|
2295
|
+
console.warn(chalk28.yellow(`${name2}: Package License not allowed [${license2}]`));
|
|
2103
2296
|
}
|
|
2104
2297
|
}
|
|
2105
2298
|
}
|
|
@@ -2119,12 +2312,12 @@ var npmignoreGen = (pkg) => generateIgnoreFiles(filename2, pkg);
|
|
|
2119
2312
|
|
|
2120
2313
|
// src/actions/package/clean-outputs.ts
|
|
2121
2314
|
import path8 from "path";
|
|
2122
|
-
import
|
|
2315
|
+
import chalk29 from "chalk";
|
|
2123
2316
|
var packageCleanOutputs = () => {
|
|
2124
2317
|
const pkg = process.env.INIT_CWD ?? ".";
|
|
2125
2318
|
const pkgName = process.env.npm_package_name;
|
|
2126
2319
|
const folders = [path8.join(pkg, "dist"), path8.join(pkg, "build"), path8.join(pkg, "docs")];
|
|
2127
|
-
console.log(
|
|
2320
|
+
console.log(chalk29.green(`Cleaning Outputs [${pkgName}]`));
|
|
2128
2321
|
for (let folder of folders) {
|
|
2129
2322
|
deleteGlob(folder);
|
|
2130
2323
|
}
|
|
@@ -2133,11 +2326,11 @@ var packageCleanOutputs = () => {
|
|
|
2133
2326
|
|
|
2134
2327
|
// src/actions/package/clean-typescript.ts
|
|
2135
2328
|
import path9 from "path";
|
|
2136
|
-
import
|
|
2329
|
+
import chalk30 from "chalk";
|
|
2137
2330
|
var packageCleanTypescript = () => {
|
|
2138
2331
|
const pkg = process.env.INIT_CWD ?? ".";
|
|
2139
2332
|
const pkgName = process.env.npm_package_name;
|
|
2140
|
-
console.log(
|
|
2333
|
+
console.log(chalk30.green(`Cleaning Typescript [${pkgName}]`));
|
|
2141
2334
|
const files = [path9.join(pkg, "*.tsbuildinfo"), path9.join(pkg, ".tsconfig.*"), path9.join(pkg, ".eslintcache")];
|
|
2142
2335
|
for (let file of files) {
|
|
2143
2336
|
deleteGlob(file);
|
|
@@ -2151,26 +2344,26 @@ var packageClean = async () => {
|
|
|
2151
2344
|
};
|
|
2152
2345
|
|
|
2153
2346
|
// src/actions/package/compile/compile.ts
|
|
2154
|
-
import
|
|
2347
|
+
import chalk35 from "chalk";
|
|
2155
2348
|
|
|
2156
2349
|
// src/actions/package/compile/packageCompileTsup.ts
|
|
2157
|
-
import
|
|
2350
|
+
import chalk34 from "chalk";
|
|
2158
2351
|
import { build as build2, defineConfig } from "tsup";
|
|
2159
2352
|
|
|
2160
2353
|
// src/actions/package/compile/inputs.ts
|
|
2161
|
-
import
|
|
2354
|
+
import chalk31 from "chalk";
|
|
2162
2355
|
import { glob as glob2 } from "glob";
|
|
2163
2356
|
var getAllInputs = (srcDir, verbose = false) => {
|
|
2164
2357
|
return [...glob2.sync(`${srcDir}/**/*.ts`, { posix: true }).map((file) => {
|
|
2165
2358
|
const result = file.slice(Math.max(0, srcDir.length + 1));
|
|
2166
2359
|
if (verbose) {
|
|
2167
|
-
console.log(
|
|
2360
|
+
console.log(chalk31.gray(`getAllInputs: ${JSON.stringify(result, null, 2)}`));
|
|
2168
2361
|
}
|
|
2169
2362
|
return result;
|
|
2170
2363
|
}), ...glob2.sync(`${srcDir}/**/*.tsx`, { posix: true }).map((file) => {
|
|
2171
2364
|
const result = file.slice(Math.max(0, srcDir.length + 1));
|
|
2172
2365
|
if (verbose) {
|
|
2173
|
-
console.log(
|
|
2366
|
+
console.log(chalk31.gray(`getAllInputs: ${JSON.stringify(result, null, 2)}`));
|
|
2174
2367
|
}
|
|
2175
2368
|
return result;
|
|
2176
2369
|
})];
|
|
@@ -2232,7 +2425,7 @@ function deepMergeObjects(objects) {
|
|
|
2232
2425
|
|
|
2233
2426
|
// src/actions/package/compile/packageCompileTsc.ts
|
|
2234
2427
|
import { cwd as cwd2 } from "process";
|
|
2235
|
-
import
|
|
2428
|
+
import chalk32 from "chalk";
|
|
2236
2429
|
import { createProgramFromConfig } from "tsc-prog";
|
|
2237
2430
|
import ts3, {
|
|
2238
2431
|
DiagnosticCategory,
|
|
@@ -2254,7 +2447,7 @@ var getCompilerOptions = (options = {}, fileName = "tsconfig.json") => {
|
|
|
2254
2447
|
var packageCompileTsc = (platform, entries, srcDir = "src", outDir = "dist", compilerOptionsParam, verbose = false) => {
|
|
2255
2448
|
const pkg = process.env.INIT_CWD ?? cwd2();
|
|
2256
2449
|
if (verbose) {
|
|
2257
|
-
console.log(
|
|
2450
|
+
console.log(chalk32.cyan(`Validating code START: ${entries.length} files to ${outDir} from ${srcDir}`));
|
|
2258
2451
|
}
|
|
2259
2452
|
const configFilePath = ts3.findConfigFile(
|
|
2260
2453
|
"./",
|
|
@@ -2277,10 +2470,10 @@ var packageCompileTsc = (platform, entries, srcDir = "src", outDir = "dist", com
|
|
|
2277
2470
|
emitDeclarationOnly: true,
|
|
2278
2471
|
noEmit: false
|
|
2279
2472
|
};
|
|
2280
|
-
console.log(
|
|
2473
|
+
console.log(chalk32.cyan(`Validating Files: ${entries.length}`));
|
|
2281
2474
|
if (verbose) {
|
|
2282
2475
|
for (const entry of entries) {
|
|
2283
|
-
console.log(
|
|
2476
|
+
console.log(chalk32.grey(`Validating: ${entry}`));
|
|
2284
2477
|
}
|
|
2285
2478
|
}
|
|
2286
2479
|
try {
|
|
@@ -2316,7 +2509,7 @@ var packageCompileTsc = (platform, entries, srcDir = "src", outDir = "dist", com
|
|
|
2316
2509
|
return 0;
|
|
2317
2510
|
} finally {
|
|
2318
2511
|
if (verbose) {
|
|
2319
|
-
console.log(
|
|
2512
|
+
console.log(chalk32.cyan(`Validating code FINISH: ${entries.length} files to ${outDir} from ${srcDir}`));
|
|
2320
2513
|
}
|
|
2321
2514
|
}
|
|
2322
2515
|
};
|
|
@@ -2324,7 +2517,7 @@ var packageCompileTsc = (platform, entries, srcDir = "src", outDir = "dist", com
|
|
|
2324
2517
|
// src/actions/package/compile/packageCompileTscTypes.ts
|
|
2325
2518
|
import path10 from "path";
|
|
2326
2519
|
import { cwd as cwd3 } from "process";
|
|
2327
|
-
import
|
|
2520
|
+
import chalk33 from "chalk";
|
|
2328
2521
|
import { rollup } from "rollup";
|
|
2329
2522
|
import dts from "rollup-plugin-dts";
|
|
2330
2523
|
import nodeExternals from "rollup-plugin-node-externals";
|
|
@@ -2349,8 +2542,8 @@ async function bundleDts(inputPath, outputPath, platform, options, verbose = fal
|
|
|
2349
2542
|
if (ignoredWarningCodes.has(warning.code ?? "")) {
|
|
2350
2543
|
return;
|
|
2351
2544
|
}
|
|
2352
|
-
console.warn(
|
|
2353
|
-
console.warn(
|
|
2545
|
+
console.warn(chalk33.yellow(`[${warning.code}] ${warning.message}`));
|
|
2546
|
+
console.warn(chalk33.gray(inputPath));
|
|
2354
2547
|
warn(warning);
|
|
2355
2548
|
}
|
|
2356
2549
|
});
|
|
@@ -2360,8 +2553,8 @@ async function bundleDts(inputPath, outputPath, platform, options, verbose = fal
|
|
|
2360
2553
|
});
|
|
2361
2554
|
} catch (ex) {
|
|
2362
2555
|
const error = ex;
|
|
2363
|
-
console.warn(
|
|
2364
|
-
console.warn(
|
|
2556
|
+
console.warn(chalk33.red(error));
|
|
2557
|
+
console.warn(chalk33.gray(inputPath));
|
|
2365
2558
|
}
|
|
2366
2559
|
if (verbose) {
|
|
2367
2560
|
console.log(`Bundled declarations written to ${outputPath}`);
|
|
@@ -2369,7 +2562,7 @@ async function bundleDts(inputPath, outputPath, platform, options, verbose = fal
|
|
|
2369
2562
|
}
|
|
2370
2563
|
var packageCompileTscTypes = async (entries, outDir, platform, srcDir = "build", verbose = false) => {
|
|
2371
2564
|
if (verbose) {
|
|
2372
|
-
console.log(
|
|
2565
|
+
console.log(chalk33.cyan(`Compiling Types START [${platform}]: ${entries.length} files to ${outDir} from ${srcDir}`));
|
|
2373
2566
|
console.log(`Entries: ${entries.join(", ")}`);
|
|
2374
2567
|
}
|
|
2375
2568
|
const pkg = process.env.INIT_CWD ?? cwd3();
|
|
@@ -2393,7 +2586,7 @@ var packageCompileTscTypes = async (entries, outDir, platform, srcDir = "build",
|
|
|
2393
2586
|
await bundleDts(`${srcRoot}/${entryTypeName}`, `${outDir}/${entryTypeName}`, platform, { compilerOptions }, verbose);
|
|
2394
2587
|
}));
|
|
2395
2588
|
if (verbose) {
|
|
2396
|
-
console.log(
|
|
2589
|
+
console.log(chalk33.cyan(`Compiling Types FINISH: ${entries.length} files to ${outDir} from ${srcDir}`));
|
|
2397
2590
|
}
|
|
2398
2591
|
return 0;
|
|
2399
2592
|
};
|
|
@@ -2405,15 +2598,15 @@ var compileFolder = async (srcDir, entries, buildDir, options, bundleTypes = fal
|
|
|
2405
2598
|
console.log(`compileFolder [${srcDir}, ${options?.outDir}]`);
|
|
2406
2599
|
}
|
|
2407
2600
|
if (entries.length === 0) {
|
|
2408
|
-
console.warn(
|
|
2601
|
+
console.warn(chalk34.yellow(`No entries found in ${srcDir} to compile`));
|
|
2409
2602
|
return 0;
|
|
2410
2603
|
}
|
|
2411
2604
|
if (verbose) {
|
|
2412
|
-
console.log(
|
|
2605
|
+
console.log(chalk34.gray(`buildDir [${buildDir}]`));
|
|
2413
2606
|
}
|
|
2414
2607
|
const validationResult = packageCompileTsc(options?.platform ?? "neutral", entries, srcDir, buildDir, void 0, verbose);
|
|
2415
2608
|
if (validationResult !== 0) {
|
|
2416
|
-
console.error(
|
|
2609
|
+
console.error(chalk34.red(`Compile:Validation had ${validationResult} errors`));
|
|
2417
2610
|
return validationResult;
|
|
2418
2611
|
}
|
|
2419
2612
|
const optionsParams = tsupOptions([{
|
|
@@ -2438,12 +2631,12 @@ var compileFolder = async (srcDir, entries, buildDir, options, bundleTypes = fal
|
|
|
2438
2631
|
})
|
|
2439
2632
|
)).flat();
|
|
2440
2633
|
if (verbose) {
|
|
2441
|
-
console.log(
|
|
2442
|
-
console.log(
|
|
2634
|
+
console.log(chalk34.cyan(`TSUP:build:start [${srcDir}]`));
|
|
2635
|
+
console.log(chalk34.gray(`TSUP:build:options [${JSON.stringify(optionsList, null, 2)}]`));
|
|
2443
2636
|
}
|
|
2444
2637
|
await Promise.all(optionsList.map((options2) => build2(options2)));
|
|
2445
2638
|
if (verbose) {
|
|
2446
|
-
console.log(
|
|
2639
|
+
console.log(chalk34.cyan(`TSUP:build:stop [${srcDir}]`));
|
|
2447
2640
|
}
|
|
2448
2641
|
if (bundleTypes) {
|
|
2449
2642
|
await packageCompileTscTypes(entries, outDir, options?.platform ?? "neutral", buildDir, verbose);
|
|
@@ -2554,14 +2747,14 @@ var packageCompileTsup = async (config2) => {
|
|
|
2554
2747
|
// src/actions/package/compile/compile.ts
|
|
2555
2748
|
var packageCompile = async (inConfig = {}) => {
|
|
2556
2749
|
const pkg = process.env.INIT_CWD;
|
|
2557
|
-
console.log(
|
|
2750
|
+
console.log(chalk35.green(`Compiling ${pkg}`));
|
|
2558
2751
|
const config2 = await loadConfig(inConfig);
|
|
2559
2752
|
return await packageCompileTsup(config2);
|
|
2560
2753
|
};
|
|
2561
2754
|
|
|
2562
2755
|
// src/actions/package/copy-assets.ts
|
|
2563
2756
|
import path11 from "path/posix";
|
|
2564
|
-
import
|
|
2757
|
+
import chalk36 from "chalk";
|
|
2565
2758
|
import cpy2 from "cpy";
|
|
2566
2759
|
var copyTargetAssets2 = async (target, name, location) => {
|
|
2567
2760
|
try {
|
|
@@ -2574,7 +2767,7 @@ var copyTargetAssets2 = async (target, name, location) => {
|
|
|
2574
2767
|
}
|
|
2575
2768
|
);
|
|
2576
2769
|
if (values.length > 0) {
|
|
2577
|
-
console.log(
|
|
2770
|
+
console.log(chalk36.green(`Copying Assets [${target.toUpperCase()}] - ${name} - ${location}`));
|
|
2578
2771
|
}
|
|
2579
2772
|
for (const value of values) {
|
|
2580
2773
|
console.log(`${value.split("/").pop()} => ./dist/${target}`);
|
|
@@ -2639,9 +2832,9 @@ var packageCycle = async () => {
|
|
|
2639
2832
|
};
|
|
2640
2833
|
|
|
2641
2834
|
// src/actions/package/gen-docs.ts
|
|
2642
|
-
import { existsSync as
|
|
2835
|
+
import { existsSync as existsSync9 } from "fs";
|
|
2643
2836
|
import path12 from "path";
|
|
2644
|
-
import
|
|
2837
|
+
import chalk37 from "chalk";
|
|
2645
2838
|
import {
|
|
2646
2839
|
Application,
|
|
2647
2840
|
ArgumentsReader,
|
|
@@ -2659,7 +2852,7 @@ var ExitCodes = {
|
|
|
2659
2852
|
};
|
|
2660
2853
|
var packageGenDocs = async () => {
|
|
2661
2854
|
const pkg = process.env.INIT_CWD;
|
|
2662
|
-
if (pkg !== void 0 && !
|
|
2855
|
+
if (pkg !== void 0 && !existsSync9(path12.join(pkg, "typedoc.json"))) {
|
|
2663
2856
|
return;
|
|
2664
2857
|
}
|
|
2665
2858
|
const app = await Application.bootstrap({
|
|
@@ -2745,16 +2938,16 @@ var runTypeDoc = async (app) => {
|
|
|
2745
2938
|
return ExitCodes.OutputError;
|
|
2746
2939
|
}
|
|
2747
2940
|
}
|
|
2748
|
-
console.log(
|
|
2941
|
+
console.log(chalk37.green(`${pkgName} - Ok`));
|
|
2749
2942
|
return ExitCodes.Ok;
|
|
2750
2943
|
};
|
|
2751
2944
|
|
|
2752
2945
|
// src/actions/package/lint.ts
|
|
2753
|
-
import { readdirSync as
|
|
2946
|
+
import { readdirSync as readdirSync5 } from "fs";
|
|
2754
2947
|
import path13 from "path";
|
|
2755
2948
|
import { cwd as cwd4 } from "process";
|
|
2756
2949
|
import { pathToFileURL } from "url";
|
|
2757
|
-
import
|
|
2950
|
+
import chalk38 from "chalk";
|
|
2758
2951
|
import { ESLint } from "eslint";
|
|
2759
2952
|
import { findUp } from "find-up";
|
|
2760
2953
|
import picomatch from "picomatch";
|
|
@@ -2763,14 +2956,14 @@ var dumpMessages = (lintResults) => {
|
|
|
2763
2956
|
const severity = ["none", "warning", "error"];
|
|
2764
2957
|
for (const lintResult of lintResults) {
|
|
2765
2958
|
if (lintResult.messages.length > 0) {
|
|
2766
|
-
console.log(
|
|
2959
|
+
console.log(chalk38.gray(`
|
|
2767
2960
|
${lintResult.filePath}`));
|
|
2768
2961
|
for (const message of lintResult.messages) {
|
|
2769
2962
|
console.log(
|
|
2770
|
-
|
|
2771
|
-
|
|
2772
|
-
|
|
2773
|
-
|
|
2963
|
+
chalk38.gray(` ${message.line}:${message.column}`),
|
|
2964
|
+
chalk38[colors[message.severity]](` ${severity[message.severity]}`),
|
|
2965
|
+
chalk38.white(` ${message.message}`),
|
|
2966
|
+
chalk38.gray(` ${message.ruleId}`)
|
|
2774
2967
|
);
|
|
2775
2968
|
}
|
|
2776
2969
|
}
|
|
@@ -2787,7 +2980,7 @@ function getFiles(dir, ignoreFolders) {
|
|
|
2787
2980
|
const currentDirectory = cwd4();
|
|
2788
2981
|
const subDirectory = dir.split(currentDirectory)[1]?.split("/")[1];
|
|
2789
2982
|
if (ignoreFolders.includes(subDirectory)) return [];
|
|
2790
|
-
return
|
|
2983
|
+
return readdirSync5(dir, { withFileTypes: true }).flatMap((dirent) => {
|
|
2791
2984
|
const res = path13.resolve(dir, dirent.name);
|
|
2792
2985
|
const relativePath = subDirectory === void 0 ? dirent.name : `${subDirectory}/${dirent.name}`;
|
|
2793
2986
|
const ignoreMatchers = ignoreFolders.map((pattern) => picomatch(pattern));
|
|
@@ -2808,10 +3001,10 @@ var packageLint = async (fix2 = false, verbose = false, cache = true) => {
|
|
|
2808
3001
|
cache
|
|
2809
3002
|
});
|
|
2810
3003
|
const files = getFiles(cwd4(), ignoreFolders);
|
|
2811
|
-
console.log(
|
|
3004
|
+
console.log(chalk38.green(`Linting ${pkg} [files = ${files.length}]`));
|
|
2812
3005
|
if (verbose) {
|
|
2813
3006
|
for (const file of files) {
|
|
2814
|
-
console.log(
|
|
3007
|
+
console.log(chalk38.gray(` ${file}`));
|
|
2815
3008
|
}
|
|
2816
3009
|
}
|
|
2817
3010
|
const lintResults = await engine.lintFiles(files);
|
|
@@ -2822,32 +3015,32 @@ var packageLint = async (fix2 = false, verbose = false, cache = true) => {
|
|
|
2822
3015
|
const filesCountColor = files.length < 100 ? "green" : files.length < 1e3 ? "yellow" : "red";
|
|
2823
3016
|
const lintTime = Date.now() - start;
|
|
2824
3017
|
const lintTimeColor = lintTime < 1e3 ? "green" : lintTime < 3e3 ? "yellow" : "red";
|
|
2825
|
-
console.log(
|
|
3018
|
+
console.log(chalk38.white(`Linted ${chalk38[filesCountColor](files.length)} files in ${chalk38[lintTimeColor](lintTime)}ms`));
|
|
2826
3019
|
return lintResults.reduce((prev, lintResult) => prev + lintResult.errorCount, 0);
|
|
2827
3020
|
};
|
|
2828
3021
|
|
|
2829
3022
|
// src/actions/package/publint.ts
|
|
2830
3023
|
import { promises as fs10 } from "fs";
|
|
2831
|
-
import
|
|
3024
|
+
import chalk39 from "chalk";
|
|
2832
3025
|
import sortPackageJson from "sort-package-json";
|
|
2833
3026
|
var customPubLint = (pkg) => {
|
|
2834
3027
|
let errorCount = 0;
|
|
2835
3028
|
let warningCount = 0;
|
|
2836
3029
|
if (pkg.files === void 0) {
|
|
2837
|
-
console.warn(
|
|
3030
|
+
console.warn(chalk39.yellow('Publint [custom]: "files" field is missing'));
|
|
2838
3031
|
warningCount++;
|
|
2839
3032
|
}
|
|
2840
3033
|
if (pkg.main !== void 0) {
|
|
2841
|
-
console.warn(
|
|
3034
|
+
console.warn(chalk39.yellow('Publint [custom]: "main" field is deprecated, use "exports" instead'));
|
|
2842
3035
|
warningCount++;
|
|
2843
3036
|
}
|
|
2844
3037
|
if (pkg.sideEffects !== false) {
|
|
2845
|
-
console.warn(
|
|
3038
|
+
console.warn(chalk39.yellow('Publint [custom]: "sideEffects" field should be set to false'));
|
|
2846
3039
|
warningCount++;
|
|
2847
3040
|
}
|
|
2848
3041
|
if (pkg.resolutions !== void 0) {
|
|
2849
|
-
console.warn(
|
|
2850
|
-
console.warn(
|
|
3042
|
+
console.warn(chalk39.yellow('Publint [custom]: "resolutions" in use'));
|
|
3043
|
+
console.warn(chalk39.gray(JSON.stringify(pkg.resolutions, null, 2)));
|
|
2851
3044
|
warningCount++;
|
|
2852
3045
|
}
|
|
2853
3046
|
return [errorCount, warningCount];
|
|
@@ -2857,8 +3050,8 @@ var packagePublint = async ({ strict = true, verbose = false } = {}) => {
|
|
|
2857
3050
|
const sortedPkg = sortPackageJson(await fs10.readFile(`${pkgDir}/package.json`, "utf8"));
|
|
2858
3051
|
await fs10.writeFile(`${pkgDir}/package.json`, sortedPkg);
|
|
2859
3052
|
const pkg = JSON.parse(await fs10.readFile(`${pkgDir}/package.json`, "utf8"));
|
|
2860
|
-
console.log(
|
|
2861
|
-
console.log(
|
|
3053
|
+
console.log(chalk39.green(`Publint: ${pkg.name}`));
|
|
3054
|
+
console.log(chalk39.gray(pkgDir));
|
|
2862
3055
|
const { publint: publint2 } = await import("publint");
|
|
2863
3056
|
const { messages } = await publint2({
|
|
2864
3057
|
level: "suggestion",
|
|
@@ -2869,22 +3062,22 @@ var packagePublint = async ({ strict = true, verbose = false } = {}) => {
|
|
|
2869
3062
|
for (const message of messages) {
|
|
2870
3063
|
switch (message.type) {
|
|
2871
3064
|
case "error": {
|
|
2872
|
-
console.error(
|
|
3065
|
+
console.error(chalk39.red(`[${message.code}] ${formatMessage(message, pkg)}`));
|
|
2873
3066
|
break;
|
|
2874
3067
|
}
|
|
2875
3068
|
case "warning": {
|
|
2876
|
-
console.warn(
|
|
3069
|
+
console.warn(chalk39.yellow(`[${message.code}] ${formatMessage(message, pkg)}`));
|
|
2877
3070
|
break;
|
|
2878
3071
|
}
|
|
2879
3072
|
default: {
|
|
2880
|
-
console.log(
|
|
3073
|
+
console.log(chalk39.white(`[${message.code}] ${formatMessage(message, pkg)}`));
|
|
2881
3074
|
break;
|
|
2882
3075
|
}
|
|
2883
3076
|
}
|
|
2884
3077
|
}
|
|
2885
3078
|
const [errorCount, warningCount] = customPubLint(pkg);
|
|
2886
3079
|
if (verbose) {
|
|
2887
|
-
console.log(
|
|
3080
|
+
console.log(chalk39.gray(`Publint [Finish]: ${pkgDir} [${messages.length + errorCount + warningCount} messages]`));
|
|
2888
3081
|
}
|
|
2889
3082
|
return messages.filter((message) => message.type === "error").length + errorCount;
|
|
2890
3083
|
};
|
|
@@ -2918,7 +3111,10 @@ async function readmeGen({
|
|
|
2918
3111
|
typedoc,
|
|
2919
3112
|
verbose
|
|
2920
3113
|
}) {
|
|
3114
|
+
const config2 = await loadConfig();
|
|
2921
3115
|
return await generateReadmeFiles({
|
|
3116
|
+
logoLinkUrl: config2.readme?.logoLinkUrl,
|
|
3117
|
+
logoUrl: config2.readme?.logoUrl,
|
|
2922
3118
|
pkg,
|
|
2923
3119
|
templatePath,
|
|
2924
3120
|
typedoc,
|
|
@@ -2926,6 +3122,15 @@ async function readmeGen({
|
|
|
2926
3122
|
});
|
|
2927
3123
|
}
|
|
2928
3124
|
|
|
3125
|
+
// src/actions/readme-init.ts
|
|
3126
|
+
async function readmeInit({ templatePath }) {
|
|
3127
|
+
const config2 = await loadConfig();
|
|
3128
|
+
const template = applyLogoConfig(DEFAULT_README_TEMPLATE, config2.readme?.logoUrl, config2.readme?.logoLinkUrl);
|
|
3129
|
+
const resolvedTemplatePath = resolveTemplatePath(templatePath);
|
|
3130
|
+
await scaffoldTemplate(resolvedTemplatePath, template);
|
|
3131
|
+
return 0;
|
|
3132
|
+
}
|
|
3133
|
+
|
|
2929
3134
|
// src/actions/rebuild.ts
|
|
2930
3135
|
var rebuild = ({ target }) => {
|
|
2931
3136
|
return runSteps("Rebuild", [
|
|
@@ -2935,7 +3140,7 @@ var rebuild = ({ target }) => {
|
|
|
2935
3140
|
};
|
|
2936
3141
|
|
|
2937
3142
|
// src/actions/recompile.ts
|
|
2938
|
-
import
|
|
3143
|
+
import chalk40 from "chalk";
|
|
2939
3144
|
var recompile = async ({
|
|
2940
3145
|
verbose,
|
|
2941
3146
|
target,
|
|
@@ -2971,7 +3176,7 @@ var recompileAll = async ({
|
|
|
2971
3176
|
const incrementalOptions = incremental ? ["--since", "-Apt", "--topological-dev"] : ["--parallel", "-Apt", "--topological-dev"];
|
|
2972
3177
|
const jobsOptions = jobs ? ["-j", `${jobs}`] : [];
|
|
2973
3178
|
if (jobs) {
|
|
2974
|
-
console.log(
|
|
3179
|
+
console.log(chalk40.blue(`Jobs set to [${jobs}]`));
|
|
2975
3180
|
}
|
|
2976
3181
|
const result = await runStepsAsync(`Recompile${incremental ? "-Incremental" : ""} [All]`, [
|
|
2977
3182
|
[
|
|
@@ -3002,7 +3207,7 @@ var recompileAll = async ({
|
|
|
3002
3207
|
]
|
|
3003
3208
|
]);
|
|
3004
3209
|
console.log(
|
|
3005
|
-
`${
|
|
3210
|
+
`${chalk40.gray("Recompiled in")} [${chalk40.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk40.gray("seconds")}`
|
|
3006
3211
|
);
|
|
3007
3212
|
return result;
|
|
3008
3213
|
};
|
|
@@ -3011,7 +3216,7 @@ var recompileAll = async ({
|
|
|
3011
3216
|
import {
|
|
3012
3217
|
closeSync,
|
|
3013
3218
|
openSync,
|
|
3014
|
-
rmSync
|
|
3219
|
+
rmSync as rmSync2
|
|
3015
3220
|
} from "fs";
|
|
3016
3221
|
var reinstall = () => {
|
|
3017
3222
|
console.log("Reinstall [Clear Lock File]");
|
|
@@ -3021,7 +3226,7 @@ var reinstall = () => {
|
|
|
3021
3226
|
const result = workspaces.map(({ location, name }) => {
|
|
3022
3227
|
const dist = `${location}/node_modules`;
|
|
3023
3228
|
try {
|
|
3024
|
-
|
|
3229
|
+
rmSync2(dist, { force: true, recursive: true });
|
|
3025
3230
|
return 0;
|
|
3026
3231
|
} catch (ex) {
|
|
3027
3232
|
const error = ex;
|
|
@@ -3033,13 +3238,13 @@ var reinstall = () => {
|
|
|
3033
3238
|
};
|
|
3034
3239
|
|
|
3035
3240
|
// src/actions/relint.ts
|
|
3036
|
-
import
|
|
3241
|
+
import chalk41 from "chalk";
|
|
3037
3242
|
var relintPackage = ({
|
|
3038
3243
|
pkg,
|
|
3039
3244
|
fix: fix2,
|
|
3040
3245
|
verbose
|
|
3041
3246
|
}) => {
|
|
3042
|
-
console.log(
|
|
3247
|
+
console.log(chalk41.gray(`${fix2 ? "Fix" : "Lint"} [${pkg}]`));
|
|
3043
3248
|
const start = Date.now();
|
|
3044
3249
|
const result = runSteps(`${fix2 ? "Fix" : "Lint"} [${pkg}]`, [
|
|
3045
3250
|
["yarn", [
|
|
@@ -3049,7 +3254,7 @@ var relintPackage = ({
|
|
|
3049
3254
|
fix2 ? "package-fix" : verbose ? "package-lint-verbose" : "package-lint"
|
|
3050
3255
|
]]
|
|
3051
3256
|
]);
|
|
3052
|
-
console.log(
|
|
3257
|
+
console.log(chalk41.gray(`${fix2 ? "Fixed in" : "Linted in"} [${chalk41.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk41.gray("seconds")}`));
|
|
3053
3258
|
return result;
|
|
3054
3259
|
};
|
|
3055
3260
|
var relint = ({
|
|
@@ -3069,21 +3274,21 @@ var relint = ({
|
|
|
3069
3274
|
});
|
|
3070
3275
|
};
|
|
3071
3276
|
var relintAllPackages = ({ fix: fix2 = false } = {}) => {
|
|
3072
|
-
console.log(
|
|
3277
|
+
console.log(chalk41.gray(`${fix2 ? "Fix" : "Lint"} [All-Packages]`));
|
|
3073
3278
|
const start = Date.now();
|
|
3074
3279
|
const fixOptions = fix2 ? ["--fix"] : [];
|
|
3075
3280
|
const result = runSteps(`${fix2 ? "Fix" : "Lint"} [All-Packages]`, [
|
|
3076
3281
|
["yarn", ["eslint", ...fixOptions]]
|
|
3077
3282
|
]);
|
|
3078
|
-
console.log(
|
|
3283
|
+
console.log(chalk41.gray(`${fix2 ? "Fixed in" : "Linted in"} [${chalk41.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk41.gray("seconds")}`));
|
|
3079
3284
|
return result;
|
|
3080
3285
|
};
|
|
3081
3286
|
|
|
3082
3287
|
// src/actions/retest.ts
|
|
3083
3288
|
var retest = () => {
|
|
3084
3289
|
return runSteps("Test", [
|
|
3085
|
-
["yarn", ["
|
|
3086
|
-
["yarn", ["
|
|
3290
|
+
["yarn", ["vitest", "--clearCache"]],
|
|
3291
|
+
["yarn", ["vitest", "."]]
|
|
3087
3292
|
]);
|
|
3088
3293
|
};
|
|
3089
3294
|
|
|
@@ -3093,10 +3298,10 @@ var sonar = () => {
|
|
|
3093
3298
|
};
|
|
3094
3299
|
|
|
3095
3300
|
// src/actions/statics.ts
|
|
3096
|
-
import
|
|
3301
|
+
import chalk42 from "chalk";
|
|
3097
3302
|
var DefaultDependencies = ["axios", "@xylabs/pixel", "react", "graphql", "react-router", "@mui/material", "@mui/system"];
|
|
3098
3303
|
var statics = () => {
|
|
3099
|
-
console.log(
|
|
3304
|
+
console.log(chalk42.green("Check Required Static Dependencies"));
|
|
3100
3305
|
const statics2 = parsedPackageJSON()?.xy?.deps?.statics;
|
|
3101
3306
|
return detectDuplicateDependencies(statics2, DefaultDependencies);
|
|
3102
3307
|
};
|
|
@@ -3152,561 +3357,696 @@ var loadPackageConfig = async () => {
|
|
|
3152
3357
|
return JSON.parse(pkgConfig);
|
|
3153
3358
|
};
|
|
3154
3359
|
|
|
3155
|
-
// src/xy/
|
|
3156
|
-
|
|
3360
|
+
// src/xy/param.ts
|
|
3361
|
+
var packagePositionalParam = (yargs2) => {
|
|
3362
|
+
return yargs2.positional("package", { describe: "Specific package to target", type: "string" });
|
|
3363
|
+
};
|
|
3157
3364
|
|
|
3158
|
-
// src/xy/
|
|
3159
|
-
var
|
|
3160
|
-
|
|
3161
|
-
|
|
3162
|
-
|
|
3163
|
-
|
|
3164
|
-
|
|
3165
|
-
|
|
3166
|
-
|
|
3167
|
-
|
|
3168
|
-
console.log(`Building: ${argv.package ?? "all"}`);
|
|
3169
|
-
}
|
|
3170
|
-
process.exitCode = await build({
|
|
3171
|
-
incremental: !!argv.incremental,
|
|
3172
|
-
jobs: argv.jobs,
|
|
3173
|
-
pkg: argv.package,
|
|
3174
|
-
target: argv.target,
|
|
3175
|
-
verbose: !!argv.verbose
|
|
3176
|
-
});
|
|
3177
|
-
}
|
|
3178
|
-
).command(
|
|
3179
|
-
"compile [package]",
|
|
3180
|
-
"Compile with Typescript & Copy Images",
|
|
3181
|
-
(yargs2) => {
|
|
3182
|
-
return yargs2.positional("package", { describe: "Specific package to compile" });
|
|
3183
|
-
},
|
|
3184
|
-
(argv) => {
|
|
3185
|
-
if (argv.verbose) {
|
|
3186
|
-
console.log(`Compiling: ${argv.package ?? "all"}`);
|
|
3187
|
-
}
|
|
3188
|
-
process.exitCode = compile({
|
|
3189
|
-
incremental: !!argv.incremental,
|
|
3190
|
-
jobs: argv.jobs,
|
|
3191
|
-
pkg: argv.package,
|
|
3192
|
-
target: argv.target,
|
|
3193
|
-
verbose: !!argv.verbose
|
|
3194
|
-
});
|
|
3365
|
+
// src/xy/build-commands/build.ts
|
|
3366
|
+
var buildCommand = {
|
|
3367
|
+
builder: (yargs2) => {
|
|
3368
|
+
return packagePositionalParam(yargs2);
|
|
3369
|
+
},
|
|
3370
|
+
command: "build [package]",
|
|
3371
|
+
describe: "Build - Compile & Lint",
|
|
3372
|
+
handler: async (argv) => {
|
|
3373
|
+
if (argv.verbose) {
|
|
3374
|
+
console.log(`Building: ${argv.package ?? "all"}`);
|
|
3195
3375
|
}
|
|
3196
|
-
|
|
3197
|
-
|
|
3198
|
-
|
|
3199
|
-
|
|
3200
|
-
|
|
3201
|
-
|
|
3202
|
-
|
|
3203
|
-
|
|
3204
|
-
|
|
3205
|
-
|
|
3206
|
-
|
|
3207
|
-
|
|
3208
|
-
|
|
3209
|
-
|
|
3210
|
-
|
|
3211
|
-
|
|
3212
|
-
|
|
3213
|
-
});
|
|
3376
|
+
process.exitCode = await build({
|
|
3377
|
+
incremental: !!argv.incremental,
|
|
3378
|
+
jobs: argv.jobs,
|
|
3379
|
+
pkg: argv.package,
|
|
3380
|
+
target: argv.target,
|
|
3381
|
+
verbose: !!argv.verbose
|
|
3382
|
+
});
|
|
3383
|
+
}
|
|
3384
|
+
};
|
|
3385
|
+
var compileCommand = {
|
|
3386
|
+
builder: (yargs2) => {
|
|
3387
|
+
return packagePositionalParam(yargs2);
|
|
3388
|
+
},
|
|
3389
|
+
command: "compile [package]",
|
|
3390
|
+
describe: "Compile with Typescript & Copy Images",
|
|
3391
|
+
handler: (argv) => {
|
|
3392
|
+
if (argv.verbose) {
|
|
3393
|
+
console.log(`Compiling: ${argv.package ?? "all"}`);
|
|
3214
3394
|
}
|
|
3215
|
-
|
|
3216
|
-
|
|
3217
|
-
|
|
3218
|
-
|
|
3219
|
-
|
|
3220
|
-
|
|
3221
|
-
|
|
3222
|
-
|
|
3223
|
-
|
|
3224
|
-
|
|
3225
|
-
|
|
3226
|
-
|
|
3227
|
-
|
|
3228
|
-
|
|
3229
|
-
|
|
3230
|
-
|
|
3231
|
-
|
|
3395
|
+
process.exitCode = compile({
|
|
3396
|
+
incremental: !!argv.incremental,
|
|
3397
|
+
jobs: argv.jobs,
|
|
3398
|
+
pkg: argv.package,
|
|
3399
|
+
target: argv.target,
|
|
3400
|
+
verbose: !!argv.verbose
|
|
3401
|
+
});
|
|
3402
|
+
}
|
|
3403
|
+
};
|
|
3404
|
+
var compileOnlyCommand = {
|
|
3405
|
+
builder: (yargs2) => {
|
|
3406
|
+
return packagePositionalParam(yargs2);
|
|
3407
|
+
},
|
|
3408
|
+
command: "compile-only [package]",
|
|
3409
|
+
describe: "Compile with Typescript & Copy Images (No Publint)",
|
|
3410
|
+
handler: (argv) => {
|
|
3411
|
+
if (argv.verbose) {
|
|
3412
|
+
console.log(`Compiling: ${argv.package ?? "all"}`);
|
|
3232
3413
|
}
|
|
3233
|
-
|
|
3234
|
-
|
|
3235
|
-
|
|
3236
|
-
|
|
3237
|
-
|
|
3238
|
-
|
|
3239
|
-
|
|
3240
|
-
|
|
3241
|
-
|
|
3242
|
-
|
|
3243
|
-
|
|
3244
|
-
|
|
3245
|
-
|
|
3246
|
-
|
|
3247
|
-
|
|
3248
|
-
|
|
3249
|
-
|
|
3250
|
-
|
|
3251
|
-
|
|
3414
|
+
process.exitCode = compile({
|
|
3415
|
+
incremental: !!argv.incremental,
|
|
3416
|
+
jobs: argv.jobs,
|
|
3417
|
+
pkg: argv.package,
|
|
3418
|
+
publint: false,
|
|
3419
|
+
target: argv.target,
|
|
3420
|
+
verbose: !!argv.verbose
|
|
3421
|
+
});
|
|
3422
|
+
}
|
|
3423
|
+
};
|
|
3424
|
+
var recompileCommand = {
|
|
3425
|
+
builder: (yargs2) => {
|
|
3426
|
+
return packagePositionalParam(yargs2);
|
|
3427
|
+
},
|
|
3428
|
+
command: "recompile [package]",
|
|
3429
|
+
describe: "Re-compile with Typescript & Copy Images",
|
|
3430
|
+
handler: async (argv) => {
|
|
3431
|
+
if (argv.verbose) {
|
|
3432
|
+
console.log(`Re-compiling: ${argv.package ?? "all"}`);
|
|
3252
3433
|
}
|
|
3253
|
-
|
|
3434
|
+
process.exitCode = await recompile({
|
|
3435
|
+
incremental: !!argv.incremental,
|
|
3436
|
+
jobs: argv.jobs,
|
|
3437
|
+
pkg: argv.package,
|
|
3438
|
+
target: argv.target,
|
|
3439
|
+
verbose: !!argv.verbose
|
|
3440
|
+
});
|
|
3441
|
+
}
|
|
3442
|
+
};
|
|
3443
|
+
var rebuildCommand = {
|
|
3444
|
+
builder: (yargs2) => {
|
|
3445
|
+
return packagePositionalParam(yargs2);
|
|
3446
|
+
},
|
|
3447
|
+
command: "rebuild [package]",
|
|
3448
|
+
describe: "Rebuild - Clean, Compile & Lint",
|
|
3449
|
+
handler: (argv) => {
|
|
3450
|
+
if (argv.verbose) console.log(`Rebuilding: ${argv.package ?? "all"}`);
|
|
3451
|
+
process.exitCode = rebuild({ target: argv.target });
|
|
3452
|
+
}
|
|
3453
|
+
};
|
|
3454
|
+
var copyAssetsCommand = {
|
|
3455
|
+
builder: (yargs2) => {
|
|
3456
|
+
return packagePositionalParam(yargs2);
|
|
3457
|
+
},
|
|
3458
|
+
command: "copy-assets [package]",
|
|
3459
|
+
describe: "Copy Assets - Copy the assets from src to dist",
|
|
3460
|
+
handler: async (argv) => {
|
|
3461
|
+
if (argv.verbose) console.log(`Copying Assets: ${argv.package ?? "all"}`);
|
|
3462
|
+
process.exitCode = await copyAssets({ target: argv.target });
|
|
3463
|
+
}
|
|
3254
3464
|
};
|
|
3255
3465
|
|
|
3256
|
-
// src/xy/
|
|
3257
|
-
var
|
|
3258
|
-
return
|
|
3466
|
+
// src/xy/build-commands/index.ts
|
|
3467
|
+
var xyBuildCommands = (args) => {
|
|
3468
|
+
return args.command(buildCommand).command(compileCommand).command(compileOnlyCommand).command(rebuildCommand).command(recompileCommand).command(copyAssetsCommand);
|
|
3469
|
+
};
|
|
3470
|
+
|
|
3471
|
+
// src/xy/common/claude/commandsCommand.ts
|
|
3472
|
+
var commandsCommand = {
|
|
3473
|
+
command: "commands",
|
|
3474
|
+
describe: "Sync XY Labs standard Claude slash commands to .claude/commands/",
|
|
3475
|
+
handler: (argv) => {
|
|
3476
|
+
if (argv.verbose) console.log("Claude Commands");
|
|
3477
|
+
process.exitCode = claudeCommands();
|
|
3478
|
+
}
|
|
3479
|
+
};
|
|
3480
|
+
|
|
3481
|
+
// src/xy/common/claude/initCommand.ts
|
|
3482
|
+
var initCommand = {
|
|
3483
|
+
builder: (yargs2) => {
|
|
3484
|
+
return yargs2.option("force", {
|
|
3485
|
+
alias: "f",
|
|
3486
|
+
default: false,
|
|
3487
|
+
description: "Overwrite existing CLAUDE.md",
|
|
3488
|
+
type: "boolean"
|
|
3489
|
+
});
|
|
3490
|
+
},
|
|
3491
|
+
command: "init",
|
|
3492
|
+
describe: "Initialize all Claude configuration (commands, rules, settings)",
|
|
3493
|
+
handler: async (argv) => {
|
|
3494
|
+
if (argv.verbose) console.log("Claude Init");
|
|
3495
|
+
const commandsResult = claudeCommands();
|
|
3496
|
+
const rulesResult = claudeRules({ force: argv.force });
|
|
3497
|
+
const settingsResult = await claudeSettings();
|
|
3498
|
+
process.exitCode = commandsResult || rulesResult || settingsResult;
|
|
3499
|
+
}
|
|
3500
|
+
};
|
|
3501
|
+
var initClaudeSkillsCommand = {
|
|
3502
|
+
command: "init:skills",
|
|
3503
|
+
describe: "Initialize Claude skills configuration",
|
|
3504
|
+
handler: () => {
|
|
3505
|
+
const result = claudeSkills();
|
|
3506
|
+
process.exitCode = result;
|
|
3507
|
+
}
|
|
3508
|
+
};
|
|
3509
|
+
|
|
3510
|
+
// src/xy/common/claude/rulesCommand.ts
|
|
3511
|
+
var rulesCommand = {
|
|
3512
|
+
builder: (yargs2) => {
|
|
3513
|
+
return yargs2.option("force", {
|
|
3514
|
+
alias: "f",
|
|
3515
|
+
default: false,
|
|
3516
|
+
description: "Overwrite existing CLAUDE.md",
|
|
3517
|
+
type: "boolean"
|
|
3518
|
+
});
|
|
3519
|
+
},
|
|
3520
|
+
command: "rules",
|
|
3521
|
+
describe: "Sync XY Labs standard Claude rules to .claude/rules/",
|
|
3522
|
+
handler: (argv) => {
|
|
3523
|
+
if (argv.verbose) console.log("Claude Rules");
|
|
3524
|
+
process.exitCode = claudeRules({ force: argv.force });
|
|
3525
|
+
}
|
|
3526
|
+
};
|
|
3527
|
+
|
|
3528
|
+
// src/xy/common/claude/settingsCommand.ts
|
|
3529
|
+
var settingsCommand = {
|
|
3530
|
+
command: "settings",
|
|
3531
|
+
describe: "Initialize .claude/settings.local.json with XY Labs defaults",
|
|
3532
|
+
handler: async (argv) => {
|
|
3533
|
+
if (argv.verbose) console.log("Claude Settings");
|
|
3534
|
+
process.exitCode = await claudeSettings();
|
|
3535
|
+
}
|
|
3536
|
+
};
|
|
3537
|
+
|
|
3538
|
+
// src/xy/common/claude/index.ts
|
|
3539
|
+
var claudeCommand = {
|
|
3540
|
+
builder: (yargs2) => {
|
|
3541
|
+
return yargs2.command(commandsCommand).command(initCommand).command(rulesCommand).command(settingsCommand).command(initClaudeSkillsCommand).demandCommand(1, "Please specify a claude subcommand");
|
|
3542
|
+
},
|
|
3543
|
+
command: "claude",
|
|
3544
|
+
describe: "Claude - Claude Code configuration utilities",
|
|
3545
|
+
handler: () => {
|
|
3546
|
+
}
|
|
3547
|
+
};
|
|
3548
|
+
|
|
3549
|
+
// src/xy/common/cleanDocsCommand.ts
|
|
3550
|
+
var cleanDocsCommand = {
|
|
3551
|
+
command: "clean-docs",
|
|
3552
|
+
describe: "CleanDocs - Clean TypeDocs",
|
|
3553
|
+
handler: (argv) => {
|
|
3554
|
+
if (argv.verbose) console.log("Cleaning TypeDocs: all");
|
|
3555
|
+
process.exitCode = cleanDocs();
|
|
3556
|
+
}
|
|
3259
3557
|
};
|
|
3260
3558
|
|
|
3261
|
-
// src/xy/
|
|
3559
|
+
// src/xy/common/deadCommand.ts
|
|
3560
|
+
var deadCommand = {
|
|
3561
|
+
builder: (yargs2) => {
|
|
3562
|
+
return packagePositionalParam(yargs2);
|
|
3563
|
+
},
|
|
3564
|
+
command: "dead [package]",
|
|
3565
|
+
describe: "Dead - Check for dead code",
|
|
3566
|
+
handler: (argv) => {
|
|
3567
|
+
if (argv.verbose) console.log("Dead");
|
|
3568
|
+
process.exitCode = dead();
|
|
3569
|
+
}
|
|
3570
|
+
};
|
|
3571
|
+
|
|
3572
|
+
// src/xy/common/genDocsCommand.ts
|
|
3573
|
+
var genDocsCommand = {
|
|
3574
|
+
builder: (yargs2) => {
|
|
3575
|
+
return packagePositionalParam(yargs2);
|
|
3576
|
+
},
|
|
3577
|
+
command: "gen-docs [package]",
|
|
3578
|
+
describe: "GenDocs - Generate TypeDocs",
|
|
3579
|
+
handler: (argv) => {
|
|
3580
|
+
if (argv.verbose) console.log(`Generating TypeDocs: ${argv.package ?? "all"}`);
|
|
3581
|
+
process.exitCode = genDocs({ incremental: !!argv.incremental, pkg: argv.package });
|
|
3582
|
+
}
|
|
3583
|
+
};
|
|
3584
|
+
|
|
3585
|
+
// src/xy/common/gitignoreGenCommand.ts
|
|
3586
|
+
var gitignoreGenCommand = {
|
|
3587
|
+
command: "gitignore-gen",
|
|
3588
|
+
describe: "GitIgnore Gen - Generate .gitignore files",
|
|
3589
|
+
handler: (argv) => {
|
|
3590
|
+
if (argv.verbose) console.log("GitIgnore Gen");
|
|
3591
|
+
process.exitCode = gitignoreGen();
|
|
3592
|
+
}
|
|
3593
|
+
};
|
|
3594
|
+
|
|
3595
|
+
// src/xy/common/gitlintCommand.ts
|
|
3596
|
+
var gitlintCommand = {
|
|
3597
|
+
command: "gitlint [package]",
|
|
3598
|
+
describe: "Gitlint - Lint your git config",
|
|
3599
|
+
handler: (argv) => {
|
|
3600
|
+
if (argv.verbose) console.log("Gitlint");
|
|
3601
|
+
process.exitCode = argv.fix ? gitlintFix() : gitlint();
|
|
3602
|
+
}
|
|
3603
|
+
};
|
|
3604
|
+
|
|
3605
|
+
// src/xy/common/licenseCommand.ts
|
|
3606
|
+
var licenseCommand = {
|
|
3607
|
+
builder: (yargs2) => {
|
|
3608
|
+
return packagePositionalParam(yargs2);
|
|
3609
|
+
},
|
|
3610
|
+
command: "license [package]",
|
|
3611
|
+
describe: "License - Check licenses of dependencies",
|
|
3612
|
+
handler: async (argv) => {
|
|
3613
|
+
if (argv.verbose) console.log(`License: ${argv.package ?? "all"}`);
|
|
3614
|
+
process.exitCode = await license();
|
|
3615
|
+
}
|
|
3616
|
+
};
|
|
3617
|
+
|
|
3618
|
+
// src/xy/common/npmignoreGenCommand.ts
|
|
3619
|
+
var npmignoreGenCommand = {
|
|
3620
|
+
command: "npmignore-gen",
|
|
3621
|
+
describe: "NpmIgnore Gen - Generate .npmignore files",
|
|
3622
|
+
handler: (argv) => {
|
|
3623
|
+
if (argv.verbose) console.log("NpmIgnore Gen");
|
|
3624
|
+
process.exitCode = npmignoreGen();
|
|
3625
|
+
}
|
|
3626
|
+
};
|
|
3627
|
+
|
|
3628
|
+
// src/xy/common/readme/genCommand.ts
|
|
3629
|
+
var genCommand = {
|
|
3630
|
+
builder: (yargs2) => {
|
|
3631
|
+
return packagePositionalParam(yargs2).option("template", {
|
|
3632
|
+
alias: "t",
|
|
3633
|
+
description: "Path to README.template.md",
|
|
3634
|
+
type: "string"
|
|
3635
|
+
}).option("typedoc", {
|
|
3636
|
+
default: false,
|
|
3637
|
+
description: "Generate TypeDoc reference sections",
|
|
3638
|
+
type: "boolean"
|
|
3639
|
+
});
|
|
3640
|
+
},
|
|
3641
|
+
aliases: ["$0"],
|
|
3642
|
+
command: "gen [package]",
|
|
3643
|
+
describe: "Generate README.md files from template",
|
|
3644
|
+
handler: async (argv) => {
|
|
3645
|
+
if (argv.verbose) console.log("Readme Gen");
|
|
3646
|
+
process.exitCode = await readmeGen({
|
|
3647
|
+
pkg: argv.package,
|
|
3648
|
+
templatePath: argv.template,
|
|
3649
|
+
typedoc: argv.typedoc,
|
|
3650
|
+
verbose: !!argv.verbose
|
|
3651
|
+
});
|
|
3652
|
+
}
|
|
3653
|
+
};
|
|
3654
|
+
|
|
3655
|
+
// src/xy/common/readme/initCommand.ts
|
|
3656
|
+
var initCommand2 = {
|
|
3657
|
+
builder: (yargs2) => {
|
|
3658
|
+
return yargs2.option("template", {
|
|
3659
|
+
alias: "t",
|
|
3660
|
+
description: "Path to README.template.md",
|
|
3661
|
+
type: "string"
|
|
3662
|
+
});
|
|
3663
|
+
},
|
|
3664
|
+
command: "init",
|
|
3665
|
+
describe: "Initialize README template and logo files",
|
|
3666
|
+
handler: async (argv) => {
|
|
3667
|
+
if (argv.verbose) console.log("Readme Init");
|
|
3668
|
+
process.exitCode = await readmeInit({
|
|
3669
|
+
templatePath: argv.template,
|
|
3670
|
+
verbose: !!argv.verbose
|
|
3671
|
+
});
|
|
3672
|
+
}
|
|
3673
|
+
};
|
|
3674
|
+
|
|
3675
|
+
// src/xy/common/readme/index.ts
|
|
3676
|
+
var readmeCommand = {
|
|
3677
|
+
builder: (yargs2) => {
|
|
3678
|
+
return yargs2.command(genCommand).command(initCommand2);
|
|
3679
|
+
},
|
|
3680
|
+
command: "readme",
|
|
3681
|
+
describe: "Readme - README file utilities",
|
|
3682
|
+
handler: () => {
|
|
3683
|
+
}
|
|
3684
|
+
};
|
|
3685
|
+
|
|
3686
|
+
// src/xy/common/retestCommand.ts
|
|
3687
|
+
var retestCommand = {
|
|
3688
|
+
command: "retest",
|
|
3689
|
+
describe: "Re-Test - Run Jest Tests with cleaned cache",
|
|
3690
|
+
handler: (argv) => {
|
|
3691
|
+
if (argv.verbose) console.log("Re-Testing");
|
|
3692
|
+
process.exitCode = retest();
|
|
3693
|
+
}
|
|
3694
|
+
};
|
|
3695
|
+
|
|
3696
|
+
// src/xy/common/testCommand.ts
|
|
3697
|
+
var testCommand = {
|
|
3698
|
+
command: "test",
|
|
3699
|
+
describe: "Test - Run Jest Tests",
|
|
3700
|
+
handler: (argv) => {
|
|
3701
|
+
if (argv.verbose) console.log("Testing");
|
|
3702
|
+
process.exitCode = test();
|
|
3703
|
+
}
|
|
3704
|
+
};
|
|
3705
|
+
|
|
3706
|
+
// src/xy/common/upplugCommand.ts
|
|
3707
|
+
var upplugCommand = {
|
|
3708
|
+
command: "upplug",
|
|
3709
|
+
describe: "UpPlug - Update Yarn Plugins",
|
|
3710
|
+
handler: (argv) => {
|
|
3711
|
+
if (argv.verbose) console.log("UpPlug");
|
|
3712
|
+
process.exitCode = updateYarnPlugins();
|
|
3713
|
+
}
|
|
3714
|
+
};
|
|
3715
|
+
|
|
3716
|
+
// src/xy/common/upyarnCommand.ts
|
|
3717
|
+
var upyarnCommand = {
|
|
3718
|
+
command: "upyarn",
|
|
3719
|
+
describe: "UpYarn - Update Yarn Version",
|
|
3720
|
+
handler: (argv) => {
|
|
3721
|
+
if (argv.verbose) console.log("UpYarn");
|
|
3722
|
+
process.exitCode = updateYarnVersion();
|
|
3723
|
+
}
|
|
3724
|
+
};
|
|
3725
|
+
|
|
3726
|
+
// src/xy/common/yarn3OnlyCommand.ts
|
|
3727
|
+
var yarn3OnlyCommand = {
|
|
3728
|
+
command: "yarn3only",
|
|
3729
|
+
describe: "Yarn3Only - Check if using Yarn v3",
|
|
3730
|
+
handler: (argv) => {
|
|
3731
|
+
if (argv.verbose) console.log("Yarn 3 Check");
|
|
3732
|
+
process.exitCode = yarn3Only();
|
|
3733
|
+
}
|
|
3734
|
+
};
|
|
3735
|
+
|
|
3736
|
+
// src/xy/common/index.ts
|
|
3262
3737
|
var xyCommonCommands = (args) => {
|
|
3263
|
-
return args.command(
|
|
3264
|
-
|
|
3265
|
-
|
|
3266
|
-
|
|
3267
|
-
|
|
3268
|
-
|
|
3269
|
-
|
|
3270
|
-
|
|
3271
|
-
|
|
3272
|
-
|
|
3273
|
-
|
|
3274
|
-
|
|
3275
|
-
|
|
3276
|
-
|
|
3277
|
-
|
|
3278
|
-
|
|
3279
|
-
|
|
3280
|
-
|
|
3281
|
-
|
|
3282
|
-
(
|
|
3283
|
-
|
|
3284
|
-
|
|
3285
|
-
|
|
3286
|
-
|
|
3287
|
-
|
|
3288
|
-
|
|
3289
|
-
|
|
3290
|
-
|
|
3291
|
-
|
|
3292
|
-
|
|
3293
|
-
|
|
3294
|
-
|
|
3295
|
-
|
|
3296
|
-
|
|
3297
|
-
|
|
3298
|
-
|
|
3299
|
-
|
|
3300
|
-
|
|
3301
|
-
|
|
3302
|
-
|
|
3303
|
-
|
|
3304
|
-
|
|
3305
|
-
|
|
3306
|
-
|
|
3307
|
-
|
|
3308
|
-
|
|
3309
|
-
|
|
3310
|
-
|
|
3311
|
-
|
|
3312
|
-
|
|
3313
|
-
|
|
3314
|
-
).command(
|
|
3315
|
-
"gen-docs [package]",
|
|
3316
|
-
"GenDocs - Generate TypeDocs",
|
|
3317
|
-
(yargs2) => {
|
|
3318
|
-
return packagePositionalParam(yargs2);
|
|
3319
|
-
},
|
|
3320
|
-
(argv) => {
|
|
3321
|
-
if (argv.verbose) console.log(`Generating TypeDocs: ${argv.package ?? "all"}`);
|
|
3322
|
-
process.exitCode = genDocs({ incremental: !!argv.incremental, pkg: argv.package });
|
|
3323
|
-
}
|
|
3324
|
-
).command(
|
|
3325
|
-
"clean-docs",
|
|
3326
|
-
"CleanDocs - Clean TypeDocs",
|
|
3327
|
-
(yargs2) => yargs2,
|
|
3328
|
-
(argv) => {
|
|
3329
|
-
if (argv.verbose) console.log("Cleaning TypeDocs: all");
|
|
3330
|
-
process.exitCode = cleanDocs();
|
|
3331
|
-
}
|
|
3332
|
-
).command(
|
|
3333
|
-
"gitlint [package]",
|
|
3334
|
-
"Gitlint - Lint your git config",
|
|
3335
|
-
(yargs2) => {
|
|
3336
|
-
return yargs2;
|
|
3337
|
-
},
|
|
3338
|
-
(argv) => {
|
|
3339
|
-
if (argv.verbose) console.log("Gitlint");
|
|
3340
|
-
process.exitCode = argv.fix ? gitlintFix() : gitlint();
|
|
3341
|
-
}
|
|
3342
|
-
).command(
|
|
3343
|
-
"gitignore-gen",
|
|
3344
|
-
"GitIgnore Gen - Generate .gitignore files",
|
|
3345
|
-
(yargs2) => {
|
|
3346
|
-
return yargs2;
|
|
3347
|
-
},
|
|
3348
|
-
(argv) => {
|
|
3349
|
-
if (argv.verbose) console.log("GitIgnore Gen");
|
|
3350
|
-
process.exitCode = gitignoreGen();
|
|
3351
|
-
}
|
|
3352
|
-
).command(
|
|
3353
|
-
"npmignore-gen",
|
|
3354
|
-
"NpmIgnore Gen - Generate .npmignore files",
|
|
3355
|
-
(yargs2) => {
|
|
3356
|
-
return yargs2;
|
|
3357
|
-
},
|
|
3358
|
-
(argv) => {
|
|
3359
|
-
if (argv.verbose) console.log("NpmIgnore Gen");
|
|
3360
|
-
process.exitCode = npmignoreGen();
|
|
3361
|
-
}
|
|
3362
|
-
).command(
|
|
3363
|
-
"readme-gen [package]",
|
|
3364
|
-
"Readme Gen - Generate README.md files from template",
|
|
3365
|
-
(yargs2) => {
|
|
3366
|
-
return packagePositionalParam(yargs2).option("template", {
|
|
3367
|
-
alias: "t",
|
|
3368
|
-
description: "Path to README.template.md",
|
|
3369
|
-
type: "string"
|
|
3370
|
-
}).option("typedoc", {
|
|
3371
|
-
default: false,
|
|
3372
|
-
description: "Generate TypeDoc reference sections",
|
|
3373
|
-
type: "boolean"
|
|
3374
|
-
});
|
|
3375
|
-
},
|
|
3376
|
-
async (argv) => {
|
|
3377
|
-
if (argv.verbose) console.log("Readme Gen");
|
|
3378
|
-
process.exitCode = await readmeGen({
|
|
3379
|
-
pkg: argv.package,
|
|
3380
|
-
templatePath: argv.template,
|
|
3381
|
-
typedoc: argv.typedoc,
|
|
3382
|
-
verbose: !!argv.verbose
|
|
3383
|
-
});
|
|
3384
|
-
}
|
|
3385
|
-
).command(
|
|
3386
|
-
"retest",
|
|
3387
|
-
"Re-Test - Run Jest Tests with cleaned cache",
|
|
3388
|
-
(yargs2) => {
|
|
3389
|
-
return yargs2;
|
|
3390
|
-
},
|
|
3391
|
-
(argv) => {
|
|
3392
|
-
if (argv.verbose) console.log("Re-Testing");
|
|
3393
|
-
process.exitCode = retest();
|
|
3394
|
-
}
|
|
3395
|
-
).command(
|
|
3396
|
-
"test",
|
|
3397
|
-
"Test - Run Jest Tests",
|
|
3398
|
-
(yargs2) => {
|
|
3399
|
-
return yargs2;
|
|
3400
|
-
},
|
|
3401
|
-
(argv) => {
|
|
3402
|
-
if (argv.verbose) console.log("Testing");
|
|
3403
|
-
process.exitCode = test();
|
|
3404
|
-
}
|
|
3405
|
-
).command(
|
|
3406
|
-
"upplug",
|
|
3407
|
-
"UpPlug - Update Yarn Plugins",
|
|
3408
|
-
(yargs2) => {
|
|
3409
|
-
return yargs2;
|
|
3410
|
-
},
|
|
3411
|
-
(argv) => {
|
|
3412
|
-
if (argv.verbose) console.log("UpPlug");
|
|
3413
|
-
process.exitCode = updateYarnPlugins();
|
|
3414
|
-
}
|
|
3415
|
-
).command(
|
|
3416
|
-
"upyarn",
|
|
3417
|
-
"UpYarn - Update Yarn Version",
|
|
3418
|
-
(yargs2) => {
|
|
3419
|
-
return yargs2;
|
|
3420
|
-
},
|
|
3421
|
-
(argv) => {
|
|
3422
|
-
if (argv.verbose) console.log("UpYarn");
|
|
3423
|
-
process.exitCode = updateYarnVersion();
|
|
3424
|
-
}
|
|
3425
|
-
).command(
|
|
3426
|
-
"yarn3only",
|
|
3427
|
-
"Yarn3Only - Check if using Yarn v3",
|
|
3428
|
-
(yargs2) => {
|
|
3429
|
-
return yargs2;
|
|
3430
|
-
},
|
|
3431
|
-
(argv) => {
|
|
3432
|
-
if (argv.verbose) console.log("Yarn 3 Check");
|
|
3433
|
-
process.exitCode = yarn3Only();
|
|
3434
|
-
}
|
|
3435
|
-
);
|
|
3738
|
+
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);
|
|
3739
|
+
};
|
|
3740
|
+
|
|
3741
|
+
// src/xy/deploy/deployCommand.ts
|
|
3742
|
+
var deployCommand = {
|
|
3743
|
+
command: "deploy",
|
|
3744
|
+
describe: "Deploy - Deploy patch",
|
|
3745
|
+
handler: (argv) => {
|
|
3746
|
+
if (argv.verbose) console.log("Deploy patch");
|
|
3747
|
+
process.exitCode = deploy();
|
|
3748
|
+
}
|
|
3749
|
+
};
|
|
3750
|
+
|
|
3751
|
+
// src/xy/deploy/deployMajorCommand.ts
|
|
3752
|
+
var deployMajorCommand = {
|
|
3753
|
+
command: "deploy-major",
|
|
3754
|
+
describe: "Deploy - Deploy major",
|
|
3755
|
+
handler: (argv) => {
|
|
3756
|
+
if (argv.verbose) console.log("Deploy major");
|
|
3757
|
+
process.exitCode = deployMajor();
|
|
3758
|
+
}
|
|
3759
|
+
};
|
|
3760
|
+
|
|
3761
|
+
// src/xy/deploy/deployMinorCommand.ts
|
|
3762
|
+
var deployMinorCommand = {
|
|
3763
|
+
command: "deploy-minor",
|
|
3764
|
+
describe: "Deploy - Deploy minor",
|
|
3765
|
+
handler: (argv) => {
|
|
3766
|
+
if (argv.verbose) console.log("Deploy minor");
|
|
3767
|
+
process.exitCode = deployMinor();
|
|
3768
|
+
}
|
|
3769
|
+
};
|
|
3770
|
+
|
|
3771
|
+
// src/xy/deploy/deployNextCommand.ts
|
|
3772
|
+
var deployNextCommand = {
|
|
3773
|
+
command: "deploy-next",
|
|
3774
|
+
describe: "Deploy - Deploy next",
|
|
3775
|
+
handler: (argv) => {
|
|
3776
|
+
if (argv.verbose) console.log("Deploy next");
|
|
3777
|
+
process.exitCode = deployNext();
|
|
3778
|
+
}
|
|
3779
|
+
};
|
|
3780
|
+
|
|
3781
|
+
// src/xy/deploy/publishCommand.ts
|
|
3782
|
+
var publishCommand = {
|
|
3783
|
+
command: "publish",
|
|
3784
|
+
describe: "Publish - Publish packages to npmjs",
|
|
3785
|
+
handler: (argv) => {
|
|
3786
|
+
if (argv.verbose) console.log("Publish packages to npmjs");
|
|
3787
|
+
process.exitCode = publish();
|
|
3788
|
+
}
|
|
3436
3789
|
};
|
|
3437
3790
|
|
|
3438
|
-
// src/xy/
|
|
3791
|
+
// src/xy/deploy/index.ts
|
|
3439
3792
|
var xyDeployCommands = (args) => {
|
|
3440
|
-
return args.command(
|
|
3441
|
-
|
|
3442
|
-
|
|
3443
|
-
|
|
3444
|
-
|
|
3445
|
-
|
|
3446
|
-
|
|
3447
|
-
|
|
3448
|
-
|
|
3449
|
-
|
|
3450
|
-
)
|
|
3451
|
-
|
|
3452
|
-
|
|
3453
|
-
(yargs2) => {
|
|
3454
|
-
return yargs2;
|
|
3455
|
-
},
|
|
3456
|
-
(argv) => {
|
|
3457
|
-
if (argv.verbose) console.log("Deploy minor");
|
|
3458
|
-
process.exitCode = deployMinor();
|
|
3459
|
-
}
|
|
3460
|
-
).command(
|
|
3461
|
-
"deploy-major",
|
|
3462
|
-
"Deploy - Deploy major",
|
|
3463
|
-
(yargs2) => {
|
|
3464
|
-
return yargs2;
|
|
3465
|
-
},
|
|
3466
|
-
(argv) => {
|
|
3467
|
-
if (argv.verbose) console.log("Deploy major");
|
|
3468
|
-
process.exitCode = deployMajor();
|
|
3469
|
-
}
|
|
3470
|
-
).command(
|
|
3471
|
-
"deploy-next",
|
|
3472
|
-
"Deploy - Deploy next",
|
|
3473
|
-
(yargs2) => {
|
|
3474
|
-
return yargs2;
|
|
3475
|
-
},
|
|
3476
|
-
(argv) => {
|
|
3477
|
-
if (argv.verbose) console.log("Deploy next");
|
|
3478
|
-
process.exitCode = deployNext();
|
|
3479
|
-
}
|
|
3480
|
-
).command(
|
|
3481
|
-
"publish",
|
|
3482
|
-
"Publish - Publish packages to npmjs",
|
|
3483
|
-
(yargs2) => {
|
|
3484
|
-
return yargs2;
|
|
3485
|
-
},
|
|
3486
|
-
(argv) => {
|
|
3487
|
-
if (argv.verbose) console.log("Publish packages to npmjs");
|
|
3488
|
-
process.exitCode = publish();
|
|
3793
|
+
return args.command(deployCommand).command(deployMinorCommand).command(deployMajorCommand).command(deployNextCommand).command(publishCommand);
|
|
3794
|
+
};
|
|
3795
|
+
|
|
3796
|
+
// src/xy/install/cleanCommand.ts
|
|
3797
|
+
var cleanCommand = {
|
|
3798
|
+
command: "clean [package]",
|
|
3799
|
+
describe: "Clean",
|
|
3800
|
+
builder: (yargs2) => {
|
|
3801
|
+
return yargs2.positional("package", { describe: "Specific package to clean" });
|
|
3802
|
+
},
|
|
3803
|
+
handler: async (argv) => {
|
|
3804
|
+
if (argv.verbose) {
|
|
3805
|
+
console.log(`Cleaning: ${argv.package ?? "all"}`);
|
|
3489
3806
|
}
|
|
3490
|
-
|
|
3807
|
+
process.exitCode = await clean({
|
|
3808
|
+
pkg: argv.package,
|
|
3809
|
+
verbose: !!argv.verbose
|
|
3810
|
+
});
|
|
3811
|
+
}
|
|
3812
|
+
};
|
|
3813
|
+
|
|
3814
|
+
// src/xy/install/dupdepsCommand.ts
|
|
3815
|
+
var dupdepsCommand = {
|
|
3816
|
+
command: "dupdeps",
|
|
3817
|
+
describe: "Dupdeps - Duplicate Dependencies in package.json",
|
|
3818
|
+
handler: (argv) => {
|
|
3819
|
+
if (argv.verbose) console.log("Dupdeps");
|
|
3820
|
+
process.exitCode = dupdeps();
|
|
3821
|
+
}
|
|
3822
|
+
};
|
|
3823
|
+
|
|
3824
|
+
// src/xy/install/reinstallCommand.ts
|
|
3825
|
+
var reinstallCommand = {
|
|
3826
|
+
command: "reinstall",
|
|
3827
|
+
describe: "Reinstall - Clean & Install",
|
|
3828
|
+
handler: (argv) => {
|
|
3829
|
+
if (argv.verbose) console.log("Reinstalling");
|
|
3830
|
+
process.exitCode = reinstall();
|
|
3831
|
+
}
|
|
3832
|
+
};
|
|
3833
|
+
|
|
3834
|
+
// src/xy/install/staticsCommand.ts
|
|
3835
|
+
var staticsCommand = {
|
|
3836
|
+
command: "statics",
|
|
3837
|
+
describe: "Statics - Confirming Static Packages",
|
|
3838
|
+
handler: (argv) => {
|
|
3839
|
+
if (argv.verbose) console.log("Statics");
|
|
3840
|
+
process.exitCode = statics();
|
|
3841
|
+
}
|
|
3842
|
+
};
|
|
3843
|
+
|
|
3844
|
+
// src/xy/install/upCommand.ts
|
|
3845
|
+
var upCommand = {
|
|
3846
|
+
command: "up",
|
|
3847
|
+
describe: "Up - Update dependencies",
|
|
3848
|
+
handler: (argv) => {
|
|
3849
|
+
if (argv.verbose) console.log("Up");
|
|
3850
|
+
process.exitCode = up();
|
|
3851
|
+
}
|
|
3852
|
+
};
|
|
3853
|
+
|
|
3854
|
+
// src/xy/install/updoCommand.ts
|
|
3855
|
+
var updoCommand = {
|
|
3856
|
+
command: "updo",
|
|
3857
|
+
describe: "Updo - Update dependencies [Interactive]",
|
|
3858
|
+
handler: (argv) => {
|
|
3859
|
+
if (argv.verbose) console.log("Updo");
|
|
3860
|
+
process.exitCode = updo();
|
|
3861
|
+
}
|
|
3491
3862
|
};
|
|
3492
3863
|
|
|
3493
|
-
// src/xy/
|
|
3864
|
+
// src/xy/install/index.ts
|
|
3494
3865
|
var xyInstallCommands = (args) => {
|
|
3495
|
-
return args.command(
|
|
3496
|
-
"clean [package]",
|
|
3497
|
-
"Clean",
|
|
3498
|
-
(yargs2) => {
|
|
3499
|
-
return yargs2.positional("package", { describe: "Specific package to clean" });
|
|
3500
|
-
},
|
|
3501
|
-
async (argv) => {
|
|
3502
|
-
if (argv.verbose) {
|
|
3503
|
-
console.log(`Cleaning: ${argv.package ?? "all"}`);
|
|
3504
|
-
}
|
|
3505
|
-
process.exitCode = await clean({
|
|
3506
|
-
pkg: argv.package,
|
|
3507
|
-
verbose: !!argv.verbose
|
|
3508
|
-
});
|
|
3509
|
-
}
|
|
3510
|
-
).command(
|
|
3511
|
-
"reinstall",
|
|
3512
|
-
"Reinstall - Clean & Install",
|
|
3513
|
-
(yargs2) => {
|
|
3514
|
-
return yargs2;
|
|
3515
|
-
},
|
|
3516
|
-
(argv) => {
|
|
3517
|
-
if (argv.verbose) console.log("Reinstalling");
|
|
3518
|
-
process.exitCode = reinstall();
|
|
3519
|
-
}
|
|
3520
|
-
).command(
|
|
3521
|
-
"up",
|
|
3522
|
-
"Up - Update dependencies",
|
|
3523
|
-
(yargs2) => {
|
|
3524
|
-
return yargs2;
|
|
3525
|
-
},
|
|
3526
|
-
(argv) => {
|
|
3527
|
-
if (argv.verbose) console.log("Up");
|
|
3528
|
-
process.exitCode = up();
|
|
3529
|
-
}
|
|
3530
|
-
).command(
|
|
3531
|
-
"updo",
|
|
3532
|
-
"Updo - Update dependencies [Interactive]",
|
|
3533
|
-
(yargs2) => {
|
|
3534
|
-
return yargs2;
|
|
3535
|
-
},
|
|
3536
|
-
(argv) => {
|
|
3537
|
-
if (argv.verbose) console.log("Updo");
|
|
3538
|
-
process.exitCode = updo();
|
|
3539
|
-
}
|
|
3540
|
-
).command(
|
|
3541
|
-
"statics",
|
|
3542
|
-
"Statics - Confirming Static Packages",
|
|
3543
|
-
(yargs2) => {
|
|
3544
|
-
return yargs2;
|
|
3545
|
-
},
|
|
3546
|
-
(argv) => {
|
|
3547
|
-
if (argv.verbose) console.log("Statics");
|
|
3548
|
-
process.exitCode = statics();
|
|
3549
|
-
}
|
|
3550
|
-
).command(
|
|
3551
|
-
"dupdeps",
|
|
3552
|
-
"Dupdeps - Duplicate Dependencies in package.json",
|
|
3553
|
-
(yargs2) => {
|
|
3554
|
-
return yargs2;
|
|
3555
|
-
},
|
|
3556
|
-
(argv) => {
|
|
3557
|
-
if (argv.verbose) console.log("Dupdeps");
|
|
3558
|
-
process.exitCode = dupdeps();
|
|
3559
|
-
}
|
|
3560
|
-
);
|
|
3866
|
+
return args.command(cleanCommand).command(reinstallCommand).command(upCommand).command(updoCommand).command(staticsCommand).command(dupdepsCommand);
|
|
3561
3867
|
};
|
|
3562
3868
|
|
|
3563
|
-
// src/xy/
|
|
3564
|
-
import
|
|
3869
|
+
// src/xy/lint/cycleCommand.ts
|
|
3870
|
+
import chalk43 from "chalk";
|
|
3871
|
+
var cycleCommand = {
|
|
3872
|
+
command: "cycle [package]",
|
|
3873
|
+
describe: "Cycle - Check for dependency cycles",
|
|
3874
|
+
builder: (yargs2) => {
|
|
3875
|
+
return packagePositionalParam(yargs2);
|
|
3876
|
+
},
|
|
3877
|
+
handler: async (argv) => {
|
|
3878
|
+
const start = Date.now();
|
|
3879
|
+
if (argv.verbose) console.log("Cycle");
|
|
3880
|
+
process.exitCode = await cycle({ pkg: argv.package });
|
|
3881
|
+
console.log(chalk43.blue(`Finished in ${Date.now() - start}ms`));
|
|
3882
|
+
}
|
|
3883
|
+
};
|
|
3884
|
+
|
|
3885
|
+
// src/xy/lint/deplintCommand.ts
|
|
3886
|
+
import chalk44 from "chalk";
|
|
3887
|
+
var deplintCommand = {
|
|
3888
|
+
command: "deplint [package]",
|
|
3889
|
+
describe: "Deplint - Run Deplint",
|
|
3890
|
+
builder: (yargs2) => {
|
|
3891
|
+
return packagePositionalParam(yargs2).option("deps", {
|
|
3892
|
+
alias: "d",
|
|
3893
|
+
default: false,
|
|
3894
|
+
description: "Check dependencies",
|
|
3895
|
+
type: "boolean"
|
|
3896
|
+
}).option("devDeps", {
|
|
3897
|
+
alias: "v",
|
|
3898
|
+
default: false,
|
|
3899
|
+
description: "Check devDependencies",
|
|
3900
|
+
type: "boolean"
|
|
3901
|
+
}).option("peerDeps", {
|
|
3902
|
+
alias: "p",
|
|
3903
|
+
default: false,
|
|
3904
|
+
description: "Check peerDependencies",
|
|
3905
|
+
type: "boolean"
|
|
3906
|
+
}).option("exclude", {
|
|
3907
|
+
alias: "e",
|
|
3908
|
+
description: "Package names to exclude from unused checks (comma-separated or repeated)",
|
|
3909
|
+
type: "array"
|
|
3910
|
+
});
|
|
3911
|
+
},
|
|
3912
|
+
handler: async (argv) => {
|
|
3913
|
+
if (argv.verbose) console.log("Deplint");
|
|
3914
|
+
const start = Date.now();
|
|
3915
|
+
const cliExclude = argv.exclude?.flatMap((v) => String(v).split(",")).map((v) => v.trim()).filter(Boolean);
|
|
3916
|
+
process.exitCode = await deplint({
|
|
3917
|
+
cliExclude,
|
|
3918
|
+
pkg: argv.package,
|
|
3919
|
+
deps: !!argv.deps,
|
|
3920
|
+
devDeps: !!argv.devDeps,
|
|
3921
|
+
peerDeps: !!argv.peerDeps,
|
|
3922
|
+
verbose: !!argv.verbose
|
|
3923
|
+
});
|
|
3924
|
+
console.log(chalk44.blue(`Finished in ${Date.now() - start}ms`));
|
|
3925
|
+
}
|
|
3926
|
+
};
|
|
3927
|
+
|
|
3928
|
+
// src/xy/lint/fixCommand.ts
|
|
3929
|
+
import chalk45 from "chalk";
|
|
3930
|
+
var fixCommand = {
|
|
3931
|
+
command: "fix [package]",
|
|
3932
|
+
describe: "Fix - Run Eslint w/fix",
|
|
3933
|
+
builder: (yargs2) => {
|
|
3934
|
+
return packagePositionalParam(yargs2);
|
|
3935
|
+
},
|
|
3936
|
+
handler: (argv) => {
|
|
3937
|
+
const start = Date.now();
|
|
3938
|
+
if (argv.verbose) console.log("Fix");
|
|
3939
|
+
process.exitCode = fix();
|
|
3940
|
+
console.log(chalk45.blue(`Finished in ${Date.now() - start}ms`));
|
|
3941
|
+
}
|
|
3942
|
+
};
|
|
3943
|
+
|
|
3944
|
+
// src/xy/lint/knipCommand.ts
|
|
3945
|
+
import chalk46 from "chalk";
|
|
3946
|
+
var knipCommand = {
|
|
3947
|
+
command: "knip",
|
|
3948
|
+
describe: "Knip - Run Knip",
|
|
3949
|
+
builder: (yargs2) => {
|
|
3950
|
+
return packagePositionalParam(yargs2);
|
|
3951
|
+
},
|
|
3952
|
+
handler: (argv) => {
|
|
3953
|
+
if (argv.verbose) console.log("Knip");
|
|
3954
|
+
const start = Date.now();
|
|
3955
|
+
process.exitCode = knip();
|
|
3956
|
+
console.log(chalk46.blue(`Knip finished in ${Date.now() - start}ms`));
|
|
3957
|
+
}
|
|
3958
|
+
};
|
|
3959
|
+
|
|
3960
|
+
// src/xy/lint/lintCommand.ts
|
|
3961
|
+
import chalk47 from "chalk";
|
|
3962
|
+
var lintCommand = {
|
|
3963
|
+
command: "lint [package]",
|
|
3964
|
+
describe: "Lint - Run Eslint",
|
|
3965
|
+
builder: (yargs2) => {
|
|
3966
|
+
return packagePositionalParam(yargs2).option("fix", {
|
|
3967
|
+
alias: "f",
|
|
3968
|
+
default: false,
|
|
3969
|
+
description: "Fix fixable issues",
|
|
3970
|
+
type: "boolean"
|
|
3971
|
+
}).option("cache", {
|
|
3972
|
+
alias: "c",
|
|
3973
|
+
default: false,
|
|
3974
|
+
description: "Use caching for performance",
|
|
3975
|
+
type: "boolean"
|
|
3976
|
+
});
|
|
3977
|
+
},
|
|
3978
|
+
handler: (argv) => {
|
|
3979
|
+
if (argv.verbose) console.log("Lint");
|
|
3980
|
+
const start = Date.now();
|
|
3981
|
+
process.exitCode = argv.fix ? fix({
|
|
3982
|
+
pkg: argv.package,
|
|
3983
|
+
cache: argv.cache,
|
|
3984
|
+
verbose: !!argv.verbose
|
|
3985
|
+
}) : lint({
|
|
3986
|
+
pkg: argv.package,
|
|
3987
|
+
cache: argv.cache,
|
|
3988
|
+
verbose: !!argv.verbose
|
|
3989
|
+
});
|
|
3990
|
+
console.log(chalk47.blue(`Finished in ${Date.now() - start}ms`));
|
|
3991
|
+
}
|
|
3992
|
+
};
|
|
3993
|
+
|
|
3994
|
+
// src/xy/lint/publintCommand.ts
|
|
3995
|
+
import chalk48 from "chalk";
|
|
3996
|
+
var publintCommand = {
|
|
3997
|
+
command: "publint [package]",
|
|
3998
|
+
describe: "Publint - Run Publint",
|
|
3999
|
+
builder: (yargs2) => {
|
|
4000
|
+
return packagePositionalParam(yargs2);
|
|
4001
|
+
},
|
|
4002
|
+
handler: async (argv) => {
|
|
4003
|
+
if (argv.verbose) console.log("Publint");
|
|
4004
|
+
const start = Date.now();
|
|
4005
|
+
process.exitCode = await publint({ pkg: argv.package, verbose: !!argv.verbose });
|
|
4006
|
+
console.log(chalk48.blue(`Finished in ${Date.now() - start}ms`));
|
|
4007
|
+
}
|
|
4008
|
+
};
|
|
4009
|
+
|
|
4010
|
+
// src/xy/lint/relintCommand.ts
|
|
4011
|
+
import chalk49 from "chalk";
|
|
4012
|
+
var relintCommand = {
|
|
4013
|
+
command: "relint [package]",
|
|
4014
|
+
describe: "Relint - Clean & Lint",
|
|
4015
|
+
builder: (yargs2) => {
|
|
4016
|
+
return packagePositionalParam(yargs2);
|
|
4017
|
+
},
|
|
4018
|
+
handler: (argv) => {
|
|
4019
|
+
if (argv.verbose) console.log("Relinting");
|
|
4020
|
+
const start = Date.now();
|
|
4021
|
+
process.exitCode = relint();
|
|
4022
|
+
console.log(chalk49.blue(`Finished in ${Date.now() - start}ms`));
|
|
4023
|
+
}
|
|
4024
|
+
};
|
|
4025
|
+
|
|
4026
|
+
// src/xy/lint/sonarCommand.ts
|
|
4027
|
+
import chalk50 from "chalk";
|
|
4028
|
+
var sonarCommand = {
|
|
4029
|
+
command: "sonar",
|
|
4030
|
+
describe: "Sonar - Run Sonar Check",
|
|
4031
|
+
builder: (yargs2) => {
|
|
4032
|
+
return packagePositionalParam(yargs2);
|
|
4033
|
+
},
|
|
4034
|
+
handler: (argv) => {
|
|
4035
|
+
const start = Date.now();
|
|
4036
|
+
if (argv.verbose) console.log("Sonar Check");
|
|
4037
|
+
process.exitCode = sonar();
|
|
4038
|
+
console.log(chalk50.blue(`Finished in ${Date.now() - start}ms`));
|
|
4039
|
+
}
|
|
4040
|
+
};
|
|
4041
|
+
|
|
4042
|
+
// src/xy/lint/index.ts
|
|
3565
4043
|
var xyLintCommands = (args) => {
|
|
3566
|
-
return args.command(
|
|
3567
|
-
"cycle [package]",
|
|
3568
|
-
"Cycle - Check for dependency cycles",
|
|
3569
|
-
(yargs2) => {
|
|
3570
|
-
return packagePositionalParam(yargs2);
|
|
3571
|
-
},
|
|
3572
|
-
async (argv) => {
|
|
3573
|
-
const start = Date.now();
|
|
3574
|
-
if (argv.verbose) console.log("Cycle");
|
|
3575
|
-
process.exitCode = await cycle({ pkg: argv.package });
|
|
3576
|
-
console.log(chalk42.blue(`Finished in ${Date.now() - start}ms`));
|
|
3577
|
-
}
|
|
3578
|
-
).command(
|
|
3579
|
-
"lint [package]",
|
|
3580
|
-
"Lint - Run Eslint",
|
|
3581
|
-
(yargs2) => {
|
|
3582
|
-
return packagePositionalParam(yargs2).option("fix", {
|
|
3583
|
-
alias: "f",
|
|
3584
|
-
default: false,
|
|
3585
|
-
description: "Fix fixable issues",
|
|
3586
|
-
type: "boolean"
|
|
3587
|
-
}).option("cache", {
|
|
3588
|
-
alias: "c",
|
|
3589
|
-
default: false,
|
|
3590
|
-
description: "Use caching for performance",
|
|
3591
|
-
type: "boolean"
|
|
3592
|
-
});
|
|
3593
|
-
},
|
|
3594
|
-
(argv) => {
|
|
3595
|
-
if (argv.verbose) console.log("Lint");
|
|
3596
|
-
const start = Date.now();
|
|
3597
|
-
process.exitCode = argv.fix ? fix({
|
|
3598
|
-
pkg: argv.package,
|
|
3599
|
-
cache: argv.cache,
|
|
3600
|
-
verbose: !!argv.verbose
|
|
3601
|
-
}) : lint({
|
|
3602
|
-
pkg: argv.package,
|
|
3603
|
-
cache: argv.cache,
|
|
3604
|
-
verbose: !!argv.verbose
|
|
3605
|
-
});
|
|
3606
|
-
console.log(chalk42.blue(`Finished in ${Date.now() - start}ms`));
|
|
3607
|
-
}
|
|
3608
|
-
).command(
|
|
3609
|
-
"deplint [package]",
|
|
3610
|
-
"Deplint - Run Deplint",
|
|
3611
|
-
(yargs2) => {
|
|
3612
|
-
return packagePositionalParam(yargs2).option("deps", {
|
|
3613
|
-
alias: "d",
|
|
3614
|
-
default: false,
|
|
3615
|
-
description: "Check dependencies",
|
|
3616
|
-
type: "boolean"
|
|
3617
|
-
}).option("devDeps", {
|
|
3618
|
-
alias: "v",
|
|
3619
|
-
default: false,
|
|
3620
|
-
description: "Check devDependencies",
|
|
3621
|
-
type: "boolean"
|
|
3622
|
-
}).option("peerDeps", {
|
|
3623
|
-
alias: "p",
|
|
3624
|
-
default: false,
|
|
3625
|
-
description: "Check peerDependencies",
|
|
3626
|
-
type: "boolean"
|
|
3627
|
-
}).option("exclude", {
|
|
3628
|
-
alias: "e",
|
|
3629
|
-
description: "Package names to exclude from unused checks (comma-separated or repeated)",
|
|
3630
|
-
type: "array"
|
|
3631
|
-
});
|
|
3632
|
-
},
|
|
3633
|
-
async (argv) => {
|
|
3634
|
-
if (argv.verbose) console.log("Deplint");
|
|
3635
|
-
const start = Date.now();
|
|
3636
|
-
const cliExclude = argv.exclude?.flatMap((v) => String(v).split(",")).map((v) => v.trim()).filter(Boolean);
|
|
3637
|
-
process.exitCode = await deplint({
|
|
3638
|
-
cliExclude,
|
|
3639
|
-
pkg: argv.package,
|
|
3640
|
-
deps: !!argv.deps,
|
|
3641
|
-
devDeps: !!argv.devDeps,
|
|
3642
|
-
peerDeps: !!argv.peerDeps,
|
|
3643
|
-
verbose: !!argv.verbose
|
|
3644
|
-
});
|
|
3645
|
-
console.log(chalk42.blue(`Finished in ${Date.now() - start}ms`));
|
|
3646
|
-
}
|
|
3647
|
-
).command(
|
|
3648
|
-
"fix [package]",
|
|
3649
|
-
"Fix - Run Eslint w/fix",
|
|
3650
|
-
(yargs2) => {
|
|
3651
|
-
return packagePositionalParam(yargs2);
|
|
3652
|
-
},
|
|
3653
|
-
(argv) => {
|
|
3654
|
-
const start = Date.now();
|
|
3655
|
-
if (argv.verbose) console.log("Fix");
|
|
3656
|
-
process.exitCode = fix();
|
|
3657
|
-
console.log(chalk42.blue(`Finished in ${Date.now() - start}ms`));
|
|
3658
|
-
}
|
|
3659
|
-
).command(
|
|
3660
|
-
"relint [package]",
|
|
3661
|
-
"Relint - Clean & Lint",
|
|
3662
|
-
(yargs2) => {
|
|
3663
|
-
return packagePositionalParam(yargs2);
|
|
3664
|
-
},
|
|
3665
|
-
(argv) => {
|
|
3666
|
-
if (argv.verbose) console.log("Relinting");
|
|
3667
|
-
const start = Date.now();
|
|
3668
|
-
process.exitCode = relint();
|
|
3669
|
-
console.log(chalk42.blue(`Finished in ${Date.now() - start}ms`));
|
|
3670
|
-
}
|
|
3671
|
-
).command(
|
|
3672
|
-
"publint [package]",
|
|
3673
|
-
"Publint - Run Publint",
|
|
3674
|
-
(yargs2) => {
|
|
3675
|
-
return packagePositionalParam(yargs2);
|
|
3676
|
-
},
|
|
3677
|
-
async (argv) => {
|
|
3678
|
-
if (argv.verbose) console.log("Publint");
|
|
3679
|
-
const start = Date.now();
|
|
3680
|
-
process.exitCode = await publint({ pkg: argv.package, verbose: !!argv.verbose });
|
|
3681
|
-
console.log(chalk42.blue(`Finished in ${Date.now() - start}ms`));
|
|
3682
|
-
}
|
|
3683
|
-
).command(
|
|
3684
|
-
"knip",
|
|
3685
|
-
"Knip - Run Knip",
|
|
3686
|
-
(yargs2) => {
|
|
3687
|
-
return packagePositionalParam(yargs2);
|
|
3688
|
-
},
|
|
3689
|
-
(argv) => {
|
|
3690
|
-
if (argv.verbose) console.log("Knip");
|
|
3691
|
-
const start = Date.now();
|
|
3692
|
-
process.exitCode = knip();
|
|
3693
|
-
console.log(chalk42.blue(`Knip finished in ${Date.now() - start}ms`));
|
|
3694
|
-
}
|
|
3695
|
-
).command(
|
|
3696
|
-
"sonar",
|
|
3697
|
-
"Sonar - Run Sonar Check",
|
|
3698
|
-
(yargs2) => {
|
|
3699
|
-
return packagePositionalParam(yargs2);
|
|
3700
|
-
},
|
|
3701
|
-
(argv) => {
|
|
3702
|
-
const start = Date.now();
|
|
3703
|
-
if (argv.verbose) console.log("Sonar Check");
|
|
3704
|
-
process.exitCode = sonar();
|
|
3705
|
-
console.log(chalk42.blue(`Finished in ${Date.now() - start}ms`));
|
|
3706
|
-
}
|
|
3707
|
-
);
|
|
4044
|
+
return args.command(cycleCommand).command(lintCommand).command(deplintCommand).command(fixCommand).command(relintCommand).command(publintCommand).command(knipCommand).command(sonarCommand);
|
|
3708
4045
|
};
|
|
3709
4046
|
|
|
4047
|
+
// src/xy/xy.ts
|
|
4048
|
+
import chalk51 from "chalk";
|
|
4049
|
+
|
|
3710
4050
|
// src/xy/xyParseOptions.ts
|
|
3711
4051
|
import yargs from "yargs";
|
|
3712
4052
|
import { hideBin } from "yargs/helpers";
|
|
@@ -3738,17 +4078,21 @@ var xyParseOptions = () => {
|
|
|
3738
4078
|
var xy = async () => {
|
|
3739
4079
|
const options = xyParseOptions();
|
|
3740
4080
|
return await xyBuildCommands(xyCommonCommands(xyInstallCommands(xyDeployCommands(xyLintCommands(options))))).demandCommand(1).command("*", "", () => {
|
|
3741
|
-
console.error(
|
|
3742
|
-
console.log(
|
|
4081
|
+
console.error(chalk51.yellow(`Command not found [${chalk51.magenta(process.argv[2])}]`));
|
|
4082
|
+
console.log(chalk51.gray("Try 'yarn xy --help' for list of commands"));
|
|
3743
4083
|
}).version().help().argv;
|
|
3744
4084
|
};
|
|
3745
4085
|
export {
|
|
3746
4086
|
CROSS_PLATFORM_NEWLINE,
|
|
4087
|
+
DEFAULT_README_BODY,
|
|
4088
|
+
DEFAULT_README_TEMPLATE,
|
|
3747
4089
|
DuplicateDetector,
|
|
3748
4090
|
INIT_CWD,
|
|
3749
4091
|
WINDOWS_NEWLINE_REGEX,
|
|
3750
4092
|
XYLABS_COMMANDS_PREFIX,
|
|
3751
4093
|
XYLABS_RULES_PREFIX,
|
|
4094
|
+
XYLABS_SKILLS_PREFIX,
|
|
4095
|
+
applyLogoConfig,
|
|
3752
4096
|
build,
|
|
3753
4097
|
bundleDts,
|
|
3754
4098
|
checkResult,
|
|
@@ -3758,6 +4102,8 @@ export {
|
|
|
3758
4102
|
claudeMdRuleTemplates,
|
|
3759
4103
|
claudeRules,
|
|
3760
4104
|
claudeSettings,
|
|
4105
|
+
claudeSkillTemplates,
|
|
4106
|
+
claudeSkills,
|
|
3761
4107
|
clean,
|
|
3762
4108
|
cleanAll,
|
|
3763
4109
|
cleanDocs,
|
|
@@ -3824,6 +4170,7 @@ export {
|
|
|
3824
4170
|
readLines,
|
|
3825
4171
|
readNonEmptyLines,
|
|
3826
4172
|
readmeGen,
|
|
4173
|
+
readmeInit,
|
|
3827
4174
|
rebuild,
|
|
3828
4175
|
recompile,
|
|
3829
4176
|
recompileAll,
|
|
@@ -3832,6 +4179,7 @@ export {
|
|
|
3832
4179
|
relint,
|
|
3833
4180
|
relintAllPackages,
|
|
3834
4181
|
relintPackage,
|
|
4182
|
+
resolveTemplatePath,
|
|
3835
4183
|
retest,
|
|
3836
4184
|
runStepAsync,
|
|
3837
4185
|
runSteps,
|
|
@@ -3840,6 +4188,7 @@ export {
|
|
|
3840
4188
|
runXyWithWarning,
|
|
3841
4189
|
safeExit,
|
|
3842
4190
|
safeExitAsync,
|
|
4191
|
+
scaffoldTemplate,
|
|
3843
4192
|
sonar,
|
|
3844
4193
|
statics,
|
|
3845
4194
|
test,
|