@xylabs/ts-scripts-yarn3 7.4.15 → 7.4.17
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-settings.mjs +82 -0
- package/dist/actions/claude-settings.mjs.map +1 -0
- package/dist/actions/index.mjs +191 -116
- package/dist/actions/index.mjs.map +1 -1
- package/dist/actions/package/compile/buildEntries.mjs +4 -1
- package/dist/actions/package/compile/buildEntries.mjs.map +1 -1
- package/dist/actions/package/compile/compile.mjs +5 -2
- package/dist/actions/package/compile/compile.mjs.map +1 -1
- package/dist/actions/package/compile/index.mjs +5 -2
- package/dist/actions/package/compile/index.mjs.map +1 -1
- package/dist/actions/package/compile/packageCompileTsc.mjs +1 -1
- package/dist/actions/package/compile/packageCompileTsc.mjs.map +1 -1
- package/dist/actions/package/compile/packageCompileTsup.mjs +5 -2
- package/dist/actions/package/compile/packageCompileTsup.mjs.map +1 -1
- package/dist/actions/package/index.mjs +5 -2
- package/dist/actions/package/index.mjs.map +1 -1
- package/dist/actions/package/recompile.mjs +5 -2
- package/dist/actions/package/recompile.mjs.map +1 -1
- package/dist/bin/package/build-only.mjs +5 -2
- package/dist/bin/package/build-only.mjs.map +1 -1
- package/dist/bin/package/build.mjs +5 -2
- package/dist/bin/package/build.mjs.map +1 -1
- package/dist/bin/package/compile-only.mjs +5 -2
- package/dist/bin/package/compile-only.mjs.map +1 -1
- package/dist/bin/package/compile-tsup.mjs +5 -2
- package/dist/bin/package/compile-tsup.mjs.map +1 -1
- package/dist/bin/package/compile.mjs +5 -2
- package/dist/bin/package/compile.mjs.map +1 -1
- package/dist/bin/package/recompile.mjs +5 -2
- package/dist/bin/package/recompile.mjs.map +1 -1
- package/dist/bin/xy.mjs +150 -71
- package/dist/bin/xy.mjs.map +1 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.mjs +211 -128
- package/dist/index.mjs.map +1 -1
- package/dist/xy/index.mjs +150 -71
- package/dist/xy/index.mjs.map +1 -1
- package/dist/xy/xy.mjs +150 -71
- package/dist/xy/xy.mjs.map +1 -1
- package/dist/xy/xyCommonCommands.mjs +96 -17
- package/dist/xy/xyCommonCommands.mjs.map +1 -1
- package/package.json +3 -3
package/dist/actions/index.mjs
CHANGED
|
@@ -739,6 +739,77 @@ var claudeRules = ({ force } = {}) => {
|
|
|
739
739
|
return 0;
|
|
740
740
|
};
|
|
741
741
|
|
|
742
|
+
// src/actions/claude-settings.ts
|
|
743
|
+
import {
|
|
744
|
+
existsSync as existsSync6,
|
|
745
|
+
mkdirSync as mkdirSync3,
|
|
746
|
+
writeFileSync as writeFileSync4
|
|
747
|
+
} from "fs";
|
|
748
|
+
import PATH5 from "path";
|
|
749
|
+
import { createInterface } from "readline";
|
|
750
|
+
import chalk12 from "chalk";
|
|
751
|
+
var DEFAULT_SETTINGS = {
|
|
752
|
+
permissions: {
|
|
753
|
+
allow: [
|
|
754
|
+
"Bash(git *)",
|
|
755
|
+
"Bash(yarn *)",
|
|
756
|
+
"Bash(npx *)",
|
|
757
|
+
"Bash(node *)",
|
|
758
|
+
"Bash(ls *)",
|
|
759
|
+
"Bash(mkdir *)",
|
|
760
|
+
"Bash(cp *)",
|
|
761
|
+
"Bash(mv *)",
|
|
762
|
+
"Bash(rm *)",
|
|
763
|
+
"Bash(cat *)",
|
|
764
|
+
"Bash(head *)",
|
|
765
|
+
"Bash(tail *)",
|
|
766
|
+
"Bash(echo *)",
|
|
767
|
+
"Bash(pwd)",
|
|
768
|
+
"Bash(which *)",
|
|
769
|
+
"Bash(gh *)",
|
|
770
|
+
"Read",
|
|
771
|
+
"Edit",
|
|
772
|
+
"Write",
|
|
773
|
+
"Glob",
|
|
774
|
+
"Grep",
|
|
775
|
+
"Skill"
|
|
776
|
+
],
|
|
777
|
+
deny: [
|
|
778
|
+
"Bash(git push --force*)",
|
|
779
|
+
"Bash(git reset --hard*)",
|
|
780
|
+
"Bash(rm -rf /*)"
|
|
781
|
+
]
|
|
782
|
+
}
|
|
783
|
+
};
|
|
784
|
+
function askConfirmation(question) {
|
|
785
|
+
const rl = createInterface({ input: process.stdin, output: process.stdout });
|
|
786
|
+
return new Promise((resolve) => {
|
|
787
|
+
rl.question(question, (answer) => {
|
|
788
|
+
rl.close();
|
|
789
|
+
resolve(answer.toLowerCase() === "y" || answer.toLowerCase() === "yes");
|
|
790
|
+
});
|
|
791
|
+
});
|
|
792
|
+
}
|
|
793
|
+
async function claudeSettings() {
|
|
794
|
+
const cwd5 = INIT_CWD() ?? process.cwd();
|
|
795
|
+
const claudeDir = PATH5.resolve(cwd5, ".claude");
|
|
796
|
+
const settingsPath = PATH5.resolve(claudeDir, "settings.local.json");
|
|
797
|
+
mkdirSync3(claudeDir, { recursive: true });
|
|
798
|
+
if (existsSync6(settingsPath)) {
|
|
799
|
+
const confirmed = await askConfirmation(
|
|
800
|
+
chalk12.yellow(`${settingsPath} already exists. Replace it? (y/N) `)
|
|
801
|
+
);
|
|
802
|
+
if (!confirmed) {
|
|
803
|
+
console.log(chalk12.gray("Skipped \u2014 existing settings.local.json preserved"));
|
|
804
|
+
return 0;
|
|
805
|
+
}
|
|
806
|
+
}
|
|
807
|
+
writeFileSync4(settingsPath, `${JSON.stringify(DEFAULT_SETTINGS, null, 2)}
|
|
808
|
+
`, "utf8");
|
|
809
|
+
console.log(chalk12.green("Generated .claude/settings.local.json"));
|
|
810
|
+
return 0;
|
|
811
|
+
}
|
|
812
|
+
|
|
742
813
|
// src/actions/clean.ts
|
|
743
814
|
var clean = async ({ verbose, pkg }) => {
|
|
744
815
|
return pkg ? await cleanPackage({ pkg, verbose }) : cleanAll({ verbose });
|
|
@@ -753,16 +824,16 @@ var cleanAll = ({ verbose }) => {
|
|
|
753
824
|
|
|
754
825
|
// src/actions/clean-docs.ts
|
|
755
826
|
import path from "path";
|
|
756
|
-
import
|
|
827
|
+
import chalk13 from "chalk";
|
|
757
828
|
var cleanDocs = () => {
|
|
758
829
|
const pkgName = process.env.npm_package_name;
|
|
759
|
-
console.log(
|
|
830
|
+
console.log(chalk13.green(`Cleaning Docs [${pkgName}]`));
|
|
760
831
|
for (const { location } of yarnWorkspaces()) deleteGlob(path.join(location, "docs"));
|
|
761
832
|
return 0;
|
|
762
833
|
};
|
|
763
834
|
|
|
764
835
|
// src/actions/compile.ts
|
|
765
|
-
import
|
|
836
|
+
import chalk14 from "chalk";
|
|
766
837
|
var compile = ({
|
|
767
838
|
verbose,
|
|
768
839
|
target,
|
|
@@ -803,7 +874,7 @@ var compileAll = ({
|
|
|
803
874
|
const incrementalOptions = incremental ? ["--since", "-Ap", "--topological-dev"] : ["--parallel", "-Ap", "--topological-dev"];
|
|
804
875
|
const jobsOptions = jobs ? ["-j", `${jobs}`] : [];
|
|
805
876
|
if (jobs) {
|
|
806
|
-
console.log(
|
|
877
|
+
console.log(chalk14.blue(`Jobs set to [${jobs}]`));
|
|
807
878
|
}
|
|
808
879
|
const result = runSteps(`Compile${incremental ? "-Incremental" : ""} [All]`, [
|
|
809
880
|
["yarn", [
|
|
@@ -817,13 +888,13 @@ var compileAll = ({
|
|
|
817
888
|
...targetOptions
|
|
818
889
|
]]
|
|
819
890
|
]);
|
|
820
|
-
console.log(`${
|
|
891
|
+
console.log(`${chalk14.gray("Compiled in")} [${chalk14.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk14.gray("seconds")}`);
|
|
821
892
|
return result;
|
|
822
893
|
};
|
|
823
894
|
|
|
824
895
|
// src/actions/copy-assets.ts
|
|
825
896
|
import path2 from "path/posix";
|
|
826
|
-
import
|
|
897
|
+
import chalk15 from "chalk";
|
|
827
898
|
import cpy from "cpy";
|
|
828
899
|
var copyPackageTargetAssets = async (target, name, location) => {
|
|
829
900
|
try {
|
|
@@ -846,7 +917,7 @@ var copyPackageTargetAssets = async (target, name, location) => {
|
|
|
846
917
|
};
|
|
847
918
|
var copyTargetAssets = async (target, pkg) => {
|
|
848
919
|
const workspaces = yarnWorkspaces();
|
|
849
|
-
console.log(
|
|
920
|
+
console.log(chalk15.green(`Copying Assets [${target.toUpperCase()}]`));
|
|
850
921
|
const workspaceList = workspaces.filter(({ name }) => {
|
|
851
922
|
return pkg === void 0 || name === pkg;
|
|
852
923
|
});
|
|
@@ -930,7 +1001,7 @@ var dead = () => {
|
|
|
930
1001
|
};
|
|
931
1002
|
|
|
932
1003
|
// src/actions/deplint/deplint.ts
|
|
933
|
-
import
|
|
1004
|
+
import chalk21 from "chalk";
|
|
934
1005
|
|
|
935
1006
|
// src/actions/deplint/findFiles.ts
|
|
936
1007
|
import fs2 from "fs";
|
|
@@ -1132,7 +1203,7 @@ function getExternalImportsFromFiles({
|
|
|
1132
1203
|
|
|
1133
1204
|
// src/actions/deplint/checkPackage/getUnlistedDependencies.ts
|
|
1134
1205
|
import { builtinModules } from "module";
|
|
1135
|
-
import
|
|
1206
|
+
import chalk16 from "chalk";
|
|
1136
1207
|
function isRuntimeImportListed(imp, name, dependencies, peerDependencies) {
|
|
1137
1208
|
return dependencies.includes(imp) || imp === name || peerDependencies.includes(imp) || builtinModules.includes(imp);
|
|
1138
1209
|
}
|
|
@@ -1140,7 +1211,7 @@ function isTypeImportListed(imp, name, dependencies, devDependencies, peerDepend
|
|
|
1140
1211
|
return dependencies.includes(imp) || imp === name || dependencies.includes(`@types/${imp}`) || peerDependencies.includes(imp) || peerDependencies.includes(`@types/${imp}`) || devDependencies.includes(`@types/${imp}`) || builtinModules.includes(imp);
|
|
1141
1212
|
}
|
|
1142
1213
|
function logMissing(name, imp, importPaths) {
|
|
1143
|
-
console.log(`[${
|
|
1214
|
+
console.log(`[${chalk16.blue(name)}] Missing dependency in package.json: ${chalk16.red(imp)}`);
|
|
1144
1215
|
if (importPaths[imp]) {
|
|
1145
1216
|
console.log(` ${importPaths[imp].join("\n ")}`);
|
|
1146
1217
|
}
|
|
@@ -1169,7 +1240,7 @@ function getUnlistedDependencies({ name, location }, {
|
|
|
1169
1240
|
}
|
|
1170
1241
|
if (unlistedDependencies > 0) {
|
|
1171
1242
|
const packageLocation = `${location}/package.json`;
|
|
1172
|
-
console.log(` ${
|
|
1243
|
+
console.log(` ${chalk16.yellow(packageLocation)}
|
|
1173
1244
|
`);
|
|
1174
1245
|
}
|
|
1175
1246
|
return unlistedDependencies;
|
|
@@ -1177,7 +1248,7 @@ function getUnlistedDependencies({ name, location }, {
|
|
|
1177
1248
|
|
|
1178
1249
|
// src/actions/deplint/checkPackage/getUnlistedDevDependencies.ts
|
|
1179
1250
|
import { builtinModules as builtinModules2 } from "module";
|
|
1180
|
-
import
|
|
1251
|
+
import chalk17 from "chalk";
|
|
1181
1252
|
function getUnlistedDevDependencies({ name, location }, {
|
|
1182
1253
|
devDependencies,
|
|
1183
1254
|
dependencies,
|
|
@@ -1191,7 +1262,7 @@ function getUnlistedDevDependencies({ name, location }, {
|
|
|
1191
1262
|
for (const imp of externalAllImports) {
|
|
1192
1263
|
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)) {
|
|
1193
1264
|
unlistedDevDependencies++;
|
|
1194
|
-
console.log(`[${
|
|
1265
|
+
console.log(`[${chalk17.blue(name)}] Missing devDependency in package.json: ${chalk17.red(imp)}`);
|
|
1195
1266
|
if (allImportPaths[imp]) {
|
|
1196
1267
|
console.log(` ${allImportPaths[imp].join("\n ")}`);
|
|
1197
1268
|
}
|
|
@@ -1199,14 +1270,14 @@ function getUnlistedDevDependencies({ name, location }, {
|
|
|
1199
1270
|
}
|
|
1200
1271
|
if (unlistedDevDependencies > 0) {
|
|
1201
1272
|
const packageLocation = `${location}/package.json`;
|
|
1202
|
-
console.log(` ${
|
|
1273
|
+
console.log(` ${chalk17.yellow(packageLocation)}
|
|
1203
1274
|
`);
|
|
1204
1275
|
}
|
|
1205
1276
|
return unlistedDevDependencies;
|
|
1206
1277
|
}
|
|
1207
1278
|
|
|
1208
1279
|
// src/actions/deplint/checkPackage/getUnusedDependencies.ts
|
|
1209
|
-
import
|
|
1280
|
+
import chalk18 from "chalk";
|
|
1210
1281
|
function getUnusedDependencies({ name, location }, { dependencies }, {
|
|
1211
1282
|
externalDistImports,
|
|
1212
1283
|
externalDistTypeImports,
|
|
@@ -1218,22 +1289,22 @@ function getUnusedDependencies({ name, location }, { dependencies }, {
|
|
|
1218
1289
|
if (!externalDistImports.includes(dep) && !externalDistImports.includes(dep.replace(/^@types\//, "")) && !externalDistTypeImports.includes(dep) && !externalDistTypeImports.includes(dep.replace(/^@types\//, ""))) {
|
|
1219
1290
|
unusedDependencies++;
|
|
1220
1291
|
if (externalAllImports.includes(dep)) {
|
|
1221
|
-
console.log(`[${
|
|
1292
|
+
console.log(`[${chalk18.blue(name)}] dependency should be devDependency in package.json: ${chalk18.red(dep)}`);
|
|
1222
1293
|
} else {
|
|
1223
|
-
console.log(`[${
|
|
1294
|
+
console.log(`[${chalk18.blue(name)}] Unused dependency in package.json: ${chalk18.red(dep)}`);
|
|
1224
1295
|
}
|
|
1225
1296
|
}
|
|
1226
1297
|
}
|
|
1227
1298
|
if (unusedDependencies > 0) {
|
|
1228
1299
|
const packageLocation = `${location}/package.json`;
|
|
1229
|
-
console.log(` ${
|
|
1300
|
+
console.log(` ${chalk18.yellow(packageLocation)}
|
|
1230
1301
|
`);
|
|
1231
1302
|
}
|
|
1232
1303
|
return unusedDependencies;
|
|
1233
1304
|
}
|
|
1234
1305
|
|
|
1235
1306
|
// src/actions/deplint/checkPackage/getUnusedDevDependencies.ts
|
|
1236
|
-
import
|
|
1307
|
+
import chalk19 from "chalk";
|
|
1237
1308
|
|
|
1238
1309
|
// src/actions/deplint/getCliReferencedPackagesFromFiles.ts
|
|
1239
1310
|
import fs8 from "fs";
|
|
@@ -1517,19 +1588,19 @@ function getUnusedDevDependencies({ name, location }, {
|
|
|
1517
1588
|
if (dependencies.includes(dep) || peerDependencies.includes(dep)) continue;
|
|
1518
1589
|
if (!isDevDepUsed(dep, allImports, implicitDeps, requiredPeers, scriptRefs, cliRefs)) {
|
|
1519
1590
|
unusedDevDependencies++;
|
|
1520
|
-
console.log(`[${
|
|
1591
|
+
console.log(`[${chalk19.blue(name)}] Unused devDependency in package.json: ${chalk19.red(dep)}`);
|
|
1521
1592
|
}
|
|
1522
1593
|
}
|
|
1523
1594
|
if (unusedDevDependencies > 0) {
|
|
1524
1595
|
const packageLocation = `${location}/package.json`;
|
|
1525
|
-
console.log(` ${
|
|
1596
|
+
console.log(` ${chalk19.yellow(packageLocation)}
|
|
1526
1597
|
`);
|
|
1527
1598
|
}
|
|
1528
1599
|
return unusedDevDependencies;
|
|
1529
1600
|
}
|
|
1530
1601
|
|
|
1531
1602
|
// src/actions/deplint/checkPackage/getUnusedPeerDependencies.ts
|
|
1532
|
-
import
|
|
1603
|
+
import chalk20 from "chalk";
|
|
1533
1604
|
function getUnusedPeerDependencies({ name, location }, { peerDependencies, dependencies }, { externalDistImports, externalDistTypeImports }, exclude) {
|
|
1534
1605
|
let unusedDependencies = 0;
|
|
1535
1606
|
for (const dep of peerDependencies) {
|
|
@@ -1537,15 +1608,15 @@ function getUnusedPeerDependencies({ name, location }, { peerDependencies, depen
|
|
|
1537
1608
|
if (!externalDistImports.includes(dep) && !externalDistImports.includes(dep.replace(/^@types\//, "")) && !externalDistTypeImports.includes(dep) && !externalDistTypeImports.includes(dep.replace(/^@types\//, ""))) {
|
|
1538
1609
|
unusedDependencies++;
|
|
1539
1610
|
if (dependencies.includes(dep)) {
|
|
1540
|
-
console.log(`[${
|
|
1611
|
+
console.log(`[${chalk20.blue(name)}] Unused peerDependency [already a dependency] in package.json: ${chalk20.red(dep)}`);
|
|
1541
1612
|
} else {
|
|
1542
|
-
console.log(`[${
|
|
1613
|
+
console.log(`[${chalk20.blue(name)}] Unused peerDependency in package.json: ${chalk20.red(dep)}`);
|
|
1543
1614
|
}
|
|
1544
1615
|
}
|
|
1545
1616
|
}
|
|
1546
1617
|
if (unusedDependencies > 0) {
|
|
1547
1618
|
const packageLocation = `${location}/package.json`;
|
|
1548
|
-
console.log(` ${
|
|
1619
|
+
console.log(` ${chalk20.yellow(packageLocation)}
|
|
1549
1620
|
`);
|
|
1550
1621
|
}
|
|
1551
1622
|
return unusedDependencies;
|
|
@@ -1640,9 +1711,9 @@ var deplint = async ({
|
|
|
1640
1711
|
});
|
|
1641
1712
|
}
|
|
1642
1713
|
if (totalErrors > 0) {
|
|
1643
|
-
console.warn(`Deplint: Found ${
|
|
1714
|
+
console.warn(`Deplint: Found ${chalk21.red(totalErrors)} dependency problems. ${chalk21.red("\u2716")}`);
|
|
1644
1715
|
} else {
|
|
1645
|
-
console.info(`Deplint: Found no dependency problems. ${
|
|
1716
|
+
console.info(`Deplint: Found no dependency problems. ${chalk21.green("\u2714")}`);
|
|
1646
1717
|
}
|
|
1647
1718
|
return 0;
|
|
1648
1719
|
};
|
|
@@ -1744,22 +1815,22 @@ var deployNext = () => {
|
|
|
1744
1815
|
};
|
|
1745
1816
|
|
|
1746
1817
|
// src/actions/dupdeps.ts
|
|
1747
|
-
import
|
|
1818
|
+
import chalk22 from "chalk";
|
|
1748
1819
|
var dupdeps = () => {
|
|
1749
|
-
console.log(
|
|
1820
|
+
console.log(chalk22.green("Checking all Dependencies for Duplicates"));
|
|
1750
1821
|
const allDependencies = parsedPackageJSON()?.dependencies;
|
|
1751
1822
|
const dependencies = Object.entries(allDependencies).map(([k]) => k);
|
|
1752
1823
|
return detectDuplicateDependencies(dependencies);
|
|
1753
1824
|
};
|
|
1754
1825
|
|
|
1755
1826
|
// src/actions/lint.ts
|
|
1756
|
-
import
|
|
1827
|
+
import chalk23 from "chalk";
|
|
1757
1828
|
var lintPackage = ({
|
|
1758
1829
|
pkg,
|
|
1759
1830
|
fix: fix2,
|
|
1760
1831
|
verbose
|
|
1761
1832
|
}) => {
|
|
1762
|
-
console.log(
|
|
1833
|
+
console.log(chalk23.gray(`${fix2 ? "Fix" : "Lint"} [${pkg}]`));
|
|
1763
1834
|
const start = Date.now();
|
|
1764
1835
|
const result = runSteps(`${fix2 ? "Fix" : "Lint"} [${pkg}]`, [
|
|
1765
1836
|
["yarn", [
|
|
@@ -1769,7 +1840,7 @@ var lintPackage = ({
|
|
|
1769
1840
|
fix2 ? "package-fix" : verbose ? "package-lint-verbose" : "package-lint"
|
|
1770
1841
|
]]
|
|
1771
1842
|
]);
|
|
1772
|
-
console.log(
|
|
1843
|
+
console.log(chalk23.gray(`${fix2 ? "Fixed in" : "Linted in"} [${chalk23.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk23.gray("seconds")}`));
|
|
1773
1844
|
return result;
|
|
1774
1845
|
};
|
|
1775
1846
|
var lint = ({
|
|
@@ -1789,13 +1860,13 @@ var lint = ({
|
|
|
1789
1860
|
});
|
|
1790
1861
|
};
|
|
1791
1862
|
var lintAllPackages = ({ fix: fix2 = false } = {}) => {
|
|
1792
|
-
console.log(
|
|
1863
|
+
console.log(chalk23.gray(`${fix2 ? "Fix" : "Lint"} [All-Packages]`));
|
|
1793
1864
|
const start = Date.now();
|
|
1794
1865
|
const fixOptions = fix2 ? ["--fix"] : [];
|
|
1795
1866
|
const result = runSteps(`${fix2 ? "Fix" : "Lint"} [All-Packages]`, [
|
|
1796
1867
|
["yarn", ["eslint", "--cache", "--cache-location", ".eslintcache", "--cache-strategy", "content", ...fixOptions]]
|
|
1797
1868
|
]);
|
|
1798
|
-
console.log(
|
|
1869
|
+
console.log(chalk23.gray(`${fix2 ? "Fixed in" : "Linted in"} [${chalk23.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk23.gray("seconds")}`));
|
|
1799
1870
|
return result;
|
|
1800
1871
|
};
|
|
1801
1872
|
|
|
@@ -1823,7 +1894,7 @@ var filename = ".gitignore";
|
|
|
1823
1894
|
var gitignoreGen = (pkg) => generateIgnoreFiles(filename, pkg);
|
|
1824
1895
|
|
|
1825
1896
|
// src/actions/gitlint.ts
|
|
1826
|
-
import
|
|
1897
|
+
import chalk24 from "chalk";
|
|
1827
1898
|
import ParseGitConfig from "parse-git-config";
|
|
1828
1899
|
var gitlint = () => {
|
|
1829
1900
|
console.log(`
|
|
@@ -1834,7 +1905,7 @@ Gitlint Start [${process.cwd()}]
|
|
|
1834
1905
|
const errors = 0;
|
|
1835
1906
|
const gitConfig = ParseGitConfig.sync();
|
|
1836
1907
|
const warn = (message) => {
|
|
1837
|
-
console.warn(
|
|
1908
|
+
console.warn(chalk24.yellow(`Warning: ${message}`));
|
|
1838
1909
|
warnings++;
|
|
1839
1910
|
};
|
|
1840
1911
|
if (gitConfig.core.ignorecase) {
|
|
@@ -1854,13 +1925,13 @@ Gitlint Start [${process.cwd()}]
|
|
|
1854
1925
|
}
|
|
1855
1926
|
const resultMessages = [];
|
|
1856
1927
|
if (valid > 0) {
|
|
1857
|
-
resultMessages.push(
|
|
1928
|
+
resultMessages.push(chalk24.green(`Passed: ${valid}`));
|
|
1858
1929
|
}
|
|
1859
1930
|
if (warnings > 0) {
|
|
1860
|
-
resultMessages.push(
|
|
1931
|
+
resultMessages.push(chalk24.yellow(`Warnings: ${warnings}`));
|
|
1861
1932
|
}
|
|
1862
1933
|
if (errors > 0) {
|
|
1863
|
-
resultMessages.push(
|
|
1934
|
+
resultMessages.push(chalk24.red(` Errors: ${errors}`));
|
|
1864
1935
|
}
|
|
1865
1936
|
console.warn(`Gitlint Finish [ ${resultMessages.join(" | ")} ]
|
|
1866
1937
|
`);
|
|
@@ -1869,7 +1940,7 @@ Gitlint Start [${process.cwd()}]
|
|
|
1869
1940
|
|
|
1870
1941
|
// src/actions/gitlint-fix.ts
|
|
1871
1942
|
import { execSync as execSync3 } from "child_process";
|
|
1872
|
-
import
|
|
1943
|
+
import chalk25 from "chalk";
|
|
1873
1944
|
import ParseGitConfig2 from "parse-git-config";
|
|
1874
1945
|
var gitlintFix = () => {
|
|
1875
1946
|
console.log(`
|
|
@@ -1878,15 +1949,15 @@ Gitlint Fix Start [${process.cwd()}]
|
|
|
1878
1949
|
const gitConfig = ParseGitConfig2.sync();
|
|
1879
1950
|
if (gitConfig.core.ignorecase) {
|
|
1880
1951
|
execSync3("git config core.ignorecase false", { stdio: "inherit" });
|
|
1881
|
-
console.warn(
|
|
1952
|
+
console.warn(chalk25.yellow("\nGitlint Fix: Updated core.ignorecase to be false\n"));
|
|
1882
1953
|
}
|
|
1883
1954
|
if (gitConfig.core.autocrlf !== false) {
|
|
1884
1955
|
execSync3("git config core.autocrlf false", { stdio: "inherit" });
|
|
1885
|
-
console.warn(
|
|
1956
|
+
console.warn(chalk25.yellow("\nGitlint Fix: Updated core.autocrlf to be false\n"));
|
|
1886
1957
|
}
|
|
1887
1958
|
if (gitConfig.core.eol !== "lf") {
|
|
1888
1959
|
execSync3("git config core.eol lf", { stdio: "inherit" });
|
|
1889
|
-
console.warn(
|
|
1960
|
+
console.warn(chalk25.yellow('\nGitlint Fix: Updated core.eol to be "lf"\n'));
|
|
1890
1961
|
}
|
|
1891
1962
|
return 1;
|
|
1892
1963
|
};
|
|
@@ -1897,7 +1968,7 @@ var knip = () => {
|
|
|
1897
1968
|
};
|
|
1898
1969
|
|
|
1899
1970
|
// src/actions/license.ts
|
|
1900
|
-
import
|
|
1971
|
+
import chalk26 from "chalk";
|
|
1901
1972
|
import { init } from "license-checker";
|
|
1902
1973
|
var license = async (pkg) => {
|
|
1903
1974
|
const workspaces = yarnWorkspaces();
|
|
@@ -1922,18 +1993,18 @@ var license = async (pkg) => {
|
|
|
1922
1993
|
"LGPL-3.0-or-later",
|
|
1923
1994
|
"Python-2.0"
|
|
1924
1995
|
]);
|
|
1925
|
-
console.log(
|
|
1996
|
+
console.log(chalk26.green("License Checker"));
|
|
1926
1997
|
return (await Promise.all(
|
|
1927
1998
|
workspaceList.map(({ location, name }) => {
|
|
1928
1999
|
return new Promise((resolve) => {
|
|
1929
2000
|
init({ production: true, start: location }, (error, packages) => {
|
|
1930
2001
|
if (error) {
|
|
1931
|
-
console.error(
|
|
1932
|
-
console.error(
|
|
2002
|
+
console.error(chalk26.red(`License Checker [${name}] Error`));
|
|
2003
|
+
console.error(chalk26.gray(error));
|
|
1933
2004
|
console.log("\n");
|
|
1934
2005
|
resolve(1);
|
|
1935
2006
|
} else {
|
|
1936
|
-
console.log(
|
|
2007
|
+
console.log(chalk26.green(`License Checker [${name}]`));
|
|
1937
2008
|
let count = 0;
|
|
1938
2009
|
for (const [name2, info] of Object.entries(packages)) {
|
|
1939
2010
|
const licenses = Array.isArray(info.licenses) ? info.licenses : [info.licenses];
|
|
@@ -1949,7 +2020,7 @@ var license = async (pkg) => {
|
|
|
1949
2020
|
}
|
|
1950
2021
|
if (!orLicenseFound) {
|
|
1951
2022
|
count++;
|
|
1952
|
-
console.warn(
|
|
2023
|
+
console.warn(chalk26.yellow(`${name2}: Package License not allowed [${license2}]`));
|
|
1953
2024
|
}
|
|
1954
2025
|
}
|
|
1955
2026
|
}
|
|
@@ -1969,12 +2040,12 @@ var npmignoreGen = (pkg) => generateIgnoreFiles(filename2, pkg);
|
|
|
1969
2040
|
|
|
1970
2041
|
// src/actions/package/clean-outputs.ts
|
|
1971
2042
|
import path8 from "path";
|
|
1972
|
-
import
|
|
2043
|
+
import chalk27 from "chalk";
|
|
1973
2044
|
var packageCleanOutputs = () => {
|
|
1974
2045
|
const pkg = process.env.INIT_CWD ?? ".";
|
|
1975
2046
|
const pkgName = process.env.npm_package_name;
|
|
1976
2047
|
const folders = [path8.join(pkg, "dist"), path8.join(pkg, "build"), path8.join(pkg, "docs")];
|
|
1977
|
-
console.log(
|
|
2048
|
+
console.log(chalk27.green(`Cleaning Outputs [${pkgName}]`));
|
|
1978
2049
|
for (let folder of folders) {
|
|
1979
2050
|
deleteGlob(folder);
|
|
1980
2051
|
}
|
|
@@ -1983,11 +2054,11 @@ var packageCleanOutputs = () => {
|
|
|
1983
2054
|
|
|
1984
2055
|
// src/actions/package/clean-typescript.ts
|
|
1985
2056
|
import path9 from "path";
|
|
1986
|
-
import
|
|
2057
|
+
import chalk28 from "chalk";
|
|
1987
2058
|
var packageCleanTypescript = () => {
|
|
1988
2059
|
const pkg = process.env.INIT_CWD ?? ".";
|
|
1989
2060
|
const pkgName = process.env.npm_package_name;
|
|
1990
|
-
console.log(
|
|
2061
|
+
console.log(chalk28.green(`Cleaning Typescript [${pkgName}]`));
|
|
1991
2062
|
const files = [path9.join(pkg, "*.tsbuildinfo"), path9.join(pkg, ".tsconfig.*"), path9.join(pkg, ".eslintcache")];
|
|
1992
2063
|
for (let file of files) {
|
|
1993
2064
|
deleteGlob(file);
|
|
@@ -2001,32 +2072,35 @@ var packageClean = async () => {
|
|
|
2001
2072
|
};
|
|
2002
2073
|
|
|
2003
2074
|
// src/actions/package/compile/compile.ts
|
|
2004
|
-
import
|
|
2075
|
+
import chalk33 from "chalk";
|
|
2005
2076
|
|
|
2006
2077
|
// src/actions/package/compile/packageCompileTsup.ts
|
|
2007
|
-
import
|
|
2078
|
+
import chalk32 from "chalk";
|
|
2008
2079
|
import { build as build2, defineConfig } from "tsup";
|
|
2009
2080
|
|
|
2010
2081
|
// src/actions/package/compile/inputs.ts
|
|
2011
|
-
import
|
|
2082
|
+
import chalk29 from "chalk";
|
|
2012
2083
|
import { glob as glob2 } from "glob";
|
|
2013
2084
|
var getAllInputs = (srcDir, verbose = false) => {
|
|
2014
2085
|
return [...glob2.sync(`${srcDir}/**/*.ts`, { posix: true }).map((file) => {
|
|
2015
2086
|
const result = file.slice(Math.max(0, srcDir.length + 1));
|
|
2016
2087
|
if (verbose) {
|
|
2017
|
-
console.log(
|
|
2088
|
+
console.log(chalk29.gray(`getAllInputs: ${JSON.stringify(result, null, 2)}`));
|
|
2018
2089
|
}
|
|
2019
2090
|
return result;
|
|
2020
2091
|
}), ...glob2.sync(`${srcDir}/**/*.tsx`, { posix: true }).map((file) => {
|
|
2021
2092
|
const result = file.slice(Math.max(0, srcDir.length + 1));
|
|
2022
2093
|
if (verbose) {
|
|
2023
|
-
console.log(
|
|
2094
|
+
console.log(chalk29.gray(`getAllInputs: ${JSON.stringify(result, null, 2)}`));
|
|
2024
2095
|
}
|
|
2025
2096
|
return result;
|
|
2026
2097
|
})];
|
|
2027
2098
|
};
|
|
2028
2099
|
|
|
2029
2100
|
// src/actions/package/compile/buildEntries.ts
|
|
2101
|
+
var isSpecOrStory = (entry) => {
|
|
2102
|
+
return entry.includes(".spec.") || entry.includes(".stories.") || entry.startsWith("spec/") || entry.includes("/spec/") || entry.startsWith("stories/") || entry.includes("/stories/") || entry === "spec.ts" || entry.endsWith("/spec.ts") || entry === "stories.ts" || entry.endsWith("/stories.ts");
|
|
2103
|
+
};
|
|
2030
2104
|
var buildEntries = (srcDir, entryMode = "single", options, excludeSpecAndStories = true, verbose = false) => {
|
|
2031
2105
|
let entries = [];
|
|
2032
2106
|
switch (entryMode) {
|
|
@@ -2035,7 +2109,7 @@ var buildEntries = (srcDir, entryMode = "single", options, excludeSpecAndStories
|
|
|
2035
2109
|
break;
|
|
2036
2110
|
}
|
|
2037
2111
|
case "all": {
|
|
2038
|
-
entries = (excludeSpecAndStories ? getAllInputs(srcDir).filter((entry) => !
|
|
2112
|
+
entries = (excludeSpecAndStories ? getAllInputs(srcDir).filter((entry) => !isSpecOrStory(entry)) : getAllInputs(srcDir)).filter((entry) => !entry.endsWith(".d.ts"));
|
|
2039
2113
|
break;
|
|
2040
2114
|
}
|
|
2041
2115
|
case "custom": {
|
|
@@ -2079,7 +2153,7 @@ function deepMergeObjects(objects) {
|
|
|
2079
2153
|
|
|
2080
2154
|
// src/actions/package/compile/packageCompileTsc.ts
|
|
2081
2155
|
import { cwd as cwd2 } from "process";
|
|
2082
|
-
import
|
|
2156
|
+
import chalk30 from "chalk";
|
|
2083
2157
|
import { createProgramFromConfig } from "tsc-prog";
|
|
2084
2158
|
import ts3, {
|
|
2085
2159
|
DiagnosticCategory,
|
|
@@ -2101,7 +2175,7 @@ var getCompilerOptions = (options = {}, fileName = "tsconfig.json") => {
|
|
|
2101
2175
|
var packageCompileTsc = (platform, entries, srcDir = "src", outDir = "dist", compilerOptionsParam, verbose = false) => {
|
|
2102
2176
|
const pkg = process.env.INIT_CWD ?? cwd2();
|
|
2103
2177
|
if (verbose) {
|
|
2104
|
-
console.log(
|
|
2178
|
+
console.log(chalk30.cyan(`Validating code START: ${entries.length} files to ${outDir} from ${srcDir}`));
|
|
2105
2179
|
}
|
|
2106
2180
|
const configFilePath = ts3.findConfigFile(
|
|
2107
2181
|
"./",
|
|
@@ -2124,10 +2198,10 @@ var packageCompileTsc = (platform, entries, srcDir = "src", outDir = "dist", com
|
|
|
2124
2198
|
emitDeclarationOnly: true,
|
|
2125
2199
|
noEmit: false
|
|
2126
2200
|
};
|
|
2127
|
-
console.log(
|
|
2201
|
+
console.log(chalk30.cyan(`Validating Files: ${entries.length}`));
|
|
2128
2202
|
if (verbose) {
|
|
2129
2203
|
for (const entry of entries) {
|
|
2130
|
-
console.log(
|
|
2204
|
+
console.log(chalk30.grey(`Validating: ${entry}`));
|
|
2131
2205
|
}
|
|
2132
2206
|
}
|
|
2133
2207
|
try {
|
|
@@ -2151,7 +2225,7 @@ var packageCompileTsc = (platform, entries, srcDir = "src", outDir = "dist", com
|
|
|
2151
2225
|
);
|
|
2152
2226
|
console.error(formattedDiagnostics);
|
|
2153
2227
|
}
|
|
2154
|
-
const nonEmitPatterns = [".stories.", "/stories/", ".spec.", "/spec/", ".example."];
|
|
2228
|
+
const nonEmitPatterns = [".stories.", "/stories/", "/stories.", ".spec.", "/spec/", "/spec.", ".example."];
|
|
2155
2229
|
program.emit(void 0, (fileName, text, writeByteOrderMark) => {
|
|
2156
2230
|
if (nonEmitPatterns.some((pattern) => fileName.includes(pattern))) {
|
|
2157
2231
|
return;
|
|
@@ -2163,7 +2237,7 @@ var packageCompileTsc = (platform, entries, srcDir = "src", outDir = "dist", com
|
|
|
2163
2237
|
return 0;
|
|
2164
2238
|
} finally {
|
|
2165
2239
|
if (verbose) {
|
|
2166
|
-
console.log(
|
|
2240
|
+
console.log(chalk30.cyan(`Validating code FINISH: ${entries.length} files to ${outDir} from ${srcDir}`));
|
|
2167
2241
|
}
|
|
2168
2242
|
}
|
|
2169
2243
|
};
|
|
@@ -2171,7 +2245,7 @@ var packageCompileTsc = (platform, entries, srcDir = "src", outDir = "dist", com
|
|
|
2171
2245
|
// src/actions/package/compile/packageCompileTscTypes.ts
|
|
2172
2246
|
import path10 from "path";
|
|
2173
2247
|
import { cwd as cwd3 } from "process";
|
|
2174
|
-
import
|
|
2248
|
+
import chalk31 from "chalk";
|
|
2175
2249
|
import { rollup } from "rollup";
|
|
2176
2250
|
import dts from "rollup-plugin-dts";
|
|
2177
2251
|
import nodeExternals from "rollup-plugin-node-externals";
|
|
@@ -2196,8 +2270,8 @@ async function bundleDts(inputPath, outputPath, platform, options, verbose = fal
|
|
|
2196
2270
|
if (ignoredWarningCodes.has(warning.code ?? "")) {
|
|
2197
2271
|
return;
|
|
2198
2272
|
}
|
|
2199
|
-
console.warn(
|
|
2200
|
-
console.warn(
|
|
2273
|
+
console.warn(chalk31.yellow(`[${warning.code}] ${warning.message}`));
|
|
2274
|
+
console.warn(chalk31.gray(inputPath));
|
|
2201
2275
|
warn(warning);
|
|
2202
2276
|
}
|
|
2203
2277
|
});
|
|
@@ -2207,8 +2281,8 @@ async function bundleDts(inputPath, outputPath, platform, options, verbose = fal
|
|
|
2207
2281
|
});
|
|
2208
2282
|
} catch (ex) {
|
|
2209
2283
|
const error = ex;
|
|
2210
|
-
console.warn(
|
|
2211
|
-
console.warn(
|
|
2284
|
+
console.warn(chalk31.red(error));
|
|
2285
|
+
console.warn(chalk31.gray(inputPath));
|
|
2212
2286
|
}
|
|
2213
2287
|
if (verbose) {
|
|
2214
2288
|
console.log(`Bundled declarations written to ${outputPath}`);
|
|
@@ -2216,7 +2290,7 @@ async function bundleDts(inputPath, outputPath, platform, options, verbose = fal
|
|
|
2216
2290
|
}
|
|
2217
2291
|
var packageCompileTscTypes = async (entries, outDir, platform, srcDir = "build", verbose = false) => {
|
|
2218
2292
|
if (verbose) {
|
|
2219
|
-
console.log(
|
|
2293
|
+
console.log(chalk31.cyan(`Compiling Types START [${platform}]: ${entries.length} files to ${outDir} from ${srcDir}`));
|
|
2220
2294
|
console.log(`Entries: ${entries.join(", ")}`);
|
|
2221
2295
|
}
|
|
2222
2296
|
const pkg = process.env.INIT_CWD ?? cwd3();
|
|
@@ -2240,7 +2314,7 @@ var packageCompileTscTypes = async (entries, outDir, platform, srcDir = "build",
|
|
|
2240
2314
|
await bundleDts(`${srcRoot}/${entryTypeName}`, `${outDir}/${entryTypeName}`, platform, { compilerOptions }, verbose);
|
|
2241
2315
|
}));
|
|
2242
2316
|
if (verbose) {
|
|
2243
|
-
console.log(
|
|
2317
|
+
console.log(chalk31.cyan(`Compiling Types FINISH: ${entries.length} files to ${outDir} from ${srcDir}`));
|
|
2244
2318
|
}
|
|
2245
2319
|
return 0;
|
|
2246
2320
|
};
|
|
@@ -2252,15 +2326,15 @@ var compileFolder = async (srcDir, entries, buildDir, options, bundleTypes = fal
|
|
|
2252
2326
|
console.log(`compileFolder [${srcDir}, ${options?.outDir}]`);
|
|
2253
2327
|
}
|
|
2254
2328
|
if (entries.length === 0) {
|
|
2255
|
-
console.warn(
|
|
2329
|
+
console.warn(chalk32.yellow(`No entries found in ${srcDir} to compile`));
|
|
2256
2330
|
return 0;
|
|
2257
2331
|
}
|
|
2258
2332
|
if (verbose) {
|
|
2259
|
-
console.log(
|
|
2333
|
+
console.log(chalk32.gray(`buildDir [${buildDir}]`));
|
|
2260
2334
|
}
|
|
2261
2335
|
const validationResult = packageCompileTsc(options?.platform ?? "neutral", entries, srcDir, buildDir, void 0, verbose);
|
|
2262
2336
|
if (validationResult !== 0) {
|
|
2263
|
-
console.error(
|
|
2337
|
+
console.error(chalk32.red(`Compile:Validation had ${validationResult} errors`));
|
|
2264
2338
|
return validationResult;
|
|
2265
2339
|
}
|
|
2266
2340
|
const optionsParams = tsupOptions([{
|
|
@@ -2285,12 +2359,12 @@ var compileFolder = async (srcDir, entries, buildDir, options, bundleTypes = fal
|
|
|
2285
2359
|
})
|
|
2286
2360
|
)).flat();
|
|
2287
2361
|
if (verbose) {
|
|
2288
|
-
console.log(
|
|
2289
|
-
console.log(
|
|
2362
|
+
console.log(chalk32.cyan(`TSUP:build:start [${srcDir}]`));
|
|
2363
|
+
console.log(chalk32.gray(`TSUP:build:options [${JSON.stringify(optionsList, null, 2)}]`));
|
|
2290
2364
|
}
|
|
2291
2365
|
await Promise.all(optionsList.map((options2) => build2(options2)));
|
|
2292
2366
|
if (verbose) {
|
|
2293
|
-
console.log(
|
|
2367
|
+
console.log(chalk32.cyan(`TSUP:build:stop [${srcDir}]`));
|
|
2294
2368
|
}
|
|
2295
2369
|
if (bundleTypes) {
|
|
2296
2370
|
await packageCompileTscTypes(entries, outDir, options?.platform ?? "neutral", buildDir, verbose);
|
|
@@ -2401,14 +2475,14 @@ var packageCompileTsup = async (config2) => {
|
|
|
2401
2475
|
// src/actions/package/compile/compile.ts
|
|
2402
2476
|
var packageCompile = async (inConfig = {}) => {
|
|
2403
2477
|
const pkg = process.env.INIT_CWD;
|
|
2404
|
-
console.log(
|
|
2478
|
+
console.log(chalk33.green(`Compiling ${pkg}`));
|
|
2405
2479
|
const config2 = await loadConfig(inConfig);
|
|
2406
2480
|
return await packageCompileTsup(config2);
|
|
2407
2481
|
};
|
|
2408
2482
|
|
|
2409
2483
|
// src/actions/package/copy-assets.ts
|
|
2410
2484
|
import path11 from "path/posix";
|
|
2411
|
-
import
|
|
2485
|
+
import chalk34 from "chalk";
|
|
2412
2486
|
import cpy2 from "cpy";
|
|
2413
2487
|
var copyTargetAssets2 = async (target, name, location) => {
|
|
2414
2488
|
try {
|
|
@@ -2421,7 +2495,7 @@ var copyTargetAssets2 = async (target, name, location) => {
|
|
|
2421
2495
|
}
|
|
2422
2496
|
);
|
|
2423
2497
|
if (values.length > 0) {
|
|
2424
|
-
console.log(
|
|
2498
|
+
console.log(chalk34.green(`Copying Assets [${target.toUpperCase()}] - ${name} - ${location}`));
|
|
2425
2499
|
}
|
|
2426
2500
|
for (const value of values) {
|
|
2427
2501
|
console.log(`${value.split("/").pop()} => ./dist/${target}`);
|
|
@@ -2486,9 +2560,9 @@ var packageCycle = async () => {
|
|
|
2486
2560
|
};
|
|
2487
2561
|
|
|
2488
2562
|
// src/actions/package/gen-docs.ts
|
|
2489
|
-
import { existsSync as
|
|
2563
|
+
import { existsSync as existsSync7 } from "fs";
|
|
2490
2564
|
import path12 from "path";
|
|
2491
|
-
import
|
|
2565
|
+
import chalk35 from "chalk";
|
|
2492
2566
|
import {
|
|
2493
2567
|
Application,
|
|
2494
2568
|
ArgumentsReader,
|
|
@@ -2506,7 +2580,7 @@ var ExitCodes = {
|
|
|
2506
2580
|
};
|
|
2507
2581
|
var packageGenDocs = async () => {
|
|
2508
2582
|
const pkg = process.env.INIT_CWD;
|
|
2509
|
-
if (pkg !== void 0 && !
|
|
2583
|
+
if (pkg !== void 0 && !existsSync7(path12.join(pkg, "typedoc.json"))) {
|
|
2510
2584
|
return;
|
|
2511
2585
|
}
|
|
2512
2586
|
const app = await Application.bootstrap({
|
|
@@ -2592,7 +2666,7 @@ var runTypeDoc = async (app) => {
|
|
|
2592
2666
|
return ExitCodes.OutputError;
|
|
2593
2667
|
}
|
|
2594
2668
|
}
|
|
2595
|
-
console.log(
|
|
2669
|
+
console.log(chalk35.green(`${pkgName} - Ok`));
|
|
2596
2670
|
return ExitCodes.Ok;
|
|
2597
2671
|
};
|
|
2598
2672
|
|
|
@@ -2601,7 +2675,7 @@ import { readdirSync as readdirSync4 } from "fs";
|
|
|
2601
2675
|
import path13 from "path";
|
|
2602
2676
|
import { cwd as cwd4 } from "process";
|
|
2603
2677
|
import { pathToFileURL } from "url";
|
|
2604
|
-
import
|
|
2678
|
+
import chalk36 from "chalk";
|
|
2605
2679
|
import { ESLint } from "eslint";
|
|
2606
2680
|
import { findUp } from "find-up";
|
|
2607
2681
|
import picomatch from "picomatch";
|
|
@@ -2610,14 +2684,14 @@ var dumpMessages = (lintResults) => {
|
|
|
2610
2684
|
const severity = ["none", "warning", "error"];
|
|
2611
2685
|
for (const lintResult of lintResults) {
|
|
2612
2686
|
if (lintResult.messages.length > 0) {
|
|
2613
|
-
console.log(
|
|
2687
|
+
console.log(chalk36.gray(`
|
|
2614
2688
|
${lintResult.filePath}`));
|
|
2615
2689
|
for (const message of lintResult.messages) {
|
|
2616
2690
|
console.log(
|
|
2617
|
-
|
|
2618
|
-
|
|
2619
|
-
|
|
2620
|
-
|
|
2691
|
+
chalk36.gray(` ${message.line}:${message.column}`),
|
|
2692
|
+
chalk36[colors[message.severity]](` ${severity[message.severity]}`),
|
|
2693
|
+
chalk36.white(` ${message.message}`),
|
|
2694
|
+
chalk36.gray(` ${message.ruleId}`)
|
|
2621
2695
|
);
|
|
2622
2696
|
}
|
|
2623
2697
|
}
|
|
@@ -2655,10 +2729,10 @@ var packageLint = async (fix2 = false, verbose = false, cache = true) => {
|
|
|
2655
2729
|
cache
|
|
2656
2730
|
});
|
|
2657
2731
|
const files = getFiles(cwd4(), ignoreFolders);
|
|
2658
|
-
console.log(
|
|
2732
|
+
console.log(chalk36.green(`Linting ${pkg} [files = ${files.length}]`));
|
|
2659
2733
|
if (verbose) {
|
|
2660
2734
|
for (const file of files) {
|
|
2661
|
-
console.log(
|
|
2735
|
+
console.log(chalk36.gray(` ${file}`));
|
|
2662
2736
|
}
|
|
2663
2737
|
}
|
|
2664
2738
|
const lintResults = await engine.lintFiles(files);
|
|
@@ -2669,32 +2743,32 @@ var packageLint = async (fix2 = false, verbose = false, cache = true) => {
|
|
|
2669
2743
|
const filesCountColor = files.length < 100 ? "green" : files.length < 1e3 ? "yellow" : "red";
|
|
2670
2744
|
const lintTime = Date.now() - start;
|
|
2671
2745
|
const lintTimeColor = lintTime < 1e3 ? "green" : lintTime < 3e3 ? "yellow" : "red";
|
|
2672
|
-
console.log(
|
|
2746
|
+
console.log(chalk36.white(`Linted ${chalk36[filesCountColor](files.length)} files in ${chalk36[lintTimeColor](lintTime)}ms`));
|
|
2673
2747
|
return lintResults.reduce((prev, lintResult) => prev + lintResult.errorCount, 0);
|
|
2674
2748
|
};
|
|
2675
2749
|
|
|
2676
2750
|
// src/actions/package/publint.ts
|
|
2677
2751
|
import { promises as fs10 } from "fs";
|
|
2678
|
-
import
|
|
2752
|
+
import chalk37 from "chalk";
|
|
2679
2753
|
import sortPackageJson from "sort-package-json";
|
|
2680
2754
|
var customPubLint = (pkg) => {
|
|
2681
2755
|
let errorCount = 0;
|
|
2682
2756
|
let warningCount = 0;
|
|
2683
2757
|
if (pkg.files === void 0) {
|
|
2684
|
-
console.warn(
|
|
2758
|
+
console.warn(chalk37.yellow('Publint [custom]: "files" field is missing'));
|
|
2685
2759
|
warningCount++;
|
|
2686
2760
|
}
|
|
2687
2761
|
if (pkg.main !== void 0) {
|
|
2688
|
-
console.warn(
|
|
2762
|
+
console.warn(chalk37.yellow('Publint [custom]: "main" field is deprecated, use "exports" instead'));
|
|
2689
2763
|
warningCount++;
|
|
2690
2764
|
}
|
|
2691
2765
|
if (pkg.sideEffects !== false) {
|
|
2692
|
-
console.warn(
|
|
2766
|
+
console.warn(chalk37.yellow('Publint [custom]: "sideEffects" field should be set to false'));
|
|
2693
2767
|
warningCount++;
|
|
2694
2768
|
}
|
|
2695
2769
|
if (pkg.resolutions !== void 0) {
|
|
2696
|
-
console.warn(
|
|
2697
|
-
console.warn(
|
|
2770
|
+
console.warn(chalk37.yellow('Publint [custom]: "resolutions" in use'));
|
|
2771
|
+
console.warn(chalk37.gray(JSON.stringify(pkg.resolutions, null, 2)));
|
|
2698
2772
|
warningCount++;
|
|
2699
2773
|
}
|
|
2700
2774
|
return [errorCount, warningCount];
|
|
@@ -2704,8 +2778,8 @@ var packagePublint = async ({ strict = true, verbose = false } = {}) => {
|
|
|
2704
2778
|
const sortedPkg = sortPackageJson(await fs10.readFile(`${pkgDir}/package.json`, "utf8"));
|
|
2705
2779
|
await fs10.writeFile(`${pkgDir}/package.json`, sortedPkg);
|
|
2706
2780
|
const pkg = JSON.parse(await fs10.readFile(`${pkgDir}/package.json`, "utf8"));
|
|
2707
|
-
console.log(
|
|
2708
|
-
console.log(
|
|
2781
|
+
console.log(chalk37.green(`Publint: ${pkg.name}`));
|
|
2782
|
+
console.log(chalk37.gray(pkgDir));
|
|
2709
2783
|
const { publint: publint2 } = await import("publint");
|
|
2710
2784
|
const { messages } = await publint2({
|
|
2711
2785
|
level: "suggestion",
|
|
@@ -2716,22 +2790,22 @@ var packagePublint = async ({ strict = true, verbose = false } = {}) => {
|
|
|
2716
2790
|
for (const message of messages) {
|
|
2717
2791
|
switch (message.type) {
|
|
2718
2792
|
case "error": {
|
|
2719
|
-
console.error(
|
|
2793
|
+
console.error(chalk37.red(`[${message.code}] ${formatMessage(message, pkg)}`));
|
|
2720
2794
|
break;
|
|
2721
2795
|
}
|
|
2722
2796
|
case "warning": {
|
|
2723
|
-
console.warn(
|
|
2797
|
+
console.warn(chalk37.yellow(`[${message.code}] ${formatMessage(message, pkg)}`));
|
|
2724
2798
|
break;
|
|
2725
2799
|
}
|
|
2726
2800
|
default: {
|
|
2727
|
-
console.log(
|
|
2801
|
+
console.log(chalk37.white(`[${message.code}] ${formatMessage(message, pkg)}`));
|
|
2728
2802
|
break;
|
|
2729
2803
|
}
|
|
2730
2804
|
}
|
|
2731
2805
|
}
|
|
2732
2806
|
const [errorCount, warningCount] = customPubLint(pkg);
|
|
2733
2807
|
if (verbose) {
|
|
2734
|
-
console.log(
|
|
2808
|
+
console.log(chalk37.gray(`Publint [Finish]: ${pkgDir} [${messages.length + errorCount + warningCount} messages]`));
|
|
2735
2809
|
}
|
|
2736
2810
|
return messages.filter((message) => message.type === "error").length + errorCount;
|
|
2737
2811
|
};
|
|
@@ -2782,7 +2856,7 @@ var rebuild = ({ target }) => {
|
|
|
2782
2856
|
};
|
|
2783
2857
|
|
|
2784
2858
|
// src/actions/recompile.ts
|
|
2785
|
-
import
|
|
2859
|
+
import chalk38 from "chalk";
|
|
2786
2860
|
var recompile = async ({
|
|
2787
2861
|
verbose,
|
|
2788
2862
|
target,
|
|
@@ -2818,7 +2892,7 @@ var recompileAll = async ({
|
|
|
2818
2892
|
const incrementalOptions = incremental ? ["--since", "-Apt", "--topological-dev"] : ["--parallel", "-Apt", "--topological-dev"];
|
|
2819
2893
|
const jobsOptions = jobs ? ["-j", `${jobs}`] : [];
|
|
2820
2894
|
if (jobs) {
|
|
2821
|
-
console.log(
|
|
2895
|
+
console.log(chalk38.blue(`Jobs set to [${jobs}]`));
|
|
2822
2896
|
}
|
|
2823
2897
|
const result = await runStepsAsync(`Recompile${incremental ? "-Incremental" : ""} [All]`, [
|
|
2824
2898
|
[
|
|
@@ -2849,7 +2923,7 @@ var recompileAll = async ({
|
|
|
2849
2923
|
]
|
|
2850
2924
|
]);
|
|
2851
2925
|
console.log(
|
|
2852
|
-
`${
|
|
2926
|
+
`${chalk38.gray("Recompiled in")} [${chalk38.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk38.gray("seconds")}`
|
|
2853
2927
|
);
|
|
2854
2928
|
return result;
|
|
2855
2929
|
};
|
|
@@ -2880,13 +2954,13 @@ var reinstall = () => {
|
|
|
2880
2954
|
};
|
|
2881
2955
|
|
|
2882
2956
|
// src/actions/relint.ts
|
|
2883
|
-
import
|
|
2957
|
+
import chalk39 from "chalk";
|
|
2884
2958
|
var relintPackage = ({
|
|
2885
2959
|
pkg,
|
|
2886
2960
|
fix: fix2,
|
|
2887
2961
|
verbose
|
|
2888
2962
|
}) => {
|
|
2889
|
-
console.log(
|
|
2963
|
+
console.log(chalk39.gray(`${fix2 ? "Fix" : "Lint"} [${pkg}]`));
|
|
2890
2964
|
const start = Date.now();
|
|
2891
2965
|
const result = runSteps(`${fix2 ? "Fix" : "Lint"} [${pkg}]`, [
|
|
2892
2966
|
["yarn", [
|
|
@@ -2896,7 +2970,7 @@ var relintPackage = ({
|
|
|
2896
2970
|
fix2 ? "package-fix" : verbose ? "package-lint-verbose" : "package-lint"
|
|
2897
2971
|
]]
|
|
2898
2972
|
]);
|
|
2899
|
-
console.log(
|
|
2973
|
+
console.log(chalk39.gray(`${fix2 ? "Fixed in" : "Linted in"} [${chalk39.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk39.gray("seconds")}`));
|
|
2900
2974
|
return result;
|
|
2901
2975
|
};
|
|
2902
2976
|
var relint = ({
|
|
@@ -2916,13 +2990,13 @@ var relint = ({
|
|
|
2916
2990
|
});
|
|
2917
2991
|
};
|
|
2918
2992
|
var relintAllPackages = ({ fix: fix2 = false } = {}) => {
|
|
2919
|
-
console.log(
|
|
2993
|
+
console.log(chalk39.gray(`${fix2 ? "Fix" : "Lint"} [All-Packages]`));
|
|
2920
2994
|
const start = Date.now();
|
|
2921
2995
|
const fixOptions = fix2 ? ["--fix"] : [];
|
|
2922
2996
|
const result = runSteps(`${fix2 ? "Fix" : "Lint"} [All-Packages]`, [
|
|
2923
2997
|
["yarn", ["eslint", ...fixOptions]]
|
|
2924
2998
|
]);
|
|
2925
|
-
console.log(
|
|
2999
|
+
console.log(chalk39.gray(`${fix2 ? "Fixed in" : "Linted in"} [${chalk39.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk39.gray("seconds")}`));
|
|
2926
3000
|
return result;
|
|
2927
3001
|
};
|
|
2928
3002
|
|
|
@@ -2940,10 +3014,10 @@ var sonar = () => {
|
|
|
2940
3014
|
};
|
|
2941
3015
|
|
|
2942
3016
|
// src/actions/statics.ts
|
|
2943
|
-
import
|
|
3017
|
+
import chalk40 from "chalk";
|
|
2944
3018
|
var DefaultDependencies = ["axios", "@xylabs/pixel", "react", "graphql", "react-router", "@mui/material", "@mui/system"];
|
|
2945
3019
|
var statics = () => {
|
|
2946
|
-
console.log(
|
|
3020
|
+
console.log(chalk40.green("Check Required Static Dependencies"));
|
|
2947
3021
|
const statics2 = parsedPackageJSON()?.xy?.deps?.statics;
|
|
2948
3022
|
return detectDuplicateDependencies(statics2, DefaultDependencies);
|
|
2949
3023
|
};
|
|
@@ -2995,6 +3069,7 @@ export {
|
|
|
2995
3069
|
bundleDts,
|
|
2996
3070
|
claudeCommands,
|
|
2997
3071
|
claudeRules,
|
|
3072
|
+
claudeSettings,
|
|
2998
3073
|
clean,
|
|
2999
3074
|
cleanAll,
|
|
3000
3075
|
cleanDocs,
|