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