my-durable 0.0.8 → 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/bin/dpi.mjs +13 -1
- package/package.json +1 -1
package/bin/dpi.mjs
CHANGED
|
@@ -100,6 +100,10 @@ if (command === "update" || command === "upgrade") {
|
|
|
100
100
|
});
|
|
101
101
|
if (!res.ok) throw new Error(`registry responded ${res.status}`);
|
|
102
102
|
latest = (await res.json()).version;
|
|
103
|
+
// This string is later interpolated into a command line (shell on Windows):
|
|
104
|
+
// anything that is not a plain semver must stop the update, not run.
|
|
105
|
+
if (!/^\d+\.\d+\.\d+(-[0-9A-Za-z.]+)?$/.test(String(latest)))
|
|
106
|
+
throw new Error(`registry returned a malformed version: ${latest}`);
|
|
103
107
|
} catch (error) {
|
|
104
108
|
process.stderr.write(`dpi update: cannot reach the npm registry (${error.message})\n`);
|
|
105
109
|
process.exit(1);
|
|
@@ -132,7 +136,15 @@ if (command === "update" || command === "upgrade") {
|
|
|
132
136
|
process.exit(0);
|
|
133
137
|
}
|
|
134
138
|
|
|
135
|
-
|
|
139
|
+
// Windows: npm is npm.cmd and cmd.exe only executes batch files through a
|
|
140
|
+
// shell — a bare spawn("npm") dies with ENOENT (CreateProcess does no
|
|
141
|
+
// PATHEXT resolution). Args are literals plus the strictly-validated
|
|
142
|
+
// version above, so shell: true has no injection surface here.
|
|
143
|
+
const onWindows = process.platform === "win32";
|
|
144
|
+
const child = spawn(onWindows ? "npm.cmd" : "npm", ["install", "-g", `my-durable@${latest}`], {
|
|
145
|
+
stdio: "inherit",
|
|
146
|
+
shell: onWindows,
|
|
147
|
+
});
|
|
136
148
|
child.on("error", (error) => {
|
|
137
149
|
process.stderr.write(`dpi update: cannot run npm (${error.message})\n`);
|
|
138
150
|
process.exit(1);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "my-durable",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.9",
|
|
4
4
|
"description": "Durable Pi \u2014 the durable agent network: hub web UI, device backend daemon, TUI admin and the shared SDK, packaged as one runnable monorepo install",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|