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