forked from uber-web/jazelle
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Leo Horie
authored and
Giancarlo Anemone
committed
Oct 30, 2020
1 parent
644d1d6
commit fb81721
Showing
3 changed files
with
17 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,19 @@ | ||
// @flow | ||
const {realpathSync: realpath, existsSync: exists} = require('fs'); | ||
const {execSync: exec} = require('child_process'); | ||
const {execSync: exec, spawnSync: spawn} = require('child_process'); | ||
const {dirname} = require('path'); | ||
const {yarn} = require('../utils/binary-paths.js'); | ||
|
||
const root = process.cwd(); | ||
const [node, , main, bin, ...args] = process.argv; | ||
|
||
if (exists(`${main}/node_modules/.bin/flow`)) { | ||
const files = exec(`find . -name output.tgz`, {cwd: bin, encoding: 'utf8'}) | ||
.split('\n') | ||
.filter(Boolean); | ||
files.map(f => { | ||
const target = `${root}/${dirname(f)}`; | ||
exec(`tar xzf "${f}" -C "${target}"`, {cwd: bin}); | ||
}); | ||
const files = exec(`find . -name output.tgz`, {cwd: bin, encoding: 'utf8'}) | ||
.split('\n') | ||
.filter(Boolean); | ||
files.map(f => { | ||
const target = `${root}/${dirname(f)}`; | ||
spawn('tar', ['xzf', f, '-C', target], {cwd: bin}); | ||
}); | ||
|
||
const params = args.map(arg => `'${arg}'`).join(' '); | ||
const cmd = `${node} ${main}/node_modules/.bin/flow ${params}`; | ||
const dir = dirname(realpath(`${main}/package.json`)); | ||
exec(cmd, {cwd: dir, env: process.env, stdio: 'inherit'}); | ||
} | ||
const dir = dirname(realpath(`${main}/package.json`)); | ||
spawn(node, [yarn, 'flow', ...args], {cwd: dir, env: process.env, stdio: 'inherit'}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters