1688-cli 0.1.2 → 0.1.3
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 +8 -0
- package/package.json +1 -1
- package/scripts/postinstall.mjs +22 -0
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,14 @@
|
|
|
3
3
|
All notable changes to this project are documented here.
|
|
4
4
|
This project follows [Semantic Versioning](https://semver.org/).
|
|
5
5
|
|
|
6
|
+
## [0.1.3] - 2026-05-13
|
|
7
|
+
|
|
8
|
+
### Fixed
|
|
9
|
+
- Postinstall: stop any running daemon during `npm i -g 1688-cli` so the next
|
|
10
|
+
command auto-starts a fresh daemon running the new code. Previously the
|
|
11
|
+
long-lived daemon kept serving the old code after an upgrade until the user
|
|
12
|
+
ran `1688 daemon stop` manually.
|
|
13
|
+
|
|
6
14
|
## [0.1.2] - 2026-05-13
|
|
7
15
|
|
|
8
16
|
### Fixed
|
package/package.json
CHANGED
package/scripts/postinstall.mjs
CHANGED
|
@@ -17,6 +17,28 @@ if (process.env.CI || process.env.BB1688_SKIP_POSTINSTALL) {
|
|
|
17
17
|
process.exit(0);
|
|
18
18
|
}
|
|
19
19
|
|
|
20
|
+
// ── 0. Stop any running daemon so it restarts with the new code ───────────
|
|
21
|
+
// Otherwise the old daemon keeps serving stale code until the user runs
|
|
22
|
+
// `1688 daemon stop` manually after every upgrade.
|
|
23
|
+
try {
|
|
24
|
+
const pidFile = path.join(os.homedir(), '.1688', 'daemon.pid');
|
|
25
|
+
if (fs.existsSync(pidFile)) {
|
|
26
|
+
const pid = parseInt(fs.readFileSync(pidFile, 'utf8').trim(), 10);
|
|
27
|
+
if (Number.isInteger(pid) && pid > 0) {
|
|
28
|
+
try {
|
|
29
|
+
process.kill(pid, 'SIGTERM');
|
|
30
|
+
console.log(
|
|
31
|
+
`1688-cli: stopped previous daemon (pid ${pid}); it will auto-start with the new code on next command.`,
|
|
32
|
+
);
|
|
33
|
+
} catch {
|
|
34
|
+
// Process already dead or owned by another user — harmless.
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
} catch {
|
|
39
|
+
/* ignore */
|
|
40
|
+
}
|
|
41
|
+
|
|
20
42
|
// ── 1. System Chrome detection ────────────────────────────────────────────
|
|
21
43
|
function hasSystemChrome() {
|
|
22
44
|
const candidates = {
|