@xylabs/ts-scripts-yarn3 7.4.20 → 7.4.22
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-clean.mjs +71 -0
- package/dist/actions/claude-clean.mjs.map +1 -0
- package/dist/actions/claude-commands.mjs +11 -2
- package/dist/actions/claude-commands.mjs.map +1 -1
- package/dist/actions/claude-rules.mjs +27 -7
- package/dist/actions/claude-rules.mjs.map +1 -1
- package/dist/actions/claude-skills.mjs.map +1 -1
- package/dist/actions/dupdeps.mjs +3 -2
- package/dist/actions/dupdeps.mjs.map +1 -1
- package/dist/actions/gitignore.mjs +152 -0
- package/dist/actions/gitignore.mjs.map +1 -0
- package/dist/actions/index.mjs +392 -206
- package/dist/actions/index.mjs.map +1 -1
- package/dist/bin/xy.mjs +432 -226
- package/dist/bin/xy.mjs.map +1 -1
- package/dist/index.d.ts +11 -3
- package/dist/index.mjs +495 -282
- package/dist/index.mjs.map +1 -1
- package/dist/lib/claudeMdTemplate.mjs +5 -1
- package/dist/lib/claudeMdTemplate.mjs.map +1 -1
- package/dist/lib/gitignoreTemplate.mjs +12 -0
- package/dist/lib/gitignoreTemplate.mjs.map +1 -0
- package/dist/lib/index.mjs +17 -3
- package/dist/lib/index.mjs.map +1 -1
- package/dist/xy/build/buildCommand.mjs +161 -0
- package/dist/xy/build/buildCommand.mjs.map +1 -0
- package/dist/xy/build/compileCommand.mjs +174 -0
- package/dist/xy/build/compileCommand.mjs.map +1 -0
- package/dist/xy/build/compileOnlyCommand.mjs +175 -0
- package/dist/xy/build/compileOnlyCommand.mjs.map +1 -0
- package/dist/xy/build/copyAssetsCommand.mjs +84 -0
- package/dist/xy/build/copyAssetsCommand.mjs.map +1 -0
- package/dist/xy/{build-commands → build}/index.mjs +45 -40
- package/dist/xy/build/index.mjs.map +1 -0
- package/dist/xy/build/rebuildCommand.mjs +114 -0
- package/dist/xy/build/rebuildCommand.mjs.map +1 -0
- package/dist/xy/build/recompileCommand.mjs +204 -0
- package/dist/xy/build/recompileCommand.mjs.map +1 -0
- package/dist/xy/common/claude/cleanCommand.mjs +79 -0
- package/dist/xy/common/claude/cleanCommand.mjs.map +1 -0
- package/dist/xy/common/claude/commandsCommand.mjs +11 -2
- package/dist/xy/common/claude/commandsCommand.mjs.map +1 -1
- package/dist/xy/common/claude/index.mjs +171 -69
- package/dist/xy/common/claude/index.mjs.map +1 -1
- package/dist/xy/common/claude/initCommand.mjs +38 -115
- package/dist/xy/common/claude/initCommand.mjs.map +1 -1
- package/dist/xy/common/claude/rulesCommand.mjs +27 -7
- package/dist/xy/common/claude/rulesCommand.mjs.map +1 -1
- package/dist/xy/common/claude/skillsCommand.mjs.map +1 -1
- package/dist/xy/common/gitignoreCommand.mjs +158 -0
- package/dist/xy/common/gitignoreCommand.mjs.map +1 -0
- package/dist/xy/common/index.mjs +304 -109
- package/dist/xy/common/index.mjs.map +1 -1
- package/dist/xy/index.mjs +432 -226
- package/dist/xy/index.mjs.map +1 -1
- package/dist/xy/install/dupdepsCommand.mjs +3 -2
- package/dist/xy/install/dupdepsCommand.mjs.map +1 -1
- package/dist/xy/install/index.mjs +3 -2
- package/dist/xy/install/index.mjs.map +1 -1
- package/dist/xy/xy.mjs +432 -226
- package/dist/xy/xy.mjs.map +1 -1
- package/package.json +2 -2
- package/templates/claude/CLAUDE-local.md +4 -0
- package/templates/claude/commands/xy-dead.md +5 -0
- package/templates/claude/{rules/xylabs-dependencies.md → commands/xy-deps.md} +7 -7
- package/templates/claude/commands/xy-dupdeps.md +5 -0
- package/templates/claude/commands/xy-gen-docs.md +5 -0
- package/templates/claude/commands/xy-gitignore.md +5 -0
- package/templates/claude/commands/xy-gitlint.md +5 -0
- package/templates/claude/commands/xy-license.md +5 -0
- package/templates/claude/commands/xy-lint-rules.md +44 -0
- package/templates/claude/commands/xy-recompile.md +5 -0
- package/templates/claude/commands/xy-reinstall.md +5 -0
- package/templates/claude/commands/xy-relint.md +5 -0
- package/templates/claude/commands/xy-retest.md +5 -0
- package/templates/claude/commands/xy-sonar.md +5 -0
- package/templates/claude/commands/xy-up.md +7 -0
- package/templates/claude/rules/xylabs-architecture.md +4 -7
- package/templates/claude/rules/xylabs-build.md +6 -11
- package/templates/claude/rules/xylabs-git-workflow.md +3 -5
- package/templates/claude/rules/xylabs-naming.md +4 -7
- package/templates/claude/rules/xylabs-style.md +14 -19
- package/templates/claude/skills/xylabs-e2e-setup/SKILL.md +16 -2
- package/templates/gitignore/template.gitignore +40 -0
- package/dist/actions/gitignore-gen.mjs +0 -88
- package/dist/actions/gitignore-gen.mjs.map +0 -1
- package/dist/xy/build-commands/build.mjs +0 -502
- package/dist/xy/build-commands/build.mjs.map +0 -1
- package/dist/xy/build-commands/index.mjs.map +0 -1
- package/dist/xy/common/gitignoreGenCommand.mjs +0 -98
- package/dist/xy/common/gitignoreGenCommand.mjs.map +0 -1
- package/templates/claude/commands/xylabs-deploy-major.md +0 -7
- package/templates/claude/commands/xylabs-deploy-minor.md +0 -7
- package/templates/claude/commands/xylabs-deploy.md +0 -7
- package/templates/claude/rules/xylabs-error-handling.md +0 -7
- package/templates/claude/rules/xylabs-frameworks.md +0 -8
- package/templates/claude/rules/xylabs-linting.md +0 -55
- package/templates/claude/rules/xylabs-typescript.md +0 -11
- /package/templates/claude/commands/{xylabs-build.md → xy-build.md} +0 -0
- /package/templates/claude/commands/{xylabs-clean.md → xy-clean.md} +0 -0
- /package/templates/claude/commands/{xylabs-compile.md → xy-compile.md} +0 -0
- /package/templates/claude/commands/{xylabs-cycle.md → xy-cycle.md} +0 -0
- /package/templates/claude/commands/{xylabs-deplint.md → xy-deplint.md} +0 -0
- /package/templates/claude/commands/{xylabs-fix.md → xy-fix.md} +0 -0
- /package/templates/claude/commands/{xylabs-knip.md → xy-knip.md} +0 -0
- /package/templates/claude/commands/{xylabs-lint.md → xy-lint.md} +0 -0
- /package/templates/claude/commands/{xylabs-publint.md → xy-publint.md} +0 -0
- /package/templates/claude/commands/{xylabs-rebuild.md → xy-rebuild.md} +0 -0
- /package/templates/claude/commands/{xylabs-test.md → xy-test.md} +0 -0
package/dist/xy/xy.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// src/xy/xy.ts
|
|
2
|
-
import
|
|
2
|
+
import chalk41 from "chalk";
|
|
3
3
|
|
|
4
4
|
// src/actions/build.ts
|
|
5
5
|
import chalk9 from "chalk";
|
|
@@ -29,7 +29,8 @@ var require2 = createRequire(import.meta.url);
|
|
|
29
29
|
var packageRoot = PATH.dirname(require2.resolve("@xylabs/ts-scripts-yarn3/package.json"));
|
|
30
30
|
var templatesDir = PATH.resolve(packageRoot, "templates", "claude");
|
|
31
31
|
var XYLABS_RULES_PREFIX = "xylabs-";
|
|
32
|
-
var XYLABS_COMMANDS_PREFIX = "
|
|
32
|
+
var XYLABS_COMMANDS_PREFIX = "xy-";
|
|
33
|
+
var LEGACY_COMMANDS_PREFIX = "xylabs-";
|
|
33
34
|
var XYLABS_SKILLS_PREFIX = "xylabs-";
|
|
34
35
|
var claudeMdRuleTemplates = () => {
|
|
35
36
|
const rulesDir = PATH.resolve(templatesDir, "rules");
|
|
@@ -67,7 +68,7 @@ var claudeSkillTemplates = () => {
|
|
|
67
68
|
}
|
|
68
69
|
return result;
|
|
69
70
|
};
|
|
70
|
-
var
|
|
71
|
+
var claudeMdLocalTemplate = () => readFileSync(PATH.resolve(templatesDir, "CLAUDE-local.md"), "utf8");
|
|
71
72
|
|
|
72
73
|
// src/lib/deleteGlob.ts
|
|
73
74
|
import fs from "fs";
|
|
@@ -327,19 +328,19 @@ var INIT_CWD = () => {
|
|
|
327
328
|
// src/lib/generateIgnoreFiles.ts
|
|
328
329
|
var localeCompare = (a, b) => a.localeCompare(b);
|
|
329
330
|
var mergeEntries = (a, b) => [...union(a, b)].toSorted(localeCompare);
|
|
330
|
-
var generateIgnoreFiles = (
|
|
331
|
-
console.log(chalk4.green(`Generate ${
|
|
331
|
+
var generateIgnoreFiles = (filename2, pkg) => {
|
|
332
|
+
console.log(chalk4.green(`Generate ${filename2} Files`));
|
|
332
333
|
const cwd = INIT_CWD() ?? ".";
|
|
333
334
|
const workspaces = pkg ? [yarnWorkspace(pkg)] : yarnWorkspaces();
|
|
334
|
-
const readEntries = (location) => readNonEmptyLines(`${location}/${
|
|
335
|
-
const writeEntries = (location, entries) => writeLines(`${location}/${
|
|
335
|
+
const readEntries = (location) => readNonEmptyLines(`${location}/${filename2}`);
|
|
336
|
+
const writeEntries = (location, entries) => writeLines(`${location}/${filename2}`, entries);
|
|
336
337
|
const results = workspaces.map(({ location, name }) => {
|
|
337
338
|
try {
|
|
338
339
|
writeEntries(location, mergeEntries(readEntries(cwd), readEntries(location)));
|
|
339
340
|
return 0;
|
|
340
341
|
} catch (ex) {
|
|
341
342
|
const error = ex;
|
|
342
|
-
console.error(`Generate ${
|
|
343
|
+
console.error(`Generate ${filename2} Files [${name}] [${error.message}]`);
|
|
343
344
|
return 1;
|
|
344
345
|
}
|
|
345
346
|
});
|
|
@@ -569,6 +570,15 @@ async function generateReadmeFiles({
|
|
|
569
570
|
return failed ? 1 : 0;
|
|
570
571
|
}
|
|
571
572
|
|
|
573
|
+
// src/lib/gitignoreTemplate.ts
|
|
574
|
+
import { readFileSync as readFileSync4 } from "fs";
|
|
575
|
+
import { createRequire as createRequire3 } from "module";
|
|
576
|
+
import PATH3 from "path";
|
|
577
|
+
var require4 = createRequire3(import.meta.url);
|
|
578
|
+
var packageRoot3 = PATH3.dirname(require4.resolve("@xylabs/ts-scripts-yarn3/package.json"));
|
|
579
|
+
var templatesDir2 = PATH3.resolve(packageRoot3, "templates", "gitignore");
|
|
580
|
+
var gitignoreTemplate = () => readFileSync4(PATH3.resolve(templatesDir2, "template.gitignore"), "utf8");
|
|
581
|
+
|
|
572
582
|
// src/lib/loadConfig.ts
|
|
573
583
|
import chalk6 from "chalk";
|
|
574
584
|
import { cosmiconfig } from "cosmiconfig";
|
|
@@ -591,10 +601,10 @@ var loadConfig = async (params) => {
|
|
|
591
601
|
};
|
|
592
602
|
|
|
593
603
|
// src/lib/parsedPackageJSON.ts
|
|
594
|
-
import { readFileSync as
|
|
604
|
+
import { readFileSync as readFileSync5 } from "fs";
|
|
595
605
|
var parsedPackageJSON = (path8) => {
|
|
596
606
|
const pathToPackageJSON = path8 ?? process.env.npm_package_json ?? "";
|
|
597
|
-
const packageJSON =
|
|
607
|
+
const packageJSON = readFileSync5(pathToPackageJSON).toString();
|
|
598
608
|
return JSON.parse(packageJSON);
|
|
599
609
|
};
|
|
600
610
|
|
|
@@ -704,25 +714,85 @@ var build = async ({
|
|
|
704
714
|
return result;
|
|
705
715
|
};
|
|
706
716
|
|
|
707
|
-
// src/actions/claude-
|
|
717
|
+
// src/actions/claude-clean.ts
|
|
708
718
|
import {
|
|
709
719
|
existsSync as existsSync4,
|
|
710
|
-
mkdirSync,
|
|
711
720
|
readdirSync as readdirSync2,
|
|
712
|
-
|
|
713
|
-
unlinkSync
|
|
714
|
-
writeFileSync as writeFileSync2
|
|
721
|
+
rmSync,
|
|
722
|
+
unlinkSync
|
|
715
723
|
} from "fs";
|
|
716
|
-
import
|
|
724
|
+
import PATH4 from "path";
|
|
717
725
|
import chalk10 from "chalk";
|
|
726
|
+
function removeFile(filePath, label) {
|
|
727
|
+
if (existsSync4(filePath)) {
|
|
728
|
+
unlinkSync(filePath);
|
|
729
|
+
console.log(chalk10.yellow(` Removed ${label}`));
|
|
730
|
+
return true;
|
|
731
|
+
}
|
|
732
|
+
return false;
|
|
733
|
+
}
|
|
734
|
+
function removeDir(dirPath, label) {
|
|
735
|
+
if (existsSync4(dirPath)) {
|
|
736
|
+
rmSync(dirPath, { recursive: true });
|
|
737
|
+
console.log(chalk10.yellow(` Removed ${label}`));
|
|
738
|
+
return true;
|
|
739
|
+
}
|
|
740
|
+
return false;
|
|
741
|
+
}
|
|
742
|
+
function claudeClean() {
|
|
743
|
+
console.log(chalk10.green("Clean Claude configuration"));
|
|
744
|
+
const cwd = INIT_CWD() ?? process.cwd();
|
|
745
|
+
let removed = 0;
|
|
746
|
+
const rootFiles = ["CLAUDE.md", "CLAUDE.local.md"];
|
|
747
|
+
for (const file of rootFiles) {
|
|
748
|
+
if (removeFile(PATH4.resolve(cwd, file), file)) removed++;
|
|
749
|
+
}
|
|
750
|
+
if (removeDir(PATH4.resolve(cwd, ".claude"), ".claude/")) removed++;
|
|
751
|
+
const packagesDir = PATH4.resolve(cwd, "packages");
|
|
752
|
+
if (existsSync4(packagesDir)) {
|
|
753
|
+
const findClaudeFiles = (dir, prefix) => {
|
|
754
|
+
const entries = readdirSync2(dir, { withFileTypes: true });
|
|
755
|
+
for (const entry of entries) {
|
|
756
|
+
const fullPath = PATH4.resolve(dir, entry.name);
|
|
757
|
+
const label = `${prefix}${entry.name}`;
|
|
758
|
+
if (entry.isFile() && (entry.name === "CLAUDE.md" || entry.name === "CLAUDE.local.md")) {
|
|
759
|
+
if (removeFile(fullPath, label)) removed++;
|
|
760
|
+
} else if (entry.isDirectory() && entry.name === ".claude") {
|
|
761
|
+
if (removeDir(fullPath, `${label}/`)) removed++;
|
|
762
|
+
} else if (entry.isDirectory() && entry.name !== "node_modules" && entry.name !== "dist") {
|
|
763
|
+
findClaudeFiles(fullPath, `${label}/`);
|
|
764
|
+
}
|
|
765
|
+
}
|
|
766
|
+
};
|
|
767
|
+
findClaudeFiles(packagesDir, "packages/");
|
|
768
|
+
}
|
|
769
|
+
if (removed > 0) {
|
|
770
|
+
console.log(chalk10.green(` Removed ${removed} item(s)`));
|
|
771
|
+
} else {
|
|
772
|
+
console.log(chalk10.gray(" Nothing to clean"));
|
|
773
|
+
}
|
|
774
|
+
return 0;
|
|
775
|
+
}
|
|
776
|
+
|
|
777
|
+
// src/actions/claude-commands.ts
|
|
778
|
+
import {
|
|
779
|
+
existsSync as existsSync5,
|
|
780
|
+
mkdirSync,
|
|
781
|
+
readdirSync as readdirSync3,
|
|
782
|
+
readFileSync as readFileSync6,
|
|
783
|
+
unlinkSync as unlinkSync2,
|
|
784
|
+
writeFileSync as writeFileSync2
|
|
785
|
+
} from "fs";
|
|
786
|
+
import PATH5 from "path";
|
|
787
|
+
import chalk11 from "chalk";
|
|
718
788
|
var syncCommandFiles = (commandsDir) => {
|
|
719
789
|
const templates = claudeCommandTemplates();
|
|
720
790
|
const templateNames = new Set(Object.keys(templates));
|
|
721
791
|
let updated = 0;
|
|
722
792
|
let created = 0;
|
|
723
|
-
for (const [
|
|
724
|
-
const targetPath =
|
|
725
|
-
const existing =
|
|
793
|
+
for (const [filename2, content] of Object.entries(templates)) {
|
|
794
|
+
const targetPath = PATH5.resolve(commandsDir, filename2);
|
|
795
|
+
const existing = existsSync5(targetPath) ? readFileSync6(targetPath, "utf8") : void 0;
|
|
726
796
|
if (existing === content) continue;
|
|
727
797
|
writeFileSync2(targetPath, content, "utf8");
|
|
728
798
|
if (existing) {
|
|
@@ -738,16 +808,23 @@ var syncCommandFiles = (commandsDir) => {
|
|
|
738
808
|
};
|
|
739
809
|
};
|
|
740
810
|
var removeStaleCommands = (commandsDir, templateNames) => {
|
|
741
|
-
const existingCommands =
|
|
811
|
+
const existingCommands = readdirSync3(commandsDir).filter((f) => f.startsWith(XYLABS_COMMANDS_PREFIX) && f.endsWith(".md"));
|
|
742
812
|
let removed = 0;
|
|
743
813
|
for (const file of existingCommands) {
|
|
744
814
|
if (!templateNames.has(file)) {
|
|
745
|
-
|
|
815
|
+
unlinkSync2(PATH5.resolve(commandsDir, file));
|
|
746
816
|
removed++;
|
|
747
817
|
}
|
|
748
818
|
}
|
|
749
819
|
return removed;
|
|
750
820
|
};
|
|
821
|
+
var removeLegacyCommands = (commandsDir) => {
|
|
822
|
+
const legacyFiles = readdirSync3(commandsDir).filter((f) => f.startsWith(LEGACY_COMMANDS_PREFIX) && f.endsWith(".md"));
|
|
823
|
+
for (const file of legacyFiles) {
|
|
824
|
+
unlinkSync2(PATH5.resolve(commandsDir, file));
|
|
825
|
+
}
|
|
826
|
+
return legacyFiles.length;
|
|
827
|
+
};
|
|
751
828
|
var logCommandsResult = (created, updated, removed) => {
|
|
752
829
|
if (created || updated || removed) {
|
|
753
830
|
const parts = [
|
|
@@ -755,44 +832,46 @@ var logCommandsResult = (created, updated, removed) => {
|
|
|
755
832
|
updated ? `${updated} updated` : "",
|
|
756
833
|
removed ? `${removed} removed` : ""
|
|
757
834
|
].filter(Boolean);
|
|
758
|
-
console.log(
|
|
835
|
+
console.log(chalk11.green(`.claude/commands/${XYLABS_COMMANDS_PREFIX}*.md: ${parts.join(", ")}`));
|
|
759
836
|
} else {
|
|
760
|
-
console.log(
|
|
837
|
+
console.log(chalk11.gray(`.claude/commands/${XYLABS_COMMANDS_PREFIX}*.md: already up to date`));
|
|
761
838
|
}
|
|
762
839
|
};
|
|
763
840
|
var claudeCommands = () => {
|
|
764
841
|
const cwd = INIT_CWD() ?? process.cwd();
|
|
765
|
-
const commandsDir =
|
|
842
|
+
const commandsDir = PATH5.resolve(cwd, ".claude", "commands");
|
|
766
843
|
mkdirSync(commandsDir, { recursive: true });
|
|
844
|
+
const legacy = removeLegacyCommands(commandsDir);
|
|
767
845
|
const {
|
|
768
846
|
created,
|
|
769
847
|
templateNames,
|
|
770
848
|
updated
|
|
771
849
|
} = syncCommandFiles(commandsDir);
|
|
772
850
|
const removed = removeStaleCommands(commandsDir, templateNames);
|
|
773
|
-
logCommandsResult(created, updated, removed);
|
|
851
|
+
logCommandsResult(created, updated, removed + legacy);
|
|
774
852
|
return 0;
|
|
775
853
|
};
|
|
776
854
|
|
|
777
855
|
// src/actions/claude-rules.ts
|
|
856
|
+
import { spawnSync as spawnSync4 } from "child_process";
|
|
778
857
|
import {
|
|
779
|
-
existsSync as
|
|
858
|
+
existsSync as existsSync6,
|
|
780
859
|
mkdirSync as mkdirSync2,
|
|
781
|
-
readdirSync as
|
|
782
|
-
readFileSync as
|
|
783
|
-
unlinkSync as
|
|
860
|
+
readdirSync as readdirSync4,
|
|
861
|
+
readFileSync as readFileSync7,
|
|
862
|
+
unlinkSync as unlinkSync3,
|
|
784
863
|
writeFileSync as writeFileSync3
|
|
785
864
|
} from "fs";
|
|
786
|
-
import
|
|
787
|
-
import
|
|
865
|
+
import PATH6 from "path";
|
|
866
|
+
import chalk12 from "chalk";
|
|
788
867
|
var syncRuleFiles = (rulesDir) => {
|
|
789
868
|
const templates = claudeMdRuleTemplates();
|
|
790
869
|
const templateNames = new Set(Object.keys(templates));
|
|
791
870
|
let updated = 0;
|
|
792
871
|
let created = 0;
|
|
793
|
-
for (const [
|
|
794
|
-
const targetPath =
|
|
795
|
-
const existing =
|
|
872
|
+
for (const [filename2, content] of Object.entries(templates)) {
|
|
873
|
+
const targetPath = PATH6.resolve(rulesDir, filename2);
|
|
874
|
+
const existing = existsSync6(targetPath) ? readFileSync7(targetPath, "utf8") : void 0;
|
|
796
875
|
if (existing === content) continue;
|
|
797
876
|
writeFileSync3(targetPath, content, "utf8");
|
|
798
877
|
if (existing) {
|
|
@@ -808,11 +887,11 @@ var syncRuleFiles = (rulesDir) => {
|
|
|
808
887
|
};
|
|
809
888
|
};
|
|
810
889
|
var removeStaleRules = (rulesDir, templateNames) => {
|
|
811
|
-
const existingRules =
|
|
890
|
+
const existingRules = readdirSync4(rulesDir).filter((f) => f.startsWith(XYLABS_RULES_PREFIX) && f.endsWith(".md"));
|
|
812
891
|
let removed = 0;
|
|
813
892
|
for (const file of existingRules) {
|
|
814
893
|
if (!templateNames.has(file)) {
|
|
815
|
-
|
|
894
|
+
unlinkSync3(PATH6.resolve(rulesDir, file));
|
|
816
895
|
removed++;
|
|
817
896
|
}
|
|
818
897
|
}
|
|
@@ -825,26 +904,44 @@ var logRulesResult = (created, updated, removed) => {
|
|
|
825
904
|
updated ? `${updated} updated` : "",
|
|
826
905
|
removed ? `${removed} removed` : ""
|
|
827
906
|
].filter(Boolean);
|
|
828
|
-
console.log(
|
|
907
|
+
console.log(chalk12.green(`.claude/rules/${XYLABS_RULES_PREFIX}*.md: ${parts.join(", ")}`));
|
|
829
908
|
} else {
|
|
830
|
-
console.log(
|
|
909
|
+
console.log(chalk12.gray(`.claude/rules/${XYLABS_RULES_PREFIX}*.md: already up to date`));
|
|
831
910
|
}
|
|
832
911
|
};
|
|
833
912
|
var ensureProjectClaudeMd = (cwd, force) => {
|
|
834
|
-
const projectPath =
|
|
835
|
-
if (!
|
|
836
|
-
if (force &&
|
|
837
|
-
console.log(
|
|
913
|
+
const projectPath = PATH6.resolve(cwd, "CLAUDE.md");
|
|
914
|
+
if (!existsSync6(projectPath) || force) {
|
|
915
|
+
if (force && existsSync6(projectPath)) {
|
|
916
|
+
console.log(chalk12.yellow("Regenerating CLAUDE.md"));
|
|
838
917
|
}
|
|
839
|
-
|
|
840
|
-
|
|
918
|
+
console.log(chalk12.green("Generating CLAUDE.md via claude /init..."));
|
|
919
|
+
const result = spawnSync4("claude", ["-p", "/init", "--allowedTools", "Read", "Write", "Glob", "Grep"], {
|
|
920
|
+
cwd,
|
|
921
|
+
shell: true,
|
|
922
|
+
stdio: "inherit"
|
|
923
|
+
});
|
|
924
|
+
if (result.status !== 0) {
|
|
925
|
+
console.error(chalk12.red("claude /init failed \u2014 is Claude Code installed?"));
|
|
926
|
+
return 1;
|
|
927
|
+
}
|
|
928
|
+
} else {
|
|
929
|
+
console.log(chalk12.gray("CLAUDE.md already exists (skipped, use --force to regenerate)"));
|
|
930
|
+
}
|
|
931
|
+
return 0;
|
|
932
|
+
};
|
|
933
|
+
var ensureLocalClaudeMd = (cwd) => {
|
|
934
|
+
const localPath = PATH6.resolve(cwd, "CLAUDE.local.md");
|
|
935
|
+
if (existsSync6(localPath)) {
|
|
936
|
+
console.log(chalk12.gray("CLAUDE.local.md already exists (skipped)"));
|
|
841
937
|
} else {
|
|
842
|
-
|
|
938
|
+
writeFileSync3(localPath, claudeMdLocalTemplate(), "utf8");
|
|
939
|
+
console.log(chalk12.green("Generated CLAUDE.local.md"));
|
|
843
940
|
}
|
|
844
941
|
};
|
|
845
942
|
var claudeRules = ({ force } = {}) => {
|
|
846
943
|
const cwd = INIT_CWD() ?? process.cwd();
|
|
847
|
-
const rulesDir =
|
|
944
|
+
const rulesDir = PATH6.resolve(cwd, ".claude", "rules");
|
|
848
945
|
mkdirSync2(rulesDir, { recursive: true });
|
|
849
946
|
const {
|
|
850
947
|
created,
|
|
@@ -853,19 +950,20 @@ var claudeRules = ({ force } = {}) => {
|
|
|
853
950
|
} = syncRuleFiles(rulesDir);
|
|
854
951
|
const removed = removeStaleRules(rulesDir, templateNames);
|
|
855
952
|
logRulesResult(created, updated, removed);
|
|
856
|
-
ensureProjectClaudeMd(cwd, force);
|
|
857
|
-
|
|
953
|
+
const claudeMdResult = ensureProjectClaudeMd(cwd, force);
|
|
954
|
+
ensureLocalClaudeMd(cwd);
|
|
955
|
+
return claudeMdResult ?? 0;
|
|
858
956
|
};
|
|
859
957
|
|
|
860
958
|
// src/actions/claude-settings.ts
|
|
861
959
|
import {
|
|
862
|
-
existsSync as
|
|
960
|
+
existsSync as existsSync7,
|
|
863
961
|
mkdirSync as mkdirSync3,
|
|
864
962
|
writeFileSync as writeFileSync4
|
|
865
963
|
} from "fs";
|
|
866
|
-
import
|
|
964
|
+
import PATH7 from "path";
|
|
867
965
|
import { createInterface as createInterface2 } from "readline";
|
|
868
|
-
import
|
|
966
|
+
import chalk13 from "chalk";
|
|
869
967
|
var DEFAULT_SETTINGS = {
|
|
870
968
|
permissions: {
|
|
871
969
|
allow: [
|
|
@@ -910,48 +1008,48 @@ function askConfirmation2(question) {
|
|
|
910
1008
|
}
|
|
911
1009
|
async function claudeSettings() {
|
|
912
1010
|
const cwd = INIT_CWD() ?? process.cwd();
|
|
913
|
-
const claudeDir =
|
|
914
|
-
const settingsPath =
|
|
1011
|
+
const claudeDir = PATH7.resolve(cwd, ".claude");
|
|
1012
|
+
const settingsPath = PATH7.resolve(claudeDir, "settings.local.json");
|
|
915
1013
|
mkdirSync3(claudeDir, { recursive: true });
|
|
916
|
-
if (
|
|
1014
|
+
if (existsSync7(settingsPath)) {
|
|
917
1015
|
const confirmed = await askConfirmation2(
|
|
918
|
-
|
|
1016
|
+
chalk13.yellow(`${settingsPath} already exists. Replace it? (y/N) `)
|
|
919
1017
|
);
|
|
920
1018
|
if (!confirmed) {
|
|
921
|
-
console.log(
|
|
1019
|
+
console.log(chalk13.gray("Skipped \u2014 existing settings.local.json preserved"));
|
|
922
1020
|
return 0;
|
|
923
1021
|
}
|
|
924
1022
|
}
|
|
925
1023
|
writeFileSync4(settingsPath, `${JSON.stringify(DEFAULT_SETTINGS, null, 2)}
|
|
926
1024
|
`, "utf8");
|
|
927
|
-
console.log(
|
|
1025
|
+
console.log(chalk13.green("Generated .claude/settings.local.json"));
|
|
928
1026
|
return 0;
|
|
929
1027
|
}
|
|
930
1028
|
|
|
931
1029
|
// src/actions/claude-skills.ts
|
|
932
1030
|
import {
|
|
933
|
-
existsSync as
|
|
1031
|
+
existsSync as existsSync8,
|
|
934
1032
|
mkdirSync as mkdirSync4,
|
|
935
|
-
readdirSync as
|
|
936
|
-
readFileSync as
|
|
937
|
-
rmSync,
|
|
1033
|
+
readdirSync as readdirSync5,
|
|
1034
|
+
readFileSync as readFileSync8,
|
|
1035
|
+
rmSync as rmSync2,
|
|
938
1036
|
statSync as statSync2,
|
|
939
1037
|
writeFileSync as writeFileSync5
|
|
940
1038
|
} from "fs";
|
|
941
|
-
import
|
|
942
|
-
import
|
|
1039
|
+
import PATH8 from "path";
|
|
1040
|
+
import chalk14 from "chalk";
|
|
943
1041
|
var syncSkillFiles = (skillsDir) => {
|
|
944
1042
|
const templates = claudeSkillTemplates();
|
|
945
1043
|
const templateNames = new Set(Object.keys(templates));
|
|
946
1044
|
let updated = 0;
|
|
947
1045
|
let created = 0;
|
|
948
1046
|
for (const [skillName, files] of Object.entries(templates)) {
|
|
949
|
-
const skillDir =
|
|
1047
|
+
const skillDir = PATH8.resolve(skillsDir, skillName);
|
|
950
1048
|
mkdirSync4(skillDir, { recursive: true });
|
|
951
|
-
for (const [
|
|
952
|
-
const targetPath =
|
|
953
|
-
mkdirSync4(
|
|
954
|
-
const existing =
|
|
1049
|
+
for (const [filename2, content] of Object.entries(files)) {
|
|
1050
|
+
const targetPath = PATH8.resolve(skillDir, filename2);
|
|
1051
|
+
mkdirSync4(PATH8.dirname(targetPath), { recursive: true });
|
|
1052
|
+
const existing = existsSync8(targetPath) ? readFileSync8(targetPath, "utf8") : void 0;
|
|
955
1053
|
if (existing === content) continue;
|
|
956
1054
|
writeFileSync5(targetPath, content, "utf8");
|
|
957
1055
|
if (existing) {
|
|
@@ -968,13 +1066,13 @@ var syncSkillFiles = (skillsDir) => {
|
|
|
968
1066
|
};
|
|
969
1067
|
};
|
|
970
1068
|
var removeStaleSkills = (skillsDir, templateNames) => {
|
|
971
|
-
const existingSkills =
|
|
972
|
-
(f) => f.startsWith(XYLABS_SKILLS_PREFIX) && statSync2(
|
|
1069
|
+
const existingSkills = readdirSync5(skillsDir).filter(
|
|
1070
|
+
(f) => f.startsWith(XYLABS_SKILLS_PREFIX) && statSync2(PATH8.resolve(skillsDir, f)).isDirectory()
|
|
973
1071
|
);
|
|
974
1072
|
let removed = 0;
|
|
975
1073
|
for (const dir of existingSkills) {
|
|
976
1074
|
if (!templateNames.has(dir)) {
|
|
977
|
-
|
|
1075
|
+
rmSync2(PATH8.resolve(skillsDir, dir), { recursive: true });
|
|
978
1076
|
removed++;
|
|
979
1077
|
}
|
|
980
1078
|
}
|
|
@@ -987,14 +1085,14 @@ var logSkillsResult = (created, updated, removed) => {
|
|
|
987
1085
|
updated ? `${updated} updated` : "",
|
|
988
1086
|
removed ? `${removed} removed` : ""
|
|
989
1087
|
].filter(Boolean);
|
|
990
|
-
console.log(
|
|
1088
|
+
console.log(chalk14.green(`.claude/skills/${XYLABS_SKILLS_PREFIX}*/: ${parts.join(", ")}`));
|
|
991
1089
|
} else {
|
|
992
|
-
console.log(
|
|
1090
|
+
console.log(chalk14.gray(`.claude/skills/${XYLABS_SKILLS_PREFIX}*/: already up to date`));
|
|
993
1091
|
}
|
|
994
1092
|
};
|
|
995
1093
|
var claudeSkills = () => {
|
|
996
1094
|
const cwd = INIT_CWD() ?? process.cwd();
|
|
997
|
-
const skillsDir =
|
|
1095
|
+
const skillsDir = PATH8.resolve(cwd, ".claude", "skills");
|
|
998
1096
|
mkdirSync4(skillsDir, { recursive: true });
|
|
999
1097
|
const {
|
|
1000
1098
|
created,
|
|
@@ -1020,16 +1118,16 @@ var cleanAll = ({ verbose }) => {
|
|
|
1020
1118
|
|
|
1021
1119
|
// src/actions/clean-docs.ts
|
|
1022
1120
|
import path from "path";
|
|
1023
|
-
import
|
|
1121
|
+
import chalk15 from "chalk";
|
|
1024
1122
|
var cleanDocs = () => {
|
|
1025
1123
|
const pkgName = process.env.npm_package_name;
|
|
1026
|
-
console.log(
|
|
1124
|
+
console.log(chalk15.green(`Cleaning Docs [${pkgName}]`));
|
|
1027
1125
|
for (const { location } of yarnWorkspaces()) deleteGlob(path.join(location, "docs"));
|
|
1028
1126
|
return 0;
|
|
1029
1127
|
};
|
|
1030
1128
|
|
|
1031
1129
|
// src/actions/compile.ts
|
|
1032
|
-
import
|
|
1130
|
+
import chalk16 from "chalk";
|
|
1033
1131
|
var compile = ({
|
|
1034
1132
|
verbose,
|
|
1035
1133
|
target,
|
|
@@ -1070,7 +1168,7 @@ var compileAll = ({
|
|
|
1070
1168
|
const incrementalOptions = incremental ? ["--since", "-Ap", "--topological-dev"] : ["--parallel", "-Ap", "--topological-dev"];
|
|
1071
1169
|
const jobsOptions = jobs ? ["-j", `${jobs}`] : [];
|
|
1072
1170
|
if (jobs) {
|
|
1073
|
-
console.log(
|
|
1171
|
+
console.log(chalk16.blue(`Jobs set to [${jobs}]`));
|
|
1074
1172
|
}
|
|
1075
1173
|
const result = runSteps(`Compile${incremental ? "-Incremental" : ""} [All]`, [
|
|
1076
1174
|
["yarn", [
|
|
@@ -1084,13 +1182,13 @@ var compileAll = ({
|
|
|
1084
1182
|
...targetOptions
|
|
1085
1183
|
]]
|
|
1086
1184
|
]);
|
|
1087
|
-
console.log(`${
|
|
1185
|
+
console.log(`${chalk16.gray("Compiled in")} [${chalk16.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk16.gray("seconds")}`);
|
|
1088
1186
|
return result;
|
|
1089
1187
|
};
|
|
1090
1188
|
|
|
1091
1189
|
// src/actions/copy-assets.ts
|
|
1092
1190
|
import path2 from "path/posix";
|
|
1093
|
-
import
|
|
1191
|
+
import chalk17 from "chalk";
|
|
1094
1192
|
import cpy from "cpy";
|
|
1095
1193
|
var copyPackageTargetAssets = async (target, name, location) => {
|
|
1096
1194
|
try {
|
|
@@ -1113,7 +1211,7 @@ var copyPackageTargetAssets = async (target, name, location) => {
|
|
|
1113
1211
|
};
|
|
1114
1212
|
var copyTargetAssets = async (target, pkg) => {
|
|
1115
1213
|
const workspaces = yarnWorkspaces();
|
|
1116
|
-
console.log(
|
|
1214
|
+
console.log(chalk17.green(`Copying Assets [${target.toUpperCase()}]`));
|
|
1117
1215
|
const workspaceList = workspaces.filter(({ name }) => {
|
|
1118
1216
|
return pkg === void 0 || name === pkg;
|
|
1119
1217
|
});
|
|
@@ -1197,7 +1295,7 @@ var dead = () => {
|
|
|
1197
1295
|
};
|
|
1198
1296
|
|
|
1199
1297
|
// src/actions/deplint/deplint.ts
|
|
1200
|
-
import
|
|
1298
|
+
import chalk23 from "chalk";
|
|
1201
1299
|
|
|
1202
1300
|
// src/actions/deplint/findFiles.ts
|
|
1203
1301
|
import fs2 from "fs";
|
|
@@ -1402,7 +1500,7 @@ function getExternalImportsFromFiles({
|
|
|
1402
1500
|
|
|
1403
1501
|
// src/actions/deplint/checkPackage/getUnlistedDependencies.ts
|
|
1404
1502
|
import { builtinModules } from "module";
|
|
1405
|
-
import
|
|
1503
|
+
import chalk18 from "chalk";
|
|
1406
1504
|
function isRuntimeImportListed(imp, name, dependencies, peerDependencies) {
|
|
1407
1505
|
return dependencies.includes(imp) || imp === name || peerDependencies.includes(imp) || builtinModules.includes(imp);
|
|
1408
1506
|
}
|
|
@@ -1410,7 +1508,7 @@ function isTypeImportListed(imp, name, dependencies, devDependencies, peerDepend
|
|
|
1410
1508
|
return dependencies.includes(imp) || imp === name || dependencies.includes(`@types/${imp}`) || peerDependencies.includes(imp) || peerDependencies.includes(`@types/${imp}`) || devDependencies.includes(`@types/${imp}`) || builtinModules.includes(imp);
|
|
1411
1509
|
}
|
|
1412
1510
|
function logMissing(name, imp, importPaths) {
|
|
1413
|
-
console.log(`[${
|
|
1511
|
+
console.log(`[${chalk18.blue(name)}] Missing dependency in package.json: ${chalk18.red(imp)}`);
|
|
1414
1512
|
if (importPaths[imp]) {
|
|
1415
1513
|
console.log(` ${importPaths[imp].join("\n ")}`);
|
|
1416
1514
|
}
|
|
@@ -1439,7 +1537,7 @@ function getUnlistedDependencies({ name, location }, {
|
|
|
1439
1537
|
}
|
|
1440
1538
|
if (unlistedDependencies > 0) {
|
|
1441
1539
|
const packageLocation = `${location}/package.json`;
|
|
1442
|
-
console.log(` ${
|
|
1540
|
+
console.log(` ${chalk18.yellow(packageLocation)}
|
|
1443
1541
|
`);
|
|
1444
1542
|
}
|
|
1445
1543
|
return unlistedDependencies;
|
|
@@ -1447,7 +1545,7 @@ function getUnlistedDependencies({ name, location }, {
|
|
|
1447
1545
|
|
|
1448
1546
|
// src/actions/deplint/checkPackage/getUnlistedDevDependencies.ts
|
|
1449
1547
|
import { builtinModules as builtinModules2 } from "module";
|
|
1450
|
-
import
|
|
1548
|
+
import chalk19 from "chalk";
|
|
1451
1549
|
function getUnlistedDevDependencies({ name, location }, {
|
|
1452
1550
|
devDependencies,
|
|
1453
1551
|
dependencies,
|
|
@@ -1461,7 +1559,7 @@ function getUnlistedDevDependencies({ name, location }, {
|
|
|
1461
1559
|
for (const imp of externalAllImports) {
|
|
1462
1560
|
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)) {
|
|
1463
1561
|
unlistedDevDependencies++;
|
|
1464
|
-
console.log(`[${
|
|
1562
|
+
console.log(`[${chalk19.blue(name)}] Missing devDependency in package.json: ${chalk19.red(imp)}`);
|
|
1465
1563
|
if (allImportPaths[imp]) {
|
|
1466
1564
|
console.log(` ${allImportPaths[imp].join("\n ")}`);
|
|
1467
1565
|
}
|
|
@@ -1469,14 +1567,14 @@ function getUnlistedDevDependencies({ name, location }, {
|
|
|
1469
1567
|
}
|
|
1470
1568
|
if (unlistedDevDependencies > 0) {
|
|
1471
1569
|
const packageLocation = `${location}/package.json`;
|
|
1472
|
-
console.log(` ${
|
|
1570
|
+
console.log(` ${chalk19.yellow(packageLocation)}
|
|
1473
1571
|
`);
|
|
1474
1572
|
}
|
|
1475
1573
|
return unlistedDevDependencies;
|
|
1476
1574
|
}
|
|
1477
1575
|
|
|
1478
1576
|
// src/actions/deplint/checkPackage/getUnusedDependencies.ts
|
|
1479
|
-
import
|
|
1577
|
+
import chalk20 from "chalk";
|
|
1480
1578
|
function getUnusedDependencies({ name, location }, { dependencies }, {
|
|
1481
1579
|
externalDistImports,
|
|
1482
1580
|
externalDistTypeImports,
|
|
@@ -1488,22 +1586,22 @@ function getUnusedDependencies({ name, location }, { dependencies }, {
|
|
|
1488
1586
|
if (!externalDistImports.includes(dep) && !externalDistImports.includes(dep.replace(/^@types\//, "")) && !externalDistTypeImports.includes(dep) && !externalDistTypeImports.includes(dep.replace(/^@types\//, ""))) {
|
|
1489
1587
|
unusedDependencies++;
|
|
1490
1588
|
if (externalAllImports.includes(dep)) {
|
|
1491
|
-
console.log(`[${
|
|
1589
|
+
console.log(`[${chalk20.blue(name)}] dependency should be devDependency in package.json: ${chalk20.red(dep)}`);
|
|
1492
1590
|
} else {
|
|
1493
|
-
console.log(`[${
|
|
1591
|
+
console.log(`[${chalk20.blue(name)}] Unused dependency in package.json: ${chalk20.red(dep)}`);
|
|
1494
1592
|
}
|
|
1495
1593
|
}
|
|
1496
1594
|
}
|
|
1497
1595
|
if (unusedDependencies > 0) {
|
|
1498
1596
|
const packageLocation = `${location}/package.json`;
|
|
1499
|
-
console.log(` ${
|
|
1597
|
+
console.log(` ${chalk20.yellow(packageLocation)}
|
|
1500
1598
|
`);
|
|
1501
1599
|
}
|
|
1502
1600
|
return unusedDependencies;
|
|
1503
1601
|
}
|
|
1504
1602
|
|
|
1505
1603
|
// src/actions/deplint/checkPackage/getUnusedDevDependencies.ts
|
|
1506
|
-
import
|
|
1604
|
+
import chalk21 from "chalk";
|
|
1507
1605
|
|
|
1508
1606
|
// src/actions/deplint/getCliReferencedPackagesFromFiles.ts
|
|
1509
1607
|
import fs8 from "fs";
|
|
@@ -1787,19 +1885,19 @@ function getUnusedDevDependencies({ name, location }, {
|
|
|
1787
1885
|
if (dependencies.includes(dep) || peerDependencies.includes(dep)) continue;
|
|
1788
1886
|
if (!isDevDepUsed(dep, allImports, implicitDeps, requiredPeers, scriptRefs, cliRefs)) {
|
|
1789
1887
|
unusedDevDependencies++;
|
|
1790
|
-
console.log(`[${
|
|
1888
|
+
console.log(`[${chalk21.blue(name)}] Unused devDependency in package.json: ${chalk21.red(dep)}`);
|
|
1791
1889
|
}
|
|
1792
1890
|
}
|
|
1793
1891
|
if (unusedDevDependencies > 0) {
|
|
1794
1892
|
const packageLocation = `${location}/package.json`;
|
|
1795
|
-
console.log(` ${
|
|
1893
|
+
console.log(` ${chalk21.yellow(packageLocation)}
|
|
1796
1894
|
`);
|
|
1797
1895
|
}
|
|
1798
1896
|
return unusedDevDependencies;
|
|
1799
1897
|
}
|
|
1800
1898
|
|
|
1801
1899
|
// src/actions/deplint/checkPackage/getUnusedPeerDependencies.ts
|
|
1802
|
-
import
|
|
1900
|
+
import chalk22 from "chalk";
|
|
1803
1901
|
function getUnusedPeerDependencies({ name, location }, { peerDependencies, dependencies }, { externalDistImports, externalDistTypeImports }, exclude) {
|
|
1804
1902
|
let unusedDependencies = 0;
|
|
1805
1903
|
for (const dep of peerDependencies) {
|
|
@@ -1807,15 +1905,15 @@ function getUnusedPeerDependencies({ name, location }, { peerDependencies, depen
|
|
|
1807
1905
|
if (!externalDistImports.includes(dep) && !externalDistImports.includes(dep.replace(/^@types\//, "")) && !externalDistTypeImports.includes(dep) && !externalDistTypeImports.includes(dep.replace(/^@types\//, ""))) {
|
|
1808
1906
|
unusedDependencies++;
|
|
1809
1907
|
if (dependencies.includes(dep)) {
|
|
1810
|
-
console.log(`[${
|
|
1908
|
+
console.log(`[${chalk22.blue(name)}] Unused peerDependency [already a dependency] in package.json: ${chalk22.red(dep)}`);
|
|
1811
1909
|
} else {
|
|
1812
|
-
console.log(`[${
|
|
1910
|
+
console.log(`[${chalk22.blue(name)}] Unused peerDependency in package.json: ${chalk22.red(dep)}`);
|
|
1813
1911
|
}
|
|
1814
1912
|
}
|
|
1815
1913
|
}
|
|
1816
1914
|
if (unusedDependencies > 0) {
|
|
1817
1915
|
const packageLocation = `${location}/package.json`;
|
|
1818
|
-
console.log(` ${
|
|
1916
|
+
console.log(` ${chalk22.yellow(packageLocation)}
|
|
1819
1917
|
`);
|
|
1820
1918
|
}
|
|
1821
1919
|
return unusedDependencies;
|
|
@@ -1910,19 +2008,19 @@ var deplint = async ({
|
|
|
1910
2008
|
});
|
|
1911
2009
|
}
|
|
1912
2010
|
if (totalErrors > 0) {
|
|
1913
|
-
console.warn(`Deplint: Found ${
|
|
2011
|
+
console.warn(`Deplint: Found ${chalk23.red(totalErrors)} dependency problems. ${chalk23.red("\u2716")}`);
|
|
1914
2012
|
} else {
|
|
1915
|
-
console.info(`Deplint: Found no dependency problems. ${
|
|
2013
|
+
console.info(`Deplint: Found no dependency problems. ${chalk23.green("\u2714")}`);
|
|
1916
2014
|
}
|
|
1917
2015
|
return 0;
|
|
1918
2016
|
};
|
|
1919
2017
|
|
|
1920
2018
|
// src/actions/deploy.ts
|
|
1921
|
-
import { readFileSync as
|
|
2019
|
+
import { readFileSync as readFileSync9 } from "fs";
|
|
1922
2020
|
var privatePackageExcludeList = () => {
|
|
1923
2021
|
const possibleDeployablePackages = yarnWorkspaces().map((workspace) => [
|
|
1924
2022
|
workspace,
|
|
1925
|
-
JSON.parse(
|
|
2023
|
+
JSON.parse(readFileSync9(`${workspace.location}/package.json`, { encoding: "utf8" }))
|
|
1926
2024
|
]);
|
|
1927
2025
|
const privatePackages = possibleDeployablePackages.filter(([_, pkg]) => pkg.private).map(([workspace]) => workspace);
|
|
1928
2026
|
const excludeList = privatePackages.map((workspace) => `--exclude ${workspace.name}`);
|
|
@@ -1942,11 +2040,11 @@ var deploy = () => {
|
|
|
1942
2040
|
};
|
|
1943
2041
|
|
|
1944
2042
|
// src/actions/deploy-major.ts
|
|
1945
|
-
import { readFileSync as
|
|
2043
|
+
import { readFileSync as readFileSync10 } from "fs";
|
|
1946
2044
|
var privatePackageExcludeList2 = () => {
|
|
1947
2045
|
const possibleDeployablePackages = yarnWorkspaces().map((workspace) => [
|
|
1948
2046
|
workspace,
|
|
1949
|
-
JSON.parse(
|
|
2047
|
+
JSON.parse(readFileSync10(`${workspace.location}/package.json`, { encoding: "utf8" }))
|
|
1950
2048
|
]);
|
|
1951
2049
|
const privatePackages = possibleDeployablePackages.filter(([_, pkg]) => pkg.private).map(([workspace]) => workspace);
|
|
1952
2050
|
const excludeList = privatePackages.map((workspace) => `--exclude ${workspace.name}`);
|
|
@@ -1966,11 +2064,11 @@ var deployMajor = () => {
|
|
|
1966
2064
|
};
|
|
1967
2065
|
|
|
1968
2066
|
// src/actions/deploy-minor.ts
|
|
1969
|
-
import { readFileSync as
|
|
2067
|
+
import { readFileSync as readFileSync11 } from "fs";
|
|
1970
2068
|
var privatePackageExcludeList3 = () => {
|
|
1971
2069
|
const possibleDeployablePackages = yarnWorkspaces().map((workspace) => [
|
|
1972
2070
|
workspace,
|
|
1973
|
-
JSON.parse(
|
|
2071
|
+
JSON.parse(readFileSync11(`${workspace.location}/package.json`, { encoding: "utf8" }))
|
|
1974
2072
|
]);
|
|
1975
2073
|
const privatePackages = possibleDeployablePackages.filter(([_, pkg]) => pkg.private).map(([workspace]) => workspace);
|
|
1976
2074
|
const excludeList = privatePackages.map((workspace) => `--exclude ${workspace.name}`);
|
|
@@ -1990,11 +2088,11 @@ var deployMinor = () => {
|
|
|
1990
2088
|
};
|
|
1991
2089
|
|
|
1992
2090
|
// src/actions/deploy-next.ts
|
|
1993
|
-
import { readFileSync as
|
|
2091
|
+
import { readFileSync as readFileSync12 } from "fs";
|
|
1994
2092
|
var privatePackageExcludeList4 = () => {
|
|
1995
2093
|
const possibleDeployablePackages = yarnWorkspaces().map((workspace) => [
|
|
1996
2094
|
workspace,
|
|
1997
|
-
JSON.parse(
|
|
2095
|
+
JSON.parse(readFileSync12(`${workspace.location}/package.json`, { encoding: "utf8" }))
|
|
1998
2096
|
]);
|
|
1999
2097
|
const privatePackages = possibleDeployablePackages.filter(([_, pkg]) => pkg.private).map(([workspace]) => workspace);
|
|
2000
2098
|
const excludeList = privatePackages.map((workspace) => `--exclude ${workspace.name}`);
|
|
@@ -2014,22 +2112,23 @@ var deployNext = () => {
|
|
|
2014
2112
|
};
|
|
2015
2113
|
|
|
2016
2114
|
// src/actions/dupdeps.ts
|
|
2017
|
-
import
|
|
2115
|
+
import chalk24 from "chalk";
|
|
2018
2116
|
var dupdeps = () => {
|
|
2019
|
-
console.log(
|
|
2020
|
-
const
|
|
2021
|
-
const
|
|
2117
|
+
console.log(chalk24.green("Checking all Dependencies for Duplicates"));
|
|
2118
|
+
const pkg = parsedPackageJSON();
|
|
2119
|
+
const allDependencies = { ...pkg?.dependencies, ...pkg?.devDependencies };
|
|
2120
|
+
const dependencies = Object.keys(allDependencies);
|
|
2022
2121
|
return detectDuplicateDependencies(dependencies);
|
|
2023
2122
|
};
|
|
2024
2123
|
|
|
2025
2124
|
// src/actions/lint.ts
|
|
2026
|
-
import
|
|
2125
|
+
import chalk25 from "chalk";
|
|
2027
2126
|
var lintPackage = ({
|
|
2028
2127
|
pkg,
|
|
2029
2128
|
fix: fix2,
|
|
2030
2129
|
verbose
|
|
2031
2130
|
}) => {
|
|
2032
|
-
console.log(
|
|
2131
|
+
console.log(chalk25.gray(`${fix2 ? "Fix" : "Lint"} [${pkg}]`));
|
|
2033
2132
|
const start = Date.now();
|
|
2034
2133
|
const result = runSteps(`${fix2 ? "Fix" : "Lint"} [${pkg}]`, [
|
|
2035
2134
|
["yarn", [
|
|
@@ -2039,7 +2138,7 @@ var lintPackage = ({
|
|
|
2039
2138
|
fix2 ? "package-fix" : verbose ? "package-lint-verbose" : "package-lint"
|
|
2040
2139
|
]]
|
|
2041
2140
|
]);
|
|
2042
|
-
console.log(
|
|
2141
|
+
console.log(chalk25.gray(`${fix2 ? "Fixed in" : "Linted in"} [${chalk25.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk25.gray("seconds")}`));
|
|
2043
2142
|
return result;
|
|
2044
2143
|
};
|
|
2045
2144
|
var lint = ({
|
|
@@ -2059,13 +2158,13 @@ var lint = ({
|
|
|
2059
2158
|
});
|
|
2060
2159
|
};
|
|
2061
2160
|
var lintAllPackages = ({ fix: fix2 = false } = {}) => {
|
|
2062
|
-
console.log(
|
|
2161
|
+
console.log(chalk25.gray(`${fix2 ? "Fix" : "Lint"} [All-Packages]`));
|
|
2063
2162
|
const start = Date.now();
|
|
2064
2163
|
const fixOptions = fix2 ? ["--fix"] : [];
|
|
2065
2164
|
const result = runSteps(`${fix2 ? "Fix" : "Lint"} [All-Packages]`, [
|
|
2066
2165
|
["yarn", ["eslint", "--cache", "--cache-location", ".eslintcache", "--cache-strategy", "content", ...fixOptions]]
|
|
2067
2166
|
]);
|
|
2068
|
-
console.log(
|
|
2167
|
+
console.log(chalk25.gray(`${fix2 ? "Fixed in" : "Linted in"} [${chalk25.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk25.gray("seconds")}`));
|
|
2069
2168
|
return result;
|
|
2070
2169
|
};
|
|
2071
2170
|
|
|
@@ -2088,12 +2187,96 @@ var genDocsAll = ({ incremental }) => {
|
|
|
2088
2187
|
return runSteps(`GenDocs [All${incremental ? "-Incremental" : ""}]`, [...steps]);
|
|
2089
2188
|
};
|
|
2090
2189
|
|
|
2091
|
-
// src/actions/gitignore
|
|
2092
|
-
|
|
2093
|
-
|
|
2190
|
+
// src/actions/gitignore.ts
|
|
2191
|
+
import { unlinkSync as unlinkSync4 } from "fs";
|
|
2192
|
+
import chalk26 from "chalk";
|
|
2193
|
+
var COMMENT_PREFIX = "#";
|
|
2194
|
+
var isComment = (line) => line.startsWith(COMMENT_PREFIX);
|
|
2195
|
+
var isNegation = (line) => line.startsWith("!");
|
|
2196
|
+
function parseTemplateSections(lines) {
|
|
2197
|
+
const sections = [];
|
|
2198
|
+
let current = [];
|
|
2199
|
+
for (const line of lines) {
|
|
2200
|
+
if (isComment(line)) {
|
|
2201
|
+
if (current.length > 0) {
|
|
2202
|
+
sections.push(current);
|
|
2203
|
+
}
|
|
2204
|
+
current = [line];
|
|
2205
|
+
} else {
|
|
2206
|
+
current.push(line);
|
|
2207
|
+
}
|
|
2208
|
+
}
|
|
2209
|
+
if (current.length > 0) {
|
|
2210
|
+
sections.push(current);
|
|
2211
|
+
}
|
|
2212
|
+
return sections;
|
|
2213
|
+
}
|
|
2214
|
+
function mergeWithTemplate(existing, templateContent) {
|
|
2215
|
+
const templateLines = templateContent.split("\n").filter((line) => line.trim().length > 0);
|
|
2216
|
+
const sections = parseTemplateSections(templateLines);
|
|
2217
|
+
const existingEntries = new Set(existing.filter((line) => !isComment(line)));
|
|
2218
|
+
const templateEntries = new Set(templateLines.filter((line) => !isComment(line)));
|
|
2219
|
+
const customEntries = [...existingEntries].filter((entry) => !templateEntries.has(entry));
|
|
2220
|
+
const result = [];
|
|
2221
|
+
for (const section of sections) {
|
|
2222
|
+
for (const line of section) {
|
|
2223
|
+
result.push(line);
|
|
2224
|
+
}
|
|
2225
|
+
result.push("");
|
|
2226
|
+
}
|
|
2227
|
+
if (customEntries.length > 0) {
|
|
2228
|
+
result.push("# Custom");
|
|
2229
|
+
const sorted = [...union(customEntries, [])].toSorted((a, b) => {
|
|
2230
|
+
if (isNegation(a) && !isNegation(b)) return 1;
|
|
2231
|
+
if (!isNegation(a) && isNegation(b)) return -1;
|
|
2232
|
+
return a.localeCompare(b);
|
|
2233
|
+
});
|
|
2234
|
+
for (const entry of sorted) {
|
|
2235
|
+
result.push(entry);
|
|
2236
|
+
}
|
|
2237
|
+
result.push("");
|
|
2238
|
+
}
|
|
2239
|
+
return result;
|
|
2240
|
+
}
|
|
2241
|
+
function removePackageGitignores(cwd) {
|
|
2242
|
+
let removed = 0;
|
|
2243
|
+
const workspaces = yarnWorkspaces();
|
|
2244
|
+
for (const { location } of workspaces) {
|
|
2245
|
+
if (location === ".") continue;
|
|
2246
|
+
const filePath = `${cwd}/${location}/.gitignore`;
|
|
2247
|
+
try {
|
|
2248
|
+
unlinkSync4(filePath);
|
|
2249
|
+
console.log(chalk26.yellow(` Removed ${location}/.gitignore`));
|
|
2250
|
+
removed++;
|
|
2251
|
+
} catch {
|
|
2252
|
+
}
|
|
2253
|
+
}
|
|
2254
|
+
return removed;
|
|
2255
|
+
}
|
|
2256
|
+
function gitignore() {
|
|
2257
|
+
console.log(chalk26.green("Generate .gitignore"));
|
|
2258
|
+
const cwd = INIT_CWD() ?? ".";
|
|
2259
|
+
const gitignorePath = `${cwd}/.gitignore`;
|
|
2260
|
+
try {
|
|
2261
|
+
const templateContent = gitignoreTemplate();
|
|
2262
|
+
const existing = readNonEmptyLines(gitignorePath);
|
|
2263
|
+
const merged = mergeWithTemplate(existing, templateContent);
|
|
2264
|
+
writeLines(gitignorePath, merged);
|
|
2265
|
+
console.log(chalk26.green(" Root .gitignore updated"));
|
|
2266
|
+
const removed = removePackageGitignores(cwd);
|
|
2267
|
+
if (removed > 0) {
|
|
2268
|
+
console.log(chalk26.green(` Removed ${removed} package .gitignore file(s)`));
|
|
2269
|
+
}
|
|
2270
|
+
return 0;
|
|
2271
|
+
} catch (ex) {
|
|
2272
|
+
const error = ex;
|
|
2273
|
+
console.error(chalk26.red(`Generate .gitignore failed: ${error.message}`));
|
|
2274
|
+
return 1;
|
|
2275
|
+
}
|
|
2276
|
+
}
|
|
2094
2277
|
|
|
2095
2278
|
// src/actions/gitlint.ts
|
|
2096
|
-
import
|
|
2279
|
+
import chalk27 from "chalk";
|
|
2097
2280
|
import ParseGitConfig from "parse-git-config";
|
|
2098
2281
|
var gitlint = () => {
|
|
2099
2282
|
console.log(`
|
|
@@ -2104,7 +2287,7 @@ Gitlint Start [${process.cwd()}]
|
|
|
2104
2287
|
const errors = 0;
|
|
2105
2288
|
const gitConfig = ParseGitConfig.sync();
|
|
2106
2289
|
const warn = (message) => {
|
|
2107
|
-
console.warn(
|
|
2290
|
+
console.warn(chalk27.yellow(`Warning: ${message}`));
|
|
2108
2291
|
warnings++;
|
|
2109
2292
|
};
|
|
2110
2293
|
if (gitConfig.core.ignorecase) {
|
|
@@ -2124,13 +2307,13 @@ Gitlint Start [${process.cwd()}]
|
|
|
2124
2307
|
}
|
|
2125
2308
|
const resultMessages = [];
|
|
2126
2309
|
if (valid > 0) {
|
|
2127
|
-
resultMessages.push(
|
|
2310
|
+
resultMessages.push(chalk27.green(`Passed: ${valid}`));
|
|
2128
2311
|
}
|
|
2129
2312
|
if (warnings > 0) {
|
|
2130
|
-
resultMessages.push(
|
|
2313
|
+
resultMessages.push(chalk27.yellow(`Warnings: ${warnings}`));
|
|
2131
2314
|
}
|
|
2132
2315
|
if (errors > 0) {
|
|
2133
|
-
resultMessages.push(
|
|
2316
|
+
resultMessages.push(chalk27.red(` Errors: ${errors}`));
|
|
2134
2317
|
}
|
|
2135
2318
|
console.warn(`Gitlint Finish [ ${resultMessages.join(" | ")} ]
|
|
2136
2319
|
`);
|
|
@@ -2139,7 +2322,7 @@ Gitlint Start [${process.cwd()}]
|
|
|
2139
2322
|
|
|
2140
2323
|
// src/actions/gitlint-fix.ts
|
|
2141
2324
|
import { execSync as execSync3 } from "child_process";
|
|
2142
|
-
import
|
|
2325
|
+
import chalk28 from "chalk";
|
|
2143
2326
|
import ParseGitConfig2 from "parse-git-config";
|
|
2144
2327
|
var gitlintFix = () => {
|
|
2145
2328
|
console.log(`
|
|
@@ -2148,15 +2331,15 @@ Gitlint Fix Start [${process.cwd()}]
|
|
|
2148
2331
|
const gitConfig = ParseGitConfig2.sync();
|
|
2149
2332
|
if (gitConfig.core.ignorecase) {
|
|
2150
2333
|
execSync3("git config core.ignorecase false", { stdio: "inherit" });
|
|
2151
|
-
console.warn(
|
|
2334
|
+
console.warn(chalk28.yellow("\nGitlint Fix: Updated core.ignorecase to be false\n"));
|
|
2152
2335
|
}
|
|
2153
2336
|
if (gitConfig.core.autocrlf !== false) {
|
|
2154
2337
|
execSync3("git config core.autocrlf false", { stdio: "inherit" });
|
|
2155
|
-
console.warn(
|
|
2338
|
+
console.warn(chalk28.yellow("\nGitlint Fix: Updated core.autocrlf to be false\n"));
|
|
2156
2339
|
}
|
|
2157
2340
|
if (gitConfig.core.eol !== "lf") {
|
|
2158
2341
|
execSync3("git config core.eol lf", { stdio: "inherit" });
|
|
2159
|
-
console.warn(
|
|
2342
|
+
console.warn(chalk28.yellow('\nGitlint Fix: Updated core.eol to be "lf"\n'));
|
|
2160
2343
|
}
|
|
2161
2344
|
return 1;
|
|
2162
2345
|
};
|
|
@@ -2167,7 +2350,7 @@ var knip = () => {
|
|
|
2167
2350
|
};
|
|
2168
2351
|
|
|
2169
2352
|
// src/actions/license.ts
|
|
2170
|
-
import
|
|
2353
|
+
import chalk29 from "chalk";
|
|
2171
2354
|
import { init } from "license-checker";
|
|
2172
2355
|
var license = async (pkg) => {
|
|
2173
2356
|
const workspaces = yarnWorkspaces();
|
|
@@ -2192,18 +2375,18 @@ var license = async (pkg) => {
|
|
|
2192
2375
|
"LGPL-3.0-or-later",
|
|
2193
2376
|
"Python-2.0"
|
|
2194
2377
|
]);
|
|
2195
|
-
console.log(
|
|
2378
|
+
console.log(chalk29.green("License Checker"));
|
|
2196
2379
|
return (await Promise.all(
|
|
2197
2380
|
workspaceList.map(({ location, name }) => {
|
|
2198
2381
|
return new Promise((resolve) => {
|
|
2199
2382
|
init({ production: true, start: location }, (error, packages) => {
|
|
2200
2383
|
if (error) {
|
|
2201
|
-
console.error(
|
|
2202
|
-
console.error(
|
|
2384
|
+
console.error(chalk29.red(`License Checker [${name}] Error`));
|
|
2385
|
+
console.error(chalk29.gray(error));
|
|
2203
2386
|
console.log("\n");
|
|
2204
2387
|
resolve(1);
|
|
2205
2388
|
} else {
|
|
2206
|
-
console.log(
|
|
2389
|
+
console.log(chalk29.green(`License Checker [${name}]`));
|
|
2207
2390
|
let count = 0;
|
|
2208
2391
|
for (const [name2, info] of Object.entries(packages)) {
|
|
2209
2392
|
const licenses = Array.isArray(info.licenses) ? info.licenses : [info.licenses];
|
|
@@ -2219,7 +2402,7 @@ var license = async (pkg) => {
|
|
|
2219
2402
|
}
|
|
2220
2403
|
if (!orLicenseFound) {
|
|
2221
2404
|
count++;
|
|
2222
|
-
console.warn(
|
|
2405
|
+
console.warn(chalk29.yellow(`${name2}: Package License not allowed [${license2}]`));
|
|
2223
2406
|
}
|
|
2224
2407
|
}
|
|
2225
2408
|
}
|
|
@@ -2234,8 +2417,8 @@ var license = async (pkg) => {
|
|
|
2234
2417
|
};
|
|
2235
2418
|
|
|
2236
2419
|
// src/actions/npmignore-gen.ts
|
|
2237
|
-
var
|
|
2238
|
-
var npmignoreGen = (pkg) => generateIgnoreFiles(
|
|
2420
|
+
var filename = ".npmignore";
|
|
2421
|
+
var npmignoreGen = (pkg) => generateIgnoreFiles(filename, pkg);
|
|
2239
2422
|
|
|
2240
2423
|
// src/actions/publint.ts
|
|
2241
2424
|
var publint = async ({ verbose, pkg }) => {
|
|
@@ -2290,7 +2473,7 @@ var rebuild = ({ target }) => {
|
|
|
2290
2473
|
};
|
|
2291
2474
|
|
|
2292
2475
|
// src/actions/recompile.ts
|
|
2293
|
-
import
|
|
2476
|
+
import chalk30 from "chalk";
|
|
2294
2477
|
var recompile = async ({
|
|
2295
2478
|
verbose,
|
|
2296
2479
|
target,
|
|
@@ -2326,7 +2509,7 @@ var recompileAll = async ({
|
|
|
2326
2509
|
const incrementalOptions = incremental ? ["--since", "-Apt", "--topological-dev"] : ["--parallel", "-Apt", "--topological-dev"];
|
|
2327
2510
|
const jobsOptions = jobs ? ["-j", `${jobs}`] : [];
|
|
2328
2511
|
if (jobs) {
|
|
2329
|
-
console.log(
|
|
2512
|
+
console.log(chalk30.blue(`Jobs set to [${jobs}]`));
|
|
2330
2513
|
}
|
|
2331
2514
|
const result = await runStepsAsync(`Recompile${incremental ? "-Incremental" : ""} [All]`, [
|
|
2332
2515
|
[
|
|
@@ -2357,7 +2540,7 @@ var recompileAll = async ({
|
|
|
2357
2540
|
]
|
|
2358
2541
|
]);
|
|
2359
2542
|
console.log(
|
|
2360
|
-
`${
|
|
2543
|
+
`${chalk30.gray("Recompiled in")} [${chalk30.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk30.gray("seconds")}`
|
|
2361
2544
|
);
|
|
2362
2545
|
return result;
|
|
2363
2546
|
};
|
|
@@ -2366,7 +2549,7 @@ var recompileAll = async ({
|
|
|
2366
2549
|
import {
|
|
2367
2550
|
closeSync,
|
|
2368
2551
|
openSync,
|
|
2369
|
-
rmSync as
|
|
2552
|
+
rmSync as rmSync3
|
|
2370
2553
|
} from "fs";
|
|
2371
2554
|
var reinstall = () => {
|
|
2372
2555
|
console.log("Reinstall [Clear Lock File]");
|
|
@@ -2376,7 +2559,7 @@ var reinstall = () => {
|
|
|
2376
2559
|
const result = workspaces.map(({ location, name }) => {
|
|
2377
2560
|
const dist = `${location}/node_modules`;
|
|
2378
2561
|
try {
|
|
2379
|
-
|
|
2562
|
+
rmSync3(dist, { force: true, recursive: true });
|
|
2380
2563
|
return 0;
|
|
2381
2564
|
} catch (ex) {
|
|
2382
2565
|
const error = ex;
|
|
@@ -2388,13 +2571,13 @@ var reinstall = () => {
|
|
|
2388
2571
|
};
|
|
2389
2572
|
|
|
2390
2573
|
// src/actions/relint.ts
|
|
2391
|
-
import
|
|
2574
|
+
import chalk31 from "chalk";
|
|
2392
2575
|
var relintPackage = ({
|
|
2393
2576
|
pkg,
|
|
2394
2577
|
fix: fix2,
|
|
2395
2578
|
verbose
|
|
2396
2579
|
}) => {
|
|
2397
|
-
console.log(
|
|
2580
|
+
console.log(chalk31.gray(`${fix2 ? "Fix" : "Lint"} [${pkg}]`));
|
|
2398
2581
|
const start = Date.now();
|
|
2399
2582
|
const result = runSteps(`${fix2 ? "Fix" : "Lint"} [${pkg}]`, [
|
|
2400
2583
|
["yarn", [
|
|
@@ -2404,7 +2587,7 @@ var relintPackage = ({
|
|
|
2404
2587
|
fix2 ? "package-fix" : verbose ? "package-lint-verbose" : "package-lint"
|
|
2405
2588
|
]]
|
|
2406
2589
|
]);
|
|
2407
|
-
console.log(
|
|
2590
|
+
console.log(chalk31.gray(`${fix2 ? "Fixed in" : "Linted in"} [${chalk31.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk31.gray("seconds")}`));
|
|
2408
2591
|
return result;
|
|
2409
2592
|
};
|
|
2410
2593
|
var relint = ({
|
|
@@ -2424,13 +2607,13 @@ var relint = ({
|
|
|
2424
2607
|
});
|
|
2425
2608
|
};
|
|
2426
2609
|
var relintAllPackages = ({ fix: fix2 = false } = {}) => {
|
|
2427
|
-
console.log(
|
|
2610
|
+
console.log(chalk31.gray(`${fix2 ? "Fix" : "Lint"} [All-Packages]`));
|
|
2428
2611
|
const start = Date.now();
|
|
2429
2612
|
const fixOptions = fix2 ? ["--fix"] : [];
|
|
2430
2613
|
const result = runSteps(`${fix2 ? "Fix" : "Lint"} [All-Packages]`, [
|
|
2431
2614
|
["yarn", ["eslint", ...fixOptions]]
|
|
2432
2615
|
]);
|
|
2433
|
-
console.log(
|
|
2616
|
+
console.log(chalk31.gray(`${fix2 ? "Fixed in" : "Linted in"} [${chalk31.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk31.gray("seconds")}`));
|
|
2434
2617
|
return result;
|
|
2435
2618
|
};
|
|
2436
2619
|
|
|
@@ -2448,10 +2631,10 @@ var sonar = () => {
|
|
|
2448
2631
|
};
|
|
2449
2632
|
|
|
2450
2633
|
// src/actions/statics.ts
|
|
2451
|
-
import
|
|
2634
|
+
import chalk32 from "chalk";
|
|
2452
2635
|
var DefaultDependencies = ["axios", "@xylabs/pixel", "react", "graphql", "react-router", "@mui/material", "@mui/system"];
|
|
2453
2636
|
var statics = () => {
|
|
2454
|
-
console.log(
|
|
2637
|
+
console.log(chalk32.green("Check Required Static Dependencies"));
|
|
2455
2638
|
const statics2 = parsedPackageJSON()?.xy?.deps?.statics;
|
|
2456
2639
|
return detectDuplicateDependencies(statics2, DefaultDependencies);
|
|
2457
2640
|
};
|
|
@@ -2499,18 +2682,13 @@ var yarn3Only = () => {
|
|
|
2499
2682
|
return 0;
|
|
2500
2683
|
};
|
|
2501
2684
|
|
|
2502
|
-
// src/xy/
|
|
2503
|
-
var packagePositionalParam = (yargs2) => {
|
|
2504
|
-
return yargs2.positional("package", { describe: "Specific package to target", type: "string" });
|
|
2505
|
-
};
|
|
2506
|
-
|
|
2507
|
-
// src/xy/build-commands/build.ts
|
|
2685
|
+
// src/xy/build/buildCommand.ts
|
|
2508
2686
|
var buildCommand = {
|
|
2509
|
-
builder: (yargs2) => {
|
|
2510
|
-
return packagePositionalParam(yargs2);
|
|
2511
|
-
},
|
|
2512
2687
|
command: "build [package]",
|
|
2513
2688
|
describe: "Build - Compile & Lint",
|
|
2689
|
+
builder: (yargs2) => {
|
|
2690
|
+
return yargs2.positional("package", { describe: "Specific package to build" });
|
|
2691
|
+
},
|
|
2514
2692
|
handler: async (argv) => {
|
|
2515
2693
|
if (argv.verbose) {
|
|
2516
2694
|
console.log(`Building: ${argv.package ?? "all"}`);
|
|
@@ -2524,12 +2702,14 @@ var buildCommand = {
|
|
|
2524
2702
|
});
|
|
2525
2703
|
}
|
|
2526
2704
|
};
|
|
2705
|
+
|
|
2706
|
+
// src/xy/build/compileCommand.ts
|
|
2527
2707
|
var compileCommand = {
|
|
2528
|
-
builder: (yargs2) => {
|
|
2529
|
-
return packagePositionalParam(yargs2);
|
|
2530
|
-
},
|
|
2531
2708
|
command: "compile [package]",
|
|
2532
2709
|
describe: "Compile with Typescript & Copy Images",
|
|
2710
|
+
builder: (yargs2) => {
|
|
2711
|
+
return yargs2.positional("package", { describe: "Specific package to compile" });
|
|
2712
|
+
},
|
|
2533
2713
|
handler: (argv) => {
|
|
2534
2714
|
if (argv.verbose) {
|
|
2535
2715
|
console.log(`Compiling: ${argv.package ?? "all"}`);
|
|
@@ -2543,12 +2723,14 @@ var compileCommand = {
|
|
|
2543
2723
|
});
|
|
2544
2724
|
}
|
|
2545
2725
|
};
|
|
2726
|
+
|
|
2727
|
+
// src/xy/build/compileOnlyCommand.ts
|
|
2546
2728
|
var compileOnlyCommand = {
|
|
2547
|
-
builder: (yargs2) => {
|
|
2548
|
-
return packagePositionalParam(yargs2);
|
|
2549
|
-
},
|
|
2550
2729
|
command: "compile-only [package]",
|
|
2551
2730
|
describe: "Compile with Typescript & Copy Images (No Publint)",
|
|
2731
|
+
builder: (yargs2) => {
|
|
2732
|
+
return yargs2.positional("package", { describe: "Specific package to compile" });
|
|
2733
|
+
},
|
|
2552
2734
|
handler: (argv) => {
|
|
2553
2735
|
if (argv.verbose) {
|
|
2554
2736
|
console.log(`Compiling: ${argv.package ?? "all"}`);
|
|
@@ -2563,51 +2745,67 @@ var compileOnlyCommand = {
|
|
|
2563
2745
|
});
|
|
2564
2746
|
}
|
|
2565
2747
|
};
|
|
2566
|
-
|
|
2748
|
+
|
|
2749
|
+
// src/xy/build/copyAssetsCommand.ts
|
|
2750
|
+
var copyAssetsCommand = {
|
|
2751
|
+
command: "copy-assets [package]",
|
|
2752
|
+
describe: "Copy Assets - Copy the assets from src to dist",
|
|
2567
2753
|
builder: (yargs2) => {
|
|
2568
|
-
return
|
|
2754
|
+
return yargs2.positional("package", { describe: "Specific package to copy assets" });
|
|
2569
2755
|
},
|
|
2570
|
-
command: "recompile [package]",
|
|
2571
|
-
describe: "Re-compile with Typescript & Copy Images",
|
|
2572
2756
|
handler: async (argv) => {
|
|
2573
|
-
if (argv.verbose) {
|
|
2574
|
-
|
|
2575
|
-
}
|
|
2576
|
-
process.exitCode = await recompile({
|
|
2577
|
-
incremental: !!argv.incremental,
|
|
2578
|
-
jobs: argv.jobs,
|
|
2579
|
-
pkg: argv.package,
|
|
2580
|
-
target: argv.target,
|
|
2581
|
-
verbose: !!argv.verbose
|
|
2582
|
-
});
|
|
2757
|
+
if (argv.verbose) console.log(`Copying Assets: ${argv.package ?? "all"}`);
|
|
2758
|
+
process.exitCode = await copyAssets({ target: argv.target });
|
|
2583
2759
|
}
|
|
2584
2760
|
};
|
|
2761
|
+
|
|
2762
|
+
// src/xy/build/rebuildCommand.ts
|
|
2585
2763
|
var rebuildCommand = {
|
|
2586
|
-
builder: (yargs2) => {
|
|
2587
|
-
return packagePositionalParam(yargs2);
|
|
2588
|
-
},
|
|
2589
2764
|
command: "rebuild [package]",
|
|
2590
2765
|
describe: "Rebuild - Clean, Compile & Lint",
|
|
2766
|
+
builder: (yargs2) => {
|
|
2767
|
+
return yargs2.positional("package", { describe: "Specific package to rebuild" });
|
|
2768
|
+
},
|
|
2591
2769
|
handler: (argv) => {
|
|
2592
2770
|
if (argv.verbose) console.log(`Rebuilding: ${argv.package ?? "all"}`);
|
|
2593
2771
|
process.exitCode = rebuild({ target: argv.target });
|
|
2594
2772
|
}
|
|
2595
2773
|
};
|
|
2596
|
-
|
|
2774
|
+
|
|
2775
|
+
// src/xy/build/recompileCommand.ts
|
|
2776
|
+
var recompileCommand = {
|
|
2777
|
+
command: "recompile [package]",
|
|
2778
|
+
describe: "Re-compile with Typescript & Copy Images",
|
|
2597
2779
|
builder: (yargs2) => {
|
|
2598
|
-
return
|
|
2780
|
+
return yargs2.positional("package", { describe: "Specific package to re-compile" });
|
|
2599
2781
|
},
|
|
2600
|
-
command: "copy-assets [package]",
|
|
2601
|
-
describe: "Copy Assets - Copy the assets from src to dist",
|
|
2602
2782
|
handler: async (argv) => {
|
|
2603
|
-
if (argv.verbose)
|
|
2604
|
-
|
|
2783
|
+
if (argv.verbose) {
|
|
2784
|
+
console.log(`Re-compiling: ${argv.package ?? "all"}`);
|
|
2785
|
+
}
|
|
2786
|
+
process.exitCode = await recompile({
|
|
2787
|
+
incremental: !!argv.incremental,
|
|
2788
|
+
jobs: argv.jobs,
|
|
2789
|
+
pkg: argv.package,
|
|
2790
|
+
target: argv.target,
|
|
2791
|
+
verbose: !!argv.verbose
|
|
2792
|
+
});
|
|
2605
2793
|
}
|
|
2606
2794
|
};
|
|
2607
2795
|
|
|
2608
|
-
// src/xy/build
|
|
2796
|
+
// src/xy/build/index.ts
|
|
2609
2797
|
var xyBuildCommands = (args) => {
|
|
2610
|
-
return args.command(buildCommand).command(compileCommand).command(compileOnlyCommand).command(
|
|
2798
|
+
return args.command(buildCommand).command(compileCommand).command(compileOnlyCommand).command(recompileCommand).command(rebuildCommand).command(copyAssetsCommand);
|
|
2799
|
+
};
|
|
2800
|
+
|
|
2801
|
+
// src/xy/common/claude/cleanCommand.ts
|
|
2802
|
+
var cleanCommand = {
|
|
2803
|
+
command: "clean",
|
|
2804
|
+
describe: "Remove all Claude configuration files from the repo",
|
|
2805
|
+
handler: (argv) => {
|
|
2806
|
+
if (argv.verbose) console.log("Claude Clean");
|
|
2807
|
+
process.exitCode = claudeClean();
|
|
2808
|
+
}
|
|
2611
2809
|
};
|
|
2612
2810
|
|
|
2613
2811
|
// src/xy/common/claude/commandsCommand.ts
|
|
@@ -2640,14 +2838,6 @@ var initCommand = {
|
|
|
2640
2838
|
process.exitCode = commandsResult || rulesResult || settingsResult;
|
|
2641
2839
|
}
|
|
2642
2840
|
};
|
|
2643
|
-
var initClaudeSkillsCommand = {
|
|
2644
|
-
command: "init:skills",
|
|
2645
|
-
describe: "Initialize Claude skills configuration",
|
|
2646
|
-
handler: () => {
|
|
2647
|
-
const result = claudeSkills();
|
|
2648
|
-
process.exitCode = result;
|
|
2649
|
-
}
|
|
2650
|
-
};
|
|
2651
2841
|
|
|
2652
2842
|
// src/xy/common/claude/rulesCommand.ts
|
|
2653
2843
|
var rulesCommand = {
|
|
@@ -2677,10 +2867,21 @@ var settingsCommand = {
|
|
|
2677
2867
|
}
|
|
2678
2868
|
};
|
|
2679
2869
|
|
|
2870
|
+
// src/xy/common/claude/skillsCommand.ts
|
|
2871
|
+
var skillsCommand = {
|
|
2872
|
+
builder: (yargs2) => yargs2,
|
|
2873
|
+
command: "skills",
|
|
2874
|
+
describe: "Sync XY Labs standard Claude skills to .claude/skills/",
|
|
2875
|
+
handler: (argv) => {
|
|
2876
|
+
if (argv.verbose) console.log("Claude Skills");
|
|
2877
|
+
process.exitCode = claudeSkills();
|
|
2878
|
+
}
|
|
2879
|
+
};
|
|
2880
|
+
|
|
2680
2881
|
// src/xy/common/claude/index.ts
|
|
2681
2882
|
var claudeCommand = {
|
|
2682
2883
|
builder: (yargs2) => {
|
|
2683
|
-
return yargs2.command(commandsCommand).command(initCommand).command(rulesCommand).command(settingsCommand).command(
|
|
2884
|
+
return yargs2.command(cleanCommand).command(commandsCommand).command(initCommand).command(rulesCommand).command(settingsCommand).command(skillsCommand).demandCommand(1, "Please specify a claude subcommand");
|
|
2684
2885
|
},
|
|
2685
2886
|
command: "claude",
|
|
2686
2887
|
describe: "Claude - Claude Code configuration utilities",
|
|
@@ -2698,6 +2899,11 @@ var cleanDocsCommand = {
|
|
|
2698
2899
|
}
|
|
2699
2900
|
};
|
|
2700
2901
|
|
|
2902
|
+
// src/xy/param.ts
|
|
2903
|
+
var packagePositionalParam = (yargs2) => {
|
|
2904
|
+
return yargs2.positional("package", { describe: "Specific package to target", type: "string" });
|
|
2905
|
+
};
|
|
2906
|
+
|
|
2701
2907
|
// src/xy/common/deadCommand.ts
|
|
2702
2908
|
var deadCommand = {
|
|
2703
2909
|
builder: (yargs2) => {
|
|
@@ -2724,13 +2930,13 @@ var genDocsCommand = {
|
|
|
2724
2930
|
}
|
|
2725
2931
|
};
|
|
2726
2932
|
|
|
2727
|
-
// src/xy/common/
|
|
2728
|
-
var
|
|
2729
|
-
command: "gitignore
|
|
2730
|
-
describe: "GitIgnore
|
|
2933
|
+
// src/xy/common/gitignoreCommand.ts
|
|
2934
|
+
var gitignoreCommand = {
|
|
2935
|
+
command: "gitignore",
|
|
2936
|
+
describe: "GitIgnore - Generate root .gitignore and remove package .gitignore files",
|
|
2731
2937
|
handler: (argv) => {
|
|
2732
|
-
if (argv.verbose) console.log("GitIgnore
|
|
2733
|
-
process.exitCode =
|
|
2938
|
+
if (argv.verbose) console.log("GitIgnore");
|
|
2939
|
+
process.exitCode = gitignore();
|
|
2734
2940
|
}
|
|
2735
2941
|
};
|
|
2736
2942
|
|
|
@@ -2877,7 +3083,7 @@ var yarn3OnlyCommand = {
|
|
|
2877
3083
|
|
|
2878
3084
|
// src/xy/common/index.ts
|
|
2879
3085
|
var xyCommonCommands = (args) => {
|
|
2880
|
-
return args.command(claudeCommand).command(licenseCommand).command(deadCommand).command(genDocsCommand).command(cleanDocsCommand).command(gitlintCommand).command(
|
|
3086
|
+
return args.command(claudeCommand).command(licenseCommand).command(deadCommand).command(genDocsCommand).command(cleanDocsCommand).command(gitlintCommand).command(gitignoreCommand).command(npmignoreGenCommand).command(readmeCommand).command(retestCommand).command(testCommand).command(upplugCommand).command(upyarnCommand).command(yarn3OnlyCommand);
|
|
2881
3087
|
};
|
|
2882
3088
|
|
|
2883
3089
|
// src/xy/deploy/deployCommand.ts
|
|
@@ -2936,7 +3142,7 @@ var xyDeployCommands = (args) => {
|
|
|
2936
3142
|
};
|
|
2937
3143
|
|
|
2938
3144
|
// src/xy/install/cleanCommand.ts
|
|
2939
|
-
var
|
|
3145
|
+
var cleanCommand2 = {
|
|
2940
3146
|
command: "clean [package]",
|
|
2941
3147
|
describe: "Clean",
|
|
2942
3148
|
builder: (yargs2) => {
|
|
@@ -3005,11 +3211,11 @@ var updoCommand = {
|
|
|
3005
3211
|
|
|
3006
3212
|
// src/xy/install/index.ts
|
|
3007
3213
|
var xyInstallCommands = (args) => {
|
|
3008
|
-
return args.command(
|
|
3214
|
+
return args.command(cleanCommand2).command(reinstallCommand).command(upCommand).command(updoCommand).command(staticsCommand).command(dupdepsCommand);
|
|
3009
3215
|
};
|
|
3010
3216
|
|
|
3011
3217
|
// src/xy/lint/cycleCommand.ts
|
|
3012
|
-
import
|
|
3218
|
+
import chalk33 from "chalk";
|
|
3013
3219
|
var cycleCommand = {
|
|
3014
3220
|
command: "cycle [package]",
|
|
3015
3221
|
describe: "Cycle - Check for dependency cycles",
|
|
@@ -3020,12 +3226,12 @@ var cycleCommand = {
|
|
|
3020
3226
|
const start = Date.now();
|
|
3021
3227
|
if (argv.verbose) console.log("Cycle");
|
|
3022
3228
|
process.exitCode = await cycle({ pkg: argv.package });
|
|
3023
|
-
console.log(
|
|
3229
|
+
console.log(chalk33.blue(`Finished in ${Date.now() - start}ms`));
|
|
3024
3230
|
}
|
|
3025
3231
|
};
|
|
3026
3232
|
|
|
3027
3233
|
// src/xy/lint/deplintCommand.ts
|
|
3028
|
-
import
|
|
3234
|
+
import chalk34 from "chalk";
|
|
3029
3235
|
var deplintCommand = {
|
|
3030
3236
|
command: "deplint [package]",
|
|
3031
3237
|
describe: "Deplint - Run Deplint",
|
|
@@ -3063,12 +3269,12 @@ var deplintCommand = {
|
|
|
3063
3269
|
peerDeps: !!argv.peerDeps,
|
|
3064
3270
|
verbose: !!argv.verbose
|
|
3065
3271
|
});
|
|
3066
|
-
console.log(
|
|
3272
|
+
console.log(chalk34.blue(`Finished in ${Date.now() - start}ms`));
|
|
3067
3273
|
}
|
|
3068
3274
|
};
|
|
3069
3275
|
|
|
3070
3276
|
// src/xy/lint/fixCommand.ts
|
|
3071
|
-
import
|
|
3277
|
+
import chalk35 from "chalk";
|
|
3072
3278
|
var fixCommand = {
|
|
3073
3279
|
command: "fix [package]",
|
|
3074
3280
|
describe: "Fix - Run Eslint w/fix",
|
|
@@ -3079,12 +3285,12 @@ var fixCommand = {
|
|
|
3079
3285
|
const start = Date.now();
|
|
3080
3286
|
if (argv.verbose) console.log("Fix");
|
|
3081
3287
|
process.exitCode = fix();
|
|
3082
|
-
console.log(
|
|
3288
|
+
console.log(chalk35.blue(`Finished in ${Date.now() - start}ms`));
|
|
3083
3289
|
}
|
|
3084
3290
|
};
|
|
3085
3291
|
|
|
3086
3292
|
// src/xy/lint/knipCommand.ts
|
|
3087
|
-
import
|
|
3293
|
+
import chalk36 from "chalk";
|
|
3088
3294
|
var knipCommand = {
|
|
3089
3295
|
command: "knip",
|
|
3090
3296
|
describe: "Knip - Run Knip",
|
|
@@ -3095,12 +3301,12 @@ var knipCommand = {
|
|
|
3095
3301
|
if (argv.verbose) console.log("Knip");
|
|
3096
3302
|
const start = Date.now();
|
|
3097
3303
|
process.exitCode = knip();
|
|
3098
|
-
console.log(
|
|
3304
|
+
console.log(chalk36.blue(`Knip finished in ${Date.now() - start}ms`));
|
|
3099
3305
|
}
|
|
3100
3306
|
};
|
|
3101
3307
|
|
|
3102
3308
|
// src/xy/lint/lintCommand.ts
|
|
3103
|
-
import
|
|
3309
|
+
import chalk37 from "chalk";
|
|
3104
3310
|
var lintCommand = {
|
|
3105
3311
|
command: "lint [package]",
|
|
3106
3312
|
describe: "Lint - Run Eslint",
|
|
@@ -3129,12 +3335,12 @@ var lintCommand = {
|
|
|
3129
3335
|
cache: argv.cache,
|
|
3130
3336
|
verbose: !!argv.verbose
|
|
3131
3337
|
});
|
|
3132
|
-
console.log(
|
|
3338
|
+
console.log(chalk37.blue(`Finished in ${Date.now() - start}ms`));
|
|
3133
3339
|
}
|
|
3134
3340
|
};
|
|
3135
3341
|
|
|
3136
3342
|
// src/xy/lint/publintCommand.ts
|
|
3137
|
-
import
|
|
3343
|
+
import chalk38 from "chalk";
|
|
3138
3344
|
var publintCommand = {
|
|
3139
3345
|
command: "publint [package]",
|
|
3140
3346
|
describe: "Publint - Run Publint",
|
|
@@ -3145,12 +3351,12 @@ var publintCommand = {
|
|
|
3145
3351
|
if (argv.verbose) console.log("Publint");
|
|
3146
3352
|
const start = Date.now();
|
|
3147
3353
|
process.exitCode = await publint({ pkg: argv.package, verbose: !!argv.verbose });
|
|
3148
|
-
console.log(
|
|
3354
|
+
console.log(chalk38.blue(`Finished in ${Date.now() - start}ms`));
|
|
3149
3355
|
}
|
|
3150
3356
|
};
|
|
3151
3357
|
|
|
3152
3358
|
// src/xy/lint/relintCommand.ts
|
|
3153
|
-
import
|
|
3359
|
+
import chalk39 from "chalk";
|
|
3154
3360
|
var relintCommand = {
|
|
3155
3361
|
command: "relint [package]",
|
|
3156
3362
|
describe: "Relint - Clean & Lint",
|
|
@@ -3161,12 +3367,12 @@ var relintCommand = {
|
|
|
3161
3367
|
if (argv.verbose) console.log("Relinting");
|
|
3162
3368
|
const start = Date.now();
|
|
3163
3369
|
process.exitCode = relint();
|
|
3164
|
-
console.log(
|
|
3370
|
+
console.log(chalk39.blue(`Finished in ${Date.now() - start}ms`));
|
|
3165
3371
|
}
|
|
3166
3372
|
};
|
|
3167
3373
|
|
|
3168
3374
|
// src/xy/lint/sonarCommand.ts
|
|
3169
|
-
import
|
|
3375
|
+
import chalk40 from "chalk";
|
|
3170
3376
|
var sonarCommand = {
|
|
3171
3377
|
command: "sonar",
|
|
3172
3378
|
describe: "Sonar - Run Sonar Check",
|
|
@@ -3177,7 +3383,7 @@ var sonarCommand = {
|
|
|
3177
3383
|
const start = Date.now();
|
|
3178
3384
|
if (argv.verbose) console.log("Sonar Check");
|
|
3179
3385
|
process.exitCode = sonar();
|
|
3180
|
-
console.log(
|
|
3386
|
+
console.log(chalk40.blue(`Finished in ${Date.now() - start}ms`));
|
|
3181
3387
|
}
|
|
3182
3388
|
};
|
|
3183
3389
|
|
|
@@ -3217,8 +3423,8 @@ var xyParseOptions = () => {
|
|
|
3217
3423
|
var xy = async () => {
|
|
3218
3424
|
const options = xyParseOptions();
|
|
3219
3425
|
return await xyBuildCommands(xyCommonCommands(xyInstallCommands(xyDeployCommands(xyLintCommands(options))))).demandCommand(1).command("*", "", () => {
|
|
3220
|
-
console.error(
|
|
3221
|
-
console.log(
|
|
3426
|
+
console.error(chalk41.yellow(`Command not found [${chalk41.magenta(process.argv[2])}]`));
|
|
3427
|
+
console.log(chalk41.gray("Try 'yarn xy --help' for list of commands"));
|
|
3222
3428
|
}).version().help().argv;
|
|
3223
3429
|
};
|
|
3224
3430
|
export {
|