@buun_group/dna 0.2.0 → 0.2.1

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/bin/dna +25 -13
  2. package/package.json +10 -7
package/bin/dna CHANGED
@@ -25,27 +25,39 @@ if (!pkg) {
25
25
  }
26
26
 
27
27
  const ext = platform === "win32" ? ".exe" : "";
28
- const npmDir = pkg.replace("@buun_group/", "");
28
+ const binaryName = `dna${ext}`;
29
29
  let binaryPath;
30
30
 
31
- // Try require.resolve first (works when installed via npm)
31
+ // 1. Try require.resolve (works when optionalDeps are nested in node_modules)
32
32
  try {
33
- binaryPath = require.resolve(`${pkg}/bin/dna${ext}`);
33
+ binaryPath = require.resolve(`${pkg}/bin/${binaryName}`);
34
34
  } catch {
35
- // Fallback to local dev path (for testing before publish)
36
- const localPath = path.join(__dirname, "..", "npm", npmDir, "bin", `dna${ext}`);
37
- if (fs.existsSync(localPath)) {
38
- binaryPath = localPath;
35
+ // 2. Global install: npm hoists optionalDeps as siblings in global node_modules
36
+ // __dirname = .../node_modules/@buun_group/dna/bin
37
+ // sibling = .../node_modules/@buun_group/dna-linux-x64/bin/dna
38
+ const globalSibling = path.join(__dirname, "..", "..", pkg.replace("@buun_group/", ""), "bin", binaryName);
39
+ if (fs.existsSync(globalSibling)) {
40
+ binaryPath = globalSibling;
39
41
  } else {
40
- console.error(
41
- `Could not find the dna binary for ${platform}-${arch}.\n` +
42
- `The platform package ${pkg} may not have been installed.\n` +
43
- `Try reinstalling: npm install -g @buun_group/dna`
44
- );
45
- process.exit(1);
42
+ // 3. Local dev path (for testing before publish)
43
+ const localPath = path.join(__dirname, "..", "npm", pkg.replace("@buun_group/", ""), "bin", binaryName);
44
+ if (fs.existsSync(localPath)) {
45
+ binaryPath = localPath;
46
+ }
46
47
  }
47
48
  }
48
49
 
50
+ if (!binaryPath) {
51
+ console.error(
52
+ `Could not find the dna binary for ${platform}-${arch}.\n` +
53
+ `The platform package ${pkg} may not have been installed.\n\n` +
54
+ `Try:\n` +
55
+ ` npm install -g @buun_group/dna\n` +
56
+ ` npm install -g ${pkg}\n`
57
+ );
58
+ process.exit(1);
59
+ }
60
+
49
61
  const result = spawnSync(binaryPath, process.argv.slice(2), {
50
62
  stdio: "inherit",
51
63
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@buun_group/dna",
3
- "version": "0.2.0",
3
+ "version": "0.2.1",
4
4
  "description": "DESTROY.NETWORK Agent CLI — privacy-first disposable email automation",
5
5
  "license": "MIT",
6
6
  "bin": {
@@ -10,11 +10,11 @@
10
10
  "postinstall": "node install.js"
11
11
  },
12
12
  "optionalDependencies": {
13
- "@buun_group/dna-linux-x64": "0.2.0",
14
- "@buun_group/dna-linux-arm64": "0.2.0",
15
- "@buun_group/dna-darwin-x64": "0.2.0",
16
- "@buun_group/dna-darwin-arm64": "0.2.0",
17
- "@buun_group/dna-win32-x64": "0.2.0"
13
+ "@buun_group/dna-darwin-arm64": "0.2.1",
14
+ "@buun_group/dna-darwin-x64": "0.2.1",
15
+ "@buun_group/dna-linux-arm64": "0.2.1",
16
+ "@buun_group/dna-linux-x64": "0.2.1",
17
+ "@buun_group/dna-win32-x64": "0.2.1"
18
18
  },
19
19
  "files": [
20
20
  "bin",
@@ -34,5 +34,8 @@
34
34
  "disposable-email",
35
35
  "cli",
36
36
  "agent"
37
- ]
37
+ ],
38
+ "dependencies": {
39
+ "@buun_group/dna": "^0.2.0"
40
+ }
38
41
  }