@idomatic/create 1.1.1 → 1.1.12

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/helpers/index.js CHANGED
@@ -4,14 +4,14 @@ const defaultConfigs = {
4
4
  prefix: "auto-id-",
5
5
  excludeTags: ["html", "head", "script"],
6
6
  includeExtensions: ["js", "jsx", "ts", "tsx"],
7
- excludeFiles: [],
7
+ excludeFiles: ["node_modules", "public"],
8
8
  },
9
9
  html: {
10
10
  attributeName: "id",
11
11
  prefix: "auto-id-",
12
12
  excludeTags: ["html", "head", "script"],
13
13
  includeExtensions: ["html", "vue"],
14
- excludeFiles: [],
14
+ excludeFiles: ["node_modules", "public"],
15
15
  },
16
16
  };
17
17
 
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 { writeFileSync } from "fs";
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!");
@@ -23,8 +23,11 @@ const res = await prompts([
23
23
  // Detect package manager
24
24
  const agent = process.env.npm_config_user_agent || "";
25
25
  let pkg = "npm";
26
- if (agent.includes("yarn")) pkg = "yarn";
27
- else if (agent.includes("bun")) pkg = "bun";
26
+ if (agent?.includes("yarn")) pkg = "yarn";
27
+ else if (agent?.includes("pnpm")) pkg = "pnpm";
28
+ else if (agent?.includes("bun")) pkg = "bun";
29
+ else if (agent?.includes("npm")) pkg = "npm";
30
+ else pkg = detectPackageManagerFallback();
28
31
 
29
32
  // Install parser if opted-in
30
33
  if (res.installParsers) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@idomatic/create",
3
- "version": "1.1.1",
3
+ "version": "1.1.12",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "@idomatic/create": "./index.js"
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"; // default fallback
13
+ }