ocx-cursor 0.3.0 → 0.3.1
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/ocx-cursor.mjs +1 -1
- package/package.json +1 -1
- package/src/install.mjs +17 -10
package/bin/ocx-cursor.mjs
CHANGED
package/package.json
CHANGED
package/src/install.mjs
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { execFileSync } from "node:child_process";
|
|
2
2
|
import { randomBytes } from "node:crypto";
|
|
3
|
-
import { access, chmod, copyFile, cp, lstat, mkdir, readFile, readlink, rename, rm, symlink, writeFile } from "node:fs/promises";
|
|
3
|
+
import { access, chmod, copyFile, cp, lstat, mkdir, mkdtemp, readFile, readlink, rename, rm, symlink, writeFile } from "node:fs/promises";
|
|
4
|
+
import { tmpdir } from "node:os";
|
|
4
5
|
import { dirname, join, resolve } from "node:path";
|
|
5
6
|
import { fileURLToPath } from "node:url";
|
|
6
7
|
import {
|
|
@@ -176,16 +177,22 @@ export async function installService() {
|
|
|
176
177
|
return { installRoot, launchAgentFile, cliLinkFile, secretStatus };
|
|
177
178
|
}
|
|
178
179
|
|
|
179
|
-
export function updateService(options = {}) {
|
|
180
|
+
export async function updateService(options = {}) {
|
|
180
181
|
const execute = options.execFileSync || execFileSync;
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
"
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
182
|
+
const ownsTemporaryDirectory = !options.temporaryDirectory;
|
|
183
|
+
const temporaryDirectory = options.temporaryDirectory || await mkdtemp(join(tmpdir(), "ocx-cursor-update-"));
|
|
184
|
+
try {
|
|
185
|
+
execute(options.npmCommand || "npm", [
|
|
186
|
+
"exec",
|
|
187
|
+
"--yes",
|
|
188
|
+
"--package=ocx-cursor@latest",
|
|
189
|
+
"--",
|
|
190
|
+
"ocx-cursor",
|
|
191
|
+
"install",
|
|
192
|
+
], { cwd: temporaryDirectory, stdio: "inherit" });
|
|
193
|
+
} finally {
|
|
194
|
+
if (ownsTemporaryDirectory) await rm(temporaryDirectory, { recursive: true, force: true });
|
|
195
|
+
}
|
|
189
196
|
}
|
|
190
197
|
|
|
191
198
|
export async function uninstallService() {
|