@dimensional-innovations/tool-config 5.0.1 → 6.0.0

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.
Files changed (39) hide show
  1. package/dist/astro-6WHBKQFX.js +43 -0
  2. package/dist/astro-6WHBKQFX.js.map +1 -0
  3. package/dist/chunk-AKQIWLRC.js +446 -0
  4. package/dist/chunk-AKQIWLRC.js.map +1 -0
  5. package/dist/chunk-HAVDVZO3.js +624 -0
  6. package/dist/chunk-HAVDVZO3.js.map +1 -0
  7. package/dist/chunk-HUYPX7RZ.js +125 -0
  8. package/dist/chunk-HUYPX7RZ.js.map +1 -0
  9. package/dist/chunk-L7IN57ZC.js +167 -0
  10. package/dist/chunk-L7IN57ZC.js.map +1 -0
  11. package/dist/chunk-LRQFF2N5.js +141 -0
  12. package/dist/chunk-LRQFF2N5.js.map +1 -0
  13. package/dist/chunk-NRDWX5HH.js +363 -0
  14. package/dist/chunk-NRDWX5HH.js.map +1 -0
  15. package/dist/chunk-OMQFJOZZ.js +48 -0
  16. package/dist/chunk-OMQFJOZZ.js.map +1 -0
  17. package/dist/cli/index.js +72 -55
  18. package/dist/cli/index.js.map +1 -1
  19. package/dist/eslint-DXHSX6VW.js +5 -0
  20. package/dist/eslint-DXHSX6VW.js.map +1 -0
  21. package/dist/index.js +14 -2589
  22. package/dist/index.js.map +1 -1
  23. package/dist/prettier-EYWEBRIS.js +4 -0
  24. package/dist/prettier-EYWEBRIS.js.map +1 -0
  25. package/dist/react-YIKJI3VA.js +91 -0
  26. package/dist/react-YIKJI3VA.js.map +1 -0
  27. package/dist/semantic-release-7XCPBEKO.js +4 -0
  28. package/dist/semantic-release-7XCPBEKO.js.map +1 -0
  29. package/dist/solid-F44BEBBP.js +54 -0
  30. package/dist/solid-F44BEBBP.js.map +1 -0
  31. package/dist/stylelint-UAZHFIUD.js +5 -0
  32. package/dist/stylelint-UAZHFIUD.js.map +1 -0
  33. package/dist/svelte-XEOX6WAQ.js +56 -0
  34. package/dist/svelte-XEOX6WAQ.js.map +1 -0
  35. package/dist/typescript-G4HYJJ7T.js +4 -0
  36. package/dist/typescript-G4HYJJ7T.js.map +1 -0
  37. package/dist/vue-DP7MCMOU.js +144 -0
  38. package/dist/vue-DP7MCMOU.js.map +1 -0
  39. package/package.json +12 -11
package/dist/cli/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import { existsSync, rmSync, readFileSync, writeFileSync } from 'fs';
2
+ import { existsSync, readFileSync, writeFileSync, rmSync } from 'fs';
3
3
  import { join } from 'path';
4
4
  import { execSync } from 'child_process';
5
5
  import pc from 'picocolors';
@@ -44,7 +44,7 @@ function detectTypeChecker(framework, preference = "auto", cwd = process.cwd())
44
44
  const hasVueTsc = hasPackageInstalled("vue-tsc", cwd);
45
45
  if (hasVueTsc) return "vue-tsc";
46
46
  console.warn(
47
- "\u26A0\uFE0F Vue project detected but vue-tsc not found.\n Install with: npm install -D vue-tsc\n Falling back to tsgo/tsc (won't check .vue files)"
47
+ "\u26A0\uFE0F Vue project detected but vue-tsc not found.\n Install vue-tsc as a dev dependency to enable .vue file checking.\n Falling back to tsgo/tsc (won't check .vue files)"
48
48
  );
49
49
  }
