@xylabs/ts-scripts-yarn3 7.4.8 → 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 +229 -142
- package/dist/actions/index.mjs.map +1 -1
- package/dist/actions/package/compile/compile.mjs +7 -1
- package/dist/actions/package/compile/compile.mjs.map +1 -1
- package/dist/actions/package/compile/index.mjs +7 -1
- package/dist/actions/package/compile/index.mjs.map +1 -1
- package/dist/actions/package/compile/packageCompileTsc.mjs +7 -1
- package/dist/actions/package/compile/packageCompileTsc.mjs.map +1 -1
- package/dist/actions/package/compile/packageCompileTsup.mjs +7 -1
- package/dist/actions/package/compile/packageCompileTsup.mjs.map +1 -1
- package/dist/actions/package/index.mjs +7 -1
- package/dist/actions/package/index.mjs.map +1 -1
- package/dist/actions/package/recompile.mjs +7 -1
- package/dist/actions/package/recompile.mjs.map +1 -1
- package/dist/bin/package/build-only.mjs +7 -1
- package/dist/bin/package/build-only.mjs.map +1 -1
- package/dist/bin/package/build.mjs +7 -1
- package/dist/bin/package/build.mjs.map +1 -1
- package/dist/bin/package/compile-only.mjs +7 -1
- package/dist/bin/package/compile-only.mjs.map +1 -1
- package/dist/bin/package/compile-tsup.mjs +7 -1
- package/dist/bin/package/compile-tsup.mjs.map +1 -1
- package/dist/bin/package/compile.mjs +7 -1
- package/dist/bin/package/compile.mjs.map +1 -1
- package/dist/bin/package/recompile.mjs +7 -1
- package/dist/bin/package/recompile.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 +251 -154
- 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/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/createBuildConfig.ts
|
|
@@ -522,7 +532,7 @@ var build = async ({
|
|
|
522
532
|
return result;
|
|
523
533
|
};
|
|
524
534
|
|
|
525
|
-
// src/actions/claude-
|
|
535
|
+
// src/actions/claude-commands.ts
|
|
526
536
|
import {
|
|
527
537
|
existsSync as existsSync5,
|
|
528
538
|
mkdirSync,
|
|
@@ -533,13 +543,13 @@ import {
|
|
|
533
543
|
} from "fs";
|
|
534
544
|
import PATH2 from "path";
|
|
535
545
|
import chalk10 from "chalk";
|
|
536
|
-
var
|
|
537
|
-
const templates =
|
|
546
|
+
var syncCommandFiles = (commandsDir) => {
|
|
547
|
+
const templates = claudeCommandTemplates();
|
|
538
548
|
const templateNames = new Set(Object.keys(templates));
|
|
539
549
|
let updated = 0;
|
|
540
550
|
let created = 0;
|
|
541
551
|
for (const [filename3, content] of Object.entries(templates)) {
|
|
542
|
-
const targetPath = PATH2.resolve(
|
|
552
|
+
const targetPath = PATH2.resolve(commandsDir, filename3);
|
|
543
553
|
const existing = existsSync5(targetPath) ? readFileSync6(targetPath, "utf8") : void 0;
|
|
544
554
|
if (existing === content) continue;
|
|
545
555
|
writeFileSync2(targetPath, content, "utf8");
|
|
@@ -555,12 +565,82 @@ var syncRuleFiles = (rulesDir) => {
|
|
|
555
565
|
updated
|
|
556
566
|
};
|
|
557
567
|
};
|
|
568
|
+
var removeStaleCommands = (commandsDir, templateNames) => {
|
|
569
|
+
const existingCommands = readdirSync2(commandsDir).filter((f) => f.startsWith(XYLABS_COMMANDS_PREFIX) && f.endsWith(".md"));
|
|
570
|
+
let removed = 0;
|
|
571
|
+
for (const file of existingCommands) {
|
|
572
|
+
if (!templateNames.has(file)) {
|
|
573
|
+
unlinkSync(PATH2.resolve(commandsDir, file));
|
|
574
|
+
removed++;
|
|
575
|
+
}
|
|
576
|
+
}
|
|
577
|
+
return removed;
|
|
578
|
+
};
|
|
579
|
+
var logCommandsResult = (created, updated, removed) => {
|
|
580
|
+
if (created || updated || removed) {
|
|
581
|
+
const parts = [
|
|
582
|
+
created ? `${created} created` : "",
|
|
583
|
+
updated ? `${updated} updated` : "",
|
|
584
|
+
removed ? `${removed} removed` : ""
|
|
585
|
+
].filter(Boolean);
|
|
586
|
+
console.log(chalk10.green(`.claude/commands/${XYLABS_COMMANDS_PREFIX}*.md: ${parts.join(", ")}`));
|
|
587
|
+
} else {
|
|
588
|
+
console.log(chalk10.gray(`.claude/commands/${XYLABS_COMMANDS_PREFIX}*.md: already up to date`));
|
|
589
|
+
}
|
|
590
|
+
};
|
|
591
|
+
var claudeCommands = () => {
|
|
592
|
+
const cwd5 = INIT_CWD() ?? process.cwd();
|
|
593
|
+
const commandsDir = PATH2.resolve(cwd5, ".claude", "commands");
|
|
594
|
+
mkdirSync(commandsDir, { recursive: true });
|
|
595
|
+
const {
|
|
596
|
+
created,
|
|
597
|
+
templateNames,
|
|
598
|
+
updated
|
|
599
|
+
} = syncCommandFiles(commandsDir);
|
|
600
|
+
const removed = removeStaleCommands(commandsDir, templateNames);
|
|
601
|
+
logCommandsResult(created, updated, removed);
|
|
602
|
+
return 0;
|
|
603
|
+
};
|
|
604
|
+
|
|
605
|
+
// src/actions/claude-rules.ts
|
|
606
|
+
import {
|
|
607
|
+
existsSync as existsSync6,
|
|
608
|
+
mkdirSync as mkdirSync2,
|
|
609
|
+
readdirSync as readdirSync3,
|
|
610
|
+
readFileSync as readFileSync7,
|
|
611
|
+
unlinkSync as unlinkSync2,
|
|
612
|
+
writeFileSync as writeFileSync3
|
|
613
|
+
} from "fs";
|
|
614
|
+
import PATH3 from "path";
|
|
615
|
+
import chalk11 from "chalk";
|
|
616
|
+
var syncRuleFiles = (rulesDir) => {
|
|
617
|
+
const templates = claudeMdRuleTemplates();
|
|
618
|
+
const templateNames = new Set(Object.keys(templates));
|
|
619
|
+
let updated = 0;
|
|
620
|
+
let created = 0;
|
|
621
|
+
for (const [filename3, content] of Object.entries(templates)) {
|
|
622
|
+
const targetPath = PATH3.resolve(rulesDir, filename3);
|
|
623
|
+
const existing = existsSync6(targetPath) ? readFileSync7(targetPath, "utf8") : void 0;
|
|
624
|
+
if (existing === content) continue;
|
|
625
|
+
writeFileSync3(targetPath, content, "utf8");
|
|
626
|
+
if (existing) {
|
|
627
|
+
updated++;
|
|
628
|
+
} else {
|
|
629
|
+
created++;
|
|
630
|
+
}
|
|
631
|
+
}
|
|
632
|
+
return {
|
|
633
|
+
created,
|
|
634
|
+
templateNames,
|
|
635
|
+
updated
|
|
636
|
+
};
|
|
637
|
+
};
|
|
558
638
|
var removeStaleRules = (rulesDir, templateNames) => {
|
|
559
|
-
const existingRules =
|
|
639
|
+
const existingRules = readdirSync3(rulesDir).filter((f) => f.startsWith(XYLABS_RULES_PREFIX) && f.endsWith(".md"));
|
|
560
640
|
let removed = 0;
|
|
561
641
|
for (const file of existingRules) {
|
|
562
642
|
if (!templateNames.has(file)) {
|
|
563
|
-
|
|
643
|
+
unlinkSync2(PATH3.resolve(rulesDir, file));
|
|
564
644
|
removed++;
|
|
565
645
|
}
|
|
566
646
|
}
|
|
@@ -573,27 +653,27 @@ var logRulesResult = (created, updated, removed) => {
|
|
|
573
653
|
updated ? `${updated} updated` : "",
|
|
574
654
|
removed ? `${removed} removed` : ""
|
|
575
655
|
].filter(Boolean);
|
|
576
|
-
console.log(
|
|
656
|
+
console.log(chalk11.green(`.claude/rules/${XYLABS_RULES_PREFIX}*.md: ${parts.join(", ")}`));
|
|
577
657
|
} else {
|
|
578
|
-
console.log(
|
|
658
|
+
console.log(chalk11.gray(`.claude/rules/${XYLABS_RULES_PREFIX}*.md: already up to date`));
|
|
579
659
|
}
|
|
580
660
|
};
|
|
581
661
|
var ensureProjectClaudeMd = (cwd5, force) => {
|
|
582
|
-
const projectPath =
|
|
583
|
-
if (!
|
|
584
|
-
if (force &&
|
|
585
|
-
console.log(
|
|
662
|
+
const projectPath = PATH3.resolve(cwd5, "CLAUDE.md");
|
|
663
|
+
if (!existsSync6(projectPath) || force) {
|
|
664
|
+
if (force && existsSync6(projectPath)) {
|
|
665
|
+
console.log(chalk11.yellow("Overwriting existing CLAUDE.md"));
|
|
586
666
|
}
|
|
587
|
-
|
|
588
|
-
console.log(
|
|
667
|
+
writeFileSync3(projectPath, claudeMdProjectTemplate(), "utf8");
|
|
668
|
+
console.log(chalk11.green("Generated CLAUDE.md"));
|
|
589
669
|
} else {
|
|
590
|
-
console.log(
|
|
670
|
+
console.log(chalk11.gray("CLAUDE.md already exists (skipped)"));
|
|
591
671
|
}
|
|
592
672
|
};
|
|
593
673
|
var claudeRules = ({ force } = {}) => {
|
|
594
674
|
const cwd5 = INIT_CWD() ?? process.cwd();
|
|
595
|
-
const rulesDir =
|
|
596
|
-
|
|
675
|
+
const rulesDir = PATH3.resolve(cwd5, ".claude", "rules");
|
|
676
|
+
mkdirSync2(rulesDir, { recursive: true });
|
|
597
677
|
const {
|
|
598
678
|
created,
|
|
599
679
|
templateNames,
|
|
@@ -619,16 +699,16 @@ var cleanAll = ({ verbose }) => {
|
|
|
619
699
|
|
|
620
700
|
// src/actions/clean-docs.ts
|
|
621
701
|
import path from "path";
|
|
622
|
-
import
|
|
702
|
+
import chalk12 from "chalk";
|
|
623
703
|
var cleanDocs = () => {
|
|
624
704
|
const pkgName = process.env.npm_package_name;
|
|
625
|
-
console.log(
|
|
705
|
+
console.log(chalk12.green(`Cleaning Docs [${pkgName}]`));
|
|
626
706
|
for (const { location } of yarnWorkspaces()) deleteGlob(path.join(location, "docs"));
|
|
627
707
|
return 0;
|
|
628
708
|
};
|
|
629
709
|
|
|
630
710
|
// src/actions/compile.ts
|
|
631
|
-
import
|
|
711
|
+
import chalk13 from "chalk";
|
|
632
712
|
var compile = ({
|
|
633
713
|
verbose,
|
|
634
714
|
target,
|
|
@@ -669,7 +749,7 @@ var compileAll = ({
|
|
|
669
749
|
const incrementalOptions = incremental ? ["--since", "-Ap", "--topological-dev"] : ["--parallel", "-Ap", "--topological-dev"];
|
|
670
750
|
const jobsOptions = jobs ? ["-j", `${jobs}`] : [];
|
|
671
751
|
if (jobs) {
|
|
672
|
-
console.log(
|
|
752
|
+
console.log(chalk13.blue(`Jobs set to [${jobs}]`));
|
|
673
753
|
}
|
|
674
754
|
const result = runSteps(`Compile${incremental ? "-Incremental" : ""} [All]`, [
|
|
675
755
|
["yarn", [
|
|
@@ -683,13 +763,13 @@ var compileAll = ({
|
|
|
683
763
|
...targetOptions
|
|
684
764
|
]]
|
|
685
765
|
]);
|
|
686
|
-
console.log(`${
|
|
766
|
+
console.log(`${chalk13.gray("Compiled in")} [${chalk13.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk13.gray("seconds")}`);
|
|
687
767
|
return result;
|
|
688
768
|
};
|
|
689
769
|
|
|
690
770
|
// src/actions/copy-assets.ts
|
|
691
771
|
import path2 from "path/posix";
|
|
692
|
-
import
|
|
772
|
+
import chalk14 from "chalk";
|
|
693
773
|
import cpy from "cpy";
|
|
694
774
|
var copyPackageTargetAssets = async (target, name, location) => {
|
|
695
775
|
try {
|
|
@@ -712,7 +792,7 @@ var copyPackageTargetAssets = async (target, name, location) => {
|
|
|
712
792
|
};
|
|
713
793
|
var copyTargetAssets = async (target, pkg) => {
|
|
714
794
|
const workspaces = yarnWorkspaces();
|
|
715
|
-
console.log(
|
|
795
|
+
console.log(chalk14.green(`Copying Assets [${target.toUpperCase()}]`));
|
|
716
796
|
const workspaceList = workspaces.filter(({ name }) => {
|
|
717
797
|
return pkg === void 0 || name === pkg;
|
|
718
798
|
});
|
|
@@ -796,7 +876,7 @@ var dead = () => {
|
|
|
796
876
|
};
|
|
797
877
|
|
|
798
878
|
// src/actions/deplint/deplint.ts
|
|
799
|
-
import
|
|
879
|
+
import chalk20 from "chalk";
|
|
800
880
|
|
|
801
881
|
// src/actions/deplint/findFiles.ts
|
|
802
882
|
import fs2 from "fs";
|
|
@@ -998,12 +1078,12 @@ function getExternalImportsFromFiles({
|
|
|
998
1078
|
|
|
999
1079
|
// src/actions/deplint/checkPackage/getUnlistedDependencies.ts
|
|
1000
1080
|
import { builtinModules } from "module";
|
|
1001
|
-
import
|
|
1081
|
+
import chalk15 from "chalk";
|
|
1002
1082
|
function isListedOrBuiltin(imp, name, dependencies, peerDependencies) {
|
|
1003
1083
|
return dependencies.includes(imp) || imp === name || dependencies.includes(`@types/${imp}`) || peerDependencies.includes(imp) || peerDependencies.includes(`@types/${imp}`) || builtinModules.includes(imp) || builtinModules.includes(`@types/${imp}`);
|
|
1004
1084
|
}
|
|
1005
1085
|
function logMissing(name, imp, importPaths) {
|
|
1006
|
-
console.log(`[${
|
|
1086
|
+
console.log(`[${chalk15.blue(name)}] Missing dependency in package.json: ${chalk15.red(imp)}`);
|
|
1007
1087
|
if (importPaths[imp]) {
|
|
1008
1088
|
console.log(` ${importPaths[imp].join("\n ")}`);
|
|
1009
1089
|
}
|
|
@@ -1028,7 +1108,7 @@ function getUnlistedDependencies({ name, location }, { dependencies, peerDepende
|
|
|
1028
1108
|
}
|
|
1029
1109
|
if (unlistedDependencies > 0) {
|
|
1030
1110
|
const packageLocation = `${location}/package.json`;
|
|
1031
|
-
console.log(` ${
|
|
1111
|
+
console.log(` ${chalk15.yellow(packageLocation)}
|
|
1032
1112
|
`);
|
|
1033
1113
|
}
|
|
1034
1114
|
return unlistedDependencies;
|
|
@@ -1036,7 +1116,7 @@ function getUnlistedDependencies({ name, location }, { dependencies, peerDepende
|
|
|
1036
1116
|
|
|
1037
1117
|
// src/actions/deplint/checkPackage/getUnlistedDevDependencies.ts
|
|
1038
1118
|
import { builtinModules as builtinModules2 } from "module";
|
|
1039
|
-
import
|
|
1119
|
+
import chalk16 from "chalk";
|
|
1040
1120
|
function getUnlistedDevDependencies({ name, location }, {
|
|
1041
1121
|
devDependencies,
|
|
1042
1122
|
dependencies,
|
|
@@ -1050,7 +1130,7 @@ function getUnlistedDevDependencies({ name, location }, {
|
|
|
1050
1130
|
for (const imp of externalAllImports) {
|
|
1051
1131
|
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)) {
|
|
1052
1132
|
unlistedDevDependencies++;
|
|
1053
|
-
console.log(`[${
|
|
1133
|
+
console.log(`[${chalk16.blue(name)}] Missing devDependency in package.json: ${chalk16.red(imp)}`);
|
|
1054
1134
|
if (allImportPaths[imp]) {
|
|
1055
1135
|
console.log(` ${allImportPaths[imp].join("\n ")}`);
|
|
1056
1136
|
}
|
|
@@ -1058,14 +1138,14 @@ function getUnlistedDevDependencies({ name, location }, {
|
|
|
1058
1138
|
}
|
|
1059
1139
|
if (unlistedDevDependencies > 0) {
|
|
1060
1140
|
const packageLocation = `${location}/package.json`;
|
|
1061
|
-
console.log(` ${
|
|
1141
|
+
console.log(` ${chalk16.yellow(packageLocation)}
|
|
1062
1142
|
`);
|
|
1063
1143
|
}
|
|
1064
1144
|
return unlistedDevDependencies;
|
|
1065
1145
|
}
|
|
1066
1146
|
|
|
1067
1147
|
// src/actions/deplint/checkPackage/getUnusedDependencies.ts
|
|
1068
|
-
import
|
|
1148
|
+
import chalk17 from "chalk";
|
|
1069
1149
|
function getUnusedDependencies({ name, location }, { dependencies }, {
|
|
1070
1150
|
externalDistImports,
|
|
1071
1151
|
externalDistTypeImports,
|
|
@@ -1076,22 +1156,22 @@ function getUnusedDependencies({ name, location }, { dependencies }, {
|
|
|
1076
1156
|
if (!externalDistImports.includes(dep) && !externalDistImports.includes(dep.replace(/^@types\//, "")) && !externalDistTypeImports.includes(dep) && !externalDistTypeImports.includes(dep.replace(/^@types\//, ""))) {
|
|
1077
1157
|
unusedDependencies++;
|
|
1078
1158
|
if (externalAllImports.includes(dep)) {
|
|
1079
|
-
console.log(`[${
|
|
1159
|
+
console.log(`[${chalk17.blue(name)}] dependency should be devDependency in package.json: ${chalk17.red(dep)}`);
|
|
1080
1160
|
} else {
|
|
1081
|
-
console.log(`[${
|
|
1161
|
+
console.log(`[${chalk17.blue(name)}] Unused dependency in package.json: ${chalk17.red(dep)}`);
|
|
1082
1162
|
}
|
|
1083
1163
|
}
|
|
1084
1164
|
}
|
|
1085
1165
|
if (unusedDependencies > 0) {
|
|
1086
1166
|
const packageLocation = `${location}/package.json`;
|
|
1087
|
-
console.log(` ${
|
|
1167
|
+
console.log(` ${chalk17.yellow(packageLocation)}
|
|
1088
1168
|
`);
|
|
1089
1169
|
}
|
|
1090
1170
|
return unusedDependencies;
|
|
1091
1171
|
}
|
|
1092
1172
|
|
|
1093
1173
|
// src/actions/deplint/checkPackage/getUnusedDevDependencies.ts
|
|
1094
|
-
import
|
|
1174
|
+
import chalk18 from "chalk";
|
|
1095
1175
|
|
|
1096
1176
|
// src/actions/deplint/getRequiredPeerDependencies.ts
|
|
1097
1177
|
import fs6 from "fs";
|
|
@@ -1279,34 +1359,34 @@ function getUnusedDevDependencies({ name, location }, {
|
|
|
1279
1359
|
if (dependencies.includes(dep) || peerDependencies.includes(dep)) continue;
|
|
1280
1360
|
if (!isDevDepUsed(dep, allImports, implicitDeps, requiredPeers, scriptRefs)) {
|
|
1281
1361
|
unusedDevDependencies++;
|
|
1282
|
-
console.log(`[${
|
|
1362
|
+
console.log(`[${chalk18.blue(name)}] Unused devDependency in package.json: ${chalk18.red(dep)}`);
|
|
1283
1363
|
}
|
|
1284
1364
|
}
|
|
1285
1365
|
if (unusedDevDependencies > 0) {
|
|
1286
1366
|
const packageLocation = `${location}/package.json`;
|
|
1287
|
-
console.log(` ${
|
|
1367
|
+
console.log(` ${chalk18.yellow(packageLocation)}
|
|
1288
1368
|
`);
|
|
1289
1369
|
}
|
|
1290
1370
|
return unusedDevDependencies;
|
|
1291
1371
|
}
|
|
1292
1372
|
|
|
1293
1373
|
// src/actions/deplint/checkPackage/getUnusedPeerDependencies.ts
|
|
1294
|
-
import
|
|
1374
|
+
import chalk19 from "chalk";
|
|
1295
1375
|
function getUnusedPeerDependencies({ name, location }, { peerDependencies, dependencies }, { externalDistImports, externalDistTypeImports }) {
|
|
1296
1376
|
let unusedDependencies = 0;
|
|
1297
1377
|
for (const dep of peerDependencies) {
|
|
1298
1378
|
if (!externalDistImports.includes(dep) && !externalDistImports.includes(dep.replace(/^@types\//, "")) && !externalDistTypeImports.includes(dep) && !externalDistTypeImports.includes(dep.replace(/^@types\//, ""))) {
|
|
1299
1379
|
unusedDependencies++;
|
|
1300
1380
|
if (dependencies.includes(dep)) {
|
|
1301
|
-
console.log(`[${
|
|
1381
|
+
console.log(`[${chalk19.blue(name)}] Unused peerDependency [already a dependency] in package.json: ${chalk19.red(dep)}`);
|
|
1302
1382
|
} else {
|
|
1303
|
-
console.log(`[${
|
|
1383
|
+
console.log(`[${chalk19.blue(name)}] Unused peerDependency in package.json: ${chalk19.red(dep)}`);
|
|
1304
1384
|
}
|
|
1305
1385
|
}
|
|
1306
1386
|
}
|
|
1307
1387
|
if (unusedDependencies > 0) {
|
|
1308
1388
|
const packageLocation = `${location}/package.json`;
|
|
1309
|
-
console.log(` ${
|
|
1389
|
+
console.log(` ${chalk19.yellow(packageLocation)}
|
|
1310
1390
|
`);
|
|
1311
1391
|
}
|
|
1312
1392
|
return unusedDependencies;
|
|
@@ -1392,19 +1472,19 @@ var deplint = ({
|
|
|
1392
1472
|
});
|
|
1393
1473
|
}
|
|
1394
1474
|
if (totalErrors > 0) {
|
|
1395
|
-
console.warn(`Deplint: Found ${
|
|
1475
|
+
console.warn(`Deplint: Found ${chalk20.red(totalErrors)} dependency problems. ${chalk20.red("\u2716")}`);
|
|
1396
1476
|
} else {
|
|
1397
|
-
console.info(`Deplint: Found no dependency problems. ${
|
|
1477
|
+
console.info(`Deplint: Found no dependency problems. ${chalk20.green("\u2714")}`);
|
|
1398
1478
|
}
|
|
1399
1479
|
return 0;
|
|
1400
1480
|
};
|
|
1401
1481
|
|
|
1402
1482
|
// src/actions/deploy.ts
|
|
1403
|
-
import { readFileSync as
|
|
1483
|
+
import { readFileSync as readFileSync8 } from "fs";
|
|
1404
1484
|
var privatePackageExcludeList = () => {
|
|
1405
1485
|
const possibleDeployablePackages = yarnWorkspaces().map((workspace) => [
|
|
1406
1486
|
workspace,
|
|
1407
|
-
JSON.parse(
|
|
1487
|
+
JSON.parse(readFileSync8(`${workspace.location}/package.json`, { encoding: "utf8" }))
|
|
1408
1488
|
]);
|
|
1409
1489
|
const privatePackages = possibleDeployablePackages.filter(([_, pkg]) => pkg.private).map(([workspace]) => workspace);
|
|
1410
1490
|
const excludeList = privatePackages.map((workspace) => `--exclude ${workspace.name}`);
|
|
@@ -1424,11 +1504,11 @@ var deploy = () => {
|
|
|
1424
1504
|
};
|
|
1425
1505
|
|
|
1426
1506
|
// src/actions/deploy-major.ts
|
|
1427
|
-
import { readFileSync as
|
|
1507
|
+
import { readFileSync as readFileSync9 } from "fs";
|
|
1428
1508
|
var privatePackageExcludeList2 = () => {
|
|
1429
1509
|
const possibleDeployablePackages = yarnWorkspaces().map((workspace) => [
|
|
1430
1510
|
workspace,
|
|
1431
|
-
JSON.parse(
|
|
1511
|
+
JSON.parse(readFileSync9(`${workspace.location}/package.json`, { encoding: "utf8" }))
|
|
1432
1512
|
]);
|
|
1433
1513
|
const privatePackages = possibleDeployablePackages.filter(([_, pkg]) => pkg.private).map(([workspace]) => workspace);
|
|
1434
1514
|
const excludeList = privatePackages.map((workspace) => `--exclude ${workspace.name}`);
|
|
@@ -1448,11 +1528,11 @@ var deployMajor = () => {
|
|
|
1448
1528
|
};
|
|
1449
1529
|
|
|
1450
1530
|
// src/actions/deploy-minor.ts
|
|
1451
|
-
import { readFileSync as
|
|
1531
|
+
import { readFileSync as readFileSync10 } from "fs";
|
|
1452
1532
|
var privatePackageExcludeList3 = () => {
|
|
1453
1533
|
const possibleDeployablePackages = yarnWorkspaces().map((workspace) => [
|
|
1454
1534
|
workspace,
|
|
1455
|
-
JSON.parse(
|
|
1535
|
+
JSON.parse(readFileSync10(`${workspace.location}/package.json`, { encoding: "utf8" }))
|
|
1456
1536
|
]);
|
|
1457
1537
|
const privatePackages = possibleDeployablePackages.filter(([_, pkg]) => pkg.private).map(([workspace]) => workspace);
|
|
1458
1538
|
const excludeList = privatePackages.map((workspace) => `--exclude ${workspace.name}`);
|
|
@@ -1472,11 +1552,11 @@ var deployMinor = () => {
|
|
|
1472
1552
|
};
|
|
1473
1553
|
|
|
1474
1554
|
// src/actions/deploy-next.ts
|
|
1475
|
-
import { readFileSync as
|
|
1555
|
+
import { readFileSync as readFileSync11 } from "fs";
|
|
1476
1556
|
var privatePackageExcludeList4 = () => {
|
|
1477
1557
|
const possibleDeployablePackages = yarnWorkspaces().map((workspace) => [
|
|
1478
1558
|
workspace,
|
|
1479
|
-
JSON.parse(
|
|
1559
|
+
JSON.parse(readFileSync11(`${workspace.location}/package.json`, { encoding: "utf8" }))
|
|
1480
1560
|
]);
|
|
1481
1561
|
const privatePackages = possibleDeployablePackages.filter(([_, pkg]) => pkg.private).map(([workspace]) => workspace);
|
|
1482
1562
|
const excludeList = privatePackages.map((workspace) => `--exclude ${workspace.name}`);
|
|
@@ -1496,22 +1576,22 @@ var deployNext = () => {
|
|
|
1496
1576
|
};
|
|
1497
1577
|
|
|
1498
1578
|
// src/actions/dupdeps.ts
|
|
1499
|
-
import
|
|
1579
|
+
import chalk21 from "chalk";
|
|
1500
1580
|
var dupdeps = () => {
|
|
1501
|
-
console.log(
|
|
1581
|
+
console.log(chalk21.green("Checking all Dependencies for Duplicates"));
|
|
1502
1582
|
const allDependencies = parsedPackageJSON()?.dependencies;
|
|
1503
1583
|
const dependencies = Object.entries(allDependencies).map(([k]) => k);
|
|
1504
1584
|
return detectDuplicateDependencies(dependencies);
|
|
1505
1585
|
};
|
|
1506
1586
|
|
|
1507
1587
|
// src/actions/lint.ts
|
|
1508
|
-
import
|
|
1588
|
+
import chalk22 from "chalk";
|
|
1509
1589
|
var lintPackage = ({
|
|
1510
1590
|
pkg,
|
|
1511
1591
|
fix: fix2,
|
|
1512
1592
|
verbose
|
|
1513
1593
|
}) => {
|
|
1514
|
-
console.log(
|
|
1594
|
+
console.log(chalk22.gray(`${fix2 ? "Fix" : "Lint"} [${pkg}]`));
|
|
1515
1595
|
const start = Date.now();
|
|
1516
1596
|
const result = runSteps(`${fix2 ? "Fix" : "Lint"} [${pkg}]`, [
|
|
1517
1597
|
["yarn", [
|
|
@@ -1521,7 +1601,7 @@ var lintPackage = ({
|
|
|
1521
1601
|
fix2 ? "package-fix" : verbose ? "package-lint-verbose" : "package-lint"
|
|
1522
1602
|
]]
|
|
1523
1603
|
]);
|
|
1524
|
-
console.log(
|
|
1604
|
+
console.log(chalk22.gray(`${fix2 ? "Fixed in" : "Linted in"} [${chalk22.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk22.gray("seconds")}`));
|
|
1525
1605
|
return result;
|
|
1526
1606
|
};
|
|
1527
1607
|
var lint = ({
|
|
@@ -1541,13 +1621,13 @@ var lint = ({
|
|
|
1541
1621
|
});
|
|
1542
1622
|
};
|
|
1543
1623
|
var lintAllPackages = ({ fix: fix2 = false } = {}) => {
|
|
1544
|
-
console.log(
|
|
1624
|
+
console.log(chalk22.gray(`${fix2 ? "Fix" : "Lint"} [All-Packages]`));
|
|
1545
1625
|
const start = Date.now();
|
|
1546
1626
|
const fixOptions = fix2 ? ["--fix"] : [];
|
|
1547
1627
|
const result = runSteps(`${fix2 ? "Fix" : "Lint"} [All-Packages]`, [
|
|
1548
1628
|
["yarn", ["eslint", "--cache", "--cache-location", ".eslintcache", "--cache-strategy", "content", ...fixOptions]]
|
|
1549
1629
|
]);
|
|
1550
|
-
console.log(
|
|
1630
|
+
console.log(chalk22.gray(`${fix2 ? "Fixed in" : "Linted in"} [${chalk22.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk22.gray("seconds")}`));
|
|
1551
1631
|
return result;
|
|
1552
1632
|
};
|
|
1553
1633
|
|
|
@@ -1575,7 +1655,7 @@ var filename = ".gitignore";
|
|
|
1575
1655
|
var gitignoreGen = (pkg) => generateIgnoreFiles(filename, pkg);
|
|
1576
1656
|
|
|
1577
1657
|
// src/actions/gitlint.ts
|
|
1578
|
-
import
|
|
1658
|
+
import chalk23 from "chalk";
|
|
1579
1659
|
import ParseGitConfig from "parse-git-config";
|
|
1580
1660
|
var gitlint = () => {
|
|
1581
1661
|
console.log(`
|
|
@@ -1586,7 +1666,7 @@ Gitlint Start [${process.cwd()}]
|
|
|
1586
1666
|
const errors = 0;
|
|
1587
1667
|
const gitConfig = ParseGitConfig.sync();
|
|
1588
1668
|
const warn = (message) => {
|
|
1589
|
-
console.warn(
|
|
1669
|
+
console.warn(chalk23.yellow(`Warning: ${message}`));
|
|
1590
1670
|
warnings++;
|
|
1591
1671
|
};
|
|
1592
1672
|
if (gitConfig.core.ignorecase) {
|
|
@@ -1606,13 +1686,13 @@ Gitlint Start [${process.cwd()}]
|
|
|
1606
1686
|
}
|
|
1607
1687
|
const resultMessages = [];
|
|
1608
1688
|
if (valid > 0) {
|
|
1609
|
-
resultMessages.push(
|
|
1689
|
+
resultMessages.push(chalk23.green(`Passed: ${valid}`));
|
|
1610
1690
|
}
|
|
1611
1691
|
if (warnings > 0) {
|
|
1612
|
-
resultMessages.push(
|
|
1692
|
+
resultMessages.push(chalk23.yellow(`Warnings: ${warnings}`));
|
|
1613
1693
|
}
|
|
1614
1694
|
if (errors > 0) {
|
|
1615
|
-
resultMessages.push(
|
|
1695
|
+
resultMessages.push(chalk23.red(` Errors: ${errors}`));
|
|
1616
1696
|
}
|
|
1617
1697
|
console.warn(`Gitlint Finish [ ${resultMessages.join(" | ")} ]
|
|
1618
1698
|
`);
|
|
@@ -1621,7 +1701,7 @@ Gitlint Start [${process.cwd()}]
|
|
|
1621
1701
|
|
|
1622
1702
|
// src/actions/gitlint-fix.ts
|
|
1623
1703
|
import { execSync as execSync2 } from "child_process";
|
|
1624
|
-
import
|
|
1704
|
+
import chalk24 from "chalk";
|
|
1625
1705
|
import ParseGitConfig2 from "parse-git-config";
|
|
1626
1706
|
var gitlintFix = () => {
|
|
1627
1707
|
console.log(`
|
|
@@ -1630,15 +1710,15 @@ Gitlint Fix Start [${process.cwd()}]
|
|
|
1630
1710
|
const gitConfig = ParseGitConfig2.sync();
|
|
1631
1711
|
if (gitConfig.core.ignorecase) {
|
|
1632
1712
|
execSync2("git config core.ignorecase false", { stdio: "inherit" });
|
|
1633
|
-
console.warn(
|
|
1713
|
+
console.warn(chalk24.yellow("\nGitlint Fix: Updated core.ignorecase to be false\n"));
|
|
1634
1714
|
}
|
|
1635
1715
|
if (gitConfig.core.autocrlf !== false) {
|
|
1636
1716
|
execSync2("git config core.autocrlf false", { stdio: "inherit" });
|
|
1637
|
-
console.warn(
|
|
1717
|
+
console.warn(chalk24.yellow("\nGitlint Fix: Updated core.autocrlf to be false\n"));
|
|
1638
1718
|
}
|
|
1639
1719
|
if (gitConfig.core.eol !== "lf") {
|
|
1640
1720
|
execSync2("git config core.eol lf", { stdio: "inherit" });
|
|
1641
|
-
console.warn(
|
|
1721
|
+
console.warn(chalk24.yellow('\nGitlint Fix: Updated core.eol to be "lf"\n'));
|
|
1642
1722
|
}
|
|
1643
1723
|
return 1;
|
|
1644
1724
|
};
|
|
@@ -1649,7 +1729,7 @@ var knip = () => {
|
|
|
1649
1729
|
};
|
|
1650
1730
|
|
|
1651
1731
|
// src/actions/license.ts
|
|
1652
|
-
import
|
|
1732
|
+
import chalk25 from "chalk";
|
|
1653
1733
|
import { init } from "license-checker";
|
|
1654
1734
|
var license = async (pkg) => {
|
|
1655
1735
|
const workspaces = yarnWorkspaces();
|
|
@@ -1674,18 +1754,18 @@ var license = async (pkg) => {
|
|
|
1674
1754
|
"LGPL-3.0-or-later",
|
|
1675
1755
|
"Python-2.0"
|
|
1676
1756
|
]);
|
|
1677
|
-
console.log(
|
|
1757
|
+
console.log(chalk25.green("License Checker"));
|
|
1678
1758
|
return (await Promise.all(
|
|
1679
1759
|
workspaceList.map(({ location, name }) => {
|
|
1680
1760
|
return new Promise((resolve) => {
|
|
1681
1761
|
init({ production: true, start: location }, (error, packages) => {
|
|
1682
1762
|
if (error) {
|
|
1683
|
-
console.error(
|
|
1684
|
-
console.error(
|
|
1763
|
+
console.error(chalk25.red(`License Checker [${name}] Error`));
|
|
1764
|
+
console.error(chalk25.gray(error));
|
|
1685
1765
|
console.log("\n");
|
|
1686
1766
|
resolve(1);
|
|
1687
1767
|
} else {
|
|
1688
|
-
console.log(
|
|
1768
|
+
console.log(chalk25.green(`License Checker [${name}]`));
|
|
1689
1769
|
let count = 0;
|
|
1690
1770
|
for (const [name2, info] of Object.entries(packages)) {
|
|
1691
1771
|
const licenses = Array.isArray(info.licenses) ? info.licenses : [info.licenses];
|
|
@@ -1701,7 +1781,7 @@ var license = async (pkg) => {
|
|
|
1701
1781
|
}
|
|
1702
1782
|
if (!orLicenseFound) {
|
|
1703
1783
|
count++;
|
|
1704
|
-
console.warn(
|
|
1784
|
+
console.warn(chalk25.yellow(`${name2}: Package License not allowed [${license2}]`));
|
|
1705
1785
|
}
|
|
1706
1786
|
}
|
|
1707
1787
|
}
|
|
@@ -1721,12 +1801,12 @@ var npmignoreGen = (pkg) => generateIgnoreFiles(filename2, pkg);
|
|
|
1721
1801
|
|
|
1722
1802
|
// src/actions/package/clean-outputs.ts
|
|
1723
1803
|
import path7 from "path";
|
|
1724
|
-
import
|
|
1804
|
+
import chalk26 from "chalk";
|
|
1725
1805
|
var packageCleanOutputs = () => {
|
|
1726
1806
|
const pkg = process.env.INIT_CWD ?? ".";
|
|
1727
1807
|
const pkgName = process.env.npm_package_name;
|
|
1728
1808
|
const folders = [path7.join(pkg, "dist"), path7.join(pkg, "build"), path7.join(pkg, "docs")];
|
|
1729
|
-
console.log(
|
|
1809
|
+
console.log(chalk26.green(`Cleaning Outputs [${pkgName}]`));
|
|
1730
1810
|
for (let folder of folders) {
|
|
1731
1811
|
deleteGlob(folder);
|
|
1732
1812
|
}
|
|
@@ -1735,11 +1815,11 @@ var packageCleanOutputs = () => {
|
|
|
1735
1815
|
|
|
1736
1816
|
// src/actions/package/clean-typescript.ts
|
|
1737
1817
|
import path8 from "path";
|
|
1738
|
-
import
|
|
1818
|
+
import chalk27 from "chalk";
|
|
1739
1819
|
var packageCleanTypescript = () => {
|
|
1740
1820
|
const pkg = process.env.INIT_CWD ?? ".";
|
|
1741
1821
|
const pkgName = process.env.npm_package_name;
|
|
1742
|
-
console.log(
|
|
1822
|
+
console.log(chalk27.green(`Cleaning Typescript [${pkgName}]`));
|
|
1743
1823
|
const files = [path8.join(pkg, "*.tsbuildinfo"), path8.join(pkg, ".tsconfig.*"), path8.join(pkg, ".eslintcache")];
|
|
1744
1824
|
for (let file of files) {
|
|
1745
1825
|
deleteGlob(file);
|
|
@@ -1753,26 +1833,26 @@ var packageClean = async () => {
|
|
|
1753
1833
|
};
|
|
1754
1834
|
|
|
1755
1835
|
// src/actions/package/compile/compile.ts
|
|
1756
|
-
import
|
|
1836
|
+
import chalk32 from "chalk";
|
|
1757
1837
|
|
|
1758
1838
|
// src/actions/package/compile/packageCompileTsup.ts
|
|
1759
|
-
import
|
|
1839
|
+
import chalk31 from "chalk";
|
|
1760
1840
|
import { build as build2, defineConfig } from "tsup";
|
|
1761
1841
|
|
|
1762
1842
|
// src/actions/package/compile/inputs.ts
|
|
1763
|
-
import
|
|
1843
|
+
import chalk28 from "chalk";
|
|
1764
1844
|
import { glob as glob2 } from "glob";
|
|
1765
1845
|
var getAllInputs = (srcDir, verbose = false) => {
|
|
1766
1846
|
return [...glob2.sync(`${srcDir}/**/*.ts`, { posix: true }).map((file) => {
|
|
1767
1847
|
const result = file.slice(Math.max(0, srcDir.length + 1));
|
|
1768
1848
|
if (verbose) {
|
|
1769
|
-
console.log(
|
|
1849
|
+
console.log(chalk28.gray(`getAllInputs: ${JSON.stringify(result, null, 2)}`));
|
|
1770
1850
|
}
|
|
1771
1851
|
return result;
|
|
1772
1852
|
}), ...glob2.sync(`${srcDir}/**/*.tsx`, { posix: true }).map((file) => {
|
|
1773
1853
|
const result = file.slice(Math.max(0, srcDir.length + 1));
|
|
1774
1854
|
if (verbose) {
|
|
1775
|
-
console.log(
|
|
1855
|
+
console.log(chalk28.gray(`getAllInputs: ${JSON.stringify(result, null, 2)}`));
|
|
1776
1856
|
}
|
|
1777
1857
|
return result;
|
|
1778
1858
|
})];
|
|
@@ -1831,7 +1911,7 @@ function deepMergeObjects(objects) {
|
|
|
1831
1911
|
|
|
1832
1912
|
// src/actions/package/compile/packageCompileTsc.ts
|
|
1833
1913
|
import { cwd as cwd2 } from "process";
|
|
1834
|
-
import
|
|
1914
|
+
import chalk29 from "chalk";
|
|
1835
1915
|
import { createProgramFromConfig } from "tsc-prog";
|
|
1836
1916
|
import ts2, {
|
|
1837
1917
|
DiagnosticCategory,
|
|
@@ -1853,7 +1933,7 @@ var getCompilerOptions = (options = {}, fileName = "tsconfig.json") => {
|
|
|
1853
1933
|
var packageCompileTsc = (platform, entries, srcDir = "src", outDir = "dist", compilerOptionsParam, verbose = false) => {
|
|
1854
1934
|
const pkg = process.env.INIT_CWD ?? cwd2();
|
|
1855
1935
|
if (verbose) {
|
|
1856
|
-
console.log(
|
|
1936
|
+
console.log(chalk29.cyan(`Validating code START: ${entries.length} files to ${outDir} from ${srcDir}`));
|
|
1857
1937
|
}
|
|
1858
1938
|
const configFilePath = ts2.findConfigFile(
|
|
1859
1939
|
"./",
|
|
@@ -1876,10 +1956,10 @@ var packageCompileTsc = (platform, entries, srcDir = "src", outDir = "dist", com
|
|
|
1876
1956
|
emitDeclarationOnly: true,
|
|
1877
1957
|
noEmit: false
|
|
1878
1958
|
};
|
|
1879
|
-
console.log(
|
|
1959
|
+
console.log(chalk29.cyan(`Validating Files: ${entries.length}`));
|
|
1880
1960
|
if (verbose) {
|
|
1881
1961
|
for (const entry of entries) {
|
|
1882
|
-
console.log(
|
|
1962
|
+
console.log(chalk29.grey(`Validating: ${entry}`));
|
|
1883
1963
|
}
|
|
1884
1964
|
}
|
|
1885
1965
|
try {
|
|
@@ -1903,13 +1983,19 @@ var packageCompileTsc = (platform, entries, srcDir = "src", outDir = "dist", com
|
|
|
1903
1983
|
);
|
|
1904
1984
|
console.error(formattedDiagnostics);
|
|
1905
1985
|
}
|
|
1906
|
-
|
|
1986
|
+
const nonEmitPatterns = [".stories.", "/stories/", ".spec.", "/spec/", ".example."];
|
|
1987
|
+
program.emit(void 0, (fileName, text, writeByteOrderMark) => {
|
|
1988
|
+
if (nonEmitPatterns.some((pattern) => fileName.includes(pattern))) {
|
|
1989
|
+
return;
|
|
1990
|
+
}
|
|
1991
|
+
ts2.sys.writeFile(fileName, text, writeByteOrderMark);
|
|
1992
|
+
});
|
|
1907
1993
|
return diagnostics.reduce((acc, diag) => acc + (diag.category === DiagnosticCategory.Error ? 1 : 0), 0);
|
|
1908
1994
|
}
|
|
1909
1995
|
return 0;
|
|
1910
1996
|
} finally {
|
|
1911
1997
|
if (verbose) {
|
|
1912
|
-
console.log(
|
|
1998
|
+
console.log(chalk29.cyan(`Validating code FINISH: ${entries.length} files to ${outDir} from ${srcDir}`));
|
|
1913
1999
|
}
|
|
1914
2000
|
}
|
|
1915
2001
|
};
|
|
@@ -1917,7 +2003,7 @@ var packageCompileTsc = (platform, entries, srcDir = "src", outDir = "dist", com
|
|
|
1917
2003
|
// src/actions/package/compile/packageCompileTscTypes.ts
|
|
1918
2004
|
import path9 from "path";
|
|
1919
2005
|
import { cwd as cwd3 } from "process";
|
|
1920
|
-
import
|
|
2006
|
+
import chalk30 from "chalk";
|
|
1921
2007
|
import { rollup } from "rollup";
|
|
1922
2008
|
import dts from "rollup-plugin-dts";
|
|
1923
2009
|
import nodeExternals from "rollup-plugin-node-externals";
|
|
@@ -1942,8 +2028,8 @@ async function bundleDts(inputPath, outputPath, platform, options, verbose = fal
|
|
|
1942
2028
|
if (ignoredWarningCodes.has(warning.code ?? "")) {
|
|
1943
2029
|
return;
|
|
1944
2030
|
}
|
|
1945
|
-
console.warn(
|
|
1946
|
-
console.warn(
|
|
2031
|
+
console.warn(chalk30.yellow(`[${warning.code}] ${warning.message}`));
|
|
2032
|
+
console.warn(chalk30.gray(inputPath));
|
|
1947
2033
|
warn(warning);
|
|
1948
2034
|
}
|
|
1949
2035
|
});
|
|
@@ -1953,8 +2039,8 @@ async function bundleDts(inputPath, outputPath, platform, options, verbose = fal
|
|
|
1953
2039
|
});
|
|
1954
2040
|
} catch (ex) {
|
|
1955
2041
|
const error = ex;
|
|
1956
|
-
console.warn(
|
|
1957
|
-
console.warn(
|
|
2042
|
+
console.warn(chalk30.red(error));
|
|
2043
|
+
console.warn(chalk30.gray(inputPath));
|
|
1958
2044
|
}
|
|
1959
2045
|
if (verbose) {
|
|
1960
2046
|
console.log(`Bundled declarations written to ${outputPath}`);
|
|
@@ -1962,7 +2048,7 @@ async function bundleDts(inputPath, outputPath, platform, options, verbose = fal
|
|
|
1962
2048
|
}
|
|
1963
2049
|
var packageCompileTscTypes = async (entries, outDir, platform, srcDir = "build", verbose = false) => {
|
|
1964
2050
|
if (verbose) {
|
|
1965
|
-
console.log(
|
|
2051
|
+
console.log(chalk30.cyan(`Compiling Types START [${platform}]: ${entries.length} files to ${outDir} from ${srcDir}`));
|
|
1966
2052
|
console.log(`Entries: ${entries.join(", ")}`);
|
|
1967
2053
|
}
|
|
1968
2054
|
const pkg = process.env.INIT_CWD ?? cwd3();
|
|
@@ -1986,7 +2072,7 @@ var packageCompileTscTypes = async (entries, outDir, platform, srcDir = "build",
|
|
|
1986
2072
|
await bundleDts(`${srcRoot}/${entryTypeName}`, `${outDir}/${entryTypeName}`, platform, { compilerOptions }, verbose);
|
|
1987
2073
|
}));
|
|
1988
2074
|
if (verbose) {
|
|
1989
|
-
console.log(
|
|
2075
|
+
console.log(chalk30.cyan(`Compiling Types FINISH: ${entries.length} files to ${outDir} from ${srcDir}`));
|
|
1990
2076
|
}
|
|
1991
2077
|
return 0;
|
|
1992
2078
|
};
|
|
@@ -1998,15 +2084,15 @@ var compileFolder = async (srcDir, entries, buildDir, options, bundleTypes = fal
|
|
|
1998
2084
|
console.log(`compileFolder [${srcDir}, ${options?.outDir}]`);
|
|
1999
2085
|
}
|
|
2000
2086
|
if (entries.length === 0) {
|
|
2001
|
-
console.warn(
|
|
2087
|
+
console.warn(chalk31.yellow(`No entries found in ${srcDir} to compile`));
|
|
2002
2088
|
return 0;
|
|
2003
2089
|
}
|
|
2004
2090
|
if (verbose) {
|
|
2005
|
-
console.log(
|
|
2091
|
+
console.log(chalk31.gray(`buildDir [${buildDir}]`));
|
|
2006
2092
|
}
|
|
2007
2093
|
const validationResult = packageCompileTsc(options?.platform ?? "neutral", entries, srcDir, buildDir, void 0, verbose);
|
|
2008
2094
|
if (validationResult !== 0) {
|
|
2009
|
-
console.error(
|
|
2095
|
+
console.error(chalk31.red(`Compile:Validation had ${validationResult} errors`));
|
|
2010
2096
|
return validationResult;
|
|
2011
2097
|
}
|
|
2012
2098
|
const optionsParams = tsupOptions([{
|
|
@@ -2031,12 +2117,12 @@ var compileFolder = async (srcDir, entries, buildDir, options, bundleTypes = fal
|
|
|
2031
2117
|
})
|
|
2032
2118
|
)).flat();
|
|
2033
2119
|
if (verbose) {
|
|
2034
|
-
console.log(
|
|
2035
|
-
console.log(
|
|
2120
|
+
console.log(chalk31.cyan(`TSUP:build:start [${srcDir}]`));
|
|
2121
|
+
console.log(chalk31.gray(`TSUP:build:options [${JSON.stringify(optionsList, null, 2)}]`));
|
|
2036
2122
|
}
|
|
2037
2123
|
await Promise.all(optionsList.map((options2) => build2(options2)));
|
|
2038
2124
|
if (verbose) {
|
|
2039
|
-
console.log(
|
|
2125
|
+
console.log(chalk31.cyan(`TSUP:build:stop [${srcDir}]`));
|
|
2040
2126
|
}
|
|
2041
2127
|
if (bundleTypes) {
|
|
2042
2128
|
await packageCompileTscTypes(entries, outDir, options?.platform ?? "neutral", buildDir, verbose);
|
|
@@ -2147,14 +2233,14 @@ var packageCompileTsup = async (config2) => {
|
|
|
2147
2233
|
// src/actions/package/compile/compile.ts
|
|
2148
2234
|
var packageCompile = async (inConfig = {}) => {
|
|
2149
2235
|
const pkg = process.env.INIT_CWD;
|
|
2150
|
-
console.log(
|
|
2236
|
+
console.log(chalk32.green(`Compiling ${pkg}`));
|
|
2151
2237
|
const config2 = await loadConfig(inConfig);
|
|
2152
2238
|
return await packageCompileTsup(config2);
|
|
2153
2239
|
};
|
|
2154
2240
|
|
|
2155
2241
|
// src/actions/package/copy-assets.ts
|
|
2156
2242
|
import path10 from "path/posix";
|
|
2157
|
-
import
|
|
2243
|
+
import chalk33 from "chalk";
|
|
2158
2244
|
import cpy2 from "cpy";
|
|
2159
2245
|
var copyTargetAssets2 = async (target, name, location) => {
|
|
2160
2246
|
try {
|
|
@@ -2167,7 +2253,7 @@ var copyTargetAssets2 = async (target, name, location) => {
|
|
|
2167
2253
|
}
|
|
2168
2254
|
);
|
|
2169
2255
|
if (values.length > 0) {
|
|
2170
|
-
console.log(
|
|
2256
|
+
console.log(chalk33.green(`Copying Assets [${target.toUpperCase()}] - ${name} - ${location}`));
|
|
2171
2257
|
}
|
|
2172
2258
|
for (const value of values) {
|
|
2173
2259
|
console.log(`${value.split("/").pop()} => ./dist/${target}`);
|
|
@@ -2232,9 +2318,9 @@ var packageCycle = async () => {
|
|
|
2232
2318
|
};
|
|
2233
2319
|
|
|
2234
2320
|
// src/actions/package/gen-docs.ts
|
|
2235
|
-
import { existsSync as
|
|
2321
|
+
import { existsSync as existsSync7 } from "fs";
|
|
2236
2322
|
import path11 from "path";
|
|
2237
|
-
import
|
|
2323
|
+
import chalk34 from "chalk";
|
|
2238
2324
|
import {
|
|
2239
2325
|
Application,
|
|
2240
2326
|
ArgumentsReader,
|
|
@@ -2252,7 +2338,7 @@ var ExitCodes = {
|
|
|
2252
2338
|
};
|
|
2253
2339
|
var packageGenDocs = async () => {
|
|
2254
2340
|
const pkg = process.env.INIT_CWD;
|
|
2255
|
-
if (pkg !== void 0 && !
|
|
2341
|
+
if (pkg !== void 0 && !existsSync7(path11.join(pkg, "typedoc.json"))) {
|
|
2256
2342
|
return;
|
|
2257
2343
|
}
|
|
2258
2344
|
const app = await Application.bootstrap({
|
|
@@ -2338,16 +2424,16 @@ var runTypeDoc = async (app) => {
|
|
|
2338
2424
|
return ExitCodes.OutputError;
|
|
2339
2425
|
}
|
|
2340
2426
|
}
|
|
2341
|
-
console.log(
|
|
2427
|
+
console.log(chalk34.green(`${pkgName} - Ok`));
|
|
2342
2428
|
return ExitCodes.Ok;
|
|
2343
2429
|
};
|
|
2344
2430
|
|
|
2345
2431
|
// src/actions/package/lint.ts
|
|
2346
|
-
import { readdirSync as
|
|
2432
|
+
import { readdirSync as readdirSync4 } from "fs";
|
|
2347
2433
|
import path12 from "path";
|
|
2348
2434
|
import { cwd as cwd4 } from "process";
|
|
2349
2435
|
import { pathToFileURL } from "url";
|
|
2350
|
-
import
|
|
2436
|
+
import chalk35 from "chalk";
|
|
2351
2437
|
import { ESLint } from "eslint";
|
|
2352
2438
|
import { findUp } from "find-up";
|
|
2353
2439
|
import picomatch from "picomatch";
|
|
@@ -2356,14 +2442,14 @@ var dumpMessages = (lintResults) => {
|
|
|
2356
2442
|
const severity = ["none", "warning", "error"];
|
|
2357
2443
|
for (const lintResult of lintResults) {
|
|
2358
2444
|
if (lintResult.messages.length > 0) {
|
|
2359
|
-
console.log(
|
|
2445
|
+
console.log(chalk35.gray(`
|
|
2360
2446
|
${lintResult.filePath}`));
|
|
2361
2447
|
for (const message of lintResult.messages) {
|
|
2362
2448
|
console.log(
|
|
2363
|
-
|
|
2364
|
-
|
|
2365
|
-
|
|
2366
|
-
|
|
2449
|
+
chalk35.gray(` ${message.line}:${message.column}`),
|
|
2450
|
+
chalk35[colors[message.severity]](` ${severity[message.severity]}`),
|
|
2451
|
+
chalk35.white(` ${message.message}`),
|
|
2452
|
+
chalk35.gray(` ${message.ruleId}`)
|
|
2367
2453
|
);
|
|
2368
2454
|
}
|
|
2369
2455
|
}
|
|
@@ -2380,7 +2466,7 @@ function getFiles(dir, ignoreFolders) {
|
|
|
2380
2466
|
const currentDirectory = cwd4();
|
|
2381
2467
|
const subDirectory = dir.split(currentDirectory)[1]?.split("/")[1];
|
|
2382
2468
|
if (ignoreFolders.includes(subDirectory)) return [];
|
|
2383
|
-
return
|
|
2469
|
+
return readdirSync4(dir, { withFileTypes: true }).flatMap((dirent) => {
|
|
2384
2470
|
const res = path12.resolve(dir, dirent.name);
|
|
2385
2471
|
const relativePath = subDirectory === void 0 ? dirent.name : `${subDirectory}/${dirent.name}`;
|
|
2386
2472
|
const ignoreMatchers = ignoreFolders.map((pattern) => picomatch(pattern));
|
|
@@ -2401,10 +2487,10 @@ var packageLint = async (fix2 = false, verbose = false, cache = true) => {
|
|
|
2401
2487
|
cache
|
|
2402
2488
|
});
|
|
2403
2489
|
const files = getFiles(cwd4(), ignoreFolders);
|
|
2404
|
-
console.log(
|
|
2490
|
+
console.log(chalk35.green(`Linting ${pkg} [files = ${files.length}]`));
|
|
2405
2491
|
if (verbose) {
|
|
2406
2492
|
for (const file of files) {
|
|
2407
|
-
console.log(
|
|
2493
|
+
console.log(chalk35.gray(` ${file}`));
|
|
2408
2494
|
}
|
|
2409
2495
|
}
|
|
2410
2496
|
const lintResults = await engine.lintFiles(files);
|
|
@@ -2415,32 +2501,32 @@ var packageLint = async (fix2 = false, verbose = false, cache = true) => {
|
|
|
2415
2501
|
const filesCountColor = files.length < 100 ? "green" : files.length < 1e3 ? "yellow" : "red";
|
|
2416
2502
|
const lintTime = Date.now() - start;
|
|
2417
2503
|
const lintTimeColor = lintTime < 1e3 ? "green" : lintTime < 3e3 ? "yellow" : "red";
|
|
2418
|
-
console.log(
|
|
2504
|
+
console.log(chalk35.white(`Linted ${chalk35[filesCountColor](files.length)} files in ${chalk35[lintTimeColor](lintTime)}ms`));
|
|
2419
2505
|
return lintResults.reduce((prev, lintResult) => prev + lintResult.errorCount, 0);
|
|
2420
2506
|
};
|
|
2421
2507
|
|
|
2422
2508
|
// src/actions/package/publint.ts
|
|
2423
2509
|
import { promises as fs9 } from "fs";
|
|
2424
|
-
import
|
|
2510
|
+
import chalk36 from "chalk";
|
|
2425
2511
|
import sortPackageJson from "sort-package-json";
|
|
2426
2512
|
var customPubLint = (pkg) => {
|
|
2427
2513
|
let errorCount = 0;
|
|
2428
2514
|
let warningCount = 0;
|
|
2429
2515
|
if (pkg.files === void 0) {
|
|
2430
|
-
console.warn(
|
|
2516
|
+
console.warn(chalk36.yellow('Publint [custom]: "files" field is missing'));
|
|
2431
2517
|
warningCount++;
|
|
2432
2518
|
}
|
|
2433
2519
|
if (pkg.main !== void 0) {
|
|
2434
|
-
console.warn(
|
|
2520
|
+
console.warn(chalk36.yellow('Publint [custom]: "main" field is deprecated, use "exports" instead'));
|
|
2435
2521
|
warningCount++;
|
|
2436
2522
|
}
|
|
2437
2523
|
if (pkg.sideEffects !== false) {
|
|
2438
|
-
console.warn(
|
|
2524
|
+
console.warn(chalk36.yellow('Publint [custom]: "sideEffects" field should be set to false'));
|
|
2439
2525
|
warningCount++;
|
|
2440
2526
|
}
|
|
2441
2527
|
if (pkg.resolutions !== void 0) {
|
|
2442
|
-
console.warn(
|
|
2443
|
-
console.warn(
|
|
2528
|
+
console.warn(chalk36.yellow('Publint [custom]: "resolutions" in use'));
|
|
2529
|
+
console.warn(chalk36.gray(JSON.stringify(pkg.resolutions, null, 2)));
|
|
2444
2530
|
warningCount++;
|
|
2445
2531
|
}
|
|
2446
2532
|
return [errorCount, warningCount];
|
|
@@ -2450,8 +2536,8 @@ var packagePublint = async ({ strict = true, verbose = false } = {}) => {
|
|
|
2450
2536
|
const sortedPkg = sortPackageJson(await fs9.readFile(`${pkgDir}/package.json`, "utf8"));
|
|
2451
2537
|
await fs9.writeFile(`${pkgDir}/package.json`, sortedPkg);
|
|
2452
2538
|
const pkg = JSON.parse(await fs9.readFile(`${pkgDir}/package.json`, "utf8"));
|
|
2453
|
-
console.log(
|
|
2454
|
-
console.log(
|
|
2539
|
+
console.log(chalk36.green(`Publint: ${pkg.name}`));
|
|
2540
|
+
console.log(chalk36.gray(pkgDir));
|
|
2455
2541
|
const { publint: publint2 } = await import("publint");
|
|
2456
2542
|
const { messages } = await publint2({
|
|
2457
2543
|
level: "suggestion",
|
|
@@ -2462,22 +2548,22 @@ var packagePublint = async ({ strict = true, verbose = false } = {}) => {
|
|
|
2462
2548
|
for (const message of messages) {
|
|
2463
2549
|
switch (message.type) {
|
|
2464
2550
|
case "error": {
|
|
2465
|
-
console.error(
|
|
2551
|
+
console.error(chalk36.red(`[${message.code}] ${formatMessage(message, pkg)}`));
|
|
2466
2552
|
break;
|
|
2467
2553
|
}
|
|
2468
2554
|
case "warning": {
|
|
2469
|
-
console.warn(
|
|
2555
|
+
console.warn(chalk36.yellow(`[${message.code}] ${formatMessage(message, pkg)}`));
|
|
2470
2556
|
break;
|
|
2471
2557
|
}
|
|
2472
2558
|
default: {
|
|
2473
|
-
console.log(
|
|
2559
|
+
console.log(chalk36.white(`[${message.code}] ${formatMessage(message, pkg)}`));
|
|
2474
2560
|
break;
|
|
2475
2561
|
}
|
|
2476
2562
|
}
|
|
2477
2563
|
}
|
|
2478
2564
|
const [errorCount, warningCount] = customPubLint(pkg);
|
|
2479
2565
|
if (verbose) {
|
|
2480
|
-
console.log(
|
|
2566
|
+
console.log(chalk36.gray(`Publint [Finish]: ${pkgDir} [${messages.length + errorCount + warningCount} messages]`));
|
|
2481
2567
|
}
|
|
2482
2568
|
return messages.filter((message) => message.type === "error").length + errorCount;
|
|
2483
2569
|
};
|
|
@@ -2513,7 +2599,7 @@ var rebuild = ({ target }) => {
|
|
|
2513
2599
|
};
|
|
2514
2600
|
|
|
2515
2601
|
// src/actions/recompile.ts
|
|
2516
|
-
import
|
|
2602
|
+
import chalk37 from "chalk";
|
|
2517
2603
|
var recompile = async ({
|
|
2518
2604
|
verbose,
|
|
2519
2605
|
target,
|
|
@@ -2549,7 +2635,7 @@ var recompileAll = async ({
|
|
|
2549
2635
|
const incrementalOptions = incremental ? ["--since", "-Apt", "--topological-dev"] : ["--parallel", "-Apt", "--topological-dev"];
|
|
2550
2636
|
const jobsOptions = jobs ? ["-j", `${jobs}`] : [];
|
|
2551
2637
|
if (jobs) {
|
|
2552
|
-
console.log(
|
|
2638
|
+
console.log(chalk37.blue(`Jobs set to [${jobs}]`));
|
|
2553
2639
|
}
|
|
2554
2640
|
const result = await runStepsAsync(`Recompile${incremental ? "-Incremental" : ""} [All]`, [
|
|
2555
2641
|
[
|
|
@@ -2580,7 +2666,7 @@ var recompileAll = async ({
|
|
|
2580
2666
|
]
|
|
2581
2667
|
]);
|
|
2582
2668
|
console.log(
|
|
2583
|
-
`${
|
|
2669
|
+
`${chalk37.gray("Recompiled in")} [${chalk37.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk37.gray("seconds")}`
|
|
2584
2670
|
);
|
|
2585
2671
|
return result;
|
|
2586
2672
|
};
|
|
@@ -2611,13 +2697,13 @@ var reinstall = () => {
|
|
|
2611
2697
|
};
|
|
2612
2698
|
|
|
2613
2699
|
// src/actions/relint.ts
|
|
2614
|
-
import
|
|
2700
|
+
import chalk38 from "chalk";
|
|
2615
2701
|
var relintPackage = ({
|
|
2616
2702
|
pkg,
|
|
2617
2703
|
fix: fix2,
|
|
2618
2704
|
verbose
|
|
2619
2705
|
}) => {
|
|
2620
|
-
console.log(
|
|
2706
|
+
console.log(chalk38.gray(`${fix2 ? "Fix" : "Lint"} [${pkg}]`));
|
|
2621
2707
|
const start = Date.now();
|
|
2622
2708
|
const result = runSteps(`${fix2 ? "Fix" : "Lint"} [${pkg}]`, [
|
|
2623
2709
|
["yarn", [
|
|
@@ -2627,7 +2713,7 @@ var relintPackage = ({
|
|
|
2627
2713
|
fix2 ? "package-fix" : verbose ? "package-lint-verbose" : "package-lint"
|
|
2628
2714
|
]]
|
|
2629
2715
|
]);
|
|
2630
|
-
console.log(
|
|
2716
|
+
console.log(chalk38.gray(`${fix2 ? "Fixed in" : "Linted in"} [${chalk38.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk38.gray("seconds")}`));
|
|
2631
2717
|
return result;
|
|
2632
2718
|
};
|
|
2633
2719
|
var relint = ({
|
|
@@ -2647,13 +2733,13 @@ var relint = ({
|
|
|
2647
2733
|
});
|
|
2648
2734
|
};
|
|
2649
2735
|
var relintAllPackages = ({ fix: fix2 = false } = {}) => {
|
|
2650
|
-
console.log(
|
|
2736
|
+
console.log(chalk38.gray(`${fix2 ? "Fix" : "Lint"} [All-Packages]`));
|
|
2651
2737
|
const start = Date.now();
|
|
2652
2738
|
const fixOptions = fix2 ? ["--fix"] : [];
|
|
2653
2739
|
const result = runSteps(`${fix2 ? "Fix" : "Lint"} [All-Packages]`, [
|
|
2654
2740
|
["yarn", ["eslint", ...fixOptions]]
|
|
2655
2741
|
]);
|
|
2656
|
-
console.log(
|
|
2742
|
+
console.log(chalk38.gray(`${fix2 ? "Fixed in" : "Linted in"} [${chalk38.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk38.gray("seconds")}`));
|
|
2657
2743
|
return result;
|
|
2658
2744
|
};
|
|
2659
2745
|
|
|
@@ -2671,10 +2757,10 @@ var sonar = () => {
|
|
|
2671
2757
|
};
|
|
2672
2758
|
|
|
2673
2759
|
// src/actions/statics.ts
|
|
2674
|
-
import
|
|
2760
|
+
import chalk39 from "chalk";
|
|
2675
2761
|
var DefaultDependencies = ["axios", "@xylabs/pixel", "react", "graphql", "react-router", "@mui/material", "@mui/system"];
|
|
2676
2762
|
var statics = () => {
|
|
2677
|
-
console.log(
|
|
2763
|
+
console.log(chalk39.green("Check Required Static Dependencies"));
|
|
2678
2764
|
const statics2 = parsedPackageJSON()?.xy?.deps?.statics;
|
|
2679
2765
|
return detectDuplicateDependencies(statics2, DefaultDependencies);
|
|
2680
2766
|
};
|
|
@@ -2731,7 +2817,7 @@ var loadPackageConfig = async () => {
|
|
|
2731
2817
|
};
|
|
2732
2818
|
|
|
2733
2819
|
// src/xy/xy.ts
|
|
2734
|
-
import
|
|
2820
|
+
import chalk41 from "chalk";
|
|
2735
2821
|
|
|
2736
2822
|
// src/xy/xyBuildCommands.ts
|
|
2737
2823
|
var xyBuildCommands = (args) => {
|
|
@@ -2839,6 +2925,14 @@ var packagePositionalParam = (yargs2) => {
|
|
|
2839
2925
|
// src/xy/xyCommonCommands.ts
|
|
2840
2926
|
var xyCommonCommands = (args) => {
|
|
2841
2927
|
return args.command(
|
|
2928
|
+
"claude-commands",
|
|
2929
|
+
"Claude Commands - Sync XY Labs standard Claude slash commands to .claude/commands/",
|
|
2930
|
+
(yargs2) => yargs2,
|
|
2931
|
+
(argv) => {
|
|
2932
|
+
if (argv.verbose) console.log("Claude Commands");
|
|
2933
|
+
process.exitCode = claudeCommands();
|
|
2934
|
+
}
|
|
2935
|
+
).command(
|
|
2842
2936
|
"claude-rules",
|
|
2843
2937
|
"Claude Rules - Sync XY Labs standard Claude rules to .claude/rules/",
|
|
2844
2938
|
(yargs2) => {
|
|
@@ -3100,7 +3194,7 @@ var xyInstallCommands = (args) => {
|
|
|
3100
3194
|
};
|
|
3101
3195
|
|
|
3102
3196
|
// src/xy/xyLintCommands.ts
|
|
3103
|
-
import
|
|
3197
|
+
import chalk40 from "chalk";
|
|
3104
3198
|
var xyLintCommands = (args) => {
|
|
3105
3199
|
return args.command(
|
|
3106
3200
|
"cycle [package]",
|
|
@@ -3112,7 +3206,7 @@ var xyLintCommands = (args) => {
|
|
|
3112
3206
|
const start = Date.now();
|
|
3113
3207
|
if (argv.verbose) console.log("Cycle");
|
|
3114
3208
|
process.exitCode = await cycle({ pkg: argv.package });
|
|
3115
|
-
console.log(
|
|
3209
|
+
console.log(chalk40.blue(`Finished in ${Date.now() - start}ms`));
|
|
3116
3210
|
}
|
|
3117
3211
|
).command(
|
|
3118
3212
|
"lint [package]",
|
|
@@ -3142,7 +3236,7 @@ var xyLintCommands = (args) => {
|
|
|
3142
3236
|
cache: argv.cache,
|
|
3143
3237
|
verbose: !!argv.verbose
|
|
3144
3238
|
});
|
|
3145
|
-
console.log(
|
|
3239
|
+
console.log(chalk40.blue(`Finished in ${Date.now() - start}ms`));
|
|
3146
3240
|
}
|
|
3147
3241
|
).command(
|
|
3148
3242
|
"deplint [package]",
|
|
@@ -3175,7 +3269,7 @@ var xyLintCommands = (args) => {
|
|
|
3175
3269
|
peerDeps: !!argv.peerDeps,
|
|
3176
3270
|
verbose: !!argv.verbose
|
|
3177
3271
|
});
|
|
3178
|
-
console.log(
|
|
3272
|
+
console.log(chalk40.blue(`Finished in ${Date.now() - start}ms`));
|
|
3179
3273
|
}
|
|
3180
3274
|
).command(
|
|
3181
3275
|
"fix [package]",
|
|
@@ -3187,7 +3281,7 @@ var xyLintCommands = (args) => {
|
|
|
3187
3281
|
const start = Date.now();
|
|
3188
3282
|
if (argv.verbose) console.log("Fix");
|
|
3189
3283
|
process.exitCode = fix();
|
|
3190
|
-
console.log(
|
|
3284
|
+
console.log(chalk40.blue(`Finished in ${Date.now() - start}ms`));
|
|
3191
3285
|
}
|
|
3192
3286
|
).command(
|
|
3193
3287
|
"relint [package]",
|
|
@@ -3199,7 +3293,7 @@ var xyLintCommands = (args) => {
|
|
|
3199
3293
|
if (argv.verbose) console.log("Relinting");
|
|
3200
3294
|
const start = Date.now();
|
|
3201
3295
|
process.exitCode = relint();
|
|
3202
|
-
console.log(
|
|
3296
|
+
console.log(chalk40.blue(`Finished in ${Date.now() - start}ms`));
|
|
3203
3297
|
}
|
|
3204
3298
|
).command(
|
|
3205
3299
|
"publint [package]",
|
|
@@ -3211,7 +3305,7 @@ var xyLintCommands = (args) => {
|
|
|
3211
3305
|
if (argv.verbose) console.log("Publint");
|
|
3212
3306
|
const start = Date.now();
|
|
3213
3307
|
process.exitCode = await publint({ pkg: argv.package, verbose: !!argv.verbose });
|
|
3214
|
-
console.log(
|
|
3308
|
+
console.log(chalk40.blue(`Finished in ${Date.now() - start}ms`));
|
|
3215
3309
|
}
|
|
3216
3310
|
).command(
|
|
3217
3311
|
"knip",
|
|
@@ -3223,7 +3317,7 @@ var xyLintCommands = (args) => {
|
|
|
3223
3317
|
if (argv.verbose) console.log("Knip");
|
|
3224
3318
|
const start = Date.now();
|
|
3225
3319
|
process.exitCode = knip();
|
|
3226
|
-
console.log(
|
|
3320
|
+
console.log(chalk40.blue(`Knip finished in ${Date.now() - start}ms`));
|
|
3227
3321
|
}
|
|
3228
3322
|
).command(
|
|
3229
3323
|
"sonar",
|
|
@@ -3235,7 +3329,7 @@ var xyLintCommands = (args) => {
|
|
|
3235
3329
|
const start = Date.now();
|
|
3236
3330
|
if (argv.verbose) console.log("Sonar Check");
|
|
3237
3331
|
process.exitCode = sonar();
|
|
3238
|
-
console.log(
|
|
3332
|
+
console.log(chalk40.blue(`Finished in ${Date.now() - start}ms`));
|
|
3239
3333
|
}
|
|
3240
3334
|
);
|
|
3241
3335
|
};
|
|
@@ -3271,8 +3365,8 @@ var xyParseOptions = () => {
|
|
|
3271
3365
|
var xy = async () => {
|
|
3272
3366
|
const options = xyParseOptions();
|
|
3273
3367
|
return await xyBuildCommands(xyCommonCommands(xyInstallCommands(xyDeployCommands(xyLintCommands(options))))).demandCommand(1).command("*", "", () => {
|
|
3274
|
-
console.error(
|
|
3275
|
-
console.log(
|
|
3368
|
+
console.error(chalk41.yellow(`Command not found [${chalk41.magenta(process.argv[2])}]`));
|
|
3369
|
+
console.log(chalk41.gray("Try 'yarn xy --help' for list of commands"));
|
|
3276
3370
|
}).version().help().argv;
|
|
3277
3371
|
};
|
|
3278
3372
|
export {
|
|
@@ -3280,10 +3374,13 @@ export {
|
|
|
3280
3374
|
DuplicateDetector,
|
|
3281
3375
|
INIT_CWD,
|
|
3282
3376
|
WINDOWS_NEWLINE_REGEX,
|
|
3377
|
+
XYLABS_COMMANDS_PREFIX,
|
|
3283
3378
|
XYLABS_RULES_PREFIX,
|
|
3284
3379
|
build,
|
|
3285
3380
|
bundleDts,
|
|
3286
3381
|
checkResult,
|
|
3382
|
+
claudeCommandTemplates,
|
|
3383
|
+
claudeCommands,
|
|
3287
3384
|
claudeMdProjectTemplate,
|
|
3288
3385
|
claudeMdRuleTemplates,
|
|
3289
3386
|
claudeRules,
|