Skip to content

Commit

Permalink
feat(install): support install scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
watilde committed Aug 2, 2017
1 parent 7eec860 commit 6f8bd84
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
7 changes: 7 additions & 0 deletions lib/install/installer.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ const git = require('./installer/git')
const local = require('./installer/local')
const remote = require('./installer/remote')
const registry = require('./installer/registry')
const runner = require('../run/runner')

const installer = (dep, deps, base, resolve, reject) => {
mkdirp.sync(nm)
Expand Down Expand Up @@ -40,6 +41,12 @@ const installer = (dep, deps, base, resolve, reject) => {
}

fetch.then(() => {
return new Promise((resolve, reject) => {
const args = ['install']
const pkg = require(path.join(target, 'package.json'))
runner(args, pkg).then(resolve).catch(reject)
})
}).then(() => {
global.dependenciesCount += 1
bin(dep, target)
if (fs.existsSync(path.join(target, 'binding.gyp'))) {
Expand Down
2 changes: 1 addition & 1 deletion lib/run/runner.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ module.exports = (_, pkg) => {
var newPath = npmPath.getSync({})
env[npmPath.PATH] = newPath

Promise.resolve(cmds).then(each((item) => {
return Promise.resolve(cmds).then(each((item) => {
return new Promise((resolve, reject) => {
const cmd = item.shift()
const script = spawn(cmd, args.concat(item), {env: env})
Expand Down

0 comments on commit 6f8bd84

Please sign in to comment.