@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/index.mjs
CHANGED
|
@@ -14,8 +14,27 @@ 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/createBuildConfig.ts
|
|
18
|
-
import { readFileSync } from "fs";
|
|
37
|
+
import { readFileSync as readFileSync2 } from "fs";
|
|
19
38
|
|
|
20
39
|
// src/lib/defaultBuildConfig.ts
|
|
21
40
|
var defaultBuildConfig = {
|
|
@@ -41,7 +60,7 @@ var defaultBuildConfig = {
|
|
|
41
60
|
var getGeneralTypescriptConfig = (location) => {
|
|
42
61
|
let generalConfig;
|
|
43
62
|
try {
|
|
44
|
-
generalConfig =
|
|
63
|
+
generalConfig = readFileSync2(`${location}/tsconfig.json`, { encoding: "utf8" });
|
|
45
64
|
} catch {
|
|
46
65
|
return false;
|
|
47
66
|
}
|
|
@@ -255,7 +274,7 @@ var CROSS_PLATFORM_NEWLINE = "\n";
|
|
|
255
274
|
// src/lib/file/fileLines.ts
|
|
256
275
|
import {
|
|
257
276
|
existsSync,
|
|
258
|
-
readFileSync as
|
|
277
|
+
readFileSync as readFileSync3,
|
|
259
278
|
writeFileSync
|
|
260
279
|
} from "fs";
|
|
261
280
|
|
|
@@ -270,18 +289,18 @@ var union = (a, b) => /* @__PURE__ */ new Set([...new Set(a), ...new Set(b)]);
|
|
|
270
289
|
var defaultReadFileSyncOptions = { encoding: "utf8" };
|
|
271
290
|
|
|
272
291
|
// src/lib/file/fileLines.ts
|
|
273
|
-
var readLines = (uri, options = defaultReadFileSyncOptions) => existsSync(uri) ?
|
|
292
|
+
var readLines = (uri, options = defaultReadFileSyncOptions) => existsSync(uri) ? readFileSync3(uri, options).replace(WINDOWS_NEWLINE_REGEX, CROSS_PLATFORM_NEWLINE).split(CROSS_PLATFORM_NEWLINE) : [];
|
|
274
293
|
var readNonEmptyLines = (uri, options = defaultReadFileSyncOptions) => readLines(uri, options).filter(notEmpty);
|
|
275
294
|
var writeLines = (uri, lines, options = defaultReadFileSyncOptions) => {
|
|
276
|
-
const existing = existsSync(uri) ?
|
|
295
|
+
const existing = existsSync(uri) ? readFileSync3(uri, options) : void 0;
|
|
277
296
|
const desired = lines.join(CROSS_PLATFORM_NEWLINE);
|
|
278
297
|
if (existing !== desired) writeFileSync(uri, desired, options);
|
|
279
298
|
};
|
|
280
299
|
|
|
281
300
|
// src/lib/file/tryReadFileSync.ts
|
|
282
|
-
import { existsSync as existsSync2, readFileSync as
|
|
301
|
+
import { existsSync as existsSync2, readFileSync as readFileSync4 } from "fs";
|
|
283
302
|
var tryReadFileSync = (uri, options = defaultReadFileSyncOptions) => {
|
|
284
|
-
return existsSync2(uri) ?
|
|
303
|
+
return existsSync2(uri) ? readFileSync4(uri, options) : void 0;
|
|
285
304
|
};
|
|
286
305
|
|
|
287
306
|
// src/lib/generateIgnoreFiles.ts
|
|
@@ -372,10 +391,10 @@ var loadConfig = async (params) => {
|
|
|
372
391
|
};
|
|
373
392
|
|
|
374
393
|
// src/lib/parsedPackageJSON.ts
|
|
375
|
-
import { readFileSync as
|
|
394
|
+
import { readFileSync as readFileSync5 } from "fs";
|
|
376
395
|
var parsedPackageJSON = (path13) => {
|
|
377
396
|
const pathToPackageJSON = path13 ?? process.env.npm_package_json ?? "";
|
|
378
|
-
const packageJSON =
|
|
397
|
+
const packageJSON = readFileSync5(pathToPackageJSON).toString();
|
|
379
398
|
return JSON.parse(packageJSON);
|
|
380
399
|
};
|
|
381
400
|
|
|
@@ -503,6 +522,89 @@ var build = async ({
|
|
|
503
522
|
return result;
|
|
504
523
|
};
|
|
505
524
|
|
|
525
|
+
// src/actions/claude-rules.ts
|
|
526
|
+
import {
|
|
527
|
+
existsSync as existsSync5,
|
|
528
|
+
mkdirSync,
|
|
529
|
+
readdirSync as readdirSync2,
|
|
530
|
+
readFileSync as readFileSync6,
|
|
531
|
+
unlinkSync,
|
|
532
|
+
writeFileSync as writeFileSync2
|
|
533
|
+
} from "fs";
|
|
534
|
+
import PATH2 from "path";
|
|
535
|
+
import chalk10 from "chalk";
|
|
536
|
+
var syncRuleFiles = (rulesDir) => {
|
|
537
|
+
const templates = claudeMdRuleTemplates();
|
|
538
|
+
const templateNames = new Set(Object.keys(templates));
|
|
539
|
+
let updated = 0;
|
|
540
|
+
let created = 0;
|
|
541
|
+
for (const [filename3, content] of Object.entries(templates)) {
|
|
542
|
+
const targetPath = PATH2.resolve(rulesDir, filename3);
|
|
543
|
+
const existing = existsSync5(targetPath) ? readFileSync6(targetPath, "utf8") : void 0;
|
|
544
|
+
if (existing === content) continue;
|
|
545
|
+
writeFileSync2(targetPath, content, "utf8");
|
|
546
|
+
if (existing) {
|
|
547
|
+
updated++;
|
|
548
|
+
} else {
|
|
549
|
+
created++;
|
|
550
|
+
}
|
|
551
|
+
}
|
|
552
|
+
return {
|
|
553
|
+
created,
|
|
554
|
+
templateNames,
|
|
555
|
+
updated
|
|
556
|
+
};
|
|
557
|
+
};
|
|
558
|
+
var removeStaleRules = (rulesDir, templateNames) => {
|
|
559
|
+
const existingRules = readdirSync2(rulesDir).filter((f) => f.startsWith(XYLABS_RULES_PREFIX) && f.endsWith(".md"));
|
|
560
|
+
let removed = 0;
|
|
561
|
+
for (const file of existingRules) {
|
|
562
|
+
if (!templateNames.has(file)) {
|
|
563
|
+
unlinkSync(PATH2.resolve(rulesDir, file));
|
|
564
|
+
removed++;
|
|
565
|
+
}
|
|
566
|
+
}
|
|
567
|
+
return removed;
|
|
568
|
+
};
|
|
569
|
+
var logRulesResult = (created, updated, removed) => {
|
|
570
|
+
if (created || updated || removed) {
|
|
571
|
+
const parts = [
|
|
572
|
+
created ? `${created} created` : "",
|
|
573
|
+
updated ? `${updated} updated` : "",
|
|
574
|
+
removed ? `${removed} removed` : ""
|
|
575
|
+
].filter(Boolean);
|
|
576
|
+
console.log(chalk10.green(`.claude/rules/${XYLABS_RULES_PREFIX}*.md: ${parts.join(", ")}`));
|
|
577
|
+
} else {
|
|
578
|
+
console.log(chalk10.gray(`.claude/rules/${XYLABS_RULES_PREFIX}*.md: already up to date`));
|
|
579
|
+
}
|
|
580
|
+
};
|
|
581
|
+
var ensureProjectClaudeMd = (cwd5, force) => {
|
|
582
|
+
const projectPath = PATH2.resolve(cwd5, "CLAUDE.md");
|
|
583
|
+
if (!existsSync5(projectPath) || force) {
|
|
584
|
+
if (force && existsSync5(projectPath)) {
|
|
585
|
+
console.log(chalk10.yellow("Overwriting existing CLAUDE.md"));
|
|
586
|
+
}
|
|
587
|
+
writeFileSync2(projectPath, claudeMdProjectTemplate(), "utf8");
|
|
588
|
+
console.log(chalk10.green("Generated CLAUDE.md"));
|
|
589
|
+
} else {
|
|
590
|
+
console.log(chalk10.gray("CLAUDE.md already exists (skipped)"));
|
|
591
|
+
}
|
|
592
|
+
};
|
|
593
|
+
var claudeRules = ({ force } = {}) => {
|
|
594
|
+
const cwd5 = INIT_CWD() ?? process.cwd();
|
|
595
|
+
const rulesDir = PATH2.resolve(cwd5, ".claude", "rules");
|
|
596
|
+
mkdirSync(rulesDir, { recursive: true });
|
|
597
|
+
const {
|
|
598
|
+
created,
|
|
599
|
+
templateNames,
|
|
600
|
+
updated
|
|
601
|
+
} = syncRuleFiles(rulesDir);
|
|
602
|
+
const removed = removeStaleRules(rulesDir, templateNames);
|
|
603
|
+
logRulesResult(created, updated, removed);
|
|
604
|
+
ensureProjectClaudeMd(cwd5, force);
|
|
605
|
+
return 0;
|
|
606
|
+
};
|
|
607
|
+
|
|
506
608
|
// src/actions/clean.ts
|
|
507
609
|
var clean = async ({ verbose, pkg }) => {
|
|
508
610
|
return pkg ? await cleanPackage({ pkg, verbose }) : cleanAll({ verbose });
|
|
@@ -517,16 +619,16 @@ var cleanAll = ({ verbose }) => {
|
|
|
517
619
|
|
|
518
620
|
// src/actions/clean-docs.ts
|
|
519
621
|
import path from "path";
|
|
520
|
-
import
|
|
622
|
+
import chalk11 from "chalk";
|
|
521
623
|
var cleanDocs = () => {
|
|
522
624
|
const pkgName = process.env.npm_package_name;
|
|
523
|
-
console.log(
|
|
625
|
+
console.log(chalk11.green(`Cleaning Docs [${pkgName}]`));
|
|
524
626
|
for (const { location } of yarnWorkspaces()) deleteGlob(path.join(location, "docs"));
|
|
525
627
|
return 0;
|
|
526
628
|
};
|
|
527
629
|
|
|
528
630
|
// src/actions/compile.ts
|
|
529
|
-
import
|
|
631
|
+
import chalk12 from "chalk";
|
|
530
632
|
var compile = ({
|
|
531
633
|
verbose,
|
|
532
634
|
target,
|
|
@@ -567,7 +669,7 @@ var compileAll = ({
|
|
|
567
669
|
const incrementalOptions = incremental ? ["--since", "-Ap", "--topological-dev"] : ["--parallel", "-Ap", "--topological-dev"];
|
|
568
670
|
const jobsOptions = jobs ? ["-j", `${jobs}`] : [];
|
|
569
671
|
if (jobs) {
|
|
570
|
-
console.log(
|
|
672
|
+
console.log(chalk12.blue(`Jobs set to [${jobs}]`));
|
|
571
673
|
}
|
|
572
674
|
const result = runSteps(`Compile${incremental ? "-Incremental" : ""} [All]`, [
|
|
573
675
|
["yarn", [
|
|
@@ -581,13 +683,13 @@ var compileAll = ({
|
|
|
581
683
|
...targetOptions
|
|
582
684
|
]]
|
|
583
685
|
]);
|
|
584
|
-
console.log(`${
|
|
686
|
+
console.log(`${chalk12.gray("Compiled in")} [${chalk12.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk12.gray("seconds")}`);
|
|
585
687
|
return result;
|
|
586
688
|
};
|
|
587
689
|
|
|
588
690
|
// src/actions/copy-assets.ts
|
|
589
691
|
import path2 from "path/posix";
|
|
590
|
-
import
|
|
692
|
+
import chalk13 from "chalk";
|
|
591
693
|
import cpy from "cpy";
|
|
592
694
|
var copyPackageTargetAssets = async (target, name, location) => {
|
|
593
695
|
try {
|
|
@@ -610,7 +712,7 @@ var copyPackageTargetAssets = async (target, name, location) => {
|
|
|
610
712
|
};
|
|
611
713
|
var copyTargetAssets = async (target, pkg) => {
|
|
612
714
|
const workspaces = yarnWorkspaces();
|
|
613
|
-
console.log(
|
|
715
|
+
console.log(chalk13.green(`Copying Assets [${target.toUpperCase()}]`));
|
|
614
716
|
const workspaceList = workspaces.filter(({ name }) => {
|
|
615
717
|
return pkg === void 0 || name === pkg;
|
|
616
718
|
});
|
|
@@ -694,7 +796,7 @@ var dead = () => {
|
|
|
694
796
|
};
|
|
695
797
|
|
|
696
798
|
// src/actions/deplint/deplint.ts
|
|
697
|
-
import
|
|
799
|
+
import chalk19 from "chalk";
|
|
698
800
|
|
|
699
801
|
// src/actions/deplint/findFiles.ts
|
|
700
802
|
import fs2 from "fs";
|
|
@@ -841,8 +943,9 @@ function getImportsFromFile(filePath, importPaths, typeImportPaths) {
|
|
|
841
943
|
}
|
|
842
944
|
visit(sourceFile);
|
|
843
945
|
const importsStartsWithExcludes = [".", "#", "node:"];
|
|
844
|
-
const
|
|
845
|
-
const
|
|
946
|
+
const isValidImport = (imp) => !importsStartsWithExcludes.some((exc) => imp.startsWith(exc)) && !imp.includes("*") && !imp.includes("!");
|
|
947
|
+
const cleanedImports = imports.filter(isValidImport).map(getBasePackageName);
|
|
948
|
+
const cleanedTypeImports = typeImports.filter(isValidImport).map(getBasePackageName);
|
|
846
949
|
for (const imp of cleanedImports) {
|
|
847
950
|
importPaths[imp] = importPaths[imp] ?? [];
|
|
848
951
|
importPaths[imp].push(filePath);
|
|
@@ -894,12 +997,12 @@ function getExternalImportsFromFiles({
|
|
|
894
997
|
|
|
895
998
|
// src/actions/deplint/checkPackage/getUnlistedDependencies.ts
|
|
896
999
|
import { builtinModules } from "module";
|
|
897
|
-
import
|
|
1000
|
+
import chalk14 from "chalk";
|
|
898
1001
|
function isListedOrBuiltin(imp, name, dependencies, peerDependencies) {
|
|
899
1002
|
return dependencies.includes(imp) || imp === name || dependencies.includes(`@types/${imp}`) || peerDependencies.includes(imp) || peerDependencies.includes(`@types/${imp}`) || builtinModules.includes(imp) || builtinModules.includes(`@types/${imp}`);
|
|
900
1003
|
}
|
|
901
1004
|
function logMissing(name, imp, importPaths) {
|
|
902
|
-
console.log(`[${
|
|
1005
|
+
console.log(`[${chalk14.blue(name)}] Missing dependency in package.json: ${chalk14.red(imp)}`);
|
|
903
1006
|
if (importPaths[imp]) {
|
|
904
1007
|
console.log(` ${importPaths[imp].join("\n ")}`);
|
|
905
1008
|
}
|
|
@@ -924,7 +1027,7 @@ function getUnlistedDependencies({ name, location }, { dependencies, peerDepende
|
|
|
924
1027
|
}
|
|
925
1028
|
if (unlistedDependencies > 0) {
|
|
926
1029
|
const packageLocation = `${location}/package.json`;
|
|
927
|
-
console.log(` ${
|
|
1030
|
+
console.log(` ${chalk14.yellow(packageLocation)}
|
|
928
1031
|
`);
|
|
929
1032
|
}
|
|
930
1033
|
return unlistedDependencies;
|
|
@@ -932,7 +1035,7 @@ function getUnlistedDependencies({ name, location }, { dependencies, peerDepende
|
|
|
932
1035
|
|
|
933
1036
|
// src/actions/deplint/checkPackage/getUnlistedDevDependencies.ts
|
|
934
1037
|
import { builtinModules as builtinModules2 } from "module";
|
|
935
|
-
import
|
|
1038
|
+
import chalk15 from "chalk";
|
|
936
1039
|
function getUnlistedDevDependencies({ name, location }, {
|
|
937
1040
|
devDependencies,
|
|
938
1041
|
dependencies,
|
|
@@ -946,7 +1049,7 @@ function getUnlistedDevDependencies({ name, location }, {
|
|
|
946
1049
|
for (const imp of externalAllImports) {
|
|
947
1050
|
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)) {
|
|
948
1051
|
unlistedDevDependencies++;
|
|
949
|
-
console.log(`[${
|
|
1052
|
+
console.log(`[${chalk15.blue(name)}] Missing devDependency in package.json: ${chalk15.red(imp)}`);
|
|
950
1053
|
if (allImportPaths[imp]) {
|
|
951
1054
|
console.log(` ${allImportPaths[imp].join("\n ")}`);
|
|
952
1055
|
}
|
|
@@ -954,14 +1057,14 @@ function getUnlistedDevDependencies({ name, location }, {
|
|
|
954
1057
|
}
|
|
955
1058
|
if (unlistedDevDependencies > 0) {
|
|
956
1059
|
const packageLocation = `${location}/package.json`;
|
|
957
|
-
console.log(` ${
|
|
1060
|
+
console.log(` ${chalk15.yellow(packageLocation)}
|
|
958
1061
|
`);
|
|
959
1062
|
}
|
|
960
1063
|
return unlistedDevDependencies;
|
|
961
1064
|
}
|
|
962
1065
|
|
|
963
1066
|
// src/actions/deplint/checkPackage/getUnusedDependencies.ts
|
|
964
|
-
import
|
|
1067
|
+
import chalk16 from "chalk";
|
|
965
1068
|
function getUnusedDependencies({ name, location }, { dependencies }, {
|
|
966
1069
|
externalDistImports,
|
|
967
1070
|
externalDistTypeImports,
|
|
@@ -972,22 +1075,22 @@ function getUnusedDependencies({ name, location }, { dependencies }, {
|
|
|
972
1075
|
if (!externalDistImports.includes(dep) && !externalDistImports.includes(dep.replace(/^@types\//, "")) && !externalDistTypeImports.includes(dep) && !externalDistTypeImports.includes(dep.replace(/^@types\//, ""))) {
|
|
973
1076
|
unusedDependencies++;
|
|
974
1077
|
if (externalAllImports.includes(dep)) {
|
|
975
|
-
console.log(`[${
|
|
1078
|
+
console.log(`[${chalk16.blue(name)}] dependency should be devDependency in package.json: ${chalk16.red(dep)}`);
|
|
976
1079
|
} else {
|
|
977
|
-
console.log(`[${
|
|
1080
|
+
console.log(`[${chalk16.blue(name)}] Unused dependency in package.json: ${chalk16.red(dep)}`);
|
|
978
1081
|
}
|
|
979
1082
|
}
|
|
980
1083
|
}
|
|
981
1084
|
if (unusedDependencies > 0) {
|
|
982
1085
|
const packageLocation = `${location}/package.json`;
|
|
983
|
-
console.log(` ${
|
|
1086
|
+
console.log(` ${chalk16.yellow(packageLocation)}
|
|
984
1087
|
`);
|
|
985
1088
|
}
|
|
986
1089
|
return unusedDependencies;
|
|
987
1090
|
}
|
|
988
1091
|
|
|
989
1092
|
// src/actions/deplint/checkPackage/getUnusedDevDependencies.ts
|
|
990
|
-
import
|
|
1093
|
+
import chalk17 from "chalk";
|
|
991
1094
|
|
|
992
1095
|
// src/actions/deplint/getRequiredPeerDependencies.ts
|
|
993
1096
|
import fs6 from "fs";
|
|
@@ -1170,34 +1273,34 @@ function getUnusedDevDependencies({ name, location }, {
|
|
|
1170
1273
|
if (dependencies.includes(dep) || peerDependencies.includes(dep)) continue;
|
|
1171
1274
|
if (!isDevDepUsed(dep, allImports, implicitDeps, requiredPeers, scriptRefs)) {
|
|
1172
1275
|
unusedDevDependencies++;
|
|
1173
|
-
console.log(`[${
|
|
1276
|
+
console.log(`[${chalk17.blue(name)}] Unused devDependency in package.json: ${chalk17.red(dep)}`);
|
|
1174
1277
|
}
|
|
1175
1278
|
}
|
|
1176
1279
|
if (unusedDevDependencies > 0) {
|
|
1177
1280
|
const packageLocation = `${location}/package.json`;
|
|
1178
|
-
console.log(` ${
|
|
1281
|
+
console.log(` ${chalk17.yellow(packageLocation)}
|
|
1179
1282
|
`);
|
|
1180
1283
|
}
|
|
1181
1284
|
return unusedDevDependencies;
|
|
1182
1285
|
}
|
|
1183
1286
|
|
|
1184
1287
|
// src/actions/deplint/checkPackage/getUnusedPeerDependencies.ts
|
|
1185
|
-
import
|
|
1288
|
+
import chalk18 from "chalk";
|
|
1186
1289
|
function getUnusedPeerDependencies({ name, location }, { peerDependencies, dependencies }, { externalDistImports, externalDistTypeImports }) {
|
|
1187
1290
|
let unusedDependencies = 0;
|
|
1188
1291
|
for (const dep of peerDependencies) {
|
|
1189
1292
|
if (!externalDistImports.includes(dep) && !externalDistImports.includes(dep.replace(/^@types\//, "")) && !externalDistTypeImports.includes(dep) && !externalDistTypeImports.includes(dep.replace(/^@types\//, ""))) {
|
|
1190
1293
|
unusedDependencies++;
|
|
1191
1294
|
if (dependencies.includes(dep)) {
|
|
1192
|
-
console.log(`[${
|
|
1295
|
+
console.log(`[${chalk18.blue(name)}] Unused peerDependency [already a dependency] in package.json: ${chalk18.red(dep)}`);
|
|
1193
1296
|
} else {
|
|
1194
|
-
console.log(`[${
|
|
1297
|
+
console.log(`[${chalk18.blue(name)}] Unused peerDependency in package.json: ${chalk18.red(dep)}`);
|
|
1195
1298
|
}
|
|
1196
1299
|
}
|
|
1197
1300
|
}
|
|
1198
1301
|
if (unusedDependencies > 0) {
|
|
1199
1302
|
const packageLocation = `${location}/package.json`;
|
|
1200
|
-
console.log(` ${
|
|
1303
|
+
console.log(` ${chalk18.yellow(packageLocation)}
|
|
1201
1304
|
`);
|
|
1202
1305
|
}
|
|
1203
1306
|
return unusedDependencies;
|
|
@@ -1283,19 +1386,19 @@ var deplint = ({
|
|
|
1283
1386
|
});
|
|
1284
1387
|
}
|
|
1285
1388
|
if (totalErrors > 0) {
|
|
1286
|
-
console.warn(`Deplint: Found ${
|
|
1389
|
+
console.warn(`Deplint: Found ${chalk19.red(totalErrors)} dependency problems. ${chalk19.red("\u2716")}`);
|
|
1287
1390
|
} else {
|
|
1288
|
-
console.info(`Deplint: Found no dependency problems. ${
|
|
1391
|
+
console.info(`Deplint: Found no dependency problems. ${chalk19.green("\u2714")}`);
|
|
1289
1392
|
}
|
|
1290
1393
|
return 0;
|
|
1291
1394
|
};
|
|
1292
1395
|
|
|
1293
1396
|
// src/actions/deploy.ts
|
|
1294
|
-
import { readFileSync as
|
|
1397
|
+
import { readFileSync as readFileSync7 } from "fs";
|
|
1295
1398
|
var privatePackageExcludeList = () => {
|
|
1296
1399
|
const possibleDeployablePackages = yarnWorkspaces().map((workspace) => [
|
|
1297
1400
|
workspace,
|
|
1298
|
-
JSON.parse(
|
|
1401
|
+
JSON.parse(readFileSync7(`${workspace.location}/package.json`, { encoding: "utf8" }))
|
|
1299
1402
|
]);
|
|
1300
1403
|
const privatePackages = possibleDeployablePackages.filter(([_, pkg]) => pkg.private).map(([workspace]) => workspace);
|
|
1301
1404
|
const excludeList = privatePackages.map((workspace) => `--exclude ${workspace.name}`);
|
|
@@ -1315,11 +1418,11 @@ var deploy = () => {
|
|
|
1315
1418
|
};
|
|
1316
1419
|
|
|
1317
1420
|
// src/actions/deploy-major.ts
|
|
1318
|
-
import { readFileSync as
|
|
1421
|
+
import { readFileSync as readFileSync8 } from "fs";
|
|
1319
1422
|
var privatePackageExcludeList2 = () => {
|
|
1320
1423
|
const possibleDeployablePackages = yarnWorkspaces().map((workspace) => [
|
|
1321
1424
|
workspace,
|
|
1322
|
-
JSON.parse(
|
|
1425
|
+
JSON.parse(readFileSync8(`${workspace.location}/package.json`, { encoding: "utf8" }))
|
|
1323
1426
|
]);
|
|
1324
1427
|
const privatePackages = possibleDeployablePackages.filter(([_, pkg]) => pkg.private).map(([workspace]) => workspace);
|
|
1325
1428
|
const excludeList = privatePackages.map((workspace) => `--exclude ${workspace.name}`);
|
|
@@ -1339,11 +1442,11 @@ var deployMajor = () => {
|
|
|
1339
1442
|
};
|
|
1340
1443
|
|
|
1341
1444
|
// src/actions/deploy-minor.ts
|
|
1342
|
-
import { readFileSync as
|
|
1445
|
+
import { readFileSync as readFileSync9 } from "fs";
|
|
1343
1446
|
var privatePackageExcludeList3 = () => {
|
|
1344
1447
|
const possibleDeployablePackages = yarnWorkspaces().map((workspace) => [
|
|
1345
1448
|
workspace,
|
|
1346
|
-
JSON.parse(
|
|
1449
|
+
JSON.parse(readFileSync9(`${workspace.location}/package.json`, { encoding: "utf8" }))
|
|
1347
1450
|
]);
|
|
1348
1451
|
const privatePackages = possibleDeployablePackages.filter(([_, pkg]) => pkg.private).map(([workspace]) => workspace);
|
|
1349
1452
|
const excludeList = privatePackages.map((workspace) => `--exclude ${workspace.name}`);
|
|
@@ -1363,11 +1466,11 @@ var deployMinor = () => {
|
|
|
1363
1466
|
};
|
|
1364
1467
|
|
|
1365
1468
|
// src/actions/deploy-next.ts
|
|
1366
|
-
import { readFileSync as
|
|
1469
|
+
import { readFileSync as readFileSync10 } from "fs";
|
|
1367
1470
|
var privatePackageExcludeList4 = () => {
|
|
1368
1471
|
const possibleDeployablePackages = yarnWorkspaces().map((workspace) => [
|
|
1369
1472
|
workspace,
|
|
1370
|
-
JSON.parse(
|
|
1473
|
+
JSON.parse(readFileSync10(`${workspace.location}/package.json`, { encoding: "utf8" }))
|
|
1371
1474
|
]);
|
|
1372
1475
|
const privatePackages = possibleDeployablePackages.filter(([_, pkg]) => pkg.private).map(([workspace]) => workspace);
|
|
1373
1476
|
const excludeList = privatePackages.map((workspace) => `--exclude ${workspace.name}`);
|
|
@@ -1387,22 +1490,22 @@ var deployNext = () => {
|
|
|
1387
1490
|
};
|
|
1388
1491
|
|
|
1389
1492
|
// src/actions/dupdeps.ts
|
|
1390
|
-
import
|
|
1493
|
+
import chalk20 from "chalk";
|
|
1391
1494
|
var dupdeps = () => {
|
|
1392
|
-
console.log(
|
|
1495
|
+
console.log(chalk20.green("Checking all Dependencies for Duplicates"));
|
|
1393
1496
|
const allDependencies = parsedPackageJSON()?.dependencies;
|
|
1394
1497
|
const dependencies = Object.entries(allDependencies).map(([k]) => k);
|
|
1395
1498
|
return detectDuplicateDependencies(dependencies);
|
|
1396
1499
|
};
|
|
1397
1500
|
|
|
1398
1501
|
// src/actions/lint.ts
|
|
1399
|
-
import
|
|
1502
|
+
import chalk21 from "chalk";
|
|
1400
1503
|
var lintPackage = ({
|
|
1401
1504
|
pkg,
|
|
1402
1505
|
fix: fix2,
|
|
1403
1506
|
verbose
|
|
1404
1507
|
}) => {
|
|
1405
|
-
console.log(
|
|
1508
|
+
console.log(chalk21.gray(`${fix2 ? "Fix" : "Lint"} [${pkg}]`));
|
|
1406
1509
|
const start = Date.now();
|
|
1407
1510
|
const result = runSteps(`${fix2 ? "Fix" : "Lint"} [${pkg}]`, [
|
|
1408
1511
|
["yarn", [
|
|
@@ -1412,7 +1515,7 @@ var lintPackage = ({
|
|
|
1412
1515
|
fix2 ? "package-fix" : verbose ? "package-lint-verbose" : "package-lint"
|
|
1413
1516
|
]]
|
|
1414
1517
|
]);
|
|
1415
|
-
console.log(
|
|
1518
|
+
console.log(chalk21.gray(`${fix2 ? "Fixed in" : "Linted in"} [${chalk21.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk21.gray("seconds")}`));
|
|
1416
1519
|
return result;
|
|
1417
1520
|
};
|
|
1418
1521
|
var lint = ({
|
|
@@ -1432,13 +1535,13 @@ var lint = ({
|
|
|
1432
1535
|
});
|
|
1433
1536
|
};
|
|
1434
1537
|
var lintAllPackages = ({ fix: fix2 = false } = {}) => {
|
|
1435
|
-
console.log(
|
|
1538
|
+
console.log(chalk21.gray(`${fix2 ? "Fix" : "Lint"} [All-Packages]`));
|
|
1436
1539
|
const start = Date.now();
|
|
1437
1540
|
const fixOptions = fix2 ? ["--fix"] : [];
|
|
1438
1541
|
const result = runSteps(`${fix2 ? "Fix" : "Lint"} [All-Packages]`, [
|
|
1439
1542
|
["yarn", ["eslint", "--cache", "--cache-location", ".eslintcache", "--cache-strategy", "content", ...fixOptions]]
|
|
1440
1543
|
]);
|
|
1441
|
-
console.log(
|
|
1544
|
+
console.log(chalk21.gray(`${fix2 ? "Fixed in" : "Linted in"} [${chalk21.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk21.gray("seconds")}`));
|
|
1442
1545
|
return result;
|
|
1443
1546
|
};
|
|
1444
1547
|
|
|
@@ -1466,7 +1569,7 @@ var filename = ".gitignore";
|
|
|
1466
1569
|
var gitignoreGen = (pkg) => generateIgnoreFiles(filename, pkg);
|
|
1467
1570
|
|
|
1468
1571
|
// src/actions/gitlint.ts
|
|
1469
|
-
import
|
|
1572
|
+
import chalk22 from "chalk";
|
|
1470
1573
|
import ParseGitConfig from "parse-git-config";
|
|
1471
1574
|
var gitlint = () => {
|
|
1472
1575
|
console.log(`
|
|
@@ -1477,7 +1580,7 @@ Gitlint Start [${process.cwd()}]
|
|
|
1477
1580
|
const errors = 0;
|
|
1478
1581
|
const gitConfig = ParseGitConfig.sync();
|
|
1479
1582
|
const warn = (message) => {
|
|
1480
|
-
console.warn(
|
|
1583
|
+
console.warn(chalk22.yellow(`Warning: ${message}`));
|
|
1481
1584
|
warnings++;
|
|
1482
1585
|
};
|
|
1483
1586
|
if (gitConfig.core.ignorecase) {
|
|
@@ -1497,13 +1600,13 @@ Gitlint Start [${process.cwd()}]
|
|
|
1497
1600
|
}
|
|
1498
1601
|
const resultMessages = [];
|
|
1499
1602
|
if (valid > 0) {
|
|
1500
|
-
resultMessages.push(
|
|
1603
|
+
resultMessages.push(chalk22.green(`Passed: ${valid}`));
|
|
1501
1604
|
}
|
|
1502
1605
|
if (warnings > 0) {
|
|
1503
|
-
resultMessages.push(
|
|
1606
|
+
resultMessages.push(chalk22.yellow(`Warnings: ${warnings}`));
|
|
1504
1607
|
}
|
|
1505
1608
|
if (errors > 0) {
|
|
1506
|
-
resultMessages.push(
|
|
1609
|
+
resultMessages.push(chalk22.red(` Errors: ${errors}`));
|
|
1507
1610
|
}
|
|
1508
1611
|
console.warn(`Gitlint Finish [ ${resultMessages.join(" | ")} ]
|
|
1509
1612
|
`);
|
|
@@ -1512,7 +1615,7 @@ Gitlint Start [${process.cwd()}]
|
|
|
1512
1615
|
|
|
1513
1616
|
// src/actions/gitlint-fix.ts
|
|
1514
1617
|
import { execSync as execSync2 } from "child_process";
|
|
1515
|
-
import
|
|
1618
|
+
import chalk23 from "chalk";
|
|
1516
1619
|
import ParseGitConfig2 from "parse-git-config";
|
|
1517
1620
|
var gitlintFix = () => {
|
|
1518
1621
|
console.log(`
|
|
@@ -1521,15 +1624,15 @@ Gitlint Fix Start [${process.cwd()}]
|
|
|
1521
1624
|
const gitConfig = ParseGitConfig2.sync();
|
|
1522
1625
|
if (gitConfig.core.ignorecase) {
|
|
1523
1626
|
execSync2("git config core.ignorecase false", { stdio: "inherit" });
|
|
1524
|
-
console.warn(
|
|
1627
|
+
console.warn(chalk23.yellow("\nGitlint Fix: Updated core.ignorecase to be false\n"));
|
|
1525
1628
|
}
|
|
1526
1629
|
if (gitConfig.core.autocrlf !== false) {
|
|
1527
1630
|
execSync2("git config core.autocrlf false", { stdio: "inherit" });
|
|
1528
|
-
console.warn(
|
|
1631
|
+
console.warn(chalk23.yellow("\nGitlint Fix: Updated core.autocrlf to be false\n"));
|
|
1529
1632
|
}
|
|
1530
1633
|
if (gitConfig.core.eol !== "lf") {
|
|
1531
1634
|
execSync2("git config core.eol lf", { stdio: "inherit" });
|
|
1532
|
-
console.warn(
|
|
1635
|
+
console.warn(chalk23.yellow('\nGitlint Fix: Updated core.eol to be "lf"\n'));
|
|
1533
1636
|
}
|
|
1534
1637
|
return 1;
|
|
1535
1638
|
};
|
|
@@ -1540,7 +1643,7 @@ var knip = () => {
|
|
|
1540
1643
|
};
|
|
1541
1644
|
|
|
1542
1645
|
// src/actions/license.ts
|
|
1543
|
-
import
|
|
1646
|
+
import chalk24 from "chalk";
|
|
1544
1647
|
import { init } from "license-checker";
|
|
1545
1648
|
var license = async (pkg) => {
|
|
1546
1649
|
const workspaces = yarnWorkspaces();
|
|
@@ -1565,18 +1668,18 @@ var license = async (pkg) => {
|
|
|
1565
1668
|
"LGPL-3.0-or-later",
|
|
1566
1669
|
"Python-2.0"
|
|
1567
1670
|
]);
|
|
1568
|
-
console.log(
|
|
1671
|
+
console.log(chalk24.green("License Checker"));
|
|
1569
1672
|
return (await Promise.all(
|
|
1570
1673
|
workspaceList.map(({ location, name }) => {
|
|
1571
1674
|
return new Promise((resolve) => {
|
|
1572
1675
|
init({ production: true, start: location }, (error, packages) => {
|
|
1573
1676
|
if (error) {
|
|
1574
|
-
console.error(
|
|
1575
|
-
console.error(
|
|
1677
|
+
console.error(chalk24.red(`License Checker [${name}] Error`));
|
|
1678
|
+
console.error(chalk24.gray(error));
|
|
1576
1679
|
console.log("\n");
|
|
1577
1680
|
resolve(1);
|
|
1578
1681
|
} else {
|
|
1579
|
-
console.log(
|
|
1682
|
+
console.log(chalk24.green(`License Checker [${name}]`));
|
|
1580
1683
|
let count = 0;
|
|
1581
1684
|
for (const [name2, info] of Object.entries(packages)) {
|
|
1582
1685
|
const licenses = Array.isArray(info.licenses) ? info.licenses : [info.licenses];
|
|
@@ -1592,7 +1695,7 @@ var license = async (pkg) => {
|
|
|
1592
1695
|
}
|
|
1593
1696
|
if (!orLicenseFound) {
|
|
1594
1697
|
count++;
|
|
1595
|
-
console.warn(
|
|
1698
|
+
console.warn(chalk24.yellow(`${name2}: Package License not allowed [${license2}]`));
|
|
1596
1699
|
}
|
|
1597
1700
|
}
|
|
1598
1701
|
}
|
|
@@ -1612,12 +1715,12 @@ var npmignoreGen = (pkg) => generateIgnoreFiles(filename2, pkg);
|
|
|
1612
1715
|
|
|
1613
1716
|
// src/actions/package/clean-outputs.ts
|
|
1614
1717
|
import path7 from "path";
|
|
1615
|
-
import
|
|
1718
|
+
import chalk25 from "chalk";
|
|
1616
1719
|
var packageCleanOutputs = () => {
|
|
1617
1720
|
const pkg = process.env.INIT_CWD ?? ".";
|
|
1618
1721
|
const pkgName = process.env.npm_package_name;
|
|
1619
1722
|
const folders = [path7.join(pkg, "dist"), path7.join(pkg, "build"), path7.join(pkg, "docs")];
|
|
1620
|
-
console.log(
|
|
1723
|
+
console.log(chalk25.green(`Cleaning Outputs [${pkgName}]`));
|
|
1621
1724
|
for (let folder of folders) {
|
|
1622
1725
|
deleteGlob(folder);
|
|
1623
1726
|
}
|
|
@@ -1626,11 +1729,11 @@ var packageCleanOutputs = () => {
|
|
|
1626
1729
|
|
|
1627
1730
|
// src/actions/package/clean-typescript.ts
|
|
1628
1731
|
import path8 from "path";
|
|
1629
|
-
import
|
|
1732
|
+
import chalk26 from "chalk";
|
|
1630
1733
|
var packageCleanTypescript = () => {
|
|
1631
1734
|
const pkg = process.env.INIT_CWD ?? ".";
|
|
1632
1735
|
const pkgName = process.env.npm_package_name;
|
|
1633
|
-
console.log(
|
|
1736
|
+
console.log(chalk26.green(`Cleaning Typescript [${pkgName}]`));
|
|
1634
1737
|
const files = [path8.join(pkg, "*.tsbuildinfo"), path8.join(pkg, ".tsconfig.*"), path8.join(pkg, ".eslintcache")];
|
|
1635
1738
|
for (let file of files) {
|
|
1636
1739
|
deleteGlob(file);
|
|
@@ -1644,26 +1747,26 @@ var packageClean = async () => {
|
|
|
1644
1747
|
};
|
|
1645
1748
|
|
|
1646
1749
|
// src/actions/package/compile/compile.ts
|
|
1647
|
-
import
|
|
1750
|
+
import chalk31 from "chalk";
|
|
1648
1751
|
|
|
1649
1752
|
// src/actions/package/compile/packageCompileTsup.ts
|
|
1650
|
-
import
|
|
1753
|
+
import chalk30 from "chalk";
|
|
1651
1754
|
import { build as build2, defineConfig } from "tsup";
|
|
1652
1755
|
|
|
1653
1756
|
// src/actions/package/compile/inputs.ts
|
|
1654
|
-
import
|
|
1757
|
+
import chalk27 from "chalk";
|
|
1655
1758
|
import { glob as glob2 } from "glob";
|
|
1656
1759
|
var getAllInputs = (srcDir, verbose = false) => {
|
|
1657
1760
|
return [...glob2.sync(`${srcDir}/**/*.ts`, { posix: true }).map((file) => {
|
|
1658
1761
|
const result = file.slice(Math.max(0, srcDir.length + 1));
|
|
1659
1762
|
if (verbose) {
|
|
1660
|
-
console.log(
|
|
1763
|
+
console.log(chalk27.gray(`getAllInputs: ${JSON.stringify(result, null, 2)}`));
|
|
1661
1764
|
}
|
|
1662
1765
|
return result;
|
|
1663
1766
|
}), ...glob2.sync(`${srcDir}/**/*.tsx`, { posix: true }).map((file) => {
|
|
1664
1767
|
const result = file.slice(Math.max(0, srcDir.length + 1));
|
|
1665
1768
|
if (verbose) {
|
|
1666
|
-
console.log(
|
|
1769
|
+
console.log(chalk27.gray(`getAllInputs: ${JSON.stringify(result, null, 2)}`));
|
|
1667
1770
|
}
|
|
1668
1771
|
return result;
|
|
1669
1772
|
})];
|
|
@@ -1722,7 +1825,7 @@ function deepMergeObjects(objects) {
|
|
|
1722
1825
|
|
|
1723
1826
|
// src/actions/package/compile/packageCompileTsc.ts
|
|
1724
1827
|
import { cwd as cwd2 } from "process";
|
|
1725
|
-
import
|
|
1828
|
+
import chalk28 from "chalk";
|
|
1726
1829
|
import { createProgramFromConfig } from "tsc-prog";
|
|
1727
1830
|
import ts2, {
|
|
1728
1831
|
DiagnosticCategory,
|
|
@@ -1744,7 +1847,7 @@ var getCompilerOptions = (options = {}, fileName = "tsconfig.json") => {
|
|
|
1744
1847
|
var packageCompileTsc = (platform, entries, srcDir = "src", outDir = "dist", compilerOptionsParam, verbose = false) => {
|
|
1745
1848
|
const pkg = process.env.INIT_CWD ?? cwd2();
|
|
1746
1849
|
if (verbose) {
|
|
1747
|
-
console.log(
|
|
1850
|
+
console.log(chalk28.cyan(`Validating code START: ${entries.length} files to ${outDir} from ${srcDir}`));
|
|
1748
1851
|
}
|
|
1749
1852
|
const configFilePath = ts2.findConfigFile(
|
|
1750
1853
|
"./",
|
|
@@ -1767,10 +1870,10 @@ var packageCompileTsc = (platform, entries, srcDir = "src", outDir = "dist", com
|
|
|
1767
1870
|
emitDeclarationOnly: true,
|
|
1768
1871
|
noEmit: false
|
|
1769
1872
|
};
|
|
1770
|
-
console.log(
|
|
1873
|
+
console.log(chalk28.cyan(`Validating Files: ${entries.length}`));
|
|
1771
1874
|
if (verbose) {
|
|
1772
1875
|
for (const entry of entries) {
|
|
1773
|
-
console.log(
|
|
1876
|
+
console.log(chalk28.grey(`Validating: ${entry}`));
|
|
1774
1877
|
}
|
|
1775
1878
|
}
|
|
1776
1879
|
try {
|
|
@@ -1800,7 +1903,7 @@ var packageCompileTsc = (platform, entries, srcDir = "src", outDir = "dist", com
|
|
|
1800
1903
|
return 0;
|
|
1801
1904
|
} finally {
|
|
1802
1905
|
if (verbose) {
|
|
1803
|
-
console.log(
|
|
1906
|
+
console.log(chalk28.cyan(`Validating code FINISH: ${entries.length} files to ${outDir} from ${srcDir}`));
|
|
1804
1907
|
}
|
|
1805
1908
|
}
|
|
1806
1909
|
};
|
|
@@ -1808,7 +1911,7 @@ var packageCompileTsc = (platform, entries, srcDir = "src", outDir = "dist", com
|
|
|
1808
1911
|
// src/actions/package/compile/packageCompileTscTypes.ts
|
|
1809
1912
|
import path9 from "path";
|
|
1810
1913
|
import { cwd as cwd3 } from "process";
|
|
1811
|
-
import
|
|
1914
|
+
import chalk29 from "chalk";
|
|
1812
1915
|
import { rollup } from "rollup";
|
|
1813
1916
|
import dts from "rollup-plugin-dts";
|
|
1814
1917
|
import nodeExternals from "rollup-plugin-node-externals";
|
|
@@ -1833,8 +1936,8 @@ async function bundleDts(inputPath, outputPath, platform, options, verbose = fal
|
|
|
1833
1936
|
if (ignoredWarningCodes.has(warning.code ?? "")) {
|
|
1834
1937
|
return;
|
|
1835
1938
|
}
|
|
1836
|
-
console.warn(
|
|
1837
|
-
console.warn(
|
|
1939
|
+
console.warn(chalk29.yellow(`[${warning.code}] ${warning.message}`));
|
|
1940
|
+
console.warn(chalk29.gray(inputPath));
|
|
1838
1941
|
warn(warning);
|
|
1839
1942
|
}
|
|
1840
1943
|
});
|
|
@@ -1844,8 +1947,8 @@ async function bundleDts(inputPath, outputPath, platform, options, verbose = fal
|
|
|
1844
1947
|
});
|
|
1845
1948
|
} catch (ex) {
|
|
1846
1949
|
const error = ex;
|
|
1847
|
-
console.warn(
|
|
1848
|
-
console.warn(
|
|
1950
|
+
console.warn(chalk29.red(error));
|
|
1951
|
+
console.warn(chalk29.gray(inputPath));
|
|
1849
1952
|
}
|
|
1850
1953
|
if (verbose) {
|
|
1851
1954
|
console.log(`Bundled declarations written to ${outputPath}`);
|
|
@@ -1853,7 +1956,7 @@ async function bundleDts(inputPath, outputPath, platform, options, verbose = fal
|
|
|
1853
1956
|
}
|
|
1854
1957
|
var packageCompileTscTypes = async (entries, outDir, platform, srcDir = "build", verbose = false) => {
|
|
1855
1958
|
if (verbose) {
|
|
1856
|
-
console.log(
|
|
1959
|
+
console.log(chalk29.cyan(`Compiling Types START [${platform}]: ${entries.length} files to ${outDir} from ${srcDir}`));
|
|
1857
1960
|
console.log(`Entries: ${entries.join(", ")}`);
|
|
1858
1961
|
}
|
|
1859
1962
|
const pkg = process.env.INIT_CWD ?? cwd3();
|
|
@@ -1877,7 +1980,7 @@ var packageCompileTscTypes = async (entries, outDir, platform, srcDir = "build",
|
|
|
1877
1980
|
await bundleDts(`${srcRoot}/${entryTypeName}`, `${outDir}/${entryTypeName}`, platform, { compilerOptions }, verbose);
|
|
1878
1981
|
}));
|
|
1879
1982
|
if (verbose) {
|
|
1880
|
-
console.log(
|
|
1983
|
+
console.log(chalk29.cyan(`Compiling Types FINISH: ${entries.length} files to ${outDir} from ${srcDir}`));
|
|
1881
1984
|
}
|
|
1882
1985
|
return 0;
|
|
1883
1986
|
};
|
|
@@ -1889,15 +1992,15 @@ var compileFolder = async (srcDir, entries, buildDir, options, bundleTypes = fal
|
|
|
1889
1992
|
console.log(`compileFolder [${srcDir}, ${options?.outDir}]`);
|
|
1890
1993
|
}
|
|
1891
1994
|
if (entries.length === 0) {
|
|
1892
|
-
console.warn(
|
|
1995
|
+
console.warn(chalk30.yellow(`No entries found in ${srcDir} to compile`));
|
|
1893
1996
|
return 0;
|
|
1894
1997
|
}
|
|
1895
1998
|
if (verbose) {
|
|
1896
|
-
console.log(
|
|
1999
|
+
console.log(chalk30.gray(`buildDir [${buildDir}]`));
|
|
1897
2000
|
}
|
|
1898
2001
|
const validationResult = packageCompileTsc(options?.platform ?? "neutral", entries, srcDir, buildDir, void 0, verbose);
|
|
1899
2002
|
if (validationResult !== 0) {
|
|
1900
|
-
console.error(
|
|
2003
|
+
console.error(chalk30.red(`Compile:Validation had ${validationResult} errors`));
|
|
1901
2004
|
return validationResult;
|
|
1902
2005
|
}
|
|
1903
2006
|
const optionsParams = tsupOptions([{
|
|
@@ -1922,12 +2025,12 @@ var compileFolder = async (srcDir, entries, buildDir, options, bundleTypes = fal
|
|
|
1922
2025
|
})
|
|
1923
2026
|
)).flat();
|
|
1924
2027
|
if (verbose) {
|
|
1925
|
-
console.log(
|
|
1926
|
-
console.log(
|
|
2028
|
+
console.log(chalk30.cyan(`TSUP:build:start [${srcDir}]`));
|
|
2029
|
+
console.log(chalk30.gray(`TSUP:build:options [${JSON.stringify(optionsList, null, 2)}]`));
|
|
1927
2030
|
}
|
|
1928
2031
|
await Promise.all(optionsList.map((options2) => build2(options2)));
|
|
1929
2032
|
if (verbose) {
|
|
1930
|
-
console.log(
|
|
2033
|
+
console.log(chalk30.cyan(`TSUP:build:stop [${srcDir}]`));
|
|
1931
2034
|
}
|
|
1932
2035
|
if (bundleTypes) {
|
|
1933
2036
|
await packageCompileTscTypes(entries, outDir, options?.platform ?? "neutral", buildDir, verbose);
|
|
@@ -2038,14 +2141,14 @@ var packageCompileTsup = async (config2) => {
|
|
|
2038
2141
|
// src/actions/package/compile/compile.ts
|
|
2039
2142
|
var packageCompile = async (inConfig = {}) => {
|
|
2040
2143
|
const pkg = process.env.INIT_CWD;
|
|
2041
|
-
console.log(
|
|
2144
|
+
console.log(chalk31.green(`Compiling ${pkg}`));
|
|
2042
2145
|
const config2 = await loadConfig(inConfig);
|
|
2043
2146
|
return await packageCompileTsup(config2);
|
|
2044
2147
|
};
|
|
2045
2148
|
|
|
2046
2149
|
// src/actions/package/copy-assets.ts
|
|
2047
2150
|
import path10 from "path/posix";
|
|
2048
|
-
import
|
|
2151
|
+
import chalk32 from "chalk";
|
|
2049
2152
|
import cpy2 from "cpy";
|
|
2050
2153
|
var copyTargetAssets2 = async (target, name, location) => {
|
|
2051
2154
|
try {
|
|
@@ -2058,7 +2161,7 @@ var copyTargetAssets2 = async (target, name, location) => {
|
|
|
2058
2161
|
}
|
|
2059
2162
|
);
|
|
2060
2163
|
if (values.length > 0) {
|
|
2061
|
-
console.log(
|
|
2164
|
+
console.log(chalk32.green(`Copying Assets [${target.toUpperCase()}] - ${name} - ${location}`));
|
|
2062
2165
|
}
|
|
2063
2166
|
for (const value of values) {
|
|
2064
2167
|
console.log(`${value.split("/").pop()} => ./dist/${target}`);
|
|
@@ -2123,9 +2226,9 @@ var packageCycle = async () => {
|
|
|
2123
2226
|
};
|
|
2124
2227
|
|
|
2125
2228
|
// src/actions/package/gen-docs.ts
|
|
2126
|
-
import { existsSync as
|
|
2229
|
+
import { existsSync as existsSync6 } from "fs";
|
|
2127
2230
|
import path11 from "path";
|
|
2128
|
-
import
|
|
2231
|
+
import chalk33 from "chalk";
|
|
2129
2232
|
import {
|
|
2130
2233
|
Application,
|
|
2131
2234
|
ArgumentsReader,
|
|
@@ -2143,7 +2246,7 @@ var ExitCodes = {
|
|
|
2143
2246
|
};
|
|
2144
2247
|
var packageGenDocs = async () => {
|
|
2145
2248
|
const pkg = process.env.INIT_CWD;
|
|
2146
|
-
if (pkg !== void 0 && !
|
|
2249
|
+
if (pkg !== void 0 && !existsSync6(path11.join(pkg, "typedoc.json"))) {
|
|
2147
2250
|
return;
|
|
2148
2251
|
}
|
|
2149
2252
|
const app = await Application.bootstrap({
|
|
@@ -2229,16 +2332,16 @@ var runTypeDoc = async (app) => {
|
|
|
2229
2332
|
return ExitCodes.OutputError;
|
|
2230
2333
|
}
|
|
2231
2334
|
}
|
|
2232
|
-
console.log(
|
|
2335
|
+
console.log(chalk33.green(`${pkgName} - Ok`));
|
|
2233
2336
|
return ExitCodes.Ok;
|
|
2234
2337
|
};
|
|
2235
2338
|
|
|
2236
2339
|
// src/actions/package/lint.ts
|
|
2237
|
-
import { readdirSync } from "fs";
|
|
2340
|
+
import { readdirSync as readdirSync3 } from "fs";
|
|
2238
2341
|
import path12 from "path";
|
|
2239
2342
|
import { cwd as cwd4 } from "process";
|
|
2240
2343
|
import { pathToFileURL } from "url";
|
|
2241
|
-
import
|
|
2344
|
+
import chalk34 from "chalk";
|
|
2242
2345
|
import { ESLint } from "eslint";
|
|
2243
2346
|
import { findUp } from "find-up";
|
|
2244
2347
|
import picomatch from "picomatch";
|
|
@@ -2247,14 +2350,14 @@ var dumpMessages = (lintResults) => {
|
|
|
2247
2350
|
const severity = ["none", "warning", "error"];
|
|
2248
2351
|
for (const lintResult of lintResults) {
|
|
2249
2352
|
if (lintResult.messages.length > 0) {
|
|
2250
|
-
console.log(
|
|
2353
|
+
console.log(chalk34.gray(`
|
|
2251
2354
|
${lintResult.filePath}`));
|
|
2252
2355
|
for (const message of lintResult.messages) {
|
|
2253
2356
|
console.log(
|
|
2254
|
-
|
|
2255
|
-
|
|
2256
|
-
|
|
2257
|
-
|
|
2357
|
+
chalk34.gray(` ${message.line}:${message.column}`),
|
|
2358
|
+
chalk34[colors[message.severity]](` ${severity[message.severity]}`),
|
|
2359
|
+
chalk34.white(` ${message.message}`),
|
|
2360
|
+
chalk34.gray(` ${message.ruleId}`)
|
|
2258
2361
|
);
|
|
2259
2362
|
}
|
|
2260
2363
|
}
|
|
@@ -2271,7 +2374,7 @@ function getFiles(dir, ignoreFolders) {
|
|
|
2271
2374
|
const currentDirectory = cwd4();
|
|
2272
2375
|
const subDirectory = dir.split(currentDirectory)[1]?.split("/")[1];
|
|
2273
2376
|
if (ignoreFolders.includes(subDirectory)) return [];
|
|
2274
|
-
return
|
|
2377
|
+
return readdirSync3(dir, { withFileTypes: true }).flatMap((dirent) => {
|
|
2275
2378
|
const res = path12.resolve(dir, dirent.name);
|
|
2276
2379
|
const relativePath = subDirectory === void 0 ? dirent.name : `${subDirectory}/${dirent.name}`;
|
|
2277
2380
|
const ignoreMatchers = ignoreFolders.map((pattern) => picomatch(pattern));
|
|
@@ -2292,10 +2395,10 @@ var packageLint = async (fix2 = false, verbose = false, cache = true) => {
|
|
|
2292
2395
|
cache
|
|
2293
2396
|
});
|
|
2294
2397
|
const files = getFiles(cwd4(), ignoreFolders);
|
|
2295
|
-
console.log(
|
|
2398
|
+
console.log(chalk34.green(`Linting ${pkg} [files = ${files.length}]`));
|
|
2296
2399
|
if (verbose) {
|
|
2297
2400
|
for (const file of files) {
|
|
2298
|
-
console.log(
|
|
2401
|
+
console.log(chalk34.gray(` ${file}`));
|
|
2299
2402
|
}
|
|
2300
2403
|
}
|
|
2301
2404
|
const lintResults = await engine.lintFiles(files);
|
|
@@ -2306,32 +2409,32 @@ var packageLint = async (fix2 = false, verbose = false, cache = true) => {
|
|
|
2306
2409
|
const filesCountColor = files.length < 100 ? "green" : files.length < 1e3 ? "yellow" : "red";
|
|
2307
2410
|
const lintTime = Date.now() - start;
|
|
2308
2411
|
const lintTimeColor = lintTime < 1e3 ? "green" : lintTime < 3e3 ? "yellow" : "red";
|
|
2309
|
-
console.log(
|
|
2412
|
+
console.log(chalk34.white(`Linted ${chalk34[filesCountColor](files.length)} files in ${chalk34[lintTimeColor](lintTime)}ms`));
|
|
2310
2413
|
return lintResults.reduce((prev, lintResult) => prev + lintResult.errorCount, 0);
|
|
2311
2414
|
};
|
|
2312
2415
|
|
|
2313
2416
|
// src/actions/package/publint.ts
|
|
2314
2417
|
import { promises as fs9 } from "fs";
|
|
2315
|
-
import
|
|
2418
|
+
import chalk35 from "chalk";
|
|
2316
2419
|
import sortPackageJson from "sort-package-json";
|
|
2317
2420
|
var customPubLint = (pkg) => {
|
|
2318
2421
|
let errorCount = 0;
|
|
2319
2422
|
let warningCount = 0;
|
|
2320
2423
|
if (pkg.files === void 0) {
|
|
2321
|
-
console.warn(
|
|
2424
|
+
console.warn(chalk35.yellow('Publint [custom]: "files" field is missing'));
|
|
2322
2425
|
warningCount++;
|
|
2323
2426
|
}
|
|
2324
2427
|
if (pkg.main !== void 0) {
|
|
2325
|
-
console.warn(
|
|
2428
|
+
console.warn(chalk35.yellow('Publint [custom]: "main" field is deprecated, use "exports" instead'));
|
|
2326
2429
|
warningCount++;
|
|
2327
2430
|
}
|
|
2328
2431
|
if (pkg.sideEffects !== false) {
|
|
2329
|
-
console.warn(
|
|
2432
|
+
console.warn(chalk35.yellow('Publint [custom]: "sideEffects" field should be set to false'));
|
|
2330
2433
|
warningCount++;
|
|
2331
2434
|
}
|
|
2332
2435
|
if (pkg.resolutions !== void 0) {
|
|
2333
|
-
console.warn(
|
|
2334
|
-
console.warn(
|
|
2436
|
+
console.warn(chalk35.yellow('Publint [custom]: "resolutions" in use'));
|
|
2437
|
+
console.warn(chalk35.gray(JSON.stringify(pkg.resolutions, null, 2)));
|
|
2335
2438
|
warningCount++;
|
|
2336
2439
|
}
|
|
2337
2440
|
return [errorCount, warningCount];
|
|
@@ -2341,8 +2444,8 @@ var packagePublint = async ({ strict = true, verbose = false } = {}) => {
|
|
|
2341
2444
|
const sortedPkg = sortPackageJson(await fs9.readFile(`${pkgDir}/package.json`, "utf8"));
|
|
2342
2445
|
await fs9.writeFile(`${pkgDir}/package.json`, sortedPkg);
|
|
2343
2446
|
const pkg = JSON.parse(await fs9.readFile(`${pkgDir}/package.json`, "utf8"));
|
|
2344
|
-
console.log(
|
|
2345
|
-
console.log(
|
|
2447
|
+
console.log(chalk35.green(`Publint: ${pkg.name}`));
|
|
2448
|
+
console.log(chalk35.gray(pkgDir));
|
|
2346
2449
|
const { publint: publint2 } = await import("publint");
|
|
2347
2450
|
const { messages } = await publint2({
|
|
2348
2451
|
level: "suggestion",
|
|
@@ -2353,22 +2456,22 @@ var packagePublint = async ({ strict = true, verbose = false } = {}) => {
|
|
|
2353
2456
|
for (const message of messages) {
|
|
2354
2457
|
switch (message.type) {
|
|
2355
2458
|
case "error": {
|
|
2356
|
-
console.error(
|
|
2459
|
+
console.error(chalk35.red(`[${message.code}] ${formatMessage(message, pkg)}`));
|
|
2357
2460
|
break;
|
|
2358
2461
|
}
|
|
2359
2462
|
case "warning": {
|
|
2360
|
-
console.warn(
|
|
2463
|
+
console.warn(chalk35.yellow(`[${message.code}] ${formatMessage(message, pkg)}`));
|
|
2361
2464
|
break;
|
|
2362
2465
|
}
|
|
2363
2466
|
default: {
|
|
2364
|
-
console.log(
|
|
2467
|
+
console.log(chalk35.white(`[${message.code}] ${formatMessage(message, pkg)}`));
|
|
2365
2468
|
break;
|
|
2366
2469
|
}
|
|
2367
2470
|
}
|
|
2368
2471
|
}
|
|
2369
2472
|
const [errorCount, warningCount] = customPubLint(pkg);
|
|
2370
2473
|
if (verbose) {
|
|
2371
|
-
console.log(
|
|
2474
|
+
console.log(chalk35.gray(`Publint [Finish]: ${pkgDir} [${messages.length + errorCount + warningCount} messages]`));
|
|
2372
2475
|
}
|
|
2373
2476
|
return messages.filter((message) => message.type === "error").length + errorCount;
|
|
2374
2477
|
};
|
|
@@ -2404,7 +2507,7 @@ var rebuild = ({ target }) => {
|
|
|
2404
2507
|
};
|
|
2405
2508
|
|
|
2406
2509
|
// src/actions/recompile.ts
|
|
2407
|
-
import
|
|
2510
|
+
import chalk36 from "chalk";
|
|
2408
2511
|
var recompile = async ({
|
|
2409
2512
|
verbose,
|
|
2410
2513
|
target,
|
|
@@ -2440,7 +2543,7 @@ var recompileAll = async ({
|
|
|
2440
2543
|
const incrementalOptions = incremental ? ["--since", "-Apt", "--topological-dev"] : ["--parallel", "-Apt", "--topological-dev"];
|
|
2441
2544
|
const jobsOptions = jobs ? ["-j", `${jobs}`] : [];
|
|
2442
2545
|
if (jobs) {
|
|
2443
|
-
console.log(
|
|
2546
|
+
console.log(chalk36.blue(`Jobs set to [${jobs}]`));
|
|
2444
2547
|
}
|
|
2445
2548
|
const result = await runStepsAsync(`Recompile${incremental ? "-Incremental" : ""} [All]`, [
|
|
2446
2549
|
[
|
|
@@ -2471,7 +2574,7 @@ var recompileAll = async ({
|
|
|
2471
2574
|
]
|
|
2472
2575
|
]);
|
|
2473
2576
|
console.log(
|
|
2474
|
-
`${
|
|
2577
|
+
`${chalk36.gray("Recompiled in")} [${chalk36.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk36.gray("seconds")}`
|
|
2475
2578
|
);
|
|
2476
2579
|
return result;
|
|
2477
2580
|
};
|
|
@@ -2502,13 +2605,13 @@ var reinstall = () => {
|
|
|
2502
2605
|
};
|
|
2503
2606
|
|
|
2504
2607
|
// src/actions/relint.ts
|
|
2505
|
-
import
|
|
2608
|
+
import chalk37 from "chalk";
|
|
2506
2609
|
var relintPackage = ({
|
|
2507
2610
|
pkg,
|
|
2508
2611
|
fix: fix2,
|
|
2509
2612
|
verbose
|
|
2510
2613
|
}) => {
|
|
2511
|
-
console.log(
|
|
2614
|
+
console.log(chalk37.gray(`${fix2 ? "Fix" : "Lint"} [${pkg}]`));
|
|
2512
2615
|
const start = Date.now();
|
|
2513
2616
|
const result = runSteps(`${fix2 ? "Fix" : "Lint"} [${pkg}]`, [
|
|
2514
2617
|
["yarn", [
|
|
@@ -2518,7 +2621,7 @@ var relintPackage = ({
|
|
|
2518
2621
|
fix2 ? "package-fix" : verbose ? "package-lint-verbose" : "package-lint"
|
|
2519
2622
|
]]
|
|
2520
2623
|
]);
|
|
2521
|
-
console.log(
|
|
2624
|
+
console.log(chalk37.gray(`${fix2 ? "Fixed in" : "Linted in"} [${chalk37.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk37.gray("seconds")}`));
|
|
2522
2625
|
return result;
|
|
2523
2626
|
};
|
|
2524
2627
|
var relint = ({
|
|
@@ -2538,13 +2641,13 @@ var relint = ({
|
|
|
2538
2641
|
});
|
|
2539
2642
|
};
|
|
2540
2643
|
var relintAllPackages = ({ fix: fix2 = false } = {}) => {
|
|
2541
|
-
console.log(
|
|
2644
|
+
console.log(chalk37.gray(`${fix2 ? "Fix" : "Lint"} [All-Packages]`));
|
|
2542
2645
|
const start = Date.now();
|
|
2543
2646
|
const fixOptions = fix2 ? ["--fix"] : [];
|
|
2544
2647
|
const result = runSteps(`${fix2 ? "Fix" : "Lint"} [All-Packages]`, [
|
|
2545
2648
|
["yarn", ["eslint", ...fixOptions]]
|
|
2546
2649
|
]);
|
|
2547
|
-
console.log(
|
|
2650
|
+
console.log(chalk37.gray(`${fix2 ? "Fixed in" : "Linted in"} [${chalk37.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk37.gray("seconds")}`));
|
|
2548
2651
|
return result;
|
|
2549
2652
|
};
|
|
2550
2653
|
|
|
@@ -2562,10 +2665,10 @@ var sonar = () => {
|
|
|
2562
2665
|
};
|
|
2563
2666
|
|
|
2564
2667
|
// src/actions/statics.ts
|
|
2565
|
-
import
|
|
2668
|
+
import chalk38 from "chalk";
|
|
2566
2669
|
var DefaultDependencies = ["axios", "@xylabs/pixel", "react", "graphql", "react-router", "@mui/material", "@mui/system"];
|
|
2567
2670
|
var statics = () => {
|
|
2568
|
-
console.log(
|
|
2671
|
+
console.log(chalk38.green("Check Required Static Dependencies"));
|
|
2569
2672
|
const statics2 = parsedPackageJSON()?.xy?.deps?.statics;
|
|
2570
2673
|
return detectDuplicateDependencies(statics2, DefaultDependencies);
|
|
2571
2674
|
};
|
|
@@ -2622,7 +2725,7 @@ var loadPackageConfig = async () => {
|
|
|
2622
2725
|
};
|
|
2623
2726
|
|
|
2624
2727
|
// src/xy/xy.ts
|
|
2625
|
-
import
|
|
2728
|
+
import chalk40 from "chalk";
|
|
2626
2729
|
|
|
2627
2730
|
// src/xy/xyBuildCommands.ts
|
|
2628
2731
|
var xyBuildCommands = (args) => {
|
|
@@ -2730,6 +2833,21 @@ var packagePositionalParam = (yargs2) => {
|
|
|
2730
2833
|
// src/xy/xyCommonCommands.ts
|
|
2731
2834
|
var xyCommonCommands = (args) => {
|
|
2732
2835
|
return args.command(
|
|
2836
|
+
"claude-rules",
|
|
2837
|
+
"Claude Rules - Sync XY Labs standard Claude rules to .claude/rules/",
|
|
2838
|
+
(yargs2) => {
|
|
2839
|
+
return yargs2.option("force", {
|
|
2840
|
+
alias: "f",
|
|
2841
|
+
default: false,
|
|
2842
|
+
description: "Overwrite existing CLAUDE.md",
|
|
2843
|
+
type: "boolean"
|
|
2844
|
+
});
|
|
2845
|
+
},
|
|
2846
|
+
(argv) => {
|
|
2847
|
+
if (argv.verbose) console.log("Claude Rules");
|
|
2848
|
+
process.exitCode = claudeRules({ force: argv.force });
|
|
2849
|
+
}
|
|
2850
|
+
).command(
|
|
2733
2851
|
"license [package]",
|
|
2734
2852
|
"License - Check licenses of dependencies",
|
|
2735
2853
|
(yargs2) => {
|
|
@@ -2976,7 +3094,7 @@ var xyInstallCommands = (args) => {
|
|
|
2976
3094
|
};
|
|
2977
3095
|
|
|
2978
3096
|
// src/xy/xyLintCommands.ts
|
|
2979
|
-
import
|
|
3097
|
+
import chalk39 from "chalk";
|
|
2980
3098
|
var xyLintCommands = (args) => {
|
|
2981
3099
|
return args.command(
|
|
2982
3100
|
"cycle [package]",
|
|
@@ -2988,7 +3106,7 @@ var xyLintCommands = (args) => {
|
|
|
2988
3106
|
const start = Date.now();
|
|
2989
3107
|
if (argv.verbose) console.log("Cycle");
|
|
2990
3108
|
process.exitCode = await cycle({ pkg: argv.package });
|
|
2991
|
-
console.log(
|
|
3109
|
+
console.log(chalk39.blue(`Finished in ${Date.now() - start}ms`));
|
|
2992
3110
|
}
|
|
2993
3111
|
).command(
|
|
2994
3112
|
"lint [package]",
|
|
@@ -3018,7 +3136,7 @@ var xyLintCommands = (args) => {
|
|
|
3018
3136
|
cache: argv.cache,
|
|
3019
3137
|
verbose: !!argv.verbose
|
|
3020
3138
|
});
|
|
3021
|
-
console.log(
|
|
3139
|
+
console.log(chalk39.blue(`Finished in ${Date.now() - start}ms`));
|
|
3022
3140
|
}
|
|
3023
3141
|
).command(
|
|
3024
3142
|
"deplint [package]",
|
|
@@ -3051,7 +3169,7 @@ var xyLintCommands = (args) => {
|
|
|
3051
3169
|
peerDeps: !!argv.peerDeps,
|
|
3052
3170
|
verbose: !!argv.verbose
|
|
3053
3171
|
});
|
|
3054
|
-
console.log(
|
|
3172
|
+
console.log(chalk39.blue(`Finished in ${Date.now() - start}ms`));
|
|
3055
3173
|
}
|
|
3056
3174
|
).command(
|
|
3057
3175
|
"fix [package]",
|
|
@@ -3063,7 +3181,7 @@ var xyLintCommands = (args) => {
|
|
|
3063
3181
|
const start = Date.now();
|
|
3064
3182
|
if (argv.verbose) console.log("Fix");
|
|
3065
3183
|
process.exitCode = fix();
|
|
3066
|
-
console.log(
|
|
3184
|
+
console.log(chalk39.blue(`Finished in ${Date.now() - start}ms`));
|
|
3067
3185
|
}
|
|
3068
3186
|
).command(
|
|
3069
3187
|
"relint [package]",
|
|
@@ -3075,7 +3193,7 @@ var xyLintCommands = (args) => {
|
|
|
3075
3193
|
if (argv.verbose) console.log("Relinting");
|
|
3076
3194
|
const start = Date.now();
|
|
3077
3195
|
process.exitCode = relint();
|
|
3078
|
-
console.log(
|
|
3196
|
+
console.log(chalk39.blue(`Finished in ${Date.now() - start}ms`));
|
|
3079
3197
|
}
|
|
3080
3198
|
).command(
|
|
3081
3199
|
"publint [package]",
|
|
@@ -3087,7 +3205,7 @@ var xyLintCommands = (args) => {
|
|
|
3087
3205
|
if (argv.verbose) console.log("Publint");
|
|
3088
3206
|
const start = Date.now();
|
|
3089
3207
|
process.exitCode = await publint({ pkg: argv.package, verbose: !!argv.verbose });
|
|
3090
|
-
console.log(
|
|
3208
|
+
console.log(chalk39.blue(`Finished in ${Date.now() - start}ms`));
|
|
3091
3209
|
}
|
|
3092
3210
|
).command(
|
|
3093
3211
|
"knip",
|
|
@@ -3099,7 +3217,7 @@ var xyLintCommands = (args) => {
|
|
|
3099
3217
|
if (argv.verbose) console.log("Knip");
|
|
3100
3218
|
const start = Date.now();
|
|
3101
3219
|
process.exitCode = knip();
|
|
3102
|
-
console.log(
|
|
3220
|
+
console.log(chalk39.blue(`Knip finished in ${Date.now() - start}ms`));
|
|
3103
3221
|
}
|
|
3104
3222
|
).command(
|
|
3105
3223
|
"sonar",
|
|
@@ -3111,7 +3229,7 @@ var xyLintCommands = (args) => {
|
|
|
3111
3229
|
const start = Date.now();
|
|
3112
3230
|
if (argv.verbose) console.log("Sonar Check");
|
|
3113
3231
|
process.exitCode = sonar();
|
|
3114
|
-
console.log(
|
|
3232
|
+
console.log(chalk39.blue(`Finished in ${Date.now() - start}ms`));
|
|
3115
3233
|
}
|
|
3116
3234
|
);
|
|
3117
3235
|
};
|
|
@@ -3147,8 +3265,8 @@ var xyParseOptions = () => {
|
|
|
3147
3265
|
var xy = async () => {
|
|
3148
3266
|
const options = xyParseOptions();
|
|
3149
3267
|
return await xyBuildCommands(xyCommonCommands(xyInstallCommands(xyDeployCommands(xyLintCommands(options))))).demandCommand(1).command("*", "", () => {
|
|
3150
|
-
console.error(
|
|
3151
|
-
console.log(
|
|
3268
|
+
console.error(chalk40.yellow(`Command not found [${chalk40.magenta(process.argv[2])}]`));
|
|
3269
|
+
console.log(chalk40.gray("Try 'yarn xy --help' for list of commands"));
|
|
3152
3270
|
}).version().help().argv;
|
|
3153
3271
|
};
|
|
3154
3272
|
export {
|
|
@@ -3156,9 +3274,13 @@ export {
|
|
|
3156
3274
|
DuplicateDetector,
|
|
3157
3275
|
INIT_CWD,
|
|
3158
3276
|
WINDOWS_NEWLINE_REGEX,
|
|
3277
|
+
XYLABS_RULES_PREFIX,
|
|
3159
3278
|
build,
|
|
3160
3279
|
bundleDts,
|
|
3161
3280
|
checkResult,
|
|
3281
|
+
claudeMdProjectTemplate,
|
|
3282
|
+
claudeMdRuleTemplates,
|
|
3283
|
+
claudeRules,
|
|
3162
3284
|
clean,
|
|
3163
3285
|
cleanAll,
|
|
3164
3286
|
cleanDocs,
|