@fatagnus/dink 2.8.2

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 (3) hide show
  1. package/README.md +55 -0
  2. package/bin/dink +62 -0
  3. package/package.json +40 -0
package/README.md ADDED
@@ -0,0 +1,55 @@
1
+ # @fatagnus/dink
2
+
3
+ CLI for the Dink edge mesh platform.
4
+
5
+ ## Usage
6
+
7
+ ```sh
8
+ npx @fatagnus/dink --help
9
+ npx @fatagnus/dink codegen ./dink.yaml
10
+ npx @fatagnus/dink dev setup
11
+ ```
12
+
13
+ ### Install globally
14
+
15
+ ```sh
16
+ npm i -g @fatagnus/dink
17
+ dink --help
18
+ ```
19
+
20
+ ### As a devDependency
21
+
22
+ ```sh
23
+ npm i -D @fatagnus/dink
24
+ ```
25
+
26
+ Then in `package.json` scripts:
27
+
28
+ ```json
29
+ {
30
+ "scripts": {
31
+ "codegen": "dink codegen ./dink.yaml"
32
+ }
33
+ }
34
+ ```
35
+
36
+ ## Supported platforms
37
+
38
+ | OS | Architecture |
39
+ |---------|-------------|
40
+ | macOS | arm64 |
41
+ | macOS | x64 |
42
+ | Linux | arm64 |
43
+ | Linux | x64 |
44
+ | Windows | arm64 |
45
+ | Windows | x64 |
46
+
47
+ If your platform is not listed, install from source:
48
+
49
+ ```sh
50
+ go install github.com/ozanturksever/dink/cmd/dink@latest
51
+ ```
52
+
53
+ ## Repository
54
+
55
+ https://github.com/ozanturksever/dink
package/bin/dink ADDED
@@ -0,0 +1,62 @@
1
+ #!/usr/bin/env node
2
+ "use strict";
3
+
4
+ const { execFileSync } = require("child_process");
5
+ const path = require("path");
6
+
7
+ const PLATFORMS = {
8
+ "darwin arm64": "@fatagnus/dink-darwin-arm64",
9
+ "darwin x64": "@fatagnus/dink-darwin-x64",
10
+ "linux arm64": "@fatagnus/dink-linux-arm64",
11
+ "linux x64": "@fatagnus/dink-linux-x64",
12
+ "win32 arm64": "@fatagnus/dink-win32-arm64",
13
+ "win32 x64": "@fatagnus/dink-win32-x64",
14
+ };
15
+
16
+ function getBinaryPath() {
17
+ const key = `${process.platform} ${process.arch}`;
18
+ const pkg = PLATFORMS[key];
19
+ if (!pkg) return null;
20
+
21
+ try {
22
+ const pkgJson = require.resolve(`${pkg}/package.json`);
23
+ const dir = path.dirname(pkgJson);
24
+ const bin = process.platform === "win32" ? "dink.exe" : "dink";
25
+ return path.join(dir, bin);
26
+ } catch {
27
+ return null;
28
+ }
29
+ }
30
+
31
+ function runBinary(bin, args) {
32
+ try {
33
+ execFileSync(bin, args, { stdio: "inherit" });
34
+ } catch (err) {
35
+ process.exit(err.status ?? 1);
36
+ }
37
+ }
38
+
39
+ const args = process.argv.slice(2);
40
+
41
+ // Try platform-specific binary from optionalDependencies
42
+ const binaryPath = getBinaryPath();
43
+ if (binaryPath) {
44
+ runBinary(binaryPath, args);
45
+ } else {
46
+ // Fall back to dink on $PATH
47
+ try {
48
+ execFileSync("dink", args, { stdio: "inherit" });
49
+ } catch (err) {
50
+ if (err.code === "ENOENT") {
51
+ const key = `${process.platform} ${process.arch}`;
52
+ console.error(
53
+ `Error: No prebuilt dink binary available for ${key}.\n` +
54
+ `The platform package was not installed and "dink" was not found on $PATH.\n\n` +
55
+ `To install from source:\n` +
56
+ ` go install github.com/ozanturksever/dink/cmd/dink@latest\n`
57
+ );
58
+ process.exit(1);
59
+ }
60
+ process.exit(err.status ?? 1);
61
+ }
62
+ }
package/package.json ADDED
@@ -0,0 +1,40 @@
1
+ {
2
+ "name": "@fatagnus/dink",
3
+ "version": "2.8.2",
4
+ "description": "CLI for the Dink edge mesh platform",
5
+ "bin": {
6
+ "dink": "bin/dink"
7
+ },
8
+ "optionalDependencies": {
9
+ "@fatagnus/dink-darwin-arm64": "2.8.2",
10
+ "@fatagnus/dink-darwin-x64": "2.8.2",
11
+ "@fatagnus/dink-linux-arm64": "2.8.2",
12
+ "@fatagnus/dink-linux-x64": "2.8.2",
13
+ "@fatagnus/dink-win32-arm64": "2.8.2",
14
+ "@fatagnus/dink-win32-x64": "2.8.2"
15
+ },
16
+ "publishConfig": {
17
+ "access": "public"
18
+ },
19
+ "license": "Apache-2.0",
20
+ "repository": {
21
+ "type": "git",
22
+ "url": "git+https://github.com/ozanturksever/dink.git",
23
+ "directory": "npm/dink"
24
+ },
25
+ "keywords": [
26
+ "dink",
27
+ "cli",
28
+ "edge",
29
+ "mesh",
30
+ "nats",
31
+ "codegen"
32
+ ],
33
+ "engines": {
34
+ "node": ">=16"
35
+ },
36
+ "files": [
37
+ "bin",
38
+ "README.md"
39
+ ]
40
+ }