50
50
  const hasTsgo = hasPackageInstalled("@typescript/native-preview", cwd);
@@ -1259,8 +1259,17 @@ var CHECK_SCRIPT_MAP = {
1259
1259
  typescript: "typecheck"
1260
1260
  };
1261
1261
  var CHECK_ORDER = ["prettier", "stylelint", "eslint", "typescript"];
1262
- function generateCheckAllScript(installedTools) {
1263
- const commands = CHECK_ORDER.filter((tool) => installedTools.includes(tool)).map((tool) => `yarn ${CHECK_SCRIPT_MAP[tool]}`).join(" && ");
1262
+ function detectPackageManager(cwd = process.cwd()) {
1263
+ if (existsSync(join(cwd, "pnpm-lock.yaml"))) return "pnpm";
1264
+ if (existsSync(join(cwd, "yarn.lock"))) return "yarn";
1265
+ return "npm";
1266
+ }
1267
+ function getRunCommand(pm, script) {
1268
+ if (pm === "npm") return `npm run ${script}`;
1269
+ return `${pm} ${script}`;
1270
+ }
1271
+ function generateCheckAllScript(installedTools, pm) {
1272
+ const commands = CHECK_ORDER.filter((tool) => installedTools.includes(tool)).map((tool) => getRunCommand(pm, CHECK_SCRIPT_MAP[tool])).join(" && ");
1264
1273
  return commands || null;
1265
1274
  }
1266
1275
  function updatePackageJsonScripts(tools, getScriptsFn, context) {
@@ -1289,11 +1298,12 @@ function updatePackageJsonScripts(tools, getScriptsFn, context) {
1289
1298
  if (packageJson.scripts.prettier || scriptsToAdd.prettier) installedTools.push("prettier");
1290
1299
  if (packageJson.scripts.style || scriptsToAdd.style) installedTools.push("stylelint");
1291
1300
  if (packageJson.scripts.typecheck || scriptsToAdd.typecheck) installedTools.push("typescript");
1301
+ const pm = detectPackageManager(cwd);
1292
1302
  if (installedTools.length >= 2) {
1293
- const checkAllCmd = generateCheckAllScript(installedTools);
1303
+ const checkAllCmd = generateCheckAllScript(installedTools, pm);
1294
1304
  if (checkAllCmd) {
1295
1305
  const existingCheckAll = packageJson.scripts["check-all"];
1296
- const isAutoGenerated = existingCheckAll && existingCheckAll.startsWith("yarn ") && existingCheckAll.includes(" && yarn ");
1306
+ const isAutoGenerated = existingCheckAll && /^(npm run|yarn|pnpm) .+ && (npm run|yarn|pnpm) /.test(existingCheckAll);
1297
1307
  if (!existingCheckAll || isAutoGenerated) {
1298
1308
  scriptsToAdd["check-all"] = checkAllCmd;
1299
1309
  }
@@ -1350,7 +1360,7 @@ function removePackageJsonScripts(tools, getScriptsFn, context) {
1350
1360
  }
1351
1361
  const checkAllScript = packageJson.scripts["check-all"];
1352
1362
  if (checkAllScript) {
1353
- const isAutoGenerated = checkAllScript.startsWith("yarn ") && checkAllScript.includes(" && yarn ");
1363
+ const isAutoGenerated = /^(npm run|yarn|pnpm) .+ && (npm run|yarn|pnpm) /.test(checkAllScript);
1354
1364
  if (isAutoGenerated) {
1355
1365
  scriptsToRemove.push("check-all");
1356
1366
  }
@@ -1460,7 +1470,7 @@ function showSection(title) {
1460
1470
  console.log(`${title}`);
1461
1471
  console.log("");
1462
1472
  }
1463
- function showCompletion(dryRun, createdFiles = [], scripts = []) {
1473
+ function showCompletion(dryRun, createdFiles = [], scripts = [], pm = "npm") {
1464
1474
  console.log("");
1465
1475
  if (dryRun) {
1466
1476
  console.log(createSeparator());
@@ -1502,9 +1512,9 @@ function showCompletion(dryRun, createdFiles = [], scripts = []) {
1502
1512
  completion.push("");
1503
1513
  completion.push("\u{1F680} Quick start:");
1504
1514
  if (scripts.includes("check-all")) {
1505
- completion.push(" npm run check-all");
1515
+ completion.push(` ${getRunCommand(pm, "check-all")}`);
1506
1516
  } else if (scripts.length > 0) {
1507
- completion.push(` npm run ${scripts[0]}`);
1517
+ completion.push(` ${getRunCommand(pm, scripts[0])}`);
1508
1518
  }
1509
1519
  console.log(createBox(completion));
1510
1520
  }
@@ -1569,7 +1579,8 @@ function contentMatches(filepath, expectedContent) {
1569
1579
  return false;
1570
1580
  }
1571
1581
  }
1572
- function uninstallTool(_tool, handler, detected, cwd, dryRun = false) {
1582
+ function uninstallTool(_tool, handler, context) {
1583
+ const { detected, cwd, dryRun = false } = context;
1573
1584
  const filename = handler.getConfigFilename();
1574
1585
  const filepath = join(cwd, filename);
1575
1586
  if (!existsSync(filepath)) {
@@ -1670,11 +1681,12 @@ async function setupTools(tools, detected, cwd, dryRun = false) {
1670
1681
  }
1671
1682
  function uninstallTools(tools, detected, cwd, dryRun = false) {
1672
1683
  showSection("\u{1F5D1}\uFE0F Removing configuration files...");
1684
+ const context = { detected, cwd, dryRun };
1673
1685
  let removedCount = 0;
1674
1686
  for (const tool of tools) {
1675
1687
  console.log(`${tool}:`);
1676
1688
  const handler = TOOL_HANDLERS[tool];
1677
- const success = uninstallTool(tool, handler, detected, cwd, dryRun);
1689
+ const success = uninstallTool(tool, handler, context);
1678
1690
  if (success) {
1679
1691
  removedCount++;
1680
1692
  }
@@ -1685,6 +1697,48 @@ function uninstallTools(tools, detected, cwd, dryRun = false) {
1685
1697
  }
1686
1698
  return removedCount;
1687
1699
  }
1700
+ async function handleUninstall(cwd, flags, singleTool) {
1701
+ const detected = autoDetect(cwd);
1702
+ const installedTools = detectInstalledTools(cwd);
1703
+ showUninstallBanner(installedTools);
1704
+ if (installedTools.length === 0) {
1705
+ console.log("Nothing to uninstall.");
1706
+ process.exit(0);
1707
+ }
1708
+ if (flags.all) {
1709
+ const removedCount2 = uninstallTools(installedTools, detected, cwd, flags.dryRun);
1710
+ showUninstallCompletion(flags.dryRun, removedCount2);
1711
+ process.exit(0);
1712
+ }
1713
+ if (singleTool) {
1714
+ if (!installedTools.includes(singleTool)) {
1715
+ console.log(`\u26A0\uFE0F ${singleTool} is not installed`);
1716
+ process.exit(0);
1717
+ }
1718
+ const removedCount2 = uninstallTools([singleTool], detected, cwd, flags.dryRun);
1719
+ showUninstallCompletion(flags.dryRun, removedCount2);
1720
+ process.exit(0);
1721
+ }
1722
+ const response = await prompts({
1723
+ type: "multiselect",
1724
+ name: "tools",
1725
+ message: "Which tools would you like to uninstall?",
1726
+ choices: installedTools.map((tool) => ({
1727
+ title: tool,
1728
+ value: tool,
1729
+ selected: false
1730
+ })),
1731
+ hint: "- Space to select. Return to submit"
1732
+ });
1733
+ if (!response.tools || response.tools.length === 0) {
1734
+ console.log("");
1735
+ console.log("\u274C No tools selected. Exiting.");
1736
+ process.exit(0);
1737
+ }
1738
+ const removedCount = uninstallTools(response.tools, detected, cwd, flags.dryRun);
1739
+ showUninstallCompletion(flags.dryRun, removedCount);
1740
+ process.exit(0);
1741
+ }
1688
1742
  async function main() {
1689
1743
  const args = process.argv.slice(2);
1690
1744
  const flags = {
@@ -1705,58 +1759,21 @@ async function main() {
1705
1759
  }
1706
1760
  const cwd = process.cwd();
1707
1761
  if (flags.uninstall) {
1708
- const detected2 = autoDetect(cwd);
1709
- const installedTools = detectInstalledTools(cwd);
1710
- showUninstallBanner(installedTools);
1711
- if (installedTools.length === 0) {
1712
- console.log("Nothing to uninstall.");
1713
- process.exit(0);
1714
- }
1715
- if (flags.all) {
1716
- const removedCount2 = uninstallTools(installedTools, detected2, cwd, flags.dryRun);
1717
- showUninstallCompletion(flags.dryRun, removedCount2);
1718
- process.exit(0);
1719
- }
1720
- if (singleTool) {
1721
- if (!installedTools.includes(singleTool)) {
1722
- console.log(`\u26A0\uFE0F ${singleTool} is not installed`);
1723
- process.exit(0);
1724
- }
1725
- const removedCount2 = uninstallTools([singleTool], detected2, cwd, flags.dryRun);
1726
- showUninstallCompletion(flags.dryRun, removedCount2);
1727
- process.exit(0);
1728
- }
1729
- const response2 = await prompts({
1730
- type: "multiselect",
1731
- name: "tools",
1732
- message: "Which tools would you like to uninstall?",
1733
- choices: installedTools.map((tool) => ({
1734
- title: tool,
1735
- value: tool,
1736
- selected: false
1737
- })),
1738
- hint: "- Space to select. Return to submit"
1739
- });
1740
- if (!response2.tools || response2.tools.length === 0) {
1741
- console.log("");
1742
- console.log("\u274C No tools selected. Exiting.");
1743
- process.exit(0);
1744
- }
1745
- const removedCount = uninstallTools(response2.tools, detected2, cwd, flags.dryRun);
1746
- showUninstallCompletion(flags.dryRun, removedCount);
1747
- process.exit(0);
1762
+ await handleUninstall(cwd, flags, singleTool);
1763
+ return;
1748
1764
  }
1749
1765
  const detected = autoDetect(cwd);
1750
1766
  showBanner(detected);
1767
+ const pm = detectPackageManager(cwd);
1751
1768
  if (flags.all) {
1752
1769
  const summary2 = await setupTools([...VALID_TOOLS], detected, cwd, flags.dryRun);
1753
- showCompletion(flags.dryRun, summary2.files, summary2.scripts);
1770
+ showCompletion(flags.dryRun, summary2.files, summary2.scripts, pm);
1754
1771
  process.exit(0);
1755
1772
  }
1756
1773
  if (singleTool) {
1757
1774
  validateTool(singleTool);
1758
1775
  const summary2 = await setupTools([singleTool], detected, cwd, flags.dryRun);
1759
- showCompletion(flags.dryRun, summary2.files, summary2.scripts);
1776
+ showCompletion(flags.dryRun, summary2.files, summary2.scripts, pm);
1760
1777
  process.exit(0);
1761
1778
  }
1762
1779
  const response = await prompts([
@@ -1800,7 +1817,7 @@ async function main() {
1800
1817
  process.exit(0);
1801
1818
  }
1802
1819
  const summary = await setupTools(response.tools, detected, cwd, flags.dryRun);
1803
- showCompletion(flags.dryRun, summary.files, summary.scripts);
1820
+ showCompletion(flags.dryRun, summary.files, summary.scripts, pm);
1804
1821
  }
1805
1822
  main().catch((error) => {
1806
1823
  console.error("");