@xylabs/ts-scripts-yarn3 7.4.3 → 7.4.5
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-rules.mjs +113 -0
- package/dist/actions/claude-rules.mjs.map +1 -0
- package/dist/actions/deplint/checkPackage/checkPackage.mjs +3 -2
- package/dist/actions/deplint/checkPackage/checkPackage.mjs.map +1 -1
- package/dist/actions/deplint/checkPackage/index.mjs +3 -2
- package/dist/actions/deplint/checkPackage/index.mjs.map +1 -1
- package/dist/actions/deplint/deplint.mjs +3 -2
- package/dist/actions/deplint/deplint.mjs.map +1 -1
- package/dist/actions/deplint/getExternalImportsFromFiles.mjs +3 -2
- package/dist/actions/deplint/getExternalImportsFromFiles.mjs.map +1 -1
- package/dist/actions/deplint/getImportsFromFile.mjs +3 -2
- package/dist/actions/deplint/getImportsFromFile.mjs.map +1 -1
- package/dist/actions/deplint/index.mjs +3 -2
- package/dist/actions/deplint/index.mjs.map +1 -1
- package/dist/actions/index.mjs +235 -131
- package/dist/actions/index.mjs.map +1 -1
- package/dist/bin/xy.mjs +204 -86
- package/dist/bin/xy.mjs.map +1 -1
- package/dist/index.d.ts +9 -1
- package/dist/index.mjs +269 -147
- package/dist/index.mjs.map +1 -1
- package/dist/lib/claudeMdTemplate.mjs +24 -0
- package/dist/lib/claudeMdTemplate.mjs.map +1 -0
- package/dist/lib/index.mjs +31 -9
- package/dist/lib/index.mjs.map +1 -1
- package/dist/xy/index.mjs +204 -86
- package/dist/xy/index.mjs.map +1 -1
- package/dist/xy/xy.mjs +204 -86
- package/dist/xy/xy.mjs.map +1 -1
- package/dist/xy/xyCommonCommands.mjs +137 -20
- package/dist/xy/xyCommonCommands.mjs.map +1 -1
- package/dist/xy/xyLintCommands.mjs +3 -2
- package/dist/xy/xyLintCommands.mjs.map +1 -1
- package/package.json +4 -3
- package/templates/CLAUDE-project.md +4 -0
- package/templates/rules/xylabs-architecture.md +11 -0
- package/templates/rules/xylabs-build.md +14 -0
- package/templates/rules/xylabs-dependencies.md +24 -0
- package/templates/rules/xylabs-error-handling.md +7 -0
- package/templates/rules/xylabs-frameworks.md +8 -0
- package/templates/rules/xylabs-git-workflow.md +9 -0
- package/templates/rules/xylabs-naming.md +10 -0
- package/templates/rules/xylabs-style.md +22 -0
- package/templates/rules/xylabs-typescript.md +10 -0
package/dist/actions/index.mjs
CHANGED
|
@@ -14,6 +14,25 @@ var checkResult = (name, result, level = "error", exitOnFail = false) => {
|
|
|
14
14
|
}
|
|
15
15
|
};
|
|
16
16
|
|
|
17
|
+
// src/lib/claudeMdTemplate.ts
|
|
18
|
+
import { readdirSync, readFileSync } from "fs";
|
|
19
|
+
import { createRequire } from "module";
|
|
20
|
+
import PATH from "path";
|
|
21
|
+
var require2 = createRequire(import.meta.url);
|
|
22
|
+
var packageRoot = PATH.dirname(require2.resolve("@xylabs/ts-scripts-yarn3/package.json"));
|
|
23
|
+
var templatesDir = PATH.resolve(packageRoot, "templates");
|
|
24
|
+
var XYLABS_RULES_PREFIX = "xylabs-";
|
|
25
|
+
var claudeMdRuleTemplates = () => {
|
|
26
|
+
const rulesDir = PATH.resolve(templatesDir, "rules");
|
|
27
|
+
const files = readdirSync(rulesDir).filter((f) => f.startsWith(XYLABS_RULES_PREFIX) && f.endsWith(".md"));
|
|
28
|
+
const result = {};
|
|
29
|
+
for (const file of files) {
|
|
30
|
+
result[file] = readFileSync(PATH.resolve(rulesDir, file), "utf8");
|
|
31
|
+
}
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
var claudeMdProjectTemplate = () => readFileSync(PATH.resolve(templatesDir, "CLAUDE-project.md"), "utf8");
|
|
35
|
+
|
|
17
36
|
// src/lib/deleteGlob.ts
|
|
18
37
|
import fs from "fs";
|
|
19
38
|
import { glob } from "glob";
|
|
@@ -203,7 +222,7 @@ var CROSS_PLATFORM_NEWLINE = "\n";
|
|
|
203
222
|
// src/lib/file/fileLines.ts
|
|
204
223
|
import {
|
|
205
224
|
existsSync,
|
|
206
|
-
readFileSync,
|
|
225
|
+
readFileSync as readFileSync2,
|
|
207
226
|
writeFileSync
|
|
208
227
|
} from "fs";
|
|
209
228
|
|
|
@@ -218,10 +237,10 @@ var union = (a, b) => /* @__PURE__ */ new Set([...new Set(a), ...new Set(b)]);
|
|
|
218
237
|
var defaultReadFileSyncOptions = { encoding: "utf8" };
|
|
219
238
|
|
|
220
239
|
// src/lib/file/fileLines.ts
|
|
221
|
-
var readLines = (uri, options = defaultReadFileSyncOptions) => existsSync(uri) ?
|
|
240
|
+
var readLines = (uri, options = defaultReadFileSyncOptions) => existsSync(uri) ? readFileSync2(uri, options).replace(WINDOWS_NEWLINE_REGEX, CROSS_PLATFORM_NEWLINE).split(CROSS_PLATFORM_NEWLINE) : [];
|
|
222
241
|
var readNonEmptyLines = (uri, options = defaultReadFileSyncOptions) => readLines(uri, options).filter(notEmpty);
|
|
223
242
|
var writeLines = (uri, lines, options = defaultReadFileSyncOptions) => {
|
|
224
|
-
const existing = existsSync(uri) ?
|
|
243
|
+
const existing = existsSync(uri) ? readFileSync2(uri, options) : void 0;
|
|
225
244
|
const desired = lines.join(CROSS_PLATFORM_NEWLINE);
|
|
226
245
|
if (existing !== desired) writeFileSync(uri, desired, options);
|
|
227
246
|
};
|
|
@@ -314,10 +333,10 @@ var loadConfig = async (params) => {
|
|
|
314
333
|
};
|
|
315
334
|
|
|
316
335
|
// src/lib/parsedPackageJSON.ts
|
|
317
|
-
import { readFileSync as
|
|
336
|
+
import { readFileSync as readFileSync3 } from "fs";
|
|
318
337
|
var parsedPackageJSON = (path13) => {
|
|
319
338
|
const pathToPackageJSON = path13 ?? process.env.npm_package_json ?? "";
|
|
320
|
-
const packageJSON =
|
|
339
|
+
const packageJSON = readFileSync3(pathToPackageJSON).toString();
|
|
321
340
|
return JSON.parse(packageJSON);
|
|
322
341
|
};
|
|
323
342
|
|
|
@@ -427,6 +446,89 @@ var build = async ({
|
|
|
427
446
|
return result;
|
|
428
447
|
};
|
|
429
448
|
|
|
449
|
+
// src/actions/claude-rules.ts
|
|
450
|
+
import {
|
|
451
|
+
existsSync as existsSync4,
|
|
452
|
+
mkdirSync,
|
|
453
|
+
readdirSync as readdirSync2,
|
|
454
|
+
readFileSync as readFileSync4,
|
|
455
|
+
unlinkSync,
|
|
456
|
+
writeFileSync as writeFileSync2
|
|
457
|
+
} from "fs";
|
|
458
|
+
import PATH2 from "path";
|
|
459
|
+
import chalk9 from "chalk";
|
|
460
|
+
var syncRuleFiles = (rulesDir) => {
|
|
461
|
+
const templates = claudeMdRuleTemplates();
|
|
462
|
+
const templateNames = new Set(Object.keys(templates));
|
|
463
|
+
let updated = 0;
|
|
464
|
+
let created = 0;
|
|
465
|
+
for (const [filename3, content] of Object.entries(templates)) {
|
|
466
|
+
const targetPath = PATH2.resolve(rulesDir, filename3);
|
|
467
|
+
const existing = existsSync4(targetPath) ? readFileSync4(targetPath, "utf8") : void 0;
|
|
468
|
+
if (existing === content) continue;
|
|
469
|
+
writeFileSync2(targetPath, content, "utf8");
|
|
470
|
+
if (existing) {
|
|
471
|
+
updated++;
|
|
472
|
+
} else {
|
|
473
|
+
created++;
|
|
474
|
+
}
|
|
475
|
+
}
|
|
476
|
+
return {
|
|
477
|
+
created,
|
|
478
|
+
templateNames,
|
|
479
|
+
updated
|
|
480
|
+
};
|
|
481
|
+
};
|
|
482
|
+
var removeStaleRules = (rulesDir, templateNames) => {
|
|
483
|
+
const existingRules = readdirSync2(rulesDir).filter((f) => f.startsWith(XYLABS_RULES_PREFIX) && f.endsWith(".md"));
|
|
484
|
+
let removed = 0;
|
|
485
|
+
for (const file of existingRules) {
|
|
486
|
+
if (!templateNames.has(file)) {
|
|
487
|
+
unlinkSync(PATH2.resolve(rulesDir, file));
|
|
488
|
+
removed++;
|
|
489
|
+
}
|
|
490
|
+
}
|
|
491
|
+
return removed;
|
|
492
|
+
};
|
|
493
|
+
var logRulesResult = (created, updated, removed) => {
|
|
494
|
+
if (created || updated || removed) {
|
|
495
|
+
const parts = [
|
|
496
|
+
created ? `${created} created` : "",
|
|
497
|
+
updated ? `${updated} updated` : "",
|
|
498
|
+
removed ? `${removed} removed` : ""
|
|
499
|
+
].filter(Boolean);
|
|
500
|
+
console.log(chalk9.green(`.claude/rules/${XYLABS_RULES_PREFIX}*.md: ${parts.join(", ")}`));
|
|
501
|
+
} else {
|
|
502
|
+
console.log(chalk9.gray(`.claude/rules/${XYLABS_RULES_PREFIX}*.md: already up to date`));
|
|
503
|
+
}
|
|
504
|
+
};
|
|
505
|
+
var ensureProjectClaudeMd = (cwd5, force) => {
|
|
506
|
+
const projectPath = PATH2.resolve(cwd5, "CLAUDE.md");
|
|
507
|
+
if (!existsSync4(projectPath) || force) {
|
|
508
|
+
if (force && existsSync4(projectPath)) {
|
|
509
|
+
console.log(chalk9.yellow("Overwriting existing CLAUDE.md"));
|
|
510
|
+
}
|
|
511
|
+
writeFileSync2(projectPath, claudeMdProjectTemplate(), "utf8");
|
|
512
|
+
console.log(chalk9.green("Generated CLAUDE.md"));
|
|
513
|
+
} else {
|
|
514
|
+
console.log(chalk9.gray("CLAUDE.md already exists (skipped)"));
|
|
515
|
+
}
|
|
516
|
+
};
|
|
517
|
+
var claudeRules = ({ force } = {}) => {
|
|
518
|
+
const cwd5 = INIT_CWD() ?? process.cwd();
|
|
519
|
+
const rulesDir = PATH2.resolve(cwd5, ".claude", "rules");
|
|
520
|
+
mkdirSync(rulesDir, { recursive: true });
|
|
521
|
+
const {
|
|
522
|
+
created,
|
|
523
|
+
templateNames,
|
|
524
|
+
updated
|
|
525
|
+
} = syncRuleFiles(rulesDir);
|
|
526
|
+
const removed = removeStaleRules(rulesDir, templateNames);
|
|
527
|
+
logRulesResult(created, updated, removed);
|
|
528
|
+
ensureProjectClaudeMd(cwd5, force);
|
|
529
|
+
return 0;
|
|
530
|
+
};
|
|
531
|
+
|
|
430
532
|
// src/actions/clean.ts
|
|
431
533
|
var clean = async ({ verbose, pkg }) => {
|
|
432
534
|
return pkg ? await cleanPackage({ pkg, verbose }) : cleanAll({ verbose });
|
|
@@ -441,16 +543,16 @@ var cleanAll = ({ verbose }) => {
|
|
|
441
543
|
|
|
442
544
|
// src/actions/clean-docs.ts
|
|
443
545
|
import path from "path";
|
|
444
|
-
import
|
|
546
|
+
import chalk10 from "chalk";
|
|
445
547
|
var cleanDocs = () => {
|
|
446
548
|
const pkgName = process.env.npm_package_name;
|
|
447
|
-
console.log(
|
|
549
|
+
console.log(chalk10.green(`Cleaning Docs [${pkgName}]`));
|
|
448
550
|
for (const { location } of yarnWorkspaces()) deleteGlob(path.join(location, "docs"));
|
|
449
551
|
return 0;
|
|
450
552
|
};
|
|
451
553
|
|
|
452
554
|
// src/actions/compile.ts
|
|
453
|
-
import
|
|
555
|
+
import chalk11 from "chalk";
|
|
454
556
|
var compile = ({
|
|
455
557
|
verbose,
|
|
456
558
|
target,
|
|
@@ -491,7 +593,7 @@ var compileAll = ({
|
|
|
491
593
|
const incrementalOptions = incremental ? ["--since", "-Ap", "--topological-dev"] : ["--parallel", "-Ap", "--topological-dev"];
|
|
492
594
|
const jobsOptions = jobs ? ["-j", `${jobs}`] : [];
|
|
493
595
|
if (jobs) {
|
|
494
|
-
console.log(
|
|
596
|
+
console.log(chalk11.blue(`Jobs set to [${jobs}]`));
|
|
495
597
|
}
|
|
496
598
|
const result = runSteps(`Compile${incremental ? "-Incremental" : ""} [All]`, [
|
|
497
599
|
["yarn", [
|
|
@@ -505,13 +607,13 @@ var compileAll = ({
|
|
|
505
607
|
...targetOptions
|
|
506
608
|
]]
|
|
507
609
|
]);
|
|
508
|
-
console.log(`${
|
|
610
|
+
console.log(`${chalk11.gray("Compiled in")} [${chalk11.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk11.gray("seconds")}`);
|
|
509
611
|
return result;
|
|
510
612
|
};
|
|
511
613
|
|
|
512
614
|
// src/actions/copy-assets.ts
|
|
513
615
|
import path2 from "path/posix";
|
|
514
|
-
import
|
|
616
|
+
import chalk12 from "chalk";
|
|
515
617
|
import cpy from "cpy";
|
|
516
618
|
var copyPackageTargetAssets = async (target, name, location) => {
|
|
517
619
|
try {
|
|
@@ -534,7 +636,7 @@ var copyPackageTargetAssets = async (target, name, location) => {
|
|
|
534
636
|
};
|
|
535
637
|
var copyTargetAssets = async (target, pkg) => {
|
|
536
638
|
const workspaces = yarnWorkspaces();
|
|
537
|
-
console.log(
|
|
639
|
+
console.log(chalk12.green(`Copying Assets [${target.toUpperCase()}]`));
|
|
538
640
|
const workspaceList = workspaces.filter(({ name }) => {
|
|
539
641
|
return pkg === void 0 || name === pkg;
|
|
540
642
|
});
|
|
@@ -618,7 +720,7 @@ var dead = () => {
|
|
|
618
720
|
};
|
|
619
721
|
|
|
620
722
|
// src/actions/deplint/deplint.ts
|
|
621
|
-
import
|
|
723
|
+
import chalk18 from "chalk";
|
|
622
724
|
|
|
623
725
|
// src/actions/deplint/findFiles.ts
|
|
624
726
|
import fs2 from "fs";
|
|
@@ -765,8 +867,9 @@ function getImportsFromFile(filePath, importPaths, typeImportPaths) {
|
|
|
765
867
|
}
|
|
766
868
|
visit(sourceFile);
|
|
767
869
|
const importsStartsWithExcludes = [".", "#", "node:"];
|
|
768
|
-
const
|
|
769
|
-
const
|
|
870
|
+
const isValidImport = (imp) => !importsStartsWithExcludes.some((exc) => imp.startsWith(exc)) && !imp.includes("*") && !imp.includes("!");
|
|
871
|
+
const cleanedImports = imports.filter(isValidImport).map(getBasePackageName);
|
|
872
|
+
const cleanedTypeImports = typeImports.filter(isValidImport).map(getBasePackageName);
|
|
770
873
|
for (const imp of cleanedImports) {
|
|
771
874
|
importPaths[imp] = importPaths[imp] ?? [];
|
|
772
875
|
importPaths[imp].push(filePath);
|
|
@@ -818,12 +921,12 @@ function getExternalImportsFromFiles({
|
|
|
818
921
|
|
|
819
922
|
// src/actions/deplint/checkPackage/getUnlistedDependencies.ts
|
|
820
923
|
import { builtinModules } from "module";
|
|
821
|
-
import
|
|
924
|
+
import chalk13 from "chalk";
|
|
822
925
|
function isListedOrBuiltin(imp, name, dependencies, peerDependencies) {
|
|
823
926
|
return dependencies.includes(imp) || imp === name || dependencies.includes(`@types/${imp}`) || peerDependencies.includes(imp) || peerDependencies.includes(`@types/${imp}`) || builtinModules.includes(imp) || builtinModules.includes(`@types/${imp}`);
|
|
824
927
|
}
|
|
825
928
|
function logMissing(name, imp, importPaths) {
|
|
826
|
-
console.log(`[${
|
|
929
|
+
console.log(`[${chalk13.blue(name)}] Missing dependency in package.json: ${chalk13.red(imp)}`);
|
|
827
930
|
if (importPaths[imp]) {
|
|
828
931
|
console.log(` ${importPaths[imp].join("\n ")}`);
|
|
829
932
|
}
|
|
@@ -848,7 +951,7 @@ function getUnlistedDependencies({ name, location }, { dependencies, peerDepende
|
|
|
848
951
|
}
|
|
849
952
|
if (unlistedDependencies > 0) {
|
|
850
953
|
const packageLocation = `${location}/package.json`;
|
|
851
|
-
console.log(` ${
|
|
954
|
+
console.log(` ${chalk13.yellow(packageLocation)}
|
|
852
955
|
`);
|
|
853
956
|
}
|
|
854
957
|
return unlistedDependencies;
|
|
@@ -856,7 +959,7 @@ function getUnlistedDependencies({ name, location }, { dependencies, peerDepende
|
|
|
856
959
|
|
|
857
960
|
// src/actions/deplint/checkPackage/getUnlistedDevDependencies.ts
|
|
858
961
|
import { builtinModules as builtinModules2 } from "module";
|
|
859
|
-
import
|
|
962
|
+
import chalk14 from "chalk";
|
|
860
963
|
function getUnlistedDevDependencies({ name, location }, {
|
|
861
964
|
devDependencies,
|
|
862
965
|
dependencies,
|
|
@@ -870,7 +973,7 @@ function getUnlistedDevDependencies({ name, location }, {
|
|
|
870
973
|
for (const imp of externalAllImports) {
|
|
871
974
|
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)) {
|
|
872
975
|
unlistedDevDependencies++;
|
|
873
|
-
console.log(`[${
|
|
976
|
+
console.log(`[${chalk14.blue(name)}] Missing devDependency in package.json: ${chalk14.red(imp)}`);
|
|
874
977
|
if (allImportPaths[imp]) {
|
|
875
978
|
console.log(` ${allImportPaths[imp].join("\n ")}`);
|
|
876
979
|
}
|
|
@@ -878,14 +981,14 @@ function getUnlistedDevDependencies({ name, location }, {
|
|
|
878
981
|
}
|
|
879
982
|
if (unlistedDevDependencies > 0) {
|
|
880
983
|
const packageLocation = `${location}/package.json`;
|
|
881
|
-
console.log(` ${
|
|
984
|
+
console.log(` ${chalk14.yellow(packageLocation)}
|
|
882
985
|
`);
|
|
883
986
|
}
|
|
884
987
|
return unlistedDevDependencies;
|
|
885
988
|
}
|
|
886
989
|
|
|
887
990
|
// src/actions/deplint/checkPackage/getUnusedDependencies.ts
|
|
888
|
-
import
|
|
991
|
+
import chalk15 from "chalk";
|
|
889
992
|
function getUnusedDependencies({ name, location }, { dependencies }, {
|
|
890
993
|
externalDistImports,
|
|
891
994
|
externalDistTypeImports,
|
|
@@ -896,22 +999,22 @@ function getUnusedDependencies({ name, location }, { dependencies }, {
|
|
|
896
999
|
if (!externalDistImports.includes(dep) && !externalDistImports.includes(dep.replace(/^@types\//, "")) && !externalDistTypeImports.includes(dep) && !externalDistTypeImports.includes(dep.replace(/^@types\//, ""))) {
|
|
897
1000
|
unusedDependencies++;
|
|
898
1001
|
if (externalAllImports.includes(dep)) {
|
|
899
|
-
console.log(`[${
|
|
1002
|
+
console.log(`[${chalk15.blue(name)}] dependency should be devDependency in package.json: ${chalk15.red(dep)}`);
|
|
900
1003
|
} else {
|
|
901
|
-
console.log(`[${
|
|
1004
|
+
console.log(`[${chalk15.blue(name)}] Unused dependency in package.json: ${chalk15.red(dep)}`);
|
|
902
1005
|
}
|
|
903
1006
|
}
|
|
904
1007
|
}
|
|
905
1008
|
if (unusedDependencies > 0) {
|
|
906
1009
|
const packageLocation = `${location}/package.json`;
|
|
907
|
-
console.log(` ${
|
|
1010
|
+
console.log(` ${chalk15.yellow(packageLocation)}
|
|
908
1011
|
`);
|
|
909
1012
|
}
|
|
910
1013
|
return unusedDependencies;
|
|
911
1014
|
}
|
|
912
1015
|
|
|
913
1016
|
// src/actions/deplint/checkPackage/getUnusedDevDependencies.ts
|
|
914
|
-
import
|
|
1017
|
+
import chalk16 from "chalk";
|
|
915
1018
|
|
|
916
1019
|
// src/actions/deplint/getRequiredPeerDependencies.ts
|
|
917
1020
|
import fs6 from "fs";
|
|
@@ -1094,34 +1197,34 @@ function getUnusedDevDependencies({ name, location }, {
|
|
|
1094
1197
|
if (dependencies.includes(dep) || peerDependencies.includes(dep)) continue;
|
|
1095
1198
|
if (!isDevDepUsed(dep, allImports, implicitDeps, requiredPeers, scriptRefs)) {
|
|
1096
1199
|
unusedDevDependencies++;
|
|
1097
|
-
console.log(`[${
|
|
1200
|
+
console.log(`[${chalk16.blue(name)}] Unused devDependency in package.json: ${chalk16.red(dep)}`);
|
|
1098
1201
|
}
|
|
1099
1202
|
}
|
|
1100
1203
|
if (unusedDevDependencies > 0) {
|
|
1101
1204
|
const packageLocation = `${location}/package.json`;
|
|
1102
|
-
console.log(` ${
|
|
1205
|
+
console.log(` ${chalk16.yellow(packageLocation)}
|
|
1103
1206
|
`);
|
|
1104
1207
|
}
|
|
1105
1208
|
return unusedDevDependencies;
|
|
1106
1209
|
}
|
|
1107
1210
|
|
|
1108
1211
|
// src/actions/deplint/checkPackage/getUnusedPeerDependencies.ts
|
|
1109
|
-
import
|
|
1212
|
+
import chalk17 from "chalk";
|
|
1110
1213
|
function getUnusedPeerDependencies({ name, location }, { peerDependencies, dependencies }, { externalDistImports, externalDistTypeImports }) {
|
|
1111
1214
|
let unusedDependencies = 0;
|
|
1112
1215
|
for (const dep of peerDependencies) {
|
|
1113
1216
|
if (!externalDistImports.includes(dep) && !externalDistImports.includes(dep.replace(/^@types\//, "")) && !externalDistTypeImports.includes(dep) && !externalDistTypeImports.includes(dep.replace(/^@types\//, ""))) {
|
|
1114
1217
|
unusedDependencies++;
|
|
1115
1218
|
if (dependencies.includes(dep)) {
|
|
1116
|
-
console.log(`[${
|
|
1219
|
+
console.log(`[${chalk17.blue(name)}] Unused peerDependency [already a dependency] in package.json: ${chalk17.red(dep)}`);
|
|
1117
1220
|
} else {
|
|
1118
|
-
console.log(`[${
|
|
1221
|
+
console.log(`[${chalk17.blue(name)}] Unused peerDependency in package.json: ${chalk17.red(dep)}`);
|
|
1119
1222
|
}
|
|
1120
1223
|
}
|
|
1121
1224
|
}
|
|
1122
1225
|
if (unusedDependencies > 0) {
|
|
1123
1226
|
const packageLocation = `${location}/package.json`;
|
|
1124
|
-
console.log(` ${
|
|
1227
|
+
console.log(` ${chalk17.yellow(packageLocation)}
|
|
1125
1228
|
`);
|
|
1126
1229
|
}
|
|
1127
1230
|
return unusedDependencies;
|
|
@@ -1207,19 +1310,19 @@ var deplint = ({
|
|
|
1207
1310
|
});
|
|
1208
1311
|
}
|
|
1209
1312
|
if (totalErrors > 0) {
|
|
1210
|
-
console.warn(`Deplint: Found ${
|
|
1313
|
+
console.warn(`Deplint: Found ${chalk18.red(totalErrors)} dependency problems. ${chalk18.red("\u2716")}`);
|
|
1211
1314
|
} else {
|
|
1212
|
-
console.info(`Deplint: Found no dependency problems. ${
|
|
1315
|
+
console.info(`Deplint: Found no dependency problems. ${chalk18.green("\u2714")}`);
|
|
1213
1316
|
}
|
|
1214
1317
|
return 0;
|
|
1215
1318
|
};
|
|
1216
1319
|
|
|
1217
1320
|
// src/actions/deploy.ts
|
|
1218
|
-
import { readFileSync as
|
|
1321
|
+
import { readFileSync as readFileSync5 } from "fs";
|
|
1219
1322
|
var privatePackageExcludeList = () => {
|
|
1220
1323
|
const possibleDeployablePackages = yarnWorkspaces().map((workspace) => [
|
|
1221
1324
|
workspace,
|
|
1222
|
-
JSON.parse(
|
|
1325
|
+
JSON.parse(readFileSync5(`${workspace.location}/package.json`, { encoding: "utf8" }))
|
|
1223
1326
|
]);
|
|
1224
1327
|
const privatePackages = possibleDeployablePackages.filter(([_, pkg]) => pkg.private).map(([workspace]) => workspace);
|
|
1225
1328
|
const excludeList = privatePackages.map((workspace) => `--exclude ${workspace.name}`);
|
|
@@ -1239,11 +1342,11 @@ var deploy = () => {
|
|
|
1239
1342
|
};
|
|
1240
1343
|
|
|
1241
1344
|
// src/actions/deploy-major.ts
|
|
1242
|
-
import { readFileSync as
|
|
1345
|
+
import { readFileSync as readFileSync6 } from "fs";
|
|
1243
1346
|
var privatePackageExcludeList2 = () => {
|
|
1244
1347
|
const possibleDeployablePackages = yarnWorkspaces().map((workspace) => [
|
|
1245
1348
|
workspace,
|
|
1246
|
-
JSON.parse(
|
|
1349
|
+
JSON.parse(readFileSync6(`${workspace.location}/package.json`, { encoding: "utf8" }))
|
|
1247
1350
|
]);
|
|
1248
1351
|
const privatePackages = possibleDeployablePackages.filter(([_, pkg]) => pkg.private).map(([workspace]) => workspace);
|
|
1249
1352
|
const excludeList = privatePackages.map((workspace) => `--exclude ${workspace.name}`);
|
|
@@ -1263,11 +1366,11 @@ var deployMajor = () => {
|
|
|
1263
1366
|
};
|
|
1264
1367
|
|
|
1265
1368
|
// src/actions/deploy-minor.ts
|
|
1266
|
-
import { readFileSync as
|
|
1369
|
+
import { readFileSync as readFileSync7 } from "fs";
|
|
1267
1370
|
var privatePackageExcludeList3 = () => {
|
|
1268
1371
|
const possibleDeployablePackages = yarnWorkspaces().map((workspace) => [
|
|
1269
1372
|
workspace,
|
|
1270
|
-
JSON.parse(
|
|
1373
|
+
JSON.parse(readFileSync7(`${workspace.location}/package.json`, { encoding: "utf8" }))
|
|
1271
1374
|
]);
|
|
1272
1375
|
const privatePackages = possibleDeployablePackages.filter(([_, pkg]) => pkg.private).map(([workspace]) => workspace);
|
|
1273
1376
|
const excludeList = privatePackages.map((workspace) => `--exclude ${workspace.name}`);
|
|
@@ -1287,11 +1390,11 @@ var deployMinor = () => {
|
|
|
1287
1390
|
};
|
|
1288
1391
|
|
|
1289
1392
|
// src/actions/deploy-next.ts
|
|
1290
|
-
import { readFileSync as
|
|
1393
|
+
import { readFileSync as readFileSync8 } from "fs";
|
|
1291
1394
|
var privatePackageExcludeList4 = () => {
|
|
1292
1395
|
const possibleDeployablePackages = yarnWorkspaces().map((workspace) => [
|
|
1293
1396
|
workspace,
|
|
1294
|
-
JSON.parse(
|
|
1397
|
+
JSON.parse(readFileSync8(`${workspace.location}/package.json`, { encoding: "utf8" }))
|
|
1295
1398
|
]);
|
|
1296
1399
|
const privatePackages = possibleDeployablePackages.filter(([_, pkg]) => pkg.private).map(([workspace]) => workspace);
|
|
1297
1400
|
const excludeList = privatePackages.map((workspace) => `--exclude ${workspace.name}`);
|
|
@@ -1311,22 +1414,22 @@ var deployNext = () => {
|
|
|
1311
1414
|
};
|
|
1312
1415
|
|
|
1313
1416
|
// src/actions/dupdeps.ts
|
|
1314
|
-
import
|
|
1417
|
+
import chalk19 from "chalk";
|
|
1315
1418
|
var dupdeps = () => {
|
|
1316
|
-
console.log(
|
|
1419
|
+
console.log(chalk19.green("Checking all Dependencies for Duplicates"));
|
|
1317
1420
|
const allDependencies = parsedPackageJSON()?.dependencies;
|
|
1318
1421
|
const dependencies = Object.entries(allDependencies).map(([k]) => k);
|
|
1319
1422
|
return detectDuplicateDependencies(dependencies);
|
|
1320
1423
|
};
|
|
1321
1424
|
|
|
1322
1425
|
// src/actions/lint.ts
|
|
1323
|
-
import
|
|
1426
|
+
import chalk20 from "chalk";
|
|
1324
1427
|
var lintPackage = ({
|
|
1325
1428
|
pkg,
|
|
1326
1429
|
fix: fix2,
|
|
1327
1430
|
verbose
|
|
1328
1431
|
}) => {
|
|
1329
|
-
console.log(
|
|
1432
|
+
console.log(chalk20.gray(`${fix2 ? "Fix" : "Lint"} [${pkg}]`));
|
|
1330
1433
|
const start = Date.now();
|
|
1331
1434
|
const result = runSteps(`${fix2 ? "Fix" : "Lint"} [${pkg}]`, [
|
|
1332
1435
|
["yarn", [
|
|
@@ -1336,7 +1439,7 @@ var lintPackage = ({
|
|
|
1336
1439
|
fix2 ? "package-fix" : verbose ? "package-lint-verbose" : "package-lint"
|
|
1337
1440
|
]]
|
|
1338
1441
|
]);
|
|
1339
|
-
console.log(
|
|
1442
|
+
console.log(chalk20.gray(`${fix2 ? "Fixed in" : "Linted in"} [${chalk20.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk20.gray("seconds")}`));
|
|
1340
1443
|
return result;
|
|
1341
1444
|
};
|
|
1342
1445
|
var lint = ({
|
|
@@ -1356,13 +1459,13 @@ var lint = ({
|
|
|
1356
1459
|
});
|
|
1357
1460
|
};
|
|
1358
1461
|
var lintAllPackages = ({ fix: fix2 = false } = {}) => {
|
|
1359
|
-
console.log(
|
|
1462
|
+
console.log(chalk20.gray(`${fix2 ? "Fix" : "Lint"} [All-Packages]`));
|
|
1360
1463
|
const start = Date.now();
|
|
1361
1464
|
const fixOptions = fix2 ? ["--fix"] : [];
|
|
1362
1465
|
const result = runSteps(`${fix2 ? "Fix" : "Lint"} [All-Packages]`, [
|
|
1363
1466
|
["yarn", ["eslint", "--cache", "--cache-location", ".eslintcache", "--cache-strategy", "content", ...fixOptions]]
|
|
1364
1467
|
]);
|
|
1365
|
-
console.log(
|
|
1468
|
+
console.log(chalk20.gray(`${fix2 ? "Fixed in" : "Linted in"} [${chalk20.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk20.gray("seconds")}`));
|
|
1366
1469
|
return result;
|
|
1367
1470
|
};
|
|
1368
1471
|
|
|
@@ -1390,7 +1493,7 @@ var filename = ".gitignore";
|
|
|
1390
1493
|
var gitignoreGen = (pkg) => generateIgnoreFiles(filename, pkg);
|
|
1391
1494
|
|
|
1392
1495
|
// src/actions/gitlint.ts
|
|
1393
|
-
import
|
|
1496
|
+
import chalk21 from "chalk";
|
|
1394
1497
|
import ParseGitConfig from "parse-git-config";
|
|
1395
1498
|
var gitlint = () => {
|
|
1396
1499
|
console.log(`
|
|
@@ -1401,7 +1504,7 @@ Gitlint Start [${process.cwd()}]
|
|
|
1401
1504
|
const errors = 0;
|
|
1402
1505
|
const gitConfig = ParseGitConfig.sync();
|
|
1403
1506
|
const warn = (message) => {
|
|
1404
|
-
console.warn(
|
|
1507
|
+
console.warn(chalk21.yellow(`Warning: ${message}`));
|
|
1405
1508
|
warnings++;
|
|
1406
1509
|
};
|
|
1407
1510
|
if (gitConfig.core.ignorecase) {
|
|
@@ -1421,13 +1524,13 @@ Gitlint Start [${process.cwd()}]
|
|
|
1421
1524
|
}
|
|
1422
1525
|
const resultMessages = [];
|
|
1423
1526
|
if (valid > 0) {
|
|
1424
|
-
resultMessages.push(
|
|
1527
|
+
resultMessages.push(chalk21.green(`Passed: ${valid}`));
|
|
1425
1528
|
}
|
|
1426
1529
|
if (warnings > 0) {
|
|
1427
|
-
resultMessages.push(
|
|
1530
|
+
resultMessages.push(chalk21.yellow(`Warnings: ${warnings}`));
|
|
1428
1531
|
}
|
|
1429
1532
|
if (errors > 0) {
|
|
1430
|
-
resultMessages.push(
|
|
1533
|
+
resultMessages.push(chalk21.red(` Errors: ${errors}`));
|
|
1431
1534
|
}
|
|
1432
1535
|
console.warn(`Gitlint Finish [ ${resultMessages.join(" | ")} ]
|
|
1433
1536
|
`);
|
|
@@ -1436,7 +1539,7 @@ Gitlint Start [${process.cwd()}]
|
|
|
1436
1539
|
|
|
1437
1540
|
// src/actions/gitlint-fix.ts
|
|
1438
1541
|
import { execSync as execSync2 } from "child_process";
|
|
1439
|
-
import
|
|
1542
|
+
import chalk22 from "chalk";
|
|
1440
1543
|
import ParseGitConfig2 from "parse-git-config";
|
|
1441
1544
|
var gitlintFix = () => {
|
|
1442
1545
|
console.log(`
|
|
@@ -1445,15 +1548,15 @@ Gitlint Fix Start [${process.cwd()}]
|
|
|
1445
1548
|
const gitConfig = ParseGitConfig2.sync();
|
|
1446
1549
|
if (gitConfig.core.ignorecase) {
|
|
1447
1550
|
execSync2("git config core.ignorecase false", { stdio: "inherit" });
|
|
1448
|
-
console.warn(
|
|
1551
|
+
console.warn(chalk22.yellow("\nGitlint Fix: Updated core.ignorecase to be false\n"));
|
|
1449
1552
|
}
|
|
1450
1553
|
if (gitConfig.core.autocrlf !== false) {
|
|
1451
1554
|
execSync2("git config core.autocrlf false", { stdio: "inherit" });
|
|
1452
|
-
console.warn(
|
|
1555
|
+
console.warn(chalk22.yellow("\nGitlint Fix: Updated core.autocrlf to be false\n"));
|
|
1453
1556
|
}
|
|
1454
1557
|
if (gitConfig.core.eol !== "lf") {
|
|
1455
1558
|
execSync2("git config core.eol lf", { stdio: "inherit" });
|
|
1456
|
-
console.warn(
|
|
1559
|
+
console.warn(chalk22.yellow('\nGitlint Fix: Updated core.eol to be "lf"\n'));
|
|
1457
1560
|
}
|
|
1458
1561
|
return 1;
|
|
1459
1562
|
};
|
|
@@ -1464,7 +1567,7 @@ var knip = () => {
|
|
|
1464
1567
|
};
|
|
1465
1568
|
|
|
1466
1569
|
// src/actions/license.ts
|
|
1467
|
-
import
|
|
1570
|
+
import chalk23 from "chalk";
|
|
1468
1571
|
import { init } from "license-checker";
|
|
1469
1572
|
var license = async (pkg) => {
|
|
1470
1573
|
const workspaces = yarnWorkspaces();
|
|
@@ -1489,18 +1592,18 @@ var license = async (pkg) => {
|
|
|
1489
1592
|
"LGPL-3.0-or-later",
|
|
1490
1593
|
"Python-2.0"
|
|
1491
1594
|
]);
|
|
1492
|
-
console.log(
|
|
1595
|
+
console.log(chalk23.green("License Checker"));
|
|
1493
1596
|
return (await Promise.all(
|
|
1494
1597
|
workspaceList.map(({ location, name }) => {
|
|
1495
1598
|
return new Promise((resolve) => {
|
|
1496
1599
|
init({ production: true, start: location }, (error, packages) => {
|
|
1497
1600
|
if (error) {
|
|
1498
|
-
console.error(
|
|
1499
|
-
console.error(
|
|
1601
|
+
console.error(chalk23.red(`License Checker [${name}] Error`));
|
|
1602
|
+
console.error(chalk23.gray(error));
|
|
1500
1603
|
console.log("\n");
|
|
1501
1604
|
resolve(1);
|
|
1502
1605
|
} else {
|
|
1503
|
-
console.log(
|
|
1606
|
+
console.log(chalk23.green(`License Checker [${name}]`));
|
|
1504
1607
|
let count = 0;
|
|
1505
1608
|
for (const [name2, info] of Object.entries(packages)) {
|
|
1506
1609
|
const licenses = Array.isArray(info.licenses) ? info.licenses : [info.licenses];
|
|
@@ -1516,7 +1619,7 @@ var license = async (pkg) => {
|
|
|
1516
1619
|
}
|
|
1517
1620
|
if (!orLicenseFound) {
|
|
1518
1621
|
count++;
|
|
1519
|
-
console.warn(
|
|
1622
|
+
console.warn(chalk23.yellow(`${name2}: Package License not allowed [${license2}]`));
|
|
1520
1623
|
}
|
|
1521
1624
|
}
|
|
1522
1625
|
}
|
|
@@ -1536,12 +1639,12 @@ var npmignoreGen = (pkg) => generateIgnoreFiles(filename2, pkg);
|
|
|
1536
1639
|
|
|
1537
1640
|
// src/actions/package/clean-outputs.ts
|
|
1538
1641
|
import path7 from "path";
|
|
1539
|
-
import
|
|
1642
|
+
import chalk24 from "chalk";
|
|
1540
1643
|
var packageCleanOutputs = () => {
|
|
1541
1644
|
const pkg = process.env.INIT_CWD ?? ".";
|
|
1542
1645
|
const pkgName = process.env.npm_package_name;
|
|
1543
1646
|
const folders = [path7.join(pkg, "dist"), path7.join(pkg, "build"), path7.join(pkg, "docs")];
|
|
1544
|
-
console.log(
|
|
1647
|
+
console.log(chalk24.green(`Cleaning Outputs [${pkgName}]`));
|
|
1545
1648
|
for (let folder of folders) {
|
|
1546
1649
|
deleteGlob(folder);
|
|
1547
1650
|
}
|
|
@@ -1550,11 +1653,11 @@ var packageCleanOutputs = () => {
|
|
|
1550
1653
|
|
|
1551
1654
|
// src/actions/package/clean-typescript.ts
|
|
1552
1655
|
import path8 from "path";
|
|
1553
|
-
import
|
|
1656
|
+
import chalk25 from "chalk";
|
|
1554
1657
|
var packageCleanTypescript = () => {
|
|
1555
1658
|
const pkg = process.env.INIT_CWD ?? ".";
|
|
1556
1659
|
const pkgName = process.env.npm_package_name;
|
|
1557
|
-
console.log(
|
|
1660
|
+
console.log(chalk25.green(`Cleaning Typescript [${pkgName}]`));
|
|
1558
1661
|
const files = [path8.join(pkg, "*.tsbuildinfo"), path8.join(pkg, ".tsconfig.*"), path8.join(pkg, ".eslintcache")];
|
|
1559
1662
|
for (let file of files) {
|
|
1560
1663
|
deleteGlob(file);
|
|
@@ -1568,26 +1671,26 @@ var packageClean = async () => {
|
|
|
1568
1671
|
};
|
|
1569
1672
|
|
|
1570
1673
|
// src/actions/package/compile/compile.ts
|
|
1571
|
-
import
|
|
1674
|
+
import chalk30 from "chalk";
|
|
1572
1675
|
|
|
1573
1676
|
// src/actions/package/compile/packageCompileTsup.ts
|
|
1574
|
-
import
|
|
1677
|
+
import chalk29 from "chalk";
|
|
1575
1678
|
import { build as build2, defineConfig } from "tsup";
|
|
1576
1679
|
|
|
1577
1680
|
// src/actions/package/compile/inputs.ts
|
|
1578
|
-
import
|
|
1681
|
+
import chalk26 from "chalk";
|
|
1579
1682
|
import { glob as glob2 } from "glob";
|
|
1580
1683
|
var getAllInputs = (srcDir, verbose = false) => {
|
|
1581
1684
|
return [...glob2.sync(`${srcDir}/**/*.ts`, { posix: true }).map((file) => {
|
|
1582
1685
|
const result = file.slice(Math.max(0, srcDir.length + 1));
|
|
1583
1686
|
if (verbose) {
|
|
1584
|
-
console.log(
|
|
1687
|
+
console.log(chalk26.gray(`getAllInputs: ${JSON.stringify(result, null, 2)}`));
|
|
1585
1688
|
}
|
|
1586
1689
|
return result;
|
|
1587
1690
|
}), ...glob2.sync(`${srcDir}/**/*.tsx`, { posix: true }).map((file) => {
|
|
1588
1691
|
const result = file.slice(Math.max(0, srcDir.length + 1));
|
|
1589
1692
|
if (verbose) {
|
|
1590
|
-
console.log(
|
|
1693
|
+
console.log(chalk26.gray(`getAllInputs: ${JSON.stringify(result, null, 2)}`));
|
|
1591
1694
|
}
|
|
1592
1695
|
return result;
|
|
1593
1696
|
})];
|
|
@@ -1646,7 +1749,7 @@ function deepMergeObjects(objects) {
|
|
|
1646
1749
|
|
|
1647
1750
|
// src/actions/package/compile/packageCompileTsc.ts
|
|
1648
1751
|
import { cwd as cwd2 } from "process";
|
|
1649
|
-
import
|
|
1752
|
+
import chalk27 from "chalk";
|
|
1650
1753
|
import { createProgramFromConfig } from "tsc-prog";
|
|
1651
1754
|
import ts2, {
|
|
1652
1755
|
DiagnosticCategory,
|
|
@@ -1668,7 +1771,7 @@ var getCompilerOptions = (options = {}, fileName = "tsconfig.json") => {
|
|
|
1668
1771
|
var packageCompileTsc = (platform, entries, srcDir = "src", outDir = "dist", compilerOptionsParam, verbose = false) => {
|
|
1669
1772
|
const pkg = process.env.INIT_CWD ?? cwd2();
|
|
1670
1773
|
if (verbose) {
|
|
1671
|
-
console.log(
|
|
1774
|
+
console.log(chalk27.cyan(`Validating code START: ${entries.length} files to ${outDir} from ${srcDir}`));
|
|
1672
1775
|
}
|
|
1673
1776
|
const configFilePath = ts2.findConfigFile(
|
|
1674
1777
|
"./",
|
|
@@ -1691,10 +1794,10 @@ var packageCompileTsc = (platform, entries, srcDir = "src", outDir = "dist", com
|
|
|
1691
1794
|
emitDeclarationOnly: true,
|
|
1692
1795
|
noEmit: false
|
|
1693
1796
|
};
|
|
1694
|
-
console.log(
|
|
1797
|
+
console.log(chalk27.cyan(`Validating Files: ${entries.length}`));
|
|
1695
1798
|
if (verbose) {
|
|
1696
1799
|
for (const entry of entries) {
|
|
1697
|
-
console.log(
|
|
1800
|
+
console.log(chalk27.grey(`Validating: ${entry}`));
|
|
1698
1801
|
}
|
|
1699
1802
|
}
|
|
1700
1803
|
try {
|
|
@@ -1724,7 +1827,7 @@ var packageCompileTsc = (platform, entries, srcDir = "src", outDir = "dist", com
|
|
|
1724
1827
|
return 0;
|
|
1725
1828
|
} finally {
|
|
1726
1829
|
if (verbose) {
|
|
1727
|
-
console.log(
|
|
1830
|
+
console.log(chalk27.cyan(`Validating code FINISH: ${entries.length} files to ${outDir} from ${srcDir}`));
|
|
1728
1831
|
}
|
|
1729
1832
|
}
|
|
1730
1833
|
};
|
|
@@ -1732,7 +1835,7 @@ var packageCompileTsc = (platform, entries, srcDir = "src", outDir = "dist", com
|
|
|
1732
1835
|
// src/actions/package/compile/packageCompileTscTypes.ts
|
|
1733
1836
|
import path9 from "path";
|
|
1734
1837
|
import { cwd as cwd3 } from "process";
|
|
1735
|
-
import
|
|
1838
|
+
import chalk28 from "chalk";
|
|
1736
1839
|
import { rollup } from "rollup";
|
|
1737
1840
|
import dts from "rollup-plugin-dts";
|
|
1738
1841
|
import nodeExternals from "rollup-plugin-node-externals";
|
|
@@ -1757,8 +1860,8 @@ async function bundleDts(inputPath, outputPath, platform, options, verbose = fal
|
|
|
1757
1860
|
if (ignoredWarningCodes.has(warning.code ?? "")) {
|
|
1758
1861
|
return;
|
|
1759
1862
|
}
|
|
1760
|
-
console.warn(
|
|
1761
|
-
console.warn(
|
|
1863
|
+
console.warn(chalk28.yellow(`[${warning.code}] ${warning.message}`));
|
|
1864
|
+
console.warn(chalk28.gray(inputPath));
|
|
1762
1865
|
warn(warning);
|
|
1763
1866
|
}
|
|
1764
1867
|
});
|
|
@@ -1768,8 +1871,8 @@ async function bundleDts(inputPath, outputPath, platform, options, verbose = fal
|
|
|
1768
1871
|
});
|
|
1769
1872
|
} catch (ex) {
|
|
1770
1873
|
const error = ex;
|
|
1771
|
-
console.warn(
|
|
1772
|
-
console.warn(
|
|
1874
|
+
console.warn(chalk28.red(error));
|
|
1875
|
+
console.warn(chalk28.gray(inputPath));
|
|
1773
1876
|
}
|
|
1774
1877
|
if (verbose) {
|
|
1775
1878
|
console.log(`Bundled declarations written to ${outputPath}`);
|
|
@@ -1777,7 +1880,7 @@ async function bundleDts(inputPath, outputPath, platform, options, verbose = fal
|
|
|
1777
1880
|
}
|
|
1778
1881
|
var packageCompileTscTypes = async (entries, outDir, platform, srcDir = "build", verbose = false) => {
|
|
1779
1882
|
if (verbose) {
|
|
1780
|
-
console.log(
|
|
1883
|
+
console.log(chalk28.cyan(`Compiling Types START [${platform}]: ${entries.length} files to ${outDir} from ${srcDir}`));
|
|
1781
1884
|
console.log(`Entries: ${entries.join(", ")}`);
|
|
1782
1885
|
}
|
|
1783
1886
|
const pkg = process.env.INIT_CWD ?? cwd3();
|
|
@@ -1801,7 +1904,7 @@ var packageCompileTscTypes = async (entries, outDir, platform, srcDir = "build",
|
|
|
1801
1904
|
await bundleDts(`${srcRoot}/${entryTypeName}`, `${outDir}/${entryTypeName}`, platform, { compilerOptions }, verbose);
|
|
1802
1905
|
}));
|
|
1803
1906
|
if (verbose) {
|
|
1804
|
-
console.log(
|
|
1907
|
+
console.log(chalk28.cyan(`Compiling Types FINISH: ${entries.length} files to ${outDir} from ${srcDir}`));
|
|
1805
1908
|
}
|
|
1806
1909
|
return 0;
|
|
1807
1910
|
};
|
|
@@ -1813,15 +1916,15 @@ var compileFolder = async (srcDir, entries, buildDir, options, bundleTypes = fal
|
|
|
1813
1916
|
console.log(`compileFolder [${srcDir}, ${options?.outDir}]`);
|
|
1814
1917
|
}
|
|
1815
1918
|
if (entries.length === 0) {
|
|
1816
|
-
console.warn(
|
|
1919
|
+
console.warn(chalk29.yellow(`No entries found in ${srcDir} to compile`));
|
|
1817
1920
|
return 0;
|
|
1818
1921
|
}
|
|
1819
1922
|
if (verbose) {
|
|
1820
|
-
console.log(
|
|
1923
|
+
console.log(chalk29.gray(`buildDir [${buildDir}]`));
|
|
1821
1924
|
}
|
|
1822
1925
|
const validationResult = packageCompileTsc(options?.platform ?? "neutral", entries, srcDir, buildDir, void 0, verbose);
|
|
1823
1926
|
if (validationResult !== 0) {
|
|
1824
|
-
console.error(
|
|
1927
|
+
console.error(chalk29.red(`Compile:Validation had ${validationResult} errors`));
|
|
1825
1928
|
return validationResult;
|
|
1826
1929
|
}
|
|
1827
1930
|
const optionsParams = tsupOptions([{
|
|
@@ -1846,12 +1949,12 @@ var compileFolder = async (srcDir, entries, buildDir, options, bundleTypes = fal
|
|
|
1846
1949
|
})
|
|
1847
1950
|
)).flat();
|
|
1848
1951
|
if (verbose) {
|
|
1849
|
-
console.log(
|
|
1850
|
-
console.log(
|
|
1952
|
+
console.log(chalk29.cyan(`TSUP:build:start [${srcDir}]`));
|
|
1953
|
+
console.log(chalk29.gray(`TSUP:build:options [${JSON.stringify(optionsList, null, 2)}]`));
|
|
1851
1954
|
}
|
|
1852
1955
|
await Promise.all(optionsList.map((options2) => build2(options2)));
|
|
1853
1956
|
if (verbose) {
|
|
1854
|
-
console.log(
|
|
1957
|
+
console.log(chalk29.cyan(`TSUP:build:stop [${srcDir}]`));
|
|
1855
1958
|
}
|
|
1856
1959
|
if (bundleTypes) {
|
|
1857
1960
|
await packageCompileTscTypes(entries, outDir, options?.platform ?? "neutral", buildDir, verbose);
|
|
@@ -1962,14 +2065,14 @@ var packageCompileTsup = async (config2) => {
|
|
|
1962
2065
|
// src/actions/package/compile/compile.ts
|
|
1963
2066
|
var packageCompile = async (inConfig = {}) => {
|
|
1964
2067
|
const pkg = process.env.INIT_CWD;
|
|
1965
|
-
console.log(
|
|
2068
|
+
console.log(chalk30.green(`Compiling ${pkg}`));
|
|
1966
2069
|
const config2 = await loadConfig(inConfig);
|
|
1967
2070
|
return await packageCompileTsup(config2);
|
|
1968
2071
|
};
|
|
1969
2072
|
|
|
1970
2073
|
// src/actions/package/copy-assets.ts
|
|
1971
2074
|
import path10 from "path/posix";
|
|
1972
|
-
import
|
|
2075
|
+
import chalk31 from "chalk";
|
|
1973
2076
|
import cpy2 from "cpy";
|
|
1974
2077
|
var copyTargetAssets2 = async (target, name, location) => {
|
|
1975
2078
|
try {
|
|
@@ -1982,7 +2085,7 @@ var copyTargetAssets2 = async (target, name, location) => {
|
|
|
1982
2085
|
}
|
|
1983
2086
|
);
|
|
1984
2087
|
if (values.length > 0) {
|
|
1985
|
-
console.log(
|
|
2088
|
+
console.log(chalk31.green(`Copying Assets [${target.toUpperCase()}] - ${name} - ${location}`));
|
|
1986
2089
|
}
|
|
1987
2090
|
for (const value of values) {
|
|
1988
2091
|
console.log(`${value.split("/").pop()} => ./dist/${target}`);
|
|
@@ -2047,9 +2150,9 @@ var packageCycle = async () => {
|
|
|
2047
2150
|
};
|
|
2048
2151
|
|
|
2049
2152
|
// src/actions/package/gen-docs.ts
|
|
2050
|
-
import { existsSync as
|
|
2153
|
+
import { existsSync as existsSync5 } from "fs";
|
|
2051
2154
|
import path11 from "path";
|
|
2052
|
-
import
|
|
2155
|
+
import chalk32 from "chalk";
|
|
2053
2156
|
import {
|
|
2054
2157
|
Application,
|
|
2055
2158
|
ArgumentsReader,
|
|
@@ -2067,7 +2170,7 @@ var ExitCodes = {
|
|
|
2067
2170
|
};
|
|
2068
2171
|
var packageGenDocs = async () => {
|
|
2069
2172
|
const pkg = process.env.INIT_CWD;
|
|
2070
|
-
if (pkg !== void 0 && !
|
|
2173
|
+
if (pkg !== void 0 && !existsSync5(path11.join(pkg, "typedoc.json"))) {
|
|
2071
2174
|
return;
|
|
2072
2175
|
}
|
|
2073
2176
|
const app = await Application.bootstrap({
|
|
@@ -2153,16 +2256,16 @@ var runTypeDoc = async (app) => {
|
|
|
2153
2256
|
return ExitCodes.OutputError;
|
|
2154
2257
|
}
|
|
2155
2258
|
}
|
|
2156
|
-
console.log(
|
|
2259
|
+
console.log(chalk32.green(`${pkgName} - Ok`));
|
|
2157
2260
|
return ExitCodes.Ok;
|
|
2158
2261
|
};
|
|
2159
2262
|
|
|
2160
2263
|
// src/actions/package/lint.ts
|
|
2161
|
-
import { readdirSync } from "fs";
|
|
2264
|
+
import { readdirSync as readdirSync3 } from "fs";
|
|
2162
2265
|
import path12 from "path";
|
|
2163
2266
|
import { cwd as cwd4 } from "process";
|
|
2164
2267
|
import { pathToFileURL } from "url";
|
|
2165
|
-
import
|
|
2268
|
+
import chalk33 from "chalk";
|
|
2166
2269
|
import { ESLint } from "eslint";
|
|
2167
2270
|
import { findUp } from "find-up";
|
|
2168
2271
|
import picomatch from "picomatch";
|
|
@@ -2171,14 +2274,14 @@ var dumpMessages = (lintResults) => {
|
|
|
2171
2274
|
const severity = ["none", "warning", "error"];
|
|
2172
2275
|
for (const lintResult of lintResults) {
|
|
2173
2276
|
if (lintResult.messages.length > 0) {
|
|
2174
|
-
console.log(
|
|
2277
|
+
console.log(chalk33.gray(`
|
|
2175
2278
|
${lintResult.filePath}`));
|
|
2176
2279
|
for (const message of lintResult.messages) {
|
|
2177
2280
|
console.log(
|
|
2178
|
-
|
|
2179
|
-
|
|
2180
|
-
|
|
2181
|
-
|
|
2281
|
+
chalk33.gray(` ${message.line}:${message.column}`),
|
|
2282
|
+
chalk33[colors[message.severity]](` ${severity[message.severity]}`),
|
|
2283
|
+
chalk33.white(` ${message.message}`),
|
|
2284
|
+
chalk33.gray(` ${message.ruleId}`)
|
|
2182
2285
|
);
|
|
2183
2286
|
}
|
|
2184
2287
|
}
|
|
@@ -2195,7 +2298,7 @@ function getFiles(dir, ignoreFolders) {
|
|
|
2195
2298
|
const currentDirectory = cwd4();
|
|
2196
2299
|
const subDirectory = dir.split(currentDirectory)[1]?.split("/")[1];
|
|
2197
2300
|
if (ignoreFolders.includes(subDirectory)) return [];
|
|
2198
|
-
return
|
|
2301
|
+
return readdirSync3(dir, { withFileTypes: true }).flatMap((dirent) => {
|
|
2199
2302
|
const res = path12.resolve(dir, dirent.name);
|
|
2200
2303
|
const relativePath = subDirectory === void 0 ? dirent.name : `${subDirectory}/${dirent.name}`;
|
|
2201
2304
|
const ignoreMatchers = ignoreFolders.map((pattern) => picomatch(pattern));
|
|
@@ -2216,10 +2319,10 @@ var packageLint = async (fix2 = false, verbose = false, cache = true) => {
|
|
|
2216
2319
|
cache
|
|
2217
2320
|
});
|
|
2218
2321
|
const files = getFiles(cwd4(), ignoreFolders);
|
|
2219
|
-
console.log(
|
|
2322
|
+
console.log(chalk33.green(`Linting ${pkg} [files = ${files.length}]`));
|
|
2220
2323
|
if (verbose) {
|
|
2221
2324
|
for (const file of files) {
|
|
2222
|
-
console.log(
|
|
2325
|
+
console.log(chalk33.gray(` ${file}`));
|
|
2223
2326
|
}
|
|
2224
2327
|
}
|
|
2225
2328
|
const lintResults = await engine.lintFiles(files);
|
|
@@ -2230,32 +2333,32 @@ var packageLint = async (fix2 = false, verbose = false, cache = true) => {
|
|
|
2230
2333
|
const filesCountColor = files.length < 100 ? "green" : files.length < 1e3 ? "yellow" : "red";
|
|
2231
2334
|
const lintTime = Date.now() - start;
|
|
2232
2335
|
const lintTimeColor = lintTime < 1e3 ? "green" : lintTime < 3e3 ? "yellow" : "red";
|
|
2233
|
-
console.log(
|
|
2336
|
+
console.log(chalk33.white(`Linted ${chalk33[filesCountColor](files.length)} files in ${chalk33[lintTimeColor](lintTime)}ms`));
|
|
2234
2337
|
return lintResults.reduce((prev, lintResult) => prev + lintResult.errorCount, 0);
|
|
2235
2338
|
};
|
|
2236
2339
|
|
|
2237
2340
|
// src/actions/package/publint.ts
|
|
2238
2341
|
import { promises as fs9 } from "fs";
|
|
2239
|
-
import
|
|
2342
|
+
import chalk34 from "chalk";
|
|
2240
2343
|
import sortPackageJson from "sort-package-json";
|
|
2241
2344
|
var customPubLint = (pkg) => {
|
|
2242
2345
|
let errorCount = 0;
|
|
2243
2346
|
let warningCount = 0;
|
|
2244
2347
|
if (pkg.files === void 0) {
|
|
2245
|
-
console.warn(
|
|
2348
|
+
console.warn(chalk34.yellow('Publint [custom]: "files" field is missing'));
|
|
2246
2349
|
warningCount++;
|
|
2247
2350
|
}
|
|
2248
2351
|
if (pkg.main !== void 0) {
|
|
2249
|
-
console.warn(
|
|
2352
|
+
console.warn(chalk34.yellow('Publint [custom]: "main" field is deprecated, use "exports" instead'));
|
|
2250
2353
|
warningCount++;
|
|
2251
2354
|
}
|
|
2252
2355
|
if (pkg.sideEffects !== false) {
|
|
2253
|
-
console.warn(
|
|
2356
|
+
console.warn(chalk34.yellow('Publint [custom]: "sideEffects" field should be set to false'));
|
|
2254
2357
|
warningCount++;
|
|
2255
2358
|
}
|
|
2256
2359
|
if (pkg.resolutions !== void 0) {
|
|
2257
|
-
console.warn(
|
|
2258
|
-
console.warn(
|
|
2360
|
+
console.warn(chalk34.yellow('Publint [custom]: "resolutions" in use'));
|
|
2361
|
+
console.warn(chalk34.gray(JSON.stringify(pkg.resolutions, null, 2)));
|
|
2259
2362
|
warningCount++;
|
|
2260
2363
|
}
|
|
2261
2364
|
return [errorCount, warningCount];
|
|
@@ -2265,8 +2368,8 @@ var packagePublint = async ({ strict = true, verbose = false } = {}) => {
|
|
|
2265
2368
|
const sortedPkg = sortPackageJson(await fs9.readFile(`${pkgDir}/package.json`, "utf8"));
|
|
2266
2369
|
await fs9.writeFile(`${pkgDir}/package.json`, sortedPkg);
|
|
2267
2370
|
const pkg = JSON.parse(await fs9.readFile(`${pkgDir}/package.json`, "utf8"));
|
|
2268
|
-
console.log(
|
|
2269
|
-
console.log(
|
|
2371
|
+
console.log(chalk34.green(`Publint: ${pkg.name}`));
|
|
2372
|
+
console.log(chalk34.gray(pkgDir));
|
|
2270
2373
|
const { publint: publint2 } = await import("publint");
|
|
2271
2374
|
const { messages } = await publint2({
|
|
2272
2375
|
level: "suggestion",
|
|
@@ -2277,22 +2380,22 @@ var packagePublint = async ({ strict = true, verbose = false } = {}) => {
|
|
|
2277
2380
|
for (const message of messages) {
|
|
2278
2381
|
switch (message.type) {
|
|
2279
2382
|
case "error": {
|
|
2280
|
-
console.error(
|
|
2383
|
+
console.error(chalk34.red(`[${message.code}] ${formatMessage(message, pkg)}`));
|
|
2281
2384
|
break;
|
|
2282
2385
|
}
|
|
2283
2386
|
case "warning": {
|
|
2284
|
-
console.warn(
|
|
2387
|
+
console.warn(chalk34.yellow(`[${message.code}] ${formatMessage(message, pkg)}`));
|
|
2285
2388
|
break;
|
|
2286
2389
|
}
|
|
2287
2390
|
default: {
|
|
2288
|
-
console.log(
|
|
2391
|
+
console.log(chalk34.white(`[${message.code}] ${formatMessage(message, pkg)}`));
|
|
2289
2392
|
break;
|
|
2290
2393
|
}
|
|
2291
2394
|
}
|
|
2292
2395
|
}
|
|
2293
2396
|
const [errorCount, warningCount] = customPubLint(pkg);
|
|
2294
2397
|
if (verbose) {
|
|
2295
|
-
console.log(
|
|
2398
|
+
console.log(chalk34.gray(`Publint [Finish]: ${pkgDir} [${messages.length + errorCount + warningCount} messages]`));
|
|
2296
2399
|
}
|
|
2297
2400
|
return messages.filter((message) => message.type === "error").length + errorCount;
|
|
2298
2401
|
};
|
|
@@ -2328,7 +2431,7 @@ var rebuild = ({ target }) => {
|
|
|
2328
2431
|
};
|
|
2329
2432
|
|
|
2330
2433
|
// src/actions/recompile.ts
|
|
2331
|
-
import
|
|
2434
|
+
import chalk35 from "chalk";
|
|
2332
2435
|
var recompile = async ({
|
|
2333
2436
|
verbose,
|
|
2334
2437
|
target,
|
|
@@ -2364,7 +2467,7 @@ var recompileAll = async ({
|
|
|
2364
2467
|
const incrementalOptions = incremental ? ["--since", "-Apt", "--topological-dev"] : ["--parallel", "-Apt", "--topological-dev"];
|
|
2365
2468
|
const jobsOptions = jobs ? ["-j", `${jobs}`] : [];
|
|
2366
2469
|
if (jobs) {
|
|
2367
|
-
console.log(
|
|
2470
|
+
console.log(chalk35.blue(`Jobs set to [${jobs}]`));
|
|
2368
2471
|
}
|
|
2369
2472
|
const result = await runStepsAsync(`Recompile${incremental ? "-Incremental" : ""} [All]`, [
|
|
2370
2473
|
[
|
|
@@ -2395,7 +2498,7 @@ var recompileAll = async ({
|
|
|
2395
2498
|
]
|
|
2396
2499
|
]);
|
|
2397
2500
|
console.log(
|
|
2398
|
-
`${
|
|
2501
|
+
`${chalk35.gray("Recompiled in")} [${chalk35.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk35.gray("seconds")}`
|
|
2399
2502
|
);
|
|
2400
2503
|
return result;
|
|
2401
2504
|
};
|
|
@@ -2426,13 +2529,13 @@ var reinstall = () => {
|
|
|
2426
2529
|
};
|
|
2427
2530
|
|
|
2428
2531
|
// src/actions/relint.ts
|
|
2429
|
-
import
|
|
2532
|
+
import chalk36 from "chalk";
|
|
2430
2533
|
var relintPackage = ({
|
|
2431
2534
|
pkg,
|
|
2432
2535
|
fix: fix2,
|
|
2433
2536
|
verbose
|
|
2434
2537
|
}) => {
|
|
2435
|
-
console.log(
|
|
2538
|
+
console.log(chalk36.gray(`${fix2 ? "Fix" : "Lint"} [${pkg}]`));
|
|
2436
2539
|
const start = Date.now();
|
|
2437
2540
|
const result = runSteps(`${fix2 ? "Fix" : "Lint"} [${pkg}]`, [
|
|
2438
2541
|
["yarn", [
|
|
@@ -2442,7 +2545,7 @@ var relintPackage = ({
|
|
|
2442
2545
|
fix2 ? "package-fix" : verbose ? "package-lint-verbose" : "package-lint"
|
|
2443
2546
|
]]
|
|
2444
2547
|
]);
|
|
2445
|
-
console.log(
|
|
2548
|
+
console.log(chalk36.gray(`${fix2 ? "Fixed in" : "Linted in"} [${chalk36.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk36.gray("seconds")}`));
|
|
2446
2549
|
return result;
|
|
2447
2550
|
};
|
|
2448
2551
|
var relint = ({
|
|
@@ -2462,13 +2565,13 @@ var relint = ({
|
|
|
2462
2565
|
});
|
|
2463
2566
|
};
|
|
2464
2567
|
var relintAllPackages = ({ fix: fix2 = false } = {}) => {
|
|
2465
|
-
console.log(
|
|
2568
|
+
console.log(chalk36.gray(`${fix2 ? "Fix" : "Lint"} [All-Packages]`));
|
|
2466
2569
|
const start = Date.now();
|
|
2467
2570
|
const fixOptions = fix2 ? ["--fix"] : [];
|
|
2468
2571
|
const result = runSteps(`${fix2 ? "Fix" : "Lint"} [All-Packages]`, [
|
|
2469
2572
|
["yarn", ["eslint", ...fixOptions]]
|
|
2470
2573
|
]);
|
|
2471
|
-
console.log(
|
|
2574
|
+
console.log(chalk36.gray(`${fix2 ? "Fixed in" : "Linted in"} [${chalk36.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk36.gray("seconds")}`));
|
|
2472
2575
|
return result;
|
|
2473
2576
|
};
|
|
2474
2577
|
|
|
@@ -2486,10 +2589,10 @@ var sonar = () => {
|
|
|
2486
2589
|
};
|
|
2487
2590
|
|
|
2488
2591
|
// src/actions/statics.ts
|
|
2489
|
-
import
|
|
2592
|
+
import chalk37 from "chalk";
|
|
2490
2593
|
var DefaultDependencies = ["axios", "@xylabs/pixel", "react", "graphql", "react-router", "@mui/material", "@mui/system"];
|
|
2491
2594
|
var statics = () => {
|
|
2492
|
-
console.log(
|
|
2595
|
+
console.log(chalk37.green("Check Required Static Dependencies"));
|
|
2493
2596
|
const statics2 = parsedPackageJSON()?.xy?.deps?.statics;
|
|
2494
2597
|
return detectDuplicateDependencies(statics2, DefaultDependencies);
|
|
2495
2598
|
};
|
|
@@ -2539,6 +2642,7 @@ var yarn3Only = () => {
|
|
|
2539
2642
|
export {
|
|
2540
2643
|
build,
|
|
2541
2644
|
bundleDts,
|
|
2645
|
+
claudeRules,
|
|
2542
2646
|
clean,
|
|
2543
2647
|
cleanAll,
|
|
2544
2648
|
cleanDocs,
|