Skip to content

Commit

Permalink
Ensure correct tmpdir is used for install-native (#30855)
Browse files Browse the repository at this point in the history
* Ensure correct tmpdir is used for install-native

* Use execa for Windows

* lint-fix
  • Loading branch information
ijjk committed Nov 3, 2021
1 parent 507ac98 commit 3aff5d4
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions scripts/install-native.mjs
Original file line number Diff line number Diff line change
@@ -1,14 +1,10 @@
import { execFile } from 'child_process'
import fs from 'fs-extra'
import os from 'os'
import path from 'path'
import util from 'util'

const exec = util.promisify(execFile)

import execa from 'execa'
import fs from 'fs-extra'
;(async function () {
try {
let tmpdir = os.tmpdir() + `next-swc-${Date.now()}`
let tmpdir = path.join(os.tmpdir(), `next-swc-${Date.now()}`)
await fs.ensureDir(tmpdir)
let cwd = process.cwd()
let pkgJson = {
Expand All @@ -32,7 +28,7 @@ const exec = util.promisify(execFile)
path.join(tmpdir, 'package.json'),
JSON.stringify(pkgJson)
)
let { stdout } = await exec('yarn', ['--force'], { cwd: tmpdir })
let { stdout } = await execa('yarn', ['--force'], { cwd: tmpdir })
console.log(stdout)
let pkgs = await fs.readdir(path.join(tmpdir, 'node_modules/@next'))
await fs.ensureDir(path.join(cwd, 'node_modules/@next'))
Expand Down

0 comments on commit 3aff5d4

Please sign in to comment.