@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/actions/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/deleteGlob.ts
|
|
@@ -323,10 +346,19 @@ var generateIgnoreFiles = (filename3, pkg) => {
|
|
|
323
346
|
|
|
324
347
|
// src/lib/generateReadmeFiles.ts
|
|
325
348
|
import { execSync as execSync2 } from "child_process";
|
|
326
|
-
import FS from "fs";
|
|
327
|
-
import {
|
|
349
|
+
import FS, { readFileSync as readFileSync3 } from "fs";
|
|
350
|
+
import {
|
|
351
|
+
mkdir,
|
|
352
|
+
readFile,
|
|
353
|
+
writeFile
|
|
354
|
+
} from "fs/promises";
|
|
355
|
+
import { createRequire as createRequire2 } from "module";
|
|
328
356
|
import PATH2 from "path";
|
|
357
|
+
import { createInterface } from "readline";
|
|
329
358
|
import chalk5 from "chalk";
|
|
359
|
+
var require3 = createRequire2(import.meta.url);
|
|
360
|
+
var packageRoot2 = PATH2.dirname(require3.resolve("@xylabs/ts-scripts-yarn3/package.json"));
|
|
361
|
+
var readmeTemplatesDir = PATH2.resolve(packageRoot2, "templates", "readme");
|
|
330
362
|
function fillTemplate(template, data) {
|
|
331
363
|
const additionalData = { ...data, safeName: data.name.replaceAll("/", "__").replaceAll("@", "") };
|
|
332
364
|
return template.replaceAll(/\{\{(.*?)\}\}/g, (_, key) => additionalData[key.trim()] ?? "");
|
|
@@ -416,37 +448,120 @@ ${indent}### ${item.name}
|
|
|
416
448
|
}
|
|
417
449
|
return content;
|
|
418
450
|
}
|
|
451
|
+
function askConfirmation(question) {
|
|
452
|
+
const rl = createInterface({ input: process.stdin, output: process.stdout });
|
|
453
|
+
return new Promise((resolve) => {
|
|
454
|
+
rl.question(question, (answer) => {
|
|
455
|
+
rl.close();
|
|
456
|
+
resolve(answer.toLowerCase() === "y" || answer.toLowerCase() === "yes");
|
|
457
|
+
});
|
|
458
|
+
});
|
|
459
|
+
}
|
|
460
|
+
var DEFAULT_README_TEMPLATE = readFileSync3(PATH2.resolve(readmeTemplatesDir, "README.template.md"), "utf8");
|
|
461
|
+
var DEFAULT_README_BODY = readFileSync3(PATH2.resolve(readmeTemplatesDir, "README.body.md"), "utf8");
|
|
462
|
+
function applyLogoConfig(template, logoUrl, logoLinkUrl) {
|
|
463
|
+
let result = template;
|
|
464
|
+
if (logoUrl) {
|
|
465
|
+
result = result.replace(/\[logo]: .+/, `[logo]: ${logoUrl}`);
|
|
466
|
+
if (logoLinkUrl) {
|
|
467
|
+
result = result.replace(/\[!\[logo]\[]][^)]*\)/, `[![logo][]](${logoLinkUrl})`);
|
|
468
|
+
}
|
|
469
|
+
} else {
|
|
470
|
+
result = result.replace(/\[!\[logo]\[]][^\n]*\n*/, "");
|
|
471
|
+
result = result.replace(/\[logo]: [^\n]*\n?/, "");
|
|
472
|
+
}
|
|
473
|
+
return result;
|
|
474
|
+
}
|
|
475
|
+
function resolveTemplatePath(templatePath) {
|
|
476
|
+
const cwd5 = INIT_CWD() ?? ".";
|
|
477
|
+
return templatePath ?? PATH2.join(cwd5, ".xy", "README.template.md");
|
|
478
|
+
}
|
|
479
|
+
async function loadOrCreateTemplate(resolvedTemplatePath) {
|
|
480
|
+
try {
|
|
481
|
+
const template = await readFile(resolvedTemplatePath, "utf8");
|
|
482
|
+
return { created: false, template };
|
|
483
|
+
} catch {
|
|
484
|
+
console.log(chalk5.yellow(`Template not found: ${resolvedTemplatePath}`));
|
|
485
|
+
const shouldCreate = await askConfirmation("Would you like to create a stock template? (y/N) ");
|
|
486
|
+
if (!shouldCreate) {
|
|
487
|
+
throw new Error("Template creation declined");
|
|
488
|
+
}
|
|
489
|
+
const template = DEFAULT_README_TEMPLATE;
|
|
490
|
+
await scaffoldTemplate(resolvedTemplatePath, template);
|
|
491
|
+
return { created: true, template };
|
|
492
|
+
}
|
|
493
|
+
}
|
|
494
|
+
async function scaffoldTemplate(resolvedTemplatePath, template) {
|
|
495
|
+
const xyDir = PATH2.dirname(resolvedTemplatePath);
|
|
496
|
+
await mkdir(xyDir, { recursive: true });
|
|
497
|
+
await writeFile(resolvedTemplatePath, template);
|
|
498
|
+
console.log(chalk5.green(`Created template: ${resolvedTemplatePath}`));
|
|
499
|
+
const bodyPath = PATH2.join(xyDir, "README.body.md");
|
|
500
|
+
await writeFile(bodyPath, DEFAULT_README_BODY);
|
|
501
|
+
console.log(chalk5.green(`Created body template: ${bodyPath}`));
|
|
502
|
+
}
|
|
503
|
+
async function resolveBody(location, defaultBody) {
|
|
504
|
+
const localBodyPath = PATH2.join(location, "README.body.md");
|
|
505
|
+
try {
|
|
506
|
+
return await readFile(localBodyPath, "utf8");
|
|
507
|
+
} catch {
|
|
508
|
+
return defaultBody;
|
|
509
|
+
}
|
|
510
|
+
}
|
|
511
|
+
async function generateReadmeForWorkspace(location, name, template, defaultBody, typedoc, verbose) {
|
|
512
|
+
try {
|
|
513
|
+
const pkgJsonPath = PATH2.join(location, "package.json");
|
|
514
|
+
const pkgJson = JSON.parse(await readFile(pkgJsonPath, "utf8"));
|
|
515
|
+
const body = await resolveBody(location, defaultBody);
|
|
516
|
+
const typedocContent = typedoc ? generateTypedoc(location, ["src/index*.ts"]) : "";
|
|
517
|
+
const readmeContent = fillTemplate(template, {
|
|
518
|
+
...pkgJson,
|
|
519
|
+
body,
|
|
520
|
+
typedoc: typedocContent
|
|
521
|
+
});
|
|
522
|
+
await writeFile(PATH2.join(location, "README.md"), readmeContent);
|
|
523
|
+
if (verbose) console.log(chalk5.green(` ${name}`));
|
|
524
|
+
return true;
|
|
525
|
+
} catch (ex) {
|
|
526
|
+
const error = ex;
|
|
527
|
+
console.warn(chalk5.yellow(` Skipped ${location}: ${error.message}`));
|
|
528
|
+
return false;
|
|
529
|
+
}
|
|
530
|
+
}
|
|
419
531
|
async function generateReadmeFiles({
|
|
532
|
+
logoLinkUrl,
|
|
533
|
+
logoUrl,
|
|
420
534
|
pkg,
|
|
421
535
|
templatePath,
|
|
422
536
|
typedoc = false,
|
|
423
|
-
verbose
|
|
537
|
+
verbose = false
|
|
424
538
|
}) {
|
|
425
539
|
console.log(chalk5.green("Generate README Files"));
|
|
426
|
-
const
|
|
427
|
-
const resolvedTemplatePath = templatePath ?? PATH2.join(cwd5, "scripts", "README.template.md");
|
|
540
|
+
const resolvedTemplatePath = resolveTemplatePath(templatePath);
|
|
428
541
|
let template;
|
|
542
|
+
let templateCreated;
|
|
429
543
|
try {
|
|
430
|
-
template = await
|
|
544
|
+
({ template, created: templateCreated } = await loadOrCreateTemplate(resolvedTemplatePath));
|
|
431
545
|
} catch {
|
|
432
|
-
console.error(chalk5.red(`Template not found: ${resolvedTemplatePath}`));
|
|
433
546
|
return 1;
|
|
434
547
|
}
|
|
435
|
-
|
|
548
|
+
template = applyLogoConfig(template, logoUrl, logoLinkUrl);
|
|
549
|
+
if (templateCreated) {
|
|
550
|
+
console.log(chalk5.green("Generating README files for all packages..."));
|
|
551
|
+
}
|
|
552
|
+
const xyDir = PATH2.dirname(resolvedTemplatePath);
|
|
553
|
+
const xyBodyPath = PATH2.join(xyDir, "README.body.md");
|
|
554
|
+
let defaultBody;
|
|
555
|
+
try {
|
|
556
|
+
defaultBody = await readFile(xyBodyPath, "utf8");
|
|
557
|
+
} catch {
|
|
558
|
+
defaultBody = DEFAULT_README_BODY;
|
|
559
|
+
}
|
|
560
|
+
const workspaces = pkg && !templateCreated ? [yarnWorkspace(pkg)] : yarnWorkspaces();
|
|
436
561
|
let failed = false;
|
|
437
562
|
for (const { location, name } of workspaces) {
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
const pkgJson = JSON.parse(await readFile(pkgJsonPath, "utf8"));
|
|
441
|
-
const typedocContent = typedoc ? generateTypedoc(location, ["src/index*.ts"]) : "";
|
|
442
|
-
const readmeContent = fillTemplate(template, { ...pkgJson, typedoc: typedocContent });
|
|
443
|
-
await writeFile(PATH2.join(location, "README.md"), readmeContent);
|
|
444
|
-
if (verbose) console.log(chalk5.green(` ${name}`));
|
|
445
|
-
} catch (ex) {
|
|
446
|
-
const error = ex;
|
|
447
|
-
console.warn(chalk5.yellow(` Skipped ${location}: ${error.message}`));
|
|
448
|
-
failed = true;
|
|
449
|
-
}
|
|
563
|
+
const success = await generateReadmeForWorkspace(location, name, template, defaultBody, typedoc, verbose);
|
|
564
|
+
if (!success) failed = true;
|
|
450
565
|
}
|
|
451
566
|
return failed ? 1 : 0;
|
|
452
567
|
}
|
|
@@ -473,10 +588,10 @@ var loadConfig = async (params) => {
|
|
|
473
588
|
};
|
|
474
589
|
|
|
475
590
|
// src/lib/parsedPackageJSON.ts
|
|
476
|
-
import { readFileSync as
|
|
591
|
+
import { readFileSync as readFileSync4 } from "fs";
|
|
477
592
|
var parsedPackageJSON = (path14) => {
|
|
478
593
|
const pathToPackageJSON = path14 ?? process.env.npm_package_json ?? "";
|
|
479
|
-
const packageJSON =
|
|
594
|
+
const packageJSON = readFileSync4(pathToPackageJSON).toString();
|
|
480
595
|
return JSON.parse(packageJSON);
|
|
481
596
|
};
|
|
482
597
|
|
|
@@ -591,7 +706,7 @@ import {
|
|
|
591
706
|
existsSync as existsSync4,
|
|
592
707
|
mkdirSync,
|
|
593
708
|
readdirSync as readdirSync2,
|
|
594
|
-
readFileSync as
|
|
709
|
+
readFileSync as readFileSync5,
|
|
595
710
|
unlinkSync,
|
|
596
711
|
writeFileSync as writeFileSync2
|
|
597
712
|
} from "fs";
|
|
@@ -604,7 +719,7 @@ var syncCommandFiles = (commandsDir) => {
|
|
|
604
719
|
let created = 0;
|
|
605
720
|
for (const [filename3, content] of Object.entries(templates)) {
|
|
606
721
|
const targetPath = PATH3.resolve(commandsDir, filename3);
|
|
607
|
-
const existing = existsSync4(targetPath) ?
|
|
722
|
+
const existing = existsSync4(targetPath) ? readFileSync5(targetPath, "utf8") : void 0;
|
|
608
723
|
if (existing === content) continue;
|
|
609
724
|
writeFileSync2(targetPath, content, "utf8");
|
|
610
725
|
if (existing) {
|
|
@@ -661,7 +776,7 @@ import {
|
|
|
661
776
|
existsSync as existsSync5,
|
|
662
777
|
mkdirSync as mkdirSync2,
|
|
663
778
|
readdirSync as readdirSync3,
|
|
664
|
-
readFileSync as
|
|
779
|
+
readFileSync as readFileSync6,
|
|
665
780
|
unlinkSync as unlinkSync2,
|
|
666
781
|
writeFileSync as writeFileSync3
|
|
667
782
|
} from "fs";
|
|
@@ -674,7 +789,7 @@ var syncRuleFiles = (rulesDir) => {
|
|
|
674
789
|
let created = 0;
|
|
675
790
|
for (const [filename3, content] of Object.entries(templates)) {
|
|
676
791
|
const targetPath = PATH4.resolve(rulesDir, filename3);
|
|
677
|
-
const existing = existsSync5(targetPath) ?
|
|
792
|
+
const existing = existsSync5(targetPath) ? readFileSync6(targetPath, "utf8") : void 0;
|
|
678
793
|
if (existing === content) continue;
|
|
679
794
|
writeFileSync3(targetPath, content, "utf8");
|
|
680
795
|
if (existing) {
|
|
@@ -746,7 +861,7 @@ import {
|
|
|
746
861
|
writeFileSync as writeFileSync4
|
|
747
862
|
} from "fs";
|
|
748
863
|
import PATH5 from "path";
|
|
749
|
-
import { createInterface } from "readline";
|
|
864
|
+
import { createInterface as createInterface2 } from "readline";
|
|
750
865
|
import chalk12 from "chalk";
|
|
751
866
|
var DEFAULT_SETTINGS = {
|
|
752
867
|
permissions: {
|
|
@@ -781,8 +896,8 @@ var DEFAULT_SETTINGS = {
|
|
|
781
896
|
]
|
|
782
897
|
}
|
|
783
898
|
};
|
|
784
|
-
function
|
|
785
|
-
const rl =
|
|
899
|
+
function askConfirmation2(question) {
|
|
900
|
+
const rl = createInterface2({ input: process.stdin, output: process.stdout });
|
|
786
901
|
return new Promise((resolve) => {
|
|
787
902
|
rl.question(question, (answer) => {
|
|
788
903
|
rl.close();
|
|
@@ -796,7 +911,7 @@ async function claudeSettings() {
|
|
|
796
911
|
const settingsPath = PATH5.resolve(claudeDir, "settings.local.json");
|
|
797
912
|
mkdirSync3(claudeDir, { recursive: true });
|
|
798
913
|
if (existsSync6(settingsPath)) {
|
|
799
|
-
const confirmed = await
|
|
914
|
+
const confirmed = await askConfirmation2(
|
|
800
915
|
chalk12.yellow(`${settingsPath} already exists. Replace it? (y/N) `)
|
|
801
916
|
);
|
|
802
917
|
if (!confirmed) {
|
|
@@ -810,6 +925,84 @@ async function claudeSettings() {
|
|
|
810
925
|
return 0;
|
|
811
926
|
}
|
|
812
927
|
|
|
928
|
+
// src/actions/claude-skills.ts
|
|
929
|
+
import {
|
|
930
|
+
existsSync as existsSync7,
|
|
931
|
+
mkdirSync as mkdirSync4,
|
|
932
|
+
readdirSync as readdirSync4,
|
|
933
|
+
readFileSync as readFileSync7,
|
|
934
|
+
rmSync,
|
|
935
|
+
statSync as statSync2,
|
|
936
|
+
writeFileSync as writeFileSync5
|
|
937
|
+
} from "fs";
|
|
938
|
+
import PATH6 from "path";
|
|
939
|
+
import chalk13 from "chalk";
|
|
940
|
+
var syncSkillFiles = (skillsDir) => {
|
|
941
|
+
const templates = claudeSkillTemplates();
|
|
942
|
+
const templateNames = new Set(Object.keys(templates));
|
|
943
|
+
let updated = 0;
|
|
944
|
+
let created = 0;
|
|
945
|
+
for (const [skillName, files] of Object.entries(templates)) {
|
|
946
|
+
const skillDir = PATH6.resolve(skillsDir, skillName);
|
|
947
|
+
mkdirSync4(skillDir, { recursive: true });
|
|
948
|
+
for (const [filename3, content] of Object.entries(files)) {
|
|
949
|
+
const targetPath = PATH6.resolve(skillDir, filename3);
|
|
950
|
+
mkdirSync4(PATH6.dirname(targetPath), { recursive: true });
|
|
951
|
+
const existing = existsSync7(targetPath) ? readFileSync7(targetPath, "utf8") : void 0;
|
|
952
|
+
if (existing === content) continue;
|
|
953
|
+
writeFileSync5(targetPath, content, "utf8");
|
|
954
|
+
if (existing) {
|
|
955
|
+
updated++;
|
|
956
|
+
} else {
|
|
957
|
+
created++;
|
|
958
|
+
}
|
|
959
|
+
}
|
|
960
|
+
}
|
|
961
|
+
return {
|
|
962
|
+
created,
|
|
963
|
+
templateNames,
|
|
964
|
+
updated
|
|
965
|
+
};
|
|
966
|
+
};
|
|
967
|
+
var removeStaleSkills = (skillsDir, templateNames) => {
|
|
968
|
+
const existingSkills = readdirSync4(skillsDir).filter(
|
|
969
|
+
(f) => f.startsWith(XYLABS_SKILLS_PREFIX) && statSync2(PATH6.resolve(skillsDir, f)).isDirectory()
|
|
970
|
+
);
|
|
971
|
+
let removed = 0;
|
|
972
|
+
for (const dir of existingSkills) {
|
|
973
|
+
if (!templateNames.has(dir)) {
|
|
974
|
+
rmSync(PATH6.resolve(skillsDir, dir), { recursive: true });
|
|
975
|
+
removed++;
|
|
976
|
+
}
|
|
977
|
+
}
|
|
978
|
+
return removed;
|
|
979
|
+
};
|
|
980
|
+
var logSkillsResult = (created, updated, removed) => {
|
|
981
|
+
if (created || updated || removed) {
|
|
982
|
+
const parts = [
|
|
983
|
+
created ? `${created} created` : "",
|
|
984
|
+
updated ? `${updated} updated` : "",
|
|
985
|
+
removed ? `${removed} removed` : ""
|
|
986
|
+
].filter(Boolean);
|
|
987
|
+
console.log(chalk13.green(`.claude/skills/${XYLABS_SKILLS_PREFIX}*/: ${parts.join(", ")}`));
|
|
988
|
+
} else {
|
|
989
|
+
console.log(chalk13.gray(`.claude/skills/${XYLABS_SKILLS_PREFIX}*/: already up to date`));
|
|
990
|
+
}
|
|
991
|
+
};
|
|
992
|
+
var claudeSkills = () => {
|
|
993
|
+
const cwd5 = INIT_CWD() ?? process.cwd();
|
|
994
|
+
const skillsDir = PATH6.resolve(cwd5, ".claude", "skills");
|
|
995
|
+
mkdirSync4(skillsDir, { recursive: true });
|
|
996
|
+
const {
|
|
997
|
+
created,
|
|
998
|
+
templateNames,
|
|
999
|
+
updated
|
|
1000
|
+
} = syncSkillFiles(skillsDir);
|
|
1001
|
+
const removed = removeStaleSkills(skillsDir, templateNames);
|
|
1002
|
+
logSkillsResult(created, updated, removed);
|
|
1003
|
+
return 0;
|
|
1004
|
+
};
|
|
1005
|
+
|
|
813
1006
|
// src/actions/clean.ts
|
|
814
1007
|
var clean = async ({ verbose, pkg }) => {
|
|
815
1008
|
return pkg ? await cleanPackage({ pkg, verbose }) : cleanAll({ verbose });
|
|
@@ -824,16 +1017,16 @@ var cleanAll = ({ verbose }) => {
|
|
|
824
1017
|
|
|
825
1018
|
// src/actions/clean-docs.ts
|
|
826
1019
|
import path from "path";
|
|
827
|
-
import
|
|
1020
|
+
import chalk14 from "chalk";
|
|
828
1021
|
var cleanDocs = () => {
|
|
829
1022
|
const pkgName = process.env.npm_package_name;
|
|
830
|
-
console.log(
|
|
1023
|
+
console.log(chalk14.green(`Cleaning Docs [${pkgName}]`));
|
|
831
1024
|
for (const { location } of yarnWorkspaces()) deleteGlob(path.join(location, "docs"));
|
|
832
1025
|
return 0;
|
|
833
1026
|
};
|
|
834
1027
|
|
|
835
1028
|
// src/actions/compile.ts
|
|
836
|
-
import
|
|
1029
|
+
import chalk15 from "chalk";
|
|
837
1030
|
var compile = ({
|
|
838
1031
|
verbose,
|
|
839
1032
|
target,
|
|
@@ -874,7 +1067,7 @@ var compileAll = ({
|
|
|
874
1067
|
const incrementalOptions = incremental ? ["--since", "-Ap", "--topological-dev"] : ["--parallel", "-Ap", "--topological-dev"];
|
|
875
1068
|
const jobsOptions = jobs ? ["-j", `${jobs}`] : [];
|
|
876
1069
|
if (jobs) {
|
|
877
|
-
console.log(
|
|
1070
|
+
console.log(chalk15.blue(`Jobs set to [${jobs}]`));
|
|
878
1071
|
}
|
|
879
1072
|
const result = runSteps(`Compile${incremental ? "-Incremental" : ""} [All]`, [
|
|
880
1073
|
["yarn", [
|
|
@@ -888,13 +1081,13 @@ var compileAll = ({
|
|
|
888
1081
|
...targetOptions
|
|
889
1082
|
]]
|
|
890
1083
|
]);
|
|
891
|
-
console.log(`${
|
|
1084
|
+
console.log(`${chalk15.gray("Compiled in")} [${chalk15.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk15.gray("seconds")}`);
|
|
892
1085
|
return result;
|
|
893
1086
|
};
|
|
894
1087
|
|
|
895
1088
|
// src/actions/copy-assets.ts
|
|
896
1089
|
import path2 from "path/posix";
|
|
897
|
-
import
|
|
1090
|
+
import chalk16 from "chalk";
|
|
898
1091
|
import cpy from "cpy";
|
|
899
1092
|
var copyPackageTargetAssets = async (target, name, location) => {
|
|
900
1093
|
try {
|
|
@@ -917,7 +1110,7 @@ var copyPackageTargetAssets = async (target, name, location) => {
|
|
|
917
1110
|
};
|
|
918
1111
|
var copyTargetAssets = async (target, pkg) => {
|
|
919
1112
|
const workspaces = yarnWorkspaces();
|
|
920
|
-
console.log(
|
|
1113
|
+
console.log(chalk16.green(`Copying Assets [${target.toUpperCase()}]`));
|
|
921
1114
|
const workspaceList = workspaces.filter(({ name }) => {
|
|
922
1115
|
return pkg === void 0 || name === pkg;
|
|
923
1116
|
});
|
|
@@ -1001,7 +1194,7 @@ var dead = () => {
|
|
|
1001
1194
|
};
|
|
1002
1195
|
|
|
1003
1196
|
// src/actions/deplint/deplint.ts
|
|
1004
|
-
import
|
|
1197
|
+
import chalk22 from "chalk";
|
|
1005
1198
|
|
|
1006
1199
|
// src/actions/deplint/findFiles.ts
|
|
1007
1200
|
import fs2 from "fs";
|
|
@@ -1206,7 +1399,7 @@ function getExternalImportsFromFiles({
|
|
|
1206
1399
|
|
|
1207
1400
|
// src/actions/deplint/checkPackage/getUnlistedDependencies.ts
|
|
1208
1401
|
import { builtinModules } from "module";
|
|
1209
|
-
import
|
|
1402
|
+
import chalk17 from "chalk";
|
|
1210
1403
|
function isRuntimeImportListed(imp, name, dependencies, peerDependencies) {
|
|
1211
1404
|
return dependencies.includes(imp) || imp === name || peerDependencies.includes(imp) || builtinModules.includes(imp);
|
|
1212
1405
|
}
|
|
@@ -1214,7 +1407,7 @@ function isTypeImportListed(imp, name, dependencies, devDependencies, peerDepend
|
|
|
1214
1407
|
return dependencies.includes(imp) || imp === name || dependencies.includes(`@types/${imp}`) || peerDependencies.includes(imp) || peerDependencies.includes(`@types/${imp}`) || devDependencies.includes(`@types/${imp}`) || builtinModules.includes(imp);
|
|
1215
1408
|
}
|
|
1216
1409
|
function logMissing(name, imp, importPaths) {
|
|
1217
|
-
console.log(`[${
|
|
1410
|
+
console.log(`[${chalk17.blue(name)}] Missing dependency in package.json: ${chalk17.red(imp)}`);
|
|
1218
1411
|
if (importPaths[imp]) {
|
|
1219
1412
|
console.log(` ${importPaths[imp].join("\n ")}`);
|
|
1220
1413
|
}
|
|
@@ -1243,7 +1436,7 @@ function getUnlistedDependencies({ name, location }, {
|
|
|
1243
1436
|
}
|
|
1244
1437
|
if (unlistedDependencies > 0) {
|
|
1245
1438
|
const packageLocation = `${location}/package.json`;
|
|
1246
|
-
console.log(` ${
|
|
1439
|
+
console.log(` ${chalk17.yellow(packageLocation)}
|
|
1247
1440
|
`);
|
|
1248
1441
|
}
|
|
1249
1442
|
return unlistedDependencies;
|
|
@@ -1251,7 +1444,7 @@ function getUnlistedDependencies({ name, location }, {
|
|
|
1251
1444
|
|
|
1252
1445
|
// src/actions/deplint/checkPackage/getUnlistedDevDependencies.ts
|
|
1253
1446
|
import { builtinModules as builtinModules2 } from "module";
|
|
1254
|
-
import
|
|
1447
|
+
import chalk18 from "chalk";
|
|
1255
1448
|
function getUnlistedDevDependencies({ name, location }, {
|
|
1256
1449
|
devDependencies,
|
|
1257
1450
|
dependencies,
|
|
@@ -1265,7 +1458,7 @@ function getUnlistedDevDependencies({ name, location }, {
|
|
|
1265
1458
|
for (const imp of externalAllImports) {
|
|
1266
1459
|
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)) {
|
|
1267
1460
|
unlistedDevDependencies++;
|
|
1268
|
-
console.log(`[${
|
|
1461
|
+
console.log(`[${chalk18.blue(name)}] Missing devDependency in package.json: ${chalk18.red(imp)}`);
|
|
1269
1462
|
if (allImportPaths[imp]) {
|
|
1270
1463
|
console.log(` ${allImportPaths[imp].join("\n ")}`);
|
|
1271
1464
|
}
|
|
@@ -1273,14 +1466,14 @@ function getUnlistedDevDependencies({ name, location }, {
|
|
|
1273
1466
|
}
|
|
1274
1467
|
if (unlistedDevDependencies > 0) {
|
|
1275
1468
|
const packageLocation = `${location}/package.json`;
|
|
1276
|
-
console.log(` ${
|
|
1469
|
+
console.log(` ${chalk18.yellow(packageLocation)}
|
|
1277
1470
|
`);
|
|
1278
1471
|
}
|
|
1279
1472
|
return unlistedDevDependencies;
|
|
1280
1473
|
}
|
|
1281
1474
|
|
|
1282
1475
|
// src/actions/deplint/checkPackage/getUnusedDependencies.ts
|
|
1283
|
-
import
|
|
1476
|
+
import chalk19 from "chalk";
|
|
1284
1477
|
function getUnusedDependencies({ name, location }, { dependencies }, {
|
|
1285
1478
|
externalDistImports,
|
|
1286
1479
|
externalDistTypeImports,
|
|
@@ -1292,22 +1485,22 @@ function getUnusedDependencies({ name, location }, { dependencies }, {
|
|
|
1292
1485
|
if (!externalDistImports.includes(dep) && !externalDistImports.includes(dep.replace(/^@types\//, "")) && !externalDistTypeImports.includes(dep) && !externalDistTypeImports.includes(dep.replace(/^@types\//, ""))) {
|
|
1293
1486
|
unusedDependencies++;
|
|
1294
1487
|
if (externalAllImports.includes(dep)) {
|
|
1295
|
-
console.log(`[${
|
|
1488
|
+
console.log(`[${chalk19.blue(name)}] dependency should be devDependency in package.json: ${chalk19.red(dep)}`);
|
|
1296
1489
|
} else {
|
|
1297
|
-
console.log(`[${
|
|
1490
|
+
console.log(`[${chalk19.blue(name)}] Unused dependency in package.json: ${chalk19.red(dep)}`);
|
|
1298
1491
|
}
|
|
1299
1492
|
}
|
|
1300
1493
|
}
|
|
1301
1494
|
if (unusedDependencies > 0) {
|
|
1302
1495
|
const packageLocation = `${location}/package.json`;
|
|
1303
|
-
console.log(` ${
|
|
1496
|
+
console.log(` ${chalk19.yellow(packageLocation)}
|
|
1304
1497
|
`);
|
|
1305
1498
|
}
|
|
1306
1499
|
return unusedDependencies;
|
|
1307
1500
|
}
|
|
1308
1501
|
|
|
1309
1502
|
// src/actions/deplint/checkPackage/getUnusedDevDependencies.ts
|
|
1310
|
-
import
|
|
1503
|
+
import chalk20 from "chalk";
|
|
1311
1504
|
|
|
1312
1505
|
// src/actions/deplint/getCliReferencedPackagesFromFiles.ts
|
|
1313
1506
|
import fs8 from "fs";
|
|
@@ -1591,19 +1784,19 @@ function getUnusedDevDependencies({ name, location }, {
|
|
|
1591
1784
|
if (dependencies.includes(dep) || peerDependencies.includes(dep)) continue;
|
|
1592
1785
|
if (!isDevDepUsed(dep, allImports, implicitDeps, requiredPeers, scriptRefs, cliRefs)) {
|
|
1593
1786
|
unusedDevDependencies++;
|
|
1594
|
-
console.log(`[${
|
|
1787
|
+
console.log(`[${chalk20.blue(name)}] Unused devDependency in package.json: ${chalk20.red(dep)}`);
|
|
1595
1788
|
}
|
|
1596
1789
|
}
|
|
1597
1790
|
if (unusedDevDependencies > 0) {
|
|
1598
1791
|
const packageLocation = `${location}/package.json`;
|
|
1599
|
-
console.log(` ${
|
|
1792
|
+
console.log(` ${chalk20.yellow(packageLocation)}
|
|
1600
1793
|
`);
|
|
1601
1794
|
}
|
|
1602
1795
|
return unusedDevDependencies;
|
|
1603
1796
|
}
|
|
1604
1797
|
|
|
1605
1798
|
// src/actions/deplint/checkPackage/getUnusedPeerDependencies.ts
|
|
1606
|
-
import
|
|
1799
|
+
import chalk21 from "chalk";
|
|
1607
1800
|
function getUnusedPeerDependencies({ name, location }, { peerDependencies, dependencies }, { externalDistImports, externalDistTypeImports }, exclude) {
|
|
1608
1801
|
let unusedDependencies = 0;
|
|
1609
1802
|
for (const dep of peerDependencies) {
|
|
@@ -1611,15 +1804,15 @@ function getUnusedPeerDependencies({ name, location }, { peerDependencies, depen
|
|
|
1611
1804
|
if (!externalDistImports.includes(dep) && !externalDistImports.includes(dep.replace(/^@types\//, "")) && !externalDistTypeImports.includes(dep) && !externalDistTypeImports.includes(dep.replace(/^@types\//, ""))) {
|
|
1612
1805
|
unusedDependencies++;
|
|
1613
1806
|
if (dependencies.includes(dep)) {
|
|
1614
|
-
console.log(`[${
|
|
1807
|
+
console.log(`[${chalk21.blue(name)}] Unused peerDependency [already a dependency] in package.json: ${chalk21.red(dep)}`);
|
|
1615
1808
|
} else {
|
|
1616
|
-
console.log(`[${
|
|
1809
|
+
console.log(`[${chalk21.blue(name)}] Unused peerDependency in package.json: ${chalk21.red(dep)}`);
|
|
1617
1810
|
}
|
|
1618
1811
|
}
|
|
1619
1812
|
}
|
|
1620
1813
|
if (unusedDependencies > 0) {
|
|
1621
1814
|
const packageLocation = `${location}/package.json`;
|
|
1622
|
-
console.log(` ${
|
|
1815
|
+
console.log(` ${chalk21.yellow(packageLocation)}
|
|
1623
1816
|
`);
|
|
1624
1817
|
}
|
|
1625
1818
|
return unusedDependencies;
|
|
@@ -1714,19 +1907,19 @@ var deplint = async ({
|
|
|
1714
1907
|
});
|
|
1715
1908
|
}
|
|
1716
1909
|
if (totalErrors > 0) {
|
|
1717
|
-
console.warn(`Deplint: Found ${
|
|
1910
|
+
console.warn(`Deplint: Found ${chalk22.red(totalErrors)} dependency problems. ${chalk22.red("\u2716")}`);
|
|
1718
1911
|
} else {
|
|
1719
|
-
console.info(`Deplint: Found no dependency problems. ${
|
|
1912
|
+
console.info(`Deplint: Found no dependency problems. ${chalk22.green("\u2714")}`);
|
|
1720
1913
|
}
|
|
1721
1914
|
return 0;
|
|
1722
1915
|
};
|
|
1723
1916
|
|
|
1724
1917
|
// src/actions/deploy.ts
|
|
1725
|
-
import { readFileSync as
|
|
1918
|
+
import { readFileSync as readFileSync8 } from "fs";
|
|
1726
1919
|
var privatePackageExcludeList = () => {
|
|
1727
1920
|
const possibleDeployablePackages = yarnWorkspaces().map((workspace) => [
|
|
1728
1921
|
workspace,
|
|
1729
|
-
JSON.parse(
|
|
1922
|
+
JSON.parse(readFileSync8(`${workspace.location}/package.json`, { encoding: "utf8" }))
|
|
1730
1923
|
]);
|
|
1731
1924
|
const privatePackages = possibleDeployablePackages.filter(([_, pkg]) => pkg.private).map(([workspace]) => workspace);
|
|
1732
1925
|
const excludeList = privatePackages.map((workspace) => `--exclude ${workspace.name}`);
|
|
@@ -1746,11 +1939,11 @@ var deploy = () => {
|
|
|
1746
1939
|
};
|
|
1747
1940
|
|
|
1748
1941
|
// src/actions/deploy-major.ts
|
|
1749
|
-
import { readFileSync as
|
|
1942
|
+
import { readFileSync as readFileSync9 } from "fs";
|
|
1750
1943
|
var privatePackageExcludeList2 = () => {
|
|
1751
1944
|
const possibleDeployablePackages = yarnWorkspaces().map((workspace) => [
|
|
1752
1945
|
workspace,
|
|
1753
|
-
JSON.parse(
|
|
1946
|
+
JSON.parse(readFileSync9(`${workspace.location}/package.json`, { encoding: "utf8" }))
|
|
1754
1947
|
]);
|
|
1755
1948
|
const privatePackages = possibleDeployablePackages.filter(([_, pkg]) => pkg.private).map(([workspace]) => workspace);
|
|
1756
1949
|
const excludeList = privatePackages.map((workspace) => `--exclude ${workspace.name}`);
|
|
@@ -1770,11 +1963,11 @@ var deployMajor = () => {
|
|
|
1770
1963
|
};
|
|
1771
1964
|
|
|
1772
1965
|
// src/actions/deploy-minor.ts
|
|
1773
|
-
import { readFileSync as
|
|
1966
|
+
import { readFileSync as readFileSync10 } from "fs";
|
|
1774
1967
|
var privatePackageExcludeList3 = () => {
|
|
1775
1968
|
const possibleDeployablePackages = yarnWorkspaces().map((workspace) => [
|
|
1776
1969
|
workspace,
|
|
1777
|
-
JSON.parse(
|
|
1970
|
+
JSON.parse(readFileSync10(`${workspace.location}/package.json`, { encoding: "utf8" }))
|
|
1778
1971
|
]);
|
|
1779
1972
|
const privatePackages = possibleDeployablePackages.filter(([_, pkg]) => pkg.private).map(([workspace]) => workspace);
|
|
1780
1973
|
const excludeList = privatePackages.map((workspace) => `--exclude ${workspace.name}`);
|
|
@@ -1794,11 +1987,11 @@ var deployMinor = () => {
|
|
|
1794
1987
|
};
|
|
1795
1988
|
|
|
1796
1989
|
// src/actions/deploy-next.ts
|
|
1797
|
-
import { readFileSync as
|
|
1990
|
+
import { readFileSync as readFileSync11 } from "fs";
|
|
1798
1991
|
var privatePackageExcludeList4 = () => {
|
|
1799
1992
|
const possibleDeployablePackages = yarnWorkspaces().map((workspace) => [
|
|
1800
1993
|
workspace,
|
|
1801
|
-
JSON.parse(
|
|
1994
|
+
JSON.parse(readFileSync11(`${workspace.location}/package.json`, { encoding: "utf8" }))
|
|
1802
1995
|
]);
|
|
1803
1996
|
const privatePackages = possibleDeployablePackages.filter(([_, pkg]) => pkg.private).map(([workspace]) => workspace);
|
|
1804
1997
|
const excludeList = privatePackages.map((workspace) => `--exclude ${workspace.name}`);
|
|
@@ -1818,22 +2011,22 @@ var deployNext = () => {
|
|
|
1818
2011
|
};
|
|
1819
2012
|
|
|
1820
2013
|
// src/actions/dupdeps.ts
|
|
1821
|
-
import
|
|
2014
|
+
import chalk23 from "chalk";
|
|
1822
2015
|
var dupdeps = () => {
|
|
1823
|
-
console.log(
|
|
2016
|
+
console.log(chalk23.green("Checking all Dependencies for Duplicates"));
|
|
1824
2017
|
const allDependencies = parsedPackageJSON()?.dependencies;
|
|
1825
2018
|
const dependencies = Object.entries(allDependencies).map(([k]) => k);
|
|
1826
2019
|
return detectDuplicateDependencies(dependencies);
|
|
1827
2020
|
};
|
|
1828
2021
|
|
|
1829
2022
|
// src/actions/lint.ts
|
|
1830
|
-
import
|
|
2023
|
+
import chalk24 from "chalk";
|
|
1831
2024
|
var lintPackage = ({
|
|
1832
2025
|
pkg,
|
|
1833
2026
|
fix: fix2,
|
|
1834
2027
|
verbose
|
|
1835
2028
|
}) => {
|
|
1836
|
-
console.log(
|
|
2029
|
+
console.log(chalk24.gray(`${fix2 ? "Fix" : "Lint"} [${pkg}]`));
|
|
1837
2030
|
const start = Date.now();
|
|
1838
2031
|
const result = runSteps(`${fix2 ? "Fix" : "Lint"} [${pkg}]`, [
|
|
1839
2032
|
["yarn", [
|
|
@@ -1843,7 +2036,7 @@ var lintPackage = ({
|
|
|
1843
2036
|
fix2 ? "package-fix" : verbose ? "package-lint-verbose" : "package-lint"
|
|
1844
2037
|
]]
|
|
1845
2038
|
]);
|
|
1846
|
-
console.log(
|
|
2039
|
+
console.log(chalk24.gray(`${fix2 ? "Fixed in" : "Linted in"} [${chalk24.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk24.gray("seconds")}`));
|
|
1847
2040
|
return result;
|
|
1848
2041
|
};
|
|
1849
2042
|
var lint = ({
|
|
@@ -1863,13 +2056,13 @@ var lint = ({
|
|
|
1863
2056
|
});
|
|
1864
2057
|
};
|
|
1865
2058
|
var lintAllPackages = ({ fix: fix2 = false } = {}) => {
|
|
1866
|
-
console.log(
|
|
2059
|
+
console.log(chalk24.gray(`${fix2 ? "Fix" : "Lint"} [All-Packages]`));
|
|
1867
2060
|
const start = Date.now();
|
|
1868
2061
|
const fixOptions = fix2 ? ["--fix"] : [];
|
|
1869
2062
|
const result = runSteps(`${fix2 ? "Fix" : "Lint"} [All-Packages]`, [
|
|
1870
2063
|
["yarn", ["eslint", "--cache", "--cache-location", ".eslintcache", "--cache-strategy", "content", ...fixOptions]]
|
|
1871
2064
|
]);
|
|
1872
|
-
console.log(
|
|
2065
|
+
console.log(chalk24.gray(`${fix2 ? "Fixed in" : "Linted in"} [${chalk24.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk24.gray("seconds")}`));
|
|
1873
2066
|
return result;
|
|
1874
2067
|
};
|
|
1875
2068
|
|
|
@@ -1897,7 +2090,7 @@ var filename = ".gitignore";
|
|
|
1897
2090
|
var gitignoreGen = (pkg) => generateIgnoreFiles(filename, pkg);
|
|
1898
2091
|
|
|
1899
2092
|
// src/actions/gitlint.ts
|
|
1900
|
-
import
|
|
2093
|
+
import chalk25 from "chalk";
|
|
1901
2094
|
import ParseGitConfig from "parse-git-config";
|
|
1902
2095
|
var gitlint = () => {
|
|
1903
2096
|
console.log(`
|
|
@@ -1908,7 +2101,7 @@ Gitlint Start [${process.cwd()}]
|
|
|
1908
2101
|
const errors = 0;
|
|
1909
2102
|
const gitConfig = ParseGitConfig.sync();
|
|
1910
2103
|
const warn = (message) => {
|
|
1911
|
-
console.warn(
|
|
2104
|
+
console.warn(chalk25.yellow(`Warning: ${message}`));
|
|
1912
2105
|
warnings++;
|
|
1913
2106
|
};
|
|
1914
2107
|
if (gitConfig.core.ignorecase) {
|
|
@@ -1928,13 +2121,13 @@ Gitlint Start [${process.cwd()}]
|
|
|
1928
2121
|
}
|
|
1929
2122
|
const resultMessages = [];
|
|
1930
2123
|
if (valid > 0) {
|
|
1931
|
-
resultMessages.push(
|
|
2124
|
+
resultMessages.push(chalk25.green(`Passed: ${valid}`));
|
|
1932
2125
|
}
|
|
1933
2126
|
if (warnings > 0) {
|
|
1934
|
-
resultMessages.push(
|
|
2127
|
+
resultMessages.push(chalk25.yellow(`Warnings: ${warnings}`));
|
|
1935
2128
|
}
|
|
1936
2129
|
if (errors > 0) {
|
|
1937
|
-
resultMessages.push(
|
|
2130
|
+
resultMessages.push(chalk25.red(` Errors: ${errors}`));
|
|
1938
2131
|
}
|
|
1939
2132
|
console.warn(`Gitlint Finish [ ${resultMessages.join(" | ")} ]
|
|
1940
2133
|
`);
|
|
@@ -1943,7 +2136,7 @@ Gitlint Start [${process.cwd()}]
|
|
|
1943
2136
|
|
|
1944
2137
|
// src/actions/gitlint-fix.ts
|
|
1945
2138
|
import { execSync as execSync3 } from "child_process";
|
|
1946
|
-
import
|
|
2139
|
+
import chalk26 from "chalk";
|
|
1947
2140
|
import ParseGitConfig2 from "parse-git-config";
|
|
1948
2141
|
var gitlintFix = () => {
|
|
1949
2142
|
console.log(`
|
|
@@ -1952,15 +2145,15 @@ Gitlint Fix Start [${process.cwd()}]
|
|
|
1952
2145
|
const gitConfig = ParseGitConfig2.sync();
|
|
1953
2146
|
if (gitConfig.core.ignorecase) {
|
|
1954
2147
|
execSync3("git config core.ignorecase false", { stdio: "inherit" });
|
|
1955
|
-
console.warn(
|
|
2148
|
+
console.warn(chalk26.yellow("\nGitlint Fix: Updated core.ignorecase to be false\n"));
|
|
1956
2149
|
}
|
|
1957
2150
|
if (gitConfig.core.autocrlf !== false) {
|
|
1958
2151
|
execSync3("git config core.autocrlf false", { stdio: "inherit" });
|
|
1959
|
-
console.warn(
|
|
2152
|
+
console.warn(chalk26.yellow("\nGitlint Fix: Updated core.autocrlf to be false\n"));
|
|
1960
2153
|
}
|
|
1961
2154
|
if (gitConfig.core.eol !== "lf") {
|
|
1962
2155
|
execSync3("git config core.eol lf", { stdio: "inherit" });
|
|
1963
|
-
console.warn(
|
|
2156
|
+
console.warn(chalk26.yellow('\nGitlint Fix: Updated core.eol to be "lf"\n'));
|
|
1964
2157
|
}
|
|
1965
2158
|
return 1;
|
|
1966
2159
|
};
|
|
@@ -1971,7 +2164,7 @@ var knip = () => {
|
|
|
1971
2164
|
};
|
|
1972
2165
|
|
|
1973
2166
|
// src/actions/license.ts
|
|
1974
|
-
import
|
|
2167
|
+
import chalk27 from "chalk";
|
|
1975
2168
|
import { init } from "license-checker";
|
|
1976
2169
|
var license = async (pkg) => {
|
|
1977
2170
|
const workspaces = yarnWorkspaces();
|
|
@@ -1996,18 +2189,18 @@ var license = async (pkg) => {
|
|
|
1996
2189
|
"LGPL-3.0-or-later",
|
|
1997
2190
|
"Python-2.0"
|
|
1998
2191
|
]);
|
|
1999
|
-
console.log(
|
|
2192
|
+
console.log(chalk27.green("License Checker"));
|
|
2000
2193
|
return (await Promise.all(
|
|
2001
2194
|
workspaceList.map(({ location, name }) => {
|
|
2002
2195
|
return new Promise((resolve) => {
|
|
2003
2196
|
init({ production: true, start: location }, (error, packages) => {
|
|
2004
2197
|
if (error) {
|
|
2005
|
-
console.error(
|
|
2006
|
-
console.error(
|
|
2198
|
+
console.error(chalk27.red(`License Checker [${name}] Error`));
|
|
2199
|
+
console.error(chalk27.gray(error));
|
|
2007
2200
|
console.log("\n");
|
|
2008
2201
|
resolve(1);
|
|
2009
2202
|
} else {
|
|
2010
|
-
console.log(
|
|
2203
|
+
console.log(chalk27.green(`License Checker [${name}]`));
|
|
2011
2204
|
let count = 0;
|
|
2012
2205
|
for (const [name2, info] of Object.entries(packages)) {
|
|
2013
2206
|
const licenses = Array.isArray(info.licenses) ? info.licenses : [info.licenses];
|
|
@@ -2023,7 +2216,7 @@ var license = async (pkg) => {
|
|
|
2023
2216
|
}
|
|
2024
2217
|
if (!orLicenseFound) {
|
|
2025
2218
|
count++;
|
|
2026
|
-
console.warn(
|
|
2219
|
+
console.warn(chalk27.yellow(`${name2}: Package License not allowed [${license2}]`));
|
|
2027
2220
|
}
|
|
2028
2221
|
}
|
|
2029
2222
|
}
|
|
@@ -2043,12 +2236,12 @@ var npmignoreGen = (pkg) => generateIgnoreFiles(filename2, pkg);
|
|
|
2043
2236
|
|
|
2044
2237
|
// src/actions/package/clean-outputs.ts
|
|
2045
2238
|
import path8 from "path";
|
|
2046
|
-
import
|
|
2239
|
+
import chalk28 from "chalk";
|
|
2047
2240
|
var packageCleanOutputs = () => {
|
|
2048
2241
|
const pkg = process.env.INIT_CWD ?? ".";
|
|
2049
2242
|
const pkgName = process.env.npm_package_name;
|
|
2050
2243
|
const folders = [path8.join(pkg, "dist"), path8.join(pkg, "build"), path8.join(pkg, "docs")];
|
|
2051
|
-
console.log(
|
|
2244
|
+
console.log(chalk28.green(`Cleaning Outputs [${pkgName}]`));
|
|
2052
2245
|
for (let folder of folders) {
|
|
2053
2246
|
deleteGlob(folder);
|
|
2054
2247
|
}
|
|
@@ -2057,11 +2250,11 @@ var packageCleanOutputs = () => {
|
|
|
2057
2250
|
|
|
2058
2251
|
// src/actions/package/clean-typescript.ts
|
|
2059
2252
|
import path9 from "path";
|
|
2060
|
-
import
|
|
2253
|
+
import chalk29 from "chalk";
|
|
2061
2254
|
var packageCleanTypescript = () => {
|
|
2062
2255
|
const pkg = process.env.INIT_CWD ?? ".";
|
|
2063
2256
|
const pkgName = process.env.npm_package_name;
|
|
2064
|
-
console.log(
|
|
2257
|
+
console.log(chalk29.green(`Cleaning Typescript [${pkgName}]`));
|
|
2065
2258
|
const files = [path9.join(pkg, "*.tsbuildinfo"), path9.join(pkg, ".tsconfig.*"), path9.join(pkg, ".eslintcache")];
|
|
2066
2259
|
for (let file of files) {
|
|
2067
2260
|
deleteGlob(file);
|
|
@@ -2075,26 +2268,26 @@ var packageClean = async () => {
|
|
|
2075
2268
|
};
|
|
2076
2269
|
|
|
2077
2270
|
// src/actions/package/compile/compile.ts
|
|
2078
|
-
import
|
|
2271
|
+
import chalk34 from "chalk";
|
|
2079
2272
|
|
|
2080
2273
|
// src/actions/package/compile/packageCompileTsup.ts
|
|
2081
|
-
import
|
|
2274
|
+
import chalk33 from "chalk";
|
|
2082
2275
|
import { build as build2, defineConfig } from "tsup";
|
|
2083
2276
|
|
|
2084
2277
|
// src/actions/package/compile/inputs.ts
|
|
2085
|
-
import
|
|
2278
|
+
import chalk30 from "chalk";
|
|
2086
2279
|
import { glob as glob2 } from "glob";
|
|
2087
2280
|
var getAllInputs = (srcDir, verbose = false) => {
|
|
2088
2281
|
return [...glob2.sync(`${srcDir}/**/*.ts`, { posix: true }).map((file) => {
|
|
2089
2282
|
const result = file.slice(Math.max(0, srcDir.length + 1));
|
|
2090
2283
|
if (verbose) {
|
|
2091
|
-
console.log(
|
|
2284
|
+
console.log(chalk30.gray(`getAllInputs: ${JSON.stringify(result, null, 2)}`));
|
|
2092
2285
|
}
|
|
2093
2286
|
return result;
|
|
2094
2287
|
}), ...glob2.sync(`${srcDir}/**/*.tsx`, { posix: true }).map((file) => {
|
|
2095
2288
|
const result = file.slice(Math.max(0, srcDir.length + 1));
|
|
2096
2289
|
if (verbose) {
|
|
2097
|
-
console.log(
|
|
2290
|
+
console.log(chalk30.gray(`getAllInputs: ${JSON.stringify(result, null, 2)}`));
|
|
2098
2291
|
}
|
|
2099
2292
|
return result;
|
|
2100
2293
|
})];
|
|
@@ -2156,7 +2349,7 @@ function deepMergeObjects(objects) {
|
|
|
2156
2349
|
|
|
2157
2350
|
// src/actions/package/compile/packageCompileTsc.ts
|
|
2158
2351
|
import { cwd as cwd2 } from "process";
|
|
2159
|
-
import
|
|
2352
|
+
import chalk31 from "chalk";
|
|
2160
2353
|
import { createProgramFromConfig } from "tsc-prog";
|
|
2161
2354
|
import ts3, {
|
|
2162
2355
|
DiagnosticCategory,
|
|
@@ -2178,7 +2371,7 @@ var getCompilerOptions = (options = {}, fileName = "tsconfig.json") => {
|
|
|
2178
2371
|
var packageCompileTsc = (platform, entries, srcDir = "src", outDir = "dist", compilerOptionsParam, verbose = false) => {
|
|
2179
2372
|
const pkg = process.env.INIT_CWD ?? cwd2();
|
|
2180
2373
|
if (verbose) {
|
|
2181
|
-
console.log(
|
|
2374
|
+
console.log(chalk31.cyan(`Validating code START: ${entries.length} files to ${outDir} from ${srcDir}`));
|
|
2182
2375
|
}
|
|
2183
2376
|
const configFilePath = ts3.findConfigFile(
|
|
2184
2377
|
"./",
|
|
@@ -2201,10 +2394,10 @@ var packageCompileTsc = (platform, entries, srcDir = "src", outDir = "dist", com
|
|
|
2201
2394
|
emitDeclarationOnly: true,
|
|
2202
2395
|
noEmit: false
|
|
2203
2396
|
};
|
|
2204
|
-
console.log(
|
|
2397
|
+
console.log(chalk31.cyan(`Validating Files: ${entries.length}`));
|
|
2205
2398
|
if (verbose) {
|
|
2206
2399
|
for (const entry of entries) {
|
|
2207
|
-
console.log(
|
|
2400
|
+
console.log(chalk31.grey(`Validating: ${entry}`));
|
|
2208
2401
|
}
|
|
2209
2402
|
}
|
|
2210
2403
|
try {
|
|
@@ -2240,7 +2433,7 @@ var packageCompileTsc = (platform, entries, srcDir = "src", outDir = "dist", com
|
|
|
2240
2433
|
return 0;
|
|
2241
2434
|
} finally {
|
|
2242
2435
|
if (verbose) {
|
|
2243
|
-
console.log(
|
|
2436
|
+
console.log(chalk31.cyan(`Validating code FINISH: ${entries.length} files to ${outDir} from ${srcDir}`));
|
|
2244
2437
|
}
|
|
2245
2438
|
}
|
|
2246
2439
|
};
|
|
@@ -2248,7 +2441,7 @@ var packageCompileTsc = (platform, entries, srcDir = "src", outDir = "dist", com
|
|
|
2248
2441
|
// src/actions/package/compile/packageCompileTscTypes.ts
|
|
2249
2442
|
import path10 from "path";
|
|
2250
2443
|
import { cwd as cwd3 } from "process";
|
|
2251
|
-
import
|
|
2444
|
+
import chalk32 from "chalk";
|
|
2252
2445
|
import { rollup } from "rollup";
|
|
2253
2446
|
import dts from "rollup-plugin-dts";
|
|
2254
2447
|
import nodeExternals from "rollup-plugin-node-externals";
|
|
@@ -2273,8 +2466,8 @@ async function bundleDts(inputPath, outputPath, platform, options, verbose = fal
|
|
|
2273
2466
|
if (ignoredWarningCodes.has(warning.code ?? "")) {
|
|
2274
2467
|
return;
|
|
2275
2468
|
}
|
|
2276
|
-
console.warn(
|
|
2277
|
-
console.warn(
|
|
2469
|
+
console.warn(chalk32.yellow(`[${warning.code}] ${warning.message}`));
|
|
2470
|
+
console.warn(chalk32.gray(inputPath));
|
|
2278
2471
|
warn(warning);
|
|
2279
2472
|
}
|
|
2280
2473
|
});
|
|
@@ -2284,8 +2477,8 @@ async function bundleDts(inputPath, outputPath, platform, options, verbose = fal
|
|
|
2284
2477
|
});
|
|
2285
2478
|
} catch (ex) {
|
|
2286
2479
|
const error = ex;
|
|
2287
|
-
console.warn(
|
|
2288
|
-
console.warn(
|
|
2480
|
+
console.warn(chalk32.red(error));
|
|
2481
|
+
console.warn(chalk32.gray(inputPath));
|
|
2289
2482
|
}
|
|
2290
2483
|
if (verbose) {
|
|
2291
2484
|
console.log(`Bundled declarations written to ${outputPath}`);
|
|
@@ -2293,7 +2486,7 @@ async function bundleDts(inputPath, outputPath, platform, options, verbose = fal
|
|
|
2293
2486
|
}
|
|
2294
2487
|
var packageCompileTscTypes = async (entries, outDir, platform, srcDir = "build", verbose = false) => {
|
|
2295
2488
|
if (verbose) {
|
|
2296
|
-
console.log(
|
|
2489
|
+
console.log(chalk32.cyan(`Compiling Types START [${platform}]: ${entries.length} files to ${outDir} from ${srcDir}`));
|
|
2297
2490
|
console.log(`Entries: ${entries.join(", ")}`);
|
|
2298
2491
|
}
|
|
2299
2492
|
const pkg = process.env.INIT_CWD ?? cwd3();
|
|
@@ -2317,7 +2510,7 @@ var packageCompileTscTypes = async (entries, outDir, platform, srcDir = "build",
|
|
|
2317
2510
|
await bundleDts(`${srcRoot}/${entryTypeName}`, `${outDir}/${entryTypeName}`, platform, { compilerOptions }, verbose);
|
|
2318
2511
|
}));
|
|
2319
2512
|
if (verbose) {
|
|
2320
|
-
console.log(
|
|
2513
|
+
console.log(chalk32.cyan(`Compiling Types FINISH: ${entries.length} files to ${outDir} from ${srcDir}`));
|
|
2321
2514
|
}
|
|
2322
2515
|
return 0;
|
|
2323
2516
|
};
|
|
@@ -2329,15 +2522,15 @@ var compileFolder = async (srcDir, entries, buildDir, options, bundleTypes = fal
|
|
|
2329
2522
|
console.log(`compileFolder [${srcDir}, ${options?.outDir}]`);
|
|
2330
2523
|
}
|
|
2331
2524
|
if (entries.length === 0) {
|
|
2332
|
-
console.warn(
|
|
2525
|
+
console.warn(chalk33.yellow(`No entries found in ${srcDir} to compile`));
|
|
2333
2526
|
return 0;
|
|
2334
2527
|
}
|
|
2335
2528
|
if (verbose) {
|
|
2336
|
-
console.log(
|
|
2529
|
+
console.log(chalk33.gray(`buildDir [${buildDir}]`));
|
|
2337
2530
|
}
|
|
2338
2531
|
const validationResult = packageCompileTsc(options?.platform ?? "neutral", entries, srcDir, buildDir, void 0, verbose);
|
|
2339
2532
|
if (validationResult !== 0) {
|
|
2340
|
-
console.error(
|
|
2533
|
+
console.error(chalk33.red(`Compile:Validation had ${validationResult} errors`));
|
|
2341
2534
|
return validationResult;
|
|
2342
2535
|
}
|
|
2343
2536
|
const optionsParams = tsupOptions([{
|
|
@@ -2362,12 +2555,12 @@ var compileFolder = async (srcDir, entries, buildDir, options, bundleTypes = fal
|
|
|
2362
2555
|
})
|
|
2363
2556
|
)).flat();
|
|
2364
2557
|
if (verbose) {
|
|
2365
|
-
console.log(
|
|
2366
|
-
console.log(
|
|
2558
|
+
console.log(chalk33.cyan(`TSUP:build:start [${srcDir}]`));
|
|
2559
|
+
console.log(chalk33.gray(`TSUP:build:options [${JSON.stringify(optionsList, null, 2)}]`));
|
|
2367
2560
|
}
|
|
2368
2561
|
await Promise.all(optionsList.map((options2) => build2(options2)));
|
|
2369
2562
|
if (verbose) {
|
|
2370
|
-
console.log(
|
|
2563
|
+
console.log(chalk33.cyan(`TSUP:build:stop [${srcDir}]`));
|
|
2371
2564
|
}
|
|
2372
2565
|
if (bundleTypes) {
|
|
2373
2566
|
await packageCompileTscTypes(entries, outDir, options?.platform ?? "neutral", buildDir, verbose);
|
|
@@ -2478,14 +2671,14 @@ var packageCompileTsup = async (config2) => {
|
|
|
2478
2671
|
// src/actions/package/compile/compile.ts
|
|
2479
2672
|
var packageCompile = async (inConfig = {}) => {
|
|
2480
2673
|
const pkg = process.env.INIT_CWD;
|
|
2481
|
-
console.log(
|
|
2674
|
+
console.log(chalk34.green(`Compiling ${pkg}`));
|
|
2482
2675
|
const config2 = await loadConfig(inConfig);
|
|
2483
2676
|
return await packageCompileTsup(config2);
|
|
2484
2677
|
};
|
|
2485
2678
|
|
|
2486
2679
|
// src/actions/package/copy-assets.ts
|
|
2487
2680
|
import path11 from "path/posix";
|
|
2488
|
-
import
|
|
2681
|
+
import chalk35 from "chalk";
|
|
2489
2682
|
import cpy2 from "cpy";
|
|
2490
2683
|
var copyTargetAssets2 = async (target, name, location) => {
|
|
2491
2684
|
try {
|
|
@@ -2498,7 +2691,7 @@ var copyTargetAssets2 = async (target, name, location) => {
|
|
|
2498
2691
|
}
|
|
2499
2692
|
);
|
|
2500
2693
|
if (values.length > 0) {
|
|
2501
|
-
console.log(
|
|
2694
|
+
console.log(chalk35.green(`Copying Assets [${target.toUpperCase()}] - ${name} - ${location}`));
|
|
2502
2695
|
}
|
|
2503
2696
|
for (const value of values) {
|
|
2504
2697
|
console.log(`${value.split("/").pop()} => ./dist/${target}`);
|
|
@@ -2563,9 +2756,9 @@ var packageCycle = async () => {
|
|
|
2563
2756
|
};
|
|
2564
2757
|
|
|
2565
2758
|
// src/actions/package/gen-docs.ts
|
|
2566
|
-
import { existsSync as
|
|
2759
|
+
import { existsSync as existsSync8 } from "fs";
|
|
2567
2760
|
import path12 from "path";
|
|
2568
|
-
import
|
|
2761
|
+
import chalk36 from "chalk";
|
|
2569
2762
|
import {
|
|
2570
2763
|
Application,
|
|
2571
2764
|
ArgumentsReader,
|
|
@@ -2583,7 +2776,7 @@ var ExitCodes = {
|
|
|
2583
2776
|
};
|
|
2584
2777
|
var packageGenDocs = async () => {
|
|
2585
2778
|
const pkg = process.env.INIT_CWD;
|
|
2586
|
-
if (pkg !== void 0 && !
|
|
2779
|
+
if (pkg !== void 0 && !existsSync8(path12.join(pkg, "typedoc.json"))) {
|
|
2587
2780
|
return;
|
|
2588
2781
|
}
|
|
2589
2782
|
const app = await Application.bootstrap({
|
|
@@ -2669,16 +2862,16 @@ var runTypeDoc = async (app) => {
|
|
|
2669
2862
|
return ExitCodes.OutputError;
|
|
2670
2863
|
}
|
|
2671
2864
|
}
|
|
2672
|
-
console.log(
|
|
2865
|
+
console.log(chalk36.green(`${pkgName} - Ok`));
|
|
2673
2866
|
return ExitCodes.Ok;
|
|
2674
2867
|
};
|
|
2675
2868
|
|
|
2676
2869
|
// src/actions/package/lint.ts
|
|
2677
|
-
import { readdirSync as
|
|
2870
|
+
import { readdirSync as readdirSync5 } from "fs";
|
|
2678
2871
|
import path13 from "path";
|
|
2679
2872
|
import { cwd as cwd4 } from "process";
|
|
2680
2873
|
import { pathToFileURL } from "url";
|
|
2681
|
-
import
|
|
2874
|
+
import chalk37 from "chalk";
|
|
2682
2875
|
import { ESLint } from "eslint";
|
|
2683
2876
|
import { findUp } from "find-up";
|
|
2684
2877
|
import picomatch from "picomatch";
|
|
@@ -2687,14 +2880,14 @@ var dumpMessages = (lintResults) => {
|
|
|
2687
2880
|
const severity = ["none", "warning", "error"];
|
|
2688
2881
|
for (const lintResult of lintResults) {
|
|
2689
2882
|
if (lintResult.messages.length > 0) {
|
|
2690
|
-
console.log(
|
|
2883
|
+
console.log(chalk37.gray(`
|
|
2691
2884
|
${lintResult.filePath}`));
|
|
2692
2885
|
for (const message of lintResult.messages) {
|
|
2693
2886
|
console.log(
|
|
2694
|
-
|
|
2695
|
-
|
|
2696
|
-
|
|
2697
|
-
|
|
2887
|
+
chalk37.gray(` ${message.line}:${message.column}`),
|
|
2888
|
+
chalk37[colors[message.severity]](` ${severity[message.severity]}`),
|
|
2889
|
+
chalk37.white(` ${message.message}`),
|
|
2890
|
+
chalk37.gray(` ${message.ruleId}`)
|
|
2698
2891
|
);
|
|
2699
2892
|
}
|
|
2700
2893
|
}
|
|
@@ -2711,7 +2904,7 @@ function getFiles(dir, ignoreFolders) {
|
|
|
2711
2904
|
const currentDirectory = cwd4();
|
|
2712
2905
|
const subDirectory = dir.split(currentDirectory)[1]?.split("/")[1];
|
|
2713
2906
|
if (ignoreFolders.includes(subDirectory)) return [];
|
|
2714
|
-
return
|
|
2907
|
+
return readdirSync5(dir, { withFileTypes: true }).flatMap((dirent) => {
|
|
2715
2908
|
const res = path13.resolve(dir, dirent.name);
|
|
2716
2909
|
const relativePath = subDirectory === void 0 ? dirent.name : `${subDirectory}/${dirent.name}`;
|
|
2717
2910
|
const ignoreMatchers = ignoreFolders.map((pattern) => picomatch(pattern));
|
|
@@ -2732,10 +2925,10 @@ var packageLint = async (fix2 = false, verbose = false, cache = true) => {
|
|
|
2732
2925
|
cache
|
|
2733
2926
|
});
|
|
2734
2927
|
const files = getFiles(cwd4(), ignoreFolders);
|
|
2735
|
-
console.log(
|
|
2928
|
+
console.log(chalk37.green(`Linting ${pkg} [files = ${files.length}]`));
|
|
2736
2929
|
if (verbose) {
|
|
2737
2930
|
for (const file of files) {
|
|
2738
|
-
console.log(
|
|
2931
|
+
console.log(chalk37.gray(` ${file}`));
|
|
2739
2932
|
}
|
|
2740
2933
|
}
|
|
2741
2934
|
const lintResults = await engine.lintFiles(files);
|
|
@@ -2746,32 +2939,32 @@ var packageLint = async (fix2 = false, verbose = false, cache = true) => {
|
|
|
2746
2939
|
const filesCountColor = files.length < 100 ? "green" : files.length < 1e3 ? "yellow" : "red";
|
|
2747
2940
|
const lintTime = Date.now() - start;
|
|
2748
2941
|
const lintTimeColor = lintTime < 1e3 ? "green" : lintTime < 3e3 ? "yellow" : "red";
|
|
2749
|
-
console.log(
|
|
2942
|
+
console.log(chalk37.white(`Linted ${chalk37[filesCountColor](files.length)} files in ${chalk37[lintTimeColor](lintTime)}ms`));
|
|
2750
2943
|
return lintResults.reduce((prev, lintResult) => prev + lintResult.errorCount, 0);
|
|
2751
2944
|
};
|
|
2752
2945
|
|
|
2753
2946
|
// src/actions/package/publint.ts
|
|
2754
2947
|
import { promises as fs10 } from "fs";
|
|
2755
|
-
import
|
|
2948
|
+
import chalk38 from "chalk";
|
|
2756
2949
|
import sortPackageJson from "sort-package-json";
|
|
2757
2950
|
var customPubLint = (pkg) => {
|
|
2758
2951
|
let errorCount = 0;
|
|
2759
2952
|
let warningCount = 0;
|
|
2760
2953
|
if (pkg.files === void 0) {
|
|
2761
|
-
console.warn(
|
|
2954
|
+
console.warn(chalk38.yellow('Publint [custom]: "files" field is missing'));
|
|
2762
2955
|
warningCount++;
|
|
2763
2956
|
}
|
|
2764
2957
|
if (pkg.main !== void 0) {
|
|
2765
|
-
console.warn(
|
|
2958
|
+
console.warn(chalk38.yellow('Publint [custom]: "main" field is deprecated, use "exports" instead'));
|
|
2766
2959
|
warningCount++;
|
|
2767
2960
|
}
|
|
2768
2961
|
if (pkg.sideEffects !== false) {
|
|
2769
|
-
console.warn(
|
|
2962
|
+
console.warn(chalk38.yellow('Publint [custom]: "sideEffects" field should be set to false'));
|
|
2770
2963
|
warningCount++;
|
|
2771
2964
|
}
|
|
2772
2965
|
if (pkg.resolutions !== void 0) {
|
|
2773
|
-
console.warn(
|
|
2774
|
-
console.warn(
|
|
2966
|
+
console.warn(chalk38.yellow('Publint [custom]: "resolutions" in use'));
|
|
2967
|
+
console.warn(chalk38.gray(JSON.stringify(pkg.resolutions, null, 2)));
|
|
2775
2968
|
warningCount++;
|
|
2776
2969
|
}
|
|
2777
2970
|
return [errorCount, warningCount];
|
|
@@ -2781,8 +2974,8 @@ var packagePublint = async ({ strict = true, verbose = false } = {}) => {
|
|
|
2781
2974
|
const sortedPkg = sortPackageJson(await fs10.readFile(`${pkgDir}/package.json`, "utf8"));
|
|
2782
2975
|
await fs10.writeFile(`${pkgDir}/package.json`, sortedPkg);
|
|
2783
2976
|
const pkg = JSON.parse(await fs10.readFile(`${pkgDir}/package.json`, "utf8"));
|
|
2784
|
-
console.log(
|
|
2785
|
-
console.log(
|
|
2977
|
+
console.log(chalk38.green(`Publint: ${pkg.name}`));
|
|
2978
|
+
console.log(chalk38.gray(pkgDir));
|
|
2786
2979
|
const { publint: publint2 } = await import("publint");
|
|
2787
2980
|
const { messages } = await publint2({
|
|
2788
2981
|
level: "suggestion",
|
|
@@ -2793,22 +2986,22 @@ var packagePublint = async ({ strict = true, verbose = false } = {}) => {
|
|
|
2793
2986
|
for (const message of messages) {
|
|
2794
2987
|
switch (message.type) {
|
|
2795
2988
|
case "error": {
|
|
2796
|
-
console.error(
|
|
2989
|
+
console.error(chalk38.red(`[${message.code}] ${formatMessage(message, pkg)}`));
|
|
2797
2990
|
break;
|
|
2798
2991
|
}
|
|
2799
2992
|
case "warning": {
|
|
2800
|
-
console.warn(
|
|
2993
|
+
console.warn(chalk38.yellow(`[${message.code}] ${formatMessage(message, pkg)}`));
|
|
2801
2994
|
break;
|
|
2802
2995
|
}
|
|
2803
2996
|
default: {
|
|
2804
|
-
console.log(
|
|
2997
|
+
console.log(chalk38.white(`[${message.code}] ${formatMessage(message, pkg)}`));
|
|
2805
2998
|
break;
|
|
2806
2999
|
}
|
|
2807
3000
|
}
|
|
2808
3001
|
}
|
|
2809
3002
|
const [errorCount, warningCount] = customPubLint(pkg);
|
|
2810
3003
|
if (verbose) {
|
|
2811
|
-
console.log(
|
|
3004
|
+
console.log(chalk38.gray(`Publint [Finish]: ${pkgDir} [${messages.length + errorCount + warningCount} messages]`));
|
|
2812
3005
|
}
|
|
2813
3006
|
return messages.filter((message) => message.type === "error").length + errorCount;
|
|
2814
3007
|
};
|
|
@@ -2842,7 +3035,10 @@ async function readmeGen({
|
|
|
2842
3035
|
typedoc,
|
|
2843
3036
|
verbose
|
|
2844
3037
|
}) {
|
|
3038
|
+
const config2 = await loadConfig();
|
|
2845
3039
|
return await generateReadmeFiles({
|
|
3040
|
+
logoLinkUrl: config2.readme?.logoLinkUrl,
|
|
3041
|
+
logoUrl: config2.readme?.logoUrl,
|
|
2846
3042
|
pkg,
|
|
2847
3043
|
templatePath,
|
|
2848
3044
|
typedoc,
|
|
@@ -2850,6 +3046,15 @@ async function readmeGen({
|
|
|
2850
3046
|
});
|
|
2851
3047
|
}
|
|
2852
3048
|
|
|
3049
|
+
// src/actions/readme-init.ts
|
|
3050
|
+
async function readmeInit({ templatePath }) {
|
|
3051
|
+
const config2 = await loadConfig();
|
|
3052
|
+
const template = applyLogoConfig(DEFAULT_README_TEMPLATE, config2.readme?.logoUrl, config2.readme?.logoLinkUrl);
|
|
3053
|
+
const resolvedTemplatePath = resolveTemplatePath(templatePath);
|
|
3054
|
+
await scaffoldTemplate(resolvedTemplatePath, template);
|
|
3055
|
+
return 0;
|
|
3056
|
+
}
|
|
3057
|
+
|
|
2853
3058
|
// src/actions/rebuild.ts
|
|
2854
3059
|
var rebuild = ({ target }) => {
|
|
2855
3060
|
return runSteps("Rebuild", [
|
|
@@ -2859,7 +3064,7 @@ var rebuild = ({ target }) => {
|
|
|
2859
3064
|
};
|
|
2860
3065
|
|
|
2861
3066
|
// src/actions/recompile.ts
|
|
2862
|
-
import
|
|
3067
|
+
import chalk39 from "chalk";
|
|
2863
3068
|
var recompile = async ({
|
|
2864
3069
|
verbose,
|
|
2865
3070
|
target,
|
|
@@ -2895,7 +3100,7 @@ var recompileAll = async ({
|
|
|
2895
3100
|
const incrementalOptions = incremental ? ["--since", "-Apt", "--topological-dev"] : ["--parallel", "-Apt", "--topological-dev"];
|
|
2896
3101
|
const jobsOptions = jobs ? ["-j", `${jobs}`] : [];
|
|
2897
3102
|
if (jobs) {
|
|
2898
|
-
console.log(
|
|
3103
|
+
console.log(chalk39.blue(`Jobs set to [${jobs}]`));
|
|
2899
3104
|
}
|
|
2900
3105
|
const result = await runStepsAsync(`Recompile${incremental ? "-Incremental" : ""} [All]`, [
|
|
2901
3106
|
[
|
|
@@ -2926,7 +3131,7 @@ var recompileAll = async ({
|
|
|
2926
3131
|
]
|
|
2927
3132
|
]);
|
|
2928
3133
|
console.log(
|
|
2929
|
-
`${
|
|
3134
|
+
`${chalk39.gray("Recompiled in")} [${chalk39.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk39.gray("seconds")}`
|
|
2930
3135
|
);
|
|
2931
3136
|
return result;
|
|
2932
3137
|
};
|
|
@@ -2935,7 +3140,7 @@ var recompileAll = async ({
|
|
|
2935
3140
|
import {
|
|
2936
3141
|
closeSync,
|
|
2937
3142
|
openSync,
|
|
2938
|
-
rmSync
|
|
3143
|
+
rmSync as rmSync2
|
|
2939
3144
|
} from "fs";
|
|
2940
3145
|
var reinstall = () => {
|
|
2941
3146
|
console.log("Reinstall [Clear Lock File]");
|
|
@@ -2945,7 +3150,7 @@ var reinstall = () => {
|
|
|
2945
3150
|
const result = workspaces.map(({ location, name }) => {
|
|
2946
3151
|
const dist = `${location}/node_modules`;
|
|
2947
3152
|
try {
|
|
2948
|
-
|
|
3153
|
+
rmSync2(dist, { force: true, recursive: true });
|
|
2949
3154
|
return 0;
|
|
2950
3155
|
} catch (ex) {
|
|
2951
3156
|
const error = ex;
|
|
@@ -2957,13 +3162,13 @@ var reinstall = () => {
|
|
|
2957
3162
|
};
|
|
2958
3163
|
|
|
2959
3164
|
// src/actions/relint.ts
|
|
2960
|
-
import
|
|
3165
|
+
import chalk40 from "chalk";
|
|
2961
3166
|
var relintPackage = ({
|
|
2962
3167
|
pkg,
|
|
2963
3168
|
fix: fix2,
|
|
2964
3169
|
verbose
|
|
2965
3170
|
}) => {
|
|
2966
|
-
console.log(
|
|
3171
|
+
console.log(chalk40.gray(`${fix2 ? "Fix" : "Lint"} [${pkg}]`));
|
|
2967
3172
|
const start = Date.now();
|
|
2968
3173
|
const result = runSteps(`${fix2 ? "Fix" : "Lint"} [${pkg}]`, [
|
|
2969
3174
|
["yarn", [
|
|
@@ -2973,7 +3178,7 @@ var relintPackage = ({
|
|
|
2973
3178
|
fix2 ? "package-fix" : verbose ? "package-lint-verbose" : "package-lint"
|
|
2974
3179
|
]]
|
|
2975
3180
|
]);
|
|
2976
|
-
console.log(
|
|
3181
|
+
console.log(chalk40.gray(`${fix2 ? "Fixed in" : "Linted in"} [${chalk40.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk40.gray("seconds")}`));
|
|
2977
3182
|
return result;
|
|
2978
3183
|
};
|
|
2979
3184
|
var relint = ({
|
|
@@ -2993,21 +3198,21 @@ var relint = ({
|
|
|
2993
3198
|
});
|
|
2994
3199
|
};
|
|
2995
3200
|
var relintAllPackages = ({ fix: fix2 = false } = {}) => {
|
|
2996
|
-
console.log(
|
|
3201
|
+
console.log(chalk40.gray(`${fix2 ? "Fix" : "Lint"} [All-Packages]`));
|
|
2997
3202
|
const start = Date.now();
|
|
2998
3203
|
const fixOptions = fix2 ? ["--fix"] : [];
|
|
2999
3204
|
const result = runSteps(`${fix2 ? "Fix" : "Lint"} [All-Packages]`, [
|
|
3000
3205
|
["yarn", ["eslint", ...fixOptions]]
|
|
3001
3206
|
]);
|
|
3002
|
-
console.log(
|
|
3207
|
+
console.log(chalk40.gray(`${fix2 ? "Fixed in" : "Linted in"} [${chalk40.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk40.gray("seconds")}`));
|
|
3003
3208
|
return result;
|
|
3004
3209
|
};
|
|
3005
3210
|
|
|
3006
3211
|
// src/actions/retest.ts
|
|
3007
3212
|
var retest = () => {
|
|
3008
3213
|
return runSteps("Test", [
|
|
3009
|
-
["yarn", ["
|
|
3010
|
-
["yarn", ["
|
|
3214
|
+
["yarn", ["vitest", "--clearCache"]],
|
|
3215
|
+
["yarn", ["vitest", "."]]
|
|
3011
3216
|
]);
|
|
3012
3217
|
};
|
|
3013
3218
|
|
|
@@ -3017,10 +3222,10 @@ var sonar = () => {
|
|
|
3017
3222
|
};
|
|
3018
3223
|
|
|
3019
3224
|
// src/actions/statics.ts
|
|
3020
|
-
import
|
|
3225
|
+
import chalk41 from "chalk";
|
|
3021
3226
|
var DefaultDependencies = ["axios", "@xylabs/pixel", "react", "graphql", "react-router", "@mui/material", "@mui/system"];
|
|
3022
3227
|
var statics = () => {
|
|
3023
|
-
console.log(
|
|
3228
|
+
console.log(chalk41.green("Check Required Static Dependencies"));
|
|
3024
3229
|
const statics2 = parsedPackageJSON()?.xy?.deps?.statics;
|
|
3025
3230
|
return detectDuplicateDependencies(statics2, DefaultDependencies);
|
|
3026
3231
|
};
|
|
@@ -3073,6 +3278,7 @@ export {
|
|
|
3073
3278
|
claudeCommands,
|
|
3074
3279
|
claudeRules,
|
|
3075
3280
|
claudeSettings,
|
|
3281
|
+
claudeSkills,
|
|
3076
3282
|
clean,
|
|
3077
3283
|
cleanAll,
|
|
3078
3284
|
cleanDocs,
|
|
@@ -3122,6 +3328,7 @@ export {
|
|
|
3122
3328
|
publintPackage,
|
|
3123
3329
|
publish,
|
|
3124
3330
|
readmeGen,
|
|
3331
|
+
readmeInit,
|
|
3125
3332
|
rebuild,
|
|
3126
3333
|
recompile,
|
|
3127
3334
|
recompileAll,
|