@idomatic/create 1.1.11 → 1.1.13
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/index.js +2 -5
- package/package.json +1 -1
- package/utils/index.js +13 -0
package/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env bun
|
|
2
2
|
import prompts from "prompts";
|
|
3
3
|
import { execSync } from "child_process";
|
|
4
|
-
import {
|
|
4
|
+
import { detectPackageManagerFallback } from "./utils/index.js";
|
|
5
5
|
import initConfig from "./lib/initConfig.js";
|
|
6
6
|
|
|
7
7
|
console.log("✨ Welcome to idomatic setup!");
|
|
@@ -21,10 +21,7 @@ const res = await prompts([
|
|
|
21
21
|
]);
|
|
22
22
|
|
|
23
23
|
// Detect package manager
|
|
24
|
-
const
|
|
25
|
-
let pkg = "npm";
|
|
26
|
-
if (agent.includes("yarn")) pkg = "yarn";
|
|
27
|
-
else if (agent.includes("bun")) pkg = "bun";
|
|
24
|
+
const pkg = detectPackageManagerFallback();
|
|
28
25
|
|
|
29
26
|
// Install parser if opted-in
|
|
30
27
|
if (res.installParsers) {
|
package/package.json
CHANGED
package/utils/index.js
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { existsSync } from "fs";
|
|
2
|
+
import { join } from "path";
|
|
3
|
+
|
|
4
|
+
export function detectPackageManagerFallback() {
|
|
5
|
+
const root = process.cwd();
|
|
6
|
+
|
|
7
|
+
if (existsSync(join(root, "bun.lockb"))) return "bun";
|
|
8
|
+
if (existsSync(join(root, "yarn.lock"))) return "yarn";
|
|
9
|
+
if (existsSync(join(root, "pnpm-lock.yaml"))) return "pnpm";
|
|
10
|
+
if (existsSync(join(root, "package-lock.json"))) return "npm";
|
|
11
|
+
|
|
12
|
+
return "npm";
|
|
13
|
+
}
|