@tishlang/cargo-bindgen 1.7.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/README.md ADDED
@@ -0,0 +1,19 @@
1
+ # @tishlang/cargo-bindgen
2
+
3
+ Prebuilt `tishlang-cargo-bindgen` binary for generating Rust glue crates used by Tish [`cargo:`](https://github.com/tishlang/tish) imports.
4
+
5
+ ## Usage
6
+
7
+ ```bash
8
+ npx @tishlang/cargo-bindgen --help
9
+ ```
10
+
11
+ The npm binary name is **`tish-bindgen`**.
12
+
13
+ ## Install
14
+
15
+ ```bash
16
+ npm install --save-dev @tishlang/cargo-bindgen
17
+ ```
18
+
19
+ Then run `tish-bindgen` from `node_modules/.bin` or via npm scripts.
package/bin/.gitkeep ADDED
File without changes
Binary file
package/package.json ADDED
@@ -0,0 +1,34 @@
1
+ {
2
+ "name": "@tishlang/cargo-bindgen",
3
+ "version": "1.7.0",
4
+ "description": "CLI to generate Rust glue for Tish cargo: imports (tishlang-cargo-bindgen)",
5
+ "license": "MIT",
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "https://github.com/tishlang/tish.git"
9
+ },
10
+ "publishConfig": {
11
+ "access": "public"
12
+ },
13
+ "bin": {
14
+ "tish-bindgen": "./bin/tish-bindgen"
15
+ },
16
+ "scripts": {
17
+ "postinstall": "node scripts/install-bin.js"
18
+ },
19
+ "files": [
20
+ "bin",
21
+ "scripts/install-bin.js",
22
+ "platform",
23
+ "README.md"
24
+ ],
25
+ "engines": {
26
+ "node": ">=22"
27
+ },
28
+ "keywords": [
29
+ "tish",
30
+ "cargo",
31
+ "bindgen",
32
+ "rust"
33
+ ]
34
+ }
Binary file
Binary file
@@ -0,0 +1,40 @@
1
+ #!/usr/bin/env node
2
+ 'use strict';
3
+
4
+ /**
5
+ * Copy platform/<os>-<arch>/tish-bindgen to bin/tish-bindgen so the npm bin is the native binary.
6
+ * Runs on postinstall and before npm pack in CI.
7
+ */
8
+
9
+ const fs = require('fs');
10
+ const path = require('path');
11
+
12
+ const platformKey = `${process.platform}-${process.arch}`;
13
+ const binaryName = process.platform === 'win32' ? 'tish-bindgen.exe' : 'tish-bindgen';
14
+
15
+ const root = path.join(__dirname, '..');
16
+ const src = path.join(root, 'platform', platformKey, binaryName);
17
+ const dest = path.join(root, 'bin', 'tish-bindgen');
18
+
19
+ if (!fs.existsSync(src)) {
20
+ if (process.env.TISHLANG_CARGO_BINDGEN_NPM_PACK_REQUIRE === '1') {
21
+ console.error(`[@tishlang/cargo-bindgen] No prebuilt binary for this platform: ${platformKey}`);
22
+ console.error(`[@tishlang/cargo-bindgen] Expected: ${src}`);
23
+ process.exit(1);
24
+ }
25
+ console.warn(
26
+ `[@tishlang/cargo-bindgen] Skipping native bin (not found for ${platformKey}): ${src}`
27
+ );
28
+ console.warn(
29
+ '[@tishlang/cargo-bindgen] From repo root run: ./npm/scripts/build-binaries.sh — then: node npm/cargo-bindgen/scripts/install-bin.js'
30
+ );
31
+ process.exit(0);
32
+ }
33
+
34
+ fs.mkdirSync(path.dirname(dest), { recursive: true });
35
+ fs.copyFileSync(src, dest);
36
+ try {
37
+ fs.chmodSync(dest, 0o755);
38
+ } catch (_) {
39
+ /* Windows may ignore chmod */
40
+ }