@mdvp/cli 1.10.0 → 1.11.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/cli.mjs +9 -2
- package/package.json +1 -1
package/cli.mjs
CHANGED
|
@@ -360,8 +360,15 @@ async function cmdHire(opts) {
|
|
|
360
360
|
await download(extractUrl, `${dir}/extract.js`)
|
|
361
361
|
.catch(() => {})
|
|
362
362
|
|
|
363
|
-
|
|
364
|
-
|
|
363
|
+
writeFileSync(`${dir}/package.json`, '{"type":"module","dependencies":{"puppeteer":"*"}}')
|
|
364
|
+
|
|
365
|
+
const needsInstall = !existsSync(`${dir}/node_modules/puppeteer`)
|
|
366
|
+
if (needsInstall) {
|
|
367
|
+
process.stderr.write(`${DIM}Installing puppeteer (first run, ~30s)...${R}\n`)
|
|
368
|
+
await new Promise((res, rej) => {
|
|
369
|
+
const child = spawn("npm", ["install", "--prefer-offline"], { cwd: dir, stdio: "inherit" })
|
|
370
|
+
child.on("exit", (code) => code === 0 ? res() : rej(new Error(`npm install failed (${code})`)))
|
|
371
|
+
})
|
|
365
372
|
}
|
|
366
373
|
|
|
367
374
|
const apiUrl = local ? "http://localhost:7227" : API
|