@xylabs/ts-scripts-yarn3 7.4.24 → 7.4.25
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/actions/claude-settings.mjs +3 -0
- package/dist/actions/claude-settings.mjs.map +1 -1
- package/dist/actions/index.mjs +3 -2
- package/dist/actions/index.mjs.map +1 -1
- package/dist/actions/package/compile/index.mjs +0 -2
- package/dist/actions/package/index.mjs +0 -2
- package/dist/bin/xy.mjs +213 -172
- package/dist/bin/xy.mjs.map +1 -1
- package/dist/index.d.ts +8 -5
- package/dist/index.mjs +267 -227
- package/dist/index.mjs.map +1 -1
- package/dist/lib/index.mjs +31 -0
- package/dist/lib/index.mjs.map +1 -1
- package/dist/lib/tryRunLocalScript.mjs +33 -0
- package/dist/lib/tryRunLocalScript.mjs.map +1 -0
- package/dist/xy/common/claude/index.mjs +3 -0
- package/dist/xy/common/claude/index.mjs.map +1 -1
- package/dist/xy/common/claude/initCommand.mjs +3 -0
- package/dist/xy/common/claude/initCommand.mjs.map +1 -1
- package/dist/xy/common/claude/settingsCommand.mjs +3 -0
- package/dist/xy/common/claude/settingsCommand.mjs.map +1 -1
- package/dist/xy/common/index.mjs +3 -0
- package/dist/xy/common/index.mjs.map +1 -1
- package/dist/xy/index.mjs +213 -172
- package/dist/xy/index.mjs.map +1 -1
- package/dist/xy/xy.mjs +213 -172
- package/dist/xy/xy.mjs.map +1 -1
- package/dist/xy/xyParseOptions.mjs +41 -1
- package/dist/xy/xyParseOptions.mjs.map +1 -1
- package/package.json +12 -12
- package/templates/claude/skills/xylabs-e2e-setup/SKILL.md +19 -6
package/dist/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// src/actions/build.ts
|
|
2
|
-
import
|
|
2
|
+
import chalk11 from "chalk";
|
|
3
3
|
|
|
4
4
|
// src/lib/checkResult.ts
|
|
5
5
|
import chalk from "chalk";
|
|
@@ -761,6 +761,36 @@ var runXyWithWarning = (command) => {
|
|
|
761
761
|
return 1;
|
|
762
762
|
};
|
|
763
763
|
|
|
764
|
+
// src/lib/tryRunLocalScript.ts
|
|
765
|
+
import { spawnSync as spawnSync4 } from "child_process";
|
|
766
|
+
import { readFileSync as readFileSync8 } from "fs";
|
|
767
|
+
import PATH4 from "path";
|
|
768
|
+
import chalk10 from "chalk";
|
|
769
|
+
function tryRunLocalScript(commandName) {
|
|
770
|
+
if (process.env.XY_LOCAL_SCRIPT === "1") return void 0;
|
|
771
|
+
const rootPkgPath = PATH4.resolve(process.cwd(), "package.json");
|
|
772
|
+
let rootPkg;
|
|
773
|
+
try {
|
|
774
|
+
rootPkg = JSON.parse(readFileSync8(rootPkgPath, "utf8"));
|
|
775
|
+
} catch {
|
|
776
|
+
return void 0;
|
|
777
|
+
}
|
|
778
|
+
if (!rootPkg.scripts?.[commandName]) return void 0;
|
|
779
|
+
console.log(chalk10.blue(`Delegating "${commandName}" to local script`));
|
|
780
|
+
const result = spawnSync4("yarn", ["run", commandName], {
|
|
781
|
+
cwd: process.cwd(),
|
|
782
|
+
encoding: "utf8",
|
|
783
|
+
env: {
|
|
784
|
+
FORCE_COLOR: "3",
|
|
785
|
+
...process.env,
|
|
786
|
+
XY_LOCAL_SCRIPT: "1"
|
|
787
|
+
},
|
|
788
|
+
shell: true,
|
|
789
|
+
stdio: "inherit"
|
|
790
|
+
});
|
|
791
|
+
return result.status ?? 1;
|
|
792
|
+
}
|
|
793
|
+
|
|
764
794
|
// src/actions/build.ts
|
|
765
795
|
var build = async ({
|
|
766
796
|
incremental,
|
|
@@ -776,7 +806,7 @@ var build = async ({
|
|
|
776
806
|
const targetOptions = target === void 0 ? [] : ["-t", target];
|
|
777
807
|
const jobsOptions = jobs === void 0 ? [] : ["-j", `${jobs}`];
|
|
778
808
|
if (jobs !== void 0) {
|
|
779
|
-
console.log(
|
|
809
|
+
console.log(chalk11.blue(`Jobs set to [${jobs}]`));
|
|
780
810
|
}
|
|
781
811
|
const result = await runStepsAsync(`Build${incremental ? "-Incremental" : ""} [${pkg ?? "All"}]`, [
|
|
782
812
|
["yarn", ["xy", "compile", ...pkgOptions, ...targetOptions, ...verboseOptions, ...jobsOptions, ...incrementalOptions, "--types", "tsup"]],
|
|
@@ -784,7 +814,7 @@ var build = async ({
|
|
|
784
814
|
["yarn", ["xy", "deplint", ...pkgOptions, ...verboseOptions, ...jobsOptions, ...incrementalOptions]],
|
|
785
815
|
["yarn", ["xy", "lint", ...pkgOptions, ...verboseOptions, ...incrementalOptions]]
|
|
786
816
|
]);
|
|
787
|
-
console.log(`${
|
|
817
|
+
console.log(`${chalk11.gray("Built in")} [${chalk11.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk11.gray("seconds")}`);
|
|
788
818
|
return result;
|
|
789
819
|
};
|
|
790
820
|
|
|
@@ -795,12 +825,12 @@ import {
|
|
|
795
825
|
rmSync,
|
|
796
826
|
unlinkSync
|
|
797
827
|
} from "fs";
|
|
798
|
-
import
|
|
799
|
-
import
|
|
828
|
+
import PATH5 from "path";
|
|
829
|
+
import chalk12 from "chalk";
|
|
800
830
|
function removeFile(filePath, label) {
|
|
801
831
|
if (existsSync5(filePath)) {
|
|
802
832
|
unlinkSync(filePath);
|
|
803
|
-
console.log(
|
|
833
|
+
console.log(chalk12.yellow(` Removed ${label}`));
|
|
804
834
|
return true;
|
|
805
835
|
}
|
|
806
836
|
return false;
|
|
@@ -808,26 +838,26 @@ function removeFile(filePath, label) {
|
|
|
808
838
|
function removeDir(dirPath, label) {
|
|
809
839
|
if (existsSync5(dirPath)) {
|
|
810
840
|
rmSync(dirPath, { recursive: true });
|
|
811
|
-
console.log(
|
|
841
|
+
console.log(chalk12.yellow(` Removed ${label}`));
|
|
812
842
|
return true;
|
|
813
843
|
}
|
|
814
844
|
return false;
|
|
815
845
|
}
|
|
816
846
|
function claudeClean() {
|
|
817
|
-
console.log(
|
|
847
|
+
console.log(chalk12.green("Clean Claude configuration"));
|
|
818
848
|
const cwd5 = INIT_CWD() ?? process.cwd();
|
|
819
849
|
let removed = 0;
|
|
820
850
|
const rootFiles = ["CLAUDE.md", "CLAUDE.local.md"];
|
|
821
851
|
for (const file of rootFiles) {
|
|
822
|
-
if (removeFile(
|
|
852
|
+
if (removeFile(PATH5.resolve(cwd5, file), file)) removed++;
|
|
823
853
|
}
|
|
824
|
-
if (removeDir(
|
|
825
|
-
const packagesDir =
|
|
854
|
+
if (removeDir(PATH5.resolve(cwd5, ".claude"), ".claude/")) removed++;
|
|
855
|
+
const packagesDir = PATH5.resolve(cwd5, "packages");
|
|
826
856
|
if (existsSync5(packagesDir)) {
|
|
827
857
|
const findClaudeFiles = (dir, prefix) => {
|
|
828
858
|
const entries = readdirSync2(dir, { withFileTypes: true });
|
|
829
859
|
for (const entry of entries) {
|
|
830
|
-
const fullPath =
|
|
860
|
+
const fullPath = PATH5.resolve(dir, entry.name);
|
|
831
861
|
const label = `${prefix}${entry.name}`;
|
|
832
862
|
if (entry.isFile() && (entry.name === "CLAUDE.md" || entry.name === "CLAUDE.local.md")) {
|
|
833
863
|
if (removeFile(fullPath, label)) removed++;
|
|
@@ -841,9 +871,9 @@ function claudeClean() {
|
|
|
841
871
|
findClaudeFiles(packagesDir, "packages/");
|
|
842
872
|
}
|
|
843
873
|
if (removed > 0) {
|
|
844
|
-
console.log(
|
|
874
|
+
console.log(chalk12.green(` Removed ${removed} item(s)`));
|
|
845
875
|
} else {
|
|
846
|
-
console.log(
|
|
876
|
+
console.log(chalk12.gray(" Nothing to clean"));
|
|
847
877
|
}
|
|
848
878
|
return 0;
|
|
849
879
|
}
|
|
@@ -853,20 +883,20 @@ import {
|
|
|
853
883
|
existsSync as existsSync6,
|
|
854
884
|
mkdirSync,
|
|
855
885
|
readdirSync as readdirSync3,
|
|
856
|
-
readFileSync as
|
|
886
|
+
readFileSync as readFileSync9,
|
|
857
887
|
unlinkSync as unlinkSync2,
|
|
858
888
|
writeFileSync as writeFileSync2
|
|
859
889
|
} from "fs";
|
|
860
|
-
import
|
|
861
|
-
import
|
|
890
|
+
import PATH6 from "path";
|
|
891
|
+
import chalk13 from "chalk";
|
|
862
892
|
var syncCommandFiles = (commandsDir) => {
|
|
863
893
|
const templates = claudeCommandTemplates();
|
|
864
894
|
const templateNames = new Set(Object.keys(templates));
|
|
865
895
|
let updated = 0;
|
|
866
896
|
let created = 0;
|
|
867
897
|
for (const [filename2, content] of Object.entries(templates)) {
|
|
868
|
-
const targetPath =
|
|
869
|
-
const existing = existsSync6(targetPath) ?
|
|
898
|
+
const targetPath = PATH6.resolve(commandsDir, filename2);
|
|
899
|
+
const existing = existsSync6(targetPath) ? readFileSync9(targetPath, "utf8") : void 0;
|
|
870
900
|
if (existing === content) continue;
|
|
871
901
|
writeFileSync2(targetPath, content, "utf8");
|
|
872
902
|
if (existing) {
|
|
@@ -886,7 +916,7 @@ var removeStaleCommands = (commandsDir, templateNames) => {
|
|
|
886
916
|
let removed = 0;
|
|
887
917
|
for (const file of existingCommands) {
|
|
888
918
|
if (!templateNames.has(file)) {
|
|
889
|
-
unlinkSync2(
|
|
919
|
+
unlinkSync2(PATH6.resolve(commandsDir, file));
|
|
890
920
|
removed++;
|
|
891
921
|
}
|
|
892
922
|
}
|
|
@@ -895,7 +925,7 @@ var removeStaleCommands = (commandsDir, templateNames) => {
|
|
|
895
925
|
var removeLegacyCommands = (commandsDir) => {
|
|
896
926
|
const legacyFiles = readdirSync3(commandsDir).filter((f) => f.startsWith(LEGACY_COMMANDS_PREFIX) && f.endsWith(".md"));
|
|
897
927
|
for (const file of legacyFiles) {
|
|
898
|
-
unlinkSync2(
|
|
928
|
+
unlinkSync2(PATH6.resolve(commandsDir, file));
|
|
899
929
|
}
|
|
900
930
|
return legacyFiles.length;
|
|
901
931
|
};
|
|
@@ -906,14 +936,14 @@ var logCommandsResult = (created, updated, removed) => {
|
|
|
906
936
|
updated ? `${updated} updated` : "",
|
|
907
937
|
removed ? `${removed} removed` : ""
|
|
908
938
|
].filter(Boolean);
|
|
909
|
-
console.log(
|
|
939
|
+
console.log(chalk13.green(`.claude/commands/${XYLABS_COMMANDS_PREFIX}*.md: ${parts.join(", ")}`));
|
|
910
940
|
} else {
|
|
911
|
-
console.log(
|
|
941
|
+
console.log(chalk13.gray(`.claude/commands/${XYLABS_COMMANDS_PREFIX}*.md: already up to date`));
|
|
912
942
|
}
|
|
913
943
|
};
|
|
914
944
|
var claudeCommands = () => {
|
|
915
945
|
const cwd5 = INIT_CWD() ?? process.cwd();
|
|
916
|
-
const commandsDir =
|
|
946
|
+
const commandsDir = PATH6.resolve(cwd5, ".claude", "commands");
|
|
917
947
|
mkdirSync(commandsDir, { recursive: true });
|
|
918
948
|
const legacy = removeLegacyCommands(commandsDir);
|
|
919
949
|
const {
|
|
@@ -927,25 +957,25 @@ var claudeCommands = () => {
|
|
|
927
957
|
};
|
|
928
958
|
|
|
929
959
|
// src/actions/claude-rules.ts
|
|
930
|
-
import { spawnSync as
|
|
960
|
+
import { spawnSync as spawnSync5 } from "child_process";
|
|
931
961
|
import {
|
|
932
962
|
existsSync as existsSync7,
|
|
933
963
|
mkdirSync as mkdirSync2,
|
|
934
964
|
readdirSync as readdirSync4,
|
|
935
|
-
readFileSync as
|
|
965
|
+
readFileSync as readFileSync10,
|
|
936
966
|
unlinkSync as unlinkSync3,
|
|
937
967
|
writeFileSync as writeFileSync3
|
|
938
968
|
} from "fs";
|
|
939
|
-
import
|
|
940
|
-
import
|
|
969
|
+
import PATH7 from "path";
|
|
970
|
+
import chalk14 from "chalk";
|
|
941
971
|
var syncRuleFiles = (rulesDir) => {
|
|
942
972
|
const templates = claudeMdRuleTemplates();
|
|
943
973
|
const templateNames = new Set(Object.keys(templates));
|
|
944
974
|
let updated = 0;
|
|
945
975
|
let created = 0;
|
|
946
976
|
for (const [filename2, content] of Object.entries(templates)) {
|
|
947
|
-
const targetPath =
|
|
948
|
-
const existing = existsSync7(targetPath) ?
|
|
977
|
+
const targetPath = PATH7.resolve(rulesDir, filename2);
|
|
978
|
+
const existing = existsSync7(targetPath) ? readFileSync10(targetPath, "utf8") : void 0;
|
|
949
979
|
if (existing === content) continue;
|
|
950
980
|
writeFileSync3(targetPath, content, "utf8");
|
|
951
981
|
if (existing) {
|
|
@@ -965,7 +995,7 @@ var removeStaleRules = (rulesDir, templateNames) => {
|
|
|
965
995
|
let removed = 0;
|
|
966
996
|
for (const file of existingRules) {
|
|
967
997
|
if (!templateNames.has(file)) {
|
|
968
|
-
unlinkSync3(
|
|
998
|
+
unlinkSync3(PATH7.resolve(rulesDir, file));
|
|
969
999
|
removed++;
|
|
970
1000
|
}
|
|
971
1001
|
}
|
|
@@ -978,44 +1008,44 @@ var logRulesResult = (created, updated, removed) => {
|
|
|
978
1008
|
updated ? `${updated} updated` : "",
|
|
979
1009
|
removed ? `${removed} removed` : ""
|
|
980
1010
|
].filter(Boolean);
|
|
981
|
-
console.log(
|
|
1011
|
+
console.log(chalk14.green(`.claude/rules/${XYLABS_RULES_PREFIX}*.md: ${parts.join(", ")}`));
|
|
982
1012
|
} else {
|
|
983
|
-
console.log(
|
|
1013
|
+
console.log(chalk14.gray(`.claude/rules/${XYLABS_RULES_PREFIX}*.md: already up to date`));
|
|
984
1014
|
}
|
|
985
1015
|
};
|
|
986
1016
|
var ensureProjectClaudeMd = (cwd5, force) => {
|
|
987
|
-
const projectPath =
|
|
1017
|
+
const projectPath = PATH7.resolve(cwd5, "CLAUDE.md");
|
|
988
1018
|
if (!existsSync7(projectPath) || force) {
|
|
989
1019
|
if (force && existsSync7(projectPath)) {
|
|
990
|
-
console.log(
|
|
1020
|
+
console.log(chalk14.yellow("Regenerating CLAUDE.md"));
|
|
991
1021
|
}
|
|
992
|
-
console.log(
|
|
993
|
-
const result =
|
|
1022
|
+
console.log(chalk14.green("Generating CLAUDE.md via claude /init..."));
|
|
1023
|
+
const result = spawnSync5("claude", ["-p", "/init", "--allowedTools", "Read", "Write", "Glob", "Grep"], {
|
|
994
1024
|
cwd: cwd5,
|
|
995
1025
|
shell: true,
|
|
996
1026
|
stdio: "inherit"
|
|
997
1027
|
});
|
|
998
1028
|
if (result.status !== 0) {
|
|
999
|
-
console.error(
|
|
1029
|
+
console.error(chalk14.red("claude /init failed \u2014 is Claude Code installed?"));
|
|
1000
1030
|
return 1;
|
|
1001
1031
|
}
|
|
1002
1032
|
} else {
|
|
1003
|
-
console.log(
|
|
1033
|
+
console.log(chalk14.gray("CLAUDE.md already exists (skipped, use --force to regenerate)"));
|
|
1004
1034
|
}
|
|
1005
1035
|
return 0;
|
|
1006
1036
|
};
|
|
1007
1037
|
var ensureLocalClaudeMd = (cwd5) => {
|
|
1008
|
-
const localPath =
|
|
1038
|
+
const localPath = PATH7.resolve(cwd5, "CLAUDE.local.md");
|
|
1009
1039
|
if (existsSync7(localPath)) {
|
|
1010
|
-
console.log(
|
|
1040
|
+
console.log(chalk14.gray("CLAUDE.local.md already exists (skipped)"));
|
|
1011
1041
|
} else {
|
|
1012
1042
|
writeFileSync3(localPath, claudeMdLocalTemplate(), "utf8");
|
|
1013
|
-
console.log(
|
|
1043
|
+
console.log(chalk14.green("Generated CLAUDE.local.md"));
|
|
1014
1044
|
}
|
|
1015
1045
|
};
|
|
1016
1046
|
var claudeRules = ({ force } = {}) => {
|
|
1017
1047
|
const cwd5 = INIT_CWD() ?? process.cwd();
|
|
1018
|
-
const rulesDir =
|
|
1048
|
+
const rulesDir = PATH7.resolve(cwd5, ".claude", "rules");
|
|
1019
1049
|
mkdirSync2(rulesDir, { recursive: true });
|
|
1020
1050
|
const {
|
|
1021
1051
|
created,
|
|
@@ -1035,9 +1065,9 @@ import {
|
|
|
1035
1065
|
mkdirSync as mkdirSync3,
|
|
1036
1066
|
writeFileSync as writeFileSync4
|
|
1037
1067
|
} from "fs";
|
|
1038
|
-
import
|
|
1068
|
+
import PATH8 from "path";
|
|
1039
1069
|
import { createInterface as createInterface2 } from "readline";
|
|
1040
|
-
import
|
|
1070
|
+
import chalk15 from "chalk";
|
|
1041
1071
|
var DEFAULT_SETTINGS = {
|
|
1042
1072
|
permissions: {
|
|
1043
1073
|
allow: [
|
|
@@ -1056,6 +1086,9 @@ var DEFAULT_SETTINGS = {
|
|
|
1056
1086
|
"Bash(echo *)",
|
|
1057
1087
|
"Bash(pwd)",
|
|
1058
1088
|
"Bash(which *)",
|
|
1089
|
+
"Bash(grep *)",
|
|
1090
|
+
"Bash(find *)",
|
|
1091
|
+
"Bash(npm view *)",
|
|
1059
1092
|
"Bash(gh *)",
|
|
1060
1093
|
"Read",
|
|
1061
1094
|
"Edit",
|
|
@@ -1082,21 +1115,21 @@ function askConfirmation2(question) {
|
|
|
1082
1115
|
}
|
|
1083
1116
|
async function claudeSettings() {
|
|
1084
1117
|
const cwd5 = INIT_CWD() ?? process.cwd();
|
|
1085
|
-
const claudeDir =
|
|
1086
|
-
const settingsPath =
|
|
1118
|
+
const claudeDir = PATH8.resolve(cwd5, ".claude");
|
|
1119
|
+
const settingsPath = PATH8.resolve(claudeDir, "settings.local.json");
|
|
1087
1120
|
mkdirSync3(claudeDir, { recursive: true });
|
|
1088
1121
|
if (existsSync8(settingsPath)) {
|
|
1089
1122
|
const confirmed = await askConfirmation2(
|
|
1090
|
-
|
|
1123
|
+
chalk15.yellow(`${settingsPath} already exists. Replace it? (y/N) `)
|
|
1091
1124
|
);
|
|
1092
1125
|
if (!confirmed) {
|
|
1093
|
-
console.log(
|
|
1126
|
+
console.log(chalk15.gray("Skipped \u2014 existing settings.local.json preserved"));
|
|
1094
1127
|
return 0;
|
|
1095
1128
|
}
|
|
1096
1129
|
}
|
|
1097
1130
|
writeFileSync4(settingsPath, `${JSON.stringify(DEFAULT_SETTINGS, null, 2)}
|
|
1098
1131
|
`, "utf8");
|
|
1099
|
-
console.log(
|
|
1132
|
+
console.log(chalk15.green("Generated .claude/settings.local.json"));
|
|
1100
1133
|
return 0;
|
|
1101
1134
|
}
|
|
1102
1135
|
|
|
@@ -1105,25 +1138,25 @@ import {
|
|
|
1105
1138
|
existsSync as existsSync9,
|
|
1106
1139
|
mkdirSync as mkdirSync4,
|
|
1107
1140
|
readdirSync as readdirSync5,
|
|
1108
|
-
readFileSync as
|
|
1141
|
+
readFileSync as readFileSync11,
|
|
1109
1142
|
rmSync as rmSync2,
|
|
1110
1143
|
statSync as statSync2,
|
|
1111
1144
|
writeFileSync as writeFileSync5
|
|
1112
1145
|
} from "fs";
|
|
1113
|
-
import
|
|
1114
|
-
import
|
|
1146
|
+
import PATH9 from "path";
|
|
1147
|
+
import chalk16 from "chalk";
|
|
1115
1148
|
var syncSkillFiles = (skillsDir) => {
|
|
1116
1149
|
const templates = claudeSkillTemplates();
|
|
1117
1150
|
const templateNames = new Set(Object.keys(templates));
|
|
1118
1151
|
let updated = 0;
|
|
1119
1152
|
let created = 0;
|
|
1120
1153
|
for (const [skillName, files] of Object.entries(templates)) {
|
|
1121
|
-
const skillDir =
|
|
1154
|
+
const skillDir = PATH9.resolve(skillsDir, skillName);
|
|
1122
1155
|
mkdirSync4(skillDir, { recursive: true });
|
|
1123
1156
|
for (const [filename2, content] of Object.entries(files)) {
|
|
1124
|
-
const targetPath =
|
|
1125
|
-
mkdirSync4(
|
|
1126
|
-
const existing = existsSync9(targetPath) ?
|
|
1157
|
+
const targetPath = PATH9.resolve(skillDir, filename2);
|
|
1158
|
+
mkdirSync4(PATH9.dirname(targetPath), { recursive: true });
|
|
1159
|
+
const existing = existsSync9(targetPath) ? readFileSync11(targetPath, "utf8") : void 0;
|
|
1127
1160
|
if (existing === content) continue;
|
|
1128
1161
|
writeFileSync5(targetPath, content, "utf8");
|
|
1129
1162
|
if (existing) {
|
|
@@ -1141,12 +1174,12 @@ var syncSkillFiles = (skillsDir) => {
|
|
|
1141
1174
|
};
|
|
1142
1175
|
var removeStaleSkills = (skillsDir, templateNames) => {
|
|
1143
1176
|
const existingSkills = readdirSync5(skillsDir).filter(
|
|
1144
|
-
(f) => f.startsWith(XYLABS_SKILLS_PREFIX) && statSync2(
|
|
1177
|
+
(f) => f.startsWith(XYLABS_SKILLS_PREFIX) && statSync2(PATH9.resolve(skillsDir, f)).isDirectory()
|
|
1145
1178
|
);
|
|
1146
1179
|
let removed = 0;
|
|
1147
1180
|
for (const dir of existingSkills) {
|
|
1148
1181
|
if (!templateNames.has(dir)) {
|
|
1149
|
-
rmSync2(
|
|
1182
|
+
rmSync2(PATH9.resolve(skillsDir, dir), { recursive: true });
|
|
1150
1183
|
removed++;
|
|
1151
1184
|
}
|
|
1152
1185
|
}
|
|
@@ -1159,14 +1192,14 @@ var logSkillsResult = (created, updated, removed) => {
|
|
|
1159
1192
|
updated ? `${updated} updated` : "",
|
|
1160
1193
|
removed ? `${removed} removed` : ""
|
|
1161
1194
|
].filter(Boolean);
|
|
1162
|
-
console.log(
|
|
1195
|
+
console.log(chalk16.green(`.claude/skills/${XYLABS_SKILLS_PREFIX}*/: ${parts.join(", ")}`));
|
|
1163
1196
|
} else {
|
|
1164
|
-
console.log(
|
|
1197
|
+
console.log(chalk16.gray(`.claude/skills/${XYLABS_SKILLS_PREFIX}*/: already up to date`));
|
|
1165
1198
|
}
|
|
1166
1199
|
};
|
|
1167
1200
|
var claudeSkills = () => {
|
|
1168
1201
|
const cwd5 = INIT_CWD() ?? process.cwd();
|
|
1169
|
-
const skillsDir =
|
|
1202
|
+
const skillsDir = PATH9.resolve(cwd5, ".claude", "skills");
|
|
1170
1203
|
mkdirSync4(skillsDir, { recursive: true });
|
|
1171
1204
|
const {
|
|
1172
1205
|
created,
|
|
@@ -1192,16 +1225,16 @@ var cleanAll = ({ verbose }) => {
|
|
|
1192
1225
|
|
|
1193
1226
|
// src/actions/clean-docs.ts
|
|
1194
1227
|
import path from "path";
|
|
1195
|
-
import
|
|
1228
|
+
import chalk17 from "chalk";
|
|
1196
1229
|
var cleanDocs = () => {
|
|
1197
1230
|
const pkgName = process.env.npm_package_name;
|
|
1198
|
-
console.log(
|
|
1231
|
+
console.log(chalk17.green(`Cleaning Docs [${pkgName}]`));
|
|
1199
1232
|
for (const { location } of yarnWorkspaces()) deleteGlob(path.join(location, "docs"));
|
|
1200
1233
|
return 0;
|
|
1201
1234
|
};
|
|
1202
1235
|
|
|
1203
1236
|
// src/actions/compile.ts
|
|
1204
|
-
import
|
|
1237
|
+
import chalk18 from "chalk";
|
|
1205
1238
|
var compile = ({
|
|
1206
1239
|
verbose,
|
|
1207
1240
|
target,
|
|
@@ -1242,7 +1275,7 @@ var compileAll = ({
|
|
|
1242
1275
|
const incrementalOptions = incremental ? ["--since", "-Ap", "--topological-dev"] : ["--parallel", "-Ap", "--topological-dev"];
|
|
1243
1276
|
const jobsOptions = jobs ? ["-j", `${jobs}`] : [];
|
|
1244
1277
|
if (jobs) {
|
|
1245
|
-
console.log(
|
|
1278
|
+
console.log(chalk18.blue(`Jobs set to [${jobs}]`));
|
|
1246
1279
|
}
|
|
1247
1280
|
const result = runSteps(`Compile${incremental ? "-Incremental" : ""} [All]`, [
|
|
1248
1281
|
["yarn", [
|
|
@@ -1256,13 +1289,13 @@ var compileAll = ({
|
|
|
1256
1289
|
...targetOptions
|
|
1257
1290
|
]]
|
|
1258
1291
|
]);
|
|
1259
|
-
console.log(`${
|
|
1292
|
+
console.log(`${chalk18.gray("Compiled in")} [${chalk18.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk18.gray("seconds")}`);
|
|
1260
1293
|
return result;
|
|
1261
1294
|
};
|
|
1262
1295
|
|
|
1263
1296
|
// src/actions/copy-assets.ts
|
|
1264
1297
|
import path2 from "path/posix";
|
|
1265
|
-
import
|
|
1298
|
+
import chalk19 from "chalk";
|
|
1266
1299
|
import cpy from "cpy";
|
|
1267
1300
|
var copyPackageTargetAssets = async (target, name, location) => {
|
|
1268
1301
|
try {
|
|
@@ -1285,7 +1318,7 @@ var copyPackageTargetAssets = async (target, name, location) => {
|
|
|
1285
1318
|
};
|
|
1286
1319
|
var copyTargetAssets = async (target, pkg) => {
|
|
1287
1320
|
const workspaces = yarnWorkspaces();
|
|
1288
|
-
console.log(
|
|
1321
|
+
console.log(chalk19.green(`Copying Assets [${target.toUpperCase()}]`));
|
|
1289
1322
|
const workspaceList = workspaces.filter(({ name }) => {
|
|
1290
1323
|
return pkg === void 0 || name === pkg;
|
|
1291
1324
|
});
|
|
@@ -1369,7 +1402,7 @@ var dead = () => {
|
|
|
1369
1402
|
};
|
|
1370
1403
|
|
|
1371
1404
|
// src/actions/deplint/deplint.ts
|
|
1372
|
-
import
|
|
1405
|
+
import chalk25 from "chalk";
|
|
1373
1406
|
|
|
1374
1407
|
// src/actions/deplint/findFiles.ts
|
|
1375
1408
|
import fs2 from "fs";
|
|
@@ -1574,7 +1607,7 @@ function getExternalImportsFromFiles({
|
|
|
1574
1607
|
|
|
1575
1608
|
// src/actions/deplint/checkPackage/getUnlistedDependencies.ts
|
|
1576
1609
|
import { builtinModules } from "module";
|
|
1577
|
-
import
|
|
1610
|
+
import chalk20 from "chalk";
|
|
1578
1611
|
function isRuntimeImportListed(imp, name, dependencies, peerDependencies) {
|
|
1579
1612
|
return dependencies.includes(imp) || imp === name || peerDependencies.includes(imp) || builtinModules.includes(imp);
|
|
1580
1613
|
}
|
|
@@ -1582,7 +1615,7 @@ function isTypeImportListed(imp, name, dependencies, devDependencies, peerDepend
|
|
|
1582
1615
|
return dependencies.includes(imp) || imp === name || dependencies.includes(`@types/${imp}`) || peerDependencies.includes(imp) || peerDependencies.includes(`@types/${imp}`) || devDependencies.includes(`@types/${imp}`) || builtinModules.includes(imp);
|
|
1583
1616
|
}
|
|
1584
1617
|
function logMissing(name, imp, importPaths) {
|
|
1585
|
-
console.log(`[${
|
|
1618
|
+
console.log(`[${chalk20.blue(name)}] Missing dependency in package.json: ${chalk20.red(imp)}`);
|
|
1586
1619
|
if (importPaths[imp]) {
|
|
1587
1620
|
console.log(` ${importPaths[imp].join("\n ")}`);
|
|
1588
1621
|
}
|
|
@@ -1611,7 +1644,7 @@ function getUnlistedDependencies({ name, location }, {
|
|
|
1611
1644
|
}
|
|
1612
1645
|
if (unlistedDependencies > 0) {
|
|
1613
1646
|
const packageLocation = `${location}/package.json`;
|
|
1614
|
-
console.log(` ${
|
|
1647
|
+
console.log(` ${chalk20.yellow(packageLocation)}
|
|
1615
1648
|
`);
|
|
1616
1649
|
}
|
|
1617
1650
|
return unlistedDependencies;
|
|
@@ -1619,7 +1652,7 @@ function getUnlistedDependencies({ name, location }, {
|
|
|
1619
1652
|
|
|
1620
1653
|
// src/actions/deplint/checkPackage/getUnlistedDevDependencies.ts
|
|
1621
1654
|
import { builtinModules as builtinModules2 } from "module";
|
|
1622
|
-
import
|
|
1655
|
+
import chalk21 from "chalk";
|
|
1623
1656
|
function getUnlistedDevDependencies({ name, location }, {
|
|
1624
1657
|
devDependencies,
|
|
1625
1658
|
dependencies,
|
|
@@ -1633,7 +1666,7 @@ function getUnlistedDevDependencies({ name, location }, {
|
|
|
1633
1666
|
for (const imp of externalAllImports) {
|
|
1634
1667
|
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)) {
|
|
1635
1668
|
unlistedDevDependencies++;
|
|
1636
|
-
console.log(`[${
|
|
1669
|
+
console.log(`[${chalk21.blue(name)}] Missing devDependency in package.json: ${chalk21.red(imp)}`);
|
|
1637
1670
|
if (allImportPaths[imp]) {
|
|
1638
1671
|
console.log(` ${allImportPaths[imp].join("\n ")}`);
|
|
1639
1672
|
}
|
|
@@ -1641,14 +1674,14 @@ function getUnlistedDevDependencies({ name, location }, {
|
|
|
1641
1674
|
}
|
|
1642
1675
|
if (unlistedDevDependencies > 0) {
|
|
1643
1676
|
const packageLocation = `${location}/package.json`;
|
|
1644
|
-
console.log(` ${
|
|
1677
|
+
console.log(` ${chalk21.yellow(packageLocation)}
|
|
1645
1678
|
`);
|
|
1646
1679
|
}
|
|
1647
1680
|
return unlistedDevDependencies;
|
|
1648
1681
|
}
|
|
1649
1682
|
|
|
1650
1683
|
// src/actions/deplint/checkPackage/getUnusedDependencies.ts
|
|
1651
|
-
import
|
|
1684
|
+
import chalk22 from "chalk";
|
|
1652
1685
|
function getUnusedDependencies({ name, location }, { dependencies }, {
|
|
1653
1686
|
externalDistImports,
|
|
1654
1687
|
externalDistTypeImports,
|
|
@@ -1660,22 +1693,22 @@ function getUnusedDependencies({ name, location }, { dependencies }, {
|
|
|
1660
1693
|
if (!externalDistImports.includes(dep) && !externalDistImports.includes(dep.replace(/^@types\//, "")) && !externalDistTypeImports.includes(dep) && !externalDistTypeImports.includes(dep.replace(/^@types\//, ""))) {
|
|
1661
1694
|
unusedDependencies++;
|
|
1662
1695
|
if (externalAllImports.includes(dep)) {
|
|
1663
|
-
console.log(`[${
|
|
1696
|
+
console.log(`[${chalk22.blue(name)}] dependency should be devDependency in package.json: ${chalk22.red(dep)}`);
|
|
1664
1697
|
} else {
|
|
1665
|
-
console.log(`[${
|
|
1698
|
+
console.log(`[${chalk22.blue(name)}] Unused dependency in package.json: ${chalk22.red(dep)}`);
|
|
1666
1699
|
}
|
|
1667
1700
|
}
|
|
1668
1701
|
}
|
|
1669
1702
|
if (unusedDependencies > 0) {
|
|
1670
1703
|
const packageLocation = `${location}/package.json`;
|
|
1671
|
-
console.log(` ${
|
|
1704
|
+
console.log(` ${chalk22.yellow(packageLocation)}
|
|
1672
1705
|
`);
|
|
1673
1706
|
}
|
|
1674
1707
|
return unusedDependencies;
|
|
1675
1708
|
}
|
|
1676
1709
|
|
|
1677
1710
|
// src/actions/deplint/checkPackage/getUnusedDevDependencies.ts
|
|
1678
|
-
import
|
|
1711
|
+
import chalk23 from "chalk";
|
|
1679
1712
|
|
|
1680
1713
|
// src/actions/deplint/getCliReferencedPackagesFromFiles.ts
|
|
1681
1714
|
import fs8 from "fs";
|
|
@@ -1959,19 +1992,19 @@ function getUnusedDevDependencies({ name, location }, {
|
|
|
1959
1992
|
if (dependencies.includes(dep) || peerDependencies.includes(dep)) continue;
|
|
1960
1993
|
if (!isDevDepUsed(dep, allImports, implicitDeps, requiredPeers, scriptRefs, cliRefs)) {
|
|
1961
1994
|
unusedDevDependencies++;
|
|
1962
|
-
console.log(`[${
|
|
1995
|
+
console.log(`[${chalk23.blue(name)}] Unused devDependency in package.json: ${chalk23.red(dep)}`);
|
|
1963
1996
|
}
|
|
1964
1997
|
}
|
|
1965
1998
|
if (unusedDevDependencies > 0) {
|
|
1966
1999
|
const packageLocation = `${location}/package.json`;
|
|
1967
|
-
console.log(` ${
|
|
2000
|
+
console.log(` ${chalk23.yellow(packageLocation)}
|
|
1968
2001
|
`);
|
|
1969
2002
|
}
|
|
1970
2003
|
return unusedDevDependencies;
|
|
1971
2004
|
}
|
|
1972
2005
|
|
|
1973
2006
|
// src/actions/deplint/checkPackage/getUnusedPeerDependencies.ts
|
|
1974
|
-
import
|
|
2007
|
+
import chalk24 from "chalk";
|
|
1975
2008
|
function getUnusedPeerDependencies({ name, location }, { peerDependencies, dependencies }, { externalDistImports, externalDistTypeImports }, exclude) {
|
|
1976
2009
|
let unusedDependencies = 0;
|
|
1977
2010
|
for (const dep of peerDependencies) {
|
|
@@ -1979,15 +2012,15 @@ function getUnusedPeerDependencies({ name, location }, { peerDependencies, depen
|
|
|
1979
2012
|
if (!externalDistImports.includes(dep) && !externalDistImports.includes(dep.replace(/^@types\//, "")) && !externalDistTypeImports.includes(dep) && !externalDistTypeImports.includes(dep.replace(/^@types\//, ""))) {
|
|
1980
2013
|
unusedDependencies++;
|
|
1981
2014
|
if (dependencies.includes(dep)) {
|
|
1982
|
-
console.log(`[${
|
|
2015
|
+
console.log(`[${chalk24.blue(name)}] Unused peerDependency [already a dependency] in package.json: ${chalk24.red(dep)}`);
|
|
1983
2016
|
} else {
|
|
1984
|
-
console.log(`[${
|
|
2017
|
+
console.log(`[${chalk24.blue(name)}] Unused peerDependency in package.json: ${chalk24.red(dep)}`);
|
|
1985
2018
|
}
|
|
1986
2019
|
}
|
|
1987
2020
|
}
|
|
1988
2021
|
if (unusedDependencies > 0) {
|
|
1989
2022
|
const packageLocation = `${location}/package.json`;
|
|
1990
|
-
console.log(` ${
|
|
2023
|
+
console.log(` ${chalk24.yellow(packageLocation)}
|
|
1991
2024
|
`);
|
|
1992
2025
|
}
|
|
1993
2026
|
return unusedDependencies;
|
|
@@ -2082,19 +2115,19 @@ var deplint = async ({
|
|
|
2082
2115
|
});
|
|
2083
2116
|
}
|
|
2084
2117
|
if (totalErrors > 0) {
|
|
2085
|
-
console.warn(`Deplint: Found ${
|
|
2118
|
+
console.warn(`Deplint: Found ${chalk25.red(totalErrors)} dependency problems. ${chalk25.red("\u2716")}`);
|
|
2086
2119
|
} else {
|
|
2087
|
-
console.info(`Deplint: Found no dependency problems. ${
|
|
2120
|
+
console.info(`Deplint: Found no dependency problems. ${chalk25.green("\u2714")}`);
|
|
2088
2121
|
}
|
|
2089
2122
|
return 0;
|
|
2090
2123
|
};
|
|
2091
2124
|
|
|
2092
2125
|
// src/actions/deploy.ts
|
|
2093
|
-
import { readFileSync as
|
|
2126
|
+
import { readFileSync as readFileSync12 } from "fs";
|
|
2094
2127
|
var privatePackageExcludeList = () => {
|
|
2095
2128
|
const possibleDeployablePackages = yarnWorkspaces().map((workspace) => [
|
|
2096
2129
|
workspace,
|
|
2097
|
-
JSON.parse(
|
|
2130
|
+
JSON.parse(readFileSync12(`${workspace.location}/package.json`, { encoding: "utf8" }))
|
|
2098
2131
|
]);
|
|
2099
2132
|
const privatePackages = possibleDeployablePackages.filter(([_, pkg]) => pkg.private).map(([workspace]) => workspace);
|
|
2100
2133
|
const excludeList = privatePackages.map((workspace) => `--exclude ${workspace.name}`);
|
|
@@ -2114,11 +2147,11 @@ var deploy = () => {
|
|
|
2114
2147
|
};
|
|
2115
2148
|
|
|
2116
2149
|
// src/actions/deploy-major.ts
|
|
2117
|
-
import { readFileSync as
|
|
2150
|
+
import { readFileSync as readFileSync13 } from "fs";
|
|
2118
2151
|
var privatePackageExcludeList2 = () => {
|
|
2119
2152
|
const possibleDeployablePackages = yarnWorkspaces().map((workspace) => [
|
|
2120
2153
|
workspace,
|
|
2121
|
-
JSON.parse(
|
|
2154
|
+
JSON.parse(readFileSync13(`${workspace.location}/package.json`, { encoding: "utf8" }))
|
|
2122
2155
|
]);
|
|
2123
2156
|
const privatePackages = possibleDeployablePackages.filter(([_, pkg]) => pkg.private).map(([workspace]) => workspace);
|
|
2124
2157
|
const excludeList = privatePackages.map((workspace) => `--exclude ${workspace.name}`);
|
|
@@ -2138,11 +2171,11 @@ var deployMajor = () => {
|
|
|
2138
2171
|
};
|
|
2139
2172
|
|
|
2140
2173
|
// src/actions/deploy-minor.ts
|
|
2141
|
-
import { readFileSync as
|
|
2174
|
+
import { readFileSync as readFileSync14 } from "fs";
|
|
2142
2175
|
var privatePackageExcludeList3 = () => {
|
|
2143
2176
|
const possibleDeployablePackages = yarnWorkspaces().map((workspace) => [
|
|
2144
2177
|
workspace,
|
|
2145
|
-
JSON.parse(
|
|
2178
|
+
JSON.parse(readFileSync14(`${workspace.location}/package.json`, { encoding: "utf8" }))
|
|
2146
2179
|
]);
|
|
2147
2180
|
const privatePackages = possibleDeployablePackages.filter(([_, pkg]) => pkg.private).map(([workspace]) => workspace);
|
|
2148
2181
|
const excludeList = privatePackages.map((workspace) => `--exclude ${workspace.name}`);
|
|
@@ -2162,11 +2195,11 @@ var deployMinor = () => {
|
|
|
2162
2195
|
};
|
|
2163
2196
|
|
|
2164
2197
|
// src/actions/deploy-next.ts
|
|
2165
|
-
import { readFileSync as
|
|
2198
|
+
import { readFileSync as readFileSync15 } from "fs";
|
|
2166
2199
|
var privatePackageExcludeList4 = () => {
|
|
2167
2200
|
const possibleDeployablePackages = yarnWorkspaces().map((workspace) => [
|
|
2168
2201
|
workspace,
|
|
2169
|
-
JSON.parse(
|
|
2202
|
+
JSON.parse(readFileSync15(`${workspace.location}/package.json`, { encoding: "utf8" }))
|
|
2170
2203
|
]);
|
|
2171
2204
|
const privatePackages = possibleDeployablePackages.filter(([_, pkg]) => pkg.private).map(([workspace]) => workspace);
|
|
2172
2205
|
const excludeList = privatePackages.map((workspace) => `--exclude ${workspace.name}`);
|
|
@@ -2186,9 +2219,9 @@ var deployNext = () => {
|
|
|
2186
2219
|
};
|
|
2187
2220
|
|
|
2188
2221
|
// src/actions/dupdeps.ts
|
|
2189
|
-
import
|
|
2222
|
+
import chalk26 from "chalk";
|
|
2190
2223
|
var dupdeps = () => {
|
|
2191
|
-
console.log(
|
|
2224
|
+
console.log(chalk26.green("Checking all Dependencies for Duplicates"));
|
|
2192
2225
|
const pkg = parsedPackageJSON();
|
|
2193
2226
|
const allDependencies = { ...pkg?.dependencies, ...pkg?.devDependencies };
|
|
2194
2227
|
const dependencies = Object.keys(allDependencies);
|
|
@@ -2196,13 +2229,13 @@ var dupdeps = () => {
|
|
|
2196
2229
|
};
|
|
2197
2230
|
|
|
2198
2231
|
// src/actions/lint.ts
|
|
2199
|
-
import
|
|
2232
|
+
import chalk27 from "chalk";
|
|
2200
2233
|
var lintPackage = ({
|
|
2201
2234
|
pkg,
|
|
2202
2235
|
fix: fix2,
|
|
2203
2236
|
verbose
|
|
2204
2237
|
}) => {
|
|
2205
|
-
console.log(
|
|
2238
|
+
console.log(chalk27.gray(`${fix2 ? "Fix" : "Lint"} [${pkg}]`));
|
|
2206
2239
|
const start = Date.now();
|
|
2207
2240
|
const result = runSteps(`${fix2 ? "Fix" : "Lint"} [${pkg}]`, [
|
|
2208
2241
|
["yarn", [
|
|
@@ -2212,7 +2245,7 @@ var lintPackage = ({
|
|
|
2212
2245
|
fix2 ? "package-fix" : verbose ? "package-lint-verbose" : "package-lint"
|
|
2213
2246
|
]]
|
|
2214
2247
|
]);
|
|
2215
|
-
console.log(
|
|
2248
|
+
console.log(chalk27.gray(`${fix2 ? "Fixed in" : "Linted in"} [${chalk27.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk27.gray("seconds")}`));
|
|
2216
2249
|
return result;
|
|
2217
2250
|
};
|
|
2218
2251
|
var lint = ({
|
|
@@ -2232,13 +2265,13 @@ var lint = ({
|
|
|
2232
2265
|
});
|
|
2233
2266
|
};
|
|
2234
2267
|
var lintAllPackages = ({ fix: fix2 = false } = {}) => {
|
|
2235
|
-
console.log(
|
|
2268
|
+
console.log(chalk27.gray(`${fix2 ? "Fix" : "Lint"} [All-Packages]`));
|
|
2236
2269
|
const start = Date.now();
|
|
2237
2270
|
const fixOptions = fix2 ? ["--fix"] : [];
|
|
2238
2271
|
const result = runSteps(`${fix2 ? "Fix" : "Lint"} [All-Packages]`, [
|
|
2239
2272
|
["yarn", ["eslint", "--cache", "--cache-location", ".eslintcache", "--cache-strategy", "content", ...fixOptions]]
|
|
2240
2273
|
]);
|
|
2241
|
-
console.log(
|
|
2274
|
+
console.log(chalk27.gray(`${fix2 ? "Fixed in" : "Linted in"} [${chalk27.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk27.gray("seconds")}`));
|
|
2242
2275
|
return result;
|
|
2243
2276
|
};
|
|
2244
2277
|
|
|
@@ -2263,7 +2296,7 @@ var genDocsAll = ({ incremental }) => {
|
|
|
2263
2296
|
|
|
2264
2297
|
// src/actions/gitignore.ts
|
|
2265
2298
|
import { unlinkSync as unlinkSync4 } from "fs";
|
|
2266
|
-
import
|
|
2299
|
+
import chalk28 from "chalk";
|
|
2267
2300
|
var COMMENT_PREFIX = "#";
|
|
2268
2301
|
var isComment = (line) => line.startsWith(COMMENT_PREFIX);
|
|
2269
2302
|
var isNegation = (line) => line.startsWith("!");
|
|
@@ -2320,7 +2353,7 @@ function removePackageGitignores(cwd5) {
|
|
|
2320
2353
|
const filePath = `${cwd5}/${location}/.gitignore`;
|
|
2321
2354
|
try {
|
|
2322
2355
|
unlinkSync4(filePath);
|
|
2323
|
-
console.log(
|
|
2356
|
+
console.log(chalk28.yellow(` Removed ${location}/.gitignore`));
|
|
2324
2357
|
removed++;
|
|
2325
2358
|
} catch {
|
|
2326
2359
|
}
|
|
@@ -2329,7 +2362,7 @@ function removePackageGitignores(cwd5) {
|
|
|
2329
2362
|
}
|
|
2330
2363
|
var gitignoreGen = gitignore;
|
|
2331
2364
|
function gitignore() {
|
|
2332
|
-
console.log(
|
|
2365
|
+
console.log(chalk28.green("Generate .gitignore"));
|
|
2333
2366
|
const cwd5 = INIT_CWD() ?? ".";
|
|
2334
2367
|
const gitignorePath = `${cwd5}/.gitignore`;
|
|
2335
2368
|
try {
|
|
@@ -2337,21 +2370,21 @@ function gitignore() {
|
|
|
2337
2370
|
const existing = readNonEmptyLines(gitignorePath);
|
|
2338
2371
|
const merged = mergeWithTemplate(existing, templateContent);
|
|
2339
2372
|
writeLines(gitignorePath, merged);
|
|
2340
|
-
console.log(
|
|
2373
|
+
console.log(chalk28.green(" Root .gitignore updated"));
|
|
2341
2374
|
const removed = removePackageGitignores(cwd5);
|
|
2342
2375
|
if (removed > 0) {
|
|
2343
|
-
console.log(
|
|
2376
|
+
console.log(chalk28.green(` Removed ${removed} package .gitignore file(s)`));
|
|
2344
2377
|
}
|
|
2345
2378
|
return 0;
|
|
2346
2379
|
} catch (ex) {
|
|
2347
2380
|
const error = ex;
|
|
2348
|
-
console.error(
|
|
2381
|
+
console.error(chalk28.red(`Generate .gitignore failed: ${error.message}`));
|
|
2349
2382
|
return 1;
|
|
2350
2383
|
}
|
|
2351
2384
|
}
|
|
2352
2385
|
|
|
2353
2386
|
// src/actions/gitlint.ts
|
|
2354
|
-
import
|
|
2387
|
+
import chalk29 from "chalk";
|
|
2355
2388
|
import ParseGitConfig from "parse-git-config";
|
|
2356
2389
|
var gitlint = () => {
|
|
2357
2390
|
console.log(`
|
|
@@ -2362,7 +2395,7 @@ Gitlint Start [${process.cwd()}]
|
|
|
2362
2395
|
const errors = 0;
|
|
2363
2396
|
const gitConfig = ParseGitConfig.sync();
|
|
2364
2397
|
const warn = (message) => {
|
|
2365
|
-
console.warn(
|
|
2398
|
+
console.warn(chalk29.yellow(`Warning: ${message}`));
|
|
2366
2399
|
warnings++;
|
|
2367
2400
|
};
|
|
2368
2401
|
if (gitConfig.core.ignorecase) {
|
|
@@ -2382,13 +2415,13 @@ Gitlint Start [${process.cwd()}]
|
|
|
2382
2415
|
}
|
|
2383
2416
|
const resultMessages = [];
|
|
2384
2417
|
if (valid > 0) {
|
|
2385
|
-
resultMessages.push(
|
|
2418
|
+
resultMessages.push(chalk29.green(`Passed: ${valid}`));
|
|
2386
2419
|
}
|
|
2387
2420
|
if (warnings > 0) {
|
|
2388
|
-
resultMessages.push(
|
|
2421
|
+
resultMessages.push(chalk29.yellow(`Warnings: ${warnings}`));
|
|
2389
2422
|
}
|
|
2390
2423
|
if (errors > 0) {
|
|
2391
|
-
resultMessages.push(
|
|
2424
|
+
resultMessages.push(chalk29.red(` Errors: ${errors}`));
|
|
2392
2425
|
}
|
|
2393
2426
|
console.warn(`Gitlint Finish [ ${resultMessages.join(" | ")} ]
|
|
2394
2427
|
`);
|
|
@@ -2397,7 +2430,7 @@ Gitlint Start [${process.cwd()}]
|
|
|
2397
2430
|
|
|
2398
2431
|
// src/actions/gitlint-fix.ts
|
|
2399
2432
|
import { execSync as execSync3 } from "child_process";
|
|
2400
|
-
import
|
|
2433
|
+
import chalk30 from "chalk";
|
|
2401
2434
|
import ParseGitConfig2 from "parse-git-config";
|
|
2402
2435
|
var gitlintFix = () => {
|
|
2403
2436
|
console.log(`
|
|
@@ -2406,15 +2439,15 @@ Gitlint Fix Start [${process.cwd()}]
|
|
|
2406
2439
|
const gitConfig = ParseGitConfig2.sync();
|
|
2407
2440
|
if (gitConfig.core.ignorecase) {
|
|
2408
2441
|
execSync3("git config core.ignorecase false", { stdio: "inherit" });
|
|
2409
|
-
console.warn(
|
|
2442
|
+
console.warn(chalk30.yellow("\nGitlint Fix: Updated core.ignorecase to be false\n"));
|
|
2410
2443
|
}
|
|
2411
2444
|
if (gitConfig.core.autocrlf !== false) {
|
|
2412
2445
|
execSync3("git config core.autocrlf false", { stdio: "inherit" });
|
|
2413
|
-
console.warn(
|
|
2446
|
+
console.warn(chalk30.yellow("\nGitlint Fix: Updated core.autocrlf to be false\n"));
|
|
2414
2447
|
}
|
|
2415
2448
|
if (gitConfig.core.eol !== "lf") {
|
|
2416
2449
|
execSync3("git config core.eol lf", { stdio: "inherit" });
|
|
2417
|
-
console.warn(
|
|
2450
|
+
console.warn(chalk30.yellow('\nGitlint Fix: Updated core.eol to be "lf"\n'));
|
|
2418
2451
|
}
|
|
2419
2452
|
return 1;
|
|
2420
2453
|
};
|
|
@@ -2425,7 +2458,7 @@ var knip = () => {
|
|
|
2425
2458
|
};
|
|
2426
2459
|
|
|
2427
2460
|
// src/actions/license.ts
|
|
2428
|
-
import
|
|
2461
|
+
import chalk31 from "chalk";
|
|
2429
2462
|
import { init } from "license-checker";
|
|
2430
2463
|
var license = async (pkg) => {
|
|
2431
2464
|
const workspaces = yarnWorkspaces();
|
|
@@ -2450,18 +2483,18 @@ var license = async (pkg) => {
|
|
|
2450
2483
|
"LGPL-3.0-or-later",
|
|
2451
2484
|
"Python-2.0"
|
|
2452
2485
|
]);
|
|
2453
|
-
console.log(
|
|
2486
|
+
console.log(chalk31.green("License Checker"));
|
|
2454
2487
|
return (await Promise.all(
|
|
2455
2488
|
workspaceList.map(({ location, name }) => {
|
|
2456
2489
|
return new Promise((resolve) => {
|
|
2457
2490
|
init({ production: true, start: location }, (error, packages) => {
|
|
2458
2491
|
if (error) {
|
|
2459
|
-
console.error(
|
|
2460
|
-
console.error(
|
|
2492
|
+
console.error(chalk31.red(`License Checker [${name}] Error`));
|
|
2493
|
+
console.error(chalk31.gray(error));
|
|
2461
2494
|
console.log("\n");
|
|
2462
2495
|
resolve(1);
|
|
2463
2496
|
} else {
|
|
2464
|
-
console.log(
|
|
2497
|
+
console.log(chalk31.green(`License Checker [${name}]`));
|
|
2465
2498
|
let count = 0;
|
|
2466
2499
|
for (const [name2, info] of Object.entries(packages)) {
|
|
2467
2500
|
const licenses = Array.isArray(info.licenses) ? info.licenses : [info.licenses];
|
|
@@ -2477,7 +2510,7 @@ var license = async (pkg) => {
|
|
|
2477
2510
|
}
|
|
2478
2511
|
if (!orLicenseFound) {
|
|
2479
2512
|
count++;
|
|
2480
|
-
console.warn(
|
|
2513
|
+
console.warn(chalk31.yellow(`${name2}: Package License not allowed [${license2}]`));
|
|
2481
2514
|
}
|
|
2482
2515
|
}
|
|
2483
2516
|
}
|
|
@@ -2497,12 +2530,12 @@ var npmignoreGen = (pkg) => generateIgnoreFiles(filename, pkg);
|
|
|
2497
2530
|
|
|
2498
2531
|
// src/actions/package/clean-outputs.ts
|
|
2499
2532
|
import path8 from "path";
|
|
2500
|
-
import
|
|
2533
|
+
import chalk32 from "chalk";
|
|
2501
2534
|
var packageCleanOutputs = () => {
|
|
2502
2535
|
const pkg = process.env.INIT_CWD ?? ".";
|
|
2503
2536
|
const pkgName = process.env.npm_package_name;
|
|
2504
2537
|
const folders = [path8.join(pkg, "dist"), path8.join(pkg, "build"), path8.join(pkg, "docs")];
|
|
2505
|
-
console.log(
|
|
2538
|
+
console.log(chalk32.green(`Cleaning Outputs [${pkgName}]`));
|
|
2506
2539
|
for (let folder of folders) {
|
|
2507
2540
|
deleteGlob(folder);
|
|
2508
2541
|
}
|
|
@@ -2511,11 +2544,11 @@ var packageCleanOutputs = () => {
|
|
|
2511
2544
|
|
|
2512
2545
|
// src/actions/package/clean-typescript.ts
|
|
2513
2546
|
import path9 from "path";
|
|
2514
|
-
import
|
|
2547
|
+
import chalk33 from "chalk";
|
|
2515
2548
|
var packageCleanTypescript = () => {
|
|
2516
2549
|
const pkg = process.env.INIT_CWD ?? ".";
|
|
2517
2550
|
const pkgName = process.env.npm_package_name;
|
|
2518
|
-
console.log(
|
|
2551
|
+
console.log(chalk33.green(`Cleaning Typescript [${pkgName}]`));
|
|
2519
2552
|
const files = [path9.join(pkg, "*.tsbuildinfo"), path9.join(pkg, ".tsconfig.*"), path9.join(pkg, ".eslintcache")];
|
|
2520
2553
|
for (let file of files) {
|
|
2521
2554
|
deleteGlob(file);
|
|
@@ -2529,26 +2562,26 @@ var packageClean = async () => {
|
|
|
2529
2562
|
};
|
|
2530
2563
|
|
|
2531
2564
|
// src/actions/package/compile/compile.ts
|
|
2532
|
-
import
|
|
2565
|
+
import chalk38 from "chalk";
|
|
2533
2566
|
|
|
2534
2567
|
// src/actions/package/compile/packageCompileTsup.ts
|
|
2535
|
-
import
|
|
2568
|
+
import chalk37 from "chalk";
|
|
2536
2569
|
import { build as build2, defineConfig } from "tsup";
|
|
2537
2570
|
|
|
2538
2571
|
// src/actions/package/compile/inputs.ts
|
|
2539
|
-
import
|
|
2572
|
+
import chalk34 from "chalk";
|
|
2540
2573
|
import { glob as glob2 } from "glob";
|
|
2541
2574
|
var getAllInputs = (srcDir, verbose = false) => {
|
|
2542
2575
|
return [...glob2.sync(`${srcDir}/**/*.ts`, { posix: true }).map((file) => {
|
|
2543
2576
|
const result = file.slice(Math.max(0, srcDir.length + 1));
|
|
2544
2577
|
if (verbose) {
|
|
2545
|
-
console.log(
|
|
2578
|
+
console.log(chalk34.gray(`getAllInputs: ${JSON.stringify(result, null, 2)}`));
|
|
2546
2579
|
}
|
|
2547
2580
|
return result;
|
|
2548
2581
|
}), ...glob2.sync(`${srcDir}/**/*.tsx`, { posix: true }).map((file) => {
|
|
2549
2582
|
const result = file.slice(Math.max(0, srcDir.length + 1));
|
|
2550
2583
|
if (verbose) {
|
|
2551
|
-
console.log(
|
|
2584
|
+
console.log(chalk34.gray(`getAllInputs: ${JSON.stringify(result, null, 2)}`));
|
|
2552
2585
|
}
|
|
2553
2586
|
return result;
|
|
2554
2587
|
})];
|
|
@@ -2610,7 +2643,7 @@ function deepMergeObjects(objects) {
|
|
|
2610
2643
|
|
|
2611
2644
|
// src/actions/package/compile/packageCompileTsc.ts
|
|
2612
2645
|
import { cwd as cwd2 } from "process";
|
|
2613
|
-
import
|
|
2646
|
+
import chalk35 from "chalk";
|
|
2614
2647
|
import { createProgramFromConfig } from "tsc-prog";
|
|
2615
2648
|
import ts3, {
|
|
2616
2649
|
DiagnosticCategory,
|
|
@@ -2632,7 +2665,7 @@ var getCompilerOptions = (options = {}, fileName = "tsconfig.json") => {
|
|
|
2632
2665
|
var packageCompileTsc = (platform, entries, srcDir = "src", outDir = "dist", compilerOptionsParam, verbose = false) => {
|
|
2633
2666
|
const pkg = process.env.INIT_CWD ?? cwd2();
|
|
2634
2667
|
if (verbose) {
|
|
2635
|
-
console.log(
|
|
2668
|
+
console.log(chalk35.cyan(`Validating code START: ${entries.length} files to ${outDir} from ${srcDir}`));
|
|
2636
2669
|
}
|
|
2637
2670
|
const configFilePath = ts3.findConfigFile(
|
|
2638
2671
|
"./",
|
|
@@ -2655,10 +2688,10 @@ var packageCompileTsc = (platform, entries, srcDir = "src", outDir = "dist", com
|
|
|
2655
2688
|
emitDeclarationOnly: true,
|
|
2656
2689
|
noEmit: false
|
|
2657
2690
|
};
|
|
2658
|
-
console.log(
|
|
2691
|
+
console.log(chalk35.cyan(`Validating Files: ${entries.length}`));
|
|
2659
2692
|
if (verbose) {
|
|
2660
2693
|
for (const entry of entries) {
|
|
2661
|
-
console.log(
|
|
2694
|
+
console.log(chalk35.grey(`Validating: ${entry}`));
|
|
2662
2695
|
}
|
|
2663
2696
|
}
|
|
2664
2697
|
try {
|
|
@@ -2694,7 +2727,7 @@ var packageCompileTsc = (platform, entries, srcDir = "src", outDir = "dist", com
|
|
|
2694
2727
|
return 0;
|
|
2695
2728
|
} finally {
|
|
2696
2729
|
if (verbose) {
|
|
2697
|
-
console.log(
|
|
2730
|
+
console.log(chalk35.cyan(`Validating code FINISH: ${entries.length} files to ${outDir} from ${srcDir}`));
|
|
2698
2731
|
}
|
|
2699
2732
|
}
|
|
2700
2733
|
};
|
|
@@ -2702,7 +2735,7 @@ var packageCompileTsc = (platform, entries, srcDir = "src", outDir = "dist", com
|
|
|
2702
2735
|
// src/actions/package/compile/packageCompileTscTypes.ts
|
|
2703
2736
|
import path10 from "path";
|
|
2704
2737
|
import { cwd as cwd3 } from "process";
|
|
2705
|
-
import
|
|
2738
|
+
import chalk36 from "chalk";
|
|
2706
2739
|
import { rollup } from "rollup";
|
|
2707
2740
|
import dts from "rollup-plugin-dts";
|
|
2708
2741
|
import nodeExternals from "rollup-plugin-node-externals";
|
|
@@ -2727,8 +2760,8 @@ async function bundleDts(inputPath, outputPath, platform, options, verbose = fal
|
|
|
2727
2760
|
if (ignoredWarningCodes.has(warning.code ?? "")) {
|
|
2728
2761
|
return;
|
|
2729
2762
|
}
|
|
2730
|
-
console.warn(
|
|
2731
|
-
console.warn(
|
|
2763
|
+
console.warn(chalk36.yellow(`[${warning.code}] ${warning.message}`));
|
|
2764
|
+
console.warn(chalk36.gray(inputPath));
|
|
2732
2765
|
warn(warning);
|
|
2733
2766
|
}
|
|
2734
2767
|
});
|
|
@@ -2738,8 +2771,8 @@ async function bundleDts(inputPath, outputPath, platform, options, verbose = fal
|
|
|
2738
2771
|
});
|
|
2739
2772
|
} catch (ex) {
|
|
2740
2773
|
const error = ex;
|
|
2741
|
-
console.warn(
|
|
2742
|
-
console.warn(
|
|
2774
|
+
console.warn(chalk36.red(error));
|
|
2775
|
+
console.warn(chalk36.gray(inputPath));
|
|
2743
2776
|
}
|
|
2744
2777
|
if (verbose) {
|
|
2745
2778
|
console.log(`Bundled declarations written to ${outputPath}`);
|
|
@@ -2747,7 +2780,7 @@ async function bundleDts(inputPath, outputPath, platform, options, verbose = fal
|
|
|
2747
2780
|
}
|
|
2748
2781
|
var packageCompileTscTypes = async (entries, outDir, platform, srcDir = "build", verbose = false) => {
|
|
2749
2782
|
if (verbose) {
|
|
2750
|
-
console.log(
|
|
2783
|
+
console.log(chalk36.cyan(`Compiling Types START [${platform}]: ${entries.length} files to ${outDir} from ${srcDir}`));
|
|
2751
2784
|
console.log(`Entries: ${entries.join(", ")}`);
|
|
2752
2785
|
}
|
|
2753
2786
|
const pkg = process.env.INIT_CWD ?? cwd3();
|
|
@@ -2771,7 +2804,7 @@ var packageCompileTscTypes = async (entries, outDir, platform, srcDir = "build",
|
|
|
2771
2804
|
await bundleDts(`${srcRoot}/${entryTypeName}`, `${outDir}/${entryTypeName}`, platform, { compilerOptions }, verbose);
|
|
2772
2805
|
}));
|
|
2773
2806
|
if (verbose) {
|
|
2774
|
-
console.log(
|
|
2807
|
+
console.log(chalk36.cyan(`Compiling Types FINISH: ${entries.length} files to ${outDir} from ${srcDir}`));
|
|
2775
2808
|
}
|
|
2776
2809
|
return 0;
|
|
2777
2810
|
};
|
|
@@ -2783,15 +2816,15 @@ var compileFolder = async (srcDir, entries, buildDir, options, bundleTypes = fal
|
|
|
2783
2816
|
console.log(`compileFolder [${srcDir}, ${options?.outDir}]`);
|
|
2784
2817
|
}
|
|
2785
2818
|
if (entries.length === 0) {
|
|
2786
|
-
console.warn(
|
|
2819
|
+
console.warn(chalk37.yellow(`No entries found in ${srcDir} to compile`));
|
|
2787
2820
|
return 0;
|
|
2788
2821
|
}
|
|
2789
2822
|
if (verbose) {
|
|
2790
|
-
console.log(
|
|
2823
|
+
console.log(chalk37.gray(`buildDir [${buildDir}]`));
|
|
2791
2824
|
}
|
|
2792
2825
|
const validationResult = packageCompileTsc(options?.platform ?? "neutral", entries, srcDir, buildDir, void 0, verbose);
|
|
2793
2826
|
if (validationResult !== 0) {
|
|
2794
|
-
console.error(
|
|
2827
|
+
console.error(chalk37.red(`Compile:Validation had ${validationResult} errors`));
|
|
2795
2828
|
return validationResult;
|
|
2796
2829
|
}
|
|
2797
2830
|
const optionsParams = tsupOptions([{
|
|
@@ -2816,12 +2849,12 @@ var compileFolder = async (srcDir, entries, buildDir, options, bundleTypes = fal
|
|
|
2816
2849
|
})
|
|
2817
2850
|
)).flat();
|
|
2818
2851
|
if (verbose) {
|
|
2819
|
-
console.log(
|
|
2820
|
-
console.log(
|
|
2852
|
+
console.log(chalk37.cyan(`TSUP:build:start [${srcDir}]`));
|
|
2853
|
+
console.log(chalk37.gray(`TSUP:build:options [${JSON.stringify(optionsList, null, 2)}]`));
|
|
2821
2854
|
}
|
|
2822
2855
|
await Promise.all(optionsList.map((options2) => build2(options2)));
|
|
2823
2856
|
if (verbose) {
|
|
2824
|
-
console.log(
|
|
2857
|
+
console.log(chalk37.cyan(`TSUP:build:stop [${srcDir}]`));
|
|
2825
2858
|
}
|
|
2826
2859
|
if (bundleTypes) {
|
|
2827
2860
|
await packageCompileTscTypes(entries, outDir, options?.platform ?? "neutral", buildDir, verbose);
|
|
@@ -2932,14 +2965,14 @@ var packageCompileTsup = async (config2) => {
|
|
|
2932
2965
|
// src/actions/package/compile/compile.ts
|
|
2933
2966
|
var packageCompile = async (inConfig = {}) => {
|
|
2934
2967
|
const pkg = process.env.INIT_CWD;
|
|
2935
|
-
console.log(
|
|
2968
|
+
console.log(chalk38.green(`Compiling ${pkg}`));
|
|
2936
2969
|
const config2 = await loadConfig(inConfig);
|
|
2937
2970
|
return await packageCompileTsup(config2);
|
|
2938
2971
|
};
|
|
2939
2972
|
|
|
2940
2973
|
// src/actions/package/copy-assets.ts
|
|
2941
2974
|
import path11 from "path/posix";
|
|
2942
|
-
import
|
|
2975
|
+
import chalk39 from "chalk";
|
|
2943
2976
|
import cpy2 from "cpy";
|
|
2944
2977
|
var copyTargetAssets2 = async (target, name, location) => {
|
|
2945
2978
|
try {
|
|
@@ -2952,7 +2985,7 @@ var copyTargetAssets2 = async (target, name, location) => {
|
|
|
2952
2985
|
}
|
|
2953
2986
|
);
|
|
2954
2987
|
if (values.length > 0) {
|
|
2955
|
-
console.log(
|
|
2988
|
+
console.log(chalk39.green(`Copying Assets [${target.toUpperCase()}] - ${name} - ${location}`));
|
|
2956
2989
|
}
|
|
2957
2990
|
for (const value of values) {
|
|
2958
2991
|
console.log(`${value.split("/").pop()} => ./dist/${target}`);
|
|
@@ -3019,7 +3052,7 @@ var packageCycle = async () => {
|
|
|
3019
3052
|
// src/actions/package/gen-docs.ts
|
|
3020
3053
|
import { existsSync as existsSync10 } from "fs";
|
|
3021
3054
|
import path12 from "path";
|
|
3022
|
-
import
|
|
3055
|
+
import chalk40 from "chalk";
|
|
3023
3056
|
import {
|
|
3024
3057
|
Application,
|
|
3025
3058
|
ArgumentsReader,
|
|
@@ -3123,7 +3156,7 @@ var runTypeDoc = async (app) => {
|
|
|
3123
3156
|
return ExitCodes.OutputError;
|
|
3124
3157
|
}
|
|
3125
3158
|
}
|
|
3126
|
-
console.log(
|
|
3159
|
+
console.log(chalk40.green(`${pkgName} - Ok`));
|
|
3127
3160
|
return ExitCodes.Ok;
|
|
3128
3161
|
};
|
|
3129
3162
|
|
|
@@ -3132,7 +3165,7 @@ import { readdirSync as readdirSync6 } from "fs";
|
|
|
3132
3165
|
import path13 from "path";
|
|
3133
3166
|
import { cwd as cwd4 } from "process";
|
|
3134
3167
|
import { pathToFileURL } from "url";
|
|
3135
|
-
import
|
|
3168
|
+
import chalk41 from "chalk";
|
|
3136
3169
|
import { ESLint } from "eslint";
|
|
3137
3170
|
import { findUp } from "find-up";
|
|
3138
3171
|
import picomatch from "picomatch";
|
|
@@ -3141,14 +3174,14 @@ var dumpMessages = (lintResults) => {
|
|
|
3141
3174
|
const severity = ["none", "warning", "error"];
|
|
3142
3175
|
for (const lintResult of lintResults) {
|
|
3143
3176
|
if (lintResult.messages.length > 0) {
|
|
3144
|
-
console.log(
|
|
3177
|
+
console.log(chalk41.gray(`
|
|
3145
3178
|
${lintResult.filePath}`));
|
|
3146
3179
|
for (const message of lintResult.messages) {
|
|
3147
3180
|
console.log(
|
|
3148
|
-
|
|
3149
|
-
|
|
3150
|
-
|
|
3151
|
-
|
|
3181
|
+
chalk41.gray(` ${message.line}:${message.column}`),
|
|
3182
|
+
chalk41[colors[message.severity]](` ${severity[message.severity]}`),
|
|
3183
|
+
chalk41.white(` ${message.message}`),
|
|
3184
|
+
chalk41.gray(` ${message.ruleId}`)
|
|
3152
3185
|
);
|
|
3153
3186
|
}
|
|
3154
3187
|
}
|
|
@@ -3186,10 +3219,10 @@ var packageLint = async (fix2 = false, verbose = false, cache = true) => {
|
|
|
3186
3219
|
cache
|
|
3187
3220
|
});
|
|
3188
3221
|
const files = getFiles(cwd4(), ignoreFolders);
|
|
3189
|
-
console.log(
|
|
3222
|
+
console.log(chalk41.green(`Linting ${pkg} [files = ${files.length}]`));
|
|
3190
3223
|
if (verbose) {
|
|
3191
3224
|
for (const file of files) {
|
|
3192
|
-
console.log(
|
|
3225
|
+
console.log(chalk41.gray(` ${file}`));
|
|
3193
3226
|
}
|
|
3194
3227
|
}
|
|
3195
3228
|
const lintResults = await engine.lintFiles(files);
|
|
@@ -3200,32 +3233,32 @@ var packageLint = async (fix2 = false, verbose = false, cache = true) => {
|
|
|
3200
3233
|
const filesCountColor = files.length < 100 ? "green" : files.length < 1e3 ? "yellow" : "red";
|
|
3201
3234
|
const lintTime = Date.now() - start;
|
|
3202
3235
|
const lintTimeColor = lintTime < 1e3 ? "green" : lintTime < 3e3 ? "yellow" : "red";
|
|
3203
|
-
console.log(
|
|
3236
|
+
console.log(chalk41.white(`Linted ${chalk41[filesCountColor](files.length)} files in ${chalk41[lintTimeColor](lintTime)}ms`));
|
|
3204
3237
|
return lintResults.reduce((prev, lintResult) => prev + lintResult.errorCount, 0);
|
|
3205
3238
|
};
|
|
3206
3239
|
|
|
3207
3240
|
// src/actions/package/publint.ts
|
|
3208
3241
|
import { promises as fs10 } from "fs";
|
|
3209
|
-
import
|
|
3242
|
+
import chalk42 from "chalk";
|
|
3210
3243
|
import sortPackageJson from "sort-package-json";
|
|
3211
3244
|
var customPubLint = (pkg) => {
|
|
3212
3245
|
let errorCount = 0;
|
|
3213
3246
|
let warningCount = 0;
|
|
3214
3247
|
if (pkg.files === void 0) {
|
|
3215
|
-
console.warn(
|
|
3248
|
+
console.warn(chalk42.yellow('Publint [custom]: "files" field is missing'));
|
|
3216
3249
|
warningCount++;
|
|
3217
3250
|
}
|
|
3218
3251
|
if (pkg.main !== void 0) {
|
|
3219
|
-
console.warn(
|
|
3252
|
+
console.warn(chalk42.yellow('Publint [custom]: "main" field is deprecated, use "exports" instead'));
|
|
3220
3253
|
warningCount++;
|
|
3221
3254
|
}
|
|
3222
3255
|
if (pkg.sideEffects !== false) {
|
|
3223
|
-
console.warn(
|
|
3256
|
+
console.warn(chalk42.yellow('Publint [custom]: "sideEffects" field should be set to false'));
|
|
3224
3257
|
warningCount++;
|
|
3225
3258
|
}
|
|
3226
3259
|
if (pkg.resolutions !== void 0) {
|
|
3227
|
-
console.warn(
|
|
3228
|
-
console.warn(
|
|
3260
|
+
console.warn(chalk42.yellow('Publint [custom]: "resolutions" in use'));
|
|
3261
|
+
console.warn(chalk42.gray(JSON.stringify(pkg.resolutions, null, 2)));
|
|
3229
3262
|
warningCount++;
|
|
3230
3263
|
}
|
|
3231
3264
|
return [errorCount, warningCount];
|
|
@@ -3235,8 +3268,8 @@ var packagePublint = async ({ strict = true, verbose = false } = {}) => {
|
|
|
3235
3268
|
const sortedPkg = sortPackageJson(await fs10.readFile(`${pkgDir}/package.json`, "utf8"));
|
|
3236
3269
|
await fs10.writeFile(`${pkgDir}/package.json`, sortedPkg);
|
|
3237
3270
|
const pkg = JSON.parse(await fs10.readFile(`${pkgDir}/package.json`, "utf8"));
|
|
3238
|
-
console.log(
|
|
3239
|
-
console.log(
|
|
3271
|
+
console.log(chalk42.green(`Publint: ${pkg.name}`));
|
|
3272
|
+
console.log(chalk42.gray(pkgDir));
|
|
3240
3273
|
const { publint: publint2 } = await import("publint");
|
|
3241
3274
|
const { messages } = await publint2({
|
|
3242
3275
|
level: "suggestion",
|
|
@@ -3247,22 +3280,22 @@ var packagePublint = async ({ strict = true, verbose = false } = {}) => {
|
|
|
3247
3280
|
for (const message of messages) {
|
|
3248
3281
|
switch (message.type) {
|
|
3249
3282
|
case "error": {
|
|
3250
|
-
console.error(
|
|
3283
|
+
console.error(chalk42.red(`[${message.code}] ${formatMessage(message, pkg)}`));
|
|
3251
3284
|
break;
|
|
3252
3285
|
}
|
|
3253
3286
|
case "warning": {
|
|
3254
|
-
console.warn(
|
|
3287
|
+
console.warn(chalk42.yellow(`[${message.code}] ${formatMessage(message, pkg)}`));
|
|
3255
3288
|
break;
|
|
3256
3289
|
}
|
|
3257
3290
|
default: {
|
|
3258
|
-
console.log(
|
|
3291
|
+
console.log(chalk42.white(`[${message.code}] ${formatMessage(message, pkg)}`));
|
|
3259
3292
|
break;
|
|
3260
3293
|
}
|
|
3261
3294
|
}
|
|
3262
3295
|
}
|
|
3263
3296
|
const [errorCount, warningCount] = customPubLint(pkg);
|
|
3264
3297
|
if (verbose) {
|
|
3265
|
-
console.log(
|
|
3298
|
+
console.log(chalk42.gray(`Publint [Finish]: ${pkgDir} [${messages.length + errorCount + warningCount} messages]`));
|
|
3266
3299
|
}
|
|
3267
3300
|
return messages.filter((message) => message.type === "error").length + errorCount;
|
|
3268
3301
|
};
|
|
@@ -3273,9 +3306,9 @@ var packageRecompile = async () => {
|
|
|
3273
3306
|
};
|
|
3274
3307
|
|
|
3275
3308
|
// src/actions/package-lint.ts
|
|
3276
|
-
import { readFileSync as
|
|
3277
|
-
import
|
|
3278
|
-
import
|
|
3309
|
+
import { readFileSync as readFileSync16, writeFileSync as writeFileSync6 } from "fs";
|
|
3310
|
+
import PATH10 from "path";
|
|
3311
|
+
import chalk43 from "chalk";
|
|
3279
3312
|
import picomatch2 from "picomatch";
|
|
3280
3313
|
function emptyResult() {
|
|
3281
3314
|
return {
|
|
@@ -3285,11 +3318,11 @@ function emptyResult() {
|
|
|
3285
3318
|
};
|
|
3286
3319
|
}
|
|
3287
3320
|
function readRootPackageJson(cwd5) {
|
|
3288
|
-
const raw =
|
|
3321
|
+
const raw = readFileSync16(PATH10.resolve(cwd5, "package.json"), "utf8");
|
|
3289
3322
|
return JSON.parse(raw);
|
|
3290
3323
|
}
|
|
3291
3324
|
function writeRootPackageJson(cwd5, pkg) {
|
|
3292
|
-
const path14 =
|
|
3325
|
+
const path14 = PATH10.resolve(cwd5, "package.json");
|
|
3293
3326
|
writeFileSync6(path14, `${JSON.stringify(pkg, null, 2)}
|
|
3294
3327
|
`, "utf8");
|
|
3295
3328
|
}
|
|
@@ -3317,7 +3350,7 @@ function checkRootPrivate(pkg) {
|
|
|
3317
3350
|
function fixRootPrivate(cwd5, pkg) {
|
|
3318
3351
|
pkg.private = true;
|
|
3319
3352
|
writeRootPackageJson(cwd5, pkg);
|
|
3320
|
-
console.log(
|
|
3353
|
+
console.log(chalk43.green(' \u2714 Fixed: set "private": true in root package.json'));
|
|
3321
3354
|
}
|
|
3322
3355
|
function checkNoPublishConfigOnPrivate(pkg) {
|
|
3323
3356
|
const result = emptyResult();
|
|
@@ -3329,7 +3362,7 @@ function checkNoPublishConfigOnPrivate(pkg) {
|
|
|
3329
3362
|
function fixNoPublishConfigOnPrivate(cwd5, pkg) {
|
|
3330
3363
|
delete pkg.publishConfig;
|
|
3331
3364
|
writeRootPackageJson(cwd5, pkg);
|
|
3332
|
-
console.log(
|
|
3365
|
+
console.log(chalk43.green(" \u2714 Fixed: removed publishConfig from private root package.json"));
|
|
3333
3366
|
}
|
|
3334
3367
|
function checkDiscoverable(pkg, workspaces) {
|
|
3335
3368
|
const result = emptyResult();
|
|
@@ -3348,22 +3381,22 @@ function logResults(label, result, fix2) {
|
|
|
3348
3381
|
let errors = 0;
|
|
3349
3382
|
let fixed = 0;
|
|
3350
3383
|
for (const error of result.errors) {
|
|
3351
|
-
console.log(
|
|
3384
|
+
console.log(chalk43.red(` \u2717 ${error}`));
|
|
3352
3385
|
errors++;
|
|
3353
3386
|
}
|
|
3354
3387
|
for (const fixable of result.fixable) {
|
|
3355
3388
|
if (fix2) {
|
|
3356
3389
|
fixed++;
|
|
3357
3390
|
} else {
|
|
3358
|
-
console.log(
|
|
3391
|
+
console.log(chalk43.red(` \u2717 ${fixable} (fixable)`));
|
|
3359
3392
|
errors++;
|
|
3360
3393
|
}
|
|
3361
3394
|
}
|
|
3362
3395
|
for (const warning of result.warnings) {
|
|
3363
|
-
console.log(
|
|
3396
|
+
console.log(chalk43.yellow(` \u26A0 ${warning}`));
|
|
3364
3397
|
}
|
|
3365
3398
|
if (errors === 0 && fixed === 0 && result.warnings.length === 0) {
|
|
3366
|
-
console.log(
|
|
3399
|
+
console.log(chalk43.green(` \u2713 ${label}`));
|
|
3367
3400
|
}
|
|
3368
3401
|
return { errors, fixed };
|
|
3369
3402
|
}
|
|
@@ -3383,14 +3416,14 @@ function runChecks(entries, cwd5, pkg, fix2) {
|
|
|
3383
3416
|
}
|
|
3384
3417
|
function logSummary(errors, fixed) {
|
|
3385
3418
|
if (fixed > 0) {
|
|
3386
|
-
console.log(
|
|
3419
|
+
console.log(chalk43.green(`
|
|
3387
3420
|
Fixed ${fixed} issue(s)`));
|
|
3388
3421
|
}
|
|
3389
3422
|
if (errors > 0) {
|
|
3390
|
-
console.log(
|
|
3423
|
+
console.log(chalk43.red(`
|
|
3391
3424
|
${errors} error(s) found`));
|
|
3392
3425
|
} else if (fixed === 0) {
|
|
3393
|
-
console.log(
|
|
3426
|
+
console.log(chalk43.green("\n All checks passed"));
|
|
3394
3427
|
}
|
|
3395
3428
|
}
|
|
3396
3429
|
function packageLintMonorepo(fix2 = false) {
|
|
@@ -3399,14 +3432,14 @@ function packageLintMonorepo(fix2 = false) {
|
|
|
3399
3432
|
try {
|
|
3400
3433
|
pkg = readRootPackageJson(cwd5);
|
|
3401
3434
|
} catch {
|
|
3402
|
-
console.error(
|
|
3435
|
+
console.error(chalk43.red("Could not read package.json"));
|
|
3403
3436
|
return 1;
|
|
3404
3437
|
}
|
|
3405
3438
|
if (!isMonorepo(pkg)) {
|
|
3406
|
-
console.log(
|
|
3439
|
+
console.log(chalk43.gray("Not a monorepo \u2014 skipping package-lint checks"));
|
|
3407
3440
|
return 0;
|
|
3408
3441
|
}
|
|
3409
|
-
console.log(
|
|
3442
|
+
console.log(chalk43.green("Package Lint"));
|
|
3410
3443
|
const workspaces = yarnWorkspaces();
|
|
3411
3444
|
const checks = [
|
|
3412
3445
|
{
|
|
@@ -3480,7 +3513,7 @@ var rebuild = ({ target }) => {
|
|
|
3480
3513
|
};
|
|
3481
3514
|
|
|
3482
3515
|
// src/actions/recompile.ts
|
|
3483
|
-
import
|
|
3516
|
+
import chalk44 from "chalk";
|
|
3484
3517
|
var recompile = async ({
|
|
3485
3518
|
verbose,
|
|
3486
3519
|
target,
|
|
@@ -3516,7 +3549,7 @@ var recompileAll = async ({
|
|
|
3516
3549
|
const incrementalOptions = incremental ? ["--since", "-Apt", "--topological-dev"] : ["--parallel", "-Apt", "--topological-dev"];
|
|
3517
3550
|
const jobsOptions = jobs ? ["-j", `${jobs}`] : [];
|
|
3518
3551
|
if (jobs) {
|
|
3519
|
-
console.log(
|
|
3552
|
+
console.log(chalk44.blue(`Jobs set to [${jobs}]`));
|
|
3520
3553
|
}
|
|
3521
3554
|
const result = await runStepsAsync(`Recompile${incremental ? "-Incremental" : ""} [All]`, [
|
|
3522
3555
|
[
|
|
@@ -3547,7 +3580,7 @@ var recompileAll = async ({
|
|
|
3547
3580
|
]
|
|
3548
3581
|
]);
|
|
3549
3582
|
console.log(
|
|
3550
|
-
`${
|
|
3583
|
+
`${chalk44.gray("Recompiled in")} [${chalk44.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk44.gray("seconds")}`
|
|
3551
3584
|
);
|
|
3552
3585
|
return result;
|
|
3553
3586
|
};
|
|
@@ -3578,13 +3611,13 @@ var reinstall = () => {
|
|
|
3578
3611
|
};
|
|
3579
3612
|
|
|
3580
3613
|
// src/actions/relint.ts
|
|
3581
|
-
import
|
|
3614
|
+
import chalk45 from "chalk";
|
|
3582
3615
|
var relintPackage = ({
|
|
3583
3616
|
pkg,
|
|
3584
3617
|
fix: fix2,
|
|
3585
3618
|
verbose
|
|
3586
3619
|
}) => {
|
|
3587
|
-
console.log(
|
|
3620
|
+
console.log(chalk45.gray(`${fix2 ? "Fix" : "Lint"} [${pkg}]`));
|
|
3588
3621
|
const start = Date.now();
|
|
3589
3622
|
const result = runSteps(`${fix2 ? "Fix" : "Lint"} [${pkg}]`, [
|
|
3590
3623
|
["yarn", [
|
|
@@ -3594,7 +3627,7 @@ var relintPackage = ({
|
|
|
3594
3627
|
fix2 ? "package-fix" : verbose ? "package-lint-verbose" : "package-lint"
|
|
3595
3628
|
]]
|
|
3596
3629
|
]);
|
|
3597
|
-
console.log(
|
|
3630
|
+
console.log(chalk45.gray(`${fix2 ? "Fixed in" : "Linted in"} [${chalk45.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk45.gray("seconds")}`));
|
|
3598
3631
|
return result;
|
|
3599
3632
|
};
|
|
3600
3633
|
var relint = ({
|
|
@@ -3614,13 +3647,13 @@ var relint = ({
|
|
|
3614
3647
|
});
|
|
3615
3648
|
};
|
|
3616
3649
|
var relintAllPackages = ({ fix: fix2 = false } = {}) => {
|
|
3617
|
-
console.log(
|
|
3650
|
+
console.log(chalk45.gray(`${fix2 ? "Fix" : "Lint"} [All-Packages]`));
|
|
3618
3651
|
const start = Date.now();
|
|
3619
3652
|
const fixOptions = fix2 ? ["--fix"] : [];
|
|
3620
3653
|
const result = runSteps(`${fix2 ? "Fix" : "Lint"} [All-Packages]`, [
|
|
3621
3654
|
["yarn", ["eslint", ...fixOptions]]
|
|
3622
3655
|
]);
|
|
3623
|
-
console.log(
|
|
3656
|
+
console.log(chalk45.gray(`${fix2 ? "Fixed in" : "Linted in"} [${chalk45.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk45.gray("seconds")}`));
|
|
3624
3657
|
return result;
|
|
3625
3658
|
};
|
|
3626
3659
|
|
|
@@ -3638,10 +3671,10 @@ var sonar = () => {
|
|
|
3638
3671
|
};
|
|
3639
3672
|
|
|
3640
3673
|
// src/actions/statics.ts
|
|
3641
|
-
import
|
|
3674
|
+
import chalk46 from "chalk";
|
|
3642
3675
|
var DefaultDependencies = ["axios", "@xylabs/pixel", "react", "graphql", "react-router", "@mui/material", "@mui/system"];
|
|
3643
3676
|
var statics = () => {
|
|
3644
|
-
console.log(
|
|
3677
|
+
console.log(chalk46.green("Check Required Static Dependencies"));
|
|
3645
3678
|
const statics2 = parsedPackageJSON()?.xy?.deps?.statics;
|
|
3646
3679
|
return detectDuplicateDependencies(statics2, DefaultDependencies);
|
|
3647
3680
|
};
|
|
@@ -4230,7 +4263,7 @@ var xyInstallCommands = (args) => {
|
|
|
4230
4263
|
};
|
|
4231
4264
|
|
|
4232
4265
|
// src/xy/lint/cycleCommand.ts
|
|
4233
|
-
import
|
|
4266
|
+
import chalk47 from "chalk";
|
|
4234
4267
|
var cycleCommand = {
|
|
4235
4268
|
command: "cycle [package]",
|
|
4236
4269
|
describe: "Cycle - Check for dependency cycles",
|
|
@@ -4241,12 +4274,12 @@ var cycleCommand = {
|
|
|
4241
4274
|
const start = Date.now();
|
|
4242
4275
|
if (argv.verbose) console.log("Cycle");
|
|
4243
4276
|
process.exitCode = await cycle({ pkg: argv.package });
|
|
4244
|
-
console.log(
|
|
4277
|
+
console.log(chalk47.blue(`Finished in ${Date.now() - start}ms`));
|
|
4245
4278
|
}
|
|
4246
4279
|
};
|
|
4247
4280
|
|
|
4248
4281
|
// src/xy/lint/deplintCommand.ts
|
|
4249
|
-
import
|
|
4282
|
+
import chalk48 from "chalk";
|
|
4250
4283
|
var deplintCommand = {
|
|
4251
4284
|
command: "deplint [package]",
|
|
4252
4285
|
describe: "Deplint - Run Deplint",
|
|
@@ -4284,12 +4317,12 @@ var deplintCommand = {
|
|
|
4284
4317
|
peerDeps: !!argv.peerDeps,
|
|
4285
4318
|
verbose: !!argv.verbose
|
|
4286
4319
|
});
|
|
4287
|
-
console.log(
|
|
4320
|
+
console.log(chalk48.blue(`Finished in ${Date.now() - start}ms`));
|
|
4288
4321
|
}
|
|
4289
4322
|
};
|
|
4290
4323
|
|
|
4291
4324
|
// src/xy/lint/fixCommand.ts
|
|
4292
|
-
import
|
|
4325
|
+
import chalk49 from "chalk";
|
|
4293
4326
|
var fixCommand = {
|
|
4294
4327
|
command: "fix [package]",
|
|
4295
4328
|
describe: "Fix - Run Eslint w/fix",
|
|
@@ -4300,12 +4333,12 @@ var fixCommand = {
|
|
|
4300
4333
|
const start = Date.now();
|
|
4301
4334
|
if (argv.verbose) console.log("Fix");
|
|
4302
4335
|
process.exitCode = fix();
|
|
4303
|
-
console.log(
|
|
4336
|
+
console.log(chalk49.blue(`Finished in ${Date.now() - start}ms`));
|
|
4304
4337
|
}
|
|
4305
4338
|
};
|
|
4306
4339
|
|
|
4307
4340
|
// src/xy/lint/knipCommand.ts
|
|
4308
|
-
import
|
|
4341
|
+
import chalk50 from "chalk";
|
|
4309
4342
|
var knipCommand = {
|
|
4310
4343
|
command: "knip",
|
|
4311
4344
|
describe: "Knip - Run Knip",
|
|
@@ -4316,12 +4349,12 @@ var knipCommand = {
|
|
|
4316
4349
|
if (argv.verbose) console.log("Knip");
|
|
4317
4350
|
const start = Date.now();
|
|
4318
4351
|
process.exitCode = knip();
|
|
4319
|
-
console.log(
|
|
4352
|
+
console.log(chalk50.blue(`Knip finished in ${Date.now() - start}ms`));
|
|
4320
4353
|
}
|
|
4321
4354
|
};
|
|
4322
4355
|
|
|
4323
4356
|
// src/xy/lint/lintCommand.ts
|
|
4324
|
-
import
|
|
4357
|
+
import chalk51 from "chalk";
|
|
4325
4358
|
var lintCommand = {
|
|
4326
4359
|
command: "lint [package]",
|
|
4327
4360
|
describe: "Lint - Run Eslint",
|
|
@@ -4350,7 +4383,7 @@ var lintCommand = {
|
|
|
4350
4383
|
cache: argv.cache,
|
|
4351
4384
|
verbose: !!argv.verbose
|
|
4352
4385
|
});
|
|
4353
|
-
console.log(
|
|
4386
|
+
console.log(chalk51.blue(`Finished in ${Date.now() - start}ms`));
|
|
4354
4387
|
}
|
|
4355
4388
|
};
|
|
4356
4389
|
|
|
@@ -4372,7 +4405,7 @@ var packageLintCommand = {
|
|
|
4372
4405
|
};
|
|
4373
4406
|
|
|
4374
4407
|
// src/xy/lint/publintCommand.ts
|
|
4375
|
-
import
|
|
4408
|
+
import chalk52 from "chalk";
|
|
4376
4409
|
var publintCommand = {
|
|
4377
4410
|
command: "publint [package]",
|
|
4378
4411
|
describe: "Publint - Run Publint",
|
|
@@ -4383,12 +4416,12 @@ var publintCommand = {
|
|
|
4383
4416
|
if (argv.verbose) console.log("Publint");
|
|
4384
4417
|
const start = Date.now();
|
|
4385
4418
|
process.exitCode = await publint({ pkg: argv.package, verbose: !!argv.verbose });
|
|
4386
|
-
console.log(
|
|
4419
|
+
console.log(chalk52.blue(`Finished in ${Date.now() - start}ms`));
|
|
4387
4420
|
}
|
|
4388
4421
|
};
|
|
4389
4422
|
|
|
4390
4423
|
// src/xy/lint/relintCommand.ts
|
|
4391
|
-
import
|
|
4424
|
+
import chalk53 from "chalk";
|
|
4392
4425
|
var relintCommand = {
|
|
4393
4426
|
command: "relint [package]",
|
|
4394
4427
|
describe: "Relint - Clean & Lint",
|
|
@@ -4399,12 +4432,12 @@ var relintCommand = {
|
|
|
4399
4432
|
if (argv.verbose) console.log("Relinting");
|
|
4400
4433
|
const start = Date.now();
|
|
4401
4434
|
process.exitCode = relint();
|
|
4402
|
-
console.log(
|
|
4435
|
+
console.log(chalk53.blue(`Finished in ${Date.now() - start}ms`));
|
|
4403
4436
|
}
|
|
4404
4437
|
};
|
|
4405
4438
|
|
|
4406
4439
|
// src/xy/lint/sonarCommand.ts
|
|
4407
|
-
import
|
|
4440
|
+
import chalk54 from "chalk";
|
|
4408
4441
|
var sonarCommand = {
|
|
4409
4442
|
command: "sonar",
|
|
4410
4443
|
describe: "Sonar - Run Sonar Check",
|
|
@@ -4415,7 +4448,7 @@ var sonarCommand = {
|
|
|
4415
4448
|
const start = Date.now();
|
|
4416
4449
|
if (argv.verbose) console.log("Sonar Check");
|
|
4417
4450
|
process.exitCode = sonar();
|
|
4418
|
-
console.log(
|
|
4451
|
+
console.log(chalk54.blue(`Finished in ${Date.now() - start}ms`));
|
|
4419
4452
|
}
|
|
4420
4453
|
};
|
|
4421
4454
|
|
|
@@ -4425,13 +4458,21 @@ var xyLintCommands = (args) => {
|
|
|
4425
4458
|
};
|
|
4426
4459
|
|
|
4427
4460
|
// src/xy/xy.ts
|
|
4428
|
-
import
|
|
4461
|
+
import chalk55 from "chalk";
|
|
4429
4462
|
|
|
4430
4463
|
// src/xy/xyParseOptions.ts
|
|
4431
4464
|
import yargs from "yargs";
|
|
4432
4465
|
import { hideBin } from "yargs/helpers";
|
|
4433
4466
|
var xyParseOptions = () => {
|
|
4434
|
-
return yargs(hideBin(process.argv)).scriptName("yarn xy").
|
|
4467
|
+
return yargs(hideBin(process.argv)).scriptName("yarn xy").middleware((argv) => {
|
|
4468
|
+
const commandName = argv._[0];
|
|
4469
|
+
if (commandName && argv._.length <= 1) {
|
|
4470
|
+
const result = tryRunLocalScript(commandName);
|
|
4471
|
+
if (result !== void 0) {
|
|
4472
|
+
process.exit(result);
|
|
4473
|
+
}
|
|
4474
|
+
}
|
|
4475
|
+
}, true).option("jobs", {
|
|
4435
4476
|
alias: "j",
|
|
4436
4477
|
default: void 0,
|
|
4437
4478
|
description: "Max parallel jobs",
|
|
@@ -4458,8 +4499,8 @@ var xyParseOptions = () => {
|
|
|
4458
4499
|
var xy = async () => {
|
|
4459
4500
|
const options = xyParseOptions();
|
|
4460
4501
|
return await xyBuildCommands(xyCommonCommands(xyInstallCommands(xyDeployCommands(xyLintCommands(options))))).demandCommand(1).command("*", "", () => {
|
|
4461
|
-
console.error(
|
|
4462
|
-
console.log(
|
|
4502
|
+
console.error(chalk55.yellow(`Command not found [${chalk55.magenta(process.argv[2])}]`));
|
|
4503
|
+
console.log(chalk55.gray("Try 'yarn xy --help' for list of commands"));
|
|
4463
4504
|
}).version().help().argv;
|
|
4464
4505
|
};
|
|
4465
4506
|
export {
|
|
@@ -4475,7 +4516,6 @@ export {
|
|
|
4475
4516
|
XYLABS_SKILLS_PREFIX,
|
|
4476
4517
|
applyLogoConfig,
|
|
4477
4518
|
build,
|
|
4478
|
-
bundleDts,
|
|
4479
4519
|
checkResult,
|
|
4480
4520
|
claudeClean,
|
|
4481
4521
|
claudeCommandTemplates,
|
|
@@ -4538,7 +4578,6 @@ export {
|
|
|
4538
4578
|
packageCleanTypescript,
|
|
4539
4579
|
packageCompile,
|
|
4540
4580
|
packageCompileTsc,
|
|
4541
|
-
packageCompileTscTypes,
|
|
4542
4581
|
packageCompileTsup,
|
|
4543
4582
|
packageCopyAssets,
|
|
4544
4583
|
packageCycle,
|
|
@@ -4579,6 +4618,7 @@ export {
|
|
|
4579
4618
|
statics,
|
|
4580
4619
|
test,
|
|
4581
4620
|
tryReadFileSync,
|
|
4621
|
+
tryRunLocalScript,
|
|
4582
4622
|
tsupOptions,
|
|
4583
4623
|
union,
|
|
4584
4624
|
up,
|