@zigc/cli 0.14.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.
- package/README.md +30 -0
- package/bin/zig +26 -0
- package/package.json +26 -0
package/README.md
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
# @zigc/cli
|
|
2
|
+
|
|
3
|
+
Zig compiler distributed via npm. Run Zig without installing it system-wide or in CI/CD where Zig is not available and/or only NPM is available.
|
|
4
|
+
|
|
5
|
+
## Usage
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
# Run directly
|
|
9
|
+
npx @zigc/cli version
|
|
10
|
+
bunx @zigc/cli version
|
|
11
|
+
|
|
12
|
+
# Or install globally
|
|
13
|
+
npm install -g @zigc/cli
|
|
14
|
+
zig version
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## How it works
|
|
18
|
+
|
|
19
|
+
The `@zigc/cli` package resolves the correct native binary for your platform via optional dependencies:
|
|
20
|
+
|
|
21
|
+
| Package | Platform |
|
|
22
|
+
|---------|----------|
|
|
23
|
+
| `@zigc/darwin-arm64` | macOS Apple Silicon |
|
|
24
|
+
| `@zigc/darwin-x64` | macOS Intel |
|
|
25
|
+
| `@zigc/linux-x64` | Linux x64 |
|
|
26
|
+
| `@zigc/linux-arm64` | Linux ARM64 |
|
|
27
|
+
| `@zigc/win32-x64` | Windows x64 |
|
|
28
|
+
| `@zigc/win32-arm64` | Windows ARM64 |
|
|
29
|
+
|
|
30
|
+
The standard library is shipped separately in `@zigc/lib` (shared across all platforms).
|
package/bin/zig
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { spawn } from 'node:child_process';
|
|
3
|
+
import { createRequire } from 'node:module';
|
|
4
|
+
|
|
5
|
+
const require = createRequire(import.meta.url);
|
|
6
|
+
const pkgName = `@zigc/${process.platform}-${process.arch}`;
|
|
7
|
+
const ext = process.platform === 'win32' ? '.exe' : '';
|
|
8
|
+
|
|
9
|
+
try {
|
|
10
|
+
const binaryPath = require.resolve(`${pkgName}/bin/zig${ext}`);
|
|
11
|
+
|
|
12
|
+
const child = spawn(binaryPath, process.argv.slice(2), {
|
|
13
|
+
stdio: 'inherit',
|
|
14
|
+
shell: process.platform === 'win32'
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
child.on('exit', (code) => process.exit(code ?? 0));
|
|
18
|
+
child.on('error', (err) => {
|
|
19
|
+
console.error('Failed to start child process:', err);
|
|
20
|
+
process.exit(1);
|
|
21
|
+
});
|
|
22
|
+
} catch (e) {
|
|
23
|
+
console.error(`Error: Could not find binary for ${process.platform}-${process.arch}`);
|
|
24
|
+
console.error(`Ensure the optional dependency "${pkgName}" is installed.`);
|
|
25
|
+
process.exit(1);
|
|
26
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@zigc/cli",
|
|
3
|
+
"version": "0.14.1",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"description": "Zig compiler CLI via npm - run `bunx @zigc/cli` or `npx @zigc/cli`",
|
|
6
|
+
"bin": {
|
|
7
|
+
"zig": "bin/zig"
|
|
8
|
+
},
|
|
9
|
+
"repository": {
|
|
10
|
+
"type": "git",
|
|
11
|
+
"url": "git+https://github.com/ziex-dev/zigc.git"
|
|
12
|
+
},
|
|
13
|
+
"license": "MIT",
|
|
14
|
+
"preferUnplugged": true,
|
|
15
|
+
"dependencies": {
|
|
16
|
+
"@zigc/lib": "0.14.1"
|
|
17
|
+
},
|
|
18
|
+
"optionalDependencies": {
|
|
19
|
+
"@zigc/darwin-arm64": "0.14.1",
|
|
20
|
+
"@zigc/darwin-x64": "0.14.1",
|
|
21
|
+
"@zigc/linux-x64": "0.14.1",
|
|
22
|
+
"@zigc/linux-arm64": "0.14.1",
|
|
23
|
+
"@zigc/win32-x64": "0.14.1",
|
|
24
|
+
"@zigc/win32-arm64": "0.14.1"
|
|
25
|
+
}
|
|
26
|
+
}
|