Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ensure correct tmpdir is used for install-native #30855

Merged
merged 3 commits into from
Nov 3, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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