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