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