This repository has been archived by the owner on Jul 22, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(compatibility): Refactor for compatibility with node v4 (#4)
- Loading branch information
1 parent
a8715a0
commit 14423d6
Showing
7 changed files
with
29 additions
and
35 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,3 +3,4 @@ cache: yarn | |
node_js: | ||
- '7' | ||
- '6' | ||
- '4' |
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,16 +1,18 @@ | ||
#!/usr/bin/env node | ||
|
||
const { spawn } = require('child_process') | ||
const { bin, cwd, args, isYarn, isNPM } = require('./index') | ||
'use strict' | ||
|
||
if (!isYarn && !isNPM) { | ||
const spawn = require('child_process').spawn | ||
const nyr = require('./index') | ||
|
||
if (!nyr.isYarn && !nyr.isNPM) { | ||
throw new Error('Expected to be launched from either npm or yarn.') | ||
} | ||
|
||
if (args.length < 2) { | ||
if (nyr.args.length < 2) { | ||
throw new Error('Expected at least one argument with what script to run.') | ||
} | ||
|
||
const child = spawn(bin, args, { cwd, stdio: 'inherit' }) | ||
const child = spawn(nyr.bin, nyr.args, { cwd: nyr.cwd, stdio: 'inherit' }) | ||
|
||
child.on('exit', code => process.exit(code)) |
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
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,8 +1,8 @@ | ||
const assert = require('assert') | ||
const { bin, args, cwd, isYarn, isNPM } = require('../index') | ||
const nyr = require('../index') | ||
|
||
assert(bin.endsWith('npm-cli.js'), `'bin' is '${bin}'`) | ||
assert(args.indexOf('run') === 0, `'args' is '${args}'`) | ||
assert(cwd === process.cwd(), `'cwd' is '${cwd}'`) | ||
assert(isYarn === false, `'isYarn' is '${isYarn}'`) | ||
assert(isNPM === true, `'isNPM' is '${isNPM}'`) | ||
assert(nyr.bin.endsWith('npm-cli.js'), `'bin' is '${nyr.bin}'`) | ||
assert(nyr.args.indexOf('run') === 0, `'args' is '${nyr.args}'`) | ||
assert(nyr.cwd === process.cwd(), `'cwd' is '${nyr.cwd}'`) | ||
assert(nyr.isYarn === false, `'isYarn' is '${nyr.isYarn}'`) | ||
assert(nyr.isNPM === true, `'isNPM' is '${nyr.isNPM}'`) |
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,8 +1,8 @@ | ||
const assert = require('assert') | ||
const { bin, args, cwd, isYarn, isNPM } = require('../index') | ||
const nyr = require('../index') | ||
|
||
assert(bin.endsWith('yarn.js'), `'bin' is '${bin}'`) | ||
assert(args.indexOf('run') === 0, `'args' is '${args}'`) | ||
assert(cwd === process.cwd(), `'cwd' is '${cwd}'`) | ||
assert(isYarn === true, `'isYarn' is '${isYarn}'`) | ||
assert(isNPM === false, `'isNPM' is '${isNPM}'`) | ||
assert(nyr.bin.endsWith('yarn.js'), `'bin' is '${nyr.bin}'`) | ||
assert(nyr.args.indexOf('run') === 0, `'args' is '${nyr.args}'`) | ||
assert(nyr.cwd === process.cwd(), `'cwd' is '${nyr.cwd}'`) | ||
assert(nyr.isYarn === true, `'isYarn' is '${nyr.isYarn}'`) | ||
assert(nyr.isNPM === false, `'isNPM' is '${nyr.isNPM}'`) |