slugsocial 0.0.9
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 +25 -0
- package/bin/slugsocial.js +60 -0
- package/package.json +25 -0
package/README.md
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# `npx slugsocial`
|
|
2
|
+
|
|
3
|
+
Ultra-thin shim that **execs the Rust `slugsocial` binary bundled via platform packages**.
|
|
4
|
+
|
|
5
|
+
## Usage
|
|
6
|
+
|
|
7
|
+
Install/run:
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npx slugsocial --help
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Publish checklist (npm)
|
|
14
|
+
|
|
15
|
+
- Publish **platform packages** first (one per OS/arch), each containing `bin/slugsocial` (or `.exe`).
|
|
16
|
+
- Then publish the root `slugsocial` package which has `optionalDependencies` on those platform packages.
|
|
17
|
+
|
|
18
|
+
Repo: `sortersocial/slug` (`https://github.com/sortersocial/slug`)
|
|
19
|
+
|
|
20
|
+
Packages to publish:
|
|
21
|
+
- `@sortersocial/slugsocial-darwin-arm64` (from `packages/npm/platforms/darwin-arm64`)
|
|
22
|
+
- `@sortersocial/slugsocial-darwin-x64`
|
|
23
|
+
- `slugsocial` (from `packages/npm`)
|
|
24
|
+
|
|
25
|
+
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// Ultra-thin shim: exec the Rust `slugsocial` binary bundled via platform packages.
|
|
3
|
+
//
|
|
4
|
+
// npm will download exactly one optionalDependency for this platform:
|
|
5
|
+
// - @sortersocial/slugsocial-darwin-arm64
|
|
6
|
+
// - @sortersocial/slugsocial-darwin-x64
|
|
7
|
+
// - @sortersocial/slugsocial-linux-arm64
|
|
8
|
+
// - @sortersocial/slugsocial-linux-x64
|
|
9
|
+
// - @sortersocial/slugsocial-win32-arm64
|
|
10
|
+
// - @sortersocial/slugsocial-win32-x64
|
|
11
|
+
|
|
12
|
+
const path = require("node:path");
|
|
13
|
+
const childProcess = require("node:child_process");
|
|
14
|
+
|
|
15
|
+
function die(msg) {
|
|
16
|
+
console.error(msg);
|
|
17
|
+
process.exit(1);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
function platformTriple() {
|
|
21
|
+
const p = process.platform;
|
|
22
|
+
const a = process.arch;
|
|
23
|
+
|
|
24
|
+
const plat = p === "darwin" ? "darwin" : p === "linux" ? "linux" : p === "win32" ? "windows" : null;
|
|
25
|
+
const arch = a === "x64" ? "x64" : a === "arm64" ? "arm64" : null;
|
|
26
|
+
if (!plat || !arch) {
|
|
27
|
+
die(`unsupported platform/arch: ${p}/${a}`);
|
|
28
|
+
}
|
|
29
|
+
return { plat, arch };
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
function resolvePlatformPackage() {
|
|
33
|
+
const { plat, arch } = platformTriple();
|
|
34
|
+
const name = `@sortersocial/slugsocial-${plat}-${arch}`;
|
|
35
|
+
try {
|
|
36
|
+
const pkgJson = require.resolve(`${name}/package.json`);
|
|
37
|
+
return path.dirname(pkgJson);
|
|
38
|
+
} catch {
|
|
39
|
+
die(
|
|
40
|
+
[
|
|
41
|
+
`missing platform package ${name}.`,
|
|
42
|
+
`This usually means npm didn't install optionalDependencies for your platform.`,
|
|
43
|
+
`Try: npm_config_optional=true npx slugsocial --help`,
|
|
44
|
+
].join("\n")
|
|
45
|
+
);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
async function main() {
|
|
50
|
+
const pkgDir = resolvePlatformPackage();
|
|
51
|
+
const ext = process.platform === "win32" ? ".exe" : "";
|
|
52
|
+
const bin = path.join(pkgDir, "bin", `slugsocial${ext}`);
|
|
53
|
+
const args = process.argv.slice(2);
|
|
54
|
+
const res = childProcess.spawnSync(bin, args, { stdio: "inherit" });
|
|
55
|
+
process.exit(res.status ?? 1);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
main().catch((e) => die(String(e?.message ?? e)));
|
|
59
|
+
|
|
60
|
+
|
package/package.json
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "slugsocial",
|
|
3
|
+
"version": "0.0.9",
|
|
4
|
+
"description": "Slug Social CLI shim (execs bundled Rust slugsocial) — npx-friendly",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "git+https://github.com/sortersocial/slug.git"
|
|
9
|
+
},
|
|
10
|
+
"bin": {
|
|
11
|
+
"slugsocial": "bin/slugsocial.js"
|
|
12
|
+
},
|
|
13
|
+
"files": [
|
|
14
|
+
"bin/slugsocial.js",
|
|
15
|
+
"README.md",
|
|
16
|
+
"package.json"
|
|
17
|
+
],
|
|
18
|
+
"optionalDependencies": {
|
|
19
|
+
"@sortersocial/slugsocial-darwin-arm64": "0.0.9",
|
|
20
|
+
"@sortersocial/slugsocial-darwin-x64": "0.0.9"
|
|
21
|
+
},
|
|
22
|
+
"engines": {
|
|
23
|
+
"node": ">=18"
|
|
24
|
+
}
|
|
25
|
+
}
|