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