@yacosta738/refranero 0.0.0-stage → 0.4.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.
- package/bin/refranero.mjs +29 -0
- package/package.json +29 -4
- package/README.md +0 -3
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// npm only dispatches to a platform-native Rust executable. No postinstall downloads.
|
|
3
|
+
import { spawnSync } from 'node:child_process';
|
|
4
|
+
import { createRequire } from 'node:module';
|
|
5
|
+
import { dirname, join } from 'node:path';
|
|
6
|
+
|
|
7
|
+
const require = createRequire(import.meta.url);
|
|
8
|
+
const pkg = `@yacosta738/refranero-${process.platform}-${process.arch}`;
|
|
9
|
+
const exe = process.platform === 'win32' ? 'refranero.exe' : 'refranero';
|
|
10
|
+
let binary;
|
|
11
|
+
try {
|
|
12
|
+
const root = dirname(require.resolve(`${pkg}/package.json`));
|
|
13
|
+
binary = join(root, 'bin', exe);
|
|
14
|
+
} catch (error) {
|
|
15
|
+
process.stderr.write(`Missing native package ${pkg}. Reinstall @yacosta738/refranero with optional dependencies enabled.\n`);
|
|
16
|
+
process.stderr.write(`${error.message}\n`);
|
|
17
|
+
process.exit(1);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
const child = spawnSync(binary, process.argv.slice(2), { stdio: 'inherit', windowsHide: true });
|
|
21
|
+
if (child.error) {
|
|
22
|
+
process.stderr.write(`Cannot execute ${binary}: ${child.error.message}\n`);
|
|
23
|
+
process.exit(1);
|
|
24
|
+
}
|
|
25
|
+
if (child.signal) {
|
|
26
|
+
process.stderr.write(`refranero exited on signal ${child.signal}\n`);
|
|
27
|
+
process.exit(1);
|
|
28
|
+
}
|
|
29
|
+
process.exit(child.status ?? 1);
|
package/package.json
CHANGED
|
@@ -1,6 +1,31 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@yacosta738/refranero",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "0.4.0",
|
|
4
|
+
"description": "A Rust CLI for traditional proverbs and Cervantes sources",
|
|
5
|
+
"repository": {
|
|
6
|
+
"type": "git",
|
|
7
|
+
"url": "https://github.com/yacosta738/refranero.git"
|
|
8
|
+
},
|
|
9
|
+
"type": "module",
|
|
10
|
+
"bin": {
|
|
11
|
+
"refranero": "./bin/refranero.mjs"
|
|
12
|
+
},
|
|
13
|
+
"files": [
|
|
14
|
+
"bin"
|
|
15
|
+
],
|
|
16
|
+
"engines": {
|
|
17
|
+
"node": ">=18"
|
|
18
|
+
},
|
|
19
|
+
"publishConfig": {
|
|
20
|
+
"access": "public"
|
|
21
|
+
},
|
|
22
|
+
"license": "MIT",
|
|
23
|
+
"optionalDependencies": {
|
|
24
|
+
"@yacosta738/refranero-darwin-arm64": "0.4.0",
|
|
25
|
+
"@yacosta738/refranero-darwin-x64": "0.4.0",
|
|
26
|
+
"@yacosta738/refranero-linux-arm64": "0.4.0",
|
|
27
|
+
"@yacosta738/refranero-linux-x64": "0.4.0",
|
|
28
|
+
"@yacosta738/refranero-win32-arm64": "0.4.0",
|
|
29
|
+
"@yacosta738/refranero-win32-x64": "0.4.0"
|
|
30
|
+
}
|
|
31
|
+
}
|
package/README.md
DELETED