@xylabs/ts-scripts-yarn3 7.4.19 → 7.4.21
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 +5 -1
- package/dist/actions/claude-commands.mjs.map +1 -1
- package/dist/actions/claude-rules.mjs +5 -1
- package/dist/actions/claude-rules.mjs.map +1 -1
- package/dist/actions/claude-skills.mjs +120 -0
- package/dist/actions/claude-skills.mjs.map +1 -0
- package/dist/actions/index.mjs +229 -127
- package/dist/actions/index.mjs.map +1 -1
- package/dist/bin/xy.mjs +239 -140
- package/dist/bin/xy.mjs.map +1 -1
- package/dist/index.d.ts +5 -1
- package/dist/index.mjs +299 -197
- package/dist/index.mjs.map +1 -1
- package/dist/lib/claudeMdTemplate.mjs +27 -2
- package/dist/lib/claudeMdTemplate.mjs.map +1 -1
- package/dist/lib/index.mjs +26 -1
- package/dist/lib/index.mjs.map +1 -1
- package/dist/xy/build-commands/build.mjs +502 -0
- package/dist/xy/build-commands/build.mjs.map +1 -0
- package/dist/xy/{build → build-commands}/index.mjs +40 -45
- package/dist/xy/build-commands/index.mjs.map +1 -0
- package/dist/xy/common/claude/commandsCommand.mjs +5 -1
- package/dist/xy/common/claude/commandsCommand.mjs.map +1 -1
- package/dist/xy/common/claude/index.mjs +111 -2
- package/dist/xy/common/claude/index.mjs.map +1 -1
- package/dist/xy/common/claude/initCommand.mjs +111 -1
- package/dist/xy/common/claude/initCommand.mjs.map +1 -1
- package/dist/xy/common/claude/rulesCommand.mjs +5 -1
- package/dist/xy/common/claude/rulesCommand.mjs.map +1 -1
- package/dist/xy/common/claude/skillsCommand.mjs +129 -0
- package/dist/xy/common/claude/skillsCommand.mjs.map +1 -0
- package/dist/xy/common/index.mjs +128 -19
- package/dist/xy/common/index.mjs.map +1 -1
- package/dist/xy/index.mjs +239 -140
- package/dist/xy/index.mjs.map +1 -1
- package/dist/xy/xy.mjs +239 -140
- package/dist/xy/xy.mjs.map +1 -1
- package/package.json +2 -2
- package/templates/claude/skills/xylabs-e2e-setup/SKILL.md +197 -0
- package/dist/xy/build/buildCommand.mjs +0 -161
- package/dist/xy/build/buildCommand.mjs.map +0 -1
- package/dist/xy/build/compileCommand.mjs +0 -174
- package/dist/xy/build/compileCommand.mjs.map +0 -1
- package/dist/xy/build/compileOnlyCommand.mjs +0 -175
- package/dist/xy/build/compileOnlyCommand.mjs.map +0 -1
- package/dist/xy/build/copyAssetsCommand.mjs +0 -84
- package/dist/xy/build/copyAssetsCommand.mjs.map +0 -1
- package/dist/xy/build/index.mjs.map +0 -1
- package/dist/xy/build/rebuildCommand.mjs +0 -114
- package/dist/xy/build/rebuildCommand.mjs.map +0 -1
- package/dist/xy/build/recompileCommand.mjs +0 -204
- package/dist/xy/build/recompileCommand.mjs.map +0 -1
package/dist/actions/index.mjs
CHANGED
|
@@ -15,7 +15,11 @@ var checkResult = (name, result, level = "error", exitOnFail = false) => {
|
|
|
15
15
|
};
|
|
16
16
|
|
|
17
17
|
// src/lib/claudeMdTemplate.ts
|
|
18
|
-
import {
|
|
18
|
+
import {
|
|
19
|
+
readdirSync,
|
|
20
|
+
readFileSync,
|
|
21
|
+
statSync
|
|
22
|
+
} from "fs";
|
|
19
23
|
import { createRequire } from "module";
|
|
20
24
|
import PATH from "path";
|
|
21
25
|
var require2 = createRequire(import.meta.url);
|
|
@@ -23,6 +27,7 @@ var packageRoot = PATH.dirname(require2.resolve("@xylabs/ts-scripts-yarn3/packag
|
|
|
23
27
|
var templatesDir = PATH.resolve(packageRoot, "templates", "claude");
|
|
24
28
|
var XYLABS_RULES_PREFIX = "xylabs-";
|
|
25
29
|
var XYLABS_COMMANDS_PREFIX = "xylabs-";
|
|
30
|
+
var XYLABS_SKILLS_PREFIX = "xylabs-";
|
|
26
31
|
var claudeMdRuleTemplates = () => {
|
|
27
32
|
const rulesDir = PATH.resolve(templatesDir, "rules");
|
|
28
33
|
const files = readdirSync(rulesDir).filter((f) => f.startsWith(XYLABS_RULES_PREFIX) && f.endsWith(".md"));
|
|
@@ -41,6 +46,24 @@ var claudeCommandTemplates = () => {
|
|
|
41
46
|
}
|
|
42
47
|
return result;
|
|
43
48
|
};
|
|
49
|
+
var claudeSkillTemplates = () => {
|
|
50
|
+
const skillsDir = PATH.resolve(templatesDir, "skills");
|
|
51
|
+
const dirs = readdirSync(skillsDir).filter(
|
|
52
|
+
(f) => f.startsWith(XYLABS_SKILLS_PREFIX) && statSync(PATH.resolve(skillsDir, f)).isDirectory()
|
|
53
|
+
);
|
|
54
|
+
const result = {};
|
|
55
|
+
for (const dir of dirs) {
|
|
56
|
+
const dirPath = PATH.resolve(skillsDir, dir);
|
|
57
|
+
const files = readdirSync(dirPath, { recursive: true, encoding: "utf8" });
|
|
58
|
+
result[dir] = {};
|
|
59
|
+
for (const file of files) {
|
|
60
|
+
if (statSync(PATH.resolve(dirPath, file)).isFile()) {
|
|
61
|
+
result[dir][file] = readFileSync(PATH.resolve(dirPath, file), "utf8");
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
return result;
|
|
66
|
+
};
|
|
44
67
|
var claudeMdProjectTemplate = () => readFileSync(PATH.resolve(templatesDir, "CLAUDE-project.md"), "utf8");
|
|
45
68
|
|
|
46
69
|
// src/lib/deleteGlob.ts
|
|
@@ -902,6 +925,84 @@ async function claudeSettings() {
|
|
|
902
925
|
return 0;
|
|
903
926
|
}
|
|
904
927
|
|
|
928
|
+
// src/actions/claude-skills.ts
|
|
929
|
+
import {
|
|
930
|
+
existsSync as existsSync7,
|
|
931
|
+
mkdirSync as mkdirSync4,
|
|
932
|
+
readdirSync as readdirSync4,
|
|
933
|
+
readFileSync as readFileSync7,
|
|
934
|
+
rmSync,
|
|
935
|
+
statSync as statSync2,
|
|
936
|
+
writeFileSync as writeFileSync5
|
|
937
|
+
} from "fs";
|
|
938
|
+
import PATH6 from "path";
|
|
939
|
+
import chalk13 from "chalk";
|
|
940
|
+
var syncSkillFiles = (skillsDir) => {
|
|
941
|
+
const templates = claudeSkillTemplates();
|
|
942
|
+
const templateNames = new Set(Object.keys(templates));
|
|
943
|
+
let updated = 0;
|
|
944
|
+
let created = 0;
|
|
945
|
+
for (const [skillName, files] of Object.entries(templates)) {
|
|
946
|
+
const skillDir = PATH6.resolve(skillsDir, skillName);
|
|
947
|
+
mkdirSync4(skillDir, { recursive: true });
|
|
948
|
+
for (const [filename3, content] of Object.entries(files)) {
|
|
949
|
+
const targetPath = PATH6.resolve(skillDir, filename3);
|
|
950
|
+
mkdirSync4(PATH6.dirname(targetPath), { recursive: true });
|
|
951
|
+
const existing = existsSync7(targetPath) ? readFileSync7(targetPath, "utf8") : void 0;
|
|
952
|
+
if (existing === content) continue;
|
|
953
|
+
writeFileSync5(targetPath, content, "utf8");
|
|
954
|
+
if (existing) {
|
|
955
|
+
updated++;
|
|
956
|
+
} else {
|
|
957
|
+
created++;
|
|
958
|
+
}
|
|
959
|
+
}
|
|
960
|
+
}
|
|
961
|
+
return {
|
|
962
|
+
created,
|
|
963
|
+
templateNames,
|
|
964
|
+
updated
|
|
965
|
+
};
|
|
966
|
+
};
|
|
967
|
+
var removeStaleSkills = (skillsDir, templateNames) => {
|
|
968
|
+
const existingSkills = readdirSync4(skillsDir).filter(
|
|
969
|
+
(f) => f.startsWith(XYLABS_SKILLS_PREFIX) && statSync2(PATH6.resolve(skillsDir, f)).isDirectory()
|
|
970
|
+
);
|
|
971
|
+
let removed = 0;
|
|
972
|
+
for (const dir of existingSkills) {
|
|
973
|
+
if (!templateNames.has(dir)) {
|
|
974
|
+
rmSync(PATH6.resolve(skillsDir, dir), { recursive: true });
|
|
975
|
+
removed++;
|
|
976
|
+
}
|
|
977
|
+
}
|
|
978
|
+
return removed;
|
|
979
|
+
};
|
|
980
|
+
var logSkillsResult = (created, updated, removed) => {
|
|
981
|
+
if (created || updated || removed) {
|
|
982
|
+
const parts = [
|
|
983
|
+
created ? `${created} created` : "",
|
|
984
|
+
updated ? `${updated} updated` : "",
|
|
985
|
+
removed ? `${removed} removed` : ""
|
|
986
|
+
].filter(Boolean);
|
|
987
|
+
console.log(chalk13.green(`.claude/skills/${XYLABS_SKILLS_PREFIX}*/: ${parts.join(", ")}`));
|
|
988
|
+
} else {
|
|
989
|
+
console.log(chalk13.gray(`.claude/skills/${XYLABS_SKILLS_PREFIX}*/: already up to date`));
|
|
990
|
+
}
|
|
991
|
+
};
|
|
992
|
+
var claudeSkills = () => {
|
|
993
|
+
const cwd5 = INIT_CWD() ?? process.cwd();
|
|
994
|
+
const skillsDir = PATH6.resolve(cwd5, ".claude", "skills");
|
|
995
|
+
mkdirSync4(skillsDir, { recursive: true });
|
|
996
|
+
const {
|
|
997
|
+
created,
|
|
998
|
+
templateNames,
|
|
999
|
+
updated
|
|
1000
|
+
} = syncSkillFiles(skillsDir);
|
|
1001
|
+
const removed = removeStaleSkills(skillsDir, templateNames);
|
|
1002
|
+
logSkillsResult(created, updated, removed);
|
|
1003
|
+
return 0;
|
|
1004
|
+
};
|
|
1005
|
+
|
|
905
1006
|
// src/actions/clean.ts
|
|
906
1007
|
var clean = async ({ verbose, pkg }) => {
|
|
907
1008
|
return pkg ? await cleanPackage({ pkg, verbose }) : cleanAll({ verbose });
|
|
@@ -916,16 +1017,16 @@ var cleanAll = ({ verbose }) => {
|
|
|
916
1017
|
|
|
917
1018
|
// src/actions/clean-docs.ts
|
|
918
1019
|
import path from "path";
|
|
919
|
-
import
|
|
1020
|
+
import chalk14 from "chalk";
|
|
920
1021
|
var cleanDocs = () => {
|
|
921
1022
|
const pkgName = process.env.npm_package_name;
|
|
922
|
-
console.log(
|
|
1023
|
+
console.log(chalk14.green(`Cleaning Docs [${pkgName}]`));
|
|
923
1024
|
for (const { location } of yarnWorkspaces()) deleteGlob(path.join(location, "docs"));
|
|
924
1025
|
return 0;
|
|
925
1026
|
};
|
|
926
1027
|
|
|
927
1028
|
// src/actions/compile.ts
|
|
928
|
-
import
|
|
1029
|
+
import chalk15 from "chalk";
|
|
929
1030
|
var compile = ({
|
|
930
1031
|
verbose,
|
|
931
1032
|
target,
|
|
@@ -966,7 +1067,7 @@ var compileAll = ({
|
|
|
966
1067
|
const incrementalOptions = incremental ? ["--since", "-Ap", "--topological-dev"] : ["--parallel", "-Ap", "--topological-dev"];
|
|
967
1068
|
const jobsOptions = jobs ? ["-j", `${jobs}`] : [];
|
|
968
1069
|
if (jobs) {
|
|
969
|
-
console.log(
|
|
1070
|
+
console.log(chalk15.blue(`Jobs set to [${jobs}]`));
|
|
970
1071
|
}
|
|
971
1072
|
const result = runSteps(`Compile${incremental ? "-Incremental" : ""} [All]`, [
|
|
972
1073
|
["yarn", [
|
|
@@ -980,13 +1081,13 @@ var compileAll = ({
|
|
|
980
1081
|
...targetOptions
|
|
981
1082
|
]]
|
|
982
1083
|
]);
|
|
983
|
-
console.log(`${
|
|
1084
|
+
console.log(`${chalk15.gray("Compiled in")} [${chalk15.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk15.gray("seconds")}`);
|
|
984
1085
|
return result;
|
|
985
1086
|
};
|
|
986
1087
|
|
|
987
1088
|
// src/actions/copy-assets.ts
|
|
988
1089
|
import path2 from "path/posix";
|
|
989
|
-
import
|
|
1090
|
+
import chalk16 from "chalk";
|
|
990
1091
|
import cpy from "cpy";
|
|
991
1092
|
var copyPackageTargetAssets = async (target, name, location) => {
|
|
992
1093
|
try {
|
|
@@ -1009,7 +1110,7 @@ var copyPackageTargetAssets = async (target, name, location) => {
|
|
|
1009
1110
|
};
|
|
1010
1111
|
var copyTargetAssets = async (target, pkg) => {
|
|
1011
1112
|
const workspaces = yarnWorkspaces();
|
|
1012
|
-
console.log(
|
|
1113
|
+
console.log(chalk16.green(`Copying Assets [${target.toUpperCase()}]`));
|
|
1013
1114
|
const workspaceList = workspaces.filter(({ name }) => {
|
|
1014
1115
|
return pkg === void 0 || name === pkg;
|
|
1015
1116
|
});
|
|
@@ -1093,7 +1194,7 @@ var dead = () => {
|
|
|
1093
1194
|
};
|
|
1094
1195
|
|
|
1095
1196
|
// src/actions/deplint/deplint.ts
|
|
1096
|
-
import
|
|
1197
|
+
import chalk22 from "chalk";
|
|
1097
1198
|
|
|
1098
1199
|
// src/actions/deplint/findFiles.ts
|
|
1099
1200
|
import fs2 from "fs";
|
|
@@ -1298,7 +1399,7 @@ function getExternalImportsFromFiles({
|
|
|
1298
1399
|
|
|
1299
1400
|
// src/actions/deplint/checkPackage/getUnlistedDependencies.ts
|
|
1300
1401
|
import { builtinModules } from "module";
|
|
1301
|
-
import
|
|
1402
|
+
import chalk17 from "chalk";
|
|
1302
1403
|
function isRuntimeImportListed(imp, name, dependencies, peerDependencies) {
|
|
1303
1404
|
return dependencies.includes(imp) || imp === name || peerDependencies.includes(imp) || builtinModules.includes(imp);
|
|
1304
1405
|
}
|
|
@@ -1306,7 +1407,7 @@ function isTypeImportListed(imp, name, dependencies, devDependencies, peerDepend
|
|
|
1306
1407
|
return dependencies.includes(imp) || imp === name || dependencies.includes(`@types/${imp}`) || peerDependencies.includes(imp) || peerDependencies.includes(`@types/${imp}`) || devDependencies.includes(`@types/${imp}`) || builtinModules.includes(imp);
|
|
1307
1408
|
}
|
|
1308
1409
|
function logMissing(name, imp, importPaths) {
|
|
1309
|
-
console.log(`[${
|
|
1410
|
+
console.log(`[${chalk17.blue(name)}] Missing dependency in package.json: ${chalk17.red(imp)}`);
|
|
1310
1411
|
if (importPaths[imp]) {
|
|
1311
1412
|
console.log(` ${importPaths[imp].join("\n ")}`);
|
|
1312
1413
|
}
|
|
@@ -1335,7 +1436,7 @@ function getUnlistedDependencies({ name, location }, {
|
|
|
1335
1436
|
}
|
|
1336
1437
|
if (unlistedDependencies > 0) {
|
|
1337
1438
|
const packageLocation = `${location}/package.json`;
|
|
1338
|
-
console.log(` ${
|
|
1439
|
+
console.log(` ${chalk17.yellow(packageLocation)}
|
|
1339
1440
|
`);
|
|
1340
1441
|
}
|
|
1341
1442
|
return unlistedDependencies;
|
|
@@ -1343,7 +1444,7 @@ function getUnlistedDependencies({ name, location }, {
|
|
|
1343
1444
|
|
|
1344
1445
|
// src/actions/deplint/checkPackage/getUnlistedDevDependencies.ts
|
|
1345
1446
|
import { builtinModules as builtinModules2 } from "module";
|
|
1346
|
-
import
|
|
1447
|
+
import chalk18 from "chalk";
|
|
1347
1448
|
function getUnlistedDevDependencies({ name, location }, {
|
|
1348
1449
|
devDependencies,
|
|
1349
1450
|
dependencies,
|
|
@@ -1357,7 +1458,7 @@ function getUnlistedDevDependencies({ name, location }, {
|
|
|
1357
1458
|
for (const imp of externalAllImports) {
|
|
1358
1459
|
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)) {
|
|
1359
1460
|
unlistedDevDependencies++;
|
|
1360
|
-
console.log(`[${
|
|
1461
|
+
console.log(`[${chalk18.blue(name)}] Missing devDependency in package.json: ${chalk18.red(imp)}`);
|
|
1361
1462
|
if (allImportPaths[imp]) {
|
|
1362
1463
|
console.log(` ${allImportPaths[imp].join("\n ")}`);
|
|
1363
1464
|
}
|
|
@@ -1365,14 +1466,14 @@ function getUnlistedDevDependencies({ name, location }, {
|
|
|
1365
1466
|
}
|
|
1366
1467
|
if (unlistedDevDependencies > 0) {
|
|
1367
1468
|
const packageLocation = `${location}/package.json`;
|
|
1368
|
-
console.log(` ${
|
|
1469
|
+
console.log(` ${chalk18.yellow(packageLocation)}
|
|
1369
1470
|
`);
|
|
1370
1471
|
}
|
|
1371
1472
|
return unlistedDevDependencies;
|
|
1372
1473
|
}
|
|
1373
1474
|
|
|
1374
1475
|
// src/actions/deplint/checkPackage/getUnusedDependencies.ts
|
|
1375
|
-
import
|
|
1476
|
+
import chalk19 from "chalk";
|
|
1376
1477
|
function getUnusedDependencies({ name, location }, { dependencies }, {
|
|
1377
1478
|
externalDistImports,
|
|
1378
1479
|
externalDistTypeImports,
|
|
@@ -1384,22 +1485,22 @@ function getUnusedDependencies({ name, location }, { dependencies }, {
|
|
|
1384
1485
|
if (!externalDistImports.includes(dep) && !externalDistImports.includes(dep.replace(/^@types\//, "")) && !externalDistTypeImports.includes(dep) && !externalDistTypeImports.includes(dep.replace(/^@types\//, ""))) {
|
|
1385
1486
|
unusedDependencies++;
|
|
1386
1487
|
if (externalAllImports.includes(dep)) {
|
|
1387
|
-
console.log(`[${
|
|
1488
|
+
console.log(`[${chalk19.blue(name)}] dependency should be devDependency in package.json: ${chalk19.red(dep)}`);
|
|
1388
1489
|
} else {
|
|
1389
|
-
console.log(`[${
|
|
1490
|
+
console.log(`[${chalk19.blue(name)}] Unused dependency in package.json: ${chalk19.red(dep)}`);
|
|
1390
1491
|
}
|
|
1391
1492
|
}
|
|
1392
1493
|
}
|
|
1393
1494
|
if (unusedDependencies > 0) {
|
|
1394
1495
|
const packageLocation = `${location}/package.json`;
|
|
1395
|
-
console.log(` ${
|
|
1496
|
+
console.log(` ${chalk19.yellow(packageLocation)}
|
|
1396
1497
|
`);
|
|
1397
1498
|
}
|
|
1398
1499
|
return unusedDependencies;
|
|
1399
1500
|
}
|
|
1400
1501
|
|
|
1401
1502
|
// src/actions/deplint/checkPackage/getUnusedDevDependencies.ts
|
|
1402
|
-
import
|
|
1503
|
+
import chalk20 from "chalk";
|
|
1403
1504
|
|
|
1404
1505
|
// src/actions/deplint/getCliReferencedPackagesFromFiles.ts
|
|
1405
1506
|
import fs8 from "fs";
|
|
@@ -1683,19 +1784,19 @@ function getUnusedDevDependencies({ name, location }, {
|
|
|
1683
1784
|
if (dependencies.includes(dep) || peerDependencies.includes(dep)) continue;
|
|
1684
1785
|
if (!isDevDepUsed(dep, allImports, implicitDeps, requiredPeers, scriptRefs, cliRefs)) {
|
|
1685
1786
|
unusedDevDependencies++;
|
|
1686
|
-
console.log(`[${
|
|
1787
|
+
console.log(`[${chalk20.blue(name)}] Unused devDependency in package.json: ${chalk20.red(dep)}`);
|
|
1687
1788
|
}
|
|
1688
1789
|
}
|
|
1689
1790
|
if (unusedDevDependencies > 0) {
|
|
1690
1791
|
const packageLocation = `${location}/package.json`;
|
|
1691
|
-
console.log(` ${
|
|
1792
|
+
console.log(` ${chalk20.yellow(packageLocation)}
|
|
1692
1793
|
`);
|
|
1693
1794
|
}
|
|
1694
1795
|
return unusedDevDependencies;
|
|
1695
1796
|
}
|
|
1696
1797
|
|
|
1697
1798
|
// src/actions/deplint/checkPackage/getUnusedPeerDependencies.ts
|
|
1698
|
-
import
|
|
1799
|
+
import chalk21 from "chalk";
|
|
1699
1800
|
function getUnusedPeerDependencies({ name, location }, { peerDependencies, dependencies }, { externalDistImports, externalDistTypeImports }, exclude) {
|
|
1700
1801
|
let unusedDependencies = 0;
|
|
1701
1802
|
for (const dep of peerDependencies) {
|
|
@@ -1703,15 +1804,15 @@ function getUnusedPeerDependencies({ name, location }, { peerDependencies, depen
|
|
|
1703
1804
|
if (!externalDistImports.includes(dep) && !externalDistImports.includes(dep.replace(/^@types\//, "")) && !externalDistTypeImports.includes(dep) && !externalDistTypeImports.includes(dep.replace(/^@types\//, ""))) {
|
|
1704
1805
|
unusedDependencies++;
|
|
1705
1806
|
if (dependencies.includes(dep)) {
|
|
1706
|
-
console.log(`[${
|
|
1807
|
+
console.log(`[${chalk21.blue(name)}] Unused peerDependency [already a dependency] in package.json: ${chalk21.red(dep)}`);
|
|
1707
1808
|
} else {
|
|
1708
|
-
console.log(`[${
|
|
1809
|
+
console.log(`[${chalk21.blue(name)}] Unused peerDependency in package.json: ${chalk21.red(dep)}`);
|
|
1709
1810
|
}
|
|
1710
1811
|
}
|
|
1711
1812
|
}
|
|
1712
1813
|
if (unusedDependencies > 0) {
|
|
1713
1814
|
const packageLocation = `${location}/package.json`;
|
|
1714
|
-
console.log(` ${
|
|
1815
|
+
console.log(` ${chalk21.yellow(packageLocation)}
|
|
1715
1816
|
`);
|
|
1716
1817
|
}
|
|
1717
1818
|
return unusedDependencies;
|
|
@@ -1806,19 +1907,19 @@ var deplint = async ({
|
|
|
1806
1907
|
});
|
|
1807
1908
|
}
|
|
1808
1909
|
if (totalErrors > 0) {
|
|
1809
|
-
console.warn(`Deplint: Found ${
|
|
1910
|
+
console.warn(`Deplint: Found ${chalk22.red(totalErrors)} dependency problems. ${chalk22.red("\u2716")}`);
|
|
1810
1911
|
} else {
|
|
1811
|
-
console.info(`Deplint: Found no dependency problems. ${
|
|
1912
|
+
console.info(`Deplint: Found no dependency problems. ${chalk22.green("\u2714")}`);
|
|
1812
1913
|
}
|
|
1813
1914
|
return 0;
|
|
1814
1915
|
};
|
|
1815
1916
|
|
|
1816
1917
|
// src/actions/deploy.ts
|
|
1817
|
-
import { readFileSync as
|
|
1918
|
+
import { readFileSync as readFileSync8 } from "fs";
|
|
1818
1919
|
var privatePackageExcludeList = () => {
|
|
1819
1920
|
const possibleDeployablePackages = yarnWorkspaces().map((workspace) => [
|
|
1820
1921
|
workspace,
|
|
1821
|
-
JSON.parse(
|
|
1922
|
+
JSON.parse(readFileSync8(`${workspace.location}/package.json`, { encoding: "utf8" }))
|
|
1822
1923
|
]);
|
|
1823
1924
|
const privatePackages = possibleDeployablePackages.filter(([_, pkg]) => pkg.private).map(([workspace]) => workspace);
|
|
1824
1925
|
const excludeList = privatePackages.map((workspace) => `--exclude ${workspace.name}`);
|
|
@@ -1838,11 +1939,11 @@ var deploy = () => {
|
|
|
1838
1939
|
};
|
|
1839
1940
|
|
|
1840
1941
|
// src/actions/deploy-major.ts
|
|
1841
|
-
import { readFileSync as
|
|
1942
|
+
import { readFileSync as readFileSync9 } from "fs";
|
|
1842
1943
|
var privatePackageExcludeList2 = () => {
|
|
1843
1944
|
const possibleDeployablePackages = yarnWorkspaces().map((workspace) => [
|
|
1844
1945
|
workspace,
|
|
1845
|
-
JSON.parse(
|
|
1946
|
+
JSON.parse(readFileSync9(`${workspace.location}/package.json`, { encoding: "utf8" }))
|
|
1846
1947
|
]);
|
|
1847
1948
|
const privatePackages = possibleDeployablePackages.filter(([_, pkg]) => pkg.private).map(([workspace]) => workspace);
|
|
1848
1949
|
const excludeList = privatePackages.map((workspace) => `--exclude ${workspace.name}`);
|
|
@@ -1862,11 +1963,11 @@ var deployMajor = () => {
|
|
|
1862
1963
|
};
|
|
1863
1964
|
|
|
1864
1965
|
// src/actions/deploy-minor.ts
|
|
1865
|
-
import { readFileSync as
|
|
1966
|
+
import { readFileSync as readFileSync10 } from "fs";
|
|
1866
1967
|
var privatePackageExcludeList3 = () => {
|
|
1867
1968
|
const possibleDeployablePackages = yarnWorkspaces().map((workspace) => [
|
|
1868
1969
|
workspace,
|
|
1869
|
-
JSON.parse(
|
|
1970
|
+
JSON.parse(readFileSync10(`${workspace.location}/package.json`, { encoding: "utf8" }))
|
|
1870
1971
|
]);
|
|
1871
1972
|
const privatePackages = possibleDeployablePackages.filter(([_, pkg]) => pkg.private).map(([workspace]) => workspace);
|
|
1872
1973
|
const excludeList = privatePackages.map((workspace) => `--exclude ${workspace.name}`);
|
|
@@ -1886,11 +1987,11 @@ var deployMinor = () => {
|
|
|
1886
1987
|
};
|
|
1887
1988
|
|
|
1888
1989
|
// src/actions/deploy-next.ts
|
|
1889
|
-
import { readFileSync as
|
|
1990
|
+
import { readFileSync as readFileSync11 } from "fs";
|
|
1890
1991
|
var privatePackageExcludeList4 = () => {
|
|
1891
1992
|
const possibleDeployablePackages = yarnWorkspaces().map((workspace) => [
|
|
1892
1993
|
workspace,
|
|
1893
|
-
JSON.parse(
|
|
1994
|
+
JSON.parse(readFileSync11(`${workspace.location}/package.json`, { encoding: "utf8" }))
|
|
1894
1995
|
]);
|
|
1895
1996
|
const privatePackages = possibleDeployablePackages.filter(([_, pkg]) => pkg.private).map(([workspace]) => workspace);
|
|
1896
1997
|
const excludeList = privatePackages.map((workspace) => `--exclude ${workspace.name}`);
|
|
@@ -1910,22 +2011,22 @@ var deployNext = () => {
|
|
|
1910
2011
|
};
|
|
1911
2012
|
|
|
1912
2013
|
// src/actions/dupdeps.ts
|
|
1913
|
-
import
|
|
2014
|
+
import chalk23 from "chalk";
|
|
1914
2015
|
var dupdeps = () => {
|
|
1915
|
-
console.log(
|
|
2016
|
+
console.log(chalk23.green("Checking all Dependencies for Duplicates"));
|
|
1916
2017
|
const allDependencies = parsedPackageJSON()?.dependencies;
|
|
1917
2018
|
const dependencies = Object.entries(allDependencies).map(([k]) => k);
|
|
1918
2019
|
return detectDuplicateDependencies(dependencies);
|
|
1919
2020
|
};
|
|
1920
2021
|
|
|
1921
2022
|
// src/actions/lint.ts
|
|
1922
|
-
import
|
|
2023
|
+
import chalk24 from "chalk";
|
|
1923
2024
|
var lintPackage = ({
|
|
1924
2025
|
pkg,
|
|
1925
2026
|
fix: fix2,
|
|
1926
2027
|
verbose
|
|
1927
2028
|
}) => {
|
|
1928
|
-
console.log(
|
|
2029
|
+
console.log(chalk24.gray(`${fix2 ? "Fix" : "Lint"} [${pkg}]`));
|
|
1929
2030
|
const start = Date.now();
|
|
1930
2031
|
const result = runSteps(`${fix2 ? "Fix" : "Lint"} [${pkg}]`, [
|
|
1931
2032
|
["yarn", [
|
|
@@ -1935,7 +2036,7 @@ var lintPackage = ({
|
|
|
1935
2036
|
fix2 ? "package-fix" : verbose ? "package-lint-verbose" : "package-lint"
|
|
1936
2037
|
]]
|
|
1937
2038
|
]);
|
|
1938
|
-
console.log(
|
|
2039
|
+
console.log(chalk24.gray(`${fix2 ? "Fixed in" : "Linted in"} [${chalk24.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk24.gray("seconds")}`));
|
|
1939
2040
|
return result;
|
|
1940
2041
|
};
|
|
1941
2042
|
var lint = ({
|
|
@@ -1955,13 +2056,13 @@ var lint = ({
|
|
|
1955
2056
|
});
|
|
1956
2057
|
};
|
|
1957
2058
|
var lintAllPackages = ({ fix: fix2 = false } = {}) => {
|
|
1958
|
-
console.log(
|
|
2059
|
+
console.log(chalk24.gray(`${fix2 ? "Fix" : "Lint"} [All-Packages]`));
|
|
1959
2060
|
const start = Date.now();
|
|
1960
2061
|
const fixOptions = fix2 ? ["--fix"] : [];
|
|
1961
2062
|
const result = runSteps(`${fix2 ? "Fix" : "Lint"} [All-Packages]`, [
|
|
1962
2063
|
["yarn", ["eslint", "--cache", "--cache-location", ".eslintcache", "--cache-strategy", "content", ...fixOptions]]
|
|
1963
2064
|
]);
|
|
1964
|
-
console.log(
|
|
2065
|
+
console.log(chalk24.gray(`${fix2 ? "Fixed in" : "Linted in"} [${chalk24.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk24.gray("seconds")}`));
|
|
1965
2066
|
return result;
|
|
1966
2067
|
};
|
|
1967
2068
|
|
|
@@ -1989,7 +2090,7 @@ var filename = ".gitignore";
|
|
|
1989
2090
|
var gitignoreGen = (pkg) => generateIgnoreFiles(filename, pkg);
|
|
1990
2091
|
|
|
1991
2092
|
// src/actions/gitlint.ts
|
|
1992
|
-
import
|
|
2093
|
+
import chalk25 from "chalk";
|
|
1993
2094
|
import ParseGitConfig from "parse-git-config";
|
|
1994
2095
|
var gitlint = () => {
|
|
1995
2096
|
console.log(`
|
|
@@ -2000,7 +2101,7 @@ Gitlint Start [${process.cwd()}]
|
|
|
2000
2101
|
const errors = 0;
|
|
2001
2102
|
const gitConfig = ParseGitConfig.sync();
|
|
2002
2103
|
const warn = (message) => {
|
|
2003
|
-
console.warn(
|
|
2104
|
+
console.warn(chalk25.yellow(`Warning: ${message}`));
|
|
2004
2105
|
warnings++;
|
|
2005
2106
|
};
|
|
2006
2107
|
if (gitConfig.core.ignorecase) {
|
|
@@ -2020,13 +2121,13 @@ Gitlint Start [${process.cwd()}]
|
|
|
2020
2121
|
}
|
|
2021
2122
|
const resultMessages = [];
|
|
2022
2123
|
if (valid > 0) {
|
|
2023
|
-
resultMessages.push(
|
|
2124
|
+
resultMessages.push(chalk25.green(`Passed: ${valid}`));
|
|
2024
2125
|
}
|
|
2025
2126
|
if (warnings > 0) {
|
|
2026
|
-
resultMessages.push(
|
|
2127
|
+
resultMessages.push(chalk25.yellow(`Warnings: ${warnings}`));
|
|
2027
2128
|
}
|
|
2028
2129
|
if (errors > 0) {
|
|
2029
|
-
resultMessages.push(
|
|
2130
|
+
resultMessages.push(chalk25.red(` Errors: ${errors}`));
|
|
2030
2131
|
}
|
|
2031
2132
|
console.warn(`Gitlint Finish [ ${resultMessages.join(" | ")} ]
|
|
2032
2133
|
`);
|
|
@@ -2035,7 +2136,7 @@ Gitlint Start [${process.cwd()}]
|
|
|
2035
2136
|
|
|
2036
2137
|
// src/actions/gitlint-fix.ts
|
|
2037
2138
|
import { execSync as execSync3 } from "child_process";
|
|
2038
|
-
import
|
|
2139
|
+
import chalk26 from "chalk";
|
|
2039
2140
|
import ParseGitConfig2 from "parse-git-config";
|
|
2040
2141
|
var gitlintFix = () => {
|
|
2041
2142
|
console.log(`
|
|
@@ -2044,15 +2145,15 @@ Gitlint Fix Start [${process.cwd()}]
|
|
|
2044
2145
|
const gitConfig = ParseGitConfig2.sync();
|
|
2045
2146
|
if (gitConfig.core.ignorecase) {
|
|
2046
2147
|
execSync3("git config core.ignorecase false", { stdio: "inherit" });
|
|
2047
|
-
console.warn(
|
|
2148
|
+
console.warn(chalk26.yellow("\nGitlint Fix: Updated core.ignorecase to be false\n"));
|
|
2048
2149
|
}
|
|
2049
2150
|
if (gitConfig.core.autocrlf !== false) {
|
|
2050
2151
|
execSync3("git config core.autocrlf false", { stdio: "inherit" });
|
|
2051
|
-
console.warn(
|
|
2152
|
+
console.warn(chalk26.yellow("\nGitlint Fix: Updated core.autocrlf to be false\n"));
|
|
2052
2153
|
}
|
|
2053
2154
|
if (gitConfig.core.eol !== "lf") {
|
|
2054
2155
|
execSync3("git config core.eol lf", { stdio: "inherit" });
|
|
2055
|
-
console.warn(
|
|
2156
|
+
console.warn(chalk26.yellow('\nGitlint Fix: Updated core.eol to be "lf"\n'));
|
|
2056
2157
|
}
|
|
2057
2158
|
return 1;
|
|
2058
2159
|
};
|
|
@@ -2063,7 +2164,7 @@ var knip = () => {
|
|
|
2063
2164
|
};
|
|
2064
2165
|
|
|
2065
2166
|
// src/actions/license.ts
|
|
2066
|
-
import
|
|
2167
|
+
import chalk27 from "chalk";
|
|
2067
2168
|
import { init } from "license-checker";
|
|
2068
2169
|
var license = async (pkg) => {
|
|
2069
2170
|
const workspaces = yarnWorkspaces();
|
|
@@ -2088,18 +2189,18 @@ var license = async (pkg) => {
|
|
|
2088
2189
|
"LGPL-3.0-or-later",
|
|
2089
2190
|
"Python-2.0"
|
|
2090
2191
|
]);
|
|
2091
|
-
console.log(
|
|
2192
|
+
console.log(chalk27.green("License Checker"));
|
|
2092
2193
|
return (await Promise.all(
|
|
2093
2194
|
workspaceList.map(({ location, name }) => {
|
|
2094
2195
|
return new Promise((resolve) => {
|
|
2095
2196
|
init({ production: true, start: location }, (error, packages) => {
|
|
2096
2197
|
if (error) {
|
|
2097
|
-
console.error(
|
|
2098
|
-
console.error(
|
|
2198
|
+
console.error(chalk27.red(`License Checker [${name}] Error`));
|
|
2199
|
+
console.error(chalk27.gray(error));
|
|
2099
2200
|
console.log("\n");
|
|
2100
2201
|
resolve(1);
|
|
2101
2202
|
} else {
|
|
2102
|
-
console.log(
|
|
2203
|
+
console.log(chalk27.green(`License Checker [${name}]`));
|
|
2103
2204
|
let count = 0;
|
|
2104
2205
|
for (const [name2, info] of Object.entries(packages)) {
|
|
2105
2206
|
const licenses = Array.isArray(info.licenses) ? info.licenses : [info.licenses];
|
|
@@ -2115,7 +2216,7 @@ var license = async (pkg) => {
|
|
|
2115
2216
|
}
|
|
2116
2217
|
if (!orLicenseFound) {
|
|
2117
2218
|
count++;
|
|
2118
|
-
console.warn(
|
|
2219
|
+
console.warn(chalk27.yellow(`${name2}: Package License not allowed [${license2}]`));
|
|
2119
2220
|
}
|
|
2120
2221
|
}
|
|
2121
2222
|
}
|
|
@@ -2135,12 +2236,12 @@ var npmignoreGen = (pkg) => generateIgnoreFiles(filename2, pkg);
|
|
|
2135
2236
|
|
|
2136
2237
|
// src/actions/package/clean-outputs.ts
|
|
2137
2238
|
import path8 from "path";
|
|
2138
|
-
import
|
|
2239
|
+
import chalk28 from "chalk";
|
|
2139
2240
|
var packageCleanOutputs = () => {
|
|
2140
2241
|
const pkg = process.env.INIT_CWD ?? ".";
|
|
2141
2242
|
const pkgName = process.env.npm_package_name;
|
|
2142
2243
|
const folders = [path8.join(pkg, "dist"), path8.join(pkg, "build"), path8.join(pkg, "docs")];
|
|
2143
|
-
console.log(
|
|
2244
|
+
console.log(chalk28.green(`Cleaning Outputs [${pkgName}]`));
|
|
2144
2245
|
for (let folder of folders) {
|
|
2145
2246
|
deleteGlob(folder);
|
|
2146
2247
|
}
|
|
@@ -2149,11 +2250,11 @@ var packageCleanOutputs = () => {
|
|
|
2149
2250
|
|
|
2150
2251
|
// src/actions/package/clean-typescript.ts
|
|
2151
2252
|
import path9 from "path";
|
|
2152
|
-
import
|
|
2253
|
+
import chalk29 from "chalk";
|
|
2153
2254
|
var packageCleanTypescript = () => {
|
|
2154
2255
|
const pkg = process.env.INIT_CWD ?? ".";
|
|
2155
2256
|
const pkgName = process.env.npm_package_name;
|
|
2156
|
-
console.log(
|
|
2257
|
+
console.log(chalk29.green(`Cleaning Typescript [${pkgName}]`));
|
|
2157
2258
|
const files = [path9.join(pkg, "*.tsbuildinfo"), path9.join(pkg, ".tsconfig.*"), path9.join(pkg, ".eslintcache")];
|
|
2158
2259
|
for (let file of files) {
|
|
2159
2260
|
deleteGlob(file);
|
|
@@ -2167,26 +2268,26 @@ var packageClean = async () => {
|
|
|
2167
2268
|
};
|
|
2168
2269
|
|
|
2169
2270
|
// src/actions/package/compile/compile.ts
|
|
2170
|
-
import
|
|
2271
|
+
import chalk34 from "chalk";
|
|
2171
2272
|
|
|
2172
2273
|
// src/actions/package/compile/packageCompileTsup.ts
|
|
2173
|
-
import
|
|
2274
|
+
import chalk33 from "chalk";
|
|
2174
2275
|
import { build as build2, defineConfig } from "tsup";
|
|
2175
2276
|
|
|
2176
2277
|
// src/actions/package/compile/inputs.ts
|
|
2177
|
-
import
|
|
2278
|
+
import chalk30 from "chalk";
|
|
2178
2279
|
import { glob as glob2 } from "glob";
|
|
2179
2280
|
var getAllInputs = (srcDir, verbose = false) => {
|
|
2180
2281
|
return [...glob2.sync(`${srcDir}/**/*.ts`, { posix: true }).map((file) => {
|
|
2181
2282
|
const result = file.slice(Math.max(0, srcDir.length + 1));
|
|
2182
2283
|
if (verbose) {
|
|
2183
|
-
console.log(
|
|
2284
|
+
console.log(chalk30.gray(`getAllInputs: ${JSON.stringify(result, null, 2)}`));
|
|
2184
2285
|
}
|
|
2185
2286
|
return result;
|
|
2186
2287
|
}), ...glob2.sync(`${srcDir}/**/*.tsx`, { posix: true }).map((file) => {
|
|
2187
2288
|
const result = file.slice(Math.max(0, srcDir.length + 1));
|
|
2188
2289
|
if (verbose) {
|
|
2189
|
-
console.log(
|
|
2290
|
+
console.log(chalk30.gray(`getAllInputs: ${JSON.stringify(result, null, 2)}`));
|
|
2190
2291
|
}
|
|
2191
2292
|
return result;
|
|
2192
2293
|
})];
|
|
@@ -2248,7 +2349,7 @@ function deepMergeObjects(objects) {
|
|
|
2248
2349
|
|
|
2249
2350
|
// src/actions/package/compile/packageCompileTsc.ts
|
|
2250
2351
|
import { cwd as cwd2 } from "process";
|
|
2251
|
-
import
|
|
2352
|
+
import chalk31 from "chalk";
|
|
2252
2353
|
import { createProgramFromConfig } from "tsc-prog";
|
|
2253
2354
|
import ts3, {
|
|
2254
2355
|
DiagnosticCategory,
|
|
@@ -2270,7 +2371,7 @@ var getCompilerOptions = (options = {}, fileName = "tsconfig.json") => {
|
|
|
2270
2371
|
var packageCompileTsc = (platform, entries, srcDir = "src", outDir = "dist", compilerOptionsParam, verbose = false) => {
|
|
2271
2372
|
const pkg = process.env.INIT_CWD ?? cwd2();
|
|
2272
2373
|
if (verbose) {
|
|
2273
|
-
console.log(
|
|
2374
|
+
console.log(chalk31.cyan(`Validating code START: ${entries.length} files to ${outDir} from ${srcDir}`));
|
|
2274
2375
|
}
|
|
2275
2376
|
const configFilePath = ts3.findConfigFile(
|
|
2276
2377
|
"./",
|
|
@@ -2293,10 +2394,10 @@ var packageCompileTsc = (platform, entries, srcDir = "src", outDir = "dist", com
|
|
|
2293
2394
|
emitDeclarationOnly: true,
|
|
2294
2395
|
noEmit: false
|
|
2295
2396
|
};
|
|
2296
|
-
console.log(
|
|
2397
|
+
console.log(chalk31.cyan(`Validating Files: ${entries.length}`));
|
|
2297
2398
|
if (verbose) {
|
|
2298
2399
|
for (const entry of entries) {
|
|
2299
|
-
console.log(
|
|
2400
|
+
console.log(chalk31.grey(`Validating: ${entry}`));
|
|
2300
2401
|
}
|
|
2301
2402
|
}
|
|
2302
2403
|
try {
|
|
@@ -2332,7 +2433,7 @@ var packageCompileTsc = (platform, entries, srcDir = "src", outDir = "dist", com
|
|
|
2332
2433
|
return 0;
|
|
2333
2434
|
} finally {
|
|
2334
2435
|
if (verbose) {
|
|
2335
|
-
console.log(
|
|
2436
|
+
console.log(chalk31.cyan(`Validating code FINISH: ${entries.length} files to ${outDir} from ${srcDir}`));
|
|
2336
2437
|
}
|
|
2337
2438
|
}
|
|
2338
2439
|
};
|
|
@@ -2340,7 +2441,7 @@ var packageCompileTsc = (platform, entries, srcDir = "src", outDir = "dist", com
|
|
|
2340
2441
|
// src/actions/package/compile/packageCompileTscTypes.ts
|
|
2341
2442
|
import path10 from "path";
|
|
2342
2443
|
import { cwd as cwd3 } from "process";
|
|
2343
|
-
import
|
|
2444
|
+
import chalk32 from "chalk";
|
|
2344
2445
|
import { rollup } from "rollup";
|
|
2345
2446
|
import dts from "rollup-plugin-dts";
|
|
2346
2447
|
import nodeExternals from "rollup-plugin-node-externals";
|
|
@@ -2365,8 +2466,8 @@ async function bundleDts(inputPath, outputPath, platform, options, verbose = fal
|
|
|
2365
2466
|
if (ignoredWarningCodes.has(warning.code ?? "")) {
|
|
2366
2467
|
return;
|
|
2367
2468
|
}
|
|
2368
|
-
console.warn(
|
|
2369
|
-
console.warn(
|
|
2469
|
+
console.warn(chalk32.yellow(`[${warning.code}] ${warning.message}`));
|
|
2470
|
+
console.warn(chalk32.gray(inputPath));
|
|
2370
2471
|
warn(warning);
|
|
2371
2472
|
}
|
|
2372
2473
|
});
|
|
@@ -2376,8 +2477,8 @@ async function bundleDts(inputPath, outputPath, platform, options, verbose = fal
|
|
|
2376
2477
|
});
|
|
2377
2478
|
} catch (ex) {
|
|
2378
2479
|
const error = ex;
|
|
2379
|
-
console.warn(
|
|
2380
|
-
console.warn(
|
|
2480
|
+
console.warn(chalk32.red(error));
|
|
2481
|
+
console.warn(chalk32.gray(inputPath));
|
|
2381
2482
|
}
|
|
2382
2483
|
if (verbose) {
|
|
2383
2484
|
console.log(`Bundled declarations written to ${outputPath}`);
|
|
@@ -2385,7 +2486,7 @@ async function bundleDts(inputPath, outputPath, platform, options, verbose = fal
|
|
|
2385
2486
|
}
|
|
2386
2487
|
var packageCompileTscTypes = async (entries, outDir, platform, srcDir = "build", verbose = false) => {
|
|
2387
2488
|
if (verbose) {
|
|
2388
|
-
console.log(
|
|
2489
|
+
console.log(chalk32.cyan(`Compiling Types START [${platform}]: ${entries.length} files to ${outDir} from ${srcDir}`));
|
|
2389
2490
|
console.log(`Entries: ${entries.join(", ")}`);
|
|
2390
2491
|
}
|
|
2391
2492
|
const pkg = process.env.INIT_CWD ?? cwd3();
|
|
@@ -2409,7 +2510,7 @@ var packageCompileTscTypes = async (entries, outDir, platform, srcDir = "build",
|
|
|
2409
2510
|
await bundleDts(`${srcRoot}/${entryTypeName}`, `${outDir}/${entryTypeName}`, platform, { compilerOptions }, verbose);
|
|
2410
2511
|
}));
|
|
2411
2512
|
if (verbose) {
|
|
2412
|
-
console.log(
|
|
2513
|
+
console.log(chalk32.cyan(`Compiling Types FINISH: ${entries.length} files to ${outDir} from ${srcDir}`));
|
|
2413
2514
|
}
|
|
2414
2515
|
return 0;
|
|
2415
2516
|
};
|
|
@@ -2421,15 +2522,15 @@ var compileFolder = async (srcDir, entries, buildDir, options, bundleTypes = fal
|
|
|
2421
2522
|
console.log(`compileFolder [${srcDir}, ${options?.outDir}]`);
|
|
2422
2523
|
}
|
|
2423
2524
|
if (entries.length === 0) {
|
|
2424
|
-
console.warn(
|
|
2525
|
+
console.warn(chalk33.yellow(`No entries found in ${srcDir} to compile`));
|
|
2425
2526
|
return 0;
|
|
2426
2527
|
}
|
|
2427
2528
|
if (verbose) {
|
|
2428
|
-
console.log(
|
|
2529
|
+
console.log(chalk33.gray(`buildDir [${buildDir}]`));
|
|
2429
2530
|
}
|
|
2430
2531
|
const validationResult = packageCompileTsc(options?.platform ?? "neutral", entries, srcDir, buildDir, void 0, verbose);
|
|
2431
2532
|
if (validationResult !== 0) {
|
|
2432
|
-
console.error(
|
|
2533
|
+
console.error(chalk33.red(`Compile:Validation had ${validationResult} errors`));
|
|
2433
2534
|
return validationResult;
|
|
2434
2535
|
}
|
|
2435
2536
|
const optionsParams = tsupOptions([{
|
|
@@ -2454,12 +2555,12 @@ var compileFolder = async (srcDir, entries, buildDir, options, bundleTypes = fal
|
|
|
2454
2555
|
})
|
|
2455
2556
|
)).flat();
|
|
2456
2557
|
if (verbose) {
|
|
2457
|
-
console.log(
|
|
2458
|
-
console.log(
|
|
2558
|
+
console.log(chalk33.cyan(`TSUP:build:start [${srcDir}]`));
|
|
2559
|
+
console.log(chalk33.gray(`TSUP:build:options [${JSON.stringify(optionsList, null, 2)}]`));
|
|
2459
2560
|
}
|
|
2460
2561
|
await Promise.all(optionsList.map((options2) => build2(options2)));
|
|
2461
2562
|
if (verbose) {
|
|
2462
|
-
console.log(
|
|
2563
|
+
console.log(chalk33.cyan(`TSUP:build:stop [${srcDir}]`));
|
|
2463
2564
|
}
|
|
2464
2565
|
if (bundleTypes) {
|
|
2465
2566
|
await packageCompileTscTypes(entries, outDir, options?.platform ?? "neutral", buildDir, verbose);
|
|
@@ -2570,14 +2671,14 @@ var packageCompileTsup = async (config2) => {
|
|
|
2570
2671
|
// src/actions/package/compile/compile.ts
|
|
2571
2672
|
var packageCompile = async (inConfig = {}) => {
|
|
2572
2673
|
const pkg = process.env.INIT_CWD;
|
|
2573
|
-
console.log(
|
|
2674
|
+
console.log(chalk34.green(`Compiling ${pkg}`));
|
|
2574
2675
|
const config2 = await loadConfig(inConfig);
|
|
2575
2676
|
return await packageCompileTsup(config2);
|
|
2576
2677
|
};
|
|
2577
2678
|
|
|
2578
2679
|
// src/actions/package/copy-assets.ts
|
|
2579
2680
|
import path11 from "path/posix";
|
|
2580
|
-
import
|
|
2681
|
+
import chalk35 from "chalk";
|
|
2581
2682
|
import cpy2 from "cpy";
|
|
2582
2683
|
var copyTargetAssets2 = async (target, name, location) => {
|
|
2583
2684
|
try {
|
|
@@ -2590,7 +2691,7 @@ var copyTargetAssets2 = async (target, name, location) => {
|
|
|
2590
2691
|
}
|
|
2591
2692
|
);
|
|
2592
2693
|
if (values.length > 0) {
|
|
2593
|
-
console.log(
|
|
2694
|
+
console.log(chalk35.green(`Copying Assets [${target.toUpperCase()}] - ${name} - ${location}`));
|
|
2594
2695
|
}
|
|
2595
2696
|
for (const value of values) {
|
|
2596
2697
|
console.log(`${value.split("/").pop()} => ./dist/${target}`);
|
|
@@ -2655,9 +2756,9 @@ var packageCycle = async () => {
|
|
|
2655
2756
|
};
|
|
2656
2757
|
|
|
2657
2758
|
// src/actions/package/gen-docs.ts
|
|
2658
|
-
import { existsSync as
|
|
2759
|
+
import { existsSync as existsSync8 } from "fs";
|
|
2659
2760
|
import path12 from "path";
|
|
2660
|
-
import
|
|
2761
|
+
import chalk36 from "chalk";
|
|
2661
2762
|
import {
|
|
2662
2763
|
Application,
|
|
2663
2764
|
ArgumentsReader,
|
|
@@ -2675,7 +2776,7 @@ var ExitCodes = {
|
|
|
2675
2776
|
};
|
|
2676
2777
|
var packageGenDocs = async () => {
|
|
2677
2778
|
const pkg = process.env.INIT_CWD;
|
|
2678
|
-
if (pkg !== void 0 && !
|
|
2779
|
+
if (pkg !== void 0 && !existsSync8(path12.join(pkg, "typedoc.json"))) {
|
|
2679
2780
|
return;
|
|
2680
2781
|
}
|
|
2681
2782
|
const app = await Application.bootstrap({
|
|
@@ -2761,16 +2862,16 @@ var runTypeDoc = async (app) => {
|
|
|
2761
2862
|
return ExitCodes.OutputError;
|
|
2762
2863
|
}
|
|
2763
2864
|
}
|
|
2764
|
-
console.log(
|
|
2865
|
+
console.log(chalk36.green(`${pkgName} - Ok`));
|
|
2765
2866
|
return ExitCodes.Ok;
|
|
2766
2867
|
};
|
|
2767
2868
|
|
|
2768
2869
|
// src/actions/package/lint.ts
|
|
2769
|
-
import { readdirSync as
|
|
2870
|
+
import { readdirSync as readdirSync5 } from "fs";
|
|
2770
2871
|
import path13 from "path";
|
|
2771
2872
|
import { cwd as cwd4 } from "process";
|
|
2772
2873
|
import { pathToFileURL } from "url";
|
|
2773
|
-
import
|
|
2874
|
+
import chalk37 from "chalk";
|
|
2774
2875
|
import { ESLint } from "eslint";
|
|
2775
2876
|
import { findUp } from "find-up";
|
|
2776
2877
|
import picomatch from "picomatch";
|
|
@@ -2779,14 +2880,14 @@ var dumpMessages = (lintResults) => {
|
|
|
2779
2880
|
const severity = ["none", "warning", "error"];
|
|
2780
2881
|
for (const lintResult of lintResults) {
|
|
2781
2882
|
if (lintResult.messages.length > 0) {
|
|
2782
|
-
console.log(
|
|
2883
|
+
console.log(chalk37.gray(`
|
|
2783
2884
|
${lintResult.filePath}`));
|
|
2784
2885
|
for (const message of lintResult.messages) {
|
|
2785
2886
|
console.log(
|
|
2786
|
-
|
|
2787
|
-
|
|
2788
|
-
|
|
2789
|
-
|
|
2887
|
+
chalk37.gray(` ${message.line}:${message.column}`),
|
|
2888
|
+
chalk37[colors[message.severity]](` ${severity[message.severity]}`),
|
|
2889
|
+
chalk37.white(` ${message.message}`),
|
|
2890
|
+
chalk37.gray(` ${message.ruleId}`)
|
|
2790
2891
|
);
|
|
2791
2892
|
}
|
|
2792
2893
|
}
|
|
@@ -2803,7 +2904,7 @@ function getFiles(dir, ignoreFolders) {
|
|
|
2803
2904
|
const currentDirectory = cwd4();
|
|
2804
2905
|
const subDirectory = dir.split(currentDirectory)[1]?.split("/")[1];
|
|
2805
2906
|
if (ignoreFolders.includes(subDirectory)) return [];
|
|
2806
|
-
return
|
|
2907
|
+
return readdirSync5(dir, { withFileTypes: true }).flatMap((dirent) => {
|
|
2807
2908
|
const res = path13.resolve(dir, dirent.name);
|
|
2808
2909
|
const relativePath = subDirectory === void 0 ? dirent.name : `${subDirectory}/${dirent.name}`;
|
|
2809
2910
|
const ignoreMatchers = ignoreFolders.map((pattern) => picomatch(pattern));
|
|
@@ -2824,10 +2925,10 @@ var packageLint = async (fix2 = false, verbose = false, cache = true) => {
|
|
|
2824
2925
|
cache
|
|
2825
2926
|
});
|
|
2826
2927
|
const files = getFiles(cwd4(), ignoreFolders);
|
|
2827
|
-
console.log(
|
|
2928
|
+
console.log(chalk37.green(`Linting ${pkg} [files = ${files.length}]`));
|
|
2828
2929
|
if (verbose) {
|
|
2829
2930
|
for (const file of files) {
|
|
2830
|
-
console.log(
|
|
2931
|
+
console.log(chalk37.gray(` ${file}`));
|
|
2831
2932
|
}
|
|
2832
2933
|
}
|
|
2833
2934
|
const lintResults = await engine.lintFiles(files);
|
|
@@ -2838,32 +2939,32 @@ var packageLint = async (fix2 = false, verbose = false, cache = true) => {
|
|
|
2838
2939
|
const filesCountColor = files.length < 100 ? "green" : files.length < 1e3 ? "yellow" : "red";
|
|
2839
2940
|
const lintTime = Date.now() - start;
|
|
2840
2941
|
const lintTimeColor = lintTime < 1e3 ? "green" : lintTime < 3e3 ? "yellow" : "red";
|
|
2841
|
-
console.log(
|
|
2942
|
+
console.log(chalk37.white(`Linted ${chalk37[filesCountColor](files.length)} files in ${chalk37[lintTimeColor](lintTime)}ms`));
|
|
2842
2943
|
return lintResults.reduce((prev, lintResult) => prev + lintResult.errorCount, 0);
|
|
2843
2944
|
};
|
|
2844
2945
|
|
|
2845
2946
|
// src/actions/package/publint.ts
|
|
2846
2947
|
import { promises as fs10 } from "fs";
|
|
2847
|
-
import
|
|
2948
|
+
import chalk38 from "chalk";
|
|
2848
2949
|
import sortPackageJson from "sort-package-json";
|
|
2849
2950
|
var customPubLint = (pkg) => {
|
|
2850
2951
|
let errorCount = 0;
|
|
2851
2952
|
let warningCount = 0;
|
|
2852
2953
|
if (pkg.files === void 0) {
|
|
2853
|
-
console.warn(
|
|
2954
|
+
console.warn(chalk38.yellow('Publint [custom]: "files" field is missing'));
|
|
2854
2955
|
warningCount++;
|
|
2855
2956
|
}
|
|
2856
2957
|
if (pkg.main !== void 0) {
|
|
2857
|
-
console.warn(
|
|
2958
|
+
console.warn(chalk38.yellow('Publint [custom]: "main" field is deprecated, use "exports" instead'));
|
|
2858
2959
|
warningCount++;
|
|
2859
2960
|
}
|
|
2860
2961
|
if (pkg.sideEffects !== false) {
|
|
2861
|
-
console.warn(
|
|
2962
|
+
console.warn(chalk38.yellow('Publint [custom]: "sideEffects" field should be set to false'));
|
|
2862
2963
|
warningCount++;
|
|
2863
2964
|
}
|
|
2864
2965
|
if (pkg.resolutions !== void 0) {
|
|
2865
|
-
console.warn(
|
|
2866
|
-
console.warn(
|
|
2966
|
+
console.warn(chalk38.yellow('Publint [custom]: "resolutions" in use'));
|
|
2967
|
+
console.warn(chalk38.gray(JSON.stringify(pkg.resolutions, null, 2)));
|
|
2867
2968
|
warningCount++;
|
|
2868
2969
|
}
|
|
2869
2970
|
return [errorCount, warningCount];
|
|
@@ -2873,8 +2974,8 @@ var packagePublint = async ({ strict = true, verbose = false } = {}) => {
|
|
|
2873
2974
|
const sortedPkg = sortPackageJson(await fs10.readFile(`${pkgDir}/package.json`, "utf8"));
|
|
2874
2975
|
await fs10.writeFile(`${pkgDir}/package.json`, sortedPkg);
|
|
2875
2976
|
const pkg = JSON.parse(await fs10.readFile(`${pkgDir}/package.json`, "utf8"));
|
|
2876
|
-
console.log(
|
|
2877
|
-
console.log(
|
|
2977
|
+
console.log(chalk38.green(`Publint: ${pkg.name}`));
|
|
2978
|
+
console.log(chalk38.gray(pkgDir));
|
|
2878
2979
|
const { publint: publint2 } = await import("publint");
|
|
2879
2980
|
const { messages } = await publint2({
|
|
2880
2981
|
level: "suggestion",
|
|
@@ -2885,22 +2986,22 @@ var packagePublint = async ({ strict = true, verbose = false } = {}) => {
|
|
|
2885
2986
|
for (const message of messages) {
|
|
2886
2987
|
switch (message.type) {
|
|
2887
2988
|
case "error": {
|
|
2888
|
-
console.error(
|
|
2989
|
+
console.error(chalk38.red(`[${message.code}] ${formatMessage(message, pkg)}`));
|
|
2889
2990
|
break;
|
|
2890
2991
|
}
|
|
2891
2992
|
case "warning": {
|
|
2892
|
-
console.warn(
|
|
2993
|
+
console.warn(chalk38.yellow(`[${message.code}] ${formatMessage(message, pkg)}`));
|
|
2893
2994
|
break;
|
|
2894
2995
|
}
|
|
2895
2996
|
default: {
|
|
2896
|
-
console.log(
|
|
2997
|
+
console.log(chalk38.white(`[${message.code}] ${formatMessage(message, pkg)}`));
|
|
2897
2998
|
break;
|
|
2898
2999
|
}
|
|
2899
3000
|
}
|
|
2900
3001
|
}
|
|
2901
3002
|
const [errorCount, warningCount] = customPubLint(pkg);
|
|
2902
3003
|
if (verbose) {
|
|
2903
|
-
console.log(
|
|
3004
|
+
console.log(chalk38.gray(`Publint [Finish]: ${pkgDir} [${messages.length + errorCount + warningCount} messages]`));
|
|
2904
3005
|
}
|
|
2905
3006
|
return messages.filter((message) => message.type === "error").length + errorCount;
|
|
2906
3007
|
};
|
|
@@ -2963,7 +3064,7 @@ var rebuild = ({ target }) => {
|
|
|
2963
3064
|
};
|
|
2964
3065
|
|
|
2965
3066
|
// src/actions/recompile.ts
|
|
2966
|
-
import
|
|
3067
|
+
import chalk39 from "chalk";
|
|
2967
3068
|
var recompile = async ({
|
|
2968
3069
|
verbose,
|
|
2969
3070
|
target,
|
|
@@ -2999,7 +3100,7 @@ var recompileAll = async ({
|
|
|
2999
3100
|
const incrementalOptions = incremental ? ["--since", "-Apt", "--topological-dev"] : ["--parallel", "-Apt", "--topological-dev"];
|
|
3000
3101
|
const jobsOptions = jobs ? ["-j", `${jobs}`] : [];
|
|
3001
3102
|
if (jobs) {
|
|
3002
|
-
console.log(
|
|
3103
|
+
console.log(chalk39.blue(`Jobs set to [${jobs}]`));
|
|
3003
3104
|
}
|
|
3004
3105
|
const result = await runStepsAsync(`Recompile${incremental ? "-Incremental" : ""} [All]`, [
|
|
3005
3106
|
[
|
|
@@ -3030,7 +3131,7 @@ var recompileAll = async ({
|
|
|
3030
3131
|
]
|
|
3031
3132
|
]);
|
|
3032
3133
|
console.log(
|
|
3033
|
-
`${
|
|
3134
|
+
`${chalk39.gray("Recompiled in")} [${chalk39.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk39.gray("seconds")}`
|
|
3034
3135
|
);
|
|
3035
3136
|
return result;
|
|
3036
3137
|
};
|
|
@@ -3039,7 +3140,7 @@ var recompileAll = async ({
|
|
|
3039
3140
|
import {
|
|
3040
3141
|
closeSync,
|
|
3041
3142
|
openSync,
|
|
3042
|
-
rmSync
|
|
3143
|
+
rmSync as rmSync2
|
|
3043
3144
|
} from "fs";
|
|
3044
3145
|
var reinstall = () => {
|
|
3045
3146
|
console.log("Reinstall [Clear Lock File]");
|
|
@@ -3049,7 +3150,7 @@ var reinstall = () => {
|
|
|
3049
3150
|
const result = workspaces.map(({ location, name }) => {
|
|
3050
3151
|
const dist = `${location}/node_modules`;
|
|
3051
3152
|
try {
|
|
3052
|
-
|
|
3153
|
+
rmSync2(dist, { force: true, recursive: true });
|
|
3053
3154
|
return 0;
|
|
3054
3155
|
} catch (ex) {
|
|
3055
3156
|
const error = ex;
|
|
@@ -3061,13 +3162,13 @@ var reinstall = () => {
|
|
|
3061
3162
|
};
|
|
3062
3163
|
|
|
3063
3164
|
// src/actions/relint.ts
|
|
3064
|
-
import
|
|
3165
|
+
import chalk40 from "chalk";
|
|
3065
3166
|
var relintPackage = ({
|
|
3066
3167
|
pkg,
|
|
3067
3168
|
fix: fix2,
|
|
3068
3169
|
verbose
|
|
3069
3170
|
}) => {
|
|
3070
|
-
console.log(
|
|
3171
|
+
console.log(chalk40.gray(`${fix2 ? "Fix" : "Lint"} [${pkg}]`));
|
|
3071
3172
|
const start = Date.now();
|
|
3072
3173
|
const result = runSteps(`${fix2 ? "Fix" : "Lint"} [${pkg}]`, [
|
|
3073
3174
|
["yarn", [
|
|
@@ -3077,7 +3178,7 @@ var relintPackage = ({
|
|
|
3077
3178
|
fix2 ? "package-fix" : verbose ? "package-lint-verbose" : "package-lint"
|
|
3078
3179
|
]]
|
|
3079
3180
|
]);
|
|
3080
|
-
console.log(
|
|
3181
|
+
console.log(chalk40.gray(`${fix2 ? "Fixed in" : "Linted in"} [${chalk40.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk40.gray("seconds")}`));
|
|
3081
3182
|
return result;
|
|
3082
3183
|
};
|
|
3083
3184
|
var relint = ({
|
|
@@ -3097,13 +3198,13 @@ var relint = ({
|
|
|
3097
3198
|
});
|
|
3098
3199
|
};
|
|
3099
3200
|
var relintAllPackages = ({ fix: fix2 = false } = {}) => {
|
|
3100
|
-
console.log(
|
|
3201
|
+
console.log(chalk40.gray(`${fix2 ? "Fix" : "Lint"} [All-Packages]`));
|
|
3101
3202
|
const start = Date.now();
|
|
3102
3203
|
const fixOptions = fix2 ? ["--fix"] : [];
|
|
3103
3204
|
const result = runSteps(`${fix2 ? "Fix" : "Lint"} [All-Packages]`, [
|
|
3104
3205
|
["yarn", ["eslint", ...fixOptions]]
|
|
3105
3206
|
]);
|
|
3106
|
-
console.log(
|
|
3207
|
+
console.log(chalk40.gray(`${fix2 ? "Fixed in" : "Linted in"} [${chalk40.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk40.gray("seconds")}`));
|
|
3107
3208
|
return result;
|
|
3108
3209
|
};
|
|
3109
3210
|
|
|
@@ -3121,10 +3222,10 @@ var sonar = () => {
|
|
|
3121
3222
|
};
|
|
3122
3223
|
|
|
3123
3224
|
// src/actions/statics.ts
|
|
3124
|
-
import
|
|
3225
|
+
import chalk41 from "chalk";
|
|
3125
3226
|
var DefaultDependencies = ["axios", "@xylabs/pixel", "react", "graphql", "react-router", "@mui/material", "@mui/system"];
|
|
3126
3227
|
var statics = () => {
|
|
3127
|
-
console.log(
|
|
3228
|
+
console.log(chalk41.green("Check Required Static Dependencies"));
|
|
3128
3229
|
const statics2 = parsedPackageJSON()?.xy?.deps?.statics;
|
|
3129
3230
|
return detectDuplicateDependencies(statics2, DefaultDependencies);
|
|
3130
3231
|
};
|
|
@@ -3177,6 +3278,7 @@ export {
|
|
|
3177
3278
|
claudeCommands,
|
|
3178
3279
|
claudeRules,
|
|
3179
3280
|
claudeSettings,
|
|
3281
|
+
claudeSkills,
|
|
3180
3282
|
clean,
|
|
3181
3283
|
cleanAll,
|
|
3182
3284
|
cleanDocs,
|