@xylabs/ts-scripts-yarn3 7.4.9 → 7.4.10
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/claude-commands.mjs +99 -0
- package/dist/actions/claude-commands.mjs.map +1 -0
- package/dist/actions/claude-rules.mjs.map +1 -1
- package/dist/actions/index.mjs +222 -141
- package/dist/actions/index.mjs.map +1 -1
- package/dist/bin/xy.mjs +184 -96
- package/dist/bin/xy.mjs.map +1 -1
- package/dist/index.d.ts +5 -1
- package/dist/index.mjs +244 -153
- package/dist/index.mjs.map +1 -1
- package/dist/lib/claudeMdTemplate.mjs +12 -0
- package/dist/lib/claudeMdTemplate.mjs.map +1 -1
- package/dist/lib/index.mjs +12 -0
- package/dist/lib/index.mjs.map +1 -1
- package/dist/xy/index.mjs +184 -96
- package/dist/xy/index.mjs.map +1 -1
- package/dist/xy/xy.mjs +184 -96
- package/dist/xy/xy.mjs.map +1 -1
- package/dist/xy/xyCommonCommands.mjs +122 -34
- package/dist/xy/xyCommonCommands.mjs.map +1 -1
- package/package.json +2 -2
- package/templates/commands/xylabs-build.md +5 -0
- package/templates/commands/xylabs-clean.md +5 -0
- package/templates/commands/xylabs-compile.md +5 -0
- package/templates/commands/xylabs-cycle.md +5 -0
- package/templates/commands/xylabs-deplint.md +5 -0
- package/templates/commands/xylabs-deploy-major.md +7 -0
- package/templates/commands/xylabs-deploy-minor.md +7 -0
- package/templates/commands/xylabs-deploy.md +7 -0
- package/templates/commands/xylabs-fix.md +5 -0
- package/templates/commands/xylabs-knip.md +5 -0
- package/templates/commands/xylabs-lint.md +5 -0
- package/templates/commands/xylabs-publint.md +5 -0
- package/templates/commands/xylabs-rebuild.md +5 -0
- package/templates/commands/xylabs-test.md +5 -0
package/dist/actions/index.mjs
CHANGED
|
@@ -22,6 +22,7 @@ var require2 = createRequire(import.meta.url);
|
|
|
22
22
|
var packageRoot = PATH.dirname(require2.resolve("@xylabs/ts-scripts-yarn3/package.json"));
|
|
23
23
|
var templatesDir = PATH.resolve(packageRoot, "templates");
|
|
24
24
|
var XYLABS_RULES_PREFIX = "xylabs-";
|
|
25
|
+
var XYLABS_COMMANDS_PREFIX = "xylabs-";
|
|
25
26
|
var claudeMdRuleTemplates = () => {
|
|
26
27
|
const rulesDir = PATH.resolve(templatesDir, "rules");
|
|
27
28
|
const files = readdirSync(rulesDir).filter((f) => f.startsWith(XYLABS_RULES_PREFIX) && f.endsWith(".md"));
|
|
@@ -31,6 +32,15 @@ var claudeMdRuleTemplates = () => {
|
|
|
31
32
|
}
|
|
32
33
|
return result;
|
|
33
34
|
};
|
|
35
|
+
var claudeCommandTemplates = () => {
|
|
36
|
+
const commandsDir = PATH.resolve(templatesDir, "commands");
|
|
37
|
+
const files = readdirSync(commandsDir).filter((f) => f.startsWith(XYLABS_COMMANDS_PREFIX) && f.endsWith(".md"));
|
|
38
|
+
const result = {};
|
|
39
|
+
for (const file of files) {
|
|
40
|
+
result[file] = readFileSync(PATH.resolve(commandsDir, file), "utf8");
|
|
41
|
+
}
|
|
42
|
+
return result;
|
|
43
|
+
};
|
|
34
44
|
var claudeMdProjectTemplate = () => readFileSync(PATH.resolve(templatesDir, "CLAUDE-project.md"), "utf8");
|
|
35
45
|
|
|
36
46
|
// src/lib/deleteGlob.ts
|
|
@@ -446,7 +456,7 @@ var build = async ({
|
|
|
446
456
|
return result;
|
|
447
457
|
};
|
|
448
458
|
|
|
449
|
-
// src/actions/claude-
|
|
459
|
+
// src/actions/claude-commands.ts
|
|
450
460
|
import {
|
|
451
461
|
existsSync as existsSync4,
|
|
452
462
|
mkdirSync,
|
|
@@ -457,13 +467,13 @@ import {
|
|
|
457
467
|
} from "fs";
|
|
458
468
|
import PATH2 from "path";
|
|
459
469
|
import chalk9 from "chalk";
|
|
460
|
-
var
|
|
461
|
-
const templates =
|
|
470
|
+
var syncCommandFiles = (commandsDir) => {
|
|
471
|
+
const templates = claudeCommandTemplates();
|
|
462
472
|
const templateNames = new Set(Object.keys(templates));
|
|
463
473
|
let updated = 0;
|
|
464
474
|
let created = 0;
|
|
465
475
|
for (const [filename3, content] of Object.entries(templates)) {
|
|
466
|
-
const targetPath = PATH2.resolve(
|
|
476
|
+
const targetPath = PATH2.resolve(commandsDir, filename3);
|
|
467
477
|
const existing = existsSync4(targetPath) ? readFileSync4(targetPath, "utf8") : void 0;
|
|
468
478
|
if (existing === content) continue;
|
|
469
479
|
writeFileSync2(targetPath, content, "utf8");
|
|
@@ -479,12 +489,82 @@ var syncRuleFiles = (rulesDir) => {
|
|
|
479
489
|
updated
|
|
480
490
|
};
|
|
481
491
|
};
|
|
492
|
+
var removeStaleCommands = (commandsDir, templateNames) => {
|
|
493
|
+
const existingCommands = readdirSync2(commandsDir).filter((f) => f.startsWith(XYLABS_COMMANDS_PREFIX) && f.endsWith(".md"));
|
|
494
|
+
let removed = 0;
|
|
495
|
+
for (const file of existingCommands) {
|
|
496
|
+
if (!templateNames.has(file)) {
|
|
497
|
+
unlinkSync(PATH2.resolve(commandsDir, file));
|
|
498
|
+
removed++;
|
|
499
|
+
}
|
|
500
|
+
}
|
|
501
|
+
return removed;
|
|
502
|
+
};
|
|
503
|
+
var logCommandsResult = (created, updated, removed) => {
|
|
504
|
+
if (created || updated || removed) {
|
|
505
|
+
const parts = [
|
|
506
|
+
created ? `${created} created` : "",
|
|
507
|
+
updated ? `${updated} updated` : "",
|
|
508
|
+
removed ? `${removed} removed` : ""
|
|
509
|
+
].filter(Boolean);
|
|
510
|
+
console.log(chalk9.green(`.claude/commands/${XYLABS_COMMANDS_PREFIX}*.md: ${parts.join(", ")}`));
|
|
511
|
+
} else {
|
|
512
|
+
console.log(chalk9.gray(`.claude/commands/${XYLABS_COMMANDS_PREFIX}*.md: already up to date`));
|
|
513
|
+
}
|
|
514
|
+
};
|
|
515
|
+
var claudeCommands = () => {
|
|
516
|
+
const cwd5 = INIT_CWD() ?? process.cwd();
|
|
517
|
+
const commandsDir = PATH2.resolve(cwd5, ".claude", "commands");
|
|
518
|
+
mkdirSync(commandsDir, { recursive: true });
|
|
519
|
+
const {
|
|
520
|
+
created,
|
|
521
|
+
templateNames,
|
|
522
|
+
updated
|
|
523
|
+
} = syncCommandFiles(commandsDir);
|
|
524
|
+
const removed = removeStaleCommands(commandsDir, templateNames);
|
|
525
|
+
logCommandsResult(created, updated, removed);
|
|
526
|
+
return 0;
|
|
527
|
+
};
|
|
528
|
+
|
|
529
|
+
// src/actions/claude-rules.ts
|
|
530
|
+
import {
|
|
531
|
+
existsSync as existsSync5,
|
|
532
|
+
mkdirSync as mkdirSync2,
|
|
533
|
+
readdirSync as readdirSync3,
|
|
534
|
+
readFileSync as readFileSync5,
|
|
535
|
+
unlinkSync as unlinkSync2,
|
|
536
|
+
writeFileSync as writeFileSync3
|
|
537
|
+
} from "fs";
|
|
538
|
+
import PATH3 from "path";
|
|
539
|
+
import chalk10 from "chalk";
|
|
540
|
+
var syncRuleFiles = (rulesDir) => {
|
|
541
|
+
const templates = claudeMdRuleTemplates();
|
|
542
|
+
const templateNames = new Set(Object.keys(templates));
|
|
543
|
+
let updated = 0;
|
|
544
|
+
let created = 0;
|
|
545
|
+
for (const [filename3, content] of Object.entries(templates)) {
|
|
546
|
+
const targetPath = PATH3.resolve(rulesDir, filename3);
|
|
547
|
+
const existing = existsSync5(targetPath) ? readFileSync5(targetPath, "utf8") : void 0;
|
|
548
|
+
if (existing === content) continue;
|
|
549
|
+
writeFileSync3(targetPath, content, "utf8");
|
|
550
|
+
if (existing) {
|
|
551
|
+
updated++;
|
|
552
|
+
} else {
|
|
553
|
+
created++;
|
|
554
|
+
}
|
|
555
|
+
}
|
|
556
|
+
return {
|
|
557
|
+
created,
|
|
558
|
+
templateNames,
|
|
559
|
+
updated
|
|
560
|
+
};
|
|
561
|
+
};
|
|
482
562
|
var removeStaleRules = (rulesDir, templateNames) => {
|
|
483
|
-
const existingRules =
|
|
563
|
+
const existingRules = readdirSync3(rulesDir).filter((f) => f.startsWith(XYLABS_RULES_PREFIX) && f.endsWith(".md"));
|
|
484
564
|
let removed = 0;
|
|
485
565
|
for (const file of existingRules) {
|
|
486
566
|
if (!templateNames.has(file)) {
|
|
487
|
-
|
|
567
|
+
unlinkSync2(PATH3.resolve(rulesDir, file));
|
|
488
568
|
removed++;
|
|
489
569
|
}
|
|
490
570
|
}
|
|
@@ -497,27 +577,27 @@ var logRulesResult = (created, updated, removed) => {
|
|
|
497
577
|
updated ? `${updated} updated` : "",
|
|
498
578
|
removed ? `${removed} removed` : ""
|
|
499
579
|
].filter(Boolean);
|
|
500
|
-
console.log(
|
|
580
|
+
console.log(chalk10.green(`.claude/rules/${XYLABS_RULES_PREFIX}*.md: ${parts.join(", ")}`));
|
|
501
581
|
} else {
|
|
502
|
-
console.log(
|
|
582
|
+
console.log(chalk10.gray(`.claude/rules/${XYLABS_RULES_PREFIX}*.md: already up to date`));
|
|
503
583
|
}
|
|
504
584
|
};
|
|
505
585
|
var ensureProjectClaudeMd = (cwd5, force) => {
|
|
506
|
-
const projectPath =
|
|
507
|
-
if (!
|
|
508
|
-
if (force &&
|
|
509
|
-
console.log(
|
|
586
|
+
const projectPath = PATH3.resolve(cwd5, "CLAUDE.md");
|
|
587
|
+
if (!existsSync5(projectPath) || force) {
|
|
588
|
+
if (force && existsSync5(projectPath)) {
|
|
589
|
+
console.log(chalk10.yellow("Overwriting existing CLAUDE.md"));
|
|
510
590
|
}
|
|
511
|
-
|
|
512
|
-
console.log(
|
|
591
|
+
writeFileSync3(projectPath, claudeMdProjectTemplate(), "utf8");
|
|
592
|
+
console.log(chalk10.green("Generated CLAUDE.md"));
|
|
513
593
|
} else {
|
|
514
|
-
console.log(
|
|
594
|
+
console.log(chalk10.gray("CLAUDE.md already exists (skipped)"));
|
|
515
595
|
}
|
|
516
596
|
};
|
|
517
597
|
var claudeRules = ({ force } = {}) => {
|
|
518
598
|
const cwd5 = INIT_CWD() ?? process.cwd();
|
|
519
|
-
const rulesDir =
|
|
520
|
-
|
|
599
|
+
const rulesDir = PATH3.resolve(cwd5, ".claude", "rules");
|
|
600
|
+
mkdirSync2(rulesDir, { recursive: true });
|
|
521
601
|
const {
|
|
522
602
|
created,
|
|
523
603
|
templateNames,
|
|
@@ -543,16 +623,16 @@ var cleanAll = ({ verbose }) => {
|
|
|
543
623
|
|
|
544
624
|
// src/actions/clean-docs.ts
|
|
545
625
|
import path from "path";
|
|
546
|
-
import
|
|
626
|
+
import chalk11 from "chalk";
|
|
547
627
|
var cleanDocs = () => {
|
|
548
628
|
const pkgName = process.env.npm_package_name;
|
|
549
|
-
console.log(
|
|
629
|
+
console.log(chalk11.green(`Cleaning Docs [${pkgName}]`));
|
|
550
630
|
for (const { location } of yarnWorkspaces()) deleteGlob(path.join(location, "docs"));
|
|
551
631
|
return 0;
|
|
552
632
|
};
|
|
553
633
|
|
|
554
634
|
// src/actions/compile.ts
|
|
555
|
-
import
|
|
635
|
+
import chalk12 from "chalk";
|
|
556
636
|
var compile = ({
|
|
557
637
|
verbose,
|
|
558
638
|
target,
|
|
@@ -593,7 +673,7 @@ var compileAll = ({
|
|
|
593
673
|
const incrementalOptions = incremental ? ["--since", "-Ap", "--topological-dev"] : ["--parallel", "-Ap", "--topological-dev"];
|
|
594
674
|
const jobsOptions = jobs ? ["-j", `${jobs}`] : [];
|
|
595
675
|
if (jobs) {
|
|
596
|
-
console.log(
|
|
676
|
+
console.log(chalk12.blue(`Jobs set to [${jobs}]`));
|
|
597
677
|
}
|
|
598
678
|
const result = runSteps(`Compile${incremental ? "-Incremental" : ""} [All]`, [
|
|
599
679
|
["yarn", [
|
|
@@ -607,13 +687,13 @@ var compileAll = ({
|
|
|
607
687
|
...targetOptions
|
|
608
688
|
]]
|
|
609
689
|
]);
|
|
610
|
-
console.log(`${
|
|
690
|
+
console.log(`${chalk12.gray("Compiled in")} [${chalk12.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk12.gray("seconds")}`);
|
|
611
691
|
return result;
|
|
612
692
|
};
|
|
613
693
|
|
|
614
694
|
// src/actions/copy-assets.ts
|
|
615
695
|
import path2 from "path/posix";
|
|
616
|
-
import
|
|
696
|
+
import chalk13 from "chalk";
|
|
617
697
|
import cpy from "cpy";
|
|
618
698
|
var copyPackageTargetAssets = async (target, name, location) => {
|
|
619
699
|
try {
|
|
@@ -636,7 +716,7 @@ var copyPackageTargetAssets = async (target, name, location) => {
|
|
|
636
716
|
};
|
|
637
717
|
var copyTargetAssets = async (target, pkg) => {
|
|
638
718
|
const workspaces = yarnWorkspaces();
|
|
639
|
-
console.log(
|
|
719
|
+
console.log(chalk13.green(`Copying Assets [${target.toUpperCase()}]`));
|
|
640
720
|
const workspaceList = workspaces.filter(({ name }) => {
|
|
641
721
|
return pkg === void 0 || name === pkg;
|
|
642
722
|
});
|
|
@@ -720,7 +800,7 @@ var dead = () => {
|
|
|
720
800
|
};
|
|
721
801
|
|
|
722
802
|
// src/actions/deplint/deplint.ts
|
|
723
|
-
import
|
|
803
|
+
import chalk19 from "chalk";
|
|
724
804
|
|
|
725
805
|
// src/actions/deplint/findFiles.ts
|
|
726
806
|
import fs2 from "fs";
|
|
@@ -922,12 +1002,12 @@ function getExternalImportsFromFiles({
|
|
|
922
1002
|
|
|
923
1003
|
// src/actions/deplint/checkPackage/getUnlistedDependencies.ts
|
|
924
1004
|
import { builtinModules } from "module";
|
|
925
|
-
import
|
|
1005
|
+
import chalk14 from "chalk";
|
|
926
1006
|
function isListedOrBuiltin(imp, name, dependencies, peerDependencies) {
|
|
927
1007
|
return dependencies.includes(imp) || imp === name || dependencies.includes(`@types/${imp}`) || peerDependencies.includes(imp) || peerDependencies.includes(`@types/${imp}`) || builtinModules.includes(imp) || builtinModules.includes(`@types/${imp}`);
|
|
928
1008
|
}
|
|
929
1009
|
function logMissing(name, imp, importPaths) {
|
|
930
|
-
console.log(`[${
|
|
1010
|
+
console.log(`[${chalk14.blue(name)}] Missing dependency in package.json: ${chalk14.red(imp)}`);
|
|
931
1011
|
if (importPaths[imp]) {
|
|
932
1012
|
console.log(` ${importPaths[imp].join("\n ")}`);
|
|
933
1013
|
}
|
|
@@ -952,7 +1032,7 @@ function getUnlistedDependencies({ name, location }, { dependencies, peerDepende
|
|
|
952
1032
|
}
|
|
953
1033
|
if (unlistedDependencies > 0) {
|
|
954
1034
|
const packageLocation = `${location}/package.json`;
|
|
955
|
-
console.log(` ${
|
|
1035
|
+
console.log(` ${chalk14.yellow(packageLocation)}
|
|
956
1036
|
`);
|
|
957
1037
|
}
|
|
958
1038
|
return unlistedDependencies;
|
|
@@ -960,7 +1040,7 @@ function getUnlistedDependencies({ name, location }, { dependencies, peerDepende
|
|
|
960
1040
|
|
|
961
1041
|
// src/actions/deplint/checkPackage/getUnlistedDevDependencies.ts
|
|
962
1042
|
import { builtinModules as builtinModules2 } from "module";
|
|
963
|
-
import
|
|
1043
|
+
import chalk15 from "chalk";
|
|
964
1044
|
function getUnlistedDevDependencies({ name, location }, {
|
|
965
1045
|
devDependencies,
|
|
966
1046
|
dependencies,
|
|
@@ -974,7 +1054,7 @@ function getUnlistedDevDependencies({ name, location }, {
|
|
|
974
1054
|
for (const imp of externalAllImports) {
|
|
975
1055
|
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)) {
|
|
976
1056
|
unlistedDevDependencies++;
|
|
977
|
-
console.log(`[${
|
|
1057
|
+
console.log(`[${chalk15.blue(name)}] Missing devDependency in package.json: ${chalk15.red(imp)}`);
|
|
978
1058
|
if (allImportPaths[imp]) {
|
|
979
1059
|
console.log(` ${allImportPaths[imp].join("\n ")}`);
|
|
980
1060
|
}
|
|
@@ -982,14 +1062,14 @@ function getUnlistedDevDependencies({ name, location }, {
|
|
|
982
1062
|
}
|
|
983
1063
|
if (unlistedDevDependencies > 0) {
|
|
984
1064
|
const packageLocation = `${location}/package.json`;
|
|
985
|
-
console.log(` ${
|
|
1065
|
+
console.log(` ${chalk15.yellow(packageLocation)}
|
|
986
1066
|
`);
|
|
987
1067
|
}
|
|
988
1068
|
return unlistedDevDependencies;
|
|
989
1069
|
}
|
|
990
1070
|
|
|
991
1071
|
// src/actions/deplint/checkPackage/getUnusedDependencies.ts
|
|
992
|
-
import
|
|
1072
|
+
import chalk16 from "chalk";
|
|
993
1073
|
function getUnusedDependencies({ name, location }, { dependencies }, {
|
|
994
1074
|
externalDistImports,
|
|
995
1075
|
externalDistTypeImports,
|
|
@@ -1000,22 +1080,22 @@ function getUnusedDependencies({ name, location }, { dependencies }, {
|
|
|
1000
1080
|
if (!externalDistImports.includes(dep) && !externalDistImports.includes(dep.replace(/^@types\//, "")) && !externalDistTypeImports.includes(dep) && !externalDistTypeImports.includes(dep.replace(/^@types\//, ""))) {
|
|
1001
1081
|
unusedDependencies++;
|
|
1002
1082
|
if (externalAllImports.includes(dep)) {
|
|
1003
|
-
console.log(`[${
|
|
1083
|
+
console.log(`[${chalk16.blue(name)}] dependency should be devDependency in package.json: ${chalk16.red(dep)}`);
|
|
1004
1084
|
} else {
|
|
1005
|
-
console.log(`[${
|
|
1085
|
+
console.log(`[${chalk16.blue(name)}] Unused dependency in package.json: ${chalk16.red(dep)}`);
|
|
1006
1086
|
}
|
|
1007
1087
|
}
|
|
1008
1088
|
}
|
|
1009
1089
|
if (unusedDependencies > 0) {
|
|
1010
1090
|
const packageLocation = `${location}/package.json`;
|
|
1011
|
-
console.log(` ${
|
|
1091
|
+
console.log(` ${chalk16.yellow(packageLocation)}
|
|
1012
1092
|
`);
|
|
1013
1093
|
}
|
|
1014
1094
|
return unusedDependencies;
|
|
1015
1095
|
}
|
|
1016
1096
|
|
|
1017
1097
|
// src/actions/deplint/checkPackage/getUnusedDevDependencies.ts
|
|
1018
|
-
import
|
|
1098
|
+
import chalk17 from "chalk";
|
|
1019
1099
|
|
|
1020
1100
|
// src/actions/deplint/getRequiredPeerDependencies.ts
|
|
1021
1101
|
import fs6 from "fs";
|
|
@@ -1203,34 +1283,34 @@ function getUnusedDevDependencies({ name, location }, {
|
|
|
1203
1283
|
if (dependencies.includes(dep) || peerDependencies.includes(dep)) continue;
|
|
1204
1284
|
if (!isDevDepUsed(dep, allImports, implicitDeps, requiredPeers, scriptRefs)) {
|
|
1205
1285
|
unusedDevDependencies++;
|
|
1206
|
-
console.log(`[${
|
|
1286
|
+
console.log(`[${chalk17.blue(name)}] Unused devDependency in package.json: ${chalk17.red(dep)}`);
|
|
1207
1287
|
}
|
|
1208
1288
|
}
|
|
1209
1289
|
if (unusedDevDependencies > 0) {
|
|
1210
1290
|
const packageLocation = `${location}/package.json`;
|
|
1211
|
-
console.log(` ${
|
|
1291
|
+
console.log(` ${chalk17.yellow(packageLocation)}
|
|
1212
1292
|
`);
|
|
1213
1293
|
}
|
|
1214
1294
|
return unusedDevDependencies;
|
|
1215
1295
|
}
|
|
1216
1296
|
|
|
1217
1297
|
// src/actions/deplint/checkPackage/getUnusedPeerDependencies.ts
|
|
1218
|
-
import
|
|
1298
|
+
import chalk18 from "chalk";
|
|
1219
1299
|
function getUnusedPeerDependencies({ name, location }, { peerDependencies, dependencies }, { externalDistImports, externalDistTypeImports }) {
|
|
1220
1300
|
let unusedDependencies = 0;
|
|
1221
1301
|
for (const dep of peerDependencies) {
|
|
1222
1302
|
if (!externalDistImports.includes(dep) && !externalDistImports.includes(dep.replace(/^@types\//, "")) && !externalDistTypeImports.includes(dep) && !externalDistTypeImports.includes(dep.replace(/^@types\//, ""))) {
|
|
1223
1303
|
unusedDependencies++;
|
|
1224
1304
|
if (dependencies.includes(dep)) {
|
|
1225
|
-
console.log(`[${
|
|
1305
|
+
console.log(`[${chalk18.blue(name)}] Unused peerDependency [already a dependency] in package.json: ${chalk18.red(dep)}`);
|
|
1226
1306
|
} else {
|
|
1227
|
-
console.log(`[${
|
|
1307
|
+
console.log(`[${chalk18.blue(name)}] Unused peerDependency in package.json: ${chalk18.red(dep)}`);
|
|
1228
1308
|
}
|
|
1229
1309
|
}
|
|
1230
1310
|
}
|
|
1231
1311
|
if (unusedDependencies > 0) {
|
|
1232
1312
|
const packageLocation = `${location}/package.json`;
|
|
1233
|
-
console.log(` ${
|
|
1313
|
+
console.log(` ${chalk18.yellow(packageLocation)}
|
|
1234
1314
|
`);
|
|
1235
1315
|
}
|
|
1236
1316
|
return unusedDependencies;
|
|
@@ -1316,19 +1396,19 @@ var deplint = ({
|
|
|
1316
1396
|
});
|
|
1317
1397
|
}
|
|
1318
1398
|
if (totalErrors > 0) {
|
|
1319
|
-
console.warn(`Deplint: Found ${
|
|
1399
|
+
console.warn(`Deplint: Found ${chalk19.red(totalErrors)} dependency problems. ${chalk19.red("\u2716")}`);
|
|
1320
1400
|
} else {
|
|
1321
|
-
console.info(`Deplint: Found no dependency problems. ${
|
|
1401
|
+
console.info(`Deplint: Found no dependency problems. ${chalk19.green("\u2714")}`);
|
|
1322
1402
|
}
|
|
1323
1403
|
return 0;
|
|
1324
1404
|
};
|
|
1325
1405
|
|
|
1326
1406
|
// src/actions/deploy.ts
|
|
1327
|
-
import { readFileSync as
|
|
1407
|
+
import { readFileSync as readFileSync6 } from "fs";
|
|
1328
1408
|
var privatePackageExcludeList = () => {
|
|
1329
1409
|
const possibleDeployablePackages = yarnWorkspaces().map((workspace) => [
|
|
1330
1410
|
workspace,
|
|
1331
|
-
JSON.parse(
|
|
1411
|
+
JSON.parse(readFileSync6(`${workspace.location}/package.json`, { encoding: "utf8" }))
|
|
1332
1412
|
]);
|
|
1333
1413
|
const privatePackages = possibleDeployablePackages.filter(([_, pkg]) => pkg.private).map(([workspace]) => workspace);
|
|
1334
1414
|
const excludeList = privatePackages.map((workspace) => `--exclude ${workspace.name}`);
|
|
@@ -1348,11 +1428,11 @@ var deploy = () => {
|
|
|
1348
1428
|
};
|
|
1349
1429
|
|
|
1350
1430
|
// src/actions/deploy-major.ts
|
|
1351
|
-
import { readFileSync as
|
|
1431
|
+
import { readFileSync as readFileSync7 } from "fs";
|
|
1352
1432
|
var privatePackageExcludeList2 = () => {
|
|
1353
1433
|
const possibleDeployablePackages = yarnWorkspaces().map((workspace) => [
|
|
1354
1434
|
workspace,
|
|
1355
|
-
JSON.parse(
|
|
1435
|
+
JSON.parse(readFileSync7(`${workspace.location}/package.json`, { encoding: "utf8" }))
|
|
1356
1436
|
]);
|
|
1357
1437
|
const privatePackages = possibleDeployablePackages.filter(([_, pkg]) => pkg.private).map(([workspace]) => workspace);
|
|
1358
1438
|
const excludeList = privatePackages.map((workspace) => `--exclude ${workspace.name}`);
|
|
@@ -1372,11 +1452,11 @@ var deployMajor = () => {
|
|
|
1372
1452
|
};
|
|
1373
1453
|
|
|
1374
1454
|
// src/actions/deploy-minor.ts
|
|
1375
|
-
import { readFileSync as
|
|
1455
|
+
import { readFileSync as readFileSync8 } from "fs";
|
|
1376
1456
|
var privatePackageExcludeList3 = () => {
|
|
1377
1457
|
const possibleDeployablePackages = yarnWorkspaces().map((workspace) => [
|
|
1378
1458
|
workspace,
|
|
1379
|
-
JSON.parse(
|
|
1459
|
+
JSON.parse(readFileSync8(`${workspace.location}/package.json`, { encoding: "utf8" }))
|
|
1380
1460
|
]);
|
|
1381
1461
|
const privatePackages = possibleDeployablePackages.filter(([_, pkg]) => pkg.private).map(([workspace]) => workspace);
|
|
1382
1462
|
const excludeList = privatePackages.map((workspace) => `--exclude ${workspace.name}`);
|
|
@@ -1396,11 +1476,11 @@ var deployMinor = () => {
|
|
|
1396
1476
|
};
|
|
1397
1477
|
|
|
1398
1478
|
// src/actions/deploy-next.ts
|
|
1399
|
-
import { readFileSync as
|
|
1479
|
+
import { readFileSync as readFileSync9 } from "fs";
|
|
1400
1480
|
var privatePackageExcludeList4 = () => {
|
|
1401
1481
|
const possibleDeployablePackages = yarnWorkspaces().map((workspace) => [
|
|
1402
1482
|
workspace,
|
|
1403
|
-
JSON.parse(
|
|
1483
|
+
JSON.parse(readFileSync9(`${workspace.location}/package.json`, { encoding: "utf8" }))
|
|
1404
1484
|
]);
|
|
1405
1485
|
const privatePackages = possibleDeployablePackages.filter(([_, pkg]) => pkg.private).map(([workspace]) => workspace);
|
|
1406
1486
|
const excludeList = privatePackages.map((workspace) => `--exclude ${workspace.name}`);
|
|
@@ -1420,22 +1500,22 @@ var deployNext = () => {
|
|
|
1420
1500
|
};
|
|
1421
1501
|
|
|
1422
1502
|
// src/actions/dupdeps.ts
|
|
1423
|
-
import
|
|
1503
|
+
import chalk20 from "chalk";
|
|
1424
1504
|
var dupdeps = () => {
|
|
1425
|
-
console.log(
|
|
1505
|
+
console.log(chalk20.green("Checking all Dependencies for Duplicates"));
|
|
1426
1506
|
const allDependencies = parsedPackageJSON()?.dependencies;
|
|
1427
1507
|
const dependencies = Object.entries(allDependencies).map(([k]) => k);
|
|
1428
1508
|
return detectDuplicateDependencies(dependencies);
|
|
1429
1509
|
};
|
|
1430
1510
|
|
|
1431
1511
|
// src/actions/lint.ts
|
|
1432
|
-
import
|
|
1512
|
+
import chalk21 from "chalk";
|
|
1433
1513
|
var lintPackage = ({
|
|
1434
1514
|
pkg,
|
|
1435
1515
|
fix: fix2,
|
|
1436
1516
|
verbose
|
|
1437
1517
|
}) => {
|
|
1438
|
-
console.log(
|
|
1518
|
+
console.log(chalk21.gray(`${fix2 ? "Fix" : "Lint"} [${pkg}]`));
|
|
1439
1519
|
const start = Date.now();
|
|
1440
1520
|
const result = runSteps(`${fix2 ? "Fix" : "Lint"} [${pkg}]`, [
|
|
1441
1521
|
["yarn", [
|
|
@@ -1445,7 +1525,7 @@ var lintPackage = ({
|
|
|
1445
1525
|
fix2 ? "package-fix" : verbose ? "package-lint-verbose" : "package-lint"
|
|
1446
1526
|
]]
|
|
1447
1527
|
]);
|
|
1448
|
-
console.log(
|
|
1528
|
+
console.log(chalk21.gray(`${fix2 ? "Fixed in" : "Linted in"} [${chalk21.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk21.gray("seconds")}`));
|
|
1449
1529
|
return result;
|
|
1450
1530
|
};
|
|
1451
1531
|
var lint = ({
|
|
@@ -1465,13 +1545,13 @@ var lint = ({
|
|
|
1465
1545
|
});
|
|
1466
1546
|
};
|
|
1467
1547
|
var lintAllPackages = ({ fix: fix2 = false } = {}) => {
|
|
1468
|
-
console.log(
|
|
1548
|
+
console.log(chalk21.gray(`${fix2 ? "Fix" : "Lint"} [All-Packages]`));
|
|
1469
1549
|
const start = Date.now();
|
|
1470
1550
|
const fixOptions = fix2 ? ["--fix"] : [];
|
|
1471
1551
|
const result = runSteps(`${fix2 ? "Fix" : "Lint"} [All-Packages]`, [
|
|
1472
1552
|
["yarn", ["eslint", "--cache", "--cache-location", ".eslintcache", "--cache-strategy", "content", ...fixOptions]]
|
|
1473
1553
|
]);
|
|
1474
|
-
console.log(
|
|
1554
|
+
console.log(chalk21.gray(`${fix2 ? "Fixed in" : "Linted in"} [${chalk21.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk21.gray("seconds")}`));
|
|
1475
1555
|
return result;
|
|
1476
1556
|
};
|
|
1477
1557
|
|
|
@@ -1499,7 +1579,7 @@ var filename = ".gitignore";
|
|
|
1499
1579
|
var gitignoreGen = (pkg) => generateIgnoreFiles(filename, pkg);
|
|
1500
1580
|
|
|
1501
1581
|
// src/actions/gitlint.ts
|
|
1502
|
-
import
|
|
1582
|
+
import chalk22 from "chalk";
|
|
1503
1583
|
import ParseGitConfig from "parse-git-config";
|
|
1504
1584
|
var gitlint = () => {
|
|
1505
1585
|
console.log(`
|
|
@@ -1510,7 +1590,7 @@ Gitlint Start [${process.cwd()}]
|
|
|
1510
1590
|
const errors = 0;
|
|
1511
1591
|
const gitConfig = ParseGitConfig.sync();
|
|
1512
1592
|
const warn = (message) => {
|
|
1513
|
-
console.warn(
|
|
1593
|
+
console.warn(chalk22.yellow(`Warning: ${message}`));
|
|
1514
1594
|
warnings++;
|
|
1515
1595
|
};
|
|
1516
1596
|
if (gitConfig.core.ignorecase) {
|
|
@@ -1530,13 +1610,13 @@ Gitlint Start [${process.cwd()}]
|
|
|
1530
1610
|
}
|
|
1531
1611
|
const resultMessages = [];
|
|
1532
1612
|
if (valid > 0) {
|
|
1533
|
-
resultMessages.push(
|
|
1613
|
+
resultMessages.push(chalk22.green(`Passed: ${valid}`));
|
|
1534
1614
|
}
|
|
1535
1615
|
if (warnings > 0) {
|
|
1536
|
-
resultMessages.push(
|
|
1616
|
+
resultMessages.push(chalk22.yellow(`Warnings: ${warnings}`));
|
|
1537
1617
|
}
|
|
1538
1618
|
if (errors > 0) {
|
|
1539
|
-
resultMessages.push(
|
|
1619
|
+
resultMessages.push(chalk22.red(` Errors: ${errors}`));
|
|
1540
1620
|
}
|
|
1541
1621
|
console.warn(`Gitlint Finish [ ${resultMessages.join(" | ")} ]
|
|
1542
1622
|
`);
|
|
@@ -1545,7 +1625,7 @@ Gitlint Start [${process.cwd()}]
|
|
|
1545
1625
|
|
|
1546
1626
|
// src/actions/gitlint-fix.ts
|
|
1547
1627
|
import { execSync as execSync2 } from "child_process";
|
|
1548
|
-
import
|
|
1628
|
+
import chalk23 from "chalk";
|
|
1549
1629
|
import ParseGitConfig2 from "parse-git-config";
|
|
1550
1630
|
var gitlintFix = () => {
|
|
1551
1631
|
console.log(`
|
|
@@ -1554,15 +1634,15 @@ Gitlint Fix Start [${process.cwd()}]
|
|
|
1554
1634
|
const gitConfig = ParseGitConfig2.sync();
|
|
1555
1635
|
if (gitConfig.core.ignorecase) {
|
|
1556
1636
|
execSync2("git config core.ignorecase false", { stdio: "inherit" });
|
|
1557
|
-
console.warn(
|
|
1637
|
+
console.warn(chalk23.yellow("\nGitlint Fix: Updated core.ignorecase to be false\n"));
|
|
1558
1638
|
}
|
|
1559
1639
|
if (gitConfig.core.autocrlf !== false) {
|
|
1560
1640
|
execSync2("git config core.autocrlf false", { stdio: "inherit" });
|
|
1561
|
-
console.warn(
|
|
1641
|
+
console.warn(chalk23.yellow("\nGitlint Fix: Updated core.autocrlf to be false\n"));
|
|
1562
1642
|
}
|
|
1563
1643
|
if (gitConfig.core.eol !== "lf") {
|
|
1564
1644
|
execSync2("git config core.eol lf", { stdio: "inherit" });
|
|
1565
|
-
console.warn(
|
|
1645
|
+
console.warn(chalk23.yellow('\nGitlint Fix: Updated core.eol to be "lf"\n'));
|
|
1566
1646
|
}
|
|
1567
1647
|
return 1;
|
|
1568
1648
|
};
|
|
@@ -1573,7 +1653,7 @@ var knip = () => {
|
|
|
1573
1653
|
};
|
|
1574
1654
|
|
|
1575
1655
|
// src/actions/license.ts
|
|
1576
|
-
import
|
|
1656
|
+
import chalk24 from "chalk";
|
|
1577
1657
|
import { init } from "license-checker";
|
|
1578
1658
|
var license = async (pkg) => {
|
|
1579
1659
|
const workspaces = yarnWorkspaces();
|
|
@@ -1598,18 +1678,18 @@ var license = async (pkg) => {
|
|
|
1598
1678
|
"LGPL-3.0-or-later",
|
|
1599
1679
|
"Python-2.0"
|
|
1600
1680
|
]);
|
|
1601
|
-
console.log(
|
|
1681
|
+
console.log(chalk24.green("License Checker"));
|
|
1602
1682
|
return (await Promise.all(
|
|
1603
1683
|
workspaceList.map(({ location, name }) => {
|
|
1604
1684
|
return new Promise((resolve) => {
|
|
1605
1685
|
init({ production: true, start: location }, (error, packages) => {
|
|
1606
1686
|
if (error) {
|
|
1607
|
-
console.error(
|
|
1608
|
-
console.error(
|
|
1687
|
+
console.error(chalk24.red(`License Checker [${name}] Error`));
|
|
1688
|
+
console.error(chalk24.gray(error));
|
|
1609
1689
|
console.log("\n");
|
|
1610
1690
|
resolve(1);
|
|
1611
1691
|
} else {
|
|
1612
|
-
console.log(
|
|
1692
|
+
console.log(chalk24.green(`License Checker [${name}]`));
|
|
1613
1693
|
let count = 0;
|
|
1614
1694
|
for (const [name2, info] of Object.entries(packages)) {
|
|
1615
1695
|
const licenses = Array.isArray(info.licenses) ? info.licenses : [info.licenses];
|
|
@@ -1625,7 +1705,7 @@ var license = async (pkg) => {
|
|
|
1625
1705
|
}
|
|
1626
1706
|
if (!orLicenseFound) {
|
|
1627
1707
|
count++;
|
|
1628
|
-
console.warn(
|
|
1708
|
+
console.warn(chalk24.yellow(`${name2}: Package License not allowed [${license2}]`));
|
|
1629
1709
|
}
|
|
1630
1710
|
}
|
|
1631
1711
|
}
|
|
@@ -1645,12 +1725,12 @@ var npmignoreGen = (pkg) => generateIgnoreFiles(filename2, pkg);
|
|
|
1645
1725
|
|
|
1646
1726
|
// src/actions/package/clean-outputs.ts
|
|
1647
1727
|
import path7 from "path";
|
|
1648
|
-
import
|
|
1728
|
+
import chalk25 from "chalk";
|
|
1649
1729
|
var packageCleanOutputs = () => {
|
|
1650
1730
|
const pkg = process.env.INIT_CWD ?? ".";
|
|
1651
1731
|
const pkgName = process.env.npm_package_name;
|
|
1652
1732
|
const folders = [path7.join(pkg, "dist"), path7.join(pkg, "build"), path7.join(pkg, "docs")];
|
|
1653
|
-
console.log(
|
|
1733
|
+
console.log(chalk25.green(`Cleaning Outputs [${pkgName}]`));
|
|
1654
1734
|
for (let folder of folders) {
|
|
1655
1735
|
deleteGlob(folder);
|
|
1656
1736
|
}
|
|
@@ -1659,11 +1739,11 @@ var packageCleanOutputs = () => {
|
|
|
1659
1739
|
|
|
1660
1740
|
// src/actions/package/clean-typescript.ts
|
|
1661
1741
|
import path8 from "path";
|
|
1662
|
-
import
|
|
1742
|
+
import chalk26 from "chalk";
|
|
1663
1743
|
var packageCleanTypescript = () => {
|
|
1664
1744
|
const pkg = process.env.INIT_CWD ?? ".";
|
|
1665
1745
|
const pkgName = process.env.npm_package_name;
|
|
1666
|
-
console.log(
|
|
1746
|
+
console.log(chalk26.green(`Cleaning Typescript [${pkgName}]`));
|
|
1667
1747
|
const files = [path8.join(pkg, "*.tsbuildinfo"), path8.join(pkg, ".tsconfig.*"), path8.join(pkg, ".eslintcache")];
|
|
1668
1748
|
for (let file of files) {
|
|
1669
1749
|
deleteGlob(file);
|
|
@@ -1677,26 +1757,26 @@ var packageClean = async () => {
|
|
|
1677
1757
|
};
|
|
1678
1758
|
|
|
1679
1759
|
// src/actions/package/compile/compile.ts
|
|
1680
|
-
import
|
|
1760
|
+
import chalk31 from "chalk";
|
|
1681
1761
|
|
|
1682
1762
|
// src/actions/package/compile/packageCompileTsup.ts
|
|
1683
|
-
import
|
|
1763
|
+
import chalk30 from "chalk";
|
|
1684
1764
|
import { build as build2, defineConfig } from "tsup";
|
|
1685
1765
|
|
|
1686
1766
|
// src/actions/package/compile/inputs.ts
|
|
1687
|
-
import
|
|
1767
|
+
import chalk27 from "chalk";
|
|
1688
1768
|
import { glob as glob2 } from "glob";
|
|
1689
1769
|
var getAllInputs = (srcDir, verbose = false) => {
|
|
1690
1770
|
return [...glob2.sync(`${srcDir}/**/*.ts`, { posix: true }).map((file) => {
|
|
1691
1771
|
const result = file.slice(Math.max(0, srcDir.length + 1));
|
|
1692
1772
|
if (verbose) {
|
|
1693
|
-
console.log(
|
|
1773
|
+
console.log(chalk27.gray(`getAllInputs: ${JSON.stringify(result, null, 2)}`));
|
|
1694
1774
|
}
|
|
1695
1775
|
return result;
|
|
1696
1776
|
}), ...glob2.sync(`${srcDir}/**/*.tsx`, { posix: true }).map((file) => {
|
|
1697
1777
|
const result = file.slice(Math.max(0, srcDir.length + 1));
|
|
1698
1778
|
if (verbose) {
|
|
1699
|
-
console.log(
|
|
1779
|
+
console.log(chalk27.gray(`getAllInputs: ${JSON.stringify(result, null, 2)}`));
|
|
1700
1780
|
}
|
|
1701
1781
|
return result;
|
|
1702
1782
|
})];
|
|
@@ -1755,7 +1835,7 @@ function deepMergeObjects(objects) {
|
|
|
1755
1835
|
|
|
1756
1836
|
// src/actions/package/compile/packageCompileTsc.ts
|
|
1757
1837
|
import { cwd as cwd2 } from "process";
|
|
1758
|
-
import
|
|
1838
|
+
import chalk28 from "chalk";
|
|
1759
1839
|
import { createProgramFromConfig } from "tsc-prog";
|
|
1760
1840
|
import ts2, {
|
|
1761
1841
|
DiagnosticCategory,
|
|
@@ -1777,7 +1857,7 @@ var getCompilerOptions = (options = {}, fileName = "tsconfig.json") => {
|
|
|
1777
1857
|
var packageCompileTsc = (platform, entries, srcDir = "src", outDir = "dist", compilerOptionsParam, verbose = false) => {
|
|
1778
1858
|
const pkg = process.env.INIT_CWD ?? cwd2();
|
|
1779
1859
|
if (verbose) {
|
|
1780
|
-
console.log(
|
|
1860
|
+
console.log(chalk28.cyan(`Validating code START: ${entries.length} files to ${outDir} from ${srcDir}`));
|
|
1781
1861
|
}
|
|
1782
1862
|
const configFilePath = ts2.findConfigFile(
|
|
1783
1863
|
"./",
|
|
@@ -1800,10 +1880,10 @@ var packageCompileTsc = (platform, entries, srcDir = "src", outDir = "dist", com
|
|
|
1800
1880
|
emitDeclarationOnly: true,
|
|
1801
1881
|
noEmit: false
|
|
1802
1882
|
};
|
|
1803
|
-
console.log(
|
|
1883
|
+
console.log(chalk28.cyan(`Validating Files: ${entries.length}`));
|
|
1804
1884
|
if (verbose) {
|
|
1805
1885
|
for (const entry of entries) {
|
|
1806
|
-
console.log(
|
|
1886
|
+
console.log(chalk28.grey(`Validating: ${entry}`));
|
|
1807
1887
|
}
|
|
1808
1888
|
}
|
|
1809
1889
|
try {
|
|
@@ -1839,7 +1919,7 @@ var packageCompileTsc = (platform, entries, srcDir = "src", outDir = "dist", com
|
|
|
1839
1919
|
return 0;
|
|
1840
1920
|
} finally {
|
|
1841
1921
|
if (verbose) {
|
|
1842
|
-
console.log(
|
|
1922
|
+
console.log(chalk28.cyan(`Validating code FINISH: ${entries.length} files to ${outDir} from ${srcDir}`));
|
|
1843
1923
|
}
|
|
1844
1924
|
}
|
|
1845
1925
|
};
|
|
@@ -1847,7 +1927,7 @@ var packageCompileTsc = (platform, entries, srcDir = "src", outDir = "dist", com
|
|
|
1847
1927
|
// src/actions/package/compile/packageCompileTscTypes.ts
|
|
1848
1928
|
import path9 from "path";
|
|
1849
1929
|
import { cwd as cwd3 } from "process";
|
|
1850
|
-
import
|
|
1930
|
+
import chalk29 from "chalk";
|
|
1851
1931
|
import { rollup } from "rollup";
|
|
1852
1932
|
import dts from "rollup-plugin-dts";
|
|
1853
1933
|
import nodeExternals from "rollup-plugin-node-externals";
|
|
@@ -1872,8 +1952,8 @@ async function bundleDts(inputPath, outputPath, platform, options, verbose = fal
|
|
|
1872
1952
|
if (ignoredWarningCodes.has(warning.code ?? "")) {
|
|
1873
1953
|
return;
|
|
1874
1954
|
}
|
|
1875
|
-
console.warn(
|
|
1876
|
-
console.warn(
|
|
1955
|
+
console.warn(chalk29.yellow(`[${warning.code}] ${warning.message}`));
|
|
1956
|
+
console.warn(chalk29.gray(inputPath));
|
|
1877
1957
|
warn(warning);
|
|
1878
1958
|
}
|
|
1879
1959
|
});
|
|
@@ -1883,8 +1963,8 @@ async function bundleDts(inputPath, outputPath, platform, options, verbose = fal
|
|
|
1883
1963
|
});
|
|
1884
1964
|
} catch (ex) {
|
|
1885
1965
|
const error = ex;
|
|
1886
|
-
console.warn(
|
|
1887
|
-
console.warn(
|
|
1966
|
+
console.warn(chalk29.red(error));
|
|
1967
|
+
console.warn(chalk29.gray(inputPath));
|
|
1888
1968
|
}
|
|
1889
1969
|
if (verbose) {
|
|
1890
1970
|
console.log(`Bundled declarations written to ${outputPath}`);
|
|
@@ -1892,7 +1972,7 @@ async function bundleDts(inputPath, outputPath, platform, options, verbose = fal
|
|
|
1892
1972
|
}
|
|
1893
1973
|
var packageCompileTscTypes = async (entries, outDir, platform, srcDir = "build", verbose = false) => {
|
|
1894
1974
|
if (verbose) {
|
|
1895
|
-
console.log(
|
|
1975
|
+
console.log(chalk29.cyan(`Compiling Types START [${platform}]: ${entries.length} files to ${outDir} from ${srcDir}`));
|
|
1896
1976
|
console.log(`Entries: ${entries.join(", ")}`);
|
|
1897
1977
|
}
|
|
1898
1978
|
const pkg = process.env.INIT_CWD ?? cwd3();
|
|
@@ -1916,7 +1996,7 @@ var packageCompileTscTypes = async (entries, outDir, platform, srcDir = "build",
|
|
|
1916
1996
|
await bundleDts(`${srcRoot}/${entryTypeName}`, `${outDir}/${entryTypeName}`, platform, { compilerOptions }, verbose);
|
|
1917
1997
|
}));
|
|
1918
1998
|
if (verbose) {
|
|
1919
|
-
console.log(
|
|
1999
|
+
console.log(chalk29.cyan(`Compiling Types FINISH: ${entries.length} files to ${outDir} from ${srcDir}`));
|
|
1920
2000
|
}
|
|
1921
2001
|
return 0;
|
|
1922
2002
|
};
|
|
@@ -1928,15 +2008,15 @@ var compileFolder = async (srcDir, entries, buildDir, options, bundleTypes = fal
|
|
|
1928
2008
|
console.log(`compileFolder [${srcDir}, ${options?.outDir}]`);
|
|
1929
2009
|
}
|
|
1930
2010
|
if (entries.length === 0) {
|
|
1931
|
-
console.warn(
|
|
2011
|
+
console.warn(chalk30.yellow(`No entries found in ${srcDir} to compile`));
|
|
1932
2012
|
return 0;
|
|
1933
2013
|
}
|
|
1934
2014
|
if (verbose) {
|
|
1935
|
-
console.log(
|
|
2015
|
+
console.log(chalk30.gray(`buildDir [${buildDir}]`));
|
|
1936
2016
|
}
|
|
1937
2017
|
const validationResult = packageCompileTsc(options?.platform ?? "neutral", entries, srcDir, buildDir, void 0, verbose);
|
|
1938
2018
|
if (validationResult !== 0) {
|
|
1939
|
-
console.error(
|
|
2019
|
+
console.error(chalk30.red(`Compile:Validation had ${validationResult} errors`));
|
|
1940
2020
|
return validationResult;
|
|
1941
2021
|
}
|
|
1942
2022
|
const optionsParams = tsupOptions([{
|
|
@@ -1961,12 +2041,12 @@ var compileFolder = async (srcDir, entries, buildDir, options, bundleTypes = fal
|
|
|
1961
2041
|
})
|
|
1962
2042
|
)).flat();
|
|
1963
2043
|
if (verbose) {
|
|
1964
|
-
console.log(
|
|
1965
|
-
console.log(
|
|
2044
|
+
console.log(chalk30.cyan(`TSUP:build:start [${srcDir}]`));
|
|
2045
|
+
console.log(chalk30.gray(`TSUP:build:options [${JSON.stringify(optionsList, null, 2)}]`));
|
|
1966
2046
|
}
|
|
1967
2047
|
await Promise.all(optionsList.map((options2) => build2(options2)));
|
|
1968
2048
|
if (verbose) {
|
|
1969
|
-
console.log(
|
|
2049
|
+
console.log(chalk30.cyan(`TSUP:build:stop [${srcDir}]`));
|
|
1970
2050
|
}
|
|
1971
2051
|
if (bundleTypes) {
|
|
1972
2052
|
await packageCompileTscTypes(entries, outDir, options?.platform ?? "neutral", buildDir, verbose);
|
|
@@ -2077,14 +2157,14 @@ var packageCompileTsup = async (config2) => {
|
|
|
2077
2157
|
// src/actions/package/compile/compile.ts
|
|
2078
2158
|
var packageCompile = async (inConfig = {}) => {
|
|
2079
2159
|
const pkg = process.env.INIT_CWD;
|
|
2080
|
-
console.log(
|
|
2160
|
+
console.log(chalk31.green(`Compiling ${pkg}`));
|
|
2081
2161
|
const config2 = await loadConfig(inConfig);
|
|
2082
2162
|
return await packageCompileTsup(config2);
|
|
2083
2163
|
};
|
|
2084
2164
|
|
|
2085
2165
|
// src/actions/package/copy-assets.ts
|
|
2086
2166
|
import path10 from "path/posix";
|
|
2087
|
-
import
|
|
2167
|
+
import chalk32 from "chalk";
|
|
2088
2168
|
import cpy2 from "cpy";
|
|
2089
2169
|
var copyTargetAssets2 = async (target, name, location) => {
|
|
2090
2170
|
try {
|
|
@@ -2097,7 +2177,7 @@ var copyTargetAssets2 = async (target, name, location) => {
|
|
|
2097
2177
|
}
|
|
2098
2178
|
);
|
|
2099
2179
|
if (values.length > 0) {
|
|
2100
|
-
console.log(
|
|
2180
|
+
console.log(chalk32.green(`Copying Assets [${target.toUpperCase()}] - ${name} - ${location}`));
|
|
2101
2181
|
}
|
|
2102
2182
|
for (const value of values) {
|
|
2103
2183
|
console.log(`${value.split("/").pop()} => ./dist/${target}`);
|
|
@@ -2162,9 +2242,9 @@ var packageCycle = async () => {
|
|
|
2162
2242
|
};
|
|
2163
2243
|
|
|
2164
2244
|
// src/actions/package/gen-docs.ts
|
|
2165
|
-
import { existsSync as
|
|
2245
|
+
import { existsSync as existsSync6 } from "fs";
|
|
2166
2246
|
import path11 from "path";
|
|
2167
|
-
import
|
|
2247
|
+
import chalk33 from "chalk";
|
|
2168
2248
|
import {
|
|
2169
2249
|
Application,
|
|
2170
2250
|
ArgumentsReader,
|
|
@@ -2182,7 +2262,7 @@ var ExitCodes = {
|
|
|
2182
2262
|
};
|
|
2183
2263
|
var packageGenDocs = async () => {
|
|
2184
2264
|
const pkg = process.env.INIT_CWD;
|
|
2185
|
-
if (pkg !== void 0 && !
|
|
2265
|
+
if (pkg !== void 0 && !existsSync6(path11.join(pkg, "typedoc.json"))) {
|
|
2186
2266
|
return;
|
|
2187
2267
|
}
|
|
2188
2268
|
const app = await Application.bootstrap({
|
|
@@ -2268,16 +2348,16 @@ var runTypeDoc = async (app) => {
|
|
|
2268
2348
|
return ExitCodes.OutputError;
|
|
2269
2349
|
}
|
|
2270
2350
|
}
|
|
2271
|
-
console.log(
|
|
2351
|
+
console.log(chalk33.green(`${pkgName} - Ok`));
|
|
2272
2352
|
return ExitCodes.Ok;
|
|
2273
2353
|
};
|
|
2274
2354
|
|
|
2275
2355
|
// src/actions/package/lint.ts
|
|
2276
|
-
import { readdirSync as
|
|
2356
|
+
import { readdirSync as readdirSync4 } from "fs";
|
|
2277
2357
|
import path12 from "path";
|
|
2278
2358
|
import { cwd as cwd4 } from "process";
|
|
2279
2359
|
import { pathToFileURL } from "url";
|
|
2280
|
-
import
|
|
2360
|
+
import chalk34 from "chalk";
|
|
2281
2361
|
import { ESLint } from "eslint";
|
|
2282
2362
|
import { findUp } from "find-up";
|
|
2283
2363
|
import picomatch from "picomatch";
|
|
@@ -2286,14 +2366,14 @@ var dumpMessages = (lintResults) => {
|
|
|
2286
2366
|
const severity = ["none", "warning", "error"];
|
|
2287
2367
|
for (const lintResult of lintResults) {
|
|
2288
2368
|
if (lintResult.messages.length > 0) {
|
|
2289
|
-
console.log(
|
|
2369
|
+
console.log(chalk34.gray(`
|
|
2290
2370
|
${lintResult.filePath}`));
|
|
2291
2371
|
for (const message of lintResult.messages) {
|
|
2292
2372
|
console.log(
|
|
2293
|
-
|
|
2294
|
-
|
|
2295
|
-
|
|
2296
|
-
|
|
2373
|
+
chalk34.gray(` ${message.line}:${message.column}`),
|
|
2374
|
+
chalk34[colors[message.severity]](` ${severity[message.severity]}`),
|
|
2375
|
+
chalk34.white(` ${message.message}`),
|
|
2376
|
+
chalk34.gray(` ${message.ruleId}`)
|
|
2297
2377
|
);
|
|
2298
2378
|
}
|
|
2299
2379
|
}
|
|
@@ -2310,7 +2390,7 @@ function getFiles(dir, ignoreFolders) {
|
|
|
2310
2390
|
const currentDirectory = cwd4();
|
|
2311
2391
|
const subDirectory = dir.split(currentDirectory)[1]?.split("/")[1];
|
|
2312
2392
|
if (ignoreFolders.includes(subDirectory)) return [];
|
|
2313
|
-
return
|
|
2393
|
+
return readdirSync4(dir, { withFileTypes: true }).flatMap((dirent) => {
|
|
2314
2394
|
const res = path12.resolve(dir, dirent.name);
|
|
2315
2395
|
const relativePath = subDirectory === void 0 ? dirent.name : `${subDirectory}/${dirent.name}`;
|
|
2316
2396
|
const ignoreMatchers = ignoreFolders.map((pattern) => picomatch(pattern));
|
|
@@ -2331,10 +2411,10 @@ var packageLint = async (fix2 = false, verbose = false, cache = true) => {
|
|
|
2331
2411
|
cache
|
|
2332
2412
|
});
|
|
2333
2413
|
const files = getFiles(cwd4(), ignoreFolders);
|
|
2334
|
-
console.log(
|
|
2414
|
+
console.log(chalk34.green(`Linting ${pkg} [files = ${files.length}]`));
|
|
2335
2415
|
if (verbose) {
|
|
2336
2416
|
for (const file of files) {
|
|
2337
|
-
console.log(
|
|
2417
|
+
console.log(chalk34.gray(` ${file}`));
|
|
2338
2418
|
}
|
|
2339
2419
|
}
|
|
2340
2420
|
const lintResults = await engine.lintFiles(files);
|
|
@@ -2345,32 +2425,32 @@ var packageLint = async (fix2 = false, verbose = false, cache = true) => {
|
|
|
2345
2425
|
const filesCountColor = files.length < 100 ? "green" : files.length < 1e3 ? "yellow" : "red";
|
|
2346
2426
|
const lintTime = Date.now() - start;
|
|
2347
2427
|
const lintTimeColor = lintTime < 1e3 ? "green" : lintTime < 3e3 ? "yellow" : "red";
|
|
2348
|
-
console.log(
|
|
2428
|
+
console.log(chalk34.white(`Linted ${chalk34[filesCountColor](files.length)} files in ${chalk34[lintTimeColor](lintTime)}ms`));
|
|
2349
2429
|
return lintResults.reduce((prev, lintResult) => prev + lintResult.errorCount, 0);
|
|
2350
2430
|
};
|
|
2351
2431
|
|
|
2352
2432
|
// src/actions/package/publint.ts
|
|
2353
2433
|
import { promises as fs9 } from "fs";
|
|
2354
|
-
import
|
|
2434
|
+
import chalk35 from "chalk";
|
|
2355
2435
|
import sortPackageJson from "sort-package-json";
|
|
2356
2436
|
var customPubLint = (pkg) => {
|
|
2357
2437
|
let errorCount = 0;
|
|
2358
2438
|
let warningCount = 0;
|
|
2359
2439
|
if (pkg.files === void 0) {
|
|
2360
|
-
console.warn(
|
|
2440
|
+
console.warn(chalk35.yellow('Publint [custom]: "files" field is missing'));
|
|
2361
2441
|
warningCount++;
|
|
2362
2442
|
}
|
|
2363
2443
|
if (pkg.main !== void 0) {
|
|
2364
|
-
console.warn(
|
|
2444
|
+
console.warn(chalk35.yellow('Publint [custom]: "main" field is deprecated, use "exports" instead'));
|
|
2365
2445
|
warningCount++;
|
|
2366
2446
|
}
|
|
2367
2447
|
if (pkg.sideEffects !== false) {
|
|
2368
|
-
console.warn(
|
|
2448
|
+
console.warn(chalk35.yellow('Publint [custom]: "sideEffects" field should be set to false'));
|
|
2369
2449
|
warningCount++;
|
|
2370
2450
|
}
|
|
2371
2451
|
if (pkg.resolutions !== void 0) {
|
|
2372
|
-
console.warn(
|
|
2373
|
-
console.warn(
|
|
2452
|
+
console.warn(chalk35.yellow('Publint [custom]: "resolutions" in use'));
|
|
2453
|
+
console.warn(chalk35.gray(JSON.stringify(pkg.resolutions, null, 2)));
|
|
2374
2454
|
warningCount++;
|
|
2375
2455
|
}
|
|
2376
2456
|
return [errorCount, warningCount];
|
|
@@ -2380,8 +2460,8 @@ var packagePublint = async ({ strict = true, verbose = false } = {}) => {
|
|
|
2380
2460
|
const sortedPkg = sortPackageJson(await fs9.readFile(`${pkgDir}/package.json`, "utf8"));
|
|
2381
2461
|
await fs9.writeFile(`${pkgDir}/package.json`, sortedPkg);
|
|
2382
2462
|
const pkg = JSON.parse(await fs9.readFile(`${pkgDir}/package.json`, "utf8"));
|
|
2383
|
-
console.log(
|
|
2384
|
-
console.log(
|
|
2463
|
+
console.log(chalk35.green(`Publint: ${pkg.name}`));
|
|
2464
|
+
console.log(chalk35.gray(pkgDir));
|
|
2385
2465
|
const { publint: publint2 } = await import("publint");
|
|
2386
2466
|
const { messages } = await publint2({
|
|
2387
2467
|
level: "suggestion",
|
|
@@ -2392,22 +2472,22 @@ var packagePublint = async ({ strict = true, verbose = false } = {}) => {
|
|
|
2392
2472
|
for (const message of messages) {
|
|
2393
2473
|
switch (message.type) {
|
|
2394
2474
|
case "error": {
|
|
2395
|
-
console.error(
|
|
2475
|
+
console.error(chalk35.red(`[${message.code}] ${formatMessage(message, pkg)}`));
|
|
2396
2476
|
break;
|
|
2397
2477
|
}
|
|
2398
2478
|
case "warning": {
|
|
2399
|
-
console.warn(
|
|
2479
|
+
console.warn(chalk35.yellow(`[${message.code}] ${formatMessage(message, pkg)}`));
|
|
2400
2480
|
break;
|
|
2401
2481
|
}
|
|
2402
2482
|
default: {
|
|
2403
|
-
console.log(
|
|
2483
|
+
console.log(chalk35.white(`[${message.code}] ${formatMessage(message, pkg)}`));
|
|
2404
2484
|
break;
|
|
2405
2485
|
}
|
|
2406
2486
|
}
|
|
2407
2487
|
}
|
|
2408
2488
|
const [errorCount, warningCount] = customPubLint(pkg);
|
|
2409
2489
|
if (verbose) {
|
|
2410
|
-
console.log(
|
|
2490
|
+
console.log(chalk35.gray(`Publint [Finish]: ${pkgDir} [${messages.length + errorCount + warningCount} messages]`));
|
|
2411
2491
|
}
|
|
2412
2492
|
return messages.filter((message) => message.type === "error").length + errorCount;
|
|
2413
2493
|
};
|
|
@@ -2443,7 +2523,7 @@ var rebuild = ({ target }) => {
|
|
|
2443
2523
|
};
|
|
2444
2524
|
|
|
2445
2525
|
// src/actions/recompile.ts
|
|
2446
|
-
import
|
|
2526
|
+
import chalk36 from "chalk";
|
|
2447
2527
|
var recompile = async ({
|
|
2448
2528
|
verbose,
|
|
2449
2529
|
target,
|
|
@@ -2479,7 +2559,7 @@ var recompileAll = async ({
|
|
|
2479
2559
|
const incrementalOptions = incremental ? ["--since", "-Apt", "--topological-dev"] : ["--parallel", "-Apt", "--topological-dev"];
|
|
2480
2560
|
const jobsOptions = jobs ? ["-j", `${jobs}`] : [];
|
|
2481
2561
|
if (jobs) {
|
|
2482
|
-
console.log(
|
|
2562
|
+
console.log(chalk36.blue(`Jobs set to [${jobs}]`));
|
|
2483
2563
|
}
|
|
2484
2564
|
const result = await runStepsAsync(`Recompile${incremental ? "-Incremental" : ""} [All]`, [
|
|
2485
2565
|
[
|
|
@@ -2510,7 +2590,7 @@ var recompileAll = async ({
|
|
|
2510
2590
|
]
|
|
2511
2591
|
]);
|
|
2512
2592
|
console.log(
|
|
2513
|
-
`${
|
|
2593
|
+
`${chalk36.gray("Recompiled in")} [${chalk36.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk36.gray("seconds")}`
|
|
2514
2594
|
);
|
|
2515
2595
|
return result;
|
|
2516
2596
|
};
|
|
@@ -2541,13 +2621,13 @@ var reinstall = () => {
|
|
|
2541
2621
|
};
|
|
2542
2622
|
|
|
2543
2623
|
// src/actions/relint.ts
|
|
2544
|
-
import
|
|
2624
|
+
import chalk37 from "chalk";
|
|
2545
2625
|
var relintPackage = ({
|
|
2546
2626
|
pkg,
|
|
2547
2627
|
fix: fix2,
|
|
2548
2628
|
verbose
|
|
2549
2629
|
}) => {
|
|
2550
|
-
console.log(
|
|
2630
|
+
console.log(chalk37.gray(`${fix2 ? "Fix" : "Lint"} [${pkg}]`));
|
|
2551
2631
|
const start = Date.now();
|
|
2552
2632
|
const result = runSteps(`${fix2 ? "Fix" : "Lint"} [${pkg}]`, [
|
|
2553
2633
|
["yarn", [
|
|
@@ -2557,7 +2637,7 @@ var relintPackage = ({
|
|
|
2557
2637
|
fix2 ? "package-fix" : verbose ? "package-lint-verbose" : "package-lint"
|
|
2558
2638
|
]]
|
|
2559
2639
|
]);
|
|
2560
|
-
console.log(
|
|
2640
|
+
console.log(chalk37.gray(`${fix2 ? "Fixed in" : "Linted in"} [${chalk37.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk37.gray("seconds")}`));
|
|
2561
2641
|
return result;
|
|
2562
2642
|
};
|
|
2563
2643
|
var relint = ({
|
|
@@ -2577,13 +2657,13 @@ var relint = ({
|
|
|
2577
2657
|
});
|
|
2578
2658
|
};
|
|
2579
2659
|
var relintAllPackages = ({ fix: fix2 = false } = {}) => {
|
|
2580
|
-
console.log(
|
|
2660
|
+
console.log(chalk37.gray(`${fix2 ? "Fix" : "Lint"} [All-Packages]`));
|
|
2581
2661
|
const start = Date.now();
|
|
2582
2662
|
const fixOptions = fix2 ? ["--fix"] : [];
|
|
2583
2663
|
const result = runSteps(`${fix2 ? "Fix" : "Lint"} [All-Packages]`, [
|
|
2584
2664
|
["yarn", ["eslint", ...fixOptions]]
|
|
2585
2665
|
]);
|
|
2586
|
-
console.log(
|
|
2666
|
+
console.log(chalk37.gray(`${fix2 ? "Fixed in" : "Linted in"} [${chalk37.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk37.gray("seconds")}`));
|
|
2587
2667
|
return result;
|
|
2588
2668
|
};
|
|
2589
2669
|
|
|
@@ -2601,10 +2681,10 @@ var sonar = () => {
|
|
|
2601
2681
|
};
|
|
2602
2682
|
|
|
2603
2683
|
// src/actions/statics.ts
|
|
2604
|
-
import
|
|
2684
|
+
import chalk38 from "chalk";
|
|
2605
2685
|
var DefaultDependencies = ["axios", "@xylabs/pixel", "react", "graphql", "react-router", "@mui/material", "@mui/system"];
|
|
2606
2686
|
var statics = () => {
|
|
2607
|
-
console.log(
|
|
2687
|
+
console.log(chalk38.green("Check Required Static Dependencies"));
|
|
2608
2688
|
const statics2 = parsedPackageJSON()?.xy?.deps?.statics;
|
|
2609
2689
|
return detectDuplicateDependencies(statics2, DefaultDependencies);
|
|
2610
2690
|
};
|
|
@@ -2654,6 +2734,7 @@ var yarn3Only = () => {
|
|
|
2654
2734
|
export {
|
|
2655
2735
|
build,
|
|
2656
2736
|
bundleDts,
|
|
2737
|
+
claudeCommands,
|
|
2657
2738
|
claudeRules,
|
|
2658
2739
|
clean,
|
|
2659
2740
|
cleanAll,
|