jwt-encde 1.1.0-pre.7 → 1.1.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 CHANGED
@@ -37,7 +37,7 @@ In real-world systems, signing keys and token validation are typically managed b
37
37
  - Install as npm pacakge
38
38
 
39
39
  ```sh
40
- npm install jwt-encde
40
+ npm install -g jwt-encde
41
41
  npx jwt-encde
42
42
  ```
43
43
 
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "jwt-encde",
3
- "version": "1.1.0-pre.7",
3
+ "version": "1.1.0",
4
4
  "description": "GUI JWT encoder / decoder - Local, private, easy.",
5
- "author": "nabbisen<nabbisen@scqr.net>",
5
+ "author": "nabbisen <nabbisen@scqr.net>",
6
6
  "license": "Apache-2.0",
7
7
  "repository": {
8
8
  "type": "git",
@@ -14,7 +14,7 @@
14
14
  },
15
15
  "homepage": "https://github.com/nabbisen/jwt-encde/",
16
16
  "bin": {
17
- "jwt-encde": "./index.js"
17
+ "jwt-encde": "index.js"
18
18
  },
19
19
  "files": [
20
20
  "postinstall.js"
@@ -23,9 +23,9 @@
23
23
  "postinstall": "node postinstall.js"
24
24
  },
25
25
  "optionalDependencies": {
26
- "@jwt-encde/bin-linux-x64-gnu": "1.1.0-pre.7",
27
- "@jwt-encde/bin-darwin-arm64": "1.1.0-pre.7",
28
- "@jwt-encde/bin-win32-x64-msvc": "1.1.0-pre.7"
26
+ "@jwt-encde/bin-linux-x64-gnu": "1.1.0",
27
+ "@jwt-encde/bin-darwin-arm64": "1.1.0",
28
+ "@jwt-encde/bin-win32-x64-msvc": "1.1.0"
29
29
  },
30
30
  "keywords": [
31
31
  "jwt",
package/postinstall.js ADDED
@@ -0,0 +1,58 @@
1
+ const fs = require("fs")
2
+ const os = require("os")
3
+ const path = require("path")
4
+
5
+ const binaryName = "jwt-encde"
6
+ const platformOrganization = "@jwt-encde"
7
+
8
+ function srcDestBinaryPath() {
9
+ const platform = os.platform()
10
+
11
+ let platformPackage = null
12
+ let extension = ""
13
+
14
+ switch (platform) {
15
+ case "linux":
16
+ platformPackage = "bin-linux-x64-gnu"
17
+ break
18
+ case "darwin":
19
+ platformPackage = "bin-darwin-arm64"
20
+ break
21
+ case "win32":
22
+ platformPackage = "bin-win32-x64-msvc"
23
+ extension = ".exe"
24
+ break
25
+ default:
26
+ console.error(`Unsupported platform: ${platform}`)
27
+ process.exit(1)
28
+ }
29
+
30
+ const binDir = __dirname
31
+ const srcDir = path.join(binDir, "..", platformOrganization, platformPackage)
32
+ const srcBinary = path.join(srcDir, `${binaryName}${extension}`)
33
+ const destBinary = path.join(binDir, `${binaryName}${extension}`)
34
+
35
+ return [srcBinary, destBinary]
36
+ }
37
+
38
+ function linkOrCopy(src, dest) {
39
+ try {
40
+ if (fs.existsSync(dest)) {
41
+ fs.rmSync(dest, { force: true })
42
+ }
43
+
44
+ // Try symbolic link first
45
+ fs.symlinkSync(src, dest, "file")
46
+ fs.chmodSync(src, 0o755)
47
+ console.log(`linked ${src} --> ${dest}`)
48
+ } catch (e) {
49
+ // Fallback to file copy
50
+ console.warn(`symlink failed (${e.message}), falling back to copy.`)
51
+ fs.copyFileSync(src, dest)
52
+ fs.chmodSync(dest, 0o755)
53
+ console.log(`copied ${src} --> ${dest}`)
54
+ }
55
+ }
56
+
57
+ const [srcBinary, destBinary] = srcDestBinaryPath()
58
+ linkOrCopy(srcBinary, destBinary)