@xylabs/ts-scripts-yarn3 7.4.24 → 7.4.26
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/bin/xy.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
3
|
// src/actions/build.ts
|
|
4
|
-
import
|
|
4
|
+
import chalk10 from "chalk";
|
|
5
5
|
|
|
6
6
|
// src/lib/checkResult.ts
|
|
7
7
|
import chalk from "chalk";
|
|
@@ -686,6 +686,36 @@ var runStepsAsync = async (name, steps, exitOnFail = true, messages) => {
|
|
|
686
686
|
});
|
|
687
687
|
};
|
|
688
688
|
|
|
689
|
+
// src/lib/tryRunLocalScript.ts
|
|
690
|
+
import { spawnSync as spawnSync4 } from "child_process";
|
|
691
|
+
import { readFileSync as readFileSync6 } from "fs";
|
|
692
|
+
import PATH4 from "path";
|
|
693
|
+
import chalk9 from "chalk";
|
|
694
|
+
function tryRunLocalScript(commandName) {
|
|
695
|
+
if (process.env.XY_LOCAL_SCRIPT === "1") return void 0;
|
|
696
|
+
const rootPkgPath = PATH4.resolve(process.cwd(), "package.json");
|
|
697
|
+
let rootPkg;
|
|
698
|
+
try {
|
|
699
|
+
rootPkg = JSON.parse(readFileSync6(rootPkgPath, "utf8"));
|
|
700
|
+
} catch {
|
|
701
|
+
return void 0;
|
|
702
|
+
}
|
|
703
|
+
if (!rootPkg.scripts?.[commandName]) return void 0;
|
|
704
|
+
console.log(chalk9.blue(`Delegating "${commandName}" to local script`));
|
|
705
|
+
const result = spawnSync4("yarn", ["run", commandName], {
|
|
706
|
+
cwd: process.cwd(),
|
|
707
|
+
encoding: "utf8",
|
|
708
|
+
env: {
|
|
709
|
+
FORCE_COLOR: "3",
|
|
710
|
+
...process.env,
|
|
711
|
+
XY_LOCAL_SCRIPT: "1"
|
|
712
|
+
},
|
|
713
|
+
shell: true,
|
|
714
|
+
stdio: "inherit"
|
|
715
|
+
});
|
|
716
|
+
return result.status ?? 1;
|
|
717
|
+
}
|
|
718
|
+
|
|
689
719
|
// src/actions/build.ts
|
|
690
720
|
var build = async ({
|
|
691
721
|
incremental,
|
|
@@ -701,7 +731,7 @@ var build = async ({
|
|
|
701
731
|
const targetOptions = target === void 0 ? [] : ["-t", target];
|
|
702
732
|
const jobsOptions = jobs === void 0 ? [] : ["-j", `${jobs}`];
|
|
703
733
|
if (jobs !== void 0) {
|
|
704
|
-
console.log(
|
|
734
|
+
console.log(chalk10.blue(`Jobs set to [${jobs}]`));
|
|
705
735
|
}
|
|
706
736
|
const result = await runStepsAsync(`Build${incremental ? "-Incremental" : ""} [${pkg ?? "All"}]`, [
|
|
707
737
|
["yarn", ["xy", "compile", ...pkgOptions, ...targetOptions, ...verboseOptions, ...jobsOptions, ...incrementalOptions, "--types", "tsup"]],
|
|
@@ -709,7 +739,7 @@ var build = async ({
|
|
|
709
739
|
["yarn", ["xy", "deplint", ...pkgOptions, ...verboseOptions, ...jobsOptions, ...incrementalOptions]],
|
|
710
740
|
["yarn", ["xy", "lint", ...pkgOptions, ...verboseOptions, ...incrementalOptions]]
|
|
711
741
|
]);
|
|
712
|
-
console.log(`${
|
|
742
|
+
console.log(`${chalk10.gray("Built in")} [${chalk10.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk10.gray("seconds")}`);
|
|
713
743
|
return result;
|
|
714
744
|
};
|
|
715
745
|
|
|
@@ -720,12 +750,12 @@ import {
|
|
|
720
750
|
rmSync,
|
|
721
751
|
unlinkSync
|
|
722
752
|
} from "fs";
|
|
723
|
-
import
|
|
724
|
-
import
|
|
753
|
+
import PATH5 from "path";
|
|
754
|
+
import chalk11 from "chalk";
|
|
725
755
|
function removeFile(filePath, label) {
|
|
726
756
|
if (existsSync4(filePath)) {
|
|
727
757
|
unlinkSync(filePath);
|
|
728
|
-
console.log(
|
|
758
|
+
console.log(chalk11.yellow(` Removed ${label}`));
|
|
729
759
|
return true;
|
|
730
760
|
}
|
|
731
761
|
return false;
|
|
@@ -733,26 +763,26 @@ function removeFile(filePath, label) {
|
|
|
733
763
|
function removeDir(dirPath, label) {
|
|
734
764
|
if (existsSync4(dirPath)) {
|
|
735
765
|
rmSync(dirPath, { recursive: true });
|
|
736
|
-
console.log(
|
|
766
|
+
console.log(chalk11.yellow(` Removed ${label}`));
|
|
737
767
|
return true;
|
|
738
768
|
}
|
|
739
769
|
return false;
|
|
740
770
|
}
|
|
741
771
|
function claudeClean() {
|
|
742
|
-
console.log(
|
|
772
|
+
console.log(chalk11.green("Clean Claude configuration"));
|
|
743
773
|
const cwd = INIT_CWD() ?? process.cwd();
|
|
744
774
|
let removed = 0;
|
|
745
775
|
const rootFiles = ["CLAUDE.md", "CLAUDE.local.md"];
|
|
746
776
|
for (const file of rootFiles) {
|
|
747
|
-
if (removeFile(
|
|
777
|
+
if (removeFile(PATH5.resolve(cwd, file), file)) removed++;
|
|
748
778
|
}
|
|
749
|
-
if (removeDir(
|
|
750
|
-
const packagesDir =
|
|
779
|
+
if (removeDir(PATH5.resolve(cwd, ".claude"), ".claude/")) removed++;
|
|
780
|
+
const packagesDir = PATH5.resolve(cwd, "packages");
|
|
751
781
|
if (existsSync4(packagesDir)) {
|
|
752
782
|
const findClaudeFiles = (dir, prefix) => {
|
|
753
783
|
const entries = readdirSync2(dir, { withFileTypes: true });
|
|
754
784
|
for (const entry of entries) {
|
|
755
|
-
const fullPath =
|
|
785
|
+
const fullPath = PATH5.resolve(dir, entry.name);
|
|
756
786
|
const label = `${prefix}${entry.name}`;
|
|
757
787
|
if (entry.isFile() && (entry.name === "CLAUDE.md" || entry.name === "CLAUDE.local.md")) {
|
|
758
788
|
if (removeFile(fullPath, label)) removed++;
|
|
@@ -766,9 +796,9 @@ function claudeClean() {
|
|
|
766
796
|
findClaudeFiles(packagesDir, "packages/");
|
|
767
797
|
}
|
|
768
798
|
if (removed > 0) {
|
|
769
|
-
console.log(
|
|
799
|
+
console.log(chalk11.green(` Removed ${removed} item(s)`));
|
|
770
800
|
} else {
|
|
771
|
-
console.log(
|
|
801
|
+
console.log(chalk11.gray(" Nothing to clean"));
|
|
772
802
|
}
|
|
773
803
|
return 0;
|
|
774
804
|
}
|
|
@@ -778,20 +808,20 @@ import {
|
|
|
778
808
|
existsSync as existsSync5,
|
|
779
809
|
mkdirSync,
|
|
780
810
|
readdirSync as readdirSync3,
|
|
781
|
-
readFileSync as
|
|
811
|
+
readFileSync as readFileSync7,
|
|
782
812
|
unlinkSync as unlinkSync2,
|
|
783
813
|
writeFileSync as writeFileSync2
|
|
784
814
|
} from "fs";
|
|
785
|
-
import
|
|
786
|
-
import
|
|
815
|
+
import PATH6 from "path";
|
|
816
|
+
import chalk12 from "chalk";
|
|
787
817
|
var syncCommandFiles = (commandsDir) => {
|
|
788
818
|
const templates = claudeCommandTemplates();
|
|
789
819
|
const templateNames = new Set(Object.keys(templates));
|
|
790
820
|
let updated = 0;
|
|
791
821
|
let created = 0;
|
|
792
822
|
for (const [filename2, content] of Object.entries(templates)) {
|
|
793
|
-
const targetPath =
|
|
794
|
-
const existing = existsSync5(targetPath) ?
|
|
823
|
+
const targetPath = PATH6.resolve(commandsDir, filename2);
|
|
824
|
+
const existing = existsSync5(targetPath) ? readFileSync7(targetPath, "utf8") : void 0;
|
|
795
825
|
if (existing === content) continue;
|
|
796
826
|
writeFileSync2(targetPath, content, "utf8");
|
|
797
827
|
if (existing) {
|
|
@@ -811,7 +841,7 @@ var removeStaleCommands = (commandsDir, templateNames) => {
|
|
|
811
841
|
let removed = 0;
|
|
812
842
|
for (const file of existingCommands) {
|
|
813
843
|
if (!templateNames.has(file)) {
|
|
814
|
-
unlinkSync2(
|
|
844
|
+
unlinkSync2(PATH6.resolve(commandsDir, file));
|
|
815
845
|
removed++;
|
|
816
846
|
}
|
|
817
847
|
}
|
|
@@ -820,7 +850,7 @@ var removeStaleCommands = (commandsDir, templateNames) => {
|
|
|
820
850
|
var removeLegacyCommands = (commandsDir) => {
|
|
821
851
|
const legacyFiles = readdirSync3(commandsDir).filter((f) => f.startsWith(LEGACY_COMMANDS_PREFIX) && f.endsWith(".md"));
|
|
822
852
|
for (const file of legacyFiles) {
|
|
823
|
-
unlinkSync2(
|
|
853
|
+
unlinkSync2(PATH6.resolve(commandsDir, file));
|
|
824
854
|
}
|
|
825
855
|
return legacyFiles.length;
|
|
826
856
|
};
|
|
@@ -831,14 +861,14 @@ var logCommandsResult = (created, updated, removed) => {
|
|
|
831
861
|
updated ? `${updated} updated` : "",
|
|
832
862
|
removed ? `${removed} removed` : ""
|
|
833
863
|
].filter(Boolean);
|
|
834
|
-
console.log(
|
|
864
|
+
console.log(chalk12.green(`.claude/commands/${XYLABS_COMMANDS_PREFIX}*.md: ${parts.join(", ")}`));
|
|
835
865
|
} else {
|
|
836
|
-
console.log(
|
|
866
|
+
console.log(chalk12.gray(`.claude/commands/${XYLABS_COMMANDS_PREFIX}*.md: already up to date`));
|
|
837
867
|
}
|
|
838
868
|
};
|
|
839
869
|
var claudeCommands = () => {
|
|
840
870
|
const cwd = INIT_CWD() ?? process.cwd();
|
|
841
|
-
const commandsDir =
|
|
871
|
+
const commandsDir = PATH6.resolve(cwd, ".claude", "commands");
|
|
842
872
|
mkdirSync(commandsDir, { recursive: true });
|
|
843
873
|
const legacy = removeLegacyCommands(commandsDir);
|
|
844
874
|
const {
|
|
@@ -852,25 +882,25 @@ var claudeCommands = () => {
|
|
|
852
882
|
};
|
|
853
883
|
|
|
854
884
|
// src/actions/claude-rules.ts
|
|
855
|
-
import { spawnSync as
|
|
885
|
+
import { spawnSync as spawnSync5 } from "child_process";
|
|
856
886
|
import {
|
|
857
887
|
existsSync as existsSync6,
|
|
858
888
|
mkdirSync as mkdirSync2,
|
|
859
889
|
readdirSync as readdirSync4,
|
|
860
|
-
readFileSync as
|
|
890
|
+
readFileSync as readFileSync8,
|
|
861
891
|
unlinkSync as unlinkSync3,
|
|
862
892
|
writeFileSync as writeFileSync3
|
|
863
893
|
} from "fs";
|
|
864
|
-
import
|
|
865
|
-
import
|
|
894
|
+
import PATH7 from "path";
|
|
895
|
+
import chalk13 from "chalk";
|
|
866
896
|
var syncRuleFiles = (rulesDir) => {
|
|
867
897
|
const templates = claudeMdRuleTemplates();
|
|
868
898
|
const templateNames = new Set(Object.keys(templates));
|
|
869
899
|
let updated = 0;
|
|
870
900
|
let created = 0;
|
|
871
901
|
for (const [filename2, content] of Object.entries(templates)) {
|
|
872
|
-
const targetPath =
|
|
873
|
-
const existing = existsSync6(targetPath) ?
|
|
902
|
+
const targetPath = PATH7.resolve(rulesDir, filename2);
|
|
903
|
+
const existing = existsSync6(targetPath) ? readFileSync8(targetPath, "utf8") : void 0;
|
|
874
904
|
if (existing === content) continue;
|
|
875
905
|
writeFileSync3(targetPath, content, "utf8");
|
|
876
906
|
if (existing) {
|
|
@@ -890,7 +920,7 @@ var removeStaleRules = (rulesDir, templateNames) => {
|
|
|
890
920
|
let removed = 0;
|
|
891
921
|
for (const file of existingRules) {
|
|
892
922
|
if (!templateNames.has(file)) {
|
|
893
|
-
unlinkSync3(
|
|
923
|
+
unlinkSync3(PATH7.resolve(rulesDir, file));
|
|
894
924
|
removed++;
|
|
895
925
|
}
|
|
896
926
|
}
|
|
@@ -903,44 +933,44 @@ var logRulesResult = (created, updated, removed) => {
|
|
|
903
933
|
updated ? `${updated} updated` : "",
|
|
904
934
|
removed ? `${removed} removed` : ""
|
|
905
935
|
].filter(Boolean);
|
|
906
|
-
console.log(
|
|
936
|
+
console.log(chalk13.green(`.claude/rules/${XYLABS_RULES_PREFIX}*.md: ${parts.join(", ")}`));
|
|
907
937
|
} else {
|
|
908
|
-
console.log(
|
|
938
|
+
console.log(chalk13.gray(`.claude/rules/${XYLABS_RULES_PREFIX}*.md: already up to date`));
|
|
909
939
|
}
|
|
910
940
|
};
|
|
911
941
|
var ensureProjectClaudeMd = (cwd, force) => {
|
|
912
|
-
const projectPath =
|
|
942
|
+
const projectPath = PATH7.resolve(cwd, "CLAUDE.md");
|
|
913
943
|
if (!existsSync6(projectPath) || force) {
|
|
914
944
|
if (force && existsSync6(projectPath)) {
|
|
915
|
-
console.log(
|
|
945
|
+
console.log(chalk13.yellow("Regenerating CLAUDE.md"));
|
|
916
946
|
}
|
|
917
|
-
console.log(
|
|
918
|
-
const result =
|
|
947
|
+
console.log(chalk13.green("Generating CLAUDE.md via claude /init..."));
|
|
948
|
+
const result = spawnSync5("claude", ["-p", "/init", "--allowedTools", "Read", "Write", "Glob", "Grep"], {
|
|
919
949
|
cwd,
|
|
920
950
|
shell: true,
|
|
921
951
|
stdio: "inherit"
|
|
922
952
|
});
|
|
923
953
|
if (result.status !== 0) {
|
|
924
|
-
console.error(
|
|
954
|
+
console.error(chalk13.red("claude /init failed \u2014 is Claude Code installed?"));
|
|
925
955
|
return 1;
|
|
926
956
|
}
|
|
927
957
|
} else {
|
|
928
|
-
console.log(
|
|
958
|
+
console.log(chalk13.gray("CLAUDE.md already exists (skipped, use --force to regenerate)"));
|
|
929
959
|
}
|
|
930
960
|
return 0;
|
|
931
961
|
};
|
|
932
962
|
var ensureLocalClaudeMd = (cwd) => {
|
|
933
|
-
const localPath =
|
|
963
|
+
const localPath = PATH7.resolve(cwd, "CLAUDE.local.md");
|
|
934
964
|
if (existsSync6(localPath)) {
|
|
935
|
-
console.log(
|
|
965
|
+
console.log(chalk13.gray("CLAUDE.local.md already exists (skipped)"));
|
|
936
966
|
} else {
|
|
937
967
|
writeFileSync3(localPath, claudeMdLocalTemplate(), "utf8");
|
|
938
|
-
console.log(
|
|
968
|
+
console.log(chalk13.green("Generated CLAUDE.local.md"));
|
|
939
969
|
}
|
|
940
970
|
};
|
|
941
971
|
var claudeRules = ({ force } = {}) => {
|
|
942
972
|
const cwd = INIT_CWD() ?? process.cwd();
|
|
943
|
-
const rulesDir =
|
|
973
|
+
const rulesDir = PATH7.resolve(cwd, ".claude", "rules");
|
|
944
974
|
mkdirSync2(rulesDir, { recursive: true });
|
|
945
975
|
const {
|
|
946
976
|
created,
|
|
@@ -960,9 +990,9 @@ import {
|
|
|
960
990
|
mkdirSync as mkdirSync3,
|
|
961
991
|
writeFileSync as writeFileSync4
|
|
962
992
|
} from "fs";
|
|
963
|
-
import
|
|
993
|
+
import PATH8 from "path";
|
|
964
994
|
import { createInterface as createInterface2 } from "readline";
|
|
965
|
-
import
|
|
995
|
+
import chalk14 from "chalk";
|
|
966
996
|
var DEFAULT_SETTINGS = {
|
|
967
997
|
permissions: {
|
|
968
998
|
allow: [
|
|
@@ -981,6 +1011,9 @@ var DEFAULT_SETTINGS = {
|
|
|
981
1011
|
"Bash(echo *)",
|
|
982
1012
|
"Bash(pwd)",
|
|
983
1013
|
"Bash(which *)",
|
|
1014
|
+
"Bash(grep *)",
|
|
1015
|
+
"Bash(find *)",
|
|
1016
|
+
"Bash(npm view *)",
|
|
984
1017
|
"Bash(gh *)",
|
|
985
1018
|
"Read",
|
|
986
1019
|
"Edit",
|
|
@@ -1007,21 +1040,21 @@ function askConfirmation2(question) {
|
|
|
1007
1040
|
}
|
|
1008
1041
|
async function claudeSettings() {
|
|
1009
1042
|
const cwd = INIT_CWD() ?? process.cwd();
|
|
1010
|
-
const claudeDir =
|
|
1011
|
-
const settingsPath =
|
|
1043
|
+
const claudeDir = PATH8.resolve(cwd, ".claude");
|
|
1044
|
+
const settingsPath = PATH8.resolve(claudeDir, "settings.local.json");
|
|
1012
1045
|
mkdirSync3(claudeDir, { recursive: true });
|
|
1013
1046
|
if (existsSync7(settingsPath)) {
|
|
1014
1047
|
const confirmed = await askConfirmation2(
|
|
1015
|
-
|
|
1048
|
+
chalk14.yellow(`${settingsPath} already exists. Replace it? (y/N) `)
|
|
1016
1049
|
);
|
|
1017
1050
|
if (!confirmed) {
|
|
1018
|
-
console.log(
|
|
1051
|
+
console.log(chalk14.gray("Skipped \u2014 existing settings.local.json preserved"));
|
|
1019
1052
|
return 0;
|
|
1020
1053
|
}
|
|
1021
1054
|
}
|
|
1022
1055
|
writeFileSync4(settingsPath, `${JSON.stringify(DEFAULT_SETTINGS, null, 2)}
|
|
1023
1056
|
`, "utf8");
|
|
1024
|
-
console.log(
|
|
1057
|
+
console.log(chalk14.green("Generated .claude/settings.local.json"));
|
|
1025
1058
|
return 0;
|
|
1026
1059
|
}
|
|
1027
1060
|
|
|
@@ -1030,25 +1063,25 @@ import {
|
|
|
1030
1063
|
existsSync as existsSync8,
|
|
1031
1064
|
mkdirSync as mkdirSync4,
|
|
1032
1065
|
readdirSync as readdirSync5,
|
|
1033
|
-
readFileSync as
|
|
1066
|
+
readFileSync as readFileSync9,
|
|
1034
1067
|
rmSync as rmSync2,
|
|
1035
1068
|
statSync as statSync2,
|
|
1036
1069
|
writeFileSync as writeFileSync5
|
|
1037
1070
|
} from "fs";
|
|
1038
|
-
import
|
|
1039
|
-
import
|
|
1071
|
+
import PATH9 from "path";
|
|
1072
|
+
import chalk15 from "chalk";
|
|
1040
1073
|
var syncSkillFiles = (skillsDir) => {
|
|
1041
1074
|
const templates = claudeSkillTemplates();
|
|
1042
1075
|
const templateNames = new Set(Object.keys(templates));
|
|
1043
1076
|
let updated = 0;
|
|
1044
1077
|
let created = 0;
|
|
1045
1078
|
for (const [skillName, files] of Object.entries(templates)) {
|
|
1046
|
-
const skillDir =
|
|
1079
|
+
const skillDir = PATH9.resolve(skillsDir, skillName);
|
|
1047
1080
|
mkdirSync4(skillDir, { recursive: true });
|
|
1048
1081
|
for (const [filename2, content] of Object.entries(files)) {
|
|
1049
|
-
const targetPath =
|
|
1050
|
-
mkdirSync4(
|
|
1051
|
-
const existing = existsSync8(targetPath) ?
|
|
1082
|
+
const targetPath = PATH9.resolve(skillDir, filename2);
|
|
1083
|
+
mkdirSync4(PATH9.dirname(targetPath), { recursive: true });
|
|
1084
|
+
const existing = existsSync8(targetPath) ? readFileSync9(targetPath, "utf8") : void 0;
|
|
1052
1085
|
if (existing === content) continue;
|
|
1053
1086
|
writeFileSync5(targetPath, content, "utf8");
|
|
1054
1087
|
if (existing) {
|
|
@@ -1066,12 +1099,12 @@ var syncSkillFiles = (skillsDir) => {
|
|
|
1066
1099
|
};
|
|
1067
1100
|
var removeStaleSkills = (skillsDir, templateNames) => {
|
|
1068
1101
|
const existingSkills = readdirSync5(skillsDir).filter(
|
|
1069
|
-
(f) => f.startsWith(XYLABS_SKILLS_PREFIX) && statSync2(
|
|
1102
|
+
(f) => f.startsWith(XYLABS_SKILLS_PREFIX) && statSync2(PATH9.resolve(skillsDir, f)).isDirectory()
|
|
1070
1103
|
);
|
|
1071
1104
|
let removed = 0;
|
|
1072
1105
|
for (const dir of existingSkills) {
|
|
1073
1106
|
if (!templateNames.has(dir)) {
|
|
1074
|
-
rmSync2(
|
|
1107
|
+
rmSync2(PATH9.resolve(skillsDir, dir), { recursive: true });
|
|
1075
1108
|
removed++;
|
|
1076
1109
|
}
|
|
1077
1110
|
}
|
|
@@ -1084,14 +1117,14 @@ var logSkillsResult = (created, updated, removed) => {
|
|
|
1084
1117
|
updated ? `${updated} updated` : "",
|
|
1085
1118
|
removed ? `${removed} removed` : ""
|
|
1086
1119
|
].filter(Boolean);
|
|
1087
|
-
console.log(
|
|
1120
|
+
console.log(chalk15.green(`.claude/skills/${XYLABS_SKILLS_PREFIX}*/: ${parts.join(", ")}`));
|
|
1088
1121
|
} else {
|
|
1089
|
-
console.log(
|
|
1122
|
+
console.log(chalk15.gray(`.claude/skills/${XYLABS_SKILLS_PREFIX}*/: already up to date`));
|
|
1090
1123
|
}
|
|
1091
1124
|
};
|
|
1092
1125
|
var claudeSkills = () => {
|
|
1093
1126
|
const cwd = INIT_CWD() ?? process.cwd();
|
|
1094
|
-
const skillsDir =
|
|
1127
|
+
const skillsDir = PATH9.resolve(cwd, ".claude", "skills");
|
|
1095
1128
|
mkdirSync4(skillsDir, { recursive: true });
|
|
1096
1129
|
const {
|
|
1097
1130
|
created,
|
|
@@ -1117,16 +1150,16 @@ var cleanAll = ({ verbose }) => {
|
|
|
1117
1150
|
|
|
1118
1151
|
// src/actions/clean-docs.ts
|
|
1119
1152
|
import path from "path";
|
|
1120
|
-
import
|
|
1153
|
+
import chalk16 from "chalk";
|
|
1121
1154
|
var cleanDocs = () => {
|
|
1122
1155
|
const pkgName = process.env.npm_package_name;
|
|
1123
|
-
console.log(
|
|
1156
|
+
console.log(chalk16.green(`Cleaning Docs [${pkgName}]`));
|
|
1124
1157
|
for (const { location } of yarnWorkspaces()) deleteGlob(path.join(location, "docs"));
|
|
1125
1158
|
return 0;
|
|
1126
1159
|
};
|
|
1127
1160
|
|
|
1128
1161
|
// src/actions/compile.ts
|
|
1129
|
-
import
|
|
1162
|
+
import chalk17 from "chalk";
|
|
1130
1163
|
var compile = ({
|
|
1131
1164
|
verbose,
|
|
1132
1165
|
target,
|
|
@@ -1167,7 +1200,7 @@ var compileAll = ({
|
|
|
1167
1200
|
const incrementalOptions = incremental ? ["--since", "-Ap", "--topological-dev"] : ["--parallel", "-Ap", "--topological-dev"];
|
|
1168
1201
|
const jobsOptions = jobs ? ["-j", `${jobs}`] : [];
|
|
1169
1202
|
if (jobs) {
|
|
1170
|
-
console.log(
|
|
1203
|
+
console.log(chalk17.blue(`Jobs set to [${jobs}]`));
|
|
1171
1204
|
}
|
|
1172
1205
|
const result = runSteps(`Compile${incremental ? "-Incremental" : ""} [All]`, [
|
|
1173
1206
|
["yarn", [
|
|
@@ -1181,13 +1214,13 @@ var compileAll = ({
|
|
|
1181
1214
|
...targetOptions
|
|
1182
1215
|
]]
|
|
1183
1216
|
]);
|
|
1184
|
-
console.log(`${
|
|
1217
|
+
console.log(`${chalk17.gray("Compiled in")} [${chalk17.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk17.gray("seconds")}`);
|
|
1185
1218
|
return result;
|
|
1186
1219
|
};
|
|
1187
1220
|
|
|
1188
1221
|
// src/actions/copy-assets.ts
|
|
1189
1222
|
import path2 from "path/posix";
|
|
1190
|
-
import
|
|
1223
|
+
import chalk18 from "chalk";
|
|
1191
1224
|
import cpy from "cpy";
|
|
1192
1225
|
var copyPackageTargetAssets = async (target, name, location) => {
|
|
1193
1226
|
try {
|
|
@@ -1210,7 +1243,7 @@ var copyPackageTargetAssets = async (target, name, location) => {
|
|
|
1210
1243
|
};
|
|
1211
1244
|
var copyTargetAssets = async (target, pkg) => {
|
|
1212
1245
|
const workspaces = yarnWorkspaces();
|
|
1213
|
-
console.log(
|
|
1246
|
+
console.log(chalk18.green(`Copying Assets [${target.toUpperCase()}]`));
|
|
1214
1247
|
const workspaceList = workspaces.filter(({ name }) => {
|
|
1215
1248
|
return pkg === void 0 || name === pkg;
|
|
1216
1249
|
});
|
|
@@ -1294,7 +1327,7 @@ var dead = () => {
|
|
|
1294
1327
|
};
|
|
1295
1328
|
|
|
1296
1329
|
// src/actions/deplint/deplint.ts
|
|
1297
|
-
import
|
|
1330
|
+
import chalk24 from "chalk";
|
|
1298
1331
|
|
|
1299
1332
|
// src/actions/deplint/findFiles.ts
|
|
1300
1333
|
import fs2 from "fs";
|
|
@@ -1499,7 +1532,7 @@ function getExternalImportsFromFiles({
|
|
|
1499
1532
|
|
|
1500
1533
|
// src/actions/deplint/checkPackage/getUnlistedDependencies.ts
|
|
1501
1534
|
import { builtinModules } from "module";
|
|
1502
|
-
import
|
|
1535
|
+
import chalk19 from "chalk";
|
|
1503
1536
|
function isRuntimeImportListed(imp, name, dependencies, peerDependencies) {
|
|
1504
1537
|
return dependencies.includes(imp) || imp === name || peerDependencies.includes(imp) || builtinModules.includes(imp);
|
|
1505
1538
|
}
|
|
@@ -1507,7 +1540,7 @@ function isTypeImportListed(imp, name, dependencies, devDependencies, peerDepend
|
|
|
1507
1540
|
return dependencies.includes(imp) || imp === name || dependencies.includes(`@types/${imp}`) || peerDependencies.includes(imp) || peerDependencies.includes(`@types/${imp}`) || devDependencies.includes(`@types/${imp}`) || builtinModules.includes(imp);
|
|
1508
1541
|
}
|
|
1509
1542
|
function logMissing(name, imp, importPaths) {
|
|
1510
|
-
console.log(`[${
|
|
1543
|
+
console.log(`[${chalk19.blue(name)}] Missing dependency in package.json: ${chalk19.red(imp)}`);
|
|
1511
1544
|
if (importPaths[imp]) {
|
|
1512
1545
|
console.log(` ${importPaths[imp].join("\n ")}`);
|
|
1513
1546
|
}
|
|
@@ -1536,7 +1569,7 @@ function getUnlistedDependencies({ name, location }, {
|
|
|
1536
1569
|
}
|
|
1537
1570
|
if (unlistedDependencies > 0) {
|
|
1538
1571
|
const packageLocation = `${location}/package.json`;
|
|
1539
|
-
console.log(` ${
|
|
1572
|
+
console.log(` ${chalk19.yellow(packageLocation)}
|
|
1540
1573
|
`);
|
|
1541
1574
|
}
|
|
1542
1575
|
return unlistedDependencies;
|
|
@@ -1544,7 +1577,7 @@ function getUnlistedDependencies({ name, location }, {
|
|
|
1544
1577
|
|
|
1545
1578
|
// src/actions/deplint/checkPackage/getUnlistedDevDependencies.ts
|
|
1546
1579
|
import { builtinModules as builtinModules2 } from "module";
|
|
1547
|
-
import
|
|
1580
|
+
import chalk20 from "chalk";
|
|
1548
1581
|
function getUnlistedDevDependencies({ name, location }, {
|
|
1549
1582
|
devDependencies,
|
|
1550
1583
|
dependencies,
|
|
@@ -1558,7 +1591,7 @@ function getUnlistedDevDependencies({ name, location }, {
|
|
|
1558
1591
|
for (const imp of externalAllImports) {
|
|
1559
1592
|
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)) {
|
|
1560
1593
|
unlistedDevDependencies++;
|
|
1561
|
-
console.log(`[${
|
|
1594
|
+
console.log(`[${chalk20.blue(name)}] Missing devDependency in package.json: ${chalk20.red(imp)}`);
|
|
1562
1595
|
if (allImportPaths[imp]) {
|
|
1563
1596
|
console.log(` ${allImportPaths[imp].join("\n ")}`);
|
|
1564
1597
|
}
|
|
@@ -1566,14 +1599,14 @@ function getUnlistedDevDependencies({ name, location }, {
|
|
|
1566
1599
|
}
|
|
1567
1600
|
if (unlistedDevDependencies > 0) {
|
|
1568
1601
|
const packageLocation = `${location}/package.json`;
|
|
1569
|
-
console.log(` ${
|
|
1602
|
+
console.log(` ${chalk20.yellow(packageLocation)}
|
|
1570
1603
|
`);
|
|
1571
1604
|
}
|
|
1572
1605
|
return unlistedDevDependencies;
|
|
1573
1606
|
}
|
|
1574
1607
|
|
|
1575
1608
|
// src/actions/deplint/checkPackage/getUnusedDependencies.ts
|
|
1576
|
-
import
|
|
1609
|
+
import chalk21 from "chalk";
|
|
1577
1610
|
function getUnusedDependencies({ name, location }, { dependencies }, {
|
|
1578
1611
|
externalDistImports,
|
|
1579
1612
|
externalDistTypeImports,
|
|
@@ -1585,22 +1618,22 @@ function getUnusedDependencies({ name, location }, { dependencies }, {
|
|
|
1585
1618
|
if (!externalDistImports.includes(dep) && !externalDistImports.includes(dep.replace(/^@types\//, "")) && !externalDistTypeImports.includes(dep) && !externalDistTypeImports.includes(dep.replace(/^@types\//, ""))) {
|
|
1586
1619
|
unusedDependencies++;
|
|
1587
1620
|
if (externalAllImports.includes(dep)) {
|
|
1588
|
-
console.log(`[${
|
|
1621
|
+
console.log(`[${chalk21.blue(name)}] dependency should be devDependency in package.json: ${chalk21.red(dep)}`);
|
|
1589
1622
|
} else {
|
|
1590
|
-
console.log(`[${
|
|
1623
|
+
console.log(`[${chalk21.blue(name)}] Unused dependency in package.json: ${chalk21.red(dep)}`);
|
|
1591
1624
|
}
|
|
1592
1625
|
}
|
|
1593
1626
|
}
|
|
1594
1627
|
if (unusedDependencies > 0) {
|
|
1595
1628
|
const packageLocation = `${location}/package.json`;
|
|
1596
|
-
console.log(` ${
|
|
1629
|
+
console.log(` ${chalk21.yellow(packageLocation)}
|
|
1597
1630
|
`);
|
|
1598
1631
|
}
|
|
1599
1632
|
return unusedDependencies;
|
|
1600
1633
|
}
|
|
1601
1634
|
|
|
1602
1635
|
// src/actions/deplint/checkPackage/getUnusedDevDependencies.ts
|
|
1603
|
-
import
|
|
1636
|
+
import chalk22 from "chalk";
|
|
1604
1637
|
|
|
1605
1638
|
// src/actions/deplint/getCliReferencedPackagesFromFiles.ts
|
|
1606
1639
|
import fs8 from "fs";
|
|
@@ -1884,19 +1917,19 @@ function getUnusedDevDependencies({ name, location }, {
|
|
|
1884
1917
|
if (dependencies.includes(dep) || peerDependencies.includes(dep)) continue;
|
|
1885
1918
|
if (!isDevDepUsed(dep, allImports, implicitDeps, requiredPeers, scriptRefs, cliRefs)) {
|
|
1886
1919
|
unusedDevDependencies++;
|
|
1887
|
-
console.log(`[${
|
|
1920
|
+
console.log(`[${chalk22.blue(name)}] Unused devDependency in package.json: ${chalk22.red(dep)}`);
|
|
1888
1921
|
}
|
|
1889
1922
|
}
|
|
1890
1923
|
if (unusedDevDependencies > 0) {
|
|
1891
1924
|
const packageLocation = `${location}/package.json`;
|
|
1892
|
-
console.log(` ${
|
|
1925
|
+
console.log(` ${chalk22.yellow(packageLocation)}
|
|
1893
1926
|
`);
|
|
1894
1927
|
}
|
|
1895
1928
|
return unusedDevDependencies;
|
|
1896
1929
|
}
|
|
1897
1930
|
|
|
1898
1931
|
// src/actions/deplint/checkPackage/getUnusedPeerDependencies.ts
|
|
1899
|
-
import
|
|
1932
|
+
import chalk23 from "chalk";
|
|
1900
1933
|
function getUnusedPeerDependencies({ name, location }, { peerDependencies, dependencies }, { externalDistImports, externalDistTypeImports }, exclude) {
|
|
1901
1934
|
let unusedDependencies = 0;
|
|
1902
1935
|
for (const dep of peerDependencies) {
|
|
@@ -1904,15 +1937,15 @@ function getUnusedPeerDependencies({ name, location }, { peerDependencies, depen
|
|
|
1904
1937
|
if (!externalDistImports.includes(dep) && !externalDistImports.includes(dep.replace(/^@types\//, "")) && !externalDistTypeImports.includes(dep) && !externalDistTypeImports.includes(dep.replace(/^@types\//, ""))) {
|
|
1905
1938
|
unusedDependencies++;
|
|
1906
1939
|
if (dependencies.includes(dep)) {
|
|
1907
|
-
console.log(`[${
|
|
1940
|
+
console.log(`[${chalk23.blue(name)}] Unused peerDependency [already a dependency] in package.json: ${chalk23.red(dep)}`);
|
|
1908
1941
|
} else {
|
|
1909
|
-
console.log(`[${
|
|
1942
|
+
console.log(`[${chalk23.blue(name)}] Unused peerDependency in package.json: ${chalk23.red(dep)}`);
|
|
1910
1943
|
}
|
|
1911
1944
|
}
|
|
1912
1945
|
}
|
|
1913
1946
|
if (unusedDependencies > 0) {
|
|
1914
1947
|
const packageLocation = `${location}/package.json`;
|
|
1915
|
-
console.log(` ${
|
|
1948
|
+
console.log(` ${chalk23.yellow(packageLocation)}
|
|
1916
1949
|
`);
|
|
1917
1950
|
}
|
|
1918
1951
|
return unusedDependencies;
|
|
@@ -2007,19 +2040,19 @@ var deplint = async ({
|
|
|
2007
2040
|
});
|
|
2008
2041
|
}
|
|
2009
2042
|
if (totalErrors > 0) {
|
|
2010
|
-
console.warn(`Deplint: Found ${
|
|
2043
|
+
console.warn(`Deplint: Found ${chalk24.red(totalErrors)} dependency problems. ${chalk24.red("\u2716")}`);
|
|
2011
2044
|
} else {
|
|
2012
|
-
console.info(`Deplint: Found no dependency problems. ${
|
|
2045
|
+
console.info(`Deplint: Found no dependency problems. ${chalk24.green("\u2714")}`);
|
|
2013
2046
|
}
|
|
2014
2047
|
return 0;
|
|
2015
2048
|
};
|
|
2016
2049
|
|
|
2017
2050
|
// src/actions/deploy.ts
|
|
2018
|
-
import { readFileSync as
|
|
2051
|
+
import { readFileSync as readFileSync10 } from "fs";
|
|
2019
2052
|
var privatePackageExcludeList = () => {
|
|
2020
2053
|
const possibleDeployablePackages = yarnWorkspaces().map((workspace) => [
|
|
2021
2054
|
workspace,
|
|
2022
|
-
JSON.parse(
|
|
2055
|
+
JSON.parse(readFileSync10(`${workspace.location}/package.json`, { encoding: "utf8" }))
|
|
2023
2056
|
]);
|
|
2024
2057
|
const privatePackages = possibleDeployablePackages.filter(([_, pkg]) => pkg.private).map(([workspace]) => workspace);
|
|
2025
2058
|
const excludeList = privatePackages.map((workspace) => `--exclude ${workspace.name}`);
|
|
@@ -2039,11 +2072,11 @@ var deploy = () => {
|
|
|
2039
2072
|
};
|
|
2040
2073
|
|
|
2041
2074
|
// src/actions/deploy-major.ts
|
|
2042
|
-
import { readFileSync as
|
|
2075
|
+
import { readFileSync as readFileSync11 } from "fs";
|
|
2043
2076
|
var privatePackageExcludeList2 = () => {
|
|
2044
2077
|
const possibleDeployablePackages = yarnWorkspaces().map((workspace) => [
|
|
2045
2078
|
workspace,
|
|
2046
|
-
JSON.parse(
|
|
2079
|
+
JSON.parse(readFileSync11(`${workspace.location}/package.json`, { encoding: "utf8" }))
|
|
2047
2080
|
]);
|
|
2048
2081
|
const privatePackages = possibleDeployablePackages.filter(([_, pkg]) => pkg.private).map(([workspace]) => workspace);
|
|
2049
2082
|
const excludeList = privatePackages.map((workspace) => `--exclude ${workspace.name}`);
|
|
@@ -2063,11 +2096,11 @@ var deployMajor = () => {
|
|
|
2063
2096
|
};
|
|
2064
2097
|
|
|
2065
2098
|
// src/actions/deploy-minor.ts
|
|
2066
|
-
import { readFileSync as
|
|
2099
|
+
import { readFileSync as readFileSync12 } from "fs";
|
|
2067
2100
|
var privatePackageExcludeList3 = () => {
|
|
2068
2101
|
const possibleDeployablePackages = yarnWorkspaces().map((workspace) => [
|
|
2069
2102
|
workspace,
|
|
2070
|
-
JSON.parse(
|
|
2103
|
+
JSON.parse(readFileSync12(`${workspace.location}/package.json`, { encoding: "utf8" }))
|
|
2071
2104
|
]);
|
|
2072
2105
|
const privatePackages = possibleDeployablePackages.filter(([_, pkg]) => pkg.private).map(([workspace]) => workspace);
|
|
2073
2106
|
const excludeList = privatePackages.map((workspace) => `--exclude ${workspace.name}`);
|
|
@@ -2087,11 +2120,11 @@ var deployMinor = () => {
|
|
|
2087
2120
|
};
|
|
2088
2121
|
|
|
2089
2122
|
// src/actions/deploy-next.ts
|
|
2090
|
-
import { readFileSync as
|
|
2123
|
+
import { readFileSync as readFileSync13 } from "fs";
|
|
2091
2124
|
var privatePackageExcludeList4 = () => {
|
|
2092
2125
|
const possibleDeployablePackages = yarnWorkspaces().map((workspace) => [
|
|
2093
2126
|
workspace,
|
|
2094
|
-
JSON.parse(
|
|
2127
|
+
JSON.parse(readFileSync13(`${workspace.location}/package.json`, { encoding: "utf8" }))
|
|
2095
2128
|
]);
|
|
2096
2129
|
const privatePackages = possibleDeployablePackages.filter(([_, pkg]) => pkg.private).map(([workspace]) => workspace);
|
|
2097
2130
|
const excludeList = privatePackages.map((workspace) => `--exclude ${workspace.name}`);
|
|
@@ -2111,9 +2144,9 @@ var deployNext = () => {
|
|
|
2111
2144
|
};
|
|
2112
2145
|
|
|
2113
2146
|
// src/actions/dupdeps.ts
|
|
2114
|
-
import
|
|
2147
|
+
import chalk25 from "chalk";
|
|
2115
2148
|
var dupdeps = () => {
|
|
2116
|
-
console.log(
|
|
2149
|
+
console.log(chalk25.green("Checking all Dependencies for Duplicates"));
|
|
2117
2150
|
const pkg = parsedPackageJSON();
|
|
2118
2151
|
const allDependencies = { ...pkg?.dependencies, ...pkg?.devDependencies };
|
|
2119
2152
|
const dependencies = Object.keys(allDependencies);
|
|
@@ -2121,13 +2154,13 @@ var dupdeps = () => {
|
|
|
2121
2154
|
};
|
|
2122
2155
|
|
|
2123
2156
|
// src/actions/lint.ts
|
|
2124
|
-
import
|
|
2157
|
+
import chalk26 from "chalk";
|
|
2125
2158
|
var lintPackage = ({
|
|
2126
2159
|
pkg,
|
|
2127
2160
|
fix: fix2,
|
|
2128
2161
|
verbose
|
|
2129
2162
|
}) => {
|
|
2130
|
-
console.log(
|
|
2163
|
+
console.log(chalk26.gray(`${fix2 ? "Fix" : "Lint"} [${pkg}]`));
|
|
2131
2164
|
const start = Date.now();
|
|
2132
2165
|
const result = runSteps(`${fix2 ? "Fix" : "Lint"} [${pkg}]`, [
|
|
2133
2166
|
["yarn", [
|
|
@@ -2137,7 +2170,7 @@ var lintPackage = ({
|
|
|
2137
2170
|
fix2 ? "package-fix" : verbose ? "package-lint-verbose" : "package-lint"
|
|
2138
2171
|
]]
|
|
2139
2172
|
]);
|
|
2140
|
-
console.log(
|
|
2173
|
+
console.log(chalk26.gray(`${fix2 ? "Fixed in" : "Linted in"} [${chalk26.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk26.gray("seconds")}`));
|
|
2141
2174
|
return result;
|
|
2142
2175
|
};
|
|
2143
2176
|
var lint = ({
|
|
@@ -2157,13 +2190,13 @@ var lint = ({
|
|
|
2157
2190
|
});
|
|
2158
2191
|
};
|
|
2159
2192
|
var lintAllPackages = ({ fix: fix2 = false } = {}) => {
|
|
2160
|
-
console.log(
|
|
2193
|
+
console.log(chalk26.gray(`${fix2 ? "Fix" : "Lint"} [All-Packages]`));
|
|
2161
2194
|
const start = Date.now();
|
|
2162
2195
|
const fixOptions = fix2 ? ["--fix"] : [];
|
|
2163
2196
|
const result = runSteps(`${fix2 ? "Fix" : "Lint"} [All-Packages]`, [
|
|
2164
2197
|
["yarn", ["eslint", "--cache", "--cache-location", ".eslintcache", "--cache-strategy", "content", ...fixOptions]]
|
|
2165
2198
|
]);
|
|
2166
|
-
console.log(
|
|
2199
|
+
console.log(chalk26.gray(`${fix2 ? "Fixed in" : "Linted in"} [${chalk26.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk26.gray("seconds")}`));
|
|
2167
2200
|
return result;
|
|
2168
2201
|
};
|
|
2169
2202
|
|
|
@@ -2188,7 +2221,7 @@ var genDocsAll = ({ incremental }) => {
|
|
|
2188
2221
|
|
|
2189
2222
|
// src/actions/gitignore.ts
|
|
2190
2223
|
import { unlinkSync as unlinkSync4 } from "fs";
|
|
2191
|
-
import
|
|
2224
|
+
import chalk27 from "chalk";
|
|
2192
2225
|
var COMMENT_PREFIX = "#";
|
|
2193
2226
|
var isComment = (line) => line.startsWith(COMMENT_PREFIX);
|
|
2194
2227
|
var isNegation = (line) => line.startsWith("!");
|
|
@@ -2245,7 +2278,7 @@ function removePackageGitignores(cwd) {
|
|
|
2245
2278
|
const filePath = `${cwd}/${location}/.gitignore`;
|
|
2246
2279
|
try {
|
|
2247
2280
|
unlinkSync4(filePath);
|
|
2248
|
-
console.log(
|
|
2281
|
+
console.log(chalk27.yellow(` Removed ${location}/.gitignore`));
|
|
2249
2282
|
removed++;
|
|
2250
2283
|
} catch {
|
|
2251
2284
|
}
|
|
@@ -2253,7 +2286,7 @@ function removePackageGitignores(cwd) {
|
|
|
2253
2286
|
return removed;
|
|
2254
2287
|
}
|
|
2255
2288
|
function gitignore() {
|
|
2256
|
-
console.log(
|
|
2289
|
+
console.log(chalk27.green("Generate .gitignore"));
|
|
2257
2290
|
const cwd = INIT_CWD() ?? ".";
|
|
2258
2291
|
const gitignorePath = `${cwd}/.gitignore`;
|
|
2259
2292
|
try {
|
|
@@ -2261,21 +2294,21 @@ function gitignore() {
|
|
|
2261
2294
|
const existing = readNonEmptyLines(gitignorePath);
|
|
2262
2295
|
const merged = mergeWithTemplate(existing, templateContent);
|
|
2263
2296
|
writeLines(gitignorePath, merged);
|
|
2264
|
-
console.log(
|
|
2297
|
+
console.log(chalk27.green(" Root .gitignore updated"));
|
|
2265
2298
|
const removed = removePackageGitignores(cwd);
|
|
2266
2299
|
if (removed > 0) {
|
|
2267
|
-
console.log(
|
|
2300
|
+
console.log(chalk27.green(` Removed ${removed} package .gitignore file(s)`));
|
|
2268
2301
|
}
|
|
2269
2302
|
return 0;
|
|
2270
2303
|
} catch (ex) {
|
|
2271
2304
|
const error = ex;
|
|
2272
|
-
console.error(
|
|
2305
|
+
console.error(chalk27.red(`Generate .gitignore failed: ${error.message}`));
|
|
2273
2306
|
return 1;
|
|
2274
2307
|
}
|
|
2275
2308
|
}
|
|
2276
2309
|
|
|
2277
2310
|
// src/actions/gitlint.ts
|
|
2278
|
-
import
|
|
2311
|
+
import chalk28 from "chalk";
|
|
2279
2312
|
import ParseGitConfig from "parse-git-config";
|
|
2280
2313
|
var gitlint = () => {
|
|
2281
2314
|
console.log(`
|
|
@@ -2286,7 +2319,7 @@ Gitlint Start [${process.cwd()}]
|
|
|
2286
2319
|
const errors = 0;
|
|
2287
2320
|
const gitConfig = ParseGitConfig.sync();
|
|
2288
2321
|
const warn = (message) => {
|
|
2289
|
-
console.warn(
|
|
2322
|
+
console.warn(chalk28.yellow(`Warning: ${message}`));
|
|
2290
2323
|
warnings++;
|
|
2291
2324
|
};
|
|
2292
2325
|
if (gitConfig.core.ignorecase) {
|
|
@@ -2306,13 +2339,13 @@ Gitlint Start [${process.cwd()}]
|
|
|
2306
2339
|
}
|
|
2307
2340
|
const resultMessages = [];
|
|
2308
2341
|
if (valid > 0) {
|
|
2309
|
-
resultMessages.push(
|
|
2342
|
+
resultMessages.push(chalk28.green(`Passed: ${valid}`));
|
|
2310
2343
|
}
|
|
2311
2344
|
if (warnings > 0) {
|
|
2312
|
-
resultMessages.push(
|
|
2345
|
+
resultMessages.push(chalk28.yellow(`Warnings: ${warnings}`));
|
|
2313
2346
|
}
|
|
2314
2347
|
if (errors > 0) {
|
|
2315
|
-
resultMessages.push(
|
|
2348
|
+
resultMessages.push(chalk28.red(` Errors: ${errors}`));
|
|
2316
2349
|
}
|
|
2317
2350
|
console.warn(`Gitlint Finish [ ${resultMessages.join(" | ")} ]
|
|
2318
2351
|
`);
|
|
@@ -2321,7 +2354,7 @@ Gitlint Start [${process.cwd()}]
|
|
|
2321
2354
|
|
|
2322
2355
|
// src/actions/gitlint-fix.ts
|
|
2323
2356
|
import { execSync as execSync3 } from "child_process";
|
|
2324
|
-
import
|
|
2357
|
+
import chalk29 from "chalk";
|
|
2325
2358
|
import ParseGitConfig2 from "parse-git-config";
|
|
2326
2359
|
var gitlintFix = () => {
|
|
2327
2360
|
console.log(`
|
|
@@ -2330,15 +2363,15 @@ Gitlint Fix Start [${process.cwd()}]
|
|
|
2330
2363
|
const gitConfig = ParseGitConfig2.sync();
|
|
2331
2364
|
if (gitConfig.core.ignorecase) {
|
|
2332
2365
|
execSync3("git config core.ignorecase false", { stdio: "inherit" });
|
|
2333
|
-
console.warn(
|
|
2366
|
+
console.warn(chalk29.yellow("\nGitlint Fix: Updated core.ignorecase to be false\n"));
|
|
2334
2367
|
}
|
|
2335
2368
|
if (gitConfig.core.autocrlf !== false) {
|
|
2336
2369
|
execSync3("git config core.autocrlf false", { stdio: "inherit" });
|
|
2337
|
-
console.warn(
|
|
2370
|
+
console.warn(chalk29.yellow("\nGitlint Fix: Updated core.autocrlf to be false\n"));
|
|
2338
2371
|
}
|
|
2339
2372
|
if (gitConfig.core.eol !== "lf") {
|
|
2340
2373
|
execSync3("git config core.eol lf", { stdio: "inherit" });
|
|
2341
|
-
console.warn(
|
|
2374
|
+
console.warn(chalk29.yellow('\nGitlint Fix: Updated core.eol to be "lf"\n'));
|
|
2342
2375
|
}
|
|
2343
2376
|
return 1;
|
|
2344
2377
|
};
|
|
@@ -2349,7 +2382,7 @@ var knip = () => {
|
|
|
2349
2382
|
};
|
|
2350
2383
|
|
|
2351
2384
|
// src/actions/license.ts
|
|
2352
|
-
import
|
|
2385
|
+
import chalk30 from "chalk";
|
|
2353
2386
|
import { init } from "license-checker";
|
|
2354
2387
|
var license = async (pkg) => {
|
|
2355
2388
|
const workspaces = yarnWorkspaces();
|
|
@@ -2374,18 +2407,18 @@ var license = async (pkg) => {
|
|
|
2374
2407
|
"LGPL-3.0-or-later",
|
|
2375
2408
|
"Python-2.0"
|
|
2376
2409
|
]);
|
|
2377
|
-
console.log(
|
|
2410
|
+
console.log(chalk30.green("License Checker"));
|
|
2378
2411
|
return (await Promise.all(
|
|
2379
2412
|
workspaceList.map(({ location, name }) => {
|
|
2380
2413
|
return new Promise((resolve) => {
|
|
2381
2414
|
init({ production: true, start: location }, (error, packages) => {
|
|
2382
2415
|
if (error) {
|
|
2383
|
-
console.error(
|
|
2384
|
-
console.error(
|
|
2416
|
+
console.error(chalk30.red(`License Checker [${name}] Error`));
|
|
2417
|
+
console.error(chalk30.gray(error));
|
|
2385
2418
|
console.log("\n");
|
|
2386
2419
|
resolve(1);
|
|
2387
2420
|
} else {
|
|
2388
|
-
console.log(
|
|
2421
|
+
console.log(chalk30.green(`License Checker [${name}]`));
|
|
2389
2422
|
let count = 0;
|
|
2390
2423
|
for (const [name2, info] of Object.entries(packages)) {
|
|
2391
2424
|
const licenses = Array.isArray(info.licenses) ? info.licenses : [info.licenses];
|
|
@@ -2401,7 +2434,7 @@ var license = async (pkg) => {
|
|
|
2401
2434
|
}
|
|
2402
2435
|
if (!orLicenseFound) {
|
|
2403
2436
|
count++;
|
|
2404
|
-
console.warn(
|
|
2437
|
+
console.warn(chalk30.yellow(`${name2}: Package License not allowed [${license2}]`));
|
|
2405
2438
|
}
|
|
2406
2439
|
}
|
|
2407
2440
|
}
|
|
@@ -2420,9 +2453,9 @@ var filename = ".npmignore";
|
|
|
2420
2453
|
var npmignoreGen = (pkg) => generateIgnoreFiles(filename, pkg);
|
|
2421
2454
|
|
|
2422
2455
|
// src/actions/package-lint.ts
|
|
2423
|
-
import { readFileSync as
|
|
2424
|
-
import
|
|
2425
|
-
import
|
|
2456
|
+
import { readFileSync as readFileSync14, writeFileSync as writeFileSync6 } from "fs";
|
|
2457
|
+
import PATH10 from "path";
|
|
2458
|
+
import chalk31 from "chalk";
|
|
2426
2459
|
import picomatch from "picomatch";
|
|
2427
2460
|
function emptyResult() {
|
|
2428
2461
|
return {
|
|
@@ -2432,11 +2465,11 @@ function emptyResult() {
|
|
|
2432
2465
|
};
|
|
2433
2466
|
}
|
|
2434
2467
|
function readRootPackageJson(cwd) {
|
|
2435
|
-
const raw =
|
|
2468
|
+
const raw = readFileSync14(PATH10.resolve(cwd, "package.json"), "utf8");
|
|
2436
2469
|
return JSON.parse(raw);
|
|
2437
2470
|
}
|
|
2438
2471
|
function writeRootPackageJson(cwd, pkg) {
|
|
2439
|
-
const path8 =
|
|
2472
|
+
const path8 = PATH10.resolve(cwd, "package.json");
|
|
2440
2473
|
writeFileSync6(path8, `${JSON.stringify(pkg, null, 2)}
|
|
2441
2474
|
`, "utf8");
|
|
2442
2475
|
}
|
|
@@ -2464,7 +2497,7 @@ function checkRootPrivate(pkg) {
|
|
|
2464
2497
|
function fixRootPrivate(cwd, pkg) {
|
|
2465
2498
|
pkg.private = true;
|
|
2466
2499
|
writeRootPackageJson(cwd, pkg);
|
|
2467
|
-
console.log(
|
|
2500
|
+
console.log(chalk31.green(' \u2714 Fixed: set "private": true in root package.json'));
|
|
2468
2501
|
}
|
|
2469
2502
|
function checkNoPublishConfigOnPrivate(pkg) {
|
|
2470
2503
|
const result = emptyResult();
|
|
@@ -2476,7 +2509,7 @@ function checkNoPublishConfigOnPrivate(pkg) {
|
|
|
2476
2509
|
function fixNoPublishConfigOnPrivate(cwd, pkg) {
|
|
2477
2510
|
delete pkg.publishConfig;
|
|
2478
2511
|
writeRootPackageJson(cwd, pkg);
|
|
2479
|
-
console.log(
|
|
2512
|
+
console.log(chalk31.green(" \u2714 Fixed: removed publishConfig from private root package.json"));
|
|
2480
2513
|
}
|
|
2481
2514
|
function checkDiscoverable(pkg, workspaces) {
|
|
2482
2515
|
const result = emptyResult();
|
|
@@ -2495,22 +2528,22 @@ function logResults(label, result, fix2) {
|
|
|
2495
2528
|
let errors = 0;
|
|
2496
2529
|
let fixed = 0;
|
|
2497
2530
|
for (const error of result.errors) {
|
|
2498
|
-
console.log(
|
|
2531
|
+
console.log(chalk31.red(` \u2717 ${error}`));
|
|
2499
2532
|
errors++;
|
|
2500
2533
|
}
|
|
2501
2534
|
for (const fixable of result.fixable) {
|
|
2502
2535
|
if (fix2) {
|
|
2503
2536
|
fixed++;
|
|
2504
2537
|
} else {
|
|
2505
|
-
console.log(
|
|
2538
|
+
console.log(chalk31.red(` \u2717 ${fixable} (fixable)`));
|
|
2506
2539
|
errors++;
|
|
2507
2540
|
}
|
|
2508
2541
|
}
|
|
2509
2542
|
for (const warning of result.warnings) {
|
|
2510
|
-
console.log(
|
|
2543
|
+
console.log(chalk31.yellow(` \u26A0 ${warning}`));
|
|
2511
2544
|
}
|
|
2512
2545
|
if (errors === 0 && fixed === 0 && result.warnings.length === 0) {
|
|
2513
|
-
console.log(
|
|
2546
|
+
console.log(chalk31.green(` \u2713 ${label}`));
|
|
2514
2547
|
}
|
|
2515
2548
|
return { errors, fixed };
|
|
2516
2549
|
}
|
|
@@ -2530,14 +2563,14 @@ function runChecks(entries, cwd, pkg, fix2) {
|
|
|
2530
2563
|
}
|
|
2531
2564
|
function logSummary(errors, fixed) {
|
|
2532
2565
|
if (fixed > 0) {
|
|
2533
|
-
console.log(
|
|
2566
|
+
console.log(chalk31.green(`
|
|
2534
2567
|
Fixed ${fixed} issue(s)`));
|
|
2535
2568
|
}
|
|
2536
2569
|
if (errors > 0) {
|
|
2537
|
-
console.log(
|
|
2570
|
+
console.log(chalk31.red(`
|
|
2538
2571
|
${errors} error(s) found`));
|
|
2539
2572
|
} else if (fixed === 0) {
|
|
2540
|
-
console.log(
|
|
2573
|
+
console.log(chalk31.green("\n All checks passed"));
|
|
2541
2574
|
}
|
|
2542
2575
|
}
|
|
2543
2576
|
function packageLintMonorepo(fix2 = false) {
|
|
@@ -2546,14 +2579,14 @@ function packageLintMonorepo(fix2 = false) {
|
|
|
2546
2579
|
try {
|
|
2547
2580
|
pkg = readRootPackageJson(cwd);
|
|
2548
2581
|
} catch {
|
|
2549
|
-
console.error(
|
|
2582
|
+
console.error(chalk31.red("Could not read package.json"));
|
|
2550
2583
|
return 1;
|
|
2551
2584
|
}
|
|
2552
2585
|
if (!isMonorepo(pkg)) {
|
|
2553
|
-
console.log(
|
|
2586
|
+
console.log(chalk31.gray("Not a monorepo \u2014 skipping package-lint checks"));
|
|
2554
2587
|
return 0;
|
|
2555
2588
|
}
|
|
2556
|
-
console.log(
|
|
2589
|
+
console.log(chalk31.green("Package Lint"));
|
|
2557
2590
|
const workspaces = yarnWorkspaces();
|
|
2558
2591
|
const checks = [
|
|
2559
2592
|
{
|
|
@@ -2627,7 +2660,7 @@ var rebuild = ({ target }) => {
|
|
|
2627
2660
|
};
|
|
2628
2661
|
|
|
2629
2662
|
// src/actions/recompile.ts
|
|
2630
|
-
import
|
|
2663
|
+
import chalk32 from "chalk";
|
|
2631
2664
|
var recompile = async ({
|
|
2632
2665
|
verbose,
|
|
2633
2666
|
target,
|
|
@@ -2663,7 +2696,7 @@ var recompileAll = async ({
|
|
|
2663
2696
|
const incrementalOptions = incremental ? ["--since", "-Apt", "--topological-dev"] : ["--parallel", "-Apt", "--topological-dev"];
|
|
2664
2697
|
const jobsOptions = jobs ? ["-j", `${jobs}`] : [];
|
|
2665
2698
|
if (jobs) {
|
|
2666
|
-
console.log(
|
|
2699
|
+
console.log(chalk32.blue(`Jobs set to [${jobs}]`));
|
|
2667
2700
|
}
|
|
2668
2701
|
const result = await runStepsAsync(`Recompile${incremental ? "-Incremental" : ""} [All]`, [
|
|
2669
2702
|
[
|
|
@@ -2694,7 +2727,7 @@ var recompileAll = async ({
|
|
|
2694
2727
|
]
|
|
2695
2728
|
]);
|
|
2696
2729
|
console.log(
|
|
2697
|
-
`${
|
|
2730
|
+
`${chalk32.gray("Recompiled in")} [${chalk32.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk32.gray("seconds")}`
|
|
2698
2731
|
);
|
|
2699
2732
|
return result;
|
|
2700
2733
|
};
|
|
@@ -2725,13 +2758,13 @@ var reinstall = () => {
|
|
|
2725
2758
|
};
|
|
2726
2759
|
|
|
2727
2760
|
// src/actions/relint.ts
|
|
2728
|
-
import
|
|
2761
|
+
import chalk33 from "chalk";
|
|
2729
2762
|
var relintPackage = ({
|
|
2730
2763
|
pkg,
|
|
2731
2764
|
fix: fix2,
|
|
2732
2765
|
verbose
|
|
2733
2766
|
}) => {
|
|
2734
|
-
console.log(
|
|
2767
|
+
console.log(chalk33.gray(`${fix2 ? "Fix" : "Lint"} [${pkg}]`));
|
|
2735
2768
|
const start = Date.now();
|
|
2736
2769
|
const result = runSteps(`${fix2 ? "Fix" : "Lint"} [${pkg}]`, [
|
|
2737
2770
|
["yarn", [
|
|
@@ -2741,7 +2774,7 @@ var relintPackage = ({
|
|
|
2741
2774
|
fix2 ? "package-fix" : verbose ? "package-lint-verbose" : "package-lint"
|
|
2742
2775
|
]]
|
|
2743
2776
|
]);
|
|
2744
|
-
console.log(
|
|
2777
|
+
console.log(chalk33.gray(`${fix2 ? "Fixed in" : "Linted in"} [${chalk33.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk33.gray("seconds")}`));
|
|
2745
2778
|
return result;
|
|
2746
2779
|
};
|
|
2747
2780
|
var relint = ({
|
|
@@ -2761,13 +2794,13 @@ var relint = ({
|
|
|
2761
2794
|
});
|
|
2762
2795
|
};
|
|
2763
2796
|
var relintAllPackages = ({ fix: fix2 = false } = {}) => {
|
|
2764
|
-
console.log(
|
|
2797
|
+
console.log(chalk33.gray(`${fix2 ? "Fix" : "Lint"} [All-Packages]`));
|
|
2765
2798
|
const start = Date.now();
|
|
2766
2799
|
const fixOptions = fix2 ? ["--fix"] : [];
|
|
2767
2800
|
const result = runSteps(`${fix2 ? "Fix" : "Lint"} [All-Packages]`, [
|
|
2768
2801
|
["yarn", ["eslint", ...fixOptions]]
|
|
2769
2802
|
]);
|
|
2770
|
-
console.log(
|
|
2803
|
+
console.log(chalk33.gray(`${fix2 ? "Fixed in" : "Linted in"} [${chalk33.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk33.gray("seconds")}`));
|
|
2771
2804
|
return result;
|
|
2772
2805
|
};
|
|
2773
2806
|
|
|
@@ -2785,10 +2818,10 @@ var sonar = () => {
|
|
|
2785
2818
|
};
|
|
2786
2819
|
|
|
2787
2820
|
// src/actions/statics.ts
|
|
2788
|
-
import
|
|
2821
|
+
import chalk34 from "chalk";
|
|
2789
2822
|
var DefaultDependencies = ["axios", "@xylabs/pixel", "react", "graphql", "react-router", "@mui/material", "@mui/system"];
|
|
2790
2823
|
var statics = () => {
|
|
2791
|
-
console.log(
|
|
2824
|
+
console.log(chalk34.green("Check Required Static Dependencies"));
|
|
2792
2825
|
const statics2 = parsedPackageJSON()?.xy?.deps?.statics;
|
|
2793
2826
|
return detectDuplicateDependencies(statics2, DefaultDependencies);
|
|
2794
2827
|
};
|
|
@@ -3369,7 +3402,7 @@ var xyInstallCommands = (args) => {
|
|
|
3369
3402
|
};
|
|
3370
3403
|
|
|
3371
3404
|
// src/xy/lint/cycleCommand.ts
|
|
3372
|
-
import
|
|
3405
|
+
import chalk35 from "chalk";
|
|
3373
3406
|
var cycleCommand = {
|
|
3374
3407
|
command: "cycle [package]",
|
|
3375
3408
|
describe: "Cycle - Check for dependency cycles",
|
|
@@ -3380,12 +3413,12 @@ var cycleCommand = {
|
|
|
3380
3413
|
const start = Date.now();
|
|
3381
3414
|
if (argv.verbose) console.log("Cycle");
|
|
3382
3415
|
process.exitCode = await cycle({ pkg: argv.package });
|
|
3383
|
-
console.log(
|
|
3416
|
+
console.log(chalk35.blue(`Finished in ${Date.now() - start}ms`));
|
|
3384
3417
|
}
|
|
3385
3418
|
};
|
|
3386
3419
|
|
|
3387
3420
|
// src/xy/lint/deplintCommand.ts
|
|
3388
|
-
import
|
|
3421
|
+
import chalk36 from "chalk";
|
|
3389
3422
|
var deplintCommand = {
|
|
3390
3423
|
command: "deplint [package]",
|
|
3391
3424
|
describe: "Deplint - Run Deplint",
|
|
@@ -3423,12 +3456,12 @@ var deplintCommand = {
|
|
|
3423
3456
|
peerDeps: !!argv.peerDeps,
|
|
3424
3457
|
verbose: !!argv.verbose
|
|
3425
3458
|
});
|
|
3426
|
-
console.log(
|
|
3459
|
+
console.log(chalk36.blue(`Finished in ${Date.now() - start}ms`));
|
|
3427
3460
|
}
|
|
3428
3461
|
};
|
|
3429
3462
|
|
|
3430
3463
|
// src/xy/lint/fixCommand.ts
|
|
3431
|
-
import
|
|
3464
|
+
import chalk37 from "chalk";
|
|
3432
3465
|
var fixCommand = {
|
|
3433
3466
|
command: "fix [package]",
|
|
3434
3467
|
describe: "Fix - Run Eslint w/fix",
|
|
@@ -3439,12 +3472,12 @@ var fixCommand = {
|
|
|
3439
3472
|
const start = Date.now();
|
|
3440
3473
|
if (argv.verbose) console.log("Fix");
|
|
3441
3474
|
process.exitCode = fix();
|
|
3442
|
-
console.log(
|
|
3475
|
+
console.log(chalk37.blue(`Finished in ${Date.now() - start}ms`));
|
|
3443
3476
|
}
|
|
3444
3477
|
};
|
|
3445
3478
|
|
|
3446
3479
|
// src/xy/lint/knipCommand.ts
|
|
3447
|
-
import
|
|
3480
|
+
import chalk38 from "chalk";
|
|
3448
3481
|
var knipCommand = {
|
|
3449
3482
|
command: "knip",
|
|
3450
3483
|
describe: "Knip - Run Knip",
|
|
@@ -3455,12 +3488,12 @@ var knipCommand = {
|
|
|
3455
3488
|
if (argv.verbose) console.log("Knip");
|
|
3456
3489
|
const start = Date.now();
|
|
3457
3490
|
process.exitCode = knip();
|
|
3458
|
-
console.log(
|
|
3491
|
+
console.log(chalk38.blue(`Knip finished in ${Date.now() - start}ms`));
|
|
3459
3492
|
}
|
|
3460
3493
|
};
|
|
3461
3494
|
|
|
3462
3495
|
// src/xy/lint/lintCommand.ts
|
|
3463
|
-
import
|
|
3496
|
+
import chalk39 from "chalk";
|
|
3464
3497
|
var lintCommand = {
|
|
3465
3498
|
command: "lint [package]",
|
|
3466
3499
|
describe: "Lint - Run Eslint",
|
|
@@ -3489,7 +3522,7 @@ var lintCommand = {
|
|
|
3489
3522
|
cache: argv.cache,
|
|
3490
3523
|
verbose: !!argv.verbose
|
|
3491
3524
|
});
|
|
3492
|
-
console.log(
|
|
3525
|
+
console.log(chalk39.blue(`Finished in ${Date.now() - start}ms`));
|
|
3493
3526
|
}
|
|
3494
3527
|
};
|
|
3495
3528
|
|
|
@@ -3511,7 +3544,7 @@ var packageLintCommand = {
|
|
|
3511
3544
|
};
|
|
3512
3545
|
|
|
3513
3546
|
// src/xy/lint/publintCommand.ts
|
|
3514
|
-
import
|
|
3547
|
+
import chalk40 from "chalk";
|
|
3515
3548
|
var publintCommand = {
|
|
3516
3549
|
command: "publint [package]",
|
|
3517
3550
|
describe: "Publint - Run Publint",
|
|
@@ -3522,12 +3555,12 @@ var publintCommand = {
|
|
|
3522
3555
|
if (argv.verbose) console.log("Publint");
|
|
3523
3556
|
const start = Date.now();
|
|
3524
3557
|
process.exitCode = await publint({ pkg: argv.package, verbose: !!argv.verbose });
|
|
3525
|
-
console.log(
|
|
3558
|
+
console.log(chalk40.blue(`Finished in ${Date.now() - start}ms`));
|
|
3526
3559
|
}
|
|
3527
3560
|
};
|
|
3528
3561
|
|
|
3529
3562
|
// src/xy/lint/relintCommand.ts
|
|
3530
|
-
import
|
|
3563
|
+
import chalk41 from "chalk";
|
|
3531
3564
|
var relintCommand = {
|
|
3532
3565
|
command: "relint [package]",
|
|
3533
3566
|
describe: "Relint - Clean & Lint",
|
|
@@ -3538,12 +3571,12 @@ var relintCommand = {
|
|
|
3538
3571
|
if (argv.verbose) console.log("Relinting");
|
|
3539
3572
|
const start = Date.now();
|
|
3540
3573
|
process.exitCode = relint();
|
|
3541
|
-
console.log(
|
|
3574
|
+
console.log(chalk41.blue(`Finished in ${Date.now() - start}ms`));
|
|
3542
3575
|
}
|
|
3543
3576
|
};
|
|
3544
3577
|
|
|
3545
3578
|
// src/xy/lint/sonarCommand.ts
|
|
3546
|
-
import
|
|
3579
|
+
import chalk42 from "chalk";
|
|
3547
3580
|
var sonarCommand = {
|
|
3548
3581
|
command: "sonar",
|
|
3549
3582
|
describe: "Sonar - Run Sonar Check",
|
|
@@ -3554,7 +3587,7 @@ var sonarCommand = {
|
|
|
3554
3587
|
const start = Date.now();
|
|
3555
3588
|
if (argv.verbose) console.log("Sonar Check");
|
|
3556
3589
|
process.exitCode = sonar();
|
|
3557
|
-
console.log(
|
|
3590
|
+
console.log(chalk42.blue(`Finished in ${Date.now() - start}ms`));
|
|
3558
3591
|
}
|
|
3559
3592
|
};
|
|
3560
3593
|
|
|
@@ -3564,13 +3597,21 @@ var xyLintCommands = (args) => {
|
|
|
3564
3597
|
};
|
|
3565
3598
|
|
|
3566
3599
|
// src/xy/xy.ts
|
|
3567
|
-
import
|
|
3600
|
+
import chalk43 from "chalk";
|
|
3568
3601
|
|
|
3569
3602
|
// src/xy/xyParseOptions.ts
|
|
3570
3603
|
import yargs from "yargs";
|
|
3571
3604
|
import { hideBin } from "yargs/helpers";
|
|
3572
3605
|
var xyParseOptions = () => {
|
|
3573
|
-
return yargs(hideBin(process.argv)).scriptName("yarn xy").
|
|
3606
|
+
return yargs(hideBin(process.argv)).scriptName("yarn xy").middleware((argv) => {
|
|
3607
|
+
const commandName = argv._[0];
|
|
3608
|
+
if (commandName && argv._.length <= 1) {
|
|
3609
|
+
const result = tryRunLocalScript(commandName);
|
|
3610
|
+
if (result !== void 0) {
|
|
3611
|
+
process.exit(result);
|
|
3612
|
+
}
|
|
3613
|
+
}
|
|
3614
|
+
}, true).option("jobs", {
|
|
3574
3615
|
alias: "j",
|
|
3575
3616
|
default: void 0,
|
|
3576
3617
|
description: "Max parallel jobs",
|
|
@@ -3597,8 +3638,8 @@ var xyParseOptions = () => {
|
|
|
3597
3638
|
var xy = async () => {
|
|
3598
3639
|
const options = xyParseOptions();
|
|
3599
3640
|
return await xyBuildCommands(xyCommonCommands(xyInstallCommands(xyDeployCommands(xyLintCommands(options))))).demandCommand(1).command("*", "", () => {
|
|
3600
|
-
console.error(
|
|
3601
|
-
console.log(
|
|
3641
|
+
console.error(chalk43.yellow(`Command not found [${chalk43.magenta(process.argv[2])}]`));
|
|
3642
|
+
console.log(chalk43.gray("Try 'yarn xy --help' for list of commands"));
|
|
3602
3643
|
}).version().help().argv;
|
|
3603
3644
|
};
|
|
3604
3645
|
|