@xylabs/ts-scripts-yarn3 7.4.21 → 7.4.23
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-settings.mjs +2 -2
- package/dist/actions/claude-settings.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 +550 -208
- package/dist/actions/index.mjs.map +1 -1
- package/dist/actions/package-lint.mjs +178 -0
- package/dist/actions/package-lint.mjs.map +1 -0
- package/dist/bin/xy.mjs +607 -229
- package/dist/bin/xy.mjs.map +1 -1
- package/dist/index.d.ts +13 -3
- package/dist/index.mjs +671 -285
- 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 +173 -71
- package/dist/xy/common/claude/index.mjs.map +1 -1
- package/dist/xy/common/claude/initCommand.mjs +40 -117
- 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/settingsCommand.mjs +2 -2
- package/dist/xy/common/claude/settingsCommand.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 +306 -111
- package/dist/xy/common/index.mjs.map +1 -1
- package/dist/xy/index.mjs +607 -229
- 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/lint/index.mjs +200 -22
- package/dist/xy/lint/index.mjs.map +1 -1
- package/dist/xy/lint/packageLintCommand.mjs +193 -0
- package/dist/xy/lint/packageLintCommand.mjs.map +1 -0
- package/dist/xy/xy.mjs +607 -229
- 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/xy.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// src/xy/xy.ts
|
|
2
|
-
import
|
|
2
|
+
import chalk42 from "chalk";
|
|
3
3
|
|
|
4
4
|
// src/actions/build.ts
|
|
5
5
|
import chalk9 from "chalk";
|
|
@@ -29,7 +29,8 @@ var require2 = createRequire(import.meta.url);
|
|
|
29
29
|
var packageRoot = PATH.dirname(require2.resolve("@xylabs/ts-scripts-yarn3/package.json"));
|
|
30
30
|
var templatesDir = PATH.resolve(packageRoot, "templates", "claude");
|
|
31
31
|
var XYLABS_RULES_PREFIX = "xylabs-";
|
|
32
|
-
var XYLABS_COMMANDS_PREFIX = "
|
|
32
|
+
var XYLABS_COMMANDS_PREFIX = "xy-";
|
|
33
|
+
var LEGACY_COMMANDS_PREFIX = "xylabs-";
|
|
33
34
|
var XYLABS_SKILLS_PREFIX = "xylabs-";
|
|
34
35
|
var claudeMdRuleTemplates = () => {
|
|
35
36
|
const rulesDir = PATH.resolve(templatesDir, "rules");
|
|
@@ -67,7 +68,7 @@ var claudeSkillTemplates = () => {
|
|
|
67
68
|
}
|
|
68
69
|
return result;
|
|
69
70
|
};
|
|
70
|
-
var
|
|
71
|
+
var claudeMdLocalTemplate = () => readFileSync(PATH.resolve(templatesDir, "CLAUDE-local.md"), "utf8");
|
|
71
72
|
|
|
72
73
|
// src/lib/deleteGlob.ts
|
|
73
74
|
import fs from "fs";
|
|
@@ -327,19 +328,19 @@ var INIT_CWD = () => {
|
|
|
327
328
|
// src/lib/generateIgnoreFiles.ts
|
|
328
329
|
var localeCompare = (a, b) => a.localeCompare(b);
|
|
329
330
|
var mergeEntries = (a, b) => [...union(a, b)].toSorted(localeCompare);
|
|
330
|
-
var generateIgnoreFiles = (
|
|
331
|
-
console.log(chalk4.green(`Generate ${
|
|
331
|
+
var generateIgnoreFiles = (filename2, pkg) => {
|
|
332
|
+
console.log(chalk4.green(`Generate ${filename2} Files`));
|
|
332
333
|
const cwd = INIT_CWD() ?? ".";
|
|
333
334
|
const workspaces = pkg ? [yarnWorkspace(pkg)] : yarnWorkspaces();
|
|
334
|
-
const readEntries = (location) => readNonEmptyLines(`${location}/${
|
|
335
|
-
const writeEntries = (location, entries) => writeLines(`${location}/${
|
|
335
|
+
const readEntries = (location) => readNonEmptyLines(`${location}/${filename2}`);
|
|
336
|
+
const writeEntries = (location, entries) => writeLines(`${location}/${filename2}`, entries);
|
|
336
337
|
const results = workspaces.map(({ location, name }) => {
|
|
337
338
|
try {
|
|
338
339
|
writeEntries(location, mergeEntries(readEntries(cwd), readEntries(location)));
|
|
339
340
|
return 0;
|
|
340
341
|
} catch (ex) {
|
|
341
342
|
const error = ex;
|
|
342
|
-
console.error(`Generate ${
|
|
343
|
+
console.error(`Generate ${filename2} Files [${name}] [${error.message}]`);
|
|
343
344
|
return 1;
|
|
344
345
|
}
|
|
345
346
|
});
|
|
@@ -569,6 +570,15 @@ async function generateReadmeFiles({
|
|
|
569
570
|
return failed ? 1 : 0;
|
|
570
571
|
}
|
|
571
572
|
|
|
573
|
+
// src/lib/gitignoreTemplate.ts
|
|
574
|
+
import { readFileSync as readFileSync4 } from "fs";
|
|
575
|
+
import { createRequire as createRequire3 } from "module";
|
|
576
|
+
import PATH3 from "path";
|
|
577
|
+
var require4 = createRequire3(import.meta.url);
|
|
578
|
+
var packageRoot3 = PATH3.dirname(require4.resolve("@xylabs/ts-scripts-yarn3/package.json"));
|
|
579
|
+
var templatesDir2 = PATH3.resolve(packageRoot3, "templates", "gitignore");
|
|
580
|
+
var gitignoreTemplate = () => readFileSync4(PATH3.resolve(templatesDir2, "template.gitignore"), "utf8");
|
|
581
|
+
|
|
572
582
|
// src/lib/loadConfig.ts
|
|
573
583
|
import chalk6 from "chalk";
|
|
574
584
|
import { cosmiconfig } from "cosmiconfig";
|
|
@@ -591,10 +601,10 @@ var loadConfig = async (params) => {
|
|
|
591
601
|
};
|
|
592
602
|
|
|
593
603
|
// src/lib/parsedPackageJSON.ts
|
|
594
|
-
import { readFileSync as
|
|
604
|
+
import { readFileSync as readFileSync5 } from "fs";
|
|
595
605
|
var parsedPackageJSON = (path8) => {
|
|
596
606
|
const pathToPackageJSON = path8 ?? process.env.npm_package_json ?? "";
|
|
597
|
-
const packageJSON =
|
|
607
|
+
const packageJSON = readFileSync5(pathToPackageJSON).toString();
|
|
598
608
|
return JSON.parse(packageJSON);
|
|
599
609
|
};
|
|
600
610
|
|
|
@@ -704,25 +714,85 @@ var build = async ({
|
|
|
704
714
|
return result;
|
|
705
715
|
};
|
|
706
716
|
|
|
707
|
-
// src/actions/claude-
|
|
717
|
+
// src/actions/claude-clean.ts
|
|
708
718
|
import {
|
|
709
719
|
existsSync as existsSync4,
|
|
710
|
-
mkdirSync,
|
|
711
720
|
readdirSync as readdirSync2,
|
|
712
|
-
|
|
713
|
-
unlinkSync
|
|
714
|
-
writeFileSync as writeFileSync2
|
|
721
|
+
rmSync,
|
|
722
|
+
unlinkSync
|
|
715
723
|
} from "fs";
|
|
716
|
-
import
|
|
724
|
+
import PATH4 from "path";
|
|
717
725
|
import chalk10 from "chalk";
|
|
726
|
+
function removeFile(filePath, label) {
|
|
727
|
+
if (existsSync4(filePath)) {
|
|
728
|
+
unlinkSync(filePath);
|
|
729
|
+
console.log(chalk10.yellow(` Removed ${label}`));
|
|
730
|
+
return true;
|
|
731
|
+
}
|
|
732
|
+
return false;
|
|
733
|
+
}
|
|
734
|
+
function removeDir(dirPath, label) {
|
|
735
|
+
if (existsSync4(dirPath)) {
|
|
736
|
+
rmSync(dirPath, { recursive: true });
|
|
737
|
+
console.log(chalk10.yellow(` Removed ${label}`));
|
|
738
|
+
return true;
|
|
739
|
+
}
|
|
740
|
+
return false;
|
|
741
|
+
}
|
|
742
|
+
function claudeClean() {
|
|
743
|
+
console.log(chalk10.green("Clean Claude configuration"));
|
|
744
|
+
const cwd = INIT_CWD() ?? process.cwd();
|
|
745
|
+
let removed = 0;
|
|
746
|
+
const rootFiles = ["CLAUDE.md", "CLAUDE.local.md"];
|
|
747
|
+
for (const file of rootFiles) {
|
|
748
|
+
if (removeFile(PATH4.resolve(cwd, file), file)) removed++;
|
|
749
|
+
}
|
|
750
|
+
if (removeDir(PATH4.resolve(cwd, ".claude"), ".claude/")) removed++;
|
|
751
|
+
const packagesDir = PATH4.resolve(cwd, "packages");
|
|
752
|
+
if (existsSync4(packagesDir)) {
|
|
753
|
+
const findClaudeFiles = (dir, prefix) => {
|
|
754
|
+
const entries = readdirSync2(dir, { withFileTypes: true });
|
|
755
|
+
for (const entry of entries) {
|
|
756
|
+
const fullPath = PATH4.resolve(dir, entry.name);
|
|
757
|
+
const label = `${prefix}${entry.name}`;
|
|
758
|
+
if (entry.isFile() && (entry.name === "CLAUDE.md" || entry.name === "CLAUDE.local.md")) {
|
|
759
|
+
if (removeFile(fullPath, label)) removed++;
|
|
760
|
+
} else if (entry.isDirectory() && entry.name === ".claude") {
|
|
761
|
+
if (removeDir(fullPath, `${label}/`)) removed++;
|
|
762
|
+
} else if (entry.isDirectory() && entry.name !== "node_modules" && entry.name !== "dist") {
|
|
763
|
+
findClaudeFiles(fullPath, `${label}/`);
|
|
764
|
+
}
|
|
765
|
+
}
|
|
766
|
+
};
|
|
767
|
+
findClaudeFiles(packagesDir, "packages/");
|
|
768
|
+
}
|
|
769
|
+
if (removed > 0) {
|
|
770
|
+
console.log(chalk10.green(` Removed ${removed} item(s)`));
|
|
771
|
+
} else {
|
|
772
|
+
console.log(chalk10.gray(" Nothing to clean"));
|
|
773
|
+
}
|
|
774
|
+
return 0;
|
|
775
|
+
}
|
|
776
|
+
|
|
777
|
+
// src/actions/claude-commands.ts
|
|
778
|
+
import {
|
|
779
|
+
existsSync as existsSync5,
|
|
780
|
+
mkdirSync,
|
|
781
|
+
readdirSync as readdirSync3,
|
|
782
|
+
readFileSync as readFileSync6,
|
|
783
|
+
unlinkSync as unlinkSync2,
|
|
784
|
+
writeFileSync as writeFileSync2
|
|
785
|
+
} from "fs";
|
|
786
|
+
import PATH5 from "path";
|
|
787
|
+
import chalk11 from "chalk";
|
|
718
788
|
var syncCommandFiles = (commandsDir) => {
|
|
719
789
|
const templates = claudeCommandTemplates();
|
|
720
790
|
const templateNames = new Set(Object.keys(templates));
|
|
721
791
|
let updated = 0;
|
|
722
792
|
let created = 0;
|
|
723
|
-
for (const [
|
|
724
|
-
const targetPath =
|
|
725
|
-
const existing =
|
|
793
|
+
for (const [filename2, content] of Object.entries(templates)) {
|
|
794
|
+
const targetPath = PATH5.resolve(commandsDir, filename2);
|
|
795
|
+
const existing = existsSync5(targetPath) ? readFileSync6(targetPath, "utf8") : void 0;
|
|
726
796
|
if (existing === content) continue;
|
|
727
797
|
writeFileSync2(targetPath, content, "utf8");
|
|
728
798
|
if (existing) {
|
|
@@ -738,16 +808,23 @@ var syncCommandFiles = (commandsDir) => {
|
|
|
738
808
|
};
|
|
739
809
|
};
|
|
740
810
|
var removeStaleCommands = (commandsDir, templateNames) => {
|
|
741
|
-
const existingCommands =
|
|
811
|
+
const existingCommands = readdirSync3(commandsDir).filter((f) => f.startsWith(XYLABS_COMMANDS_PREFIX) && f.endsWith(".md"));
|
|
742
812
|
let removed = 0;
|
|
743
813
|
for (const file of existingCommands) {
|
|
744
814
|
if (!templateNames.has(file)) {
|
|
745
|
-
|
|
815
|
+
unlinkSync2(PATH5.resolve(commandsDir, file));
|
|
746
816
|
removed++;
|
|
747
817
|
}
|
|
748
818
|
}
|
|
749
819
|
return removed;
|
|
750
820
|
};
|
|
821
|
+
var removeLegacyCommands = (commandsDir) => {
|
|
822
|
+
const legacyFiles = readdirSync3(commandsDir).filter((f) => f.startsWith(LEGACY_COMMANDS_PREFIX) && f.endsWith(".md"));
|
|
823
|
+
for (const file of legacyFiles) {
|
|
824
|
+
unlinkSync2(PATH5.resolve(commandsDir, file));
|
|
825
|
+
}
|
|
826
|
+
return legacyFiles.length;
|
|
827
|
+
};
|
|
751
828
|
var logCommandsResult = (created, updated, removed) => {
|
|
752
829
|
if (created || updated || removed) {
|
|
753
830
|
const parts = [
|
|
@@ -755,44 +832,46 @@ var logCommandsResult = (created, updated, removed) => {
|
|
|
755
832
|
updated ? `${updated} updated` : "",
|
|
756
833
|
removed ? `${removed} removed` : ""
|
|
757
834
|
].filter(Boolean);
|
|
758
|
-
console.log(
|
|
835
|
+
console.log(chalk11.green(`.claude/commands/${XYLABS_COMMANDS_PREFIX}*.md: ${parts.join(", ")}`));
|
|
759
836
|
} else {
|
|
760
|
-
console.log(
|
|
837
|
+
console.log(chalk11.gray(`.claude/commands/${XYLABS_COMMANDS_PREFIX}*.md: already up to date`));
|
|
761
838
|
}
|
|
762
839
|
};
|
|
763
840
|
var claudeCommands = () => {
|
|
764
841
|
const cwd = INIT_CWD() ?? process.cwd();
|
|
765
|
-
const commandsDir =
|
|
842
|
+
const commandsDir = PATH5.resolve(cwd, ".claude", "commands");
|
|
766
843
|
mkdirSync(commandsDir, { recursive: true });
|
|
844
|
+
const legacy = removeLegacyCommands(commandsDir);
|
|
767
845
|
const {
|
|
768
846
|
created,
|
|
769
847
|
templateNames,
|
|
770
848
|
updated
|
|
771
849
|
} = syncCommandFiles(commandsDir);
|
|
772
850
|
const removed = removeStaleCommands(commandsDir, templateNames);
|
|
773
|
-
logCommandsResult(created, updated, removed);
|
|
851
|
+
logCommandsResult(created, updated, removed + legacy);
|
|
774
852
|
return 0;
|
|
775
853
|
};
|
|
776
854
|
|
|
777
855
|
// src/actions/claude-rules.ts
|
|
856
|
+
import { spawnSync as spawnSync4 } from "child_process";
|
|
778
857
|
import {
|
|
779
|
-
existsSync as
|
|
858
|
+
existsSync as existsSync6,
|
|
780
859
|
mkdirSync as mkdirSync2,
|
|
781
|
-
readdirSync as
|
|
782
|
-
readFileSync as
|
|
783
|
-
unlinkSync as
|
|
860
|
+
readdirSync as readdirSync4,
|
|
861
|
+
readFileSync as readFileSync7,
|
|
862
|
+
unlinkSync as unlinkSync3,
|
|
784
863
|
writeFileSync as writeFileSync3
|
|
785
864
|
} from "fs";
|
|
786
|
-
import
|
|
787
|
-
import
|
|
865
|
+
import PATH6 from "path";
|
|
866
|
+
import chalk12 from "chalk";
|
|
788
867
|
var syncRuleFiles = (rulesDir) => {
|
|
789
868
|
const templates = claudeMdRuleTemplates();
|
|
790
869
|
const templateNames = new Set(Object.keys(templates));
|
|
791
870
|
let updated = 0;
|
|
792
871
|
let created = 0;
|
|
793
|
-
for (const [
|
|
794
|
-
const targetPath =
|
|
795
|
-
const existing =
|
|
872
|
+
for (const [filename2, content] of Object.entries(templates)) {
|
|
873
|
+
const targetPath = PATH6.resolve(rulesDir, filename2);
|
|
874
|
+
const existing = existsSync6(targetPath) ? readFileSync7(targetPath, "utf8") : void 0;
|
|
796
875
|
if (existing === content) continue;
|
|
797
876
|
writeFileSync3(targetPath, content, "utf8");
|
|
798
877
|
if (existing) {
|
|
@@ -808,11 +887,11 @@ var syncRuleFiles = (rulesDir) => {
|
|
|
808
887
|
};
|
|
809
888
|
};
|
|
810
889
|
var removeStaleRules = (rulesDir, templateNames) => {
|
|
811
|
-
const existingRules =
|
|
890
|
+
const existingRules = readdirSync4(rulesDir).filter((f) => f.startsWith(XYLABS_RULES_PREFIX) && f.endsWith(".md"));
|
|
812
891
|
let removed = 0;
|
|
813
892
|
for (const file of existingRules) {
|
|
814
893
|
if (!templateNames.has(file)) {
|
|
815
|
-
|
|
894
|
+
unlinkSync3(PATH6.resolve(rulesDir, file));
|
|
816
895
|
removed++;
|
|
817
896
|
}
|
|
818
897
|
}
|
|
@@ -825,26 +904,44 @@ var logRulesResult = (created, updated, removed) => {
|
|
|
825
904
|
updated ? `${updated} updated` : "",
|
|
826
905
|
removed ? `${removed} removed` : ""
|
|
827
906
|
].filter(Boolean);
|
|
828
|
-
console.log(
|
|
907
|
+
console.log(chalk12.green(`.claude/rules/${XYLABS_RULES_PREFIX}*.md: ${parts.join(", ")}`));
|
|
829
908
|
} else {
|
|
830
|
-
console.log(
|
|
909
|
+
console.log(chalk12.gray(`.claude/rules/${XYLABS_RULES_PREFIX}*.md: already up to date`));
|
|
831
910
|
}
|
|
832
911
|
};
|
|
833
912
|
var ensureProjectClaudeMd = (cwd, force) => {
|
|
834
|
-
const projectPath =
|
|
835
|
-
if (!
|
|
836
|
-
if (force &&
|
|
837
|
-
console.log(
|
|
913
|
+
const projectPath = PATH6.resolve(cwd, "CLAUDE.md");
|
|
914
|
+
if (!existsSync6(projectPath) || force) {
|
|
915
|
+
if (force && existsSync6(projectPath)) {
|
|
916
|
+
console.log(chalk12.yellow("Regenerating CLAUDE.md"));
|
|
917
|
+
}
|
|
918
|
+
console.log(chalk12.green("Generating CLAUDE.md via claude /init..."));
|
|
919
|
+
const result = spawnSync4("claude", ["-p", "/init", "--allowedTools", "Read", "Write", "Glob", "Grep"], {
|
|
920
|
+
cwd,
|
|
921
|
+
shell: true,
|
|
922
|
+
stdio: "inherit"
|
|
923
|
+
});
|
|
924
|
+
if (result.status !== 0) {
|
|
925
|
+
console.error(chalk12.red("claude /init failed \u2014 is Claude Code installed?"));
|
|
926
|
+
return 1;
|
|
838
927
|
}
|
|
839
|
-
writeFileSync3(projectPath, claudeMdProjectTemplate(), "utf8");
|
|
840
|
-
console.log(chalk11.green("Generated CLAUDE.md"));
|
|
841
928
|
} else {
|
|
842
|
-
console.log(
|
|
929
|
+
console.log(chalk12.gray("CLAUDE.md already exists (skipped, use --force to regenerate)"));
|
|
930
|
+
}
|
|
931
|
+
return 0;
|
|
932
|
+
};
|
|
933
|
+
var ensureLocalClaudeMd = (cwd) => {
|
|
934
|
+
const localPath = PATH6.resolve(cwd, "CLAUDE.local.md");
|
|
935
|
+
if (existsSync6(localPath)) {
|
|
936
|
+
console.log(chalk12.gray("CLAUDE.local.md already exists (skipped)"));
|
|
937
|
+
} else {
|
|
938
|
+
writeFileSync3(localPath, claudeMdLocalTemplate(), "utf8");
|
|
939
|
+
console.log(chalk12.green("Generated CLAUDE.local.md"));
|
|
843
940
|
}
|
|
844
941
|
};
|
|
845
942
|
var claudeRules = ({ force } = {}) => {
|
|
846
943
|
const cwd = INIT_CWD() ?? process.cwd();
|
|
847
|
-
const rulesDir =
|
|
944
|
+
const rulesDir = PATH6.resolve(cwd, ".claude", "rules");
|
|
848
945
|
mkdirSync2(rulesDir, { recursive: true });
|
|
849
946
|
const {
|
|
850
947
|
created,
|
|
@@ -853,19 +950,20 @@ var claudeRules = ({ force } = {}) => {
|
|
|
853
950
|
} = syncRuleFiles(rulesDir);
|
|
854
951
|
const removed = removeStaleRules(rulesDir, templateNames);
|
|
855
952
|
logRulesResult(created, updated, removed);
|
|
856
|
-
ensureProjectClaudeMd(cwd, force);
|
|
857
|
-
|
|
953
|
+
const claudeMdResult = ensureProjectClaudeMd(cwd, force);
|
|
954
|
+
ensureLocalClaudeMd(cwd);
|
|
955
|
+
return claudeMdResult ?? 0;
|
|
858
956
|
};
|
|
859
957
|
|
|
860
958
|
// src/actions/claude-settings.ts
|
|
861
959
|
import {
|
|
862
|
-
existsSync as
|
|
960
|
+
existsSync as existsSync7,
|
|
863
961
|
mkdirSync as mkdirSync3,
|
|
864
962
|
writeFileSync as writeFileSync4
|
|
865
963
|
} from "fs";
|
|
866
|
-
import
|
|
964
|
+
import PATH7 from "path";
|
|
867
965
|
import { createInterface as createInterface2 } from "readline";
|
|
868
|
-
import
|
|
966
|
+
import chalk13 from "chalk";
|
|
869
967
|
var DEFAULT_SETTINGS = {
|
|
870
968
|
permissions: {
|
|
871
969
|
allow: [
|
|
@@ -893,8 +991,8 @@ var DEFAULT_SETTINGS = {
|
|
|
893
991
|
"Skill"
|
|
894
992
|
],
|
|
895
993
|
deny: [
|
|
896
|
-
"Bash(git push --force*)",
|
|
897
|
-
"Bash(git reset --hard*)",
|
|
994
|
+
"Bash(git push --force *)",
|
|
995
|
+
"Bash(git reset --hard *)",
|
|
898
996
|
"Bash(rm -rf /*)"
|
|
899
997
|
]
|
|
900
998
|
}
|
|
@@ -910,48 +1008,48 @@ function askConfirmation2(question) {
|
|
|
910
1008
|
}
|
|
911
1009
|
async function claudeSettings() {
|
|
912
1010
|
const cwd = INIT_CWD() ?? process.cwd();
|
|
913
|
-
const claudeDir =
|
|
914
|
-
const settingsPath =
|
|
1011
|
+
const claudeDir = PATH7.resolve(cwd, ".claude");
|
|
1012
|
+
const settingsPath = PATH7.resolve(claudeDir, "settings.local.json");
|
|
915
1013
|
mkdirSync3(claudeDir, { recursive: true });
|
|
916
|
-
if (
|
|
1014
|
+
if (existsSync7(settingsPath)) {
|
|
917
1015
|
const confirmed = await askConfirmation2(
|
|
918
|
-
|
|
1016
|
+
chalk13.yellow(`${settingsPath} already exists. Replace it? (y/N) `)
|
|
919
1017
|
);
|
|
920
1018
|
if (!confirmed) {
|
|
921
|
-
console.log(
|
|
1019
|
+
console.log(chalk13.gray("Skipped \u2014 existing settings.local.json preserved"));
|
|
922
1020
|
return 0;
|
|
923
1021
|
}
|
|
924
1022
|
}
|
|
925
1023
|
writeFileSync4(settingsPath, `${JSON.stringify(DEFAULT_SETTINGS, null, 2)}
|
|
926
1024
|
`, "utf8");
|
|
927
|
-
console.log(
|
|
1025
|
+
console.log(chalk13.green("Generated .claude/settings.local.json"));
|
|
928
1026
|
return 0;
|
|
929
1027
|
}
|
|
930
1028
|
|
|
931
1029
|
// src/actions/claude-skills.ts
|
|
932
1030
|
import {
|
|
933
|
-
existsSync as
|
|
1031
|
+
existsSync as existsSync8,
|
|
934
1032
|
mkdirSync as mkdirSync4,
|
|
935
|
-
readdirSync as
|
|
936
|
-
readFileSync as
|
|
937
|
-
rmSync,
|
|
1033
|
+
readdirSync as readdirSync5,
|
|
1034
|
+
readFileSync as readFileSync8,
|
|
1035
|
+
rmSync as rmSync2,
|
|
938
1036
|
statSync as statSync2,
|
|
939
1037
|
writeFileSync as writeFileSync5
|
|
940
1038
|
} from "fs";
|
|
941
|
-
import
|
|
942
|
-
import
|
|
1039
|
+
import PATH8 from "path";
|
|
1040
|
+
import chalk14 from "chalk";
|
|
943
1041
|
var syncSkillFiles = (skillsDir) => {
|
|
944
1042
|
const templates = claudeSkillTemplates();
|
|
945
1043
|
const templateNames = new Set(Object.keys(templates));
|
|
946
1044
|
let updated = 0;
|
|
947
1045
|
let created = 0;
|
|
948
1046
|
for (const [skillName, files] of Object.entries(templates)) {
|
|
949
|
-
const skillDir =
|
|
1047
|
+
const skillDir = PATH8.resolve(skillsDir, skillName);
|
|
950
1048
|
mkdirSync4(skillDir, { recursive: true });
|
|
951
|
-
for (const [
|
|
952
|
-
const targetPath =
|
|
953
|
-
mkdirSync4(
|
|
954
|
-
const existing =
|
|
1049
|
+
for (const [filename2, content] of Object.entries(files)) {
|
|
1050
|
+
const targetPath = PATH8.resolve(skillDir, filename2);
|
|
1051
|
+
mkdirSync4(PATH8.dirname(targetPath), { recursive: true });
|
|
1052
|
+
const existing = existsSync8(targetPath) ? readFileSync8(targetPath, "utf8") : void 0;
|
|
955
1053
|
if (existing === content) continue;
|
|
956
1054
|
writeFileSync5(targetPath, content, "utf8");
|
|
957
1055
|
if (existing) {
|
|
@@ -968,13 +1066,13 @@ var syncSkillFiles = (skillsDir) => {
|
|
|
968
1066
|
};
|
|
969
1067
|
};
|
|
970
1068
|
var removeStaleSkills = (skillsDir, templateNames) => {
|
|
971
|
-
const existingSkills =
|
|
972
|
-
(f) => f.startsWith(XYLABS_SKILLS_PREFIX) && statSync2(
|
|
1069
|
+
const existingSkills = readdirSync5(skillsDir).filter(
|
|
1070
|
+
(f) => f.startsWith(XYLABS_SKILLS_PREFIX) && statSync2(PATH8.resolve(skillsDir, f)).isDirectory()
|
|
973
1071
|
);
|
|
974
1072
|
let removed = 0;
|
|
975
1073
|
for (const dir of existingSkills) {
|
|
976
1074
|
if (!templateNames.has(dir)) {
|
|
977
|
-
|
|
1075
|
+
rmSync2(PATH8.resolve(skillsDir, dir), { recursive: true });
|
|
978
1076
|
removed++;
|
|
979
1077
|
}
|
|
980
1078
|
}
|
|
@@ -987,14 +1085,14 @@ var logSkillsResult = (created, updated, removed) => {
|
|
|
987
1085
|
updated ? `${updated} updated` : "",
|
|
988
1086
|
removed ? `${removed} removed` : ""
|
|
989
1087
|
].filter(Boolean);
|
|
990
|
-
console.log(
|
|
1088
|
+
console.log(chalk14.green(`.claude/skills/${XYLABS_SKILLS_PREFIX}*/: ${parts.join(", ")}`));
|
|
991
1089
|
} else {
|
|
992
|
-
console.log(
|
|
1090
|
+
console.log(chalk14.gray(`.claude/skills/${XYLABS_SKILLS_PREFIX}*/: already up to date`));
|
|
993
1091
|
}
|
|
994
1092
|
};
|
|
995
1093
|
var claudeSkills = () => {
|
|
996
1094
|
const cwd = INIT_CWD() ?? process.cwd();
|
|
997
|
-
const skillsDir =
|
|
1095
|
+
const skillsDir = PATH8.resolve(cwd, ".claude", "skills");
|
|
998
1096
|
mkdirSync4(skillsDir, { recursive: true });
|
|
999
1097
|
const {
|
|
1000
1098
|
created,
|
|
@@ -1020,16 +1118,16 @@ var cleanAll = ({ verbose }) => {
|
|
|
1020
1118
|
|
|
1021
1119
|
// src/actions/clean-docs.ts
|
|
1022
1120
|
import path from "path";
|
|
1023
|
-
import
|
|
1121
|
+
import chalk15 from "chalk";
|
|
1024
1122
|
var cleanDocs = () => {
|
|
1025
1123
|
const pkgName = process.env.npm_package_name;
|
|
1026
|
-
console.log(
|
|
1124
|
+
console.log(chalk15.green(`Cleaning Docs [${pkgName}]`));
|
|
1027
1125
|
for (const { location } of yarnWorkspaces()) deleteGlob(path.join(location, "docs"));
|
|
1028
1126
|
return 0;
|
|
1029
1127
|
};
|
|
1030
1128
|
|
|
1031
1129
|
// src/actions/compile.ts
|
|
1032
|
-
import
|
|
1130
|
+
import chalk16 from "chalk";
|
|
1033
1131
|
var compile = ({
|
|
1034
1132
|
verbose,
|
|
1035
1133
|
target,
|
|
@@ -1070,7 +1168,7 @@ var compileAll = ({
|
|
|
1070
1168
|
const incrementalOptions = incremental ? ["--since", "-Ap", "--topological-dev"] : ["--parallel", "-Ap", "--topological-dev"];
|
|
1071
1169
|
const jobsOptions = jobs ? ["-j", `${jobs}`] : [];
|
|
1072
1170
|
if (jobs) {
|
|
1073
|
-
console.log(
|
|
1171
|
+
console.log(chalk16.blue(`Jobs set to [${jobs}]`));
|
|
1074
1172
|
}
|
|
1075
1173
|
const result = runSteps(`Compile${incremental ? "-Incremental" : ""} [All]`, [
|
|
1076
1174
|
["yarn", [
|
|
@@ -1084,13 +1182,13 @@ var compileAll = ({
|
|
|
1084
1182
|
...targetOptions
|
|
1085
1183
|
]]
|
|
1086
1184
|
]);
|
|
1087
|
-
console.log(`${
|
|
1185
|
+
console.log(`${chalk16.gray("Compiled in")} [${chalk16.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk16.gray("seconds")}`);
|
|
1088
1186
|
return result;
|
|
1089
1187
|
};
|
|
1090
1188
|
|
|
1091
1189
|
// src/actions/copy-assets.ts
|
|
1092
1190
|
import path2 from "path/posix";
|
|
1093
|
-
import
|
|
1191
|
+
import chalk17 from "chalk";
|
|
1094
1192
|
import cpy from "cpy";
|
|
1095
1193
|
var copyPackageTargetAssets = async (target, name, location) => {
|
|
1096
1194
|
try {
|
|
@@ -1113,7 +1211,7 @@ var copyPackageTargetAssets = async (target, name, location) => {
|
|
|
1113
1211
|
};
|
|
1114
1212
|
var copyTargetAssets = async (target, pkg) => {
|
|
1115
1213
|
const workspaces = yarnWorkspaces();
|
|
1116
|
-
console.log(
|
|
1214
|
+
console.log(chalk17.green(`Copying Assets [${target.toUpperCase()}]`));
|
|
1117
1215
|
const workspaceList = workspaces.filter(({ name }) => {
|
|
1118
1216
|
return pkg === void 0 || name === pkg;
|
|
1119
1217
|
});
|
|
@@ -1197,7 +1295,7 @@ var dead = () => {
|
|
|
1197
1295
|
};
|
|
1198
1296
|
|
|
1199
1297
|
// src/actions/deplint/deplint.ts
|
|
1200
|
-
import
|
|
1298
|
+
import chalk23 from "chalk";
|
|
1201
1299
|
|
|
1202
1300
|
// src/actions/deplint/findFiles.ts
|
|
1203
1301
|
import fs2 from "fs";
|
|
@@ -1402,7 +1500,7 @@ function getExternalImportsFromFiles({
|
|
|
1402
1500
|
|
|
1403
1501
|
// src/actions/deplint/checkPackage/getUnlistedDependencies.ts
|
|
1404
1502
|
import { builtinModules } from "module";
|
|
1405
|
-
import
|
|
1503
|
+
import chalk18 from "chalk";
|
|
1406
1504
|
function isRuntimeImportListed(imp, name, dependencies, peerDependencies) {
|
|
1407
1505
|
return dependencies.includes(imp) || imp === name || peerDependencies.includes(imp) || builtinModules.includes(imp);
|
|
1408
1506
|
}
|
|
@@ -1410,7 +1508,7 @@ function isTypeImportListed(imp, name, dependencies, devDependencies, peerDepend
|
|
|
1410
1508
|
return dependencies.includes(imp) || imp === name || dependencies.includes(`@types/${imp}`) || peerDependencies.includes(imp) || peerDependencies.includes(`@types/${imp}`) || devDependencies.includes(`@types/${imp}`) || builtinModules.includes(imp);
|
|
1411
1509
|
}
|
|
1412
1510
|
function logMissing(name, imp, importPaths) {
|
|
1413
|
-
console.log(`[${
|
|
1511
|
+
console.log(`[${chalk18.blue(name)}] Missing dependency in package.json: ${chalk18.red(imp)}`);
|
|
1414
1512
|
if (importPaths[imp]) {
|
|
1415
1513
|
console.log(` ${importPaths[imp].join("\n ")}`);
|
|
1416
1514
|
}
|
|
@@ -1439,7 +1537,7 @@ function getUnlistedDependencies({ name, location }, {
|
|
|
1439
1537
|
}
|
|
1440
1538
|
if (unlistedDependencies > 0) {
|
|
1441
1539
|
const packageLocation = `${location}/package.json`;
|
|
1442
|
-
console.log(` ${
|
|
1540
|
+
console.log(` ${chalk18.yellow(packageLocation)}
|
|
1443
1541
|
`);
|
|
1444
1542
|
}
|
|
1445
1543
|
return unlistedDependencies;
|
|
@@ -1447,7 +1545,7 @@ function getUnlistedDependencies({ name, location }, {
|
|
|
1447
1545
|
|
|
1448
1546
|
// src/actions/deplint/checkPackage/getUnlistedDevDependencies.ts
|
|
1449
1547
|
import { builtinModules as builtinModules2 } from "module";
|
|
1450
|
-
import
|
|
1548
|
+
import chalk19 from "chalk";
|
|
1451
1549
|
function getUnlistedDevDependencies({ name, location }, {
|
|
1452
1550
|
devDependencies,
|
|
1453
1551
|
dependencies,
|
|
@@ -1461,7 +1559,7 @@ function getUnlistedDevDependencies({ name, location }, {
|
|
|
1461
1559
|
for (const imp of externalAllImports) {
|
|
1462
1560
|
if (!distImports.includes(imp) && imp !== name && !dependencies.includes(imp) && !dependencies.includes(`@types/${imp}`) && !peerDependencies.includes(imp) && !peerDependencies.includes(`@types/${imp}`) && !devDependencies.includes(imp) && !devDependencies.includes(`@types/${imp}`) && !builtinModules2.includes(imp)) {
|
|
1463
1561
|
unlistedDevDependencies++;
|
|
1464
|
-
console.log(`[${
|
|
1562
|
+
console.log(`[${chalk19.blue(name)}] Missing devDependency in package.json: ${chalk19.red(imp)}`);
|
|
1465
1563
|
if (allImportPaths[imp]) {
|
|
1466
1564
|
console.log(` ${allImportPaths[imp].join("\n ")}`);
|
|
1467
1565
|
}
|
|
@@ -1469,14 +1567,14 @@ function getUnlistedDevDependencies({ name, location }, {
|
|
|
1469
1567
|
}
|
|
1470
1568
|
if (unlistedDevDependencies > 0) {
|
|
1471
1569
|
const packageLocation = `${location}/package.json`;
|
|
1472
|
-
console.log(` ${
|
|
1570
|
+
console.log(` ${chalk19.yellow(packageLocation)}
|
|
1473
1571
|
`);
|
|
1474
1572
|
}
|
|
1475
1573
|
return unlistedDevDependencies;
|
|
1476
1574
|
}
|
|
1477
1575
|
|
|
1478
1576
|
// src/actions/deplint/checkPackage/getUnusedDependencies.ts
|
|
1479
|
-
import
|
|
1577
|
+
import chalk20 from "chalk";
|
|
1480
1578
|
function getUnusedDependencies({ name, location }, { dependencies }, {
|
|
1481
1579
|
externalDistImports,
|
|
1482
1580
|
externalDistTypeImports,
|
|
@@ -1488,22 +1586,22 @@ function getUnusedDependencies({ name, location }, { dependencies }, {
|
|
|
1488
1586
|
if (!externalDistImports.includes(dep) && !externalDistImports.includes(dep.replace(/^@types\//, "")) && !externalDistTypeImports.includes(dep) && !externalDistTypeImports.includes(dep.replace(/^@types\//, ""))) {
|
|
1489
1587
|
unusedDependencies++;
|
|
1490
1588
|
if (externalAllImports.includes(dep)) {
|
|
1491
|
-
console.log(`[${
|
|
1589
|
+
console.log(`[${chalk20.blue(name)}] dependency should be devDependency in package.json: ${chalk20.red(dep)}`);
|
|
1492
1590
|
} else {
|
|
1493
|
-
console.log(`[${
|
|
1591
|
+
console.log(`[${chalk20.blue(name)}] Unused dependency in package.json: ${chalk20.red(dep)}`);
|
|
1494
1592
|
}
|
|
1495
1593
|
}
|
|
1496
1594
|
}
|
|
1497
1595
|
if (unusedDependencies > 0) {
|
|
1498
1596
|
const packageLocation = `${location}/package.json`;
|
|
1499
|
-
console.log(` ${
|
|
1597
|
+
console.log(` ${chalk20.yellow(packageLocation)}
|
|
1500
1598
|
`);
|
|
1501
1599
|
}
|
|
1502
1600
|
return unusedDependencies;
|
|
1503
1601
|
}
|
|
1504
1602
|
|
|
1505
1603
|
// src/actions/deplint/checkPackage/getUnusedDevDependencies.ts
|
|
1506
|
-
import
|
|
1604
|
+
import chalk21 from "chalk";
|
|
1507
1605
|
|
|
1508
1606
|
// src/actions/deplint/getCliReferencedPackagesFromFiles.ts
|
|
1509
1607
|
import fs8 from "fs";
|
|
@@ -1787,19 +1885,19 @@ function getUnusedDevDependencies({ name, location }, {
|
|
|
1787
1885
|
if (dependencies.includes(dep) || peerDependencies.includes(dep)) continue;
|
|
1788
1886
|
if (!isDevDepUsed(dep, allImports, implicitDeps, requiredPeers, scriptRefs, cliRefs)) {
|
|
1789
1887
|
unusedDevDependencies++;
|
|
1790
|
-
console.log(`[${
|
|
1888
|
+
console.log(`[${chalk21.blue(name)}] Unused devDependency in package.json: ${chalk21.red(dep)}`);
|
|
1791
1889
|
}
|
|
1792
1890
|
}
|
|
1793
1891
|
if (unusedDevDependencies > 0) {
|
|
1794
1892
|
const packageLocation = `${location}/package.json`;
|
|
1795
|
-
console.log(` ${
|
|
1893
|
+
console.log(` ${chalk21.yellow(packageLocation)}
|
|
1796
1894
|
`);
|
|
1797
1895
|
}
|
|
1798
1896
|
return unusedDevDependencies;
|
|
1799
1897
|
}
|
|
1800
1898
|
|
|
1801
1899
|
// src/actions/deplint/checkPackage/getUnusedPeerDependencies.ts
|
|
1802
|
-
import
|
|
1900
|
+
import chalk22 from "chalk";
|
|
1803
1901
|
function getUnusedPeerDependencies({ name, location }, { peerDependencies, dependencies }, { externalDistImports, externalDistTypeImports }, exclude) {
|
|
1804
1902
|
let unusedDependencies = 0;
|
|
1805
1903
|
for (const dep of peerDependencies) {
|
|
@@ -1807,15 +1905,15 @@ function getUnusedPeerDependencies({ name, location }, { peerDependencies, depen
|
|
|
1807
1905
|
if (!externalDistImports.includes(dep) && !externalDistImports.includes(dep.replace(/^@types\//, "")) && !externalDistTypeImports.includes(dep) && !externalDistTypeImports.includes(dep.replace(/^@types\//, ""))) {
|
|
1808
1906
|
unusedDependencies++;
|
|
1809
1907
|
if (dependencies.includes(dep)) {
|
|
1810
|
-
console.log(`[${
|
|
1908
|
+
console.log(`[${chalk22.blue(name)}] Unused peerDependency [already a dependency] in package.json: ${chalk22.red(dep)}`);
|
|
1811
1909
|
} else {
|
|
1812
|
-
console.log(`[${
|
|
1910
|
+
console.log(`[${chalk22.blue(name)}] Unused peerDependency in package.json: ${chalk22.red(dep)}`);
|
|
1813
1911
|
}
|
|
1814
1912
|
}
|
|
1815
1913
|
}
|
|
1816
1914
|
if (unusedDependencies > 0) {
|
|
1817
1915
|
const packageLocation = `${location}/package.json`;
|
|
1818
|
-
console.log(` ${
|
|
1916
|
+
console.log(` ${chalk22.yellow(packageLocation)}
|
|
1819
1917
|
`);
|
|
1820
1918
|
}
|
|
1821
1919
|
return unusedDependencies;
|
|
@@ -1910,19 +2008,19 @@ var deplint = async ({
|
|
|
1910
2008
|
});
|
|
1911
2009
|
}
|
|
1912
2010
|
if (totalErrors > 0) {
|
|
1913
|
-
console.warn(`Deplint: Found ${
|
|
2011
|
+
console.warn(`Deplint: Found ${chalk23.red(totalErrors)} dependency problems. ${chalk23.red("\u2716")}`);
|
|
1914
2012
|
} else {
|
|
1915
|
-
console.info(`Deplint: Found no dependency problems. ${
|
|
2013
|
+
console.info(`Deplint: Found no dependency problems. ${chalk23.green("\u2714")}`);
|
|
1916
2014
|
}
|
|
1917
2015
|
return 0;
|
|
1918
2016
|
};
|
|
1919
2017
|
|
|
1920
2018
|
// src/actions/deploy.ts
|
|
1921
|
-
import { readFileSync as
|
|
2019
|
+
import { readFileSync as readFileSync9 } from "fs";
|
|
1922
2020
|
var privatePackageExcludeList = () => {
|
|
1923
2021
|
const possibleDeployablePackages = yarnWorkspaces().map((workspace) => [
|
|
1924
2022
|
workspace,
|
|
1925
|
-
JSON.parse(
|
|
2023
|
+
JSON.parse(readFileSync9(`${workspace.location}/package.json`, { encoding: "utf8" }))
|
|
1926
2024
|
]);
|
|
1927
2025
|
const privatePackages = possibleDeployablePackages.filter(([_, pkg]) => pkg.private).map(([workspace]) => workspace);
|
|
1928
2026
|
const excludeList = privatePackages.map((workspace) => `--exclude ${workspace.name}`);
|
|
@@ -1942,11 +2040,11 @@ var deploy = () => {
|
|
|
1942
2040
|
};
|
|
1943
2041
|
|
|
1944
2042
|
// src/actions/deploy-major.ts
|
|
1945
|
-
import { readFileSync as
|
|
2043
|
+
import { readFileSync as readFileSync10 } from "fs";
|
|
1946
2044
|
var privatePackageExcludeList2 = () => {
|
|
1947
2045
|
const possibleDeployablePackages = yarnWorkspaces().map((workspace) => [
|
|
1948
2046
|
workspace,
|
|
1949
|
-
JSON.parse(
|
|
2047
|
+
JSON.parse(readFileSync10(`${workspace.location}/package.json`, { encoding: "utf8" }))
|
|
1950
2048
|
]);
|
|
1951
2049
|
const privatePackages = possibleDeployablePackages.filter(([_, pkg]) => pkg.private).map(([workspace]) => workspace);
|
|
1952
2050
|
const excludeList = privatePackages.map((workspace) => `--exclude ${workspace.name}`);
|
|
@@ -1966,11 +2064,11 @@ var deployMajor = () => {
|
|
|
1966
2064
|
};
|
|
1967
2065
|
|
|
1968
2066
|
// src/actions/deploy-minor.ts
|
|
1969
|
-
import { readFileSync as
|
|
2067
|
+
import { readFileSync as readFileSync11 } from "fs";
|
|
1970
2068
|
var privatePackageExcludeList3 = () => {
|
|
1971
2069
|
const possibleDeployablePackages = yarnWorkspaces().map((workspace) => [
|
|
1972
2070
|
workspace,
|
|
1973
|
-
JSON.parse(
|
|
2071
|
+
JSON.parse(readFileSync11(`${workspace.location}/package.json`, { encoding: "utf8" }))
|
|
1974
2072
|
]);
|
|
1975
2073
|
const privatePackages = possibleDeployablePackages.filter(([_, pkg]) => pkg.private).map(([workspace]) => workspace);
|
|
1976
2074
|
const excludeList = privatePackages.map((workspace) => `--exclude ${workspace.name}`);
|
|
@@ -1990,11 +2088,11 @@ var deployMinor = () => {
|
|
|
1990
2088
|
};
|
|
1991
2089
|
|
|
1992
2090
|
// src/actions/deploy-next.ts
|
|
1993
|
-
import { readFileSync as
|
|
2091
|
+
import { readFileSync as readFileSync12 } from "fs";
|
|
1994
2092
|
var privatePackageExcludeList4 = () => {
|
|
1995
2093
|
const possibleDeployablePackages = yarnWorkspaces().map((workspace) => [
|
|
1996
2094
|
workspace,
|
|
1997
|
-
JSON.parse(
|
|
2095
|
+
JSON.parse(readFileSync12(`${workspace.location}/package.json`, { encoding: "utf8" }))
|
|
1998
2096
|
]);
|
|
1999
2097
|
const privatePackages = possibleDeployablePackages.filter(([_, pkg]) => pkg.private).map(([workspace]) => workspace);
|
|
2000
2098
|
const excludeList = privatePackages.map((workspace) => `--exclude ${workspace.name}`);
|
|
@@ -2014,22 +2112,23 @@ var deployNext = () => {
|
|
|
2014
2112
|
};
|
|
2015
2113
|
|
|
2016
2114
|
// src/actions/dupdeps.ts
|
|
2017
|
-
import
|
|
2115
|
+
import chalk24 from "chalk";
|
|
2018
2116
|
var dupdeps = () => {
|
|
2019
|
-
console.log(
|
|
2020
|
-
const
|
|
2021
|
-
const
|
|
2117
|
+
console.log(chalk24.green("Checking all Dependencies for Duplicates"));
|
|
2118
|
+
const pkg = parsedPackageJSON();
|
|
2119
|
+
const allDependencies = { ...pkg?.dependencies, ...pkg?.devDependencies };
|
|
2120
|
+
const dependencies = Object.keys(allDependencies);
|
|
2022
2121
|
return detectDuplicateDependencies(dependencies);
|
|
2023
2122
|
};
|
|
2024
2123
|
|
|
2025
2124
|
// src/actions/lint.ts
|
|
2026
|
-
import
|
|
2125
|
+
import chalk25 from "chalk";
|
|
2027
2126
|
var lintPackage = ({
|
|
2028
2127
|
pkg,
|
|
2029
2128
|
fix: fix2,
|
|
2030
2129
|
verbose
|
|
2031
2130
|
}) => {
|
|
2032
|
-
console.log(
|
|
2131
|
+
console.log(chalk25.gray(`${fix2 ? "Fix" : "Lint"} [${pkg}]`));
|
|
2033
2132
|
const start = Date.now();
|
|
2034
2133
|
const result = runSteps(`${fix2 ? "Fix" : "Lint"} [${pkg}]`, [
|
|
2035
2134
|
["yarn", [
|
|
@@ -2039,7 +2138,7 @@ var lintPackage = ({
|
|
|
2039
2138
|
fix2 ? "package-fix" : verbose ? "package-lint-verbose" : "package-lint"
|
|
2040
2139
|
]]
|
|
2041
2140
|
]);
|
|
2042
|
-
console.log(
|
|
2141
|
+
console.log(chalk25.gray(`${fix2 ? "Fixed in" : "Linted in"} [${chalk25.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk25.gray("seconds")}`));
|
|
2043
2142
|
return result;
|
|
2044
2143
|
};
|
|
2045
2144
|
var lint = ({
|
|
@@ -2059,13 +2158,13 @@ var lint = ({
|
|
|
2059
2158
|
});
|
|
2060
2159
|
};
|
|
2061
2160
|
var lintAllPackages = ({ fix: fix2 = false } = {}) => {
|
|
2062
|
-
console.log(
|
|
2161
|
+
console.log(chalk25.gray(`${fix2 ? "Fix" : "Lint"} [All-Packages]`));
|
|
2063
2162
|
const start = Date.now();
|
|
2064
2163
|
const fixOptions = fix2 ? ["--fix"] : [];
|
|
2065
2164
|
const result = runSteps(`${fix2 ? "Fix" : "Lint"} [All-Packages]`, [
|
|
2066
2165
|
["yarn", ["eslint", "--cache", "--cache-location", ".eslintcache", "--cache-strategy", "content", ...fixOptions]]
|
|
2067
2166
|
]);
|
|
2068
|
-
console.log(
|
|
2167
|
+
console.log(chalk25.gray(`${fix2 ? "Fixed in" : "Linted in"} [${chalk25.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk25.gray("seconds")}`));
|
|
2069
2168
|
return result;
|
|
2070
2169
|
};
|
|
2071
2170
|
|
|
@@ -2088,12 +2187,96 @@ var genDocsAll = ({ incremental }) => {
|
|
|
2088
2187
|
return runSteps(`GenDocs [All${incremental ? "-Incremental" : ""}]`, [...steps]);
|
|
2089
2188
|
};
|
|
2090
2189
|
|
|
2091
|
-
// src/actions/gitignore
|
|
2092
|
-
|
|
2093
|
-
|
|
2190
|
+
// src/actions/gitignore.ts
|
|
2191
|
+
import { unlinkSync as unlinkSync4 } from "fs";
|
|
2192
|
+
import chalk26 from "chalk";
|
|
2193
|
+
var COMMENT_PREFIX = "#";
|
|
2194
|
+
var isComment = (line) => line.startsWith(COMMENT_PREFIX);
|
|
2195
|
+
var isNegation = (line) => line.startsWith("!");
|
|
2196
|
+
function parseTemplateSections(lines) {
|
|
2197
|
+
const sections = [];
|
|
2198
|
+
let current = [];
|
|
2199
|
+
for (const line of lines) {
|
|
2200
|
+
if (isComment(line)) {
|
|
2201
|
+
if (current.length > 0) {
|
|
2202
|
+
sections.push(current);
|
|
2203
|
+
}
|
|
2204
|
+
current = [line];
|
|
2205
|
+
} else {
|
|
2206
|
+
current.push(line);
|
|
2207
|
+
}
|
|
2208
|
+
}
|
|
2209
|
+
if (current.length > 0) {
|
|
2210
|
+
sections.push(current);
|
|
2211
|
+
}
|
|
2212
|
+
return sections;
|
|
2213
|
+
}
|
|
2214
|
+
function mergeWithTemplate(existing, templateContent) {
|
|
2215
|
+
const templateLines = templateContent.split("\n").filter((line) => line.trim().length > 0);
|
|
2216
|
+
const sections = parseTemplateSections(templateLines);
|
|
2217
|
+
const existingEntries = new Set(existing.filter((line) => !isComment(line)));
|
|
2218
|
+
const templateEntries = new Set(templateLines.filter((line) => !isComment(line)));
|
|
2219
|
+
const customEntries = [...existingEntries].filter((entry) => !templateEntries.has(entry));
|
|
2220
|
+
const result = [];
|
|
2221
|
+
for (const section of sections) {
|
|
2222
|
+
for (const line of section) {
|
|
2223
|
+
result.push(line);
|
|
2224
|
+
}
|
|
2225
|
+
result.push("");
|
|
2226
|
+
}
|
|
2227
|
+
if (customEntries.length > 0) {
|
|
2228
|
+
result.push("# Custom");
|
|
2229
|
+
const sorted = [...union(customEntries, [])].toSorted((a, b) => {
|
|
2230
|
+
if (isNegation(a) && !isNegation(b)) return 1;
|
|
2231
|
+
if (!isNegation(a) && isNegation(b)) return -1;
|
|
2232
|
+
return a.localeCompare(b);
|
|
2233
|
+
});
|
|
2234
|
+
for (const entry of sorted) {
|
|
2235
|
+
result.push(entry);
|
|
2236
|
+
}
|
|
2237
|
+
result.push("");
|
|
2238
|
+
}
|
|
2239
|
+
return result;
|
|
2240
|
+
}
|
|
2241
|
+
function removePackageGitignores(cwd) {
|
|
2242
|
+
let removed = 0;
|
|
2243
|
+
const workspaces = yarnWorkspaces();
|
|
2244
|
+
for (const { location } of workspaces) {
|
|
2245
|
+
if (location === ".") continue;
|
|
2246
|
+
const filePath = `${cwd}/${location}/.gitignore`;
|
|
2247
|
+
try {
|
|
2248
|
+
unlinkSync4(filePath);
|
|
2249
|
+
console.log(chalk26.yellow(` Removed ${location}/.gitignore`));
|
|
2250
|
+
removed++;
|
|
2251
|
+
} catch {
|
|
2252
|
+
}
|
|
2253
|
+
}
|
|
2254
|
+
return removed;
|
|
2255
|
+
}
|
|
2256
|
+
function gitignore() {
|
|
2257
|
+
console.log(chalk26.green("Generate .gitignore"));
|
|
2258
|
+
const cwd = INIT_CWD() ?? ".";
|
|
2259
|
+
const gitignorePath = `${cwd}/.gitignore`;
|
|
2260
|
+
try {
|
|
2261
|
+
const templateContent = gitignoreTemplate();
|
|
2262
|
+
const existing = readNonEmptyLines(gitignorePath);
|
|
2263
|
+
const merged = mergeWithTemplate(existing, templateContent);
|
|
2264
|
+
writeLines(gitignorePath, merged);
|
|
2265
|
+
console.log(chalk26.green(" Root .gitignore updated"));
|
|
2266
|
+
const removed = removePackageGitignores(cwd);
|
|
2267
|
+
if (removed > 0) {
|
|
2268
|
+
console.log(chalk26.green(` Removed ${removed} package .gitignore file(s)`));
|
|
2269
|
+
}
|
|
2270
|
+
return 0;
|
|
2271
|
+
} catch (ex) {
|
|
2272
|
+
const error = ex;
|
|
2273
|
+
console.error(chalk26.red(`Generate .gitignore failed: ${error.message}`));
|
|
2274
|
+
return 1;
|
|
2275
|
+
}
|
|
2276
|
+
}
|
|
2094
2277
|
|
|
2095
2278
|
// src/actions/gitlint.ts
|
|
2096
|
-
import
|
|
2279
|
+
import chalk27 from "chalk";
|
|
2097
2280
|
import ParseGitConfig from "parse-git-config";
|
|
2098
2281
|
var gitlint = () => {
|
|
2099
2282
|
console.log(`
|
|
@@ -2104,7 +2287,7 @@ Gitlint Start [${process.cwd()}]
|
|
|
2104
2287
|
const errors = 0;
|
|
2105
2288
|
const gitConfig = ParseGitConfig.sync();
|
|
2106
2289
|
const warn = (message) => {
|
|
2107
|
-
console.warn(
|
|
2290
|
+
console.warn(chalk27.yellow(`Warning: ${message}`));
|
|
2108
2291
|
warnings++;
|
|
2109
2292
|
};
|
|
2110
2293
|
if (gitConfig.core.ignorecase) {
|
|
@@ -2124,13 +2307,13 @@ Gitlint Start [${process.cwd()}]
|
|
|
2124
2307
|
}
|
|
2125
2308
|
const resultMessages = [];
|
|
2126
2309
|
if (valid > 0) {
|
|
2127
|
-
resultMessages.push(
|
|
2310
|
+
resultMessages.push(chalk27.green(`Passed: ${valid}`));
|
|
2128
2311
|
}
|
|
2129
2312
|
if (warnings > 0) {
|
|
2130
|
-
resultMessages.push(
|
|
2313
|
+
resultMessages.push(chalk27.yellow(`Warnings: ${warnings}`));
|
|
2131
2314
|
}
|
|
2132
2315
|
if (errors > 0) {
|
|
2133
|
-
resultMessages.push(
|
|
2316
|
+
resultMessages.push(chalk27.red(` Errors: ${errors}`));
|
|
2134
2317
|
}
|
|
2135
2318
|
console.warn(`Gitlint Finish [ ${resultMessages.join(" | ")} ]
|
|
2136
2319
|
`);
|
|
@@ -2139,7 +2322,7 @@ Gitlint Start [${process.cwd()}]
|
|
|
2139
2322
|
|
|
2140
2323
|
// src/actions/gitlint-fix.ts
|
|
2141
2324
|
import { execSync as execSync3 } from "child_process";
|
|
2142
|
-
import
|
|
2325
|
+
import chalk28 from "chalk";
|
|
2143
2326
|
import ParseGitConfig2 from "parse-git-config";
|
|
2144
2327
|
var gitlintFix = () => {
|
|
2145
2328
|
console.log(`
|
|
@@ -2148,15 +2331,15 @@ Gitlint Fix Start [${process.cwd()}]
|
|
|
2148
2331
|
const gitConfig = ParseGitConfig2.sync();
|
|
2149
2332
|
if (gitConfig.core.ignorecase) {
|
|
2150
2333
|
execSync3("git config core.ignorecase false", { stdio: "inherit" });
|
|
2151
|
-
console.warn(
|
|
2334
|
+
console.warn(chalk28.yellow("\nGitlint Fix: Updated core.ignorecase to be false\n"));
|
|
2152
2335
|
}
|
|
2153
2336
|
if (gitConfig.core.autocrlf !== false) {
|
|
2154
2337
|
execSync3("git config core.autocrlf false", { stdio: "inherit" });
|
|
2155
|
-
console.warn(
|
|
2338
|
+
console.warn(chalk28.yellow("\nGitlint Fix: Updated core.autocrlf to be false\n"));
|
|
2156
2339
|
}
|
|
2157
2340
|
if (gitConfig.core.eol !== "lf") {
|
|
2158
2341
|
execSync3("git config core.eol lf", { stdio: "inherit" });
|
|
2159
|
-
console.warn(
|
|
2342
|
+
console.warn(chalk28.yellow('\nGitlint Fix: Updated core.eol to be "lf"\n'));
|
|
2160
2343
|
}
|
|
2161
2344
|
return 1;
|
|
2162
2345
|
};
|
|
@@ -2167,7 +2350,7 @@ var knip = () => {
|
|
|
2167
2350
|
};
|
|
2168
2351
|
|
|
2169
2352
|
// src/actions/license.ts
|
|
2170
|
-
import
|
|
2353
|
+
import chalk29 from "chalk";
|
|
2171
2354
|
import { init } from "license-checker";
|
|
2172
2355
|
var license = async (pkg) => {
|
|
2173
2356
|
const workspaces = yarnWorkspaces();
|
|
@@ -2192,18 +2375,18 @@ var license = async (pkg) => {
|
|
|
2192
2375
|
"LGPL-3.0-or-later",
|
|
2193
2376
|
"Python-2.0"
|
|
2194
2377
|
]);
|
|
2195
|
-
console.log(
|
|
2378
|
+
console.log(chalk29.green("License Checker"));
|
|
2196
2379
|
return (await Promise.all(
|
|
2197
2380
|
workspaceList.map(({ location, name }) => {
|
|
2198
2381
|
return new Promise((resolve) => {
|
|
2199
2382
|
init({ production: true, start: location }, (error, packages) => {
|
|
2200
2383
|
if (error) {
|
|
2201
|
-
console.error(
|
|
2202
|
-
console.error(
|
|
2384
|
+
console.error(chalk29.red(`License Checker [${name}] Error`));
|
|
2385
|
+
console.error(chalk29.gray(error));
|
|
2203
2386
|
console.log("\n");
|
|
2204
2387
|
resolve(1);
|
|
2205
2388
|
} else {
|
|
2206
|
-
console.log(
|
|
2389
|
+
console.log(chalk29.green(`License Checker [${name}]`));
|
|
2207
2390
|
let count = 0;
|
|
2208
2391
|
for (const [name2, info] of Object.entries(packages)) {
|
|
2209
2392
|
const licenses = Array.isArray(info.licenses) ? info.licenses : [info.licenses];
|
|
@@ -2219,7 +2402,7 @@ var license = async (pkg) => {
|
|
|
2219
2402
|
}
|
|
2220
2403
|
if (!orLicenseFound) {
|
|
2221
2404
|
count++;
|
|
2222
|
-
console.warn(
|
|
2405
|
+
console.warn(chalk29.yellow(`${name2}: Package License not allowed [${license2}]`));
|
|
2223
2406
|
}
|
|
2224
2407
|
}
|
|
2225
2408
|
}
|
|
@@ -2234,8 +2417,163 @@ var license = async (pkg) => {
|
|
|
2234
2417
|
};
|
|
2235
2418
|
|
|
2236
2419
|
// src/actions/npmignore-gen.ts
|
|
2237
|
-
var
|
|
2238
|
-
var npmignoreGen = (pkg) => generateIgnoreFiles(
|
|
2420
|
+
var filename = ".npmignore";
|
|
2421
|
+
var npmignoreGen = (pkg) => generateIgnoreFiles(filename, pkg);
|
|
2422
|
+
|
|
2423
|
+
// src/actions/package-lint.ts
|
|
2424
|
+
import { readFileSync as readFileSync13, writeFileSync as writeFileSync6 } from "fs";
|
|
2425
|
+
import PATH9 from "path";
|
|
2426
|
+
import chalk30 from "chalk";
|
|
2427
|
+
import picomatch from "picomatch";
|
|
2428
|
+
function emptyResult() {
|
|
2429
|
+
return {
|
|
2430
|
+
errors: [],
|
|
2431
|
+
fixable: [],
|
|
2432
|
+
warnings: []
|
|
2433
|
+
};
|
|
2434
|
+
}
|
|
2435
|
+
function readRootPackageJson(cwd) {
|
|
2436
|
+
const raw = readFileSync13(PATH9.resolve(cwd, "package.json"), "utf8");
|
|
2437
|
+
return JSON.parse(raw);
|
|
2438
|
+
}
|
|
2439
|
+
function writeRootPackageJson(cwd, pkg) {
|
|
2440
|
+
const path8 = PATH9.resolve(cwd, "package.json");
|
|
2441
|
+
writeFileSync6(path8, `${JSON.stringify(pkg, null, 2)}
|
|
2442
|
+
`, "utf8");
|
|
2443
|
+
}
|
|
2444
|
+
function isMonorepo(pkg) {
|
|
2445
|
+
const workspaces = pkg.workspaces;
|
|
2446
|
+
return Array.isArray(workspaces) && workspaces.length > 0;
|
|
2447
|
+
}
|
|
2448
|
+
function checkPackagesFolder(workspaces) {
|
|
2449
|
+
const result = emptyResult();
|
|
2450
|
+
for (const { location, name } of workspaces) {
|
|
2451
|
+
if (location === ".") continue;
|
|
2452
|
+
if (!location.startsWith("packages/") && !location.startsWith("packages\\")) {
|
|
2453
|
+
result.errors.push(`${name} (${location}) is not inside a packages/ folder`);
|
|
2454
|
+
}
|
|
2455
|
+
}
|
|
2456
|
+
return result;
|
|
2457
|
+
}
|
|
2458
|
+
function checkRootPrivate(pkg) {
|
|
2459
|
+
const result = emptyResult();
|
|
2460
|
+
if (!pkg.private) {
|
|
2461
|
+
result.fixable.push("Root package.json must be private to prevent accidental publishing");
|
|
2462
|
+
}
|
|
2463
|
+
return result;
|
|
2464
|
+
}
|
|
2465
|
+
function fixRootPrivate(cwd, pkg) {
|
|
2466
|
+
pkg.private = true;
|
|
2467
|
+
writeRootPackageJson(cwd, pkg);
|
|
2468
|
+
console.log(chalk30.green(' \u2714 Fixed: set "private": true in root package.json'));
|
|
2469
|
+
}
|
|
2470
|
+
function checkNoPublishConfigOnPrivate(pkg) {
|
|
2471
|
+
const result = emptyResult();
|
|
2472
|
+
if (pkg.private && pkg.publishConfig) {
|
|
2473
|
+
result.fixable.push("Root package.json has publishConfig but is private \u2014 publishConfig is unnecessary");
|
|
2474
|
+
}
|
|
2475
|
+
return result;
|
|
2476
|
+
}
|
|
2477
|
+
function fixNoPublishConfigOnPrivate(cwd, pkg) {
|
|
2478
|
+
delete pkg.publishConfig;
|
|
2479
|
+
writeRootPackageJson(cwd, pkg);
|
|
2480
|
+
console.log(chalk30.green(" \u2714 Fixed: removed publishConfig from private root package.json"));
|
|
2481
|
+
}
|
|
2482
|
+
function checkDiscoverable(pkg, workspaces) {
|
|
2483
|
+
const result = emptyResult();
|
|
2484
|
+
const globs = pkg.workspaces;
|
|
2485
|
+
const matchers = globs.map((glob2) => picomatch(glob2));
|
|
2486
|
+
const isMatch = (location) => matchers.some((m) => m(location));
|
|
2487
|
+
for (const { location, name } of workspaces) {
|
|
2488
|
+
if (location === ".") continue;
|
|
2489
|
+
if (!isMatch(location)) {
|
|
2490
|
+
result.errors.push(`${name} (${location}) is not matched by any workspace glob in package.json`);
|
|
2491
|
+
}
|
|
2492
|
+
}
|
|
2493
|
+
return result;
|
|
2494
|
+
}
|
|
2495
|
+
function logResults(label, result, fix2) {
|
|
2496
|
+
let errors = 0;
|
|
2497
|
+
let fixed = 0;
|
|
2498
|
+
for (const error of result.errors) {
|
|
2499
|
+
console.log(chalk30.red(` \u2717 ${error}`));
|
|
2500
|
+
errors++;
|
|
2501
|
+
}
|
|
2502
|
+
for (const fixable of result.fixable) {
|
|
2503
|
+
if (fix2) {
|
|
2504
|
+
fixed++;
|
|
2505
|
+
} else {
|
|
2506
|
+
console.log(chalk30.red(` \u2717 ${fixable} (fixable)`));
|
|
2507
|
+
errors++;
|
|
2508
|
+
}
|
|
2509
|
+
}
|
|
2510
|
+
for (const warning of result.warnings) {
|
|
2511
|
+
console.log(chalk30.yellow(` \u26A0 ${warning}`));
|
|
2512
|
+
}
|
|
2513
|
+
if (errors === 0 && fixed === 0 && result.warnings.length === 0) {
|
|
2514
|
+
console.log(chalk30.green(` \u2713 ${label}`));
|
|
2515
|
+
}
|
|
2516
|
+
return { errors, fixed };
|
|
2517
|
+
}
|
|
2518
|
+
function runChecks(entries, cwd, pkg, fix2) {
|
|
2519
|
+
let totalErrors = 0;
|
|
2520
|
+
let totalFixed = 0;
|
|
2521
|
+
for (const entry of entries) {
|
|
2522
|
+
const result = entry.check();
|
|
2523
|
+
const log = logResults(entry.label, result, fix2);
|
|
2524
|
+
if (fix2 && entry.fix && result.fixable.length > 0) {
|
|
2525
|
+
entry.fix(cwd, pkg);
|
|
2526
|
+
}
|
|
2527
|
+
totalErrors += log.errors;
|
|
2528
|
+
totalFixed += log.fixed;
|
|
2529
|
+
}
|
|
2530
|
+
return { errors: totalErrors, fixed: totalFixed };
|
|
2531
|
+
}
|
|
2532
|
+
function logSummary(errors, fixed) {
|
|
2533
|
+
if (fixed > 0) {
|
|
2534
|
+
console.log(chalk30.green(`
|
|
2535
|
+
Fixed ${fixed} issue(s)`));
|
|
2536
|
+
}
|
|
2537
|
+
if (errors > 0) {
|
|
2538
|
+
console.log(chalk30.red(`
|
|
2539
|
+
${errors} error(s) found`));
|
|
2540
|
+
} else if (fixed === 0) {
|
|
2541
|
+
console.log(chalk30.green("\n All checks passed"));
|
|
2542
|
+
}
|
|
2543
|
+
}
|
|
2544
|
+
function packageLintMonorepo(fix2 = false) {
|
|
2545
|
+
const cwd = INIT_CWD() ?? process.cwd();
|
|
2546
|
+
let pkg;
|
|
2547
|
+
try {
|
|
2548
|
+
pkg = readRootPackageJson(cwd);
|
|
2549
|
+
} catch {
|
|
2550
|
+
console.error(chalk30.red("Could not read package.json"));
|
|
2551
|
+
return 1;
|
|
2552
|
+
}
|
|
2553
|
+
if (!isMonorepo(pkg)) {
|
|
2554
|
+
console.log(chalk30.gray("Not a monorepo \u2014 skipping package-lint checks"));
|
|
2555
|
+
return 0;
|
|
2556
|
+
}
|
|
2557
|
+
console.log(chalk30.green("Package Lint"));
|
|
2558
|
+
const workspaces = yarnWorkspaces();
|
|
2559
|
+
const checks = [
|
|
2560
|
+
{
|
|
2561
|
+
check: () => checkRootPrivate(pkg),
|
|
2562
|
+
fix: fixRootPrivate,
|
|
2563
|
+
label: "Root package is private"
|
|
2564
|
+
},
|
|
2565
|
+
{
|
|
2566
|
+
check: () => checkNoPublishConfigOnPrivate(pkg),
|
|
2567
|
+
fix: fixNoPublishConfigOnPrivate,
|
|
2568
|
+
label: "No publishConfig on private root"
|
|
2569
|
+
},
|
|
2570
|
+
{ check: () => checkPackagesFolder(workspaces), label: "All packages are in packages/ folder" },
|
|
2571
|
+
{ check: () => checkDiscoverable(pkg, workspaces), label: "All packages are discoverable from workspace globs" }
|
|
2572
|
+
];
|
|
2573
|
+
const { errors, fixed } = runChecks(checks, cwd, pkg, fix2);
|
|
2574
|
+
logSummary(errors, fixed);
|
|
2575
|
+
return errors > 0 ? 1 : 0;
|
|
2576
|
+
}
|
|
2239
2577
|
|
|
2240
2578
|
// src/actions/publint.ts
|
|
2241
2579
|
var publint = async ({ verbose, pkg }) => {
|
|
@@ -2290,7 +2628,7 @@ var rebuild = ({ target }) => {
|
|
|
2290
2628
|
};
|
|
2291
2629
|
|
|
2292
2630
|
// src/actions/recompile.ts
|
|
2293
|
-
import
|
|
2631
|
+
import chalk31 from "chalk";
|
|
2294
2632
|
var recompile = async ({
|
|
2295
2633
|
verbose,
|
|
2296
2634
|
target,
|
|
@@ -2326,7 +2664,7 @@ var recompileAll = async ({
|
|
|
2326
2664
|
const incrementalOptions = incremental ? ["--since", "-Apt", "--topological-dev"] : ["--parallel", "-Apt", "--topological-dev"];
|
|
2327
2665
|
const jobsOptions = jobs ? ["-j", `${jobs}`] : [];
|
|
2328
2666
|
if (jobs) {
|
|
2329
|
-
console.log(
|
|
2667
|
+
console.log(chalk31.blue(`Jobs set to [${jobs}]`));
|
|
2330
2668
|
}
|
|
2331
2669
|
const result = await runStepsAsync(`Recompile${incremental ? "-Incremental" : ""} [All]`, [
|
|
2332
2670
|
[
|
|
@@ -2357,7 +2695,7 @@ var recompileAll = async ({
|
|
|
2357
2695
|
]
|
|
2358
2696
|
]);
|
|
2359
2697
|
console.log(
|
|
2360
|
-
`${
|
|
2698
|
+
`${chalk31.gray("Recompiled in")} [${chalk31.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk31.gray("seconds")}`
|
|
2361
2699
|
);
|
|
2362
2700
|
return result;
|
|
2363
2701
|
};
|
|
@@ -2366,7 +2704,7 @@ var recompileAll = async ({
|
|
|
2366
2704
|
import {
|
|
2367
2705
|
closeSync,
|
|
2368
2706
|
openSync,
|
|
2369
|
-
rmSync as
|
|
2707
|
+
rmSync as rmSync3
|
|
2370
2708
|
} from "fs";
|
|
2371
2709
|
var reinstall = () => {
|
|
2372
2710
|
console.log("Reinstall [Clear Lock File]");
|
|
@@ -2376,7 +2714,7 @@ var reinstall = () => {
|
|
|
2376
2714
|
const result = workspaces.map(({ location, name }) => {
|
|
2377
2715
|
const dist = `${location}/node_modules`;
|
|
2378
2716
|
try {
|
|
2379
|
-
|
|
2717
|
+
rmSync3(dist, { force: true, recursive: true });
|
|
2380
2718
|
return 0;
|
|
2381
2719
|
} catch (ex) {
|
|
2382
2720
|
const error = ex;
|
|
@@ -2388,13 +2726,13 @@ var reinstall = () => {
|
|
|
2388
2726
|
};
|
|
2389
2727
|
|
|
2390
2728
|
// src/actions/relint.ts
|
|
2391
|
-
import
|
|
2729
|
+
import chalk32 from "chalk";
|
|
2392
2730
|
var relintPackage = ({
|
|
2393
2731
|
pkg,
|
|
2394
2732
|
fix: fix2,
|
|
2395
2733
|
verbose
|
|
2396
2734
|
}) => {
|
|
2397
|
-
console.log(
|
|
2735
|
+
console.log(chalk32.gray(`${fix2 ? "Fix" : "Lint"} [${pkg}]`));
|
|
2398
2736
|
const start = Date.now();
|
|
2399
2737
|
const result = runSteps(`${fix2 ? "Fix" : "Lint"} [${pkg}]`, [
|
|
2400
2738
|
["yarn", [
|
|
@@ -2404,7 +2742,7 @@ var relintPackage = ({
|
|
|
2404
2742
|
fix2 ? "package-fix" : verbose ? "package-lint-verbose" : "package-lint"
|
|
2405
2743
|
]]
|
|
2406
2744
|
]);
|
|
2407
|
-
console.log(
|
|
2745
|
+
console.log(chalk32.gray(`${fix2 ? "Fixed in" : "Linted in"} [${chalk32.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk32.gray("seconds")}`));
|
|
2408
2746
|
return result;
|
|
2409
2747
|
};
|
|
2410
2748
|
var relint = ({
|
|
@@ -2424,13 +2762,13 @@ var relint = ({
|
|
|
2424
2762
|
});
|
|
2425
2763
|
};
|
|
2426
2764
|
var relintAllPackages = ({ fix: fix2 = false } = {}) => {
|
|
2427
|
-
console.log(
|
|
2765
|
+
console.log(chalk32.gray(`${fix2 ? "Fix" : "Lint"} [All-Packages]`));
|
|
2428
2766
|
const start = Date.now();
|
|
2429
2767
|
const fixOptions = fix2 ? ["--fix"] : [];
|
|
2430
2768
|
const result = runSteps(`${fix2 ? "Fix" : "Lint"} [All-Packages]`, [
|
|
2431
2769
|
["yarn", ["eslint", ...fixOptions]]
|
|
2432
2770
|
]);
|
|
2433
|
-
console.log(
|
|
2771
|
+
console.log(chalk32.gray(`${fix2 ? "Fixed in" : "Linted in"} [${chalk32.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk32.gray("seconds")}`));
|
|
2434
2772
|
return result;
|
|
2435
2773
|
};
|
|
2436
2774
|
|
|
@@ -2448,10 +2786,10 @@ var sonar = () => {
|
|
|
2448
2786
|
};
|
|
2449
2787
|
|
|
2450
2788
|
// src/actions/statics.ts
|
|
2451
|
-
import
|
|
2789
|
+
import chalk33 from "chalk";
|
|
2452
2790
|
var DefaultDependencies = ["axios", "@xylabs/pixel", "react", "graphql", "react-router", "@mui/material", "@mui/system"];
|
|
2453
2791
|
var statics = () => {
|
|
2454
|
-
console.log(
|
|
2792
|
+
console.log(chalk33.green("Check Required Static Dependencies"));
|
|
2455
2793
|
const statics2 = parsedPackageJSON()?.xy?.deps?.statics;
|
|
2456
2794
|
return detectDuplicateDependencies(statics2, DefaultDependencies);
|
|
2457
2795
|
};
|
|
@@ -2499,18 +2837,13 @@ var yarn3Only = () => {
|
|
|
2499
2837
|
return 0;
|
|
2500
2838
|
};
|
|
2501
2839
|
|
|
2502
|
-
// src/xy/
|
|
2503
|
-
var packagePositionalParam = (yargs2) => {
|
|
2504
|
-
return yargs2.positional("package", { describe: "Specific package to target", type: "string" });
|
|
2505
|
-
};
|
|
2506
|
-
|
|
2507
|
-
// src/xy/build-commands/build.ts
|
|
2840
|
+
// src/xy/build/buildCommand.ts
|
|
2508
2841
|
var buildCommand = {
|
|
2509
|
-
builder: (yargs2) => {
|
|
2510
|
-
return packagePositionalParam(yargs2);
|
|
2511
|
-
},
|
|
2512
2842
|
command: "build [package]",
|
|
2513
2843
|
describe: "Build - Compile & Lint",
|
|
2844
|
+
builder: (yargs2) => {
|
|
2845
|
+
return yargs2.positional("package", { describe: "Specific package to build" });
|
|
2846
|
+
},
|
|
2514
2847
|
handler: async (argv) => {
|
|
2515
2848
|
if (argv.verbose) {
|
|
2516
2849
|
console.log(`Building: ${argv.package ?? "all"}`);
|
|
@@ -2524,12 +2857,14 @@ var buildCommand = {
|
|
|
2524
2857
|
});
|
|
2525
2858
|
}
|
|
2526
2859
|
};
|
|
2860
|
+
|
|
2861
|
+
// src/xy/build/compileCommand.ts
|
|
2527
2862
|
var compileCommand = {
|
|
2528
|
-
builder: (yargs2) => {
|
|
2529
|
-
return packagePositionalParam(yargs2);
|
|
2530
|
-
},
|
|
2531
2863
|
command: "compile [package]",
|
|
2532
2864
|
describe: "Compile with Typescript & Copy Images",
|
|
2865
|
+
builder: (yargs2) => {
|
|
2866
|
+
return yargs2.positional("package", { describe: "Specific package to compile" });
|
|
2867
|
+
},
|
|
2533
2868
|
handler: (argv) => {
|
|
2534
2869
|
if (argv.verbose) {
|
|
2535
2870
|
console.log(`Compiling: ${argv.package ?? "all"}`);
|
|
@@ -2543,12 +2878,14 @@ var compileCommand = {
|
|
|
2543
2878
|
});
|
|
2544
2879
|
}
|
|
2545
2880
|
};
|
|
2881
|
+
|
|
2882
|
+
// src/xy/build/compileOnlyCommand.ts
|
|
2546
2883
|
var compileOnlyCommand = {
|
|
2547
|
-
builder: (yargs2) => {
|
|
2548
|
-
return packagePositionalParam(yargs2);
|
|
2549
|
-
},
|
|
2550
2884
|
command: "compile-only [package]",
|
|
2551
2885
|
describe: "Compile with Typescript & Copy Images (No Publint)",
|
|
2886
|
+
builder: (yargs2) => {
|
|
2887
|
+
return yargs2.positional("package", { describe: "Specific package to compile" });
|
|
2888
|
+
},
|
|
2552
2889
|
handler: (argv) => {
|
|
2553
2890
|
if (argv.verbose) {
|
|
2554
2891
|
console.log(`Compiling: ${argv.package ?? "all"}`);
|
|
@@ -2563,51 +2900,67 @@ var compileOnlyCommand = {
|
|
|
2563
2900
|
});
|
|
2564
2901
|
}
|
|
2565
2902
|
};
|
|
2566
|
-
|
|
2903
|
+
|
|
2904
|
+
// src/xy/build/copyAssetsCommand.ts
|
|
2905
|
+
var copyAssetsCommand = {
|
|
2906
|
+
command: "copy-assets [package]",
|
|
2907
|
+
describe: "Copy Assets - Copy the assets from src to dist",
|
|
2567
2908
|
builder: (yargs2) => {
|
|
2568
|
-
return
|
|
2909
|
+
return yargs2.positional("package", { describe: "Specific package to copy assets" });
|
|
2569
2910
|
},
|
|
2570
|
-
command: "recompile [package]",
|
|
2571
|
-
describe: "Re-compile with Typescript & Copy Images",
|
|
2572
2911
|
handler: async (argv) => {
|
|
2573
|
-
if (argv.verbose) {
|
|
2574
|
-
|
|
2575
|
-
}
|
|
2576
|
-
process.exitCode = await recompile({
|
|
2577
|
-
incremental: !!argv.incremental,
|
|
2578
|
-
jobs: argv.jobs,
|
|
2579
|
-
pkg: argv.package,
|
|
2580
|
-
target: argv.target,
|
|
2581
|
-
verbose: !!argv.verbose
|
|
2582
|
-
});
|
|
2912
|
+
if (argv.verbose) console.log(`Copying Assets: ${argv.package ?? "all"}`);
|
|
2913
|
+
process.exitCode = await copyAssets({ target: argv.target });
|
|
2583
2914
|
}
|
|
2584
2915
|
};
|
|
2916
|
+
|
|
2917
|
+
// src/xy/build/rebuildCommand.ts
|
|
2585
2918
|
var rebuildCommand = {
|
|
2586
|
-
builder: (yargs2) => {
|
|
2587
|
-
return packagePositionalParam(yargs2);
|
|
2588
|
-
},
|
|
2589
2919
|
command: "rebuild [package]",
|
|
2590
2920
|
describe: "Rebuild - Clean, Compile & Lint",
|
|
2921
|
+
builder: (yargs2) => {
|
|
2922
|
+
return yargs2.positional("package", { describe: "Specific package to rebuild" });
|
|
2923
|
+
},
|
|
2591
2924
|
handler: (argv) => {
|
|
2592
2925
|
if (argv.verbose) console.log(`Rebuilding: ${argv.package ?? "all"}`);
|
|
2593
2926
|
process.exitCode = rebuild({ target: argv.target });
|
|
2594
2927
|
}
|
|
2595
2928
|
};
|
|
2596
|
-
|
|
2929
|
+
|
|
2930
|
+
// src/xy/build/recompileCommand.ts
|
|
2931
|
+
var recompileCommand = {
|
|
2932
|
+
command: "recompile [package]",
|
|
2933
|
+
describe: "Re-compile with Typescript & Copy Images",
|
|
2597
2934
|
builder: (yargs2) => {
|
|
2598
|
-
return
|
|
2935
|
+
return yargs2.positional("package", { describe: "Specific package to re-compile" });
|
|
2599
2936
|
},
|
|
2600
|
-
command: "copy-assets [package]",
|
|
2601
|
-
describe: "Copy Assets - Copy the assets from src to dist",
|
|
2602
2937
|
handler: async (argv) => {
|
|
2603
|
-
if (argv.verbose)
|
|
2604
|
-
|
|
2938
|
+
if (argv.verbose) {
|
|
2939
|
+
console.log(`Re-compiling: ${argv.package ?? "all"}`);
|
|
2940
|
+
}
|
|
2941
|
+
process.exitCode = await recompile({
|
|
2942
|
+
incremental: !!argv.incremental,
|
|
2943
|
+
jobs: argv.jobs,
|
|
2944
|
+
pkg: argv.package,
|
|
2945
|
+
target: argv.target,
|
|
2946
|
+
verbose: !!argv.verbose
|
|
2947
|
+
});
|
|
2605
2948
|
}
|
|
2606
2949
|
};
|
|
2607
2950
|
|
|
2608
|
-
// src/xy/build
|
|
2951
|
+
// src/xy/build/index.ts
|
|
2609
2952
|
var xyBuildCommands = (args) => {
|
|
2610
|
-
return args.command(buildCommand).command(compileCommand).command(compileOnlyCommand).command(
|
|
2953
|
+
return args.command(buildCommand).command(compileCommand).command(compileOnlyCommand).command(recompileCommand).command(rebuildCommand).command(copyAssetsCommand);
|
|
2954
|
+
};
|
|
2955
|
+
|
|
2956
|
+
// src/xy/common/claude/cleanCommand.ts
|
|
2957
|
+
var cleanCommand = {
|
|
2958
|
+
command: "clean",
|
|
2959
|
+
describe: "Remove all Claude configuration files from the repo",
|
|
2960
|
+
handler: (argv) => {
|
|
2961
|
+
if (argv.verbose) console.log("Claude Clean");
|
|
2962
|
+
process.exitCode = claudeClean();
|
|
2963
|
+
}
|
|
2611
2964
|
};
|
|
2612
2965
|
|
|
2613
2966
|
// src/xy/common/claude/commandsCommand.ts
|
|
@@ -2640,14 +2993,6 @@ var initCommand = {
|
|
|
2640
2993
|
process.exitCode = commandsResult || rulesResult || settingsResult;
|
|
2641
2994
|
}
|
|
2642
2995
|
};
|
|
2643
|
-
var initClaudeSkillsCommand = {
|
|
2644
|
-
command: "init:skills",
|
|
2645
|
-
describe: "Initialize Claude skills configuration",
|
|
2646
|
-
handler: () => {
|
|
2647
|
-
const result = claudeSkills();
|
|
2648
|
-
process.exitCode = result;
|
|
2649
|
-
}
|
|
2650
|
-
};
|
|
2651
2996
|
|
|
2652
2997
|
// src/xy/common/claude/rulesCommand.ts
|
|
2653
2998
|
var rulesCommand = {
|
|
@@ -2677,10 +3022,21 @@ var settingsCommand = {
|
|
|
2677
3022
|
}
|
|
2678
3023
|
};
|
|
2679
3024
|
|
|
3025
|
+
// src/xy/common/claude/skillsCommand.ts
|
|
3026
|
+
var skillsCommand = {
|
|
3027
|
+
builder: (yargs2) => yargs2,
|
|
3028
|
+
command: "skills",
|
|
3029
|
+
describe: "Sync XY Labs standard Claude skills to .claude/skills/",
|
|
3030
|
+
handler: (argv) => {
|
|
3031
|
+
if (argv.verbose) console.log("Claude Skills");
|
|
3032
|
+
process.exitCode = claudeSkills();
|
|
3033
|
+
}
|
|
3034
|
+
};
|
|
3035
|
+
|
|
2680
3036
|
// src/xy/common/claude/index.ts
|
|
2681
3037
|
var claudeCommand = {
|
|
2682
3038
|
builder: (yargs2) => {
|
|
2683
|
-
return yargs2.command(commandsCommand).command(initCommand).command(rulesCommand).command(settingsCommand).command(
|
|
3039
|
+
return yargs2.command(cleanCommand).command(commandsCommand).command(initCommand).command(rulesCommand).command(settingsCommand).command(skillsCommand).demandCommand(1, "Please specify a claude subcommand");
|
|
2684
3040
|
},
|
|
2685
3041
|
command: "claude",
|
|
2686
3042
|
describe: "Claude - Claude Code configuration utilities",
|
|
@@ -2698,6 +3054,11 @@ var cleanDocsCommand = {
|
|
|
2698
3054
|
}
|
|
2699
3055
|
};
|
|
2700
3056
|
|
|
3057
|
+
// src/xy/param.ts
|
|
3058
|
+
var packagePositionalParam = (yargs2) => {
|
|
3059
|
+
return yargs2.positional("package", { describe: "Specific package to target", type: "string" });
|
|
3060
|
+
};
|
|
3061
|
+
|
|
2701
3062
|
// src/xy/common/deadCommand.ts
|
|
2702
3063
|
var deadCommand = {
|
|
2703
3064
|
builder: (yargs2) => {
|
|
@@ -2724,13 +3085,13 @@ var genDocsCommand = {
|
|
|
2724
3085
|
}
|
|
2725
3086
|
};
|
|
2726
3087
|
|
|
2727
|
-
// src/xy/common/
|
|
2728
|
-
var
|
|
2729
|
-
command: "gitignore
|
|
2730
|
-
describe: "GitIgnore
|
|
3088
|
+
// src/xy/common/gitignoreCommand.ts
|
|
3089
|
+
var gitignoreCommand = {
|
|
3090
|
+
command: "gitignore",
|
|
3091
|
+
describe: "GitIgnore - Generate root .gitignore and remove package .gitignore files",
|
|
2731
3092
|
handler: (argv) => {
|
|
2732
|
-
if (argv.verbose) console.log("GitIgnore
|
|
2733
|
-
process.exitCode =
|
|
3093
|
+
if (argv.verbose) console.log("GitIgnore");
|
|
3094
|
+
process.exitCode = gitignore();
|
|
2734
3095
|
}
|
|
2735
3096
|
};
|
|
2736
3097
|
|
|
@@ -2877,7 +3238,7 @@ var yarn3OnlyCommand = {
|
|
|
2877
3238
|
|
|
2878
3239
|
// src/xy/common/index.ts
|
|
2879
3240
|
var xyCommonCommands = (args) => {
|
|
2880
|
-
return args.command(claudeCommand).command(licenseCommand).command(deadCommand).command(genDocsCommand).command(cleanDocsCommand).command(gitlintCommand).command(
|
|
3241
|
+
return args.command(claudeCommand).command(licenseCommand).command(deadCommand).command(genDocsCommand).command(cleanDocsCommand).command(gitlintCommand).command(gitignoreCommand).command(npmignoreGenCommand).command(readmeCommand).command(retestCommand).command(testCommand).command(upplugCommand).command(upyarnCommand).command(yarn3OnlyCommand);
|
|
2881
3242
|
};
|
|
2882
3243
|
|
|
2883
3244
|
// src/xy/deploy/deployCommand.ts
|
|
@@ -2936,7 +3297,7 @@ var xyDeployCommands = (args) => {
|
|
|
2936
3297
|
};
|
|
2937
3298
|
|
|
2938
3299
|
// src/xy/install/cleanCommand.ts
|
|
2939
|
-
var
|
|
3300
|
+
var cleanCommand2 = {
|
|
2940
3301
|
command: "clean [package]",
|
|
2941
3302
|
describe: "Clean",
|
|
2942
3303
|
builder: (yargs2) => {
|
|
@@ -3005,11 +3366,11 @@ var updoCommand = {
|
|
|
3005
3366
|
|
|
3006
3367
|
// src/xy/install/index.ts
|
|
3007
3368
|
var xyInstallCommands = (args) => {
|
|
3008
|
-
return args.command(
|
|
3369
|
+
return args.command(cleanCommand2).command(reinstallCommand).command(upCommand).command(updoCommand).command(staticsCommand).command(dupdepsCommand);
|
|
3009
3370
|
};
|
|
3010
3371
|
|
|
3011
3372
|
// src/xy/lint/cycleCommand.ts
|
|
3012
|
-
import
|
|
3373
|
+
import chalk34 from "chalk";
|
|
3013
3374
|
var cycleCommand = {
|
|
3014
3375
|
command: "cycle [package]",
|
|
3015
3376
|
describe: "Cycle - Check for dependency cycles",
|
|
@@ -3020,12 +3381,12 @@ var cycleCommand = {
|
|
|
3020
3381
|
const start = Date.now();
|
|
3021
3382
|
if (argv.verbose) console.log("Cycle");
|
|
3022
3383
|
process.exitCode = await cycle({ pkg: argv.package });
|
|
3023
|
-
console.log(
|
|
3384
|
+
console.log(chalk34.blue(`Finished in ${Date.now() - start}ms`));
|
|
3024
3385
|
}
|
|
3025
3386
|
};
|
|
3026
3387
|
|
|
3027
3388
|
// src/xy/lint/deplintCommand.ts
|
|
3028
|
-
import
|
|
3389
|
+
import chalk35 from "chalk";
|
|
3029
3390
|
var deplintCommand = {
|
|
3030
3391
|
command: "deplint [package]",
|
|
3031
3392
|
describe: "Deplint - Run Deplint",
|
|
@@ -3063,12 +3424,12 @@ var deplintCommand = {
|
|
|
3063
3424
|
peerDeps: !!argv.peerDeps,
|
|
3064
3425
|
verbose: !!argv.verbose
|
|
3065
3426
|
});
|
|
3066
|
-
console.log(
|
|
3427
|
+
console.log(chalk35.blue(`Finished in ${Date.now() - start}ms`));
|
|
3067
3428
|
}
|
|
3068
3429
|
};
|
|
3069
3430
|
|
|
3070
3431
|
// src/xy/lint/fixCommand.ts
|
|
3071
|
-
import
|
|
3432
|
+
import chalk36 from "chalk";
|
|
3072
3433
|
var fixCommand = {
|
|
3073
3434
|
command: "fix [package]",
|
|
3074
3435
|
describe: "Fix - Run Eslint w/fix",
|
|
@@ -3079,12 +3440,12 @@ var fixCommand = {
|
|
|
3079
3440
|
const start = Date.now();
|
|
3080
3441
|
if (argv.verbose) console.log("Fix");
|
|
3081
3442
|
process.exitCode = fix();
|
|
3082
|
-
console.log(
|
|
3443
|
+
console.log(chalk36.blue(`Finished in ${Date.now() - start}ms`));
|
|
3083
3444
|
}
|
|
3084
3445
|
};
|
|
3085
3446
|
|
|
3086
3447
|
// src/xy/lint/knipCommand.ts
|
|
3087
|
-
import
|
|
3448
|
+
import chalk37 from "chalk";
|
|
3088
3449
|
var knipCommand = {
|
|
3089
3450
|
command: "knip",
|
|
3090
3451
|
describe: "Knip - Run Knip",
|
|
@@ -3095,12 +3456,12 @@ var knipCommand = {
|
|
|
3095
3456
|
if (argv.verbose) console.log("Knip");
|
|
3096
3457
|
const start = Date.now();
|
|
3097
3458
|
process.exitCode = knip();
|
|
3098
|
-
console.log(
|
|
3459
|
+
console.log(chalk37.blue(`Knip finished in ${Date.now() - start}ms`));
|
|
3099
3460
|
}
|
|
3100
3461
|
};
|
|
3101
3462
|
|
|
3102
3463
|
// src/xy/lint/lintCommand.ts
|
|
3103
|
-
import
|
|
3464
|
+
import chalk38 from "chalk";
|
|
3104
3465
|
var lintCommand = {
|
|
3105
3466
|
command: "lint [package]",
|
|
3106
3467
|
describe: "Lint - Run Eslint",
|
|
@@ -3129,12 +3490,29 @@ var lintCommand = {
|
|
|
3129
3490
|
cache: argv.cache,
|
|
3130
3491
|
verbose: !!argv.verbose
|
|
3131
3492
|
});
|
|
3132
|
-
console.log(
|
|
3493
|
+
console.log(chalk38.blue(`Finished in ${Date.now() - start}ms`));
|
|
3494
|
+
}
|
|
3495
|
+
};
|
|
3496
|
+
|
|
3497
|
+
// src/xy/lint/packageLintCommand.ts
|
|
3498
|
+
var packageLintCommand = {
|
|
3499
|
+
builder: (yargs2) => {
|
|
3500
|
+
return yargs2.option("fix", {
|
|
3501
|
+
default: false,
|
|
3502
|
+
description: "Auto-fix fixable issues",
|
|
3503
|
+
type: "boolean"
|
|
3504
|
+
});
|
|
3505
|
+
},
|
|
3506
|
+
command: "package-lint",
|
|
3507
|
+
describe: "Package Lint - Check monorepo package structure",
|
|
3508
|
+
handler: (argv) => {
|
|
3509
|
+
if (argv.verbose) console.log("Package Lint");
|
|
3510
|
+
process.exitCode = packageLintMonorepo(!!argv.fix);
|
|
3133
3511
|
}
|
|
3134
3512
|
};
|
|
3135
3513
|
|
|
3136
3514
|
// src/xy/lint/publintCommand.ts
|
|
3137
|
-
import
|
|
3515
|
+
import chalk39 from "chalk";
|
|
3138
3516
|
var publintCommand = {
|
|
3139
3517
|
command: "publint [package]",
|
|
3140
3518
|
describe: "Publint - Run Publint",
|
|
@@ -3145,12 +3523,12 @@ var publintCommand = {
|
|
|
3145
3523
|
if (argv.verbose) console.log("Publint");
|
|
3146
3524
|
const start = Date.now();
|
|
3147
3525
|
process.exitCode = await publint({ pkg: argv.package, verbose: !!argv.verbose });
|
|
3148
|
-
console.log(
|
|
3526
|
+
console.log(chalk39.blue(`Finished in ${Date.now() - start}ms`));
|
|
3149
3527
|
}
|
|
3150
3528
|
};
|
|
3151
3529
|
|
|
3152
3530
|
// src/xy/lint/relintCommand.ts
|
|
3153
|
-
import
|
|
3531
|
+
import chalk40 from "chalk";
|
|
3154
3532
|
var relintCommand = {
|
|
3155
3533
|
command: "relint [package]",
|
|
3156
3534
|
describe: "Relint - Clean & Lint",
|
|
@@ -3161,12 +3539,12 @@ var relintCommand = {
|
|
|
3161
3539
|
if (argv.verbose) console.log("Relinting");
|
|
3162
3540
|
const start = Date.now();
|
|
3163
3541
|
process.exitCode = relint();
|
|
3164
|
-
console.log(
|
|
3542
|
+
console.log(chalk40.blue(`Finished in ${Date.now() - start}ms`));
|
|
3165
3543
|
}
|
|
3166
3544
|
};
|
|
3167
3545
|
|
|
3168
3546
|
// src/xy/lint/sonarCommand.ts
|
|
3169
|
-
import
|
|
3547
|
+
import chalk41 from "chalk";
|
|
3170
3548
|
var sonarCommand = {
|
|
3171
3549
|
command: "sonar",
|
|
3172
3550
|
describe: "Sonar - Run Sonar Check",
|
|
@@ -3177,13 +3555,13 @@ var sonarCommand = {
|
|
|
3177
3555
|
const start = Date.now();
|
|
3178
3556
|
if (argv.verbose) console.log("Sonar Check");
|
|
3179
3557
|
process.exitCode = sonar();
|
|
3180
|
-
console.log(
|
|
3558
|
+
console.log(chalk41.blue(`Finished in ${Date.now() - start}ms`));
|
|
3181
3559
|
}
|
|
3182
3560
|
};
|
|
3183
3561
|
|
|
3184
3562
|
// src/xy/lint/index.ts
|
|
3185
3563
|
var xyLintCommands = (args) => {
|
|
3186
|
-
return args.command(cycleCommand).command(lintCommand).command(deplintCommand).command(fixCommand).command(relintCommand).command(publintCommand).command(knipCommand).command(sonarCommand);
|
|
3564
|
+
return args.command(cycleCommand).command(lintCommand).command(deplintCommand).command(fixCommand).command(relintCommand).command(publintCommand).command(knipCommand).command(packageLintCommand).command(sonarCommand);
|
|
3187
3565
|
};
|
|
3188
3566
|
|
|
3189
3567
|
// src/xy/xyParseOptions.ts
|
|
@@ -3217,8 +3595,8 @@ var xyParseOptions = () => {
|
|
|
3217
3595
|
var xy = async () => {
|
|
3218
3596
|
const options = xyParseOptions();
|
|
3219
3597
|
return await xyBuildCommands(xyCommonCommands(xyInstallCommands(xyDeployCommands(xyLintCommands(options))))).demandCommand(1).command("*", "", () => {
|
|
3220
|
-
console.error(
|
|
3221
|
-
console.log(
|
|
3598
|
+
console.error(chalk42.yellow(`Command not found [${chalk42.magenta(process.argv[2])}]`));
|
|
3599
|
+
console.log(chalk42.gray("Try 'yarn xy --help' for list of commands"));
|
|
3222
3600
|
}).version().help().argv;
|
|
3223
3601
|
};
|
|
3224
3602
|
export {
|