@xylabs/ts-scripts-yarn3 7.4.16 → 7.4.18
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/deplint/checkPackage/checkPackage.mjs +3 -0
- package/dist/actions/deplint/checkPackage/checkPackage.mjs.map +1 -1
- package/dist/actions/deplint/checkPackage/index.mjs +3 -0
- package/dist/actions/deplint/checkPackage/index.mjs.map +1 -1
- package/dist/actions/deplint/deplint.mjs +3 -0
- package/dist/actions/deplint/deplint.mjs.map +1 -1
- package/dist/actions/deplint/getExternalImportsFromFiles.mjs +3 -0
- package/dist/actions/deplint/getExternalImportsFromFiles.mjs.map +1 -1
- package/dist/actions/deplint/getImportsFromFile.mjs +3 -0
- package/dist/actions/deplint/getImportsFromFile.mjs.map +1 -1
- package/dist/actions/deplint/index.mjs +3 -0
- package/dist/actions/deplint/index.mjs.map +1 -1
- package/dist/actions/index.mjs +194 -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 +153 -71
- package/dist/bin/xy.mjs.map +1 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.mjs +214 -128
- package/dist/index.mjs.map +1 -1
- package/dist/xy/index.mjs +153 -71
- package/dist/xy/index.mjs.map +1 -1
- package/dist/xy/xy.mjs +153 -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/dist/xy/xyLintCommands.mjs +3 -0
- package/dist/xy/xyLintCommands.mjs.map +1 -1
- package/package.json +2 -2
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";
|
|
@@ -1077,6 +1148,9 @@ function getImportsFromFile(filePath, importPaths, typeImportPaths) {
|
|
|
1077
1148
|
ts.forEachChild(node, visit);
|
|
1078
1149
|
}
|
|
1079
1150
|
visit(sourceFile);
|
|
1151
|
+
for (const ref of sourceFile.typeReferenceDirectives) {
|
|
1152
|
+
typeImports.push(ref.fileName);
|
|
1153
|
+
}
|
|
1080
1154
|
const importsStartsWithExcludes = [".", "#", "node:"];
|
|
1081
1155
|
const isValidImport = (imp) => !importsStartsWithExcludes.some((exc) => imp.startsWith(exc)) && !imp.includes("*") && !imp.includes("!");
|
|
1082
1156
|
const cleanedImports = imports.filter(isValidImport).map(getBasePackageName);
|
|
@@ -1132,7 +1206,7 @@ function getExternalImportsFromFiles({
|
|
|
1132
1206
|
|
|
1133
1207
|
// src/actions/deplint/checkPackage/getUnlistedDependencies.ts
|
|
1134
1208
|
import { builtinModules } from "module";
|
|
1135
|
-
import
|
|
1209
|
+
import chalk16 from "chalk";
|
|
1136
1210
|
function isRuntimeImportListed(imp, name, dependencies, peerDependencies) {
|
|
1137
1211
|
return dependencies.includes(imp) || imp === name || peerDependencies.includes(imp) || builtinModules.includes(imp);
|
|
1138
1212
|
}
|
|
@@ -1140,7 +1214,7 @@ function isTypeImportListed(imp, name, dependencies, devDependencies, peerDepend
|
|
|
1140
1214
|
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
1215
|
}
|
|
1142
1216
|
function logMissing(name, imp, importPaths) {
|
|
1143
|
-
console.log(`[${
|
|
1217
|
+
console.log(`[${chalk16.blue(name)}] Missing dependency in package.json: ${chalk16.red(imp)}`);
|
|
1144
1218
|
if (importPaths[imp]) {
|
|
1145
1219
|
console.log(` ${importPaths[imp].join("\n ")}`);
|
|
1146
1220
|
}
|
|
@@ -1169,7 +1243,7 @@ function getUnlistedDependencies({ name, location }, {
|
|
|
1169
1243
|
}
|
|
1170
1244
|
if (unlistedDependencies > 0) {
|
|
1171
1245
|
const packageLocation = `${location}/package.json`;
|
|
1172
|
-
console.log(` ${
|
|
1246
|
+
console.log(` ${chalk16.yellow(packageLocation)}
|
|
1173
1247
|
`);
|
|
1174
1248
|
}
|
|
1175
1249
|
return unlistedDependencies;
|
|
@@ -1177,7 +1251,7 @@ function getUnlistedDependencies({ name, location }, {
|
|
|
1177
1251
|
|
|
1178
1252
|
// src/actions/deplint/checkPackage/getUnlistedDevDependencies.ts
|
|
1179
1253
|
import { builtinModules as builtinModules2 } from "module";
|
|
1180
|
-
import
|
|
1254
|
+
import chalk17 from "chalk";
|
|
1181
1255
|
function getUnlistedDevDependencies({ name, location }, {
|
|
1182
1256
|
devDependencies,
|
|
1183
1257
|
dependencies,
|
|
@@ -1191,7 +1265,7 @@ function getUnlistedDevDependencies({ name, location }, {
|
|
|
1191
1265
|
for (const imp of externalAllImports) {
|
|
1192
1266
|
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
1267
|
unlistedDevDependencies++;
|
|
1194
|
-
console.log(`[${
|
|
1268
|
+
console.log(`[${chalk17.blue(name)}] Missing devDependency in package.json: ${chalk17.red(imp)}`);
|
|
1195
1269
|
if (allImportPaths[imp]) {
|
|
1196
1270
|
console.log(` ${allImportPaths[imp].join("\n ")}`);
|
|
1197
1271
|
}
|
|
@@ -1199,14 +1273,14 @@ function getUnlistedDevDependencies({ name, location }, {
|
|
|
1199
1273
|
}
|
|
1200
1274
|
if (unlistedDevDependencies > 0) {
|
|
1201
1275
|
const packageLocation = `${location}/package.json`;
|
|
1202
|
-
console.log(` ${
|
|
1276
|
+
console.log(` ${chalk17.yellow(packageLocation)}
|
|
1203
1277
|
`);
|
|
1204
1278
|
}
|
|
1205
1279
|
return unlistedDevDependencies;
|
|
1206
1280
|
}
|
|
1207
1281
|
|
|
1208
1282
|
// src/actions/deplint/checkPackage/getUnusedDependencies.ts
|
|
1209
|
-
import
|
|
1283
|
+
import chalk18 from "chalk";
|
|
1210
1284
|
function getUnusedDependencies({ name, location }, { dependencies }, {
|
|
1211
1285
|
externalDistImports,
|
|
1212
1286
|
externalDistTypeImports,
|
|
@@ -1218,22 +1292,22 @@ function getUnusedDependencies({ name, location }, { dependencies }, {
|
|
|
1218
1292
|
if (!externalDistImports.includes(dep) && !externalDistImports.includes(dep.replace(/^@types\//, "")) && !externalDistTypeImports.includes(dep) && !externalDistTypeImports.includes(dep.replace(/^@types\//, ""))) {
|
|
1219
1293
|
unusedDependencies++;
|
|
1220
1294
|
if (externalAllImports.includes(dep)) {
|
|
1221
|
-
console.log(`[${
|
|
1295
|
+
console.log(`[${chalk18.blue(name)}] dependency should be devDependency in package.json: ${chalk18.red(dep)}`);
|
|
1222
1296
|
} else {
|
|
1223
|
-
console.log(`[${
|
|
1297
|
+
console.log(`[${chalk18.blue(name)}] Unused dependency in package.json: ${chalk18.red(dep)}`);
|
|
1224
1298
|
}
|
|
1225
1299
|
}
|
|
1226
1300
|
}
|
|
1227
1301
|
if (unusedDependencies > 0) {
|
|
1228
1302
|
const packageLocation = `${location}/package.json`;
|
|
1229
|
-
console.log(` ${
|
|
1303
|
+
console.log(` ${chalk18.yellow(packageLocation)}
|
|
1230
1304
|
`);
|
|
1231
1305
|
}
|
|
1232
1306
|
return unusedDependencies;
|
|
1233
1307
|
}
|
|
1234
1308
|
|
|
1235
1309
|
// src/actions/deplint/checkPackage/getUnusedDevDependencies.ts
|
|
1236
|
-
import
|
|
1310
|
+
import chalk19 from "chalk";
|
|
1237
1311
|
|
|
1238
1312
|
// src/actions/deplint/getCliReferencedPackagesFromFiles.ts
|
|
1239
1313
|
import fs8 from "fs";
|
|
@@ -1517,19 +1591,19 @@ function getUnusedDevDependencies({ name, location }, {
|
|
|
1517
1591
|
if (dependencies.includes(dep) || peerDependencies.includes(dep)) continue;
|
|
1518
1592
|
if (!isDevDepUsed(dep, allImports, implicitDeps, requiredPeers, scriptRefs, cliRefs)) {
|
|
1519
1593
|
unusedDevDependencies++;
|
|
1520
|
-
console.log(`[${
|
|
1594
|
+
console.log(`[${chalk19.blue(name)}] Unused devDependency in package.json: ${chalk19.red(dep)}`);
|
|
1521
1595
|
}
|
|
1522
1596
|
}
|
|
1523
1597
|
if (unusedDevDependencies > 0) {
|
|
1524
1598
|
const packageLocation = `${location}/package.json`;
|
|
1525
|
-
console.log(` ${
|
|
1599
|
+
console.log(` ${chalk19.yellow(packageLocation)}
|
|
1526
1600
|
`);
|
|
1527
1601
|
}
|
|
1528
1602
|
return unusedDevDependencies;
|
|
1529
1603
|
}
|
|
1530
1604
|
|
|
1531
1605
|
// src/actions/deplint/checkPackage/getUnusedPeerDependencies.ts
|
|
1532
|
-
import
|
|
1606
|
+
import chalk20 from "chalk";
|
|
1533
1607
|
function getUnusedPeerDependencies({ name, location }, { peerDependencies, dependencies }, { externalDistImports, externalDistTypeImports }, exclude) {
|
|
1534
1608
|
let unusedDependencies = 0;
|
|
1535
1609
|
for (const dep of peerDependencies) {
|
|
@@ -1537,15 +1611,15 @@ function getUnusedPeerDependencies({ name, location }, { peerDependencies, depen
|
|
|
1537
1611
|
if (!externalDistImports.includes(dep) && !externalDistImports.includes(dep.replace(/^@types\//, "")) && !externalDistTypeImports.includes(dep) && !externalDistTypeImports.includes(dep.replace(/^@types\//, ""))) {
|
|
1538
1612
|
unusedDependencies++;
|
|
1539
1613
|
if (dependencies.includes(dep)) {
|
|
1540
|
-
console.log(`[${
|
|
1614
|
+
console.log(`[${chalk20.blue(name)}] Unused peerDependency [already a dependency] in package.json: ${chalk20.red(dep)}`);
|
|
1541
1615
|
} else {
|
|
1542
|
-
console.log(`[${
|
|
1616
|
+
console.log(`[${chalk20.blue(name)}] Unused peerDependency in package.json: ${chalk20.red(dep)}`);
|
|
1543
1617
|
}
|
|
1544
1618
|
}
|
|
1545
1619
|
}
|
|
1546
1620
|
if (unusedDependencies > 0) {
|
|
1547
1621
|
const packageLocation = `${location}/package.json`;
|
|
1548
|
-
console.log(` ${
|
|
1622
|
+
console.log(` ${chalk20.yellow(packageLocation)}
|
|
1549
1623
|
`);
|
|
1550
1624
|
}
|
|
1551
1625
|
return unusedDependencies;
|
|
@@ -1640,9 +1714,9 @@ var deplint = async ({
|
|
|
1640
1714
|
});
|
|
1641
1715
|
}
|
|
1642
1716
|
if (totalErrors > 0) {
|
|
1643
|
-
console.warn(`Deplint: Found ${
|
|
1717
|
+
console.warn(`Deplint: Found ${chalk21.red(totalErrors)} dependency problems. ${chalk21.red("\u2716")}`);
|
|
1644
1718
|
} else {
|
|
1645
|
-
console.info(`Deplint: Found no dependency problems. ${
|
|
1719
|
+
console.info(`Deplint: Found no dependency problems. ${chalk21.green("\u2714")}`);
|
|
1646
1720
|
}
|
|
1647
1721
|
return 0;
|
|
1648
1722
|
};
|
|
@@ -1744,22 +1818,22 @@ var deployNext = () => {
|
|
|
1744
1818
|
};
|
|
1745
1819
|
|
|
1746
1820
|
// src/actions/dupdeps.ts
|
|
1747
|
-
import
|
|
1821
|
+
import chalk22 from "chalk";
|
|
1748
1822
|
var dupdeps = () => {
|
|
1749
|
-
console.log(
|
|
1823
|
+
console.log(chalk22.green("Checking all Dependencies for Duplicates"));
|
|
1750
1824
|
const allDependencies = parsedPackageJSON()?.dependencies;
|
|
1751
1825
|
const dependencies = Object.entries(allDependencies).map(([k]) => k);
|
|
1752
1826
|
return detectDuplicateDependencies(dependencies);
|
|
1753
1827
|
};
|
|
1754
1828
|
|
|
1755
1829
|
// src/actions/lint.ts
|
|
1756
|
-
import
|
|
1830
|
+
import chalk23 from "chalk";
|
|
1757
1831
|
var lintPackage = ({
|
|
1758
1832
|
pkg,
|
|
1759
1833
|
fix: fix2,
|
|
1760
1834
|
verbose
|
|
1761
1835
|
}) => {
|
|
1762
|
-
console.log(
|
|
1836
|
+
console.log(chalk23.gray(`${fix2 ? "Fix" : "Lint"} [${pkg}]`));
|
|
1763
1837
|
const start = Date.now();
|
|
1764
1838
|
const result = runSteps(`${fix2 ? "Fix" : "Lint"} [${pkg}]`, [
|
|
1765
1839
|
["yarn", [
|
|
@@ -1769,7 +1843,7 @@ var lintPackage = ({
|
|
|
1769
1843
|
fix2 ? "package-fix" : verbose ? "package-lint-verbose" : "package-lint"
|
|
1770
1844
|
]]
|
|
1771
1845
|
]);
|
|
1772
|
-
console.log(
|
|
1846
|
+
console.log(chalk23.gray(`${fix2 ? "Fixed in" : "Linted in"} [${chalk23.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk23.gray("seconds")}`));
|
|
1773
1847
|
return result;
|
|
1774
1848
|
};
|
|
1775
1849
|
var lint = ({
|
|
@@ -1789,13 +1863,13 @@ var lint = ({
|
|
|
1789
1863
|
});
|
|
1790
1864
|
};
|
|
1791
1865
|
var lintAllPackages = ({ fix: fix2 = false } = {}) => {
|
|
1792
|
-
console.log(
|
|
1866
|
+
console.log(chalk23.gray(`${fix2 ? "Fix" : "Lint"} [All-Packages]`));
|
|
1793
1867
|
const start = Date.now();
|
|
1794
1868
|
const fixOptions = fix2 ? ["--fix"] : [];
|
|
1795
1869
|
const result = runSteps(`${fix2 ? "Fix" : "Lint"} [All-Packages]`, [
|
|
1796
1870
|
["yarn", ["eslint", "--cache", "--cache-location", ".eslintcache", "--cache-strategy", "content", ...fixOptions]]
|
|
1797
1871
|
]);
|
|
1798
|
-
console.log(
|
|
1872
|
+
console.log(chalk23.gray(`${fix2 ? "Fixed in" : "Linted in"} [${chalk23.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk23.gray("seconds")}`));
|
|
1799
1873
|
return result;
|
|
1800
1874
|
};
|
|
1801
1875
|
|
|
@@ -1823,7 +1897,7 @@ var filename = ".gitignore";
|
|
|
1823
1897
|
var gitignoreGen = (pkg) => generateIgnoreFiles(filename, pkg);
|
|
1824
1898
|
|
|
1825
1899
|
// src/actions/gitlint.ts
|
|
1826
|
-
import
|
|
1900
|
+
import chalk24 from "chalk";
|
|
1827
1901
|
import ParseGitConfig from "parse-git-config";
|
|
1828
1902
|
var gitlint = () => {
|
|
1829
1903
|
console.log(`
|
|
@@ -1834,7 +1908,7 @@ Gitlint Start [${process.cwd()}]
|
|
|
1834
1908
|
const errors = 0;
|
|
1835
1909
|
const gitConfig = ParseGitConfig.sync();
|
|
1836
1910
|
const warn = (message) => {
|
|
1837
|
-
console.warn(
|
|
1911
|
+
console.warn(chalk24.yellow(`Warning: ${message}`));
|
|
1838
1912
|
warnings++;
|
|
1839
1913
|
};
|
|
1840
1914
|
if (gitConfig.core.ignorecase) {
|
|
@@ -1854,13 +1928,13 @@ Gitlint Start [${process.cwd()}]
|
|
|
1854
1928
|
}
|
|
1855
1929
|
const resultMessages = [];
|
|
1856
1930
|
if (valid > 0) {
|
|
1857
|
-
resultMessages.push(
|
|
1931
|
+
resultMessages.push(chalk24.green(`Passed: ${valid}`));
|
|
1858
1932
|
}
|
|
1859
1933
|
if (warnings > 0) {
|
|
1860
|
-
resultMessages.push(
|
|
1934
|
+
resultMessages.push(chalk24.yellow(`Warnings: ${warnings}`));
|
|
1861
1935
|
}
|
|
1862
1936
|
if (errors > 0) {
|
|
1863
|
-
resultMessages.push(
|
|
1937
|
+
resultMessages.push(chalk24.red(` Errors: ${errors}`));
|
|
1864
1938
|
}
|
|
1865
1939
|
console.warn(`Gitlint Finish [ ${resultMessages.join(" | ")} ]
|
|
1866
1940
|
`);
|
|
@@ -1869,7 +1943,7 @@ Gitlint Start [${process.cwd()}]
|
|
|
1869
1943
|
|
|
1870
1944
|
// src/actions/gitlint-fix.ts
|
|
1871
1945
|
import { execSync as execSync3 } from "child_process";
|
|
1872
|
-
import
|
|
1946
|
+
import chalk25 from "chalk";
|
|
1873
1947
|
import ParseGitConfig2 from "parse-git-config";
|
|
1874
1948
|
var gitlintFix = () => {
|
|
1875
1949
|
console.log(`
|
|
@@ -1878,15 +1952,15 @@ Gitlint Fix Start [${process.cwd()}]
|
|
|
1878
1952
|
const gitConfig = ParseGitConfig2.sync();
|
|
1879
1953
|
if (gitConfig.core.ignorecase) {
|
|
1880
1954
|
execSync3("git config core.ignorecase false", { stdio: "inherit" });
|
|
1881
|
-
console.warn(
|
|
1955
|
+
console.warn(chalk25.yellow("\nGitlint Fix: Updated core.ignorecase to be false\n"));
|
|
1882
1956
|
}
|
|
1883
1957
|
if (gitConfig.core.autocrlf !== false) {
|
|
1884
1958
|
execSync3("git config core.autocrlf false", { stdio: "inherit" });
|
|
1885
|
-
console.warn(
|
|
1959
|
+
console.warn(chalk25.yellow("\nGitlint Fix: Updated core.autocrlf to be false\n"));
|
|
1886
1960
|
}
|
|
1887
1961
|
if (gitConfig.core.eol !== "lf") {
|
|
1888
1962
|
execSync3("git config core.eol lf", { stdio: "inherit" });
|
|
1889
|
-
console.warn(
|
|
1963
|
+
console.warn(chalk25.yellow('\nGitlint Fix: Updated core.eol to be "lf"\n'));
|
|
1890
1964
|
}
|
|
1891
1965
|
return 1;
|
|
1892
1966
|
};
|
|
@@ -1897,7 +1971,7 @@ var knip = () => {
|
|
|
1897
1971
|
};
|
|
1898
1972
|
|
|
1899
1973
|
// src/actions/license.ts
|
|
1900
|
-
import
|
|
1974
|
+
import chalk26 from "chalk";
|
|
1901
1975
|
import { init } from "license-checker";
|
|
1902
1976
|
var license = async (pkg) => {
|
|
1903
1977
|
const workspaces = yarnWorkspaces();
|
|
@@ -1922,18 +1996,18 @@ var license = async (pkg) => {
|
|
|
1922
1996
|
"LGPL-3.0-or-later",
|
|
1923
1997
|
"Python-2.0"
|
|
1924
1998
|
]);
|
|
1925
|
-
console.log(
|
|
1999
|
+
console.log(chalk26.green("License Checker"));
|
|
1926
2000
|
return (await Promise.all(
|
|
1927
2001
|
workspaceList.map(({ location, name }) => {
|
|
1928
2002
|
return new Promise((resolve) => {
|
|
1929
2003
|
init({ production: true, start: location }, (error, packages) => {
|
|
1930
2004
|
if (error) {
|
|
1931
|
-
console.error(
|
|
1932
|
-
console.error(
|
|
2005
|
+
console.error(chalk26.red(`License Checker [${name}] Error`));
|
|
2006
|
+
console.error(chalk26.gray(error));
|
|
1933
2007
|
console.log("\n");
|
|
1934
2008
|
resolve(1);
|
|
1935
2009
|
} else {
|
|
1936
|
-
console.log(
|
|
2010
|
+
console.log(chalk26.green(`License Checker [${name}]`));
|
|
1937
2011
|
let count = 0;
|
|
1938
2012
|
for (const [name2, info] of Object.entries(packages)) {
|
|
1939
2013
|
const licenses = Array.isArray(info.licenses) ? info.licenses : [info.licenses];
|
|
@@ -1949,7 +2023,7 @@ var license = async (pkg) => {
|
|
|
1949
2023
|
}
|
|
1950
2024
|
if (!orLicenseFound) {
|
|
1951
2025
|
count++;
|
|
1952
|
-
console.warn(
|
|
2026
|
+
console.warn(chalk26.yellow(`${name2}: Package License not allowed [${license2}]`));
|
|
1953
2027
|
}
|
|
1954
2028
|
}
|
|
1955
2029
|
}
|
|
@@ -1969,12 +2043,12 @@ var npmignoreGen = (pkg) => generateIgnoreFiles(filename2, pkg);
|
|
|
1969
2043
|
|
|
1970
2044
|
// src/actions/package/clean-outputs.ts
|
|
1971
2045
|
import path8 from "path";
|
|
1972
|
-
import
|
|
2046
|
+
import chalk27 from "chalk";
|
|
1973
2047
|
var packageCleanOutputs = () => {
|
|
1974
2048
|
const pkg = process.env.INIT_CWD ?? ".";
|
|
1975
2049
|
const pkgName = process.env.npm_package_name;
|
|
1976
2050
|
const folders = [path8.join(pkg, "dist"), path8.join(pkg, "build"), path8.join(pkg, "docs")];
|
|
1977
|
-
console.log(
|
|
2051
|
+
console.log(chalk27.green(`Cleaning Outputs [${pkgName}]`));
|
|
1978
2052
|
for (let folder of folders) {
|
|
1979
2053
|
deleteGlob(folder);
|
|
1980
2054
|
}
|
|
@@ -1983,11 +2057,11 @@ var packageCleanOutputs = () => {
|
|
|
1983
2057
|
|
|
1984
2058
|
// src/actions/package/clean-typescript.ts
|
|
1985
2059
|
import path9 from "path";
|
|
1986
|
-
import
|
|
2060
|
+
import chalk28 from "chalk";
|
|
1987
2061
|
var packageCleanTypescript = () => {
|
|
1988
2062
|
const pkg = process.env.INIT_CWD ?? ".";
|
|
1989
2063
|
const pkgName = process.env.npm_package_name;
|
|
1990
|
-
console.log(
|
|
2064
|
+
console.log(chalk28.green(`Cleaning Typescript [${pkgName}]`));
|
|
1991
2065
|
const files = [path9.join(pkg, "*.tsbuildinfo"), path9.join(pkg, ".tsconfig.*"), path9.join(pkg, ".eslintcache")];
|
|
1992
2066
|
for (let file of files) {
|
|
1993
2067
|
deleteGlob(file);
|
|
@@ -2001,32 +2075,35 @@ var packageClean = async () => {
|
|
|
2001
2075
|
};
|
|
2002
2076
|
|
|
2003
2077
|
// src/actions/package/compile/compile.ts
|
|
2004
|
-
import
|
|
2078
|
+
import chalk33 from "chalk";
|
|
2005
2079
|
|
|
2006
2080
|
// src/actions/package/compile/packageCompileTsup.ts
|
|
2007
|
-
import
|
|
2081
|
+
import chalk32 from "chalk";
|
|
2008
2082
|
import { build as build2, defineConfig } from "tsup";
|
|
2009
2083
|
|
|
2010
2084
|
// src/actions/package/compile/inputs.ts
|
|
2011
|
-
import
|
|
2085
|
+
import chalk29 from "chalk";
|
|
2012
2086
|
import { glob as glob2 } from "glob";
|
|
2013
2087
|
var getAllInputs = (srcDir, verbose = false) => {
|
|
2014
2088
|
return [...glob2.sync(`${srcDir}/**/*.ts`, { posix: true }).map((file) => {
|
|
2015
2089
|
const result = file.slice(Math.max(0, srcDir.length + 1));
|
|
2016
2090
|
if (verbose) {
|
|
2017
|
-
console.log(
|
|
2091
|
+
console.log(chalk29.gray(`getAllInputs: ${JSON.stringify(result, null, 2)}`));
|
|
2018
2092
|
}
|
|
2019
2093
|
return result;
|
|
2020
2094
|
}), ...glob2.sync(`${srcDir}/**/*.tsx`, { posix: true }).map((file) => {
|
|
2021
2095
|
const result = file.slice(Math.max(0, srcDir.length + 1));
|
|
2022
2096
|
if (verbose) {
|
|
2023
|
-
console.log(
|
|
2097
|
+
console.log(chalk29.gray(`getAllInputs: ${JSON.stringify(result, null, 2)}`));
|
|
2024
2098
|
}
|
|
2025
2099
|
return result;
|
|
2026
2100
|
})];
|
|
2027
2101
|
};
|
|
2028
2102
|
|
|
2029
2103
|
// src/actions/package/compile/buildEntries.ts
|
|
2104
|
+
var isSpecOrStory = (entry) => {
|
|
2105
|
+
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");
|
|
2106
|
+
};
|
|
2030
2107
|
var buildEntries = (srcDir, entryMode = "single", options, excludeSpecAndStories = true, verbose = false) => {
|
|
2031
2108
|
let entries = [];
|
|
2032
2109
|
switch (entryMode) {
|
|
@@ -2035,7 +2112,7 @@ var buildEntries = (srcDir, entryMode = "single", options, excludeSpecAndStories
|
|
|
2035
2112
|
break;
|
|
2036
2113
|
}
|
|
2037
2114
|
case "all": {
|
|
2038
|
-
entries = (excludeSpecAndStories ? getAllInputs(srcDir).filter((entry) => !
|
|
2115
|
+
entries = (excludeSpecAndStories ? getAllInputs(srcDir).filter((entry) => !isSpecOrStory(entry)) : getAllInputs(srcDir)).filter((entry) => !entry.endsWith(".d.ts"));
|
|
2039
2116
|
break;
|
|
2040
2117
|
}
|
|
2041
2118
|
case "custom": {
|
|
@@ -2079,7 +2156,7 @@ function deepMergeObjects(objects) {
|
|
|
2079
2156
|
|
|
2080
2157
|
// src/actions/package/compile/packageCompileTsc.ts
|
|
2081
2158
|
import { cwd as cwd2 } from "process";
|
|
2082
|
-
import
|
|
2159
|
+
import chalk30 from "chalk";
|
|
2083
2160
|
import { createProgramFromConfig } from "tsc-prog";
|
|
2084
2161
|
import ts3, {
|
|
2085
2162
|
DiagnosticCategory,
|
|
@@ -2101,7 +2178,7 @@ var getCompilerOptions = (options = {}, fileName = "tsconfig.json") => {
|
|
|
2101
2178
|
var packageCompileTsc = (platform, entries, srcDir = "src", outDir = "dist", compilerOptionsParam, verbose = false) => {
|
|
2102
2179
|
const pkg = process.env.INIT_CWD ?? cwd2();
|
|
2103
2180
|
if (verbose) {
|
|
2104
|
-
console.log(
|
|
2181
|
+
console.log(chalk30.cyan(`Validating code START: ${entries.length} files to ${outDir} from ${srcDir}`));
|
|
2105
2182
|
}
|
|
2106
2183
|
const configFilePath = ts3.findConfigFile(
|
|
2107
2184
|
"./",
|
|
@@ -2124,10 +2201,10 @@ var packageCompileTsc = (platform, entries, srcDir = "src", outDir = "dist", com
|
|
|
2124
2201
|
emitDeclarationOnly: true,
|
|
2125
2202
|
noEmit: false
|
|
2126
2203
|
};
|
|
2127
|
-
console.log(
|
|
2204
|
+
console.log(chalk30.cyan(`Validating Files: ${entries.length}`));
|
|
2128
2205
|
if (verbose) {
|
|
2129
2206
|
for (const entry of entries) {
|
|
2130
|
-
console.log(
|
|
2207
|
+
console.log(chalk30.grey(`Validating: ${entry}`));
|
|
2131
2208
|
}
|
|
2132
2209
|
}
|
|
2133
2210
|
try {
|
|
@@ -2151,7 +2228,7 @@ var packageCompileTsc = (platform, entries, srcDir = "src", outDir = "dist", com
|
|
|
2151
2228
|
);
|
|
2152
2229
|
console.error(formattedDiagnostics);
|
|
2153
2230
|
}
|
|
2154
|
-
const nonEmitPatterns = [".stories.", "/stories/", ".spec.", "/spec/", ".example."];
|
|
2231
|
+
const nonEmitPatterns = [".stories.", "/stories/", "/stories.", ".spec.", "/spec/", "/spec.", ".example."];
|
|
2155
2232
|
program.emit(void 0, (fileName, text, writeByteOrderMark) => {
|
|
2156
2233
|
if (nonEmitPatterns.some((pattern) => fileName.includes(pattern))) {
|
|
2157
2234
|
return;
|
|
@@ -2163,7 +2240,7 @@ var packageCompileTsc = (platform, entries, srcDir = "src", outDir = "dist", com
|
|
|
2163
2240
|
return 0;
|
|
2164
2241
|
} finally {
|
|
2165
2242
|
if (verbose) {
|
|
2166
|
-
console.log(
|
|
2243
|
+
console.log(chalk30.cyan(`Validating code FINISH: ${entries.length} files to ${outDir} from ${srcDir}`));
|
|
2167
2244
|
}
|
|
2168
2245
|
}
|
|
2169
2246
|
};
|
|
@@ -2171,7 +2248,7 @@ var packageCompileTsc = (platform, entries, srcDir = "src", outDir = "dist", com
|
|
|
2171
2248
|
// src/actions/package/compile/packageCompileTscTypes.ts
|
|
2172
2249
|
import path10 from "path";
|
|
2173
2250
|
import { cwd as cwd3 } from "process";
|
|
2174
|
-
import
|
|
2251
|
+
import chalk31 from "chalk";
|
|
2175
2252
|
import { rollup } from "rollup";
|
|
2176
2253
|
import dts from "rollup-plugin-dts";
|
|
2177
2254
|
import nodeExternals from "rollup-plugin-node-externals";
|
|
@@ -2196,8 +2273,8 @@ async function bundleDts(inputPath, outputPath, platform, options, verbose = fal
|
|
|
2196
2273
|
if (ignoredWarningCodes.has(warning.code ?? "")) {
|
|
2197
2274
|
return;
|
|
2198
2275
|
}
|
|
2199
|
-
console.warn(
|
|
2200
|
-
console.warn(
|
|
2276
|
+
console.warn(chalk31.yellow(`[${warning.code}] ${warning.message}`));
|
|
2277
|
+
console.warn(chalk31.gray(inputPath));
|
|
2201
2278
|
warn(warning);
|
|
2202
2279
|
}
|
|
2203
2280
|
});
|
|
@@ -2207,8 +2284,8 @@ async function bundleDts(inputPath, outputPath, platform, options, verbose = fal
|
|
|
2207
2284
|
});
|
|
2208
2285
|
} catch (ex) {
|
|
2209
2286
|
const error = ex;
|
|
2210
|
-
console.warn(
|
|
2211
|
-
console.warn(
|
|
2287
|
+
console.warn(chalk31.red(error));
|
|
2288
|
+
console.warn(chalk31.gray(inputPath));
|
|
2212
2289
|
}
|
|
2213
2290
|
if (verbose) {
|
|
2214
2291
|
console.log(`Bundled declarations written to ${outputPath}`);
|
|
@@ -2216,7 +2293,7 @@ async function bundleDts(inputPath, outputPath, platform, options, verbose = fal
|
|
|
2216
2293
|
}
|
|
2217
2294
|
var packageCompileTscTypes = async (entries, outDir, platform, srcDir = "build", verbose = false) => {
|
|
2218
2295
|
if (verbose) {
|
|
2219
|
-
console.log(
|
|
2296
|
+
console.log(chalk31.cyan(`Compiling Types START [${platform}]: ${entries.length} files to ${outDir} from ${srcDir}`));
|
|
2220
2297
|
console.log(`Entries: ${entries.join(", ")}`);
|
|
2221
2298
|
}
|
|
2222
2299
|
const pkg = process.env.INIT_CWD ?? cwd3();
|
|
@@ -2240,7 +2317,7 @@ var packageCompileTscTypes = async (entries, outDir, platform, srcDir = "build",
|
|
|
2240
2317
|
await bundleDts(`${srcRoot}/${entryTypeName}`, `${outDir}/${entryTypeName}`, platform, { compilerOptions }, verbose);
|
|
2241
2318
|
}));
|
|
2242
2319
|
if (verbose) {
|
|
2243
|
-
console.log(
|
|
2320
|
+
console.log(chalk31.cyan(`Compiling Types FINISH: ${entries.length} files to ${outDir} from ${srcDir}`));
|
|
2244
2321
|
}
|
|
2245
2322
|
return 0;
|
|
2246
2323
|
};
|
|
@@ -2252,15 +2329,15 @@ var compileFolder = async (srcDir, entries, buildDir, options, bundleTypes = fal
|
|
|
2252
2329
|
console.log(`compileFolder [${srcDir}, ${options?.outDir}]`);
|
|
2253
2330
|
}
|
|
2254
2331
|
if (entries.length === 0) {
|
|
2255
|
-
console.warn(
|
|
2332
|
+
console.warn(chalk32.yellow(`No entries found in ${srcDir} to compile`));
|
|
2256
2333
|
return 0;
|
|
2257
2334
|
}
|
|
2258
2335
|
if (verbose) {
|
|
2259
|
-
console.log(
|
|
2336
|
+
console.log(chalk32.gray(`buildDir [${buildDir}]`));
|
|
2260
2337
|
}
|
|
2261
2338
|
const validationResult = packageCompileTsc(options?.platform ?? "neutral", entries, srcDir, buildDir, void 0, verbose);
|
|
2262
2339
|
if (validationResult !== 0) {
|
|
2263
|
-
console.error(
|
|
2340
|
+
console.error(chalk32.red(`Compile:Validation had ${validationResult} errors`));
|
|
2264
2341
|
return validationResult;
|
|
2265
2342
|
}
|
|
2266
2343
|
const optionsParams = tsupOptions([{
|
|
@@ -2285,12 +2362,12 @@ var compileFolder = async (srcDir, entries, buildDir, options, bundleTypes = fal
|
|
|
2285
2362
|
})
|
|
2286
2363
|
)).flat();
|
|
2287
2364
|
if (verbose) {
|
|
2288
|
-
console.log(
|
|
2289
|
-
console.log(
|
|
2365
|
+
console.log(chalk32.cyan(`TSUP:build:start [${srcDir}]`));
|
|
2366
|
+
console.log(chalk32.gray(`TSUP:build:options [${JSON.stringify(optionsList, null, 2)}]`));
|
|
2290
2367
|
}
|
|
2291
2368
|
await Promise.all(optionsList.map((options2) => build2(options2)));
|
|
2292
2369
|
if (verbose) {
|
|
2293
|
-
console.log(
|
|
2370
|
+
console.log(chalk32.cyan(`TSUP:build:stop [${srcDir}]`));
|
|
2294
2371
|
}
|
|
2295
2372
|
if (bundleTypes) {
|
|
2296
2373
|
await packageCompileTscTypes(entries, outDir, options?.platform ?? "neutral", buildDir, verbose);
|
|
@@ -2401,14 +2478,14 @@ var packageCompileTsup = async (config2) => {
|
|
|
2401
2478
|
// src/actions/package/compile/compile.ts
|
|
2402
2479
|
var packageCompile = async (inConfig = {}) => {
|
|
2403
2480
|
const pkg = process.env.INIT_CWD;
|
|
2404
|
-
console.log(
|
|
2481
|
+
console.log(chalk33.green(`Compiling ${pkg}`));
|
|
2405
2482
|
const config2 = await loadConfig(inConfig);
|
|
2406
2483
|
return await packageCompileTsup(config2);
|
|
2407
2484
|
};
|
|
2408
2485
|
|
|
2409
2486
|
// src/actions/package/copy-assets.ts
|
|
2410
2487
|
import path11 from "path/posix";
|
|
2411
|
-
import
|
|
2488
|
+
import chalk34 from "chalk";
|
|
2412
2489
|
import cpy2 from "cpy";
|
|
2413
2490
|
var copyTargetAssets2 = async (target, name, location) => {
|
|
2414
2491
|
try {
|
|
@@ -2421,7 +2498,7 @@ var copyTargetAssets2 = async (target, name, location) => {
|
|
|
2421
2498
|
}
|
|
2422
2499
|
);
|
|
2423
2500
|
if (values.length > 0) {
|
|
2424
|
-
console.log(
|
|
2501
|
+
console.log(chalk34.green(`Copying Assets [${target.toUpperCase()}] - ${name} - ${location}`));
|
|
2425
2502
|
}
|
|
2426
2503
|
for (const value of values) {
|
|
2427
2504
|
console.log(`${value.split("/").pop()} => ./dist/${target}`);
|
|
@@ -2486,9 +2563,9 @@ var packageCycle = async () => {
|
|
|
2486
2563
|
};
|
|
2487
2564
|
|
|
2488
2565
|
// src/actions/package/gen-docs.ts
|
|
2489
|
-
import { existsSync as
|
|
2566
|
+
import { existsSync as existsSync7 } from "fs";
|
|
2490
2567
|
import path12 from "path";
|
|
2491
|
-
import
|
|
2568
|
+
import chalk35 from "chalk";
|
|
2492
2569
|
import {
|
|
2493
2570
|
Application,
|
|
2494
2571
|
ArgumentsReader,
|
|
@@ -2506,7 +2583,7 @@ var ExitCodes = {
|
|
|
2506
2583
|
};
|
|
2507
2584
|
var packageGenDocs = async () => {
|
|
2508
2585
|
const pkg = process.env.INIT_CWD;
|
|
2509
|
-
if (pkg !== void 0 && !
|
|
2586
|
+
if (pkg !== void 0 && !existsSync7(path12.join(pkg, "typedoc.json"))) {
|
|
2510
2587
|
return;
|
|
2511
2588
|
}
|
|
2512
2589
|
const app = await Application.bootstrap({
|
|
@@ -2592,7 +2669,7 @@ var runTypeDoc = async (app) => {
|
|
|
2592
2669
|
return ExitCodes.OutputError;
|
|
2593
2670
|
}
|
|
2594
2671
|
}
|
|
2595
|
-
console.log(
|
|
2672
|
+
console.log(chalk35.green(`${pkgName} - Ok`));
|
|
2596
2673
|
return ExitCodes.Ok;
|
|
2597
2674
|
};
|
|
2598
2675
|
|
|
@@ -2601,7 +2678,7 @@ import { readdirSync as readdirSync4 } from "fs";
|
|
|
2601
2678
|
import path13 from "path";
|
|
2602
2679
|
import { cwd as cwd4 } from "process";
|
|
2603
2680
|
import { pathToFileURL } from "url";
|
|
2604
|
-
import
|
|
2681
|
+
import chalk36 from "chalk";
|
|
2605
2682
|
import { ESLint } from "eslint";
|
|
2606
2683
|
import { findUp } from "find-up";
|
|
2607
2684
|
import picomatch from "picomatch";
|
|
@@ -2610,14 +2687,14 @@ var dumpMessages = (lintResults) => {
|
|
|
2610
2687
|
const severity = ["none", "warning", "error"];
|
|
2611
2688
|
for (const lintResult of lintResults) {
|
|
2612
2689
|
if (lintResult.messages.length > 0) {
|
|
2613
|
-
console.log(
|
|
2690
|
+
console.log(chalk36.gray(`
|
|
2614
2691
|
${lintResult.filePath}`));
|
|
2615
2692
|
for (const message of lintResult.messages) {
|
|
2616
2693
|
console.log(
|
|
2617
|
-
|
|
2618
|
-
|
|
2619
|
-
|
|
2620
|
-
|
|
2694
|
+
chalk36.gray(` ${message.line}:${message.column}`),
|
|
2695
|
+
chalk36[colors[message.severity]](` ${severity[message.severity]}`),
|
|
2696
|
+
chalk36.white(` ${message.message}`),
|
|
2697
|
+
chalk36.gray(` ${message.ruleId}`)
|
|
2621
2698
|
);
|
|
2622
2699
|
}
|
|
2623
2700
|
}
|
|
@@ -2655,10 +2732,10 @@ var packageLint = async (fix2 = false, verbose = false, cache = true) => {
|
|
|
2655
2732
|
cache
|
|
2656
2733
|
});
|
|
2657
2734
|
const files = getFiles(cwd4(), ignoreFolders);
|
|
2658
|
-
console.log(
|
|
2735
|
+
console.log(chalk36.green(`Linting ${pkg} [files = ${files.length}]`));
|
|
2659
2736
|
if (verbose) {
|
|
2660
2737
|
for (const file of files) {
|
|
2661
|
-
console.log(
|
|
2738
|
+
console.log(chalk36.gray(` ${file}`));
|
|
2662
2739
|
}
|
|
2663
2740
|
}
|
|
2664
2741
|
const lintResults = await engine.lintFiles(files);
|
|
@@ -2669,32 +2746,32 @@ var packageLint = async (fix2 = false, verbose = false, cache = true) => {
|
|
|
2669
2746
|
const filesCountColor = files.length < 100 ? "green" : files.length < 1e3 ? "yellow" : "red";
|
|
2670
2747
|
const lintTime = Date.now() - start;
|
|
2671
2748
|
const lintTimeColor = lintTime < 1e3 ? "green" : lintTime < 3e3 ? "yellow" : "red";
|
|
2672
|
-
console.log(
|
|
2749
|
+
console.log(chalk36.white(`Linted ${chalk36[filesCountColor](files.length)} files in ${chalk36[lintTimeColor](lintTime)}ms`));
|
|
2673
2750
|
return lintResults.reduce((prev, lintResult) => prev + lintResult.errorCount, 0);
|
|
2674
2751
|
};
|
|
2675
2752
|
|
|
2676
2753
|
// src/actions/package/publint.ts
|
|
2677
2754
|
import { promises as fs10 } from "fs";
|
|
2678
|
-
import
|
|
2755
|
+
import chalk37 from "chalk";
|
|
2679
2756
|
import sortPackageJson from "sort-package-json";
|
|
2680
2757
|
var customPubLint = (pkg) => {
|
|
2681
2758
|
let errorCount = 0;
|
|
2682
2759
|
let warningCount = 0;
|
|
2683
2760
|
if (pkg.files === void 0) {
|
|
2684
|
-
console.warn(
|
|
2761
|
+
console.warn(chalk37.yellow('Publint [custom]: "files" field is missing'));
|
|
2685
2762
|
warningCount++;
|
|
2686
2763
|
}
|
|
2687
2764
|
if (pkg.main !== void 0) {
|
|
2688
|
-
console.warn(
|
|
2765
|
+
console.warn(chalk37.yellow('Publint [custom]: "main" field is deprecated, use "exports" instead'));
|
|
2689
2766
|
warningCount++;
|
|
2690
2767
|
}
|
|
2691
2768
|
if (pkg.sideEffects !== false) {
|
|
2692
|
-
console.warn(
|
|
2769
|
+
console.warn(chalk37.yellow('Publint [custom]: "sideEffects" field should be set to false'));
|
|
2693
2770
|
warningCount++;
|
|
2694
2771
|
}
|
|
2695
2772
|
if (pkg.resolutions !== void 0) {
|
|
2696
|
-
console.warn(
|
|
2697
|
-
console.warn(
|
|
2773
|
+
console.warn(chalk37.yellow('Publint [custom]: "resolutions" in use'));
|
|
2774
|
+
console.warn(chalk37.gray(JSON.stringify(pkg.resolutions, null, 2)));
|
|
2698
2775
|
warningCount++;
|
|
2699
2776
|
}
|
|
2700
2777
|
return [errorCount, warningCount];
|
|
@@ -2704,8 +2781,8 @@ var packagePublint = async ({ strict = true, verbose = false } = {}) => {
|
|
|
2704
2781
|
const sortedPkg = sortPackageJson(await fs10.readFile(`${pkgDir}/package.json`, "utf8"));
|
|
2705
2782
|
await fs10.writeFile(`${pkgDir}/package.json`, sortedPkg);
|
|
2706
2783
|
const pkg = JSON.parse(await fs10.readFile(`${pkgDir}/package.json`, "utf8"));
|
|
2707
|
-
console.log(
|
|
2708
|
-
console.log(
|
|
2784
|
+
console.log(chalk37.green(`Publint: ${pkg.name}`));
|
|
2785
|
+
console.log(chalk37.gray(pkgDir));
|
|
2709
2786
|
const { publint: publint2 } = await import("publint");
|
|
2710
2787
|
const { messages } = await publint2({
|
|
2711
2788
|
level: "suggestion",
|
|
@@ -2716,22 +2793,22 @@ var packagePublint = async ({ strict = true, verbose = false } = {}) => {
|
|
|
2716
2793
|
for (const message of messages) {
|
|
2717
2794
|
switch (message.type) {
|
|
2718
2795
|
case "error": {
|
|
2719
|
-
console.error(
|
|
2796
|
+
console.error(chalk37.red(`[${message.code}] ${formatMessage(message, pkg)}`));
|
|
2720
2797
|
break;
|
|
2721
2798
|
}
|
|
2722
2799
|
case "warning": {
|
|
2723
|
-
console.warn(
|
|
2800
|
+
console.warn(chalk37.yellow(`[${message.code}] ${formatMessage(message, pkg)}`));
|
|
2724
2801
|
break;
|
|
2725
2802
|
}
|
|
2726
2803
|
default: {
|
|
2727
|
-
console.log(
|
|
2804
|
+
console.log(chalk37.white(`[${message.code}] ${formatMessage(message, pkg)}`));
|
|
2728
2805
|
break;
|
|
2729
2806
|
}
|
|
2730
2807
|
}
|
|
2731
2808
|
}
|
|
2732
2809
|
const [errorCount, warningCount] = customPubLint(pkg);
|
|
2733
2810
|
if (verbose) {
|
|
2734
|
-
console.log(
|
|
2811
|
+
console.log(chalk37.gray(`Publint [Finish]: ${pkgDir} [${messages.length + errorCount + warningCount} messages]`));
|
|
2735
2812
|
}
|
|
2736
2813
|
return messages.filter((message) => message.type === "error").length + errorCount;
|
|
2737
2814
|
};
|
|
@@ -2782,7 +2859,7 @@ var rebuild = ({ target }) => {
|
|
|
2782
2859
|
};
|
|
2783
2860
|
|
|
2784
2861
|
// src/actions/recompile.ts
|
|
2785
|
-
import
|
|
2862
|
+
import chalk38 from "chalk";
|
|
2786
2863
|
var recompile = async ({
|
|
2787
2864
|
verbose,
|
|
2788
2865
|
target,
|
|
@@ -2818,7 +2895,7 @@ var recompileAll = async ({
|
|
|
2818
2895
|
const incrementalOptions = incremental ? ["--since", "-Apt", "--topological-dev"] : ["--parallel", "-Apt", "--topological-dev"];
|
|
2819
2896
|
const jobsOptions = jobs ? ["-j", `${jobs}`] : [];
|
|
2820
2897
|
if (jobs) {
|
|
2821
|
-
console.log(
|
|
2898
|
+
console.log(chalk38.blue(`Jobs set to [${jobs}]`));
|
|
2822
2899
|
}
|
|
2823
2900
|
const result = await runStepsAsync(`Recompile${incremental ? "-Incremental" : ""} [All]`, [
|
|
2824
2901
|
[
|
|
@@ -2849,7 +2926,7 @@ var recompileAll = async ({
|
|
|
2849
2926
|
]
|
|
2850
2927
|
]);
|
|
2851
2928
|
console.log(
|
|
2852
|
-
`${
|
|
2929
|
+
`${chalk38.gray("Recompiled in")} [${chalk38.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk38.gray("seconds")}`
|
|
2853
2930
|
);
|
|
2854
2931
|
return result;
|
|
2855
2932
|
};
|
|
@@ -2880,13 +2957,13 @@ var reinstall = () => {
|
|
|
2880
2957
|
};
|
|
2881
2958
|
|
|
2882
2959
|
// src/actions/relint.ts
|
|
2883
|
-
import
|
|
2960
|
+
import chalk39 from "chalk";
|
|
2884
2961
|
var relintPackage = ({
|
|
2885
2962
|
pkg,
|
|
2886
2963
|
fix: fix2,
|
|
2887
2964
|
verbose
|
|
2888
2965
|
}) => {
|
|
2889
|
-
console.log(
|
|
2966
|
+
console.log(chalk39.gray(`${fix2 ? "Fix" : "Lint"} [${pkg}]`));
|
|
2890
2967
|
const start = Date.now();
|
|
2891
2968
|
const result = runSteps(`${fix2 ? "Fix" : "Lint"} [${pkg}]`, [
|
|
2892
2969
|
["yarn", [
|
|
@@ -2896,7 +2973,7 @@ var relintPackage = ({
|
|
|
2896
2973
|
fix2 ? "package-fix" : verbose ? "package-lint-verbose" : "package-lint"
|
|
2897
2974
|
]]
|
|
2898
2975
|
]);
|
|
2899
|
-
console.log(
|
|
2976
|
+
console.log(chalk39.gray(`${fix2 ? "Fixed in" : "Linted in"} [${chalk39.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk39.gray("seconds")}`));
|
|
2900
2977
|
return result;
|
|
2901
2978
|
};
|
|
2902
2979
|
var relint = ({
|
|
@@ -2916,13 +2993,13 @@ var relint = ({
|
|
|
2916
2993
|
});
|
|
2917
2994
|
};
|
|
2918
2995
|
var relintAllPackages = ({ fix: fix2 = false } = {}) => {
|
|
2919
|
-
console.log(
|
|
2996
|
+
console.log(chalk39.gray(`${fix2 ? "Fix" : "Lint"} [All-Packages]`));
|
|
2920
2997
|
const start = Date.now();
|
|
2921
2998
|
const fixOptions = fix2 ? ["--fix"] : [];
|
|
2922
2999
|
const result = runSteps(`${fix2 ? "Fix" : "Lint"} [All-Packages]`, [
|
|
2923
3000
|
["yarn", ["eslint", ...fixOptions]]
|
|
2924
3001
|
]);
|
|
2925
|
-
console.log(
|
|
3002
|
+
console.log(chalk39.gray(`${fix2 ? "Fixed in" : "Linted in"} [${chalk39.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk39.gray("seconds")}`));
|
|
2926
3003
|
return result;
|
|
2927
3004
|
};
|
|
2928
3005
|
|
|
@@ -2940,10 +3017,10 @@ var sonar = () => {
|
|
|
2940
3017
|
};
|
|
2941
3018
|
|
|
2942
3019
|
// src/actions/statics.ts
|
|
2943
|
-
import
|
|
3020
|
+
import chalk40 from "chalk";
|
|
2944
3021
|
var DefaultDependencies = ["axios", "@xylabs/pixel", "react", "graphql", "react-router", "@mui/material", "@mui/system"];
|
|
2945
3022
|
var statics = () => {
|
|
2946
|
-
console.log(
|
|
3023
|
+
console.log(chalk40.green("Check Required Static Dependencies"));
|
|
2947
3024
|
const statics2 = parsedPackageJSON()?.xy?.deps?.statics;
|
|
2948
3025
|
return detectDuplicateDependencies(statics2, DefaultDependencies);
|
|
2949
3026
|
};
|
|
@@ -2995,6 +3072,7 @@ export {
|
|
|
2995
3072
|
bundleDts,
|
|
2996
3073
|
claudeCommands,
|
|
2997
3074
|
claudeRules,
|
|
3075
|
+
claudeSettings,
|
|
2998
3076
|
clean,
|
|
2999
3077
|
cleanAll,
|
|
3000
3078
|
cleanDocs,
|