@xylabs/ts-scripts-yarn3 7.4.11 → 7.4.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/actions/index.mjs +294 -148
- package/dist/actions/index.mjs.map +1 -1
- package/dist/actions/readme-gen.mjs +173 -0
- package/dist/actions/readme-gen.mjs.map +1 -0
- package/dist/bin/xy.mjs +275 -107
- package/dist/bin/xy.mjs.map +1 -1
- package/dist/index.d.ts +17 -1
- package/dist/index.mjs +335 -165
- package/dist/index.mjs.map +1 -1
- package/dist/lib/generateReadmeFiles.mjs +160 -0
- package/dist/lib/generateReadmeFiles.mjs.map +1 -0
- package/dist/lib/index.mjs +145 -14
- package/dist/lib/index.mjs.map +1 -1
- package/dist/xy/index.mjs +275 -107
- package/dist/xy/index.mjs.map +1 -1
- package/dist/xy/xy.mjs +275 -107
- package/dist/xy/xy.mjs.map +1 -1
- package/dist/xy/xyCommonCommands.mjs +210 -42
- package/dist/xy/xyCommonCommands.mjs.map +1 -1
- package/package.json +2 -2
package/dist/xy/xy.mjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
// src/xy/xy.ts
|
|
2
|
-
import
|
|
2
|
+
import chalk30 from "chalk";
|
|
3
3
|
|
|
4
4
|
// src/actions/build.ts
|
|
5
|
-
import
|
|
5
|
+
import chalk9 from "chalk";
|
|
6
6
|
|
|
7
7
|
// src/lib/checkResult.ts
|
|
8
8
|
import chalk from "chalk";
|
|
@@ -324,8 +324,138 @@ var generateIgnoreFiles = (filename3, pkg) => {
|
|
|
324
324
|
return succeeded ? 0 : 1;
|
|
325
325
|
};
|
|
326
326
|
|
|
327
|
-
// src/lib/
|
|
327
|
+
// src/lib/generateReadmeFiles.ts
|
|
328
|
+
import { execSync as execSync2 } from "child_process";
|
|
329
|
+
import FS from "fs";
|
|
330
|
+
import { readFile, writeFile } from "fs/promises";
|
|
331
|
+
import PATH2 from "path";
|
|
328
332
|
import chalk5 from "chalk";
|
|
333
|
+
function fillTemplate(template, data) {
|
|
334
|
+
const additionalData = { ...data, safeName: data.name.replaceAll("/", "__").replaceAll("@", "") };
|
|
335
|
+
return template.replaceAll(/\{\{(.*?)\}\}/g, (_, key) => additionalData[key.trim()] ?? "");
|
|
336
|
+
}
|
|
337
|
+
function generateTypedoc(packageLocation, entryPoints) {
|
|
338
|
+
const tempDir = PATH2.join(packageLocation, ".temp-typedoc");
|
|
339
|
+
try {
|
|
340
|
+
if (!FS.existsSync(tempDir)) {
|
|
341
|
+
FS.mkdirSync(tempDir, { recursive: true });
|
|
342
|
+
}
|
|
343
|
+
const typedocConfig = {
|
|
344
|
+
disableSources: true,
|
|
345
|
+
entryPointStrategy: "expand",
|
|
346
|
+
entryPoints: entryPoints.map((ep) => PATH2.resolve(packageLocation, ep)),
|
|
347
|
+
excludeExternals: true,
|
|
348
|
+
excludeInternal: true,
|
|
349
|
+
excludePrivate: true,
|
|
350
|
+
githubPages: false,
|
|
351
|
+
hideBreadcrumbs: true,
|
|
352
|
+
hideGenerator: true,
|
|
353
|
+
hidePageTitle: true,
|
|
354
|
+
out: tempDir,
|
|
355
|
+
plugin: ["typedoc-plugin-markdown"],
|
|
356
|
+
readme: "none",
|
|
357
|
+
skipErrorChecking: true,
|
|
358
|
+
sort: ["source-order"],
|
|
359
|
+
theme: "markdown",
|
|
360
|
+
useCodeBlocks: true
|
|
361
|
+
};
|
|
362
|
+
const typedocJsonPath = PATH2.join(tempDir, "typedoc.json");
|
|
363
|
+
FS.writeFileSync(typedocJsonPath, JSON.stringify(typedocConfig, null, 2));
|
|
364
|
+
try {
|
|
365
|
+
execSync2(`npx typedoc --options ${typedocJsonPath}`, {
|
|
366
|
+
cwd: process.cwd(),
|
|
367
|
+
stdio: ["ignore", "pipe", "pipe"]
|
|
368
|
+
});
|
|
369
|
+
} catch {
|
|
370
|
+
return "";
|
|
371
|
+
}
|
|
372
|
+
return consolidateMarkdown(tempDir);
|
|
373
|
+
} catch {
|
|
374
|
+
return "";
|
|
375
|
+
} finally {
|
|
376
|
+
try {
|
|
377
|
+
FS.rmSync(tempDir, { force: true, recursive: true });
|
|
378
|
+
} catch {
|
|
379
|
+
}
|
|
380
|
+
}
|
|
381
|
+
}
|
|
382
|
+
function consolidateMarkdown(tempDir) {
|
|
383
|
+
let consolidated = "## Reference\n\n";
|
|
384
|
+
const mainReadmePath = PATH2.join(tempDir, "README.md");
|
|
385
|
+
if (FS.existsSync(mainReadmePath)) {
|
|
386
|
+
const mainContent = FS.readFileSync(mainReadmePath, "utf8").replace(/^---(.|\n)*?---\n/, "").replace(/^# .+\n/, "").replaceAll(/\]\((.+?)\.md\)/g, "](#$1)");
|
|
387
|
+
consolidated += mainContent + "\n\n";
|
|
388
|
+
}
|
|
389
|
+
consolidated += processDirectory(tempDir);
|
|
390
|
+
return consolidated.replaceAll(/\n\n\n+/g, "\n\n").replaceAll(/^#### /gm, "### ").replaceAll(/^##### /gm, "#### ").replaceAll(/^###### /gm, "##### ");
|
|
391
|
+
}
|
|
392
|
+
function processDirectory(dir, level = 0) {
|
|
393
|
+
const indent = " ".repeat(level);
|
|
394
|
+
let content = "";
|
|
395
|
+
try {
|
|
396
|
+
const items = FS.readdirSync(dir, { withFileTypes: true });
|
|
397
|
+
for (const item of items) {
|
|
398
|
+
if (item.isDirectory()) continue;
|
|
399
|
+
if (item.name === "README.md" || !item.name.endsWith(".md")) continue;
|
|
400
|
+
const fileContent = FS.readFileSync(PATH2.join(dir, item.name), "utf8").replace(/^---(.|\n)*?---\n/, "");
|
|
401
|
+
const moduleName = item.name.replace(".md", "");
|
|
402
|
+
content += `
|
|
403
|
+
|
|
404
|
+
${indent}### <a id="${moduleName}"></a>${moduleName}
|
|
405
|
+
|
|
406
|
+
`;
|
|
407
|
+
content += fileContent.replace(/^# .+\n/, "").replaceAll(/\]\((.+?)\.md\)/g, "](#$1)");
|
|
408
|
+
}
|
|
409
|
+
for (const item of items) {
|
|
410
|
+
if (!item.isDirectory()) continue;
|
|
411
|
+
if (item.name === "spec" || item.name.includes(".spec")) continue;
|
|
412
|
+
content += `
|
|
413
|
+
|
|
414
|
+
${indent}### ${item.name}
|
|
415
|
+
`;
|
|
416
|
+
content += processDirectory(PATH2.join(dir, item.name), level + 1);
|
|
417
|
+
}
|
|
418
|
+
} catch {
|
|
419
|
+
}
|
|
420
|
+
return content;
|
|
421
|
+
}
|
|
422
|
+
async function generateReadmeFiles({
|
|
423
|
+
pkg,
|
|
424
|
+
templatePath,
|
|
425
|
+
typedoc = false,
|
|
426
|
+
verbose
|
|
427
|
+
}) {
|
|
428
|
+
console.log(chalk5.green("Generate README Files"));
|
|
429
|
+
const cwd = INIT_CWD() ?? ".";
|
|
430
|
+
const resolvedTemplatePath = templatePath ?? PATH2.join(cwd, "scripts", "README.template.md");
|
|
431
|
+
let template;
|
|
432
|
+
try {
|
|
433
|
+
template = await readFile(resolvedTemplatePath, "utf8");
|
|
434
|
+
} catch {
|
|
435
|
+
console.error(chalk5.red(`Template not found: ${resolvedTemplatePath}`));
|
|
436
|
+
return 1;
|
|
437
|
+
}
|
|
438
|
+
const workspaces = pkg ? [yarnWorkspace(pkg)] : yarnWorkspaces();
|
|
439
|
+
let failed = false;
|
|
440
|
+
for (const { location, name } of workspaces) {
|
|
441
|
+
try {
|
|
442
|
+
const pkgJsonPath = PATH2.join(location, "package.json");
|
|
443
|
+
const pkgJson = JSON.parse(await readFile(pkgJsonPath, "utf8"));
|
|
444
|
+
const typedocContent = typedoc ? generateTypedoc(location, ["src/index*.ts"]) : "";
|
|
445
|
+
const readmeContent = fillTemplate(template, { ...pkgJson, typedoc: typedocContent });
|
|
446
|
+
await writeFile(PATH2.join(location, "README.md"), readmeContent);
|
|
447
|
+
if (verbose) console.log(chalk5.green(` ${name}`));
|
|
448
|
+
} catch (ex) {
|
|
449
|
+
const error = ex;
|
|
450
|
+
console.warn(chalk5.yellow(` Skipped ${location}: ${error.message}`));
|
|
451
|
+
failed = true;
|
|
452
|
+
}
|
|
453
|
+
}
|
|
454
|
+
return failed ? 1 : 0;
|
|
455
|
+
}
|
|
456
|
+
|
|
457
|
+
// src/lib/loadConfig.ts
|
|
458
|
+
import chalk6 from "chalk";
|
|
329
459
|
import { cosmiconfig } from "cosmiconfig";
|
|
330
460
|
import { TypeScriptLoader } from "cosmiconfig-typescript-loader";
|
|
331
461
|
import deepmerge from "deepmerge";
|
|
@@ -336,9 +466,9 @@ var loadConfig = async (params) => {
|
|
|
336
466
|
config = cosmicConfigResult?.config;
|
|
337
467
|
const configFilePath = cosmicConfigResult?.filepath;
|
|
338
468
|
if (configFilePath !== void 0) {
|
|
339
|
-
console.log(
|
|
469
|
+
console.log(chalk6.green(`Loaded config from ${configFilePath}`));
|
|
340
470
|
if (config.verbose) {
|
|
341
|
-
console.log(
|
|
471
|
+
console.log(chalk6.gray(`${JSON.stringify(config, null, 2)}`));
|
|
342
472
|
}
|
|
343
473
|
}
|
|
344
474
|
}
|
|
@@ -356,15 +486,15 @@ var parsedPackageJSON = (path8) => {
|
|
|
356
486
|
// src/lib/runSteps.ts
|
|
357
487
|
import { spawnSync as spawnSync3 } from "child_process";
|
|
358
488
|
import { existsSync as existsSync2 } from "fs";
|
|
359
|
-
import
|
|
489
|
+
import chalk7 from "chalk";
|
|
360
490
|
var runSteps = (name, steps, exitOnFail = true, messages) => {
|
|
361
491
|
return safeExit(() => {
|
|
362
492
|
const pkgName = process.env.npm_package_name;
|
|
363
|
-
console.log(
|
|
493
|
+
console.log(chalk7.green(`${name} [${pkgName}]`));
|
|
364
494
|
let totalStatus = 0;
|
|
365
495
|
for (const [i, [command, args, config2]] of steps.entries()) {
|
|
366
496
|
if (messages?.[i]) {
|
|
367
|
-
console.log(
|
|
497
|
+
console.log(chalk7.gray(messages?.[i]));
|
|
368
498
|
}
|
|
369
499
|
const argList = Array.isArray(args) ? args : args.split(" ");
|
|
370
500
|
if (command === "node" && !existsSync2(argList[0])) {
|
|
@@ -387,12 +517,12 @@ var runSteps = (name, steps, exitOnFail = true, messages) => {
|
|
|
387
517
|
// src/lib/runStepsAsync.ts
|
|
388
518
|
import { spawn } from "child_process";
|
|
389
519
|
import { existsSync as existsSync3 } from "fs";
|
|
390
|
-
import
|
|
520
|
+
import chalk8 from "chalk";
|
|
391
521
|
var runStepAsync = (name, step, exitOnFail = true, message) => {
|
|
392
522
|
return new Promise((resolve) => {
|
|
393
523
|
const [command, args, config2] = step;
|
|
394
524
|
if (message) {
|
|
395
|
-
console.log(
|
|
525
|
+
console.log(chalk8.gray(message));
|
|
396
526
|
}
|
|
397
527
|
const argList = Array.isArray(args) ? args : args.split(" ");
|
|
398
528
|
if (command === "node" && !existsSync3(argList[0])) {
|
|
@@ -406,8 +536,8 @@ var runStepAsync = (name, step, exitOnFail = true, message) => {
|
|
|
406
536
|
}).on("close", (code) => {
|
|
407
537
|
if (code) {
|
|
408
538
|
console.error(
|
|
409
|
-
|
|
410
|
-
`Command Exited With Non-Zero Result [${
|
|
539
|
+
chalk8.red(
|
|
540
|
+
`Command Exited With Non-Zero Result [${chalk8.gray(code)}] | ${chalk8.yellow(command)} ${chalk8.white(
|
|
411
541
|
Array.isArray(args) ? args.join(" ") : args
|
|
412
542
|
)}`
|
|
413
543
|
)
|
|
@@ -423,7 +553,7 @@ var runStepAsync = (name, step, exitOnFail = true, message) => {
|
|
|
423
553
|
var runStepsAsync = async (name, steps, exitOnFail = true, messages) => {
|
|
424
554
|
return await safeExitAsync(async () => {
|
|
425
555
|
const pkgName = process.env.npm_package_name;
|
|
426
|
-
console.log(
|
|
556
|
+
console.log(chalk8.green(`${name} [${pkgName}]`));
|
|
427
557
|
let result = 0;
|
|
428
558
|
for (const [i, step] of steps.entries()) {
|
|
429
559
|
result += await runStepAsync(name, step, exitOnFail, messages?.[i]);
|
|
@@ -447,7 +577,7 @@ var build = async ({
|
|
|
447
577
|
const targetOptions = target === void 0 ? [] : ["-t", target];
|
|
448
578
|
const jobsOptions = jobs === void 0 ? [] : ["-j", `${jobs}`];
|
|
449
579
|
if (jobs !== void 0) {
|
|
450
|
-
console.log(
|
|
580
|
+
console.log(chalk9.blue(`Jobs set to [${jobs}]`));
|
|
451
581
|
}
|
|
452
582
|
const result = await runStepsAsync(`Build${incremental ? "-Incremental" : ""} [${pkg ?? "All"}]`, [
|
|
453
583
|
["yarn", ["xy", "compile", ...pkgOptions, ...targetOptions, ...verboseOptions, ...jobsOptions, ...incrementalOptions, "--types", "tsup"]],
|
|
@@ -455,7 +585,7 @@ var build = async ({
|
|
|
455
585
|
["yarn", ["xy", "deplint", ...pkgOptions, ...verboseOptions, ...jobsOptions, ...incrementalOptions]],
|
|
456
586
|
["yarn", ["xy", "lint", ...pkgOptions, ...verboseOptions, ...incrementalOptions]]
|
|
457
587
|
]);
|
|
458
|
-
console.log(`${
|
|
588
|
+
console.log(`${chalk9.gray("Built in")} [${chalk9.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk9.gray("seconds")}`);
|
|
459
589
|
return result;
|
|
460
590
|
};
|
|
461
591
|
|
|
@@ -468,15 +598,15 @@ import {
|
|
|
468
598
|
unlinkSync,
|
|
469
599
|
writeFileSync as writeFileSync2
|
|
470
600
|
} from "fs";
|
|
471
|
-
import
|
|
472
|
-
import
|
|
601
|
+
import PATH3 from "path";
|
|
602
|
+
import chalk10 from "chalk";
|
|
473
603
|
var syncCommandFiles = (commandsDir) => {
|
|
474
604
|
const templates = claudeCommandTemplates();
|
|
475
605
|
const templateNames = new Set(Object.keys(templates));
|
|
476
606
|
let updated = 0;
|
|
477
607
|
let created = 0;
|
|
478
608
|
for (const [filename3, content] of Object.entries(templates)) {
|
|
479
|
-
const targetPath =
|
|
609
|
+
const targetPath = PATH3.resolve(commandsDir, filename3);
|
|
480
610
|
const existing = existsSync4(targetPath) ? readFileSync4(targetPath, "utf8") : void 0;
|
|
481
611
|
if (existing === content) continue;
|
|
482
612
|
writeFileSync2(targetPath, content, "utf8");
|
|
@@ -497,7 +627,7 @@ var removeStaleCommands = (commandsDir, templateNames) => {
|
|
|
497
627
|
let removed = 0;
|
|
498
628
|
for (const file of existingCommands) {
|
|
499
629
|
if (!templateNames.has(file)) {
|
|
500
|
-
unlinkSync(
|
|
630
|
+
unlinkSync(PATH3.resolve(commandsDir, file));
|
|
501
631
|
removed++;
|
|
502
632
|
}
|
|
503
633
|
}
|
|
@@ -510,14 +640,14 @@ var logCommandsResult = (created, updated, removed) => {
|
|
|
510
640
|
updated ? `${updated} updated` : "",
|
|
511
641
|
removed ? `${removed} removed` : ""
|
|
512
642
|
].filter(Boolean);
|
|
513
|
-
console.log(
|
|
643
|
+
console.log(chalk10.green(`.claude/commands/${XYLABS_COMMANDS_PREFIX}*.md: ${parts.join(", ")}`));
|
|
514
644
|
} else {
|
|
515
|
-
console.log(
|
|
645
|
+
console.log(chalk10.gray(`.claude/commands/${XYLABS_COMMANDS_PREFIX}*.md: already up to date`));
|
|
516
646
|
}
|
|
517
647
|
};
|
|
518
648
|
var claudeCommands = () => {
|
|
519
649
|
const cwd = INIT_CWD() ?? process.cwd();
|
|
520
|
-
const commandsDir =
|
|
650
|
+
const commandsDir = PATH3.resolve(cwd, ".claude", "commands");
|
|
521
651
|
mkdirSync(commandsDir, { recursive: true });
|
|
522
652
|
const {
|
|
523
653
|
created,
|
|
@@ -538,15 +668,15 @@ import {
|
|
|
538
668
|
unlinkSync as unlinkSync2,
|
|
539
669
|
writeFileSync as writeFileSync3
|
|
540
670
|
} from "fs";
|
|
541
|
-
import
|
|
542
|
-
import
|
|
671
|
+
import PATH4 from "path";
|
|
672
|
+
import chalk11 from "chalk";
|
|
543
673
|
var syncRuleFiles = (rulesDir) => {
|
|
544
674
|
const templates = claudeMdRuleTemplates();
|
|
545
675
|
const templateNames = new Set(Object.keys(templates));
|
|
546
676
|
let updated = 0;
|
|
547
677
|
let created = 0;
|
|
548
678
|
for (const [filename3, content] of Object.entries(templates)) {
|
|
549
|
-
const targetPath =
|
|
679
|
+
const targetPath = PATH4.resolve(rulesDir, filename3);
|
|
550
680
|
const existing = existsSync5(targetPath) ? readFileSync5(targetPath, "utf8") : void 0;
|
|
551
681
|
if (existing === content) continue;
|
|
552
682
|
writeFileSync3(targetPath, content, "utf8");
|
|
@@ -567,7 +697,7 @@ var removeStaleRules = (rulesDir, templateNames) => {
|
|
|
567
697
|
let removed = 0;
|
|
568
698
|
for (const file of existingRules) {
|
|
569
699
|
if (!templateNames.has(file)) {
|
|
570
|
-
unlinkSync2(
|
|
700
|
+
unlinkSync2(PATH4.resolve(rulesDir, file));
|
|
571
701
|
removed++;
|
|
572
702
|
}
|
|
573
703
|
}
|
|
@@ -580,26 +710,26 @@ var logRulesResult = (created, updated, removed) => {
|
|
|
580
710
|
updated ? `${updated} updated` : "",
|
|
581
711
|
removed ? `${removed} removed` : ""
|
|
582
712
|
].filter(Boolean);
|
|
583
|
-
console.log(
|
|
713
|
+
console.log(chalk11.green(`.claude/rules/${XYLABS_RULES_PREFIX}*.md: ${parts.join(", ")}`));
|
|
584
714
|
} else {
|
|
585
|
-
console.log(
|
|
715
|
+
console.log(chalk11.gray(`.claude/rules/${XYLABS_RULES_PREFIX}*.md: already up to date`));
|
|
586
716
|
}
|
|
587
717
|
};
|
|
588
718
|
var ensureProjectClaudeMd = (cwd, force) => {
|
|
589
|
-
const projectPath =
|
|
719
|
+
const projectPath = PATH4.resolve(cwd, "CLAUDE.md");
|
|
590
720
|
if (!existsSync5(projectPath) || force) {
|
|
591
721
|
if (force && existsSync5(projectPath)) {
|
|
592
|
-
console.log(
|
|
722
|
+
console.log(chalk11.yellow("Overwriting existing CLAUDE.md"));
|
|
593
723
|
}
|
|
594
724
|
writeFileSync3(projectPath, claudeMdProjectTemplate(), "utf8");
|
|
595
|
-
console.log(
|
|
725
|
+
console.log(chalk11.green("Generated CLAUDE.md"));
|
|
596
726
|
} else {
|
|
597
|
-
console.log(
|
|
727
|
+
console.log(chalk11.gray("CLAUDE.md already exists (skipped)"));
|
|
598
728
|
}
|
|
599
729
|
};
|
|
600
730
|
var claudeRules = ({ force } = {}) => {
|
|
601
731
|
const cwd = INIT_CWD() ?? process.cwd();
|
|
602
|
-
const rulesDir =
|
|
732
|
+
const rulesDir = PATH4.resolve(cwd, ".claude", "rules");
|
|
603
733
|
mkdirSync2(rulesDir, { recursive: true });
|
|
604
734
|
const {
|
|
605
735
|
created,
|
|
@@ -626,16 +756,16 @@ var cleanAll = ({ verbose }) => {
|
|
|
626
756
|
|
|
627
757
|
// src/actions/clean-docs.ts
|
|
628
758
|
import path from "path";
|
|
629
|
-
import
|
|
759
|
+
import chalk12 from "chalk";
|
|
630
760
|
var cleanDocs = () => {
|
|
631
761
|
const pkgName = process.env.npm_package_name;
|
|
632
|
-
console.log(
|
|
762
|
+
console.log(chalk12.green(`Cleaning Docs [${pkgName}]`));
|
|
633
763
|
for (const { location } of yarnWorkspaces()) deleteGlob(path.join(location, "docs"));
|
|
634
764
|
return 0;
|
|
635
765
|
};
|
|
636
766
|
|
|
637
767
|
// src/actions/compile.ts
|
|
638
|
-
import
|
|
768
|
+
import chalk13 from "chalk";
|
|
639
769
|
var compile = ({
|
|
640
770
|
verbose,
|
|
641
771
|
target,
|
|
@@ -676,7 +806,7 @@ var compileAll = ({
|
|
|
676
806
|
const incrementalOptions = incremental ? ["--since", "-Ap", "--topological-dev"] : ["--parallel", "-Ap", "--topological-dev"];
|
|
677
807
|
const jobsOptions = jobs ? ["-j", `${jobs}`] : [];
|
|
678
808
|
if (jobs) {
|
|
679
|
-
console.log(
|
|
809
|
+
console.log(chalk13.blue(`Jobs set to [${jobs}]`));
|
|
680
810
|
}
|
|
681
811
|
const result = runSteps(`Compile${incremental ? "-Incremental" : ""} [All]`, [
|
|
682
812
|
["yarn", [
|
|
@@ -690,13 +820,13 @@ var compileAll = ({
|
|
|
690
820
|
...targetOptions
|
|
691
821
|
]]
|
|
692
822
|
]);
|
|
693
|
-
console.log(`${
|
|
823
|
+
console.log(`${chalk13.gray("Compiled in")} [${chalk13.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk13.gray("seconds")}`);
|
|
694
824
|
return result;
|
|
695
825
|
};
|
|
696
826
|
|
|
697
827
|
// src/actions/copy-assets.ts
|
|
698
828
|
import path2 from "path/posix";
|
|
699
|
-
import
|
|
829
|
+
import chalk14 from "chalk";
|
|
700
830
|
import cpy from "cpy";
|
|
701
831
|
var copyPackageTargetAssets = async (target, name, location) => {
|
|
702
832
|
try {
|
|
@@ -719,7 +849,7 @@ var copyPackageTargetAssets = async (target, name, location) => {
|
|
|
719
849
|
};
|
|
720
850
|
var copyTargetAssets = async (target, pkg) => {
|
|
721
851
|
const workspaces = yarnWorkspaces();
|
|
722
|
-
console.log(
|
|
852
|
+
console.log(chalk14.green(`Copying Assets [${target.toUpperCase()}]`));
|
|
723
853
|
const workspaceList = workspaces.filter(({ name }) => {
|
|
724
854
|
return pkg === void 0 || name === pkg;
|
|
725
855
|
});
|
|
@@ -803,7 +933,7 @@ var dead = () => {
|
|
|
803
933
|
};
|
|
804
934
|
|
|
805
935
|
// src/actions/deplint/deplint.ts
|
|
806
|
-
import
|
|
936
|
+
import chalk20 from "chalk";
|
|
807
937
|
|
|
808
938
|
// src/actions/deplint/findFiles.ts
|
|
809
939
|
import fs2 from "fs";
|
|
@@ -1005,12 +1135,12 @@ function getExternalImportsFromFiles({
|
|
|
1005
1135
|
|
|
1006
1136
|
// src/actions/deplint/checkPackage/getUnlistedDependencies.ts
|
|
1007
1137
|
import { builtinModules } from "module";
|
|
1008
|
-
import
|
|
1138
|
+
import chalk15 from "chalk";
|
|
1009
1139
|
function isListedOrBuiltin(imp, name, dependencies, peerDependencies) {
|
|
1010
1140
|
return dependencies.includes(imp) || imp === name || dependencies.includes(`@types/${imp}`) || peerDependencies.includes(imp) || peerDependencies.includes(`@types/${imp}`) || builtinModules.includes(imp) || builtinModules.includes(`@types/${imp}`);
|
|
1011
1141
|
}
|
|
1012
1142
|
function logMissing(name, imp, importPaths) {
|
|
1013
|
-
console.log(`[${
|
|
1143
|
+
console.log(`[${chalk15.blue(name)}] Missing dependency in package.json: ${chalk15.red(imp)}`);
|
|
1014
1144
|
if (importPaths[imp]) {
|
|
1015
1145
|
console.log(` ${importPaths[imp].join("\n ")}`);
|
|
1016
1146
|
}
|
|
@@ -1035,7 +1165,7 @@ function getUnlistedDependencies({ name, location }, { dependencies, peerDepende
|
|
|
1035
1165
|
}
|
|
1036
1166
|
if (unlistedDependencies > 0) {
|
|
1037
1167
|
const packageLocation = `${location}/package.json`;
|
|
1038
|
-
console.log(` ${
|
|
1168
|
+
console.log(` ${chalk15.yellow(packageLocation)}
|
|
1039
1169
|
`);
|
|
1040
1170
|
}
|
|
1041
1171
|
return unlistedDependencies;
|
|
@@ -1043,7 +1173,7 @@ function getUnlistedDependencies({ name, location }, { dependencies, peerDepende
|
|
|
1043
1173
|
|
|
1044
1174
|
// src/actions/deplint/checkPackage/getUnlistedDevDependencies.ts
|
|
1045
1175
|
import { builtinModules as builtinModules2 } from "module";
|
|
1046
|
-
import
|
|
1176
|
+
import chalk16 from "chalk";
|
|
1047
1177
|
function getUnlistedDevDependencies({ name, location }, {
|
|
1048
1178
|
devDependencies,
|
|
1049
1179
|
dependencies,
|
|
@@ -1057,7 +1187,7 @@ function getUnlistedDevDependencies({ name, location }, {
|
|
|
1057
1187
|
for (const imp of externalAllImports) {
|
|
1058
1188
|
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)) {
|
|
1059
1189
|
unlistedDevDependencies++;
|
|
1060
|
-
console.log(`[${
|
|
1190
|
+
console.log(`[${chalk16.blue(name)}] Missing devDependency in package.json: ${chalk16.red(imp)}`);
|
|
1061
1191
|
if (allImportPaths[imp]) {
|
|
1062
1192
|
console.log(` ${allImportPaths[imp].join("\n ")}`);
|
|
1063
1193
|
}
|
|
@@ -1065,14 +1195,14 @@ function getUnlistedDevDependencies({ name, location }, {
|
|
|
1065
1195
|
}
|
|
1066
1196
|
if (unlistedDevDependencies > 0) {
|
|
1067
1197
|
const packageLocation = `${location}/package.json`;
|
|
1068
|
-
console.log(` ${
|
|
1198
|
+
console.log(` ${chalk16.yellow(packageLocation)}
|
|
1069
1199
|
`);
|
|
1070
1200
|
}
|
|
1071
1201
|
return unlistedDevDependencies;
|
|
1072
1202
|
}
|
|
1073
1203
|
|
|
1074
1204
|
// src/actions/deplint/checkPackage/getUnusedDependencies.ts
|
|
1075
|
-
import
|
|
1205
|
+
import chalk17 from "chalk";
|
|
1076
1206
|
function getUnusedDependencies({ name, location }, { dependencies }, {
|
|
1077
1207
|
externalDistImports,
|
|
1078
1208
|
externalDistTypeImports,
|
|
@@ -1084,22 +1214,22 @@ function getUnusedDependencies({ name, location }, { dependencies }, {
|
|
|
1084
1214
|
if (!externalDistImports.includes(dep) && !externalDistImports.includes(dep.replace(/^@types\//, "")) && !externalDistTypeImports.includes(dep) && !externalDistTypeImports.includes(dep.replace(/^@types\//, ""))) {
|
|
1085
1215
|
unusedDependencies++;
|
|
1086
1216
|
if (externalAllImports.includes(dep)) {
|
|
1087
|
-
console.log(`[${
|
|
1217
|
+
console.log(`[${chalk17.blue(name)}] dependency should be devDependency in package.json: ${chalk17.red(dep)}`);
|
|
1088
1218
|
} else {
|
|
1089
|
-
console.log(`[${
|
|
1219
|
+
console.log(`[${chalk17.blue(name)}] Unused dependency in package.json: ${chalk17.red(dep)}`);
|
|
1090
1220
|
}
|
|
1091
1221
|
}
|
|
1092
1222
|
}
|
|
1093
1223
|
if (unusedDependencies > 0) {
|
|
1094
1224
|
const packageLocation = `${location}/package.json`;
|
|
1095
|
-
console.log(` ${
|
|
1225
|
+
console.log(` ${chalk17.yellow(packageLocation)}
|
|
1096
1226
|
`);
|
|
1097
1227
|
}
|
|
1098
1228
|
return unusedDependencies;
|
|
1099
1229
|
}
|
|
1100
1230
|
|
|
1101
1231
|
// src/actions/deplint/checkPackage/getUnusedDevDependencies.ts
|
|
1102
|
-
import
|
|
1232
|
+
import chalk18 from "chalk";
|
|
1103
1233
|
|
|
1104
1234
|
// src/actions/deplint/getCliReferencedPackagesFromFiles.ts
|
|
1105
1235
|
import fs8 from "fs";
|
|
@@ -1383,19 +1513,19 @@ function getUnusedDevDependencies({ name, location }, {
|
|
|
1383
1513
|
if (dependencies.includes(dep) || peerDependencies.includes(dep)) continue;
|
|
1384
1514
|
if (!isDevDepUsed(dep, allImports, implicitDeps, requiredPeers, scriptRefs, cliRefs)) {
|
|
1385
1515
|
unusedDevDependencies++;
|
|
1386
|
-
console.log(`[${
|
|
1516
|
+
console.log(`[${chalk18.blue(name)}] Unused devDependency in package.json: ${chalk18.red(dep)}`);
|
|
1387
1517
|
}
|
|
1388
1518
|
}
|
|
1389
1519
|
if (unusedDevDependencies > 0) {
|
|
1390
1520
|
const packageLocation = `${location}/package.json`;
|
|
1391
|
-
console.log(` ${
|
|
1521
|
+
console.log(` ${chalk18.yellow(packageLocation)}
|
|
1392
1522
|
`);
|
|
1393
1523
|
}
|
|
1394
1524
|
return unusedDevDependencies;
|
|
1395
1525
|
}
|
|
1396
1526
|
|
|
1397
1527
|
// src/actions/deplint/checkPackage/getUnusedPeerDependencies.ts
|
|
1398
|
-
import
|
|
1528
|
+
import chalk19 from "chalk";
|
|
1399
1529
|
function getUnusedPeerDependencies({ name, location }, { peerDependencies, dependencies }, { externalDistImports, externalDistTypeImports }, exclude) {
|
|
1400
1530
|
let unusedDependencies = 0;
|
|
1401
1531
|
for (const dep of peerDependencies) {
|
|
@@ -1403,15 +1533,15 @@ function getUnusedPeerDependencies({ name, location }, { peerDependencies, depen
|
|
|
1403
1533
|
if (!externalDistImports.includes(dep) && !externalDistImports.includes(dep.replace(/^@types\//, "")) && !externalDistTypeImports.includes(dep) && !externalDistTypeImports.includes(dep.replace(/^@types\//, ""))) {
|
|
1404
1534
|
unusedDependencies++;
|
|
1405
1535
|
if (dependencies.includes(dep)) {
|
|
1406
|
-
console.log(`[${
|
|
1536
|
+
console.log(`[${chalk19.blue(name)}] Unused peerDependency [already a dependency] in package.json: ${chalk19.red(dep)}`);
|
|
1407
1537
|
} else {
|
|
1408
|
-
console.log(`[${
|
|
1538
|
+
console.log(`[${chalk19.blue(name)}] Unused peerDependency in package.json: ${chalk19.red(dep)}`);
|
|
1409
1539
|
}
|
|
1410
1540
|
}
|
|
1411
1541
|
}
|
|
1412
1542
|
if (unusedDependencies > 0) {
|
|
1413
1543
|
const packageLocation = `${location}/package.json`;
|
|
1414
|
-
console.log(` ${
|
|
1544
|
+
console.log(` ${chalk19.yellow(packageLocation)}
|
|
1415
1545
|
`);
|
|
1416
1546
|
}
|
|
1417
1547
|
return unusedDependencies;
|
|
@@ -1506,9 +1636,9 @@ var deplint = async ({
|
|
|
1506
1636
|
});
|
|
1507
1637
|
}
|
|
1508
1638
|
if (totalErrors > 0) {
|
|
1509
|
-
console.warn(`Deplint: Found ${
|
|
1639
|
+
console.warn(`Deplint: Found ${chalk20.red(totalErrors)} dependency problems. ${chalk20.red("\u2716")}`);
|
|
1510
1640
|
} else {
|
|
1511
|
-
console.info(`Deplint: Found no dependency problems. ${
|
|
1641
|
+
console.info(`Deplint: Found no dependency problems. ${chalk20.green("\u2714")}`);
|
|
1512
1642
|
}
|
|
1513
1643
|
return 0;
|
|
1514
1644
|
};
|
|
@@ -1610,22 +1740,22 @@ var deployNext = () => {
|
|
|
1610
1740
|
};
|
|
1611
1741
|
|
|
1612
1742
|
// src/actions/dupdeps.ts
|
|
1613
|
-
import
|
|
1743
|
+
import chalk21 from "chalk";
|
|
1614
1744
|
var dupdeps = () => {
|
|
1615
|
-
console.log(
|
|
1745
|
+
console.log(chalk21.green("Checking all Dependencies for Duplicates"));
|
|
1616
1746
|
const allDependencies = parsedPackageJSON()?.dependencies;
|
|
1617
1747
|
const dependencies = Object.entries(allDependencies).map(([k]) => k);
|
|
1618
1748
|
return detectDuplicateDependencies(dependencies);
|
|
1619
1749
|
};
|
|
1620
1750
|
|
|
1621
1751
|
// src/actions/lint.ts
|
|
1622
|
-
import
|
|
1752
|
+
import chalk22 from "chalk";
|
|
1623
1753
|
var lintPackage = ({
|
|
1624
1754
|
pkg,
|
|
1625
1755
|
fix: fix2,
|
|
1626
1756
|
verbose
|
|
1627
1757
|
}) => {
|
|
1628
|
-
console.log(
|
|
1758
|
+
console.log(chalk22.gray(`${fix2 ? "Fix" : "Lint"} [${pkg}]`));
|
|
1629
1759
|
const start = Date.now();
|
|
1630
1760
|
const result = runSteps(`${fix2 ? "Fix" : "Lint"} [${pkg}]`, [
|
|
1631
1761
|
["yarn", [
|
|
@@ -1635,7 +1765,7 @@ var lintPackage = ({
|
|
|
1635
1765
|
fix2 ? "package-fix" : verbose ? "package-lint-verbose" : "package-lint"
|
|
1636
1766
|
]]
|
|
1637
1767
|
]);
|
|
1638
|
-
console.log(
|
|
1768
|
+
console.log(chalk22.gray(`${fix2 ? "Fixed in" : "Linted in"} [${chalk22.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk22.gray("seconds")}`));
|
|
1639
1769
|
return result;
|
|
1640
1770
|
};
|
|
1641
1771
|
var lint = ({
|
|
@@ -1655,13 +1785,13 @@ var lint = ({
|
|
|
1655
1785
|
});
|
|
1656
1786
|
};
|
|
1657
1787
|
var lintAllPackages = ({ fix: fix2 = false } = {}) => {
|
|
1658
|
-
console.log(
|
|
1788
|
+
console.log(chalk22.gray(`${fix2 ? "Fix" : "Lint"} [All-Packages]`));
|
|
1659
1789
|
const start = Date.now();
|
|
1660
1790
|
const fixOptions = fix2 ? ["--fix"] : [];
|
|
1661
1791
|
const result = runSteps(`${fix2 ? "Fix" : "Lint"} [All-Packages]`, [
|
|
1662
1792
|
["yarn", ["eslint", "--cache", "--cache-location", ".eslintcache", "--cache-strategy", "content", ...fixOptions]]
|
|
1663
1793
|
]);
|
|
1664
|
-
console.log(
|
|
1794
|
+
console.log(chalk22.gray(`${fix2 ? "Fixed in" : "Linted in"} [${chalk22.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk22.gray("seconds")}`));
|
|
1665
1795
|
return result;
|
|
1666
1796
|
};
|
|
1667
1797
|
|
|
@@ -1689,7 +1819,7 @@ var filename = ".gitignore";
|
|
|
1689
1819
|
var gitignoreGen = (pkg) => generateIgnoreFiles(filename, pkg);
|
|
1690
1820
|
|
|
1691
1821
|
// src/actions/gitlint.ts
|
|
1692
|
-
import
|
|
1822
|
+
import chalk23 from "chalk";
|
|
1693
1823
|
import ParseGitConfig from "parse-git-config";
|
|
1694
1824
|
var gitlint = () => {
|
|
1695
1825
|
console.log(`
|
|
@@ -1700,7 +1830,7 @@ Gitlint Start [${process.cwd()}]
|
|
|
1700
1830
|
const errors = 0;
|
|
1701
1831
|
const gitConfig = ParseGitConfig.sync();
|
|
1702
1832
|
const warn = (message) => {
|
|
1703
|
-
console.warn(
|
|
1833
|
+
console.warn(chalk23.yellow(`Warning: ${message}`));
|
|
1704
1834
|
warnings++;
|
|
1705
1835
|
};
|
|
1706
1836
|
if (gitConfig.core.ignorecase) {
|
|
@@ -1720,13 +1850,13 @@ Gitlint Start [${process.cwd()}]
|
|
|
1720
1850
|
}
|
|
1721
1851
|
const resultMessages = [];
|
|
1722
1852
|
if (valid > 0) {
|
|
1723
|
-
resultMessages.push(
|
|
1853
|
+
resultMessages.push(chalk23.green(`Passed: ${valid}`));
|
|
1724
1854
|
}
|
|
1725
1855
|
if (warnings > 0) {
|
|
1726
|
-
resultMessages.push(
|
|
1856
|
+
resultMessages.push(chalk23.yellow(`Warnings: ${warnings}`));
|
|
1727
1857
|
}
|
|
1728
1858
|
if (errors > 0) {
|
|
1729
|
-
resultMessages.push(
|
|
1859
|
+
resultMessages.push(chalk23.red(` Errors: ${errors}`));
|
|
1730
1860
|
}
|
|
1731
1861
|
console.warn(`Gitlint Finish [ ${resultMessages.join(" | ")} ]
|
|
1732
1862
|
`);
|
|
@@ -1734,8 +1864,8 @@ Gitlint Start [${process.cwd()}]
|
|
|
1734
1864
|
};
|
|
1735
1865
|
|
|
1736
1866
|
// src/actions/gitlint-fix.ts
|
|
1737
|
-
import { execSync as
|
|
1738
|
-
import
|
|
1867
|
+
import { execSync as execSync3 } from "child_process";
|
|
1868
|
+
import chalk24 from "chalk";
|
|
1739
1869
|
import ParseGitConfig2 from "parse-git-config";
|
|
1740
1870
|
var gitlintFix = () => {
|
|
1741
1871
|
console.log(`
|
|
@@ -1743,16 +1873,16 @@ Gitlint Fix Start [${process.cwd()}]
|
|
|
1743
1873
|
`);
|
|
1744
1874
|
const gitConfig = ParseGitConfig2.sync();
|
|
1745
1875
|
if (gitConfig.core.ignorecase) {
|
|
1746
|
-
|
|
1747
|
-
console.warn(
|
|
1876
|
+
execSync3("git config core.ignorecase false", { stdio: "inherit" });
|
|
1877
|
+
console.warn(chalk24.yellow("\nGitlint Fix: Updated core.ignorecase to be false\n"));
|
|
1748
1878
|
}
|
|
1749
1879
|
if (gitConfig.core.autocrlf !== false) {
|
|
1750
|
-
|
|
1751
|
-
console.warn(
|
|
1880
|
+
execSync3("git config core.autocrlf false", { stdio: "inherit" });
|
|
1881
|
+
console.warn(chalk24.yellow("\nGitlint Fix: Updated core.autocrlf to be false\n"));
|
|
1752
1882
|
}
|
|
1753
1883
|
if (gitConfig.core.eol !== "lf") {
|
|
1754
|
-
|
|
1755
|
-
console.warn(
|
|
1884
|
+
execSync3("git config core.eol lf", { stdio: "inherit" });
|
|
1885
|
+
console.warn(chalk24.yellow('\nGitlint Fix: Updated core.eol to be "lf"\n'));
|
|
1756
1886
|
}
|
|
1757
1887
|
return 1;
|
|
1758
1888
|
};
|
|
@@ -1763,7 +1893,7 @@ var knip = () => {
|
|
|
1763
1893
|
};
|
|
1764
1894
|
|
|
1765
1895
|
// src/actions/license.ts
|
|
1766
|
-
import
|
|
1896
|
+
import chalk25 from "chalk";
|
|
1767
1897
|
import { init } from "license-checker";
|
|
1768
1898
|
var license = async (pkg) => {
|
|
1769
1899
|
const workspaces = yarnWorkspaces();
|
|
@@ -1788,18 +1918,18 @@ var license = async (pkg) => {
|
|
|
1788
1918
|
"LGPL-3.0-or-later",
|
|
1789
1919
|
"Python-2.0"
|
|
1790
1920
|
]);
|
|
1791
|
-
console.log(
|
|
1921
|
+
console.log(chalk25.green("License Checker"));
|
|
1792
1922
|
return (await Promise.all(
|
|
1793
1923
|
workspaceList.map(({ location, name }) => {
|
|
1794
1924
|
return new Promise((resolve) => {
|
|
1795
1925
|
init({ production: true, start: location }, (error, packages) => {
|
|
1796
1926
|
if (error) {
|
|
1797
|
-
console.error(
|
|
1798
|
-
console.error(
|
|
1927
|
+
console.error(chalk25.red(`License Checker [${name}] Error`));
|
|
1928
|
+
console.error(chalk25.gray(error));
|
|
1799
1929
|
console.log("\n");
|
|
1800
1930
|
resolve(1);
|
|
1801
1931
|
} else {
|
|
1802
|
-
console.log(
|
|
1932
|
+
console.log(chalk25.green(`License Checker [${name}]`));
|
|
1803
1933
|
let count = 0;
|
|
1804
1934
|
for (const [name2, info] of Object.entries(packages)) {
|
|
1805
1935
|
const licenses = Array.isArray(info.licenses) ? info.licenses : [info.licenses];
|
|
@@ -1815,7 +1945,7 @@ var license = async (pkg) => {
|
|
|
1815
1945
|
}
|
|
1816
1946
|
if (!orLicenseFound) {
|
|
1817
1947
|
count++;
|
|
1818
|
-
console.warn(
|
|
1948
|
+
console.warn(chalk25.yellow(`${name2}: Package License not allowed [${license2}]`));
|
|
1819
1949
|
}
|
|
1820
1950
|
}
|
|
1821
1951
|
}
|
|
@@ -1850,6 +1980,21 @@ var publish = () => {
|
|
|
1850
1980
|
return runSteps("Publish", [["npm", ["publish", "--workspaces"]]]);
|
|
1851
1981
|
};
|
|
1852
1982
|
|
|
1983
|
+
// src/actions/readme-gen.ts
|
|
1984
|
+
async function readmeGen({
|
|
1985
|
+
pkg,
|
|
1986
|
+
templatePath,
|
|
1987
|
+
typedoc,
|
|
1988
|
+
verbose
|
|
1989
|
+
}) {
|
|
1990
|
+
return await generateReadmeFiles({
|
|
1991
|
+
pkg,
|
|
1992
|
+
templatePath,
|
|
1993
|
+
typedoc,
|
|
1994
|
+
verbose
|
|
1995
|
+
});
|
|
1996
|
+
}
|
|
1997
|
+
|
|
1853
1998
|
// src/actions/rebuild.ts
|
|
1854
1999
|
var rebuild = ({ target }) => {
|
|
1855
2000
|
return runSteps("Rebuild", [
|
|
@@ -1859,7 +2004,7 @@ var rebuild = ({ target }) => {
|
|
|
1859
2004
|
};
|
|
1860
2005
|
|
|
1861
2006
|
// src/actions/recompile.ts
|
|
1862
|
-
import
|
|
2007
|
+
import chalk26 from "chalk";
|
|
1863
2008
|
var recompile = async ({
|
|
1864
2009
|
verbose,
|
|
1865
2010
|
target,
|
|
@@ -1895,7 +2040,7 @@ var recompileAll = async ({
|
|
|
1895
2040
|
const incrementalOptions = incremental ? ["--since", "-Apt", "--topological-dev"] : ["--parallel", "-Apt", "--topological-dev"];
|
|
1896
2041
|
const jobsOptions = jobs ? ["-j", `${jobs}`] : [];
|
|
1897
2042
|
if (jobs) {
|
|
1898
|
-
console.log(
|
|
2043
|
+
console.log(chalk26.blue(`Jobs set to [${jobs}]`));
|
|
1899
2044
|
}
|
|
1900
2045
|
const result = await runStepsAsync(`Recompile${incremental ? "-Incremental" : ""} [All]`, [
|
|
1901
2046
|
[
|
|
@@ -1926,7 +2071,7 @@ var recompileAll = async ({
|
|
|
1926
2071
|
]
|
|
1927
2072
|
]);
|
|
1928
2073
|
console.log(
|
|
1929
|
-
`${
|
|
2074
|
+
`${chalk26.gray("Recompiled in")} [${chalk26.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk26.gray("seconds")}`
|
|
1930
2075
|
);
|
|
1931
2076
|
return result;
|
|
1932
2077
|
};
|
|
@@ -1957,13 +2102,13 @@ var reinstall = () => {
|
|
|
1957
2102
|
};
|
|
1958
2103
|
|
|
1959
2104
|
// src/actions/relint.ts
|
|
1960
|
-
import
|
|
2105
|
+
import chalk27 from "chalk";
|
|
1961
2106
|
var relintPackage = ({
|
|
1962
2107
|
pkg,
|
|
1963
2108
|
fix: fix2,
|
|
1964
2109
|
verbose
|
|
1965
2110
|
}) => {
|
|
1966
|
-
console.log(
|
|
2111
|
+
console.log(chalk27.gray(`${fix2 ? "Fix" : "Lint"} [${pkg}]`));
|
|
1967
2112
|
const start = Date.now();
|
|
1968
2113
|
const result = runSteps(`${fix2 ? "Fix" : "Lint"} [${pkg}]`, [
|
|
1969
2114
|
["yarn", [
|
|
@@ -1973,7 +2118,7 @@ var relintPackage = ({
|
|
|
1973
2118
|
fix2 ? "package-fix" : verbose ? "package-lint-verbose" : "package-lint"
|
|
1974
2119
|
]]
|
|
1975
2120
|
]);
|
|
1976
|
-
console.log(
|
|
2121
|
+
console.log(chalk27.gray(`${fix2 ? "Fixed in" : "Linted in"} [${chalk27.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk27.gray("seconds")}`));
|
|
1977
2122
|
return result;
|
|
1978
2123
|
};
|
|
1979
2124
|
var relint = ({
|
|
@@ -1993,13 +2138,13 @@ var relint = ({
|
|
|
1993
2138
|
});
|
|
1994
2139
|
};
|
|
1995
2140
|
var relintAllPackages = ({ fix: fix2 = false } = {}) => {
|
|
1996
|
-
console.log(
|
|
2141
|
+
console.log(chalk27.gray(`${fix2 ? "Fix" : "Lint"} [All-Packages]`));
|
|
1997
2142
|
const start = Date.now();
|
|
1998
2143
|
const fixOptions = fix2 ? ["--fix"] : [];
|
|
1999
2144
|
const result = runSteps(`${fix2 ? "Fix" : "Lint"} [All-Packages]`, [
|
|
2000
2145
|
["yarn", ["eslint", ...fixOptions]]
|
|
2001
2146
|
]);
|
|
2002
|
-
console.log(
|
|
2147
|
+
console.log(chalk27.gray(`${fix2 ? "Fixed in" : "Linted in"} [${chalk27.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk27.gray("seconds")}`));
|
|
2003
2148
|
return result;
|
|
2004
2149
|
};
|
|
2005
2150
|
|
|
@@ -2017,10 +2162,10 @@ var sonar = () => {
|
|
|
2017
2162
|
};
|
|
2018
2163
|
|
|
2019
2164
|
// src/actions/statics.ts
|
|
2020
|
-
import
|
|
2165
|
+
import chalk28 from "chalk";
|
|
2021
2166
|
var DefaultDependencies = ["axios", "@xylabs/pixel", "react", "graphql", "react-router", "@mui/material", "@mui/system"];
|
|
2022
2167
|
var statics = () => {
|
|
2023
|
-
console.log(
|
|
2168
|
+
console.log(chalk28.green("Check Required Static Dependencies"));
|
|
2024
2169
|
const statics2 = parsedPackageJSON()?.xy?.deps?.statics;
|
|
2025
2170
|
return detectDuplicateDependencies(statics2, DefaultDependencies);
|
|
2026
2171
|
};
|
|
@@ -2264,6 +2409,29 @@ var xyCommonCommands = (args) => {
|
|
|
2264
2409
|
if (argv.verbose) console.log("NpmIgnore Gen");
|
|
2265
2410
|
process.exitCode = npmignoreGen();
|
|
2266
2411
|
}
|
|
2412
|
+
).command(
|
|
2413
|
+
"readme-gen [package]",
|
|
2414
|
+
"Readme Gen - Generate README.md files from template",
|
|
2415
|
+
(yargs2) => {
|
|
2416
|
+
return packagePositionalParam(yargs2).option("template", {
|
|
2417
|
+
alias: "t",
|
|
2418
|
+
description: "Path to README.template.md",
|
|
2419
|
+
type: "string"
|
|
2420
|
+
}).option("typedoc", {
|
|
2421
|
+
default: false,
|
|
2422
|
+
description: "Generate TypeDoc reference sections",
|
|
2423
|
+
type: "boolean"
|
|
2424
|
+
});
|
|
2425
|
+
},
|
|
2426
|
+
async (argv) => {
|
|
2427
|
+
if (argv.verbose) console.log("Readme Gen");
|
|
2428
|
+
process.exitCode = await readmeGen({
|
|
2429
|
+
pkg: argv.package,
|
|
2430
|
+
templatePath: argv.template,
|
|
2431
|
+
typedoc: argv.typedoc,
|
|
2432
|
+
verbose: !!argv.verbose
|
|
2433
|
+
});
|
|
2434
|
+
}
|
|
2267
2435
|
).command(
|
|
2268
2436
|
"retest",
|
|
2269
2437
|
"Re-Test - Run Jest Tests with cleaned cache",
|
|
@@ -2443,7 +2611,7 @@ var xyInstallCommands = (args) => {
|
|
|
2443
2611
|
};
|
|
2444
2612
|
|
|
2445
2613
|
// src/xy/xyLintCommands.ts
|
|
2446
|
-
import
|
|
2614
|
+
import chalk29 from "chalk";
|
|
2447
2615
|
var xyLintCommands = (args) => {
|
|
2448
2616
|
return args.command(
|
|
2449
2617
|
"cycle [package]",
|
|
@@ -2455,7 +2623,7 @@ var xyLintCommands = (args) => {
|
|
|
2455
2623
|
const start = Date.now();
|
|
2456
2624
|
if (argv.verbose) console.log("Cycle");
|
|
2457
2625
|
process.exitCode = await cycle({ pkg: argv.package });
|
|
2458
|
-
console.log(
|
|
2626
|
+
console.log(chalk29.blue(`Finished in ${Date.now() - start}ms`));
|
|
2459
2627
|
}
|
|
2460
2628
|
).command(
|
|
2461
2629
|
"lint [package]",
|
|
@@ -2485,7 +2653,7 @@ var xyLintCommands = (args) => {
|
|
|
2485
2653
|
cache: argv.cache,
|
|
2486
2654
|
verbose: !!argv.verbose
|
|
2487
2655
|
});
|
|
2488
|
-
console.log(
|
|
2656
|
+
console.log(chalk29.blue(`Finished in ${Date.now() - start}ms`));
|
|
2489
2657
|
}
|
|
2490
2658
|
).command(
|
|
2491
2659
|
"deplint [package]",
|
|
@@ -2524,7 +2692,7 @@ var xyLintCommands = (args) => {
|
|
|
2524
2692
|
peerDeps: !!argv.peerDeps,
|
|
2525
2693
|
verbose: !!argv.verbose
|
|
2526
2694
|
});
|
|
2527
|
-
console.log(
|
|
2695
|
+
console.log(chalk29.blue(`Finished in ${Date.now() - start}ms`));
|
|
2528
2696
|
}
|
|
2529
2697
|
).command(
|
|
2530
2698
|
"fix [package]",
|
|
@@ -2536,7 +2704,7 @@ var xyLintCommands = (args) => {
|
|
|
2536
2704
|
const start = Date.now();
|
|
2537
2705
|
if (argv.verbose) console.log("Fix");
|
|
2538
2706
|
process.exitCode = fix();
|
|
2539
|
-
console.log(
|
|
2707
|
+
console.log(chalk29.blue(`Finished in ${Date.now() - start}ms`));
|
|
2540
2708
|
}
|
|
2541
2709
|
).command(
|
|
2542
2710
|
"relint [package]",
|
|
@@ -2548,7 +2716,7 @@ var xyLintCommands = (args) => {
|
|
|
2548
2716
|
if (argv.verbose) console.log("Relinting");
|
|
2549
2717
|
const start = Date.now();
|
|
2550
2718
|
process.exitCode = relint();
|
|
2551
|
-
console.log(
|
|
2719
|
+
console.log(chalk29.blue(`Finished in ${Date.now() - start}ms`));
|
|
2552
2720
|
}
|
|
2553
2721
|
).command(
|
|
2554
2722
|
"publint [package]",
|
|
@@ -2560,7 +2728,7 @@ var xyLintCommands = (args) => {
|
|
|
2560
2728
|
if (argv.verbose) console.log("Publint");
|
|
2561
2729
|
const start = Date.now();
|
|
2562
2730
|
process.exitCode = await publint({ pkg: argv.package, verbose: !!argv.verbose });
|
|
2563
|
-
console.log(
|
|
2731
|
+
console.log(chalk29.blue(`Finished in ${Date.now() - start}ms`));
|
|
2564
2732
|
}
|
|
2565
2733
|
).command(
|
|
2566
2734
|
"knip",
|
|
@@ -2572,7 +2740,7 @@ var xyLintCommands = (args) => {
|
|
|
2572
2740
|
if (argv.verbose) console.log("Knip");
|
|
2573
2741
|
const start = Date.now();
|
|
2574
2742
|
process.exitCode = knip();
|
|
2575
|
-
console.log(
|
|
2743
|
+
console.log(chalk29.blue(`Knip finished in ${Date.now() - start}ms`));
|
|
2576
2744
|
}
|
|
2577
2745
|
).command(
|
|
2578
2746
|
"sonar",
|
|
@@ -2584,7 +2752,7 @@ var xyLintCommands = (args) => {
|
|
|
2584
2752
|
const start = Date.now();
|
|
2585
2753
|
if (argv.verbose) console.log("Sonar Check");
|
|
2586
2754
|
process.exitCode = sonar();
|
|
2587
|
-
console.log(
|
|
2755
|
+
console.log(chalk29.blue(`Finished in ${Date.now() - start}ms`));
|
|
2588
2756
|
}
|
|
2589
2757
|
);
|
|
2590
2758
|
};
|
|
@@ -2620,8 +2788,8 @@ var xyParseOptions = () => {
|
|
|
2620
2788
|
var xy = async () => {
|
|
2621
2789
|
const options = xyParseOptions();
|
|
2622
2790
|
return await xyBuildCommands(xyCommonCommands(xyInstallCommands(xyDeployCommands(xyLintCommands(options))))).demandCommand(1).command("*", "", () => {
|
|
2623
|
-
console.error(
|
|
2624
|
-
console.log(
|
|
2791
|
+
console.error(chalk30.yellow(`Command not found [${chalk30.magenta(process.argv[2])}]`));
|
|
2792
|
+
console.log(chalk30.gray("Try 'yarn xy --help' for list of commands"));
|
|
2625
2793
|
}).version().help().argv;
|
|
2626
2794
|
};
|
|
2627
2795
|
export {
|