@k-msg/cli 0.1.1 → 0.2.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/CHANGELOG.md +7 -0
- package/bin/k-msg.js +49 -40
- package/package.json +5 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
# @k-msg/cli
|
|
2
2
|
|
|
3
|
+
## 0.2.0 — 2026-02-15
|
|
4
|
+
|
|
5
|
+
### Minor changes
|
|
6
|
+
|
|
7
|
+
- [67c2d28](https://github.com/k-otp/k-msg/commit/67c2d28e0232276e105ff0bcbef5b544990a5e5f) Publish `@k-msg/cli` to npm as a lightweight Node launcher that downloads and runs
|
|
8
|
+
the `bunli build:all` native binaries from GitHub Releases (OIDC publish in CI). — Thanks @imjlk!
|
|
9
|
+
|
|
3
10
|
## 0.1.1 — 2026-02-15
|
|
4
11
|
|
|
5
12
|
### Patch changes
|
package/bin/k-msg.js
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
+
|
|
2
3
|
/* eslint-disable no-console */
|
|
3
4
|
|
|
4
|
-
import { createHash } from "node:crypto";
|
|
5
5
|
import { spawnSync } from "node:child_process";
|
|
6
|
+
import { createHash } from "node:crypto";
|
|
6
7
|
import fs from "node:fs";
|
|
8
|
+
import { get as httpsGet } from "node:https";
|
|
7
9
|
import os from "node:os";
|
|
8
10
|
import path from "node:path";
|
|
9
11
|
import { fileURLToPath } from "node:url";
|
|
10
|
-
import { get as httpsGet } from "node:https";
|
|
11
12
|
import { gunzipSync } from "node:zlib";
|
|
12
13
|
|
|
13
14
|
function pkgRoot() {
|
|
@@ -59,50 +60,58 @@ function cacheBaseDir() {
|
|
|
59
60
|
|
|
60
61
|
function downloadText(url) {
|
|
61
62
|
return new Promise((resolve, reject) => {
|
|
62
|
-
const req = httpsGet(
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
res.
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
63
|
+
const req = httpsGet(
|
|
64
|
+
url,
|
|
65
|
+
{ headers: { "User-Agent": "@k-msg/cli" } },
|
|
66
|
+
(res) => {
|
|
67
|
+
const status = res.statusCode || 0;
|
|
68
|
+
if (status >= 300 && status < 400 && res.headers.location) {
|
|
69
|
+
const redirected = new URL(res.headers.location, url).toString();
|
|
70
|
+
res.resume();
|
|
71
|
+
downloadText(redirected).then(resolve, reject);
|
|
72
|
+
return;
|
|
73
|
+
}
|
|
74
|
+
if (status !== 200) {
|
|
75
|
+
res.resume();
|
|
76
|
+
reject(new Error(`GET ${url} failed (status=${status})`));
|
|
77
|
+
return;
|
|
78
|
+
}
|
|
79
|
+
res.setEncoding("utf8");
|
|
80
|
+
let data = "";
|
|
81
|
+
res.on("data", (chunk) => (data += chunk));
|
|
82
|
+
res.on("end", () => resolve(data));
|
|
83
|
+
},
|
|
84
|
+
);
|
|
80
85
|
req.on("error", reject);
|
|
81
86
|
});
|
|
82
87
|
}
|
|
83
88
|
|
|
84
89
|
function downloadToFile(url, destPath) {
|
|
85
90
|
return new Promise((resolve, reject) => {
|
|
86
|
-
const req = httpsGet(
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
res.
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
91
|
+
const req = httpsGet(
|
|
92
|
+
url,
|
|
93
|
+
{ headers: { "User-Agent": "@k-msg/cli" } },
|
|
94
|
+
(res) => {
|
|
95
|
+
const status = res.statusCode || 0;
|
|
96
|
+
if (status >= 300 && status < 400 && res.headers.location) {
|
|
97
|
+
const redirected = new URL(res.headers.location, url).toString();
|
|
98
|
+
res.resume();
|
|
99
|
+
downloadToFile(redirected, destPath).then(resolve, reject);
|
|
100
|
+
return;
|
|
101
|
+
}
|
|
102
|
+
if (status !== 200) {
|
|
103
|
+
res.resume();
|
|
104
|
+
reject(new Error(`GET ${url} failed (status=${status})`));
|
|
105
|
+
return;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
fs.mkdirSync(path.dirname(destPath), { recursive: true });
|
|
109
|
+
const file = fs.createWriteStream(destPath);
|
|
110
|
+
res.pipe(file);
|
|
111
|
+
file.on("finish", () => file.close(resolve));
|
|
112
|
+
file.on("error", reject);
|
|
113
|
+
},
|
|
114
|
+
);
|
|
106
115
|
req.on("error", reject);
|
|
107
116
|
});
|
|
108
117
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@k-msg/cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "k-msg CLI (prebuilt binaries via GitHub Releases)",
|
|
6
6
|
"type": "module",
|
|
@@ -44,5 +44,9 @@
|
|
|
44
44
|
"messaging",
|
|
45
45
|
"kakao"
|
|
46
46
|
],
|
|
47
|
+
"repository": {
|
|
48
|
+
"type": "git",
|
|
49
|
+
"url": "https://github.com/k-otp/k-msg"
|
|
50
|
+
},
|
|
47
51
|
"license": "MIT"
|
|
48
52
|
}
|