@xylabs/ts-scripts-yarn3 7.4.11 → 7.4.13
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/deplint/checkPackage/checkPackage.mjs +12 -5
- package/dist/actions/deplint/checkPackage/checkPackage.mjs.map +1 -1
- package/dist/actions/deplint/checkPackage/getUnlistedDependencies.mjs +12 -5
- package/dist/actions/deplint/checkPackage/getUnlistedDependencies.mjs.map +1 -1
- package/dist/actions/deplint/checkPackage/index.mjs +12 -5
- package/dist/actions/deplint/checkPackage/index.mjs.map +1 -1
- package/dist/actions/deplint/deplint.mjs +12 -5
- package/dist/actions/deplint/deplint.mjs.map +1 -1
- package/dist/actions/deplint/index.mjs +12 -5
- package/dist/actions/deplint/index.mjs.map +1 -1
- package/dist/actions/index.mjs +306 -153
- 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 +287 -112
- package/dist/bin/xy.mjs.map +1 -1
- package/dist/index.d.ts +17 -1
- package/dist/index.mjs +347 -170
- 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 +287 -112
- package/dist/xy/index.mjs.map +1 -1
- package/dist/xy/xy.mjs +287 -112
- package/dist/xy/xy.mjs.map +1 -1
- package/dist/xy/xyCommonCommands.mjs +210 -42
- package/dist/xy/xyCommonCommands.mjs.map +1 -1
- package/dist/xy/xyLintCommands.mjs +12 -5
- package/dist/xy/xyLintCommands.mjs.map +1 -1
- package/package.json +2 -2
package/dist/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// src/actions/build.ts
|
|
2
|
-
import
|
|
2
|
+
import chalk10 from "chalk";
|
|
3
3
|
|
|
4
4
|
// src/lib/checkResult.ts
|
|
5
5
|
import chalk from "chalk";
|
|
@@ -379,8 +379,138 @@ var generateIgnoreFiles = (filename3, pkg) => {
|
|
|
379
379
|
return succeeded ? 0 : 1;
|
|
380
380
|
};
|
|
381
381
|
|
|
382
|
-
// src/lib/
|
|
382
|
+
// src/lib/generateReadmeFiles.ts
|
|
383
|
+
import { execSync as execSync2 } from "child_process";
|
|
384
|
+
import FS from "fs";
|
|
385
|
+
import { readFile, writeFile } from "fs/promises";
|
|
386
|
+
import PATH2 from "path";
|
|
383
387
|
import chalk5 from "chalk";
|
|
388
|
+
function fillTemplate(template, data) {
|
|
389
|
+
const additionalData = { ...data, safeName: data.name.replaceAll("/", "__").replaceAll("@", "") };
|
|
390
|
+
return template.replaceAll(/\{\{(.*?)\}\}/g, (_, key) => additionalData[key.trim()] ?? "");
|
|
391
|
+
}
|
|
392
|
+
function generateTypedoc(packageLocation, entryPoints) {
|
|
393
|
+
const tempDir = PATH2.join(packageLocation, ".temp-typedoc");
|
|
394
|
+
try {
|
|
395
|
+
if (!FS.existsSync(tempDir)) {
|
|
396
|
+
FS.mkdirSync(tempDir, { recursive: true });
|
|
397
|
+
}
|
|
398
|
+
const typedocConfig = {
|
|
399
|
+
disableSources: true,
|
|
400
|
+
entryPointStrategy: "expand",
|
|
401
|
+
entryPoints: entryPoints.map((ep) => PATH2.resolve(packageLocation, ep)),
|
|
402
|
+
excludeExternals: true,
|
|
403
|
+
excludeInternal: true,
|
|
404
|
+
excludePrivate: true,
|
|
405
|
+
githubPages: false,
|
|
406
|
+
hideBreadcrumbs: true,
|
|
407
|
+
hideGenerator: true,
|
|
408
|
+
hidePageTitle: true,
|
|
409
|
+
out: tempDir,
|
|
410
|
+
plugin: ["typedoc-plugin-markdown"],
|
|
411
|
+
readme: "none",
|
|
412
|
+
skipErrorChecking: true,
|
|
413
|
+
sort: ["source-order"],
|
|
414
|
+
theme: "markdown",
|
|
415
|
+
useCodeBlocks: true
|
|
416
|
+
};
|
|
417
|
+
const typedocJsonPath = PATH2.join(tempDir, "typedoc.json");
|
|
418
|
+
FS.writeFileSync(typedocJsonPath, JSON.stringify(typedocConfig, null, 2));
|
|
419
|
+
try {
|
|
420
|
+
execSync2(`npx typedoc --options ${typedocJsonPath}`, {
|
|
421
|
+
cwd: process.cwd(),
|
|
422
|
+
stdio: ["ignore", "pipe", "pipe"]
|
|
423
|
+
});
|
|
424
|
+
} catch {
|
|
425
|
+
return "";
|
|
426
|
+
}
|
|
427
|
+
return consolidateMarkdown(tempDir);
|
|
428
|
+
} catch {
|
|
429
|
+
return "";
|
|
430
|
+
} finally {
|
|
431
|
+
try {
|
|
432
|
+
FS.rmSync(tempDir, { force: true, recursive: true });
|
|
433
|
+
} catch {
|
|
434
|
+
}
|
|
435
|
+
}
|
|
436
|
+
}
|
|
437
|
+
function consolidateMarkdown(tempDir) {
|
|
438
|
+
let consolidated = "## Reference\n\n";
|
|
439
|
+
const mainReadmePath = PATH2.join(tempDir, "README.md");
|
|
440
|
+
if (FS.existsSync(mainReadmePath)) {
|
|
441
|
+
const mainContent = FS.readFileSync(mainReadmePath, "utf8").replace(/^---(.|\n)*?---\n/, "").replace(/^# .+\n/, "").replaceAll(/\]\((.+?)\.md\)/g, "](#$1)");
|
|
442
|
+
consolidated += mainContent + "\n\n";
|
|
443
|
+
}
|
|
444
|
+
consolidated += processDirectory(tempDir);
|
|
445
|
+
return consolidated.replaceAll(/\n\n\n+/g, "\n\n").replaceAll(/^#### /gm, "### ").replaceAll(/^##### /gm, "#### ").replaceAll(/^###### /gm, "##### ");
|
|
446
|
+
}
|
|
447
|
+
function processDirectory(dir, level = 0) {
|
|
448
|
+
const indent = " ".repeat(level);
|
|
449
|
+
let content = "";
|
|
450
|
+
try {
|
|
451
|
+
const items = FS.readdirSync(dir, { withFileTypes: true });
|
|
452
|
+
for (const item of items) {
|
|
453
|
+
if (item.isDirectory()) continue;
|
|
454
|
+
if (item.name === "README.md" || !item.name.endsWith(".md")) continue;
|
|
455
|
+
const fileContent = FS.readFileSync(PATH2.join(dir, item.name), "utf8").replace(/^---(.|\n)*?---\n/, "");
|
|
456
|
+
const moduleName = item.name.replace(".md", "");
|
|
457
|
+
content += `
|
|
458
|
+
|
|
459
|
+
${indent}### <a id="${moduleName}"></a>${moduleName}
|
|
460
|
+
|
|
461
|
+
`;
|
|
462
|
+
content += fileContent.replace(/^# .+\n/, "").replaceAll(/\]\((.+?)\.md\)/g, "](#$1)");
|
|
463
|
+
}
|
|
464
|
+
for (const item of items) {
|
|
465
|
+
if (!item.isDirectory()) continue;
|
|
466
|
+
if (item.name === "spec" || item.name.includes(".spec")) continue;
|
|
467
|
+
content += `
|
|
468
|
+
|
|
469
|
+
${indent}### ${item.name}
|
|
470
|
+
`;
|
|
471
|
+
content += processDirectory(PATH2.join(dir, item.name), level + 1);
|
|
472
|
+
}
|
|
473
|
+
} catch {
|
|
474
|
+
}
|
|
475
|
+
return content;
|
|
476
|
+
}
|
|
477
|
+
async function generateReadmeFiles({
|
|
478
|
+
pkg,
|
|
479
|
+
templatePath,
|
|
480
|
+
typedoc = false,
|
|
481
|
+
verbose
|
|
482
|
+
}) {
|
|
483
|
+
console.log(chalk5.green("Generate README Files"));
|
|
484
|
+
const cwd5 = INIT_CWD() ?? ".";
|
|
485
|
+
const resolvedTemplatePath = templatePath ?? PATH2.join(cwd5, "scripts", "README.template.md");
|
|
486
|
+
let template;
|
|
487
|
+
try {
|
|
488
|
+
template = await readFile(resolvedTemplatePath, "utf8");
|
|
489
|
+
} catch {
|
|
490
|
+
console.error(chalk5.red(`Template not found: ${resolvedTemplatePath}`));
|
|
491
|
+
return 1;
|
|
492
|
+
}
|
|
493
|
+
const workspaces = pkg ? [yarnWorkspace(pkg)] : yarnWorkspaces();
|
|
494
|
+
let failed = false;
|
|
495
|
+
for (const { location, name } of workspaces) {
|
|
496
|
+
try {
|
|
497
|
+
const pkgJsonPath = PATH2.join(location, "package.json");
|
|
498
|
+
const pkgJson = JSON.parse(await readFile(pkgJsonPath, "utf8"));
|
|
499
|
+
const typedocContent = typedoc ? generateTypedoc(location, ["src/index*.ts"]) : "";
|
|
500
|
+
const readmeContent = fillTemplate(template, { ...pkgJson, typedoc: typedocContent });
|
|
501
|
+
await writeFile(PATH2.join(location, "README.md"), readmeContent);
|
|
502
|
+
if (verbose) console.log(chalk5.green(` ${name}`));
|
|
503
|
+
} catch (ex) {
|
|
504
|
+
const error = ex;
|
|
505
|
+
console.warn(chalk5.yellow(` Skipped ${location}: ${error.message}`));
|
|
506
|
+
failed = true;
|
|
507
|
+
}
|
|
508
|
+
}
|
|
509
|
+
return failed ? 1 : 0;
|
|
510
|
+
}
|
|
511
|
+
|
|
512
|
+
// src/lib/loadConfig.ts
|
|
513
|
+
import chalk6 from "chalk";
|
|
384
514
|
import { cosmiconfig } from "cosmiconfig";
|
|
385
515
|
import { TypeScriptLoader } from "cosmiconfig-typescript-loader";
|
|
386
516
|
import deepmerge from "deepmerge";
|
|
@@ -391,9 +521,9 @@ var loadConfig = async (params) => {
|
|
|
391
521
|
config = cosmicConfigResult?.config;
|
|
392
522
|
const configFilePath = cosmicConfigResult?.filepath;
|
|
393
523
|
if (configFilePath !== void 0) {
|
|
394
|
-
console.log(
|
|
524
|
+
console.log(chalk6.green(`Loaded config from ${configFilePath}`));
|
|
395
525
|
if (config.verbose) {
|
|
396
|
-
console.log(
|
|
526
|
+
console.log(chalk6.gray(`${JSON.stringify(config, null, 2)}`));
|
|
397
527
|
}
|
|
398
528
|
}
|
|
399
529
|
}
|
|
@@ -411,15 +541,15 @@ var parsedPackageJSON = (path14) => {
|
|
|
411
541
|
// src/lib/runSteps.ts
|
|
412
542
|
import { spawnSync as spawnSync3 } from "child_process";
|
|
413
543
|
import { existsSync as existsSync3 } from "fs";
|
|
414
|
-
import
|
|
544
|
+
import chalk7 from "chalk";
|
|
415
545
|
var runSteps = (name, steps, exitOnFail = true, messages) => {
|
|
416
546
|
return safeExit(() => {
|
|
417
547
|
const pkgName = process.env.npm_package_name;
|
|
418
|
-
console.log(
|
|
548
|
+
console.log(chalk7.green(`${name} [${pkgName}]`));
|
|
419
549
|
let totalStatus = 0;
|
|
420
550
|
for (const [i, [command, args, config2]] of steps.entries()) {
|
|
421
551
|
if (messages?.[i]) {
|
|
422
|
-
console.log(
|
|
552
|
+
console.log(chalk7.gray(messages?.[i]));
|
|
423
553
|
}
|
|
424
554
|
const argList = Array.isArray(args) ? args : args.split(" ");
|
|
425
555
|
if (command === "node" && !existsSync3(argList[0])) {
|
|
@@ -442,12 +572,12 @@ var runSteps = (name, steps, exitOnFail = true, messages) => {
|
|
|
442
572
|
// src/lib/runStepsAsync.ts
|
|
443
573
|
import { spawn } from "child_process";
|
|
444
574
|
import { existsSync as existsSync4 } from "fs";
|
|
445
|
-
import
|
|
575
|
+
import chalk8 from "chalk";
|
|
446
576
|
var runStepAsync = (name, step, exitOnFail = true, message) => {
|
|
447
577
|
return new Promise((resolve) => {
|
|
448
578
|
const [command, args, config2] = step;
|
|
449
579
|
if (message) {
|
|
450
|
-
console.log(
|
|
580
|
+
console.log(chalk8.gray(message));
|
|
451
581
|
}
|
|
452
582
|
const argList = Array.isArray(args) ? args : args.split(" ");
|
|
453
583
|
if (command === "node" && !existsSync4(argList[0])) {
|
|
@@ -461,8 +591,8 @@ var runStepAsync = (name, step, exitOnFail = true, message) => {
|
|
|
461
591
|
}).on("close", (code) => {
|
|
462
592
|
if (code) {
|
|
463
593
|
console.error(
|
|
464
|
-
|
|
465
|
-
`Command Exited With Non-Zero Result [${
|
|
594
|
+
chalk8.red(
|
|
595
|
+
`Command Exited With Non-Zero Result [${chalk8.gray(code)}] | ${chalk8.yellow(command)} ${chalk8.white(
|
|
466
596
|
Array.isArray(args) ? args.join(" ") : args
|
|
467
597
|
)}`
|
|
468
598
|
)
|
|
@@ -478,7 +608,7 @@ var runStepAsync = (name, step, exitOnFail = true, message) => {
|
|
|
478
608
|
var runStepsAsync = async (name, steps, exitOnFail = true, messages) => {
|
|
479
609
|
return await safeExitAsync(async () => {
|
|
480
610
|
const pkgName = process.env.npm_package_name;
|
|
481
|
-
console.log(
|
|
611
|
+
console.log(chalk8.green(`${name} [${pkgName}]`));
|
|
482
612
|
let result = 0;
|
|
483
613
|
for (const [i, step] of steps.entries()) {
|
|
484
614
|
result += await runStepAsync(name, step, exitOnFail, messages?.[i]);
|
|
@@ -496,12 +626,12 @@ var runXy = (command) => {
|
|
|
496
626
|
};
|
|
497
627
|
|
|
498
628
|
// src/lib/runXyWithWarning.ts
|
|
499
|
-
import
|
|
629
|
+
import chalk9 from "chalk";
|
|
500
630
|
var runXyWithWarning = (command) => {
|
|
501
631
|
const commandString = `yarn ${command}`;
|
|
502
632
|
const commandXyString = `yarn xy ${command}`;
|
|
503
|
-
console.warn(
|
|
504
|
-
console.warn(
|
|
633
|
+
console.warn(chalk9.yellow(`WARNING: [${chalk9.white(commandString)}] is deprecated for XY Labs Scripts.`));
|
|
634
|
+
console.warn(chalk9.gray(`Did you mean [${chalk9.magenta(commandXyString)}]?`));
|
|
505
635
|
return 1;
|
|
506
636
|
};
|
|
507
637
|
|
|
@@ -520,7 +650,7 @@ var build = async ({
|
|
|
520
650
|
const targetOptions = target === void 0 ? [] : ["-t", target];
|
|
521
651
|
const jobsOptions = jobs === void 0 ? [] : ["-j", `${jobs}`];
|
|
522
652
|
if (jobs !== void 0) {
|
|
523
|
-
console.log(
|
|
653
|
+
console.log(chalk10.blue(`Jobs set to [${jobs}]`));
|
|
524
654
|
}
|
|
525
655
|
const result = await runStepsAsync(`Build${incremental ? "-Incremental" : ""} [${pkg ?? "All"}]`, [
|
|
526
656
|
["yarn", ["xy", "compile", ...pkgOptions, ...targetOptions, ...verboseOptions, ...jobsOptions, ...incrementalOptions, "--types", "tsup"]],
|
|
@@ -528,7 +658,7 @@ var build = async ({
|
|
|
528
658
|
["yarn", ["xy", "deplint", ...pkgOptions, ...verboseOptions, ...jobsOptions, ...incrementalOptions]],
|
|
529
659
|
["yarn", ["xy", "lint", ...pkgOptions, ...verboseOptions, ...incrementalOptions]]
|
|
530
660
|
]);
|
|
531
|
-
console.log(`${
|
|
661
|
+
console.log(`${chalk10.gray("Built in")} [${chalk10.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk10.gray("seconds")}`);
|
|
532
662
|
return result;
|
|
533
663
|
};
|
|
534
664
|
|
|
@@ -541,15 +671,15 @@ import {
|
|
|
541
671
|
unlinkSync,
|
|
542
672
|
writeFileSync as writeFileSync2
|
|
543
673
|
} from "fs";
|
|
544
|
-
import
|
|
545
|
-
import
|
|
674
|
+
import PATH3 from "path";
|
|
675
|
+
import chalk11 from "chalk";
|
|
546
676
|
var syncCommandFiles = (commandsDir) => {
|
|
547
677
|
const templates = claudeCommandTemplates();
|
|
548
678
|
const templateNames = new Set(Object.keys(templates));
|
|
549
679
|
let updated = 0;
|
|
550
680
|
let created = 0;
|
|
551
681
|
for (const [filename3, content] of Object.entries(templates)) {
|
|
552
|
-
const targetPath =
|
|
682
|
+
const targetPath = PATH3.resolve(commandsDir, filename3);
|
|
553
683
|
const existing = existsSync5(targetPath) ? readFileSync6(targetPath, "utf8") : void 0;
|
|
554
684
|
if (existing === content) continue;
|
|
555
685
|
writeFileSync2(targetPath, content, "utf8");
|
|
@@ -570,7 +700,7 @@ var removeStaleCommands = (commandsDir, templateNames) => {
|
|
|
570
700
|
let removed = 0;
|
|
571
701
|
for (const file of existingCommands) {
|
|
572
702
|
if (!templateNames.has(file)) {
|
|
573
|
-
unlinkSync(
|
|
703
|
+
unlinkSync(PATH3.resolve(commandsDir, file));
|
|
574
704
|
removed++;
|
|
575
705
|
}
|
|
576
706
|
}
|
|
@@ -583,14 +713,14 @@ var logCommandsResult = (created, updated, removed) => {
|
|
|
583
713
|
updated ? `${updated} updated` : "",
|
|
584
714
|
removed ? `${removed} removed` : ""
|
|
585
715
|
].filter(Boolean);
|
|
586
|
-
console.log(
|
|
716
|
+
console.log(chalk11.green(`.claude/commands/${XYLABS_COMMANDS_PREFIX}*.md: ${parts.join(", ")}`));
|
|
587
717
|
} else {
|
|
588
|
-
console.log(
|
|
718
|
+
console.log(chalk11.gray(`.claude/commands/${XYLABS_COMMANDS_PREFIX}*.md: already up to date`));
|
|
589
719
|
}
|
|
590
720
|
};
|
|
591
721
|
var claudeCommands = () => {
|
|
592
722
|
const cwd5 = INIT_CWD() ?? process.cwd();
|
|
593
|
-
const commandsDir =
|
|
723
|
+
const commandsDir = PATH3.resolve(cwd5, ".claude", "commands");
|
|
594
724
|
mkdirSync(commandsDir, { recursive: true });
|
|
595
725
|
const {
|
|
596
726
|
created,
|
|
@@ -611,15 +741,15 @@ import {
|
|
|
611
741
|
unlinkSync as unlinkSync2,
|
|
612
742
|
writeFileSync as writeFileSync3
|
|
613
743
|
} from "fs";
|
|
614
|
-
import
|
|
615
|
-
import
|
|
744
|
+
import PATH4 from "path";
|
|
745
|
+
import chalk12 from "chalk";
|
|
616
746
|
var syncRuleFiles = (rulesDir) => {
|
|
617
747
|
const templates = claudeMdRuleTemplates();
|
|
618
748
|
const templateNames = new Set(Object.keys(templates));
|
|
619
749
|
let updated = 0;
|
|
620
750
|
let created = 0;
|
|
621
751
|
for (const [filename3, content] of Object.entries(templates)) {
|
|
622
|
-
const targetPath =
|
|
752
|
+
const targetPath = PATH4.resolve(rulesDir, filename3);
|
|
623
753
|
const existing = existsSync6(targetPath) ? readFileSync7(targetPath, "utf8") : void 0;
|
|
624
754
|
if (existing === content) continue;
|
|
625
755
|
writeFileSync3(targetPath, content, "utf8");
|
|
@@ -640,7 +770,7 @@ var removeStaleRules = (rulesDir, templateNames) => {
|
|
|
640
770
|
let removed = 0;
|
|
641
771
|
for (const file of existingRules) {
|
|
642
772
|
if (!templateNames.has(file)) {
|
|
643
|
-
unlinkSync2(
|
|
773
|
+
unlinkSync2(PATH4.resolve(rulesDir, file));
|
|
644
774
|
removed++;
|
|
645
775
|
}
|
|
646
776
|
}
|
|
@@ -653,26 +783,26 @@ var logRulesResult = (created, updated, removed) => {
|
|
|
653
783
|
updated ? `${updated} updated` : "",
|
|
654
784
|
removed ? `${removed} removed` : ""
|
|
655
785
|
].filter(Boolean);
|
|
656
|
-
console.log(
|
|
786
|
+
console.log(chalk12.green(`.claude/rules/${XYLABS_RULES_PREFIX}*.md: ${parts.join(", ")}`));
|
|
657
787
|
} else {
|
|
658
|
-
console.log(
|
|
788
|
+
console.log(chalk12.gray(`.claude/rules/${XYLABS_RULES_PREFIX}*.md: already up to date`));
|
|
659
789
|
}
|
|
660
790
|
};
|
|
661
791
|
var ensureProjectClaudeMd = (cwd5, force) => {
|
|
662
|
-
const projectPath =
|
|
792
|
+
const projectPath = PATH4.resolve(cwd5, "CLAUDE.md");
|
|
663
793
|
if (!existsSync6(projectPath) || force) {
|
|
664
794
|
if (force && existsSync6(projectPath)) {
|
|
665
|
-
console.log(
|
|
795
|
+
console.log(chalk12.yellow("Overwriting existing CLAUDE.md"));
|
|
666
796
|
}
|
|
667
797
|
writeFileSync3(projectPath, claudeMdProjectTemplate(), "utf8");
|
|
668
|
-
console.log(
|
|
798
|
+
console.log(chalk12.green("Generated CLAUDE.md"));
|
|
669
799
|
} else {
|
|
670
|
-
console.log(
|
|
800
|
+
console.log(chalk12.gray("CLAUDE.md already exists (skipped)"));
|
|
671
801
|
}
|
|
672
802
|
};
|
|
673
803
|
var claudeRules = ({ force } = {}) => {
|
|
674
804
|
const cwd5 = INIT_CWD() ?? process.cwd();
|
|
675
|
-
const rulesDir =
|
|
805
|
+
const rulesDir = PATH4.resolve(cwd5, ".claude", "rules");
|
|
676
806
|
mkdirSync2(rulesDir, { recursive: true });
|
|
677
807
|
const {
|
|
678
808
|
created,
|
|
@@ -699,16 +829,16 @@ var cleanAll = ({ verbose }) => {
|
|
|
699
829
|
|
|
700
830
|
// src/actions/clean-docs.ts
|
|
701
831
|
import path from "path";
|
|
702
|
-
import
|
|
832
|
+
import chalk13 from "chalk";
|
|
703
833
|
var cleanDocs = () => {
|
|
704
834
|
const pkgName = process.env.npm_package_name;
|
|
705
|
-
console.log(
|
|
835
|
+
console.log(chalk13.green(`Cleaning Docs [${pkgName}]`));
|
|
706
836
|
for (const { location } of yarnWorkspaces()) deleteGlob(path.join(location, "docs"));
|
|
707
837
|
return 0;
|
|
708
838
|
};
|
|
709
839
|
|
|
710
840
|
// src/actions/compile.ts
|
|
711
|
-
import
|
|
841
|
+
import chalk14 from "chalk";
|
|
712
842
|
var compile = ({
|
|
713
843
|
verbose,
|
|
714
844
|
target,
|
|
@@ -749,7 +879,7 @@ var compileAll = ({
|
|
|
749
879
|
const incrementalOptions = incremental ? ["--since", "-Ap", "--topological-dev"] : ["--parallel", "-Ap", "--topological-dev"];
|
|
750
880
|
const jobsOptions = jobs ? ["-j", `${jobs}`] : [];
|
|
751
881
|
if (jobs) {
|
|
752
|
-
console.log(
|
|
882
|
+
console.log(chalk14.blue(`Jobs set to [${jobs}]`));
|
|
753
883
|
}
|
|
754
884
|
const result = runSteps(`Compile${incremental ? "-Incremental" : ""} [All]`, [
|
|
755
885
|
["yarn", [
|
|
@@ -763,13 +893,13 @@ var compileAll = ({
|
|
|
763
893
|
...targetOptions
|
|
764
894
|
]]
|
|
765
895
|
]);
|
|
766
|
-
console.log(`${
|
|
896
|
+
console.log(`${chalk14.gray("Compiled in")} [${chalk14.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk14.gray("seconds")}`);
|
|
767
897
|
return result;
|
|
768
898
|
};
|
|
769
899
|
|
|
770
900
|
// src/actions/copy-assets.ts
|
|
771
901
|
import path2 from "path/posix";
|
|
772
|
-
import
|
|
902
|
+
import chalk15 from "chalk";
|
|
773
903
|
import cpy from "cpy";
|
|
774
904
|
var copyPackageTargetAssets = async (target, name, location) => {
|
|
775
905
|
try {
|
|
@@ -792,7 +922,7 @@ var copyPackageTargetAssets = async (target, name, location) => {
|
|
|
792
922
|
};
|
|
793
923
|
var copyTargetAssets = async (target, pkg) => {
|
|
794
924
|
const workspaces = yarnWorkspaces();
|
|
795
|
-
console.log(
|
|
925
|
+
console.log(chalk15.green(`Copying Assets [${target.toUpperCase()}]`));
|
|
796
926
|
const workspaceList = workspaces.filter(({ name }) => {
|
|
797
927
|
return pkg === void 0 || name === pkg;
|
|
798
928
|
});
|
|
@@ -876,7 +1006,7 @@ var dead = () => {
|
|
|
876
1006
|
};
|
|
877
1007
|
|
|
878
1008
|
// src/actions/deplint/deplint.ts
|
|
879
|
-
import
|
|
1009
|
+
import chalk21 from "chalk";
|
|
880
1010
|
|
|
881
1011
|
// src/actions/deplint/findFiles.ts
|
|
882
1012
|
import fs2 from "fs";
|
|
@@ -1078,37 +1208,44 @@ function getExternalImportsFromFiles({
|
|
|
1078
1208
|
|
|
1079
1209
|
// src/actions/deplint/checkPackage/getUnlistedDependencies.ts
|
|
1080
1210
|
import { builtinModules } from "module";
|
|
1081
|
-
import
|
|
1082
|
-
function
|
|
1083
|
-
return dependencies.includes(imp) || imp === name ||
|
|
1211
|
+
import chalk16 from "chalk";
|
|
1212
|
+
function isRuntimeImportListed(imp, name, dependencies, peerDependencies) {
|
|
1213
|
+
return dependencies.includes(imp) || imp === name || peerDependencies.includes(imp) || builtinModules.includes(imp);
|
|
1214
|
+
}
|
|
1215
|
+
function isTypeImportListed(imp, name, dependencies, devDependencies, peerDependencies) {
|
|
1216
|
+
return dependencies.includes(imp) || imp === name || dependencies.includes(`@types/${imp}`) || peerDependencies.includes(imp) || peerDependencies.includes(`@types/${imp}`) || devDependencies.includes(`@types/${imp}`) || builtinModules.includes(imp);
|
|
1084
1217
|
}
|
|
1085
1218
|
function logMissing(name, imp, importPaths) {
|
|
1086
|
-
console.log(`[${
|
|
1219
|
+
console.log(`[${chalk16.blue(name)}] Missing dependency in package.json: ${chalk16.red(imp)}`);
|
|
1087
1220
|
if (importPaths[imp]) {
|
|
1088
1221
|
console.log(` ${importPaths[imp].join("\n ")}`);
|
|
1089
1222
|
}
|
|
1090
1223
|
}
|
|
1091
|
-
function getUnlistedDependencies({ name, location }, {
|
|
1224
|
+
function getUnlistedDependencies({ name, location }, {
|
|
1225
|
+
dependencies,
|
|
1226
|
+
devDependencies,
|
|
1227
|
+
peerDependencies
|
|
1228
|
+
}, {
|
|
1092
1229
|
externalDistImports,
|
|
1093
1230
|
externalDistTypeImports,
|
|
1094
1231
|
distImportPaths
|
|
1095
1232
|
}) {
|
|
1096
1233
|
let unlistedDependencies = 0;
|
|
1097
1234
|
for (const imp of externalDistImports) {
|
|
1098
|
-
if (!
|
|
1235
|
+
if (!isRuntimeImportListed(imp, name, dependencies, peerDependencies)) {
|
|
1099
1236
|
unlistedDependencies++;
|
|
1100
1237
|
logMissing(name, imp, distImportPaths);
|
|
1101
1238
|
}
|
|
1102
1239
|
}
|
|
1103
1240
|
for (const imp of externalDistTypeImports) {
|
|
1104
|
-
if (!
|
|
1241
|
+
if (!isTypeImportListed(imp, name, dependencies, devDependencies, peerDependencies)) {
|
|
1105
1242
|
unlistedDependencies++;
|
|
1106
1243
|
logMissing(name, imp, distImportPaths);
|
|
1107
1244
|
}
|
|
1108
1245
|
}
|
|
1109
1246
|
if (unlistedDependencies > 0) {
|
|
1110
1247
|
const packageLocation = `${location}/package.json`;
|
|
1111
|
-
console.log(` ${
|
|
1248
|
+
console.log(` ${chalk16.yellow(packageLocation)}
|
|
1112
1249
|
`);
|
|
1113
1250
|
}
|
|
1114
1251
|
return unlistedDependencies;
|
|
@@ -1116,7 +1253,7 @@ function getUnlistedDependencies({ name, location }, { dependencies, peerDepende
|
|
|
1116
1253
|
|
|
1117
1254
|
// src/actions/deplint/checkPackage/getUnlistedDevDependencies.ts
|
|
1118
1255
|
import { builtinModules as builtinModules2 } from "module";
|
|
1119
|
-
import
|
|
1256
|
+
import chalk17 from "chalk";
|
|
1120
1257
|
function getUnlistedDevDependencies({ name, location }, {
|
|
1121
1258
|
devDependencies,
|
|
1122
1259
|
dependencies,
|
|
@@ -1130,7 +1267,7 @@ function getUnlistedDevDependencies({ name, location }, {
|
|
|
1130
1267
|
for (const imp of externalAllImports) {
|
|
1131
1268
|
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)) {
|
|
1132
1269
|
unlistedDevDependencies++;
|
|
1133
|
-
console.log(`[${
|
|
1270
|
+
console.log(`[${chalk17.blue(name)}] Missing devDependency in package.json: ${chalk17.red(imp)}`);
|
|
1134
1271
|
if (allImportPaths[imp]) {
|
|
1135
1272
|
console.log(` ${allImportPaths[imp].join("\n ")}`);
|
|
1136
1273
|
}
|
|
@@ -1138,14 +1275,14 @@ function getUnlistedDevDependencies({ name, location }, {
|
|
|
1138
1275
|
}
|
|
1139
1276
|
if (unlistedDevDependencies > 0) {
|
|
1140
1277
|
const packageLocation = `${location}/package.json`;
|
|
1141
|
-
console.log(` ${
|
|
1278
|
+
console.log(` ${chalk17.yellow(packageLocation)}
|
|
1142
1279
|
`);
|
|
1143
1280
|
}
|
|
1144
1281
|
return unlistedDevDependencies;
|
|
1145
1282
|
}
|
|
1146
1283
|
|
|
1147
1284
|
// src/actions/deplint/checkPackage/getUnusedDependencies.ts
|
|
1148
|
-
import
|
|
1285
|
+
import chalk18 from "chalk";
|
|
1149
1286
|
function getUnusedDependencies({ name, location }, { dependencies }, {
|
|
1150
1287
|
externalDistImports,
|
|
1151
1288
|
externalDistTypeImports,
|
|
@@ -1157,22 +1294,22 @@ function getUnusedDependencies({ name, location }, { dependencies }, {
|
|
|
1157
1294
|
if (!externalDistImports.includes(dep) && !externalDistImports.includes(dep.replace(/^@types\//, "")) && !externalDistTypeImports.includes(dep) && !externalDistTypeImports.includes(dep.replace(/^@types\//, ""))) {
|
|
1158
1295
|
unusedDependencies++;
|
|
1159
1296
|
if (externalAllImports.includes(dep)) {
|
|
1160
|
-
console.log(`[${
|
|
1297
|
+
console.log(`[${chalk18.blue(name)}] dependency should be devDependency in package.json: ${chalk18.red(dep)}`);
|
|
1161
1298
|
} else {
|
|
1162
|
-
console.log(`[${
|
|
1299
|
+
console.log(`[${chalk18.blue(name)}] Unused dependency in package.json: ${chalk18.red(dep)}`);
|
|
1163
1300
|
}
|
|
1164
1301
|
}
|
|
1165
1302
|
}
|
|
1166
1303
|
if (unusedDependencies > 0) {
|
|
1167
1304
|
const packageLocation = `${location}/package.json`;
|
|
1168
|
-
console.log(` ${
|
|
1305
|
+
console.log(` ${chalk18.yellow(packageLocation)}
|
|
1169
1306
|
`);
|
|
1170
1307
|
}
|
|
1171
1308
|
return unusedDependencies;
|
|
1172
1309
|
}
|
|
1173
1310
|
|
|
1174
1311
|
// src/actions/deplint/checkPackage/getUnusedDevDependencies.ts
|
|
1175
|
-
import
|
|
1312
|
+
import chalk19 from "chalk";
|
|
1176
1313
|
|
|
1177
1314
|
// src/actions/deplint/getCliReferencedPackagesFromFiles.ts
|
|
1178
1315
|
import fs8 from "fs";
|
|
@@ -1456,19 +1593,19 @@ function getUnusedDevDependencies({ name, location }, {
|
|
|
1456
1593
|
if (dependencies.includes(dep) || peerDependencies.includes(dep)) continue;
|
|
1457
1594
|
if (!isDevDepUsed(dep, allImports, implicitDeps, requiredPeers, scriptRefs, cliRefs)) {
|
|
1458
1595
|
unusedDevDependencies++;
|
|
1459
|
-
console.log(`[${
|
|
1596
|
+
console.log(`[${chalk19.blue(name)}] Unused devDependency in package.json: ${chalk19.red(dep)}`);
|
|
1460
1597
|
}
|
|
1461
1598
|
}
|
|
1462
1599
|
if (unusedDevDependencies > 0) {
|
|
1463
1600
|
const packageLocation = `${location}/package.json`;
|
|
1464
|
-
console.log(` ${
|
|
1601
|
+
console.log(` ${chalk19.yellow(packageLocation)}
|
|
1465
1602
|
`);
|
|
1466
1603
|
}
|
|
1467
1604
|
return unusedDevDependencies;
|
|
1468
1605
|
}
|
|
1469
1606
|
|
|
1470
1607
|
// src/actions/deplint/checkPackage/getUnusedPeerDependencies.ts
|
|
1471
|
-
import
|
|
1608
|
+
import chalk20 from "chalk";
|
|
1472
1609
|
function getUnusedPeerDependencies({ name, location }, { peerDependencies, dependencies }, { externalDistImports, externalDistTypeImports }, exclude) {
|
|
1473
1610
|
let unusedDependencies = 0;
|
|
1474
1611
|
for (const dep of peerDependencies) {
|
|
@@ -1476,15 +1613,15 @@ function getUnusedPeerDependencies({ name, location }, { peerDependencies, depen
|
|
|
1476
1613
|
if (!externalDistImports.includes(dep) && !externalDistImports.includes(dep.replace(/^@types\//, "")) && !externalDistTypeImports.includes(dep) && !externalDistTypeImports.includes(dep.replace(/^@types\//, ""))) {
|
|
1477
1614
|
unusedDependencies++;
|
|
1478
1615
|
if (dependencies.includes(dep)) {
|
|
1479
|
-
console.log(`[${
|
|
1616
|
+
console.log(`[${chalk20.blue(name)}] Unused peerDependency [already a dependency] in package.json: ${chalk20.red(dep)}`);
|
|
1480
1617
|
} else {
|
|
1481
|
-
console.log(`[${
|
|
1618
|
+
console.log(`[${chalk20.blue(name)}] Unused peerDependency in package.json: ${chalk20.red(dep)}`);
|
|
1482
1619
|
}
|
|
1483
1620
|
}
|
|
1484
1621
|
}
|
|
1485
1622
|
if (unusedDependencies > 0) {
|
|
1486
1623
|
const packageLocation = `${location}/package.json`;
|
|
1487
|
-
console.log(` ${
|
|
1624
|
+
console.log(` ${chalk20.yellow(packageLocation)}
|
|
1488
1625
|
`);
|
|
1489
1626
|
}
|
|
1490
1627
|
return unusedDependencies;
|
|
@@ -1579,9 +1716,9 @@ var deplint = async ({
|
|
|
1579
1716
|
});
|
|
1580
1717
|
}
|
|
1581
1718
|
if (totalErrors > 0) {
|
|
1582
|
-
console.warn(`Deplint: Found ${
|
|
1719
|
+
console.warn(`Deplint: Found ${chalk21.red(totalErrors)} dependency problems. ${chalk21.red("\u2716")}`);
|
|
1583
1720
|
} else {
|
|
1584
|
-
console.info(`Deplint: Found no dependency problems. ${
|
|
1721
|
+
console.info(`Deplint: Found no dependency problems. ${chalk21.green("\u2714")}`);
|
|
1585
1722
|
}
|
|
1586
1723
|
return 0;
|
|
1587
1724
|
};
|
|
@@ -1683,22 +1820,22 @@ var deployNext = () => {
|
|
|
1683
1820
|
};
|
|
1684
1821
|
|
|
1685
1822
|
// src/actions/dupdeps.ts
|
|
1686
|
-
import
|
|
1823
|
+
import chalk22 from "chalk";
|
|
1687
1824
|
var dupdeps = () => {
|
|
1688
|
-
console.log(
|
|
1825
|
+
console.log(chalk22.green("Checking all Dependencies for Duplicates"));
|
|
1689
1826
|
const allDependencies = parsedPackageJSON()?.dependencies;
|
|
1690
1827
|
const dependencies = Object.entries(allDependencies).map(([k]) => k);
|
|
1691
1828
|
return detectDuplicateDependencies(dependencies);
|
|
1692
1829
|
};
|
|
1693
1830
|
|
|
1694
1831
|
// src/actions/lint.ts
|
|
1695
|
-
import
|
|
1832
|
+
import chalk23 from "chalk";
|
|
1696
1833
|
var lintPackage = ({
|
|
1697
1834
|
pkg,
|
|
1698
1835
|
fix: fix2,
|
|
1699
1836
|
verbose
|
|
1700
1837
|
}) => {
|
|
1701
|
-
console.log(
|
|
1838
|
+
console.log(chalk23.gray(`${fix2 ? "Fix" : "Lint"} [${pkg}]`));
|
|
1702
1839
|
const start = Date.now();
|
|
1703
1840
|
const result = runSteps(`${fix2 ? "Fix" : "Lint"} [${pkg}]`, [
|
|
1704
1841
|
["yarn", [
|
|
@@ -1708,7 +1845,7 @@ var lintPackage = ({
|
|
|
1708
1845
|
fix2 ? "package-fix" : verbose ? "package-lint-verbose" : "package-lint"
|
|
1709
1846
|
]]
|
|
1710
1847
|
]);
|
|
1711
|
-
console.log(
|
|
1848
|
+
console.log(chalk23.gray(`${fix2 ? "Fixed in" : "Linted in"} [${chalk23.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk23.gray("seconds")}`));
|
|
1712
1849
|
return result;
|
|
1713
1850
|
};
|
|
1714
1851
|
var lint = ({
|
|
@@ -1728,13 +1865,13 @@ var lint = ({
|
|
|
1728
1865
|
});
|
|
1729
1866
|
};
|
|
1730
1867
|
var lintAllPackages = ({ fix: fix2 = false } = {}) => {
|
|
1731
|
-
console.log(
|
|
1868
|
+
console.log(chalk23.gray(`${fix2 ? "Fix" : "Lint"} [All-Packages]`));
|
|
1732
1869
|
const start = Date.now();
|
|
1733
1870
|
const fixOptions = fix2 ? ["--fix"] : [];
|
|
1734
1871
|
const result = runSteps(`${fix2 ? "Fix" : "Lint"} [All-Packages]`, [
|
|
1735
1872
|
["yarn", ["eslint", "--cache", "--cache-location", ".eslintcache", "--cache-strategy", "content", ...fixOptions]]
|
|
1736
1873
|
]);
|
|
1737
|
-
console.log(
|
|
1874
|
+
console.log(chalk23.gray(`${fix2 ? "Fixed in" : "Linted in"} [${chalk23.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk23.gray("seconds")}`));
|
|
1738
1875
|
return result;
|
|
1739
1876
|
};
|
|
1740
1877
|
|
|
@@ -1762,7 +1899,7 @@ var filename = ".gitignore";
|
|
|
1762
1899
|
var gitignoreGen = (pkg) => generateIgnoreFiles(filename, pkg);
|
|
1763
1900
|
|
|
1764
1901
|
// src/actions/gitlint.ts
|
|
1765
|
-
import
|
|
1902
|
+
import chalk24 from "chalk";
|
|
1766
1903
|
import ParseGitConfig from "parse-git-config";
|
|
1767
1904
|
var gitlint = () => {
|
|
1768
1905
|
console.log(`
|
|
@@ -1773,7 +1910,7 @@ Gitlint Start [${process.cwd()}]
|
|
|
1773
1910
|
const errors = 0;
|
|
1774
1911
|
const gitConfig = ParseGitConfig.sync();
|
|
1775
1912
|
const warn = (message) => {
|
|
1776
|
-
console.warn(
|
|
1913
|
+
console.warn(chalk24.yellow(`Warning: ${message}`));
|
|
1777
1914
|
warnings++;
|
|
1778
1915
|
};
|
|
1779
1916
|
if (gitConfig.core.ignorecase) {
|
|
@@ -1793,13 +1930,13 @@ Gitlint Start [${process.cwd()}]
|
|
|
1793
1930
|
}
|
|
1794
1931
|
const resultMessages = [];
|
|
1795
1932
|
if (valid > 0) {
|
|
1796
|
-
resultMessages.push(
|
|
1933
|
+
resultMessages.push(chalk24.green(`Passed: ${valid}`));
|
|
1797
1934
|
}
|
|
1798
1935
|
if (warnings > 0) {
|
|
1799
|
-
resultMessages.push(
|
|
1936
|
+
resultMessages.push(chalk24.yellow(`Warnings: ${warnings}`));
|
|
1800
1937
|
}
|
|
1801
1938
|
if (errors > 0) {
|
|
1802
|
-
resultMessages.push(
|
|
1939
|
+
resultMessages.push(chalk24.red(` Errors: ${errors}`));
|
|
1803
1940
|
}
|
|
1804
1941
|
console.warn(`Gitlint Finish [ ${resultMessages.join(" | ")} ]
|
|
1805
1942
|
`);
|
|
@@ -1807,8 +1944,8 @@ Gitlint Start [${process.cwd()}]
|
|
|
1807
1944
|
};
|
|
1808
1945
|
|
|
1809
1946
|
// src/actions/gitlint-fix.ts
|
|
1810
|
-
import { execSync as
|
|
1811
|
-
import
|
|
1947
|
+
import { execSync as execSync3 } from "child_process";
|
|
1948
|
+
import chalk25 from "chalk";
|
|
1812
1949
|
import ParseGitConfig2 from "parse-git-config";
|
|
1813
1950
|
var gitlintFix = () => {
|
|
1814
1951
|
console.log(`
|
|
@@ -1816,16 +1953,16 @@ Gitlint Fix Start [${process.cwd()}]
|
|
|
1816
1953
|
`);
|
|
1817
1954
|
const gitConfig = ParseGitConfig2.sync();
|
|
1818
1955
|
if (gitConfig.core.ignorecase) {
|
|
1819
|
-
|
|
1820
|
-
console.warn(
|
|
1956
|
+
execSync3("git config core.ignorecase false", { stdio: "inherit" });
|
|
1957
|
+
console.warn(chalk25.yellow("\nGitlint Fix: Updated core.ignorecase to be false\n"));
|
|
1821
1958
|
}
|
|
1822
1959
|
if (gitConfig.core.autocrlf !== false) {
|
|
1823
|
-
|
|
1824
|
-
console.warn(
|
|
1960
|
+
execSync3("git config core.autocrlf false", { stdio: "inherit" });
|
|
1961
|
+
console.warn(chalk25.yellow("\nGitlint Fix: Updated core.autocrlf to be false\n"));
|
|
1825
1962
|
}
|
|
1826
1963
|
if (gitConfig.core.eol !== "lf") {
|
|
1827
|
-
|
|
1828
|
-
console.warn(
|
|
1964
|
+
execSync3("git config core.eol lf", { stdio: "inherit" });
|
|
1965
|
+
console.warn(chalk25.yellow('\nGitlint Fix: Updated core.eol to be "lf"\n'));
|
|
1829
1966
|
}
|
|
1830
1967
|
return 1;
|
|
1831
1968
|
};
|
|
@@ -1836,7 +1973,7 @@ var knip = () => {
|
|
|
1836
1973
|
};
|
|
1837
1974
|
|
|
1838
1975
|
// src/actions/license.ts
|
|
1839
|
-
import
|
|
1976
|
+
import chalk26 from "chalk";
|
|
1840
1977
|
import { init } from "license-checker";
|
|
1841
1978
|
var license = async (pkg) => {
|
|
1842
1979
|
const workspaces = yarnWorkspaces();
|
|
@@ -1861,18 +1998,18 @@ var license = async (pkg) => {
|
|
|
1861
1998
|
"LGPL-3.0-or-later",
|
|
1862
1999
|
"Python-2.0"
|
|
1863
2000
|
]);
|
|
1864
|
-
console.log(
|
|
2001
|
+
console.log(chalk26.green("License Checker"));
|
|
1865
2002
|
return (await Promise.all(
|
|
1866
2003
|
workspaceList.map(({ location, name }) => {
|
|
1867
2004
|
return new Promise((resolve) => {
|
|
1868
2005
|
init({ production: true, start: location }, (error, packages) => {
|
|
1869
2006
|
if (error) {
|
|
1870
|
-
console.error(
|
|
1871
|
-
console.error(
|
|
2007
|
+
console.error(chalk26.red(`License Checker [${name}] Error`));
|
|
2008
|
+
console.error(chalk26.gray(error));
|
|
1872
2009
|
console.log("\n");
|
|
1873
2010
|
resolve(1);
|
|
1874
2011
|
} else {
|
|
1875
|
-
console.log(
|
|
2012
|
+
console.log(chalk26.green(`License Checker [${name}]`));
|
|
1876
2013
|
let count = 0;
|
|
1877
2014
|
for (const [name2, info] of Object.entries(packages)) {
|
|
1878
2015
|
const licenses = Array.isArray(info.licenses) ? info.licenses : [info.licenses];
|
|
@@ -1888,7 +2025,7 @@ var license = async (pkg) => {
|
|
|
1888
2025
|
}
|
|
1889
2026
|
if (!orLicenseFound) {
|
|
1890
2027
|
count++;
|
|
1891
|
-
console.warn(
|
|
2028
|
+
console.warn(chalk26.yellow(`${name2}: Package License not allowed [${license2}]`));
|
|
1892
2029
|
}
|
|
1893
2030
|
}
|
|
1894
2031
|
}
|
|
@@ -1908,12 +2045,12 @@ var npmignoreGen = (pkg) => generateIgnoreFiles(filename2, pkg);
|
|
|
1908
2045
|
|
|
1909
2046
|
// src/actions/package/clean-outputs.ts
|
|
1910
2047
|
import path8 from "path";
|
|
1911
|
-
import
|
|
2048
|
+
import chalk27 from "chalk";
|
|
1912
2049
|
var packageCleanOutputs = () => {
|
|
1913
2050
|
const pkg = process.env.INIT_CWD ?? ".";
|
|
1914
2051
|
const pkgName = process.env.npm_package_name;
|
|
1915
2052
|
const folders = [path8.join(pkg, "dist"), path8.join(pkg, "build"), path8.join(pkg, "docs")];
|
|
1916
|
-
console.log(
|
|
2053
|
+
console.log(chalk27.green(`Cleaning Outputs [${pkgName}]`));
|
|
1917
2054
|
for (let folder of folders) {
|
|
1918
2055
|
deleteGlob(folder);
|
|
1919
2056
|
}
|
|
@@ -1922,11 +2059,11 @@ var packageCleanOutputs = () => {
|
|
|
1922
2059
|
|
|
1923
2060
|
// src/actions/package/clean-typescript.ts
|
|
1924
2061
|
import path9 from "path";
|
|
1925
|
-
import
|
|
2062
|
+
import chalk28 from "chalk";
|
|
1926
2063
|
var packageCleanTypescript = () => {
|
|
1927
2064
|
const pkg = process.env.INIT_CWD ?? ".";
|
|
1928
2065
|
const pkgName = process.env.npm_package_name;
|
|
1929
|
-
console.log(
|
|
2066
|
+
console.log(chalk28.green(`Cleaning Typescript [${pkgName}]`));
|
|
1930
2067
|
const files = [path9.join(pkg, "*.tsbuildinfo"), path9.join(pkg, ".tsconfig.*"), path9.join(pkg, ".eslintcache")];
|
|
1931
2068
|
for (let file of files) {
|
|
1932
2069
|
deleteGlob(file);
|
|
@@ -1940,26 +2077,26 @@ var packageClean = async () => {
|
|
|
1940
2077
|
};
|
|
1941
2078
|
|
|
1942
2079
|
// src/actions/package/compile/compile.ts
|
|
1943
|
-
import
|
|
2080
|
+
import chalk33 from "chalk";
|
|
1944
2081
|
|
|
1945
2082
|
// src/actions/package/compile/packageCompileTsup.ts
|
|
1946
|
-
import
|
|
2083
|
+
import chalk32 from "chalk";
|
|
1947
2084
|
import { build as build2, defineConfig } from "tsup";
|
|
1948
2085
|
|
|
1949
2086
|
// src/actions/package/compile/inputs.ts
|
|
1950
|
-
import
|
|
2087
|
+
import chalk29 from "chalk";
|
|
1951
2088
|
import { glob as glob2 } from "glob";
|
|
1952
2089
|
var getAllInputs = (srcDir, verbose = false) => {
|
|
1953
2090
|
return [...glob2.sync(`${srcDir}/**/*.ts`, { posix: true }).map((file) => {
|
|
1954
2091
|
const result = file.slice(Math.max(0, srcDir.length + 1));
|
|
1955
2092
|
if (verbose) {
|
|
1956
|
-
console.log(
|
|
2093
|
+
console.log(chalk29.gray(`getAllInputs: ${JSON.stringify(result, null, 2)}`));
|
|
1957
2094
|
}
|
|
1958
2095
|
return result;
|
|
1959
2096
|
}), ...glob2.sync(`${srcDir}/**/*.tsx`, { posix: true }).map((file) => {
|
|
1960
2097
|
const result = file.slice(Math.max(0, srcDir.length + 1));
|
|
1961
2098
|
if (verbose) {
|
|
1962
|
-
console.log(
|
|
2099
|
+
console.log(chalk29.gray(`getAllInputs: ${JSON.stringify(result, null, 2)}`));
|
|
1963
2100
|
}
|
|
1964
2101
|
return result;
|
|
1965
2102
|
})];
|
|
@@ -2018,7 +2155,7 @@ function deepMergeObjects(objects) {
|
|
|
2018
2155
|
|
|
2019
2156
|
// src/actions/package/compile/packageCompileTsc.ts
|
|
2020
2157
|
import { cwd as cwd2 } from "process";
|
|
2021
|
-
import
|
|
2158
|
+
import chalk30 from "chalk";
|
|
2022
2159
|
import { createProgramFromConfig } from "tsc-prog";
|
|
2023
2160
|
import ts3, {
|
|
2024
2161
|
DiagnosticCategory,
|
|
@@ -2040,7 +2177,7 @@ var getCompilerOptions = (options = {}, fileName = "tsconfig.json") => {
|
|
|
2040
2177
|
var packageCompileTsc = (platform, entries, srcDir = "src", outDir = "dist", compilerOptionsParam, verbose = false) => {
|
|
2041
2178
|
const pkg = process.env.INIT_CWD ?? cwd2();
|
|
2042
2179
|
if (verbose) {
|
|
2043
|
-
console.log(
|
|
2180
|
+
console.log(chalk30.cyan(`Validating code START: ${entries.length} files to ${outDir} from ${srcDir}`));
|
|
2044
2181
|
}
|
|
2045
2182
|
const configFilePath = ts3.findConfigFile(
|
|
2046
2183
|
"./",
|
|
@@ -2063,10 +2200,10 @@ var packageCompileTsc = (platform, entries, srcDir = "src", outDir = "dist", com
|
|
|
2063
2200
|
emitDeclarationOnly: true,
|
|
2064
2201
|
noEmit: false
|
|
2065
2202
|
};
|
|
2066
|
-
console.log(
|
|
2203
|
+
console.log(chalk30.cyan(`Validating Files: ${entries.length}`));
|
|
2067
2204
|
if (verbose) {
|
|
2068
2205
|
for (const entry of entries) {
|
|
2069
|
-
console.log(
|
|
2206
|
+
console.log(chalk30.grey(`Validating: ${entry}`));
|
|
2070
2207
|
}
|
|
2071
2208
|
}
|
|
2072
2209
|
try {
|
|
@@ -2102,7 +2239,7 @@ var packageCompileTsc = (platform, entries, srcDir = "src", outDir = "dist", com
|
|
|
2102
2239
|
return 0;
|
|
2103
2240
|
} finally {
|
|
2104
2241
|
if (verbose) {
|
|
2105
|
-
console.log(
|
|
2242
|
+
console.log(chalk30.cyan(`Validating code FINISH: ${entries.length} files to ${outDir} from ${srcDir}`));
|
|
2106
2243
|
}
|
|
2107
2244
|
}
|
|
2108
2245
|
};
|
|
@@ -2110,7 +2247,7 @@ var packageCompileTsc = (platform, entries, srcDir = "src", outDir = "dist", com
|
|
|
2110
2247
|
// src/actions/package/compile/packageCompileTscTypes.ts
|
|
2111
2248
|
import path10 from "path";
|
|
2112
2249
|
import { cwd as cwd3 } from "process";
|
|
2113
|
-
import
|
|
2250
|
+
import chalk31 from "chalk";
|
|
2114
2251
|
import { rollup } from "rollup";
|
|
2115
2252
|
import dts from "rollup-plugin-dts";
|
|
2116
2253
|
import nodeExternals from "rollup-plugin-node-externals";
|
|
@@ -2135,8 +2272,8 @@ async function bundleDts(inputPath, outputPath, platform, options, verbose = fal
|
|
|
2135
2272
|
if (ignoredWarningCodes.has(warning.code ?? "")) {
|
|
2136
2273
|
return;
|
|
2137
2274
|
}
|
|
2138
|
-
console.warn(
|
|
2139
|
-
console.warn(
|
|
2275
|
+
console.warn(chalk31.yellow(`[${warning.code}] ${warning.message}`));
|
|
2276
|
+
console.warn(chalk31.gray(inputPath));
|
|
2140
2277
|
warn(warning);
|
|
2141
2278
|
}
|
|
2142
2279
|
});
|
|
@@ -2146,8 +2283,8 @@ async function bundleDts(inputPath, outputPath, platform, options, verbose = fal
|
|
|
2146
2283
|
});
|
|
2147
2284
|
} catch (ex) {
|
|
2148
2285
|
const error = ex;
|
|
2149
|
-
console.warn(
|
|
2150
|
-
console.warn(
|
|
2286
|
+
console.warn(chalk31.red(error));
|
|
2287
|
+
console.warn(chalk31.gray(inputPath));
|
|
2151
2288
|
}
|
|
2152
2289
|
if (verbose) {
|
|
2153
2290
|
console.log(`Bundled declarations written to ${outputPath}`);
|
|
@@ -2155,7 +2292,7 @@ async function bundleDts(inputPath, outputPath, platform, options, verbose = fal
|
|
|
2155
2292
|
}
|
|
2156
2293
|
var packageCompileTscTypes = async (entries, outDir, platform, srcDir = "build", verbose = false) => {
|
|
2157
2294
|
if (verbose) {
|
|
2158
|
-
console.log(
|
|
2295
|
+
console.log(chalk31.cyan(`Compiling Types START [${platform}]: ${entries.length} files to ${outDir} from ${srcDir}`));
|
|
2159
2296
|
console.log(`Entries: ${entries.join(", ")}`);
|
|
2160
2297
|
}
|
|
2161
2298
|
const pkg = process.env.INIT_CWD ?? cwd3();
|
|
@@ -2179,7 +2316,7 @@ var packageCompileTscTypes = async (entries, outDir, platform, srcDir = "build",
|
|
|
2179
2316
|
await bundleDts(`${srcRoot}/${entryTypeName}`, `${outDir}/${entryTypeName}`, platform, { compilerOptions }, verbose);
|
|
2180
2317
|
}));
|
|
2181
2318
|
if (verbose) {
|
|
2182
|
-
console.log(
|
|
2319
|
+
console.log(chalk31.cyan(`Compiling Types FINISH: ${entries.length} files to ${outDir} from ${srcDir}`));
|
|
2183
2320
|
}
|
|
2184
2321
|
return 0;
|
|
2185
2322
|
};
|
|
@@ -2191,15 +2328,15 @@ var compileFolder = async (srcDir, entries, buildDir, options, bundleTypes = fal
|
|
|
2191
2328
|
console.log(`compileFolder [${srcDir}, ${options?.outDir}]`);
|
|
2192
2329
|
}
|
|
2193
2330
|
if (entries.length === 0) {
|
|
2194
|
-
console.warn(
|
|
2331
|
+
console.warn(chalk32.yellow(`No entries found in ${srcDir} to compile`));
|
|
2195
2332
|
return 0;
|
|
2196
2333
|
}
|
|
2197
2334
|
if (verbose) {
|
|
2198
|
-
console.log(
|
|
2335
|
+
console.log(chalk32.gray(`buildDir [${buildDir}]`));
|
|
2199
2336
|
}
|
|
2200
2337
|
const validationResult = packageCompileTsc(options?.platform ?? "neutral", entries, srcDir, buildDir, void 0, verbose);
|
|
2201
2338
|
if (validationResult !== 0) {
|
|
2202
|
-
console.error(
|
|
2339
|
+
console.error(chalk32.red(`Compile:Validation had ${validationResult} errors`));
|
|
2203
2340
|
return validationResult;
|
|
2204
2341
|
}
|
|
2205
2342
|
const optionsParams = tsupOptions([{
|
|
@@ -2224,12 +2361,12 @@ var compileFolder = async (srcDir, entries, buildDir, options, bundleTypes = fal
|
|
|
2224
2361
|
})
|
|
2225
2362
|
)).flat();
|
|
2226
2363
|
if (verbose) {
|
|
2227
|
-
console.log(
|
|
2228
|
-
console.log(
|
|
2364
|
+
console.log(chalk32.cyan(`TSUP:build:start [${srcDir}]`));
|
|
2365
|
+
console.log(chalk32.gray(`TSUP:build:options [${JSON.stringify(optionsList, null, 2)}]`));
|
|
2229
2366
|
}
|
|
2230
2367
|
await Promise.all(optionsList.map((options2) => build2(options2)));
|
|
2231
2368
|
if (verbose) {
|
|
2232
|
-
console.log(
|
|
2369
|
+
console.log(chalk32.cyan(`TSUP:build:stop [${srcDir}]`));
|
|
2233
2370
|
}
|
|
2234
2371
|
if (bundleTypes) {
|
|
2235
2372
|
await packageCompileTscTypes(entries, outDir, options?.platform ?? "neutral", buildDir, verbose);
|
|
@@ -2340,14 +2477,14 @@ var packageCompileTsup = async (config2) => {
|
|
|
2340
2477
|
// src/actions/package/compile/compile.ts
|
|
2341
2478
|
var packageCompile = async (inConfig = {}) => {
|
|
2342
2479
|
const pkg = process.env.INIT_CWD;
|
|
2343
|
-
console.log(
|
|
2480
|
+
console.log(chalk33.green(`Compiling ${pkg}`));
|
|
2344
2481
|
const config2 = await loadConfig(inConfig);
|
|
2345
2482
|
return await packageCompileTsup(config2);
|
|
2346
2483
|
};
|
|
2347
2484
|
|
|
2348
2485
|
// src/actions/package/copy-assets.ts
|
|
2349
2486
|
import path11 from "path/posix";
|
|
2350
|
-
import
|
|
2487
|
+
import chalk34 from "chalk";
|
|
2351
2488
|
import cpy2 from "cpy";
|
|
2352
2489
|
var copyTargetAssets2 = async (target, name, location) => {
|
|
2353
2490
|
try {
|
|
@@ -2360,7 +2497,7 @@ var copyTargetAssets2 = async (target, name, location) => {
|
|
|
2360
2497
|
}
|
|
2361
2498
|
);
|
|
2362
2499
|
if (values.length > 0) {
|
|
2363
|
-
console.log(
|
|
2500
|
+
console.log(chalk34.green(`Copying Assets [${target.toUpperCase()}] - ${name} - ${location}`));
|
|
2364
2501
|
}
|
|
2365
2502
|
for (const value of values) {
|
|
2366
2503
|
console.log(`${value.split("/").pop()} => ./dist/${target}`);
|
|
@@ -2427,7 +2564,7 @@ var packageCycle = async () => {
|
|
|
2427
2564
|
// src/actions/package/gen-docs.ts
|
|
2428
2565
|
import { existsSync as existsSync7 } from "fs";
|
|
2429
2566
|
import path12 from "path";
|
|
2430
|
-
import
|
|
2567
|
+
import chalk35 from "chalk";
|
|
2431
2568
|
import {
|
|
2432
2569
|
Application,
|
|
2433
2570
|
ArgumentsReader,
|
|
@@ -2531,7 +2668,7 @@ var runTypeDoc = async (app) => {
|
|
|
2531
2668
|
return ExitCodes.OutputError;
|
|
2532
2669
|
}
|
|
2533
2670
|
}
|
|
2534
|
-
console.log(
|
|
2671
|
+
console.log(chalk35.green(`${pkgName} - Ok`));
|
|
2535
2672
|
return ExitCodes.Ok;
|
|
2536
2673
|
};
|
|
2537
2674
|
|
|
@@ -2540,7 +2677,7 @@ import { readdirSync as readdirSync4 } from "fs";
|
|
|
2540
2677
|
import path13 from "path";
|
|
2541
2678
|
import { cwd as cwd4 } from "process";
|
|
2542
2679
|
import { pathToFileURL } from "url";
|
|
2543
|
-
import
|
|
2680
|
+
import chalk36 from "chalk";
|
|
2544
2681
|
import { ESLint } from "eslint";
|
|
2545
2682
|
import { findUp } from "find-up";
|
|
2546
2683
|
import picomatch from "picomatch";
|
|
@@ -2549,14 +2686,14 @@ var dumpMessages = (lintResults) => {
|
|
|
2549
2686
|
const severity = ["none", "warning", "error"];
|
|
2550
2687
|
for (const lintResult of lintResults) {
|
|
2551
2688
|
if (lintResult.messages.length > 0) {
|
|
2552
|
-
console.log(
|
|
2689
|
+
console.log(chalk36.gray(`
|
|
2553
2690
|
${lintResult.filePath}`));
|
|
2554
2691
|
for (const message of lintResult.messages) {
|
|
2555
2692
|
console.log(
|
|
2556
|
-
|
|
2557
|
-
|
|
2558
|
-
|
|
2559
|
-
|
|
2693
|
+
chalk36.gray(` ${message.line}:${message.column}`),
|
|
2694
|
+
chalk36[colors[message.severity]](` ${severity[message.severity]}`),
|
|
2695
|
+
chalk36.white(` ${message.message}`),
|
|
2696
|
+
chalk36.gray(` ${message.ruleId}`)
|
|
2560
2697
|
);
|
|
2561
2698
|
}
|
|
2562
2699
|
}
|
|
@@ -2594,10 +2731,10 @@ var packageLint = async (fix2 = false, verbose = false, cache = true) => {
|
|
|
2594
2731
|
cache
|
|
2595
2732
|
});
|
|
2596
2733
|
const files = getFiles(cwd4(), ignoreFolders);
|
|
2597
|
-
console.log(
|
|
2734
|
+
console.log(chalk36.green(`Linting ${pkg} [files = ${files.length}]`));
|
|
2598
2735
|
if (verbose) {
|
|
2599
2736
|
for (const file of files) {
|
|
2600
|
-
console.log(
|
|
2737
|
+
console.log(chalk36.gray(` ${file}`));
|
|
2601
2738
|
}
|
|
2602
2739
|
}
|
|
2603
2740
|
const lintResults = await engine.lintFiles(files);
|
|
@@ -2608,32 +2745,32 @@ var packageLint = async (fix2 = false, verbose = false, cache = true) => {
|
|
|
2608
2745
|
const filesCountColor = files.length < 100 ? "green" : files.length < 1e3 ? "yellow" : "red";
|
|
2609
2746
|
const lintTime = Date.now() - start;
|
|
2610
2747
|
const lintTimeColor = lintTime < 1e3 ? "green" : lintTime < 3e3 ? "yellow" : "red";
|
|
2611
|
-
console.log(
|
|
2748
|
+
console.log(chalk36.white(`Linted ${chalk36[filesCountColor](files.length)} files in ${chalk36[lintTimeColor](lintTime)}ms`));
|
|
2612
2749
|
return lintResults.reduce((prev, lintResult) => prev + lintResult.errorCount, 0);
|
|
2613
2750
|
};
|
|
2614
2751
|
|
|
2615
2752
|
// src/actions/package/publint.ts
|
|
2616
2753
|
import { promises as fs10 } from "fs";
|
|
2617
|
-
import
|
|
2754
|
+
import chalk37 from "chalk";
|
|
2618
2755
|
import sortPackageJson from "sort-package-json";
|
|
2619
2756
|
var customPubLint = (pkg) => {
|
|
2620
2757
|
let errorCount = 0;
|
|
2621
2758
|
let warningCount = 0;
|
|
2622
2759
|
if (pkg.files === void 0) {
|
|
2623
|
-
console.warn(
|
|
2760
|
+
console.warn(chalk37.yellow('Publint [custom]: "files" field is missing'));
|
|
2624
2761
|
warningCount++;
|
|
2625
2762
|
}
|
|
2626
2763
|
if (pkg.main !== void 0) {
|
|
2627
|
-
console.warn(
|
|
2764
|
+
console.warn(chalk37.yellow('Publint [custom]: "main" field is deprecated, use "exports" instead'));
|
|
2628
2765
|
warningCount++;
|
|
2629
2766
|
}
|
|
2630
2767
|
if (pkg.sideEffects !== false) {
|
|
2631
|
-
console.warn(
|
|
2768
|
+
console.warn(chalk37.yellow('Publint [custom]: "sideEffects" field should be set to false'));
|
|
2632
2769
|
warningCount++;
|
|
2633
2770
|
}
|
|
2634
2771
|
if (pkg.resolutions !== void 0) {
|
|
2635
|
-
console.warn(
|
|
2636
|
-
console.warn(
|
|
2772
|
+
console.warn(chalk37.yellow('Publint [custom]: "resolutions" in use'));
|
|
2773
|
+
console.warn(chalk37.gray(JSON.stringify(pkg.resolutions, null, 2)));
|
|
2637
2774
|
warningCount++;
|
|
2638
2775
|
}
|
|
2639
2776
|
return [errorCount, warningCount];
|
|
@@ -2643,8 +2780,8 @@ var packagePublint = async ({ strict = true, verbose = false } = {}) => {
|
|
|
2643
2780
|
const sortedPkg = sortPackageJson(await fs10.readFile(`${pkgDir}/package.json`, "utf8"));
|
|
2644
2781
|
await fs10.writeFile(`${pkgDir}/package.json`, sortedPkg);
|
|
2645
2782
|
const pkg = JSON.parse(await fs10.readFile(`${pkgDir}/package.json`, "utf8"));
|
|
2646
|
-
console.log(
|
|
2647
|
-
console.log(
|
|
2783
|
+
console.log(chalk37.green(`Publint: ${pkg.name}`));
|
|
2784
|
+
console.log(chalk37.gray(pkgDir));
|
|
2648
2785
|
const { publint: publint2 } = await import("publint");
|
|
2649
2786
|
const { messages } = await publint2({
|
|
2650
2787
|
level: "suggestion",
|
|
@@ -2655,22 +2792,22 @@ var packagePublint = async ({ strict = true, verbose = false } = {}) => {
|
|
|
2655
2792
|
for (const message of messages) {
|
|
2656
2793
|
switch (message.type) {
|
|
2657
2794
|
case "error": {
|
|
2658
|
-
console.error(
|
|
2795
|
+
console.error(chalk37.red(`[${message.code}] ${formatMessage(message, pkg)}`));
|
|
2659
2796
|
break;
|
|
2660
2797
|
}
|
|
2661
2798
|
case "warning": {
|
|
2662
|
-
console.warn(
|
|
2799
|
+
console.warn(chalk37.yellow(`[${message.code}] ${formatMessage(message, pkg)}`));
|
|
2663
2800
|
break;
|
|
2664
2801
|
}
|
|
2665
2802
|
default: {
|
|
2666
|
-
console.log(
|
|
2803
|
+
console.log(chalk37.white(`[${message.code}] ${formatMessage(message, pkg)}`));
|
|
2667
2804
|
break;
|
|
2668
2805
|
}
|
|
2669
2806
|
}
|
|
2670
2807
|
}
|
|
2671
2808
|
const [errorCount, warningCount] = customPubLint(pkg);
|
|
2672
2809
|
if (verbose) {
|
|
2673
|
-
console.log(
|
|
2810
|
+
console.log(chalk37.gray(`Publint [Finish]: ${pkgDir} [${messages.length + errorCount + warningCount} messages]`));
|
|
2674
2811
|
}
|
|
2675
2812
|
return messages.filter((message) => message.type === "error").length + errorCount;
|
|
2676
2813
|
};
|
|
@@ -2697,6 +2834,21 @@ var publish = () => {
|
|
|
2697
2834
|
return runSteps("Publish", [["npm", ["publish", "--workspaces"]]]);
|
|
2698
2835
|
};
|
|
2699
2836
|
|
|
2837
|
+
// src/actions/readme-gen.ts
|
|
2838
|
+
async function readmeGen({
|
|
2839
|
+
pkg,
|
|
2840
|
+
templatePath,
|
|
2841
|
+
typedoc,
|
|
2842
|
+
verbose
|
|
2843
|
+
}) {
|
|
2844
|
+
return await generateReadmeFiles({
|
|
2845
|
+
pkg,
|
|
2846
|
+
templatePath,
|
|
2847
|
+
typedoc,
|
|
2848
|
+
verbose
|
|
2849
|
+
});
|
|
2850
|
+
}
|
|
2851
|
+
|
|
2700
2852
|
// src/actions/rebuild.ts
|
|
2701
2853
|
var rebuild = ({ target }) => {
|
|
2702
2854
|
return runSteps("Rebuild", [
|
|
@@ -2706,7 +2858,7 @@ var rebuild = ({ target }) => {
|
|
|
2706
2858
|
};
|
|
2707
2859
|
|
|
2708
2860
|
// src/actions/recompile.ts
|
|
2709
|
-
import
|
|
2861
|
+
import chalk38 from "chalk";
|
|
2710
2862
|
var recompile = async ({
|
|
2711
2863
|
verbose,
|
|
2712
2864
|
target,
|
|
@@ -2742,7 +2894,7 @@ var recompileAll = async ({
|
|
|
2742
2894
|
const incrementalOptions = incremental ? ["--since", "-Apt", "--topological-dev"] : ["--parallel", "-Apt", "--topological-dev"];
|
|
2743
2895
|
const jobsOptions = jobs ? ["-j", `${jobs}`] : [];
|
|
2744
2896
|
if (jobs) {
|
|
2745
|
-
console.log(
|
|
2897
|
+
console.log(chalk38.blue(`Jobs set to [${jobs}]`));
|
|
2746
2898
|
}
|
|
2747
2899
|
const result = await runStepsAsync(`Recompile${incremental ? "-Incremental" : ""} [All]`, [
|
|
2748
2900
|
[
|
|
@@ -2773,7 +2925,7 @@ var recompileAll = async ({
|
|
|
2773
2925
|
]
|
|
2774
2926
|
]);
|
|
2775
2927
|
console.log(
|
|
2776
|
-
`${
|
|
2928
|
+
`${chalk38.gray("Recompiled in")} [${chalk38.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk38.gray("seconds")}`
|
|
2777
2929
|
);
|
|
2778
2930
|
return result;
|
|
2779
2931
|
};
|
|
@@ -2804,13 +2956,13 @@ var reinstall = () => {
|
|
|
2804
2956
|
};
|
|
2805
2957
|
|
|
2806
2958
|
// src/actions/relint.ts
|
|
2807
|
-
import
|
|
2959
|
+
import chalk39 from "chalk";
|
|
2808
2960
|
var relintPackage = ({
|
|
2809
2961
|
pkg,
|
|
2810
2962
|
fix: fix2,
|
|
2811
2963
|
verbose
|
|
2812
2964
|
}) => {
|
|
2813
|
-
console.log(
|
|
2965
|
+
console.log(chalk39.gray(`${fix2 ? "Fix" : "Lint"} [${pkg}]`));
|
|
2814
2966
|
const start = Date.now();
|
|
2815
2967
|
const result = runSteps(`${fix2 ? "Fix" : "Lint"} [${pkg}]`, [
|
|
2816
2968
|
["yarn", [
|
|
@@ -2820,7 +2972,7 @@ var relintPackage = ({
|
|
|
2820
2972
|
fix2 ? "package-fix" : verbose ? "package-lint-verbose" : "package-lint"
|
|
2821
2973
|
]]
|
|
2822
2974
|
]);
|
|
2823
|
-
console.log(
|
|
2975
|
+
console.log(chalk39.gray(`${fix2 ? "Fixed in" : "Linted in"} [${chalk39.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk39.gray("seconds")}`));
|
|
2824
2976
|
return result;
|
|
2825
2977
|
};
|
|
2826
2978
|
var relint = ({
|
|
@@ -2840,13 +2992,13 @@ var relint = ({
|
|
|
2840
2992
|
});
|
|
2841
2993
|
};
|
|
2842
2994
|
var relintAllPackages = ({ fix: fix2 = false } = {}) => {
|
|
2843
|
-
console.log(
|
|
2995
|
+
console.log(chalk39.gray(`${fix2 ? "Fix" : "Lint"} [All-Packages]`));
|
|
2844
2996
|
const start = Date.now();
|
|
2845
2997
|
const fixOptions = fix2 ? ["--fix"] : [];
|
|
2846
2998
|
const result = runSteps(`${fix2 ? "Fix" : "Lint"} [All-Packages]`, [
|
|
2847
2999
|
["yarn", ["eslint", ...fixOptions]]
|
|
2848
3000
|
]);
|
|
2849
|
-
console.log(
|
|
3001
|
+
console.log(chalk39.gray(`${fix2 ? "Fixed in" : "Linted in"} [${chalk39.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk39.gray("seconds")}`));
|
|
2850
3002
|
return result;
|
|
2851
3003
|
};
|
|
2852
3004
|
|
|
@@ -2864,10 +3016,10 @@ var sonar = () => {
|
|
|
2864
3016
|
};
|
|
2865
3017
|
|
|
2866
3018
|
// src/actions/statics.ts
|
|
2867
|
-
import
|
|
3019
|
+
import chalk40 from "chalk";
|
|
2868
3020
|
var DefaultDependencies = ["axios", "@xylabs/pixel", "react", "graphql", "react-router", "@mui/material", "@mui/system"];
|
|
2869
3021
|
var statics = () => {
|
|
2870
|
-
console.log(
|
|
3022
|
+
console.log(chalk40.green("Check Required Static Dependencies"));
|
|
2871
3023
|
const statics2 = parsedPackageJSON()?.xy?.deps?.statics;
|
|
2872
3024
|
return detectDuplicateDependencies(statics2, DefaultDependencies);
|
|
2873
3025
|
};
|
|
@@ -2916,15 +3068,15 @@ var yarn3Only = () => {
|
|
|
2916
3068
|
};
|
|
2917
3069
|
|
|
2918
3070
|
// src/loadPackageConfig.ts
|
|
2919
|
-
import { readFile } from "fs/promises";
|
|
3071
|
+
import { readFile as readFile2 } from "fs/promises";
|
|
2920
3072
|
var loadPackageConfig = async () => {
|
|
2921
3073
|
const pkg = process.env.INIT_CWD;
|
|
2922
|
-
const pkgConfig = await
|
|
3074
|
+
const pkgConfig = await readFile2(`${pkg}/package.json`, { encoding: "utf8" });
|
|
2923
3075
|
return JSON.parse(pkgConfig);
|
|
2924
3076
|
};
|
|
2925
3077
|
|
|
2926
3078
|
// src/xy/xy.ts
|
|
2927
|
-
import
|
|
3079
|
+
import chalk42 from "chalk";
|
|
2928
3080
|
|
|
2929
3081
|
// src/xy/xyBuildCommands.ts
|
|
2930
3082
|
var xyBuildCommands = (args) => {
|
|
@@ -3122,6 +3274,29 @@ var xyCommonCommands = (args) => {
|
|
|
3122
3274
|
if (argv.verbose) console.log("NpmIgnore Gen");
|
|
3123
3275
|
process.exitCode = npmignoreGen();
|
|
3124
3276
|
}
|
|
3277
|
+
).command(
|
|
3278
|
+
"readme-gen [package]",
|
|
3279
|
+
"Readme Gen - Generate README.md files from template",
|
|
3280
|
+
(yargs2) => {
|
|
3281
|
+
return packagePositionalParam(yargs2).option("template", {
|
|
3282
|
+
alias: "t",
|
|
3283
|
+
description: "Path to README.template.md",
|
|
3284
|
+
type: "string"
|
|
3285
|
+
}).option("typedoc", {
|
|
3286
|
+
default: false,
|
|
3287
|
+
description: "Generate TypeDoc reference sections",
|
|
3288
|
+
type: "boolean"
|
|
3289
|
+
});
|
|
3290
|
+
},
|
|
3291
|
+
async (argv) => {
|
|
3292
|
+
if (argv.verbose) console.log("Readme Gen");
|
|
3293
|
+
process.exitCode = await readmeGen({
|
|
3294
|
+
pkg: argv.package,
|
|
3295
|
+
templatePath: argv.template,
|
|
3296
|
+
typedoc: argv.typedoc,
|
|
3297
|
+
verbose: !!argv.verbose
|
|
3298
|
+
});
|
|
3299
|
+
}
|
|
3125
3300
|
).command(
|
|
3126
3301
|
"retest",
|
|
3127
3302
|
"Re-Test - Run Jest Tests with cleaned cache",
|
|
@@ -3301,7 +3476,7 @@ var xyInstallCommands = (args) => {
|
|
|
3301
3476
|
};
|
|
3302
3477
|
|
|
3303
3478
|
// src/xy/xyLintCommands.ts
|
|
3304
|
-
import
|
|
3479
|
+
import chalk41 from "chalk";
|
|
3305
3480
|
var xyLintCommands = (args) => {
|
|
3306
3481
|
return args.command(
|
|
3307
3482
|
"cycle [package]",
|
|
@@ -3313,7 +3488,7 @@ var xyLintCommands = (args) => {
|
|
|
3313
3488
|
const start = Date.now();
|
|
3314
3489
|
if (argv.verbose) console.log("Cycle");
|
|
3315
3490
|
process.exitCode = await cycle({ pkg: argv.package });
|
|
3316
|
-
console.log(
|
|
3491
|
+
console.log(chalk41.blue(`Finished in ${Date.now() - start}ms`));
|
|
3317
3492
|
}
|
|
3318
3493
|
).command(
|
|
3319
3494
|
"lint [package]",
|
|
@@ -3343,7 +3518,7 @@ var xyLintCommands = (args) => {
|
|
|
3343
3518
|
cache: argv.cache,
|
|
3344
3519
|
verbose: !!argv.verbose
|
|
3345
3520
|
});
|
|
3346
|
-
console.log(
|
|
3521
|
+
console.log(chalk41.blue(`Finished in ${Date.now() - start}ms`));
|
|
3347
3522
|
}
|
|
3348
3523
|
).command(
|
|
3349
3524
|
"deplint [package]",
|
|
@@ -3382,7 +3557,7 @@ var xyLintCommands = (args) => {
|
|
|
3382
3557
|
peerDeps: !!argv.peerDeps,
|
|
3383
3558
|
verbose: !!argv.verbose
|
|
3384
3559
|
});
|
|
3385
|
-
console.log(
|
|
3560
|
+
console.log(chalk41.blue(`Finished in ${Date.now() - start}ms`));
|
|
3386
3561
|
}
|
|
3387
3562
|
).command(
|
|
3388
3563
|
"fix [package]",
|
|
@@ -3394,7 +3569,7 @@ var xyLintCommands = (args) => {
|
|
|
3394
3569
|
const start = Date.now();
|
|
3395
3570
|
if (argv.verbose) console.log("Fix");
|
|
3396
3571
|
process.exitCode = fix();
|
|
3397
|
-
console.log(
|
|
3572
|
+
console.log(chalk41.blue(`Finished in ${Date.now() - start}ms`));
|
|
3398
3573
|
}
|
|
3399
3574
|
).command(
|
|
3400
3575
|
"relint [package]",
|
|
@@ -3406,7 +3581,7 @@ var xyLintCommands = (args) => {
|
|
|
3406
3581
|
if (argv.verbose) console.log("Relinting");
|
|
3407
3582
|
const start = Date.now();
|
|
3408
3583
|
process.exitCode = relint();
|
|
3409
|
-
console.log(
|
|
3584
|
+
console.log(chalk41.blue(`Finished in ${Date.now() - start}ms`));
|
|
3410
3585
|
}
|
|
3411
3586
|
).command(
|
|
3412
3587
|
"publint [package]",
|
|
@@ -3418,7 +3593,7 @@ var xyLintCommands = (args) => {
|
|
|
3418
3593
|
if (argv.verbose) console.log("Publint");
|
|
3419
3594
|
const start = Date.now();
|
|
3420
3595
|
process.exitCode = await publint({ pkg: argv.package, verbose: !!argv.verbose });
|
|
3421
|
-
console.log(
|
|
3596
|
+
console.log(chalk41.blue(`Finished in ${Date.now() - start}ms`));
|
|
3422
3597
|
}
|
|
3423
3598
|
).command(
|
|
3424
3599
|
"knip",
|
|
@@ -3430,7 +3605,7 @@ var xyLintCommands = (args) => {
|
|
|
3430
3605
|
if (argv.verbose) console.log("Knip");
|
|
3431
3606
|
const start = Date.now();
|
|
3432
3607
|
process.exitCode = knip();
|
|
3433
|
-
console.log(
|
|
3608
|
+
console.log(chalk41.blue(`Knip finished in ${Date.now() - start}ms`));
|
|
3434
3609
|
}
|
|
3435
3610
|
).command(
|
|
3436
3611
|
"sonar",
|
|
@@ -3442,7 +3617,7 @@ var xyLintCommands = (args) => {
|
|
|
3442
3617
|
const start = Date.now();
|
|
3443
3618
|
if (argv.verbose) console.log("Sonar Check");
|
|
3444
3619
|
process.exitCode = sonar();
|
|
3445
|
-
console.log(
|
|
3620
|
+
console.log(chalk41.blue(`Finished in ${Date.now() - start}ms`));
|
|
3446
3621
|
}
|
|
3447
3622
|
);
|
|
3448
3623
|
};
|
|
@@ -3478,8 +3653,8 @@ var xyParseOptions = () => {
|
|
|
3478
3653
|
var xy = async () => {
|
|
3479
3654
|
const options = xyParseOptions();
|
|
3480
3655
|
return await xyBuildCommands(xyCommonCommands(xyInstallCommands(xyDeployCommands(xyLintCommands(options))))).demandCommand(1).command("*", "", () => {
|
|
3481
|
-
console.error(
|
|
3482
|
-
console.log(
|
|
3656
|
+
console.error(chalk42.yellow(`Command not found [${chalk42.magenta(process.argv[2])}]`));
|
|
3657
|
+
console.log(chalk42.gray("Try 'yarn xy --help' for list of commands"));
|
|
3483
3658
|
}).version().help().argv;
|
|
3484
3659
|
};
|
|
3485
3660
|
export {
|
|
@@ -3526,6 +3701,7 @@ export {
|
|
|
3526
3701
|
genDocsAll,
|
|
3527
3702
|
genDocsPackage,
|
|
3528
3703
|
generateIgnoreFiles,
|
|
3704
|
+
generateReadmeFiles,
|
|
3529
3705
|
gitignoreGen,
|
|
3530
3706
|
gitlint,
|
|
3531
3707
|
gitlintFix,
|
|
@@ -3561,6 +3737,7 @@ export {
|
|
|
3561
3737
|
publish,
|
|
3562
3738
|
readLines,
|
|
3563
3739
|
readNonEmptyLines,
|
|
3740
|
+
readmeGen,
|
|
3564
3741
|
rebuild,
|
|
3565
3742
|
recompile,
|
|
3566
3743
|
recompileAll,
|