@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/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 {
|
|
@@ -1827,13 +1907,19 @@ var packageCompileTsc = (platform, entries, srcDir = "src", outDir = "dist", com
|
|
|
1827
1907
|
);
|
|
1828
1908
|
console.error(formattedDiagnostics);
|
|
1829
1909
|
}
|
|
1830
|
-
|
|
1910
|
+
const nonEmitPatterns = [".stories.", "/stories/", ".spec.", "/spec/", ".example."];
|
|
1911
|
+
program.emit(void 0, (fileName, text, writeByteOrderMark) => {
|
|
1912
|
+
if (nonEmitPatterns.some((pattern) => fileName.includes(pattern))) {
|
|
1913
|
+
return;
|
|
1914
|
+
}
|
|
1915
|
+
ts2.sys.writeFile(fileName, text, writeByteOrderMark);
|
|
1916
|
+
});
|
|
1831
1917
|
return diagnostics.reduce((acc, diag) => acc + (diag.category === DiagnosticCategory.Error ? 1 : 0), 0);
|
|
1832
1918
|
}
|
|
1833
1919
|
return 0;
|
|
1834
1920
|
} finally {
|
|
1835
1921
|
if (verbose) {
|
|
1836
|
-
console.log(
|
|
1922
|
+
console.log(chalk28.cyan(`Validating code FINISH: ${entries.length} files to ${outDir} from ${srcDir}`));
|
|
1837
1923
|
}
|
|
1838
1924
|
}
|
|
1839
1925
|
};
|
|
@@ -1841,7 +1927,7 @@ var packageCompileTsc = (platform, entries, srcDir = "src", outDir = "dist", com
|
|
|
1841
1927
|
// src/actions/package/compile/packageCompileTscTypes.ts
|
|
1842
1928
|
import path9 from "path";
|
|
1843
1929
|
import { cwd as cwd3 } from "process";
|
|
1844
|
-
import
|
|
1930
|
+
import chalk29 from "chalk";
|
|
1845
1931
|
import { rollup } from "rollup";
|
|
1846
1932
|
import dts from "rollup-plugin-dts";
|
|
1847
1933
|
import nodeExternals from "rollup-plugin-node-externals";
|
|
@@ -1866,8 +1952,8 @@ async function bundleDts(inputPath, outputPath, platform, options, verbose = fal
|
|
|
1866
1952
|
if (ignoredWarningCodes.has(warning.code ?? "")) {
|
|
1867
1953
|
return;
|
|
1868
1954
|
}
|
|
1869
|
-
console.warn(
|
|
1870
|
-
console.warn(
|
|
1955
|
+
console.warn(chalk29.yellow(`[${warning.code}] ${warning.message}`));
|
|
1956
|
+
console.warn(chalk29.gray(inputPath));
|
|
1871
1957
|
warn(warning);
|
|
1872
1958
|
}
|
|
1873
1959
|
});
|
|
@@ -1877,8 +1963,8 @@ async function bundleDts(inputPath, outputPath, platform, options, verbose = fal
|
|
|
1877
1963
|
});
|
|
1878
1964
|
} catch (ex) {
|
|
1879
1965
|
const error = ex;
|
|
1880
|
-
console.warn(
|
|
1881
|
-
console.warn(
|
|
1966
|
+
console.warn(chalk29.red(error));
|
|
1967
|
+
console.warn(chalk29.gray(inputPath));
|
|
1882
1968
|
}
|
|
1883
1969
|
if (verbose) {
|
|
1884
1970
|
console.log(`Bundled declarations written to ${outputPath}`);
|
|
@@ -1886,7 +1972,7 @@ async function bundleDts(inputPath, outputPath, platform, options, verbose = fal
|
|
|
1886
1972
|
}
|
|
1887
1973
|
var packageCompileTscTypes = async (entries, outDir, platform, srcDir = "build", verbose = false) => {
|
|
1888
1974
|
if (verbose) {
|
|
1889
|
-
console.log(
|
|
1975
|
+
console.log(chalk29.cyan(`Compiling Types START [${platform}]: ${entries.length} files to ${outDir} from ${srcDir}`));
|
|
1890
1976
|
console.log(`Entries: ${entries.join(", ")}`);
|
|
1891
1977
|
}
|
|
1892
1978
|
const pkg = process.env.INIT_CWD ?? cwd3();
|
|
@@ -1910,7 +1996,7 @@ var packageCompileTscTypes = async (entries, outDir, platform, srcDir = "build",
|
|
|
1910
1996
|
await bundleDts(`${srcRoot}/${entryTypeName}`, `${outDir}/${entryTypeName}`, platform, { compilerOptions }, verbose);
|
|
1911
1997
|
}));
|
|
1912
1998
|
if (verbose) {
|
|
1913
|
-
console.log(
|
|
1999
|
+
console.log(chalk29.cyan(`Compiling Types FINISH: ${entries.length} files to ${outDir} from ${srcDir}`));
|
|
1914
2000
|
}
|
|
1915
2001
|
return 0;
|
|
1916
2002
|
};
|
|
@@ -1922,15 +2008,15 @@ var compileFolder = async (srcDir, entries, buildDir, options, bundleTypes = fal
|
|
|
1922
2008
|
console.log(`compileFolder [${srcDir}, ${options?.outDir}]`);
|
|
1923
2009
|
}
|
|
1924
2010
|
if (entries.length === 0) {
|
|
1925
|
-
console.warn(
|
|
2011
|
+
console.warn(chalk30.yellow(`No entries found in ${srcDir} to compile`));
|
|
1926
2012
|
return 0;
|
|
1927
2013
|
}
|
|
1928
2014
|
if (verbose) {
|
|
1929
|
-
console.log(
|
|
2015
|
+
console.log(chalk30.gray(`buildDir [${buildDir}]`));
|
|
1930
2016
|
}
|
|
1931
2017
|
const validationResult = packageCompileTsc(options?.platform ?? "neutral", entries, srcDir, buildDir, void 0, verbose);
|
|
1932
2018
|
if (validationResult !== 0) {
|
|
1933
|
-
console.error(
|
|
2019
|
+
console.error(chalk30.red(`Compile:Validation had ${validationResult} errors`));
|
|
1934
2020
|
return validationResult;
|
|
1935
2021
|
}
|
|
1936
2022
|
const optionsParams = tsupOptions([{
|
|
@@ -1955,12 +2041,12 @@ var compileFolder = async (srcDir, entries, buildDir, options, bundleTypes = fal
|
|
|
1955
2041
|
})
|
|
1956
2042
|
)).flat();
|
|
1957
2043
|
if (verbose) {
|
|
1958
|
-
console.log(
|
|
1959
|
-
console.log(
|
|
2044
|
+
console.log(chalk30.cyan(`TSUP:build:start [${srcDir}]`));
|
|
2045
|
+
console.log(chalk30.gray(`TSUP:build:options [${JSON.stringify(optionsList, null, 2)}]`));
|
|
1960
2046
|
}
|
|
1961
2047
|
await Promise.all(optionsList.map((options2) => build2(options2)));
|
|
1962
2048
|
if (verbose) {
|
|
1963
|
-
console.log(
|
|
2049
|
+
console.log(chalk30.cyan(`TSUP:build:stop [${srcDir}]`));
|
|
1964
2050
|
}
|
|
1965
2051
|
if (bundleTypes) {
|
|
1966
2052
|
await packageCompileTscTypes(entries, outDir, options?.platform ?? "neutral", buildDir, verbose);
|
|
@@ -2071,14 +2157,14 @@ var packageCompileTsup = async (config2) => {
|
|
|
2071
2157
|
// src/actions/package/compile/compile.ts
|
|
2072
2158
|
var packageCompile = async (inConfig = {}) => {
|
|
2073
2159
|
const pkg = process.env.INIT_CWD;
|
|
2074
|
-
console.log(
|
|
2160
|
+
console.log(chalk31.green(`Compiling ${pkg}`));
|
|
2075
2161
|
const config2 = await loadConfig(inConfig);
|
|
2076
2162
|
return await packageCompileTsup(config2);
|
|
2077
2163
|
};
|
|
2078
2164
|
|
|
2079
2165
|
// src/actions/package/copy-assets.ts
|
|
2080
2166
|
import path10 from "path/posix";
|
|
2081
|
-
import
|
|
2167
|
+
import chalk32 from "chalk";
|
|
2082
2168
|
import cpy2 from "cpy";
|
|
2083
2169
|
var copyTargetAssets2 = async (target, name, location) => {
|
|
2084
2170
|
try {
|
|
@@ -2091,7 +2177,7 @@ var copyTargetAssets2 = async (target, name, location) => {
|
|
|
2091
2177
|
}
|
|
2092
2178
|
);
|
|
2093
2179
|
if (values.length > 0) {
|
|
2094
|
-
console.log(
|
|
2180
|
+
console.log(chalk32.green(`Copying Assets [${target.toUpperCase()}] - ${name} - ${location}`));
|
|
2095
2181
|
}
|
|
2096
2182
|
for (const value of values) {
|
|
2097
2183
|
console.log(`${value.split("/").pop()} => ./dist/${target}`);
|
|
@@ -2156,9 +2242,9 @@ var packageCycle = async () => {
|
|
|
2156
2242
|
};
|
|
2157
2243
|
|
|
2158
2244
|
// src/actions/package/gen-docs.ts
|
|
2159
|
-
import { existsSync as
|
|
2245
|
+
import { existsSync as existsSync6 } from "fs";
|
|
2160
2246
|
import path11 from "path";
|
|
2161
|
-
import
|
|
2247
|
+
import chalk33 from "chalk";
|
|
2162
2248
|
import {
|
|
2163
2249
|
Application,
|
|
2164
2250
|
ArgumentsReader,
|
|
@@ -2176,7 +2262,7 @@ var ExitCodes = {
|
|
|
2176
2262
|
};
|
|
2177
2263
|
var packageGenDocs = async () => {
|
|
2178
2264
|
const pkg = process.env.INIT_CWD;
|
|
2179
|
-
if (pkg !== void 0 && !
|
|
2265
|
+
if (pkg !== void 0 && !existsSync6(path11.join(pkg, "typedoc.json"))) {
|
|
2180
2266
|
return;
|
|
2181
2267
|
}
|
|
2182
2268
|
const app = await Application.bootstrap({
|
|
@@ -2262,16 +2348,16 @@ var runTypeDoc = async (app) => {
|
|
|
2262
2348
|
return ExitCodes.OutputError;
|
|
2263
2349
|
}
|
|
2264
2350
|
}
|
|
2265
|
-
console.log(
|
|
2351
|
+
console.log(chalk33.green(`${pkgName} - Ok`));
|
|
2266
2352
|
return ExitCodes.Ok;
|
|
2267
2353
|
};
|
|
2268
2354
|
|
|
2269
2355
|
// src/actions/package/lint.ts
|
|
2270
|
-
import { readdirSync as
|
|
2356
|
+
import { readdirSync as readdirSync4 } from "fs";
|
|
2271
2357
|
import path12 from "path";
|
|
2272
2358
|
import { cwd as cwd4 } from "process";
|
|
2273
2359
|
import { pathToFileURL } from "url";
|
|
2274
|
-
import
|
|
2360
|
+
import chalk34 from "chalk";
|
|
2275
2361
|
import { ESLint } from "eslint";
|
|
2276
2362
|
import { findUp } from "find-up";
|
|
2277
2363
|
import picomatch from "picomatch";
|
|
@@ -2280,14 +2366,14 @@ var dumpMessages = (lintResults) => {
|
|
|
2280
2366
|
const severity = ["none", "warning", "error"];
|
|
2281
2367
|
for (const lintResult of lintResults) {
|
|
2282
2368
|
if (lintResult.messages.length > 0) {
|
|
2283
|
-
console.log(
|
|
2369
|
+
console.log(chalk34.gray(`
|
|
2284
2370
|
${lintResult.filePath}`));
|
|
2285
2371
|
for (const message of lintResult.messages) {
|
|
2286
2372
|
console.log(
|
|
2287
|
-
|
|
2288
|
-
|
|
2289
|
-
|
|
2290
|
-
|
|
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}`)
|
|
2291
2377
|
);
|
|
2292
2378
|
}
|
|
2293
2379
|
}
|
|
@@ -2304,7 +2390,7 @@ function getFiles(dir, ignoreFolders) {
|
|
|
2304
2390
|
const currentDirectory = cwd4();
|
|
2305
2391
|
const subDirectory = dir.split(currentDirectory)[1]?.split("/")[1];
|
|
2306
2392
|
if (ignoreFolders.includes(subDirectory)) return [];
|
|
2307
|
-
return
|
|
2393
|
+
return readdirSync4(dir, { withFileTypes: true }).flatMap((dirent) => {
|
|
2308
2394
|
const res = path12.resolve(dir, dirent.name);
|
|
2309
2395
|
const relativePath = subDirectory === void 0 ? dirent.name : `${subDirectory}/${dirent.name}`;
|
|
2310
2396
|
const ignoreMatchers = ignoreFolders.map((pattern) => picomatch(pattern));
|
|
@@ -2325,10 +2411,10 @@ var packageLint = async (fix2 = false, verbose = false, cache = true) => {
|
|
|
2325
2411
|
cache
|
|
2326
2412
|
});
|
|
2327
2413
|
const files = getFiles(cwd4(), ignoreFolders);
|
|
2328
|
-
console.log(
|
|
2414
|
+
console.log(chalk34.green(`Linting ${pkg} [files = ${files.length}]`));
|
|
2329
2415
|
if (verbose) {
|
|
2330
2416
|
for (const file of files) {
|
|
2331
|
-
console.log(
|
|
2417
|
+
console.log(chalk34.gray(` ${file}`));
|
|
2332
2418
|
}
|
|
2333
2419
|
}
|
|
2334
2420
|
const lintResults = await engine.lintFiles(files);
|
|
@@ -2339,32 +2425,32 @@ var packageLint = async (fix2 = false, verbose = false, cache = true) => {
|
|
|
2339
2425
|
const filesCountColor = files.length < 100 ? "green" : files.length < 1e3 ? "yellow" : "red";
|
|
2340
2426
|
const lintTime = Date.now() - start;
|
|
2341
2427
|
const lintTimeColor = lintTime < 1e3 ? "green" : lintTime < 3e3 ? "yellow" : "red";
|
|
2342
|
-
console.log(
|
|
2428
|
+
console.log(chalk34.white(`Linted ${chalk34[filesCountColor](files.length)} files in ${chalk34[lintTimeColor](lintTime)}ms`));
|
|
2343
2429
|
return lintResults.reduce((prev, lintResult) => prev + lintResult.errorCount, 0);
|
|
2344
2430
|
};
|
|
2345
2431
|
|
|
2346
2432
|
// src/actions/package/publint.ts
|
|
2347
2433
|
import { promises as fs9 } from "fs";
|
|
2348
|
-
import
|
|
2434
|
+
import chalk35 from "chalk";
|
|
2349
2435
|
import sortPackageJson from "sort-package-json";
|
|
2350
2436
|
var customPubLint = (pkg) => {
|
|
2351
2437
|
let errorCount = 0;
|
|
2352
2438
|
let warningCount = 0;
|
|
2353
2439
|
if (pkg.files === void 0) {
|
|
2354
|
-
console.warn(
|
|
2440
|
+
console.warn(chalk35.yellow('Publint [custom]: "files" field is missing'));
|
|
2355
2441
|
warningCount++;
|
|
2356
2442
|
}
|
|
2357
2443
|
if (pkg.main !== void 0) {
|
|
2358
|
-
console.warn(
|
|
2444
|
+
console.warn(chalk35.yellow('Publint [custom]: "main" field is deprecated, use "exports" instead'));
|
|
2359
2445
|
warningCount++;
|
|
2360
2446
|
}
|
|
2361
2447
|
if (pkg.sideEffects !== false) {
|
|
2362
|
-
console.warn(
|
|
2448
|
+
console.warn(chalk35.yellow('Publint [custom]: "sideEffects" field should be set to false'));
|
|
2363
2449
|
warningCount++;
|
|
2364
2450
|
}
|
|
2365
2451
|
if (pkg.resolutions !== void 0) {
|
|
2366
|
-
console.warn(
|
|
2367
|
-
console.warn(
|
|
2452
|
+
console.warn(chalk35.yellow('Publint [custom]: "resolutions" in use'));
|
|
2453
|
+
console.warn(chalk35.gray(JSON.stringify(pkg.resolutions, null, 2)));
|
|
2368
2454
|
warningCount++;
|
|
2369
2455
|
}
|
|
2370
2456
|
return [errorCount, warningCount];
|
|
@@ -2374,8 +2460,8 @@ var packagePublint = async ({ strict = true, verbose = false } = {}) => {
|
|
|
2374
2460
|
const sortedPkg = sortPackageJson(await fs9.readFile(`${pkgDir}/package.json`, "utf8"));
|
|
2375
2461
|
await fs9.writeFile(`${pkgDir}/package.json`, sortedPkg);
|
|
2376
2462
|
const pkg = JSON.parse(await fs9.readFile(`${pkgDir}/package.json`, "utf8"));
|
|
2377
|
-
console.log(
|
|
2378
|
-
console.log(
|
|
2463
|
+
console.log(chalk35.green(`Publint: ${pkg.name}`));
|
|
2464
|
+
console.log(chalk35.gray(pkgDir));
|
|
2379
2465
|
const { publint: publint2 } = await import("publint");
|
|
2380
2466
|
const { messages } = await publint2({
|
|
2381
2467
|
level: "suggestion",
|
|
@@ -2386,22 +2472,22 @@ var packagePublint = async ({ strict = true, verbose = false } = {}) => {
|
|
|
2386
2472
|
for (const message of messages) {
|
|
2387
2473
|
switch (message.type) {
|
|
2388
2474
|
case "error": {
|
|
2389
|
-
console.error(
|
|
2475
|
+
console.error(chalk35.red(`[${message.code}] ${formatMessage(message, pkg)}`));
|
|
2390
2476
|
break;
|
|
2391
2477
|
}
|
|
2392
2478
|
case "warning": {
|
|
2393
|
-
console.warn(
|
|
2479
|
+
console.warn(chalk35.yellow(`[${message.code}] ${formatMessage(message, pkg)}`));
|
|
2394
2480
|
break;
|
|
2395
2481
|
}
|
|
2396
2482
|
default: {
|
|
2397
|
-
console.log(
|
|
2483
|
+
console.log(chalk35.white(`[${message.code}] ${formatMessage(message, pkg)}`));
|
|
2398
2484
|
break;
|
|
2399
2485
|
}
|
|
2400
2486
|
}
|
|
2401
2487
|
}
|
|
2402
2488
|
const [errorCount, warningCount] = customPubLint(pkg);
|
|
2403
2489
|
if (verbose) {
|
|
2404
|
-
console.log(
|
|
2490
|
+
console.log(chalk35.gray(`Publint [Finish]: ${pkgDir} [${messages.length + errorCount + warningCount} messages]`));
|
|
2405
2491
|
}
|
|
2406
2492
|
return messages.filter((message) => message.type === "error").length + errorCount;
|
|
2407
2493
|
};
|
|
@@ -2437,7 +2523,7 @@ var rebuild = ({ target }) => {
|
|
|
2437
2523
|
};
|
|
2438
2524
|
|
|
2439
2525
|
// src/actions/recompile.ts
|
|
2440
|
-
import
|
|
2526
|
+
import chalk36 from "chalk";
|
|
2441
2527
|
var recompile = async ({
|
|
2442
2528
|
verbose,
|
|
2443
2529
|
target,
|
|
@@ -2473,7 +2559,7 @@ var recompileAll = async ({
|
|
|
2473
2559
|
const incrementalOptions = incremental ? ["--since", "-Apt", "--topological-dev"] : ["--parallel", "-Apt", "--topological-dev"];
|
|
2474
2560
|
const jobsOptions = jobs ? ["-j", `${jobs}`] : [];
|
|
2475
2561
|
if (jobs) {
|
|
2476
|
-
console.log(
|
|
2562
|
+
console.log(chalk36.blue(`Jobs set to [${jobs}]`));
|
|
2477
2563
|
}
|
|
2478
2564
|
const result = await runStepsAsync(`Recompile${incremental ? "-Incremental" : ""} [All]`, [
|
|
2479
2565
|
[
|
|
@@ -2504,7 +2590,7 @@ var recompileAll = async ({
|
|
|
2504
2590
|
]
|
|
2505
2591
|
]);
|
|
2506
2592
|
console.log(
|
|
2507
|
-
`${
|
|
2593
|
+
`${chalk36.gray("Recompiled in")} [${chalk36.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk36.gray("seconds")}`
|
|
2508
2594
|
);
|
|
2509
2595
|
return result;
|
|
2510
2596
|
};
|
|
@@ -2535,13 +2621,13 @@ var reinstall = () => {
|
|
|
2535
2621
|
};
|
|
2536
2622
|
|
|
2537
2623
|
// src/actions/relint.ts
|
|
2538
|
-
import
|
|
2624
|
+
import chalk37 from "chalk";
|
|
2539
2625
|
var relintPackage = ({
|
|
2540
2626
|
pkg,
|
|
2541
2627
|
fix: fix2,
|
|
2542
2628
|
verbose
|
|
2543
2629
|
}) => {
|
|
2544
|
-
console.log(
|
|
2630
|
+
console.log(chalk37.gray(`${fix2 ? "Fix" : "Lint"} [${pkg}]`));
|
|
2545
2631
|
const start = Date.now();
|
|
2546
2632
|
const result = runSteps(`${fix2 ? "Fix" : "Lint"} [${pkg}]`, [
|
|
2547
2633
|
["yarn", [
|
|
@@ -2551,7 +2637,7 @@ var relintPackage = ({
|
|
|
2551
2637
|
fix2 ? "package-fix" : verbose ? "package-lint-verbose" : "package-lint"
|
|
2552
2638
|
]]
|
|
2553
2639
|
]);
|
|
2554
|
-
console.log(
|
|
2640
|
+
console.log(chalk37.gray(`${fix2 ? "Fixed in" : "Linted in"} [${chalk37.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk37.gray("seconds")}`));
|
|
2555
2641
|
return result;
|
|
2556
2642
|
};
|
|
2557
2643
|
var relint = ({
|
|
@@ -2571,13 +2657,13 @@ var relint = ({
|
|
|
2571
2657
|
});
|
|
2572
2658
|
};
|
|
2573
2659
|
var relintAllPackages = ({ fix: fix2 = false } = {}) => {
|
|
2574
|
-
console.log(
|
|
2660
|
+
console.log(chalk37.gray(`${fix2 ? "Fix" : "Lint"} [All-Packages]`));
|
|
2575
2661
|
const start = Date.now();
|
|
2576
2662
|
const fixOptions = fix2 ? ["--fix"] : [];
|
|
2577
2663
|
const result = runSteps(`${fix2 ? "Fix" : "Lint"} [All-Packages]`, [
|
|
2578
2664
|
["yarn", ["eslint", ...fixOptions]]
|
|
2579
2665
|
]);
|
|
2580
|
-
console.log(
|
|
2666
|
+
console.log(chalk37.gray(`${fix2 ? "Fixed in" : "Linted in"} [${chalk37.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk37.gray("seconds")}`));
|
|
2581
2667
|
return result;
|
|
2582
2668
|
};
|
|
2583
2669
|
|
|
@@ -2595,10 +2681,10 @@ var sonar = () => {
|
|
|
2595
2681
|
};
|
|
2596
2682
|
|
|
2597
2683
|
// src/actions/statics.ts
|
|
2598
|
-
import
|
|
2684
|
+
import chalk38 from "chalk";
|
|
2599
2685
|
var DefaultDependencies = ["axios", "@xylabs/pixel", "react", "graphql", "react-router", "@mui/material", "@mui/system"];
|
|
2600
2686
|
var statics = () => {
|
|
2601
|
-
console.log(
|
|
2687
|
+
console.log(chalk38.green("Check Required Static Dependencies"));
|
|
2602
2688
|
const statics2 = parsedPackageJSON()?.xy?.deps?.statics;
|
|
2603
2689
|
return detectDuplicateDependencies(statics2, DefaultDependencies);
|
|
2604
2690
|
};
|
|
@@ -2648,6 +2734,7 @@ var yarn3Only = () => {
|
|
|
2648
2734
|
export {
|
|
2649
2735
|
build,
|
|
2650
2736
|
bundleDts,
|
|
2737
|
+
claudeCommands,
|
|
2651
2738
|
claudeRules,
|
|
2652
2739
|
clean,
|
|
2653
2740
|
cleanAll,
|