@farming-labs/docs 0.0.24 → 0.0.26

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 (2) hide show
  1. package/dist/cli/index.mjs +42 -2
  2. package/package.json +1 -1
@@ -20,10 +20,16 @@ function detectFramework(cwd) {
20
20
  if (allDeps["nuxt"]) return "nuxt";
21
21
  return null;
22
22
  }
23
- function detectPackageManager(cwd) {
23
+ function detectPackageManagerFromLockfile(cwd) {
24
24
  if (fs.existsSync(path.join(cwd, "pnpm-lock.yaml"))) return "pnpm";
25
25
  if (fs.existsSync(path.join(cwd, "bun.lockb")) || fs.existsSync(path.join(cwd, "bun.lock"))) return "bun";
26
26
  if (fs.existsSync(path.join(cwd, "yarn.lock"))) return "yarn";
27
+ if (fs.existsSync(path.join(cwd, "package-lock.json"))) return "npm";
28
+ return null;
29
+ }
30
+ function detectPackageManager(cwd) {
31
+ const detected = detectPackageManagerFromLockfile(cwd);
32
+ if (detected) return detected;
27
33
  return "npm";
28
34
  }
29
35
  function installCommand(pm) {
@@ -2445,7 +2451,41 @@ async function upgrade(options = {}) {
2445
2451
  }
2446
2452
  preset = presetFromFramework(framework);
2447
2453
  }
2448
- const pm = detectPackageManager(cwd);
2454
+ let pm = detectPackageManagerFromLockfile(cwd);
2455
+ if (pm) p.log.info(`Detected ${pc.cyan(pm)} from lockfile`);
2456
+ else {
2457
+ const pmAnswer = await p.select({
2458
+ message: "Which package manager do you want to use for this upgrade?",
2459
+ options: [
2460
+ {
2461
+ value: "pnpm",
2462
+ label: "pnpm",
2463
+ hint: "Use pnpm add"
2464
+ },
2465
+ {
2466
+ value: "npm",
2467
+ label: "npm",
2468
+ hint: "Use npm add"
2469
+ },
2470
+ {
2471
+ value: "yarn",
2472
+ label: "yarn",
2473
+ hint: "Use yarn add"
2474
+ },
2475
+ {
2476
+ value: "bun",
2477
+ label: "bun",
2478
+ hint: "Use bun add"
2479
+ }
2480
+ ]
2481
+ });
2482
+ if (p.isCancel(pmAnswer)) {
2483
+ p.outro(pc.red("Upgrade cancelled."));
2484
+ process.exit(0);
2485
+ }
2486
+ pm = pmAnswer;
2487
+ p.log.info(`Using ${pc.cyan(pm)} as package manager`);
2488
+ }
2449
2489
  const cmd = buildUpgradeCommand(framework, tag, pm);
2450
2490
  const packages = getPackagesForFramework(framework);
2451
2491
  p.log.step(`Upgrading ${preset} docs packages to ${tag}...`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@farming-labs/docs",
3
- "version": "0.0.24",
3
+ "version": "0.0.26",
4
4
  "description": "Modern, flexible MDX-based docs framework — core types, config, and CLI",
5
5
  "keywords": [
6
6
  "docs",