mirror of
https://github.com/pnpm/pnpm.git
synced 2026-04-28 02:53:15 -04:00
1
.aoeu/package.json
Normal file
1
.aoeu/package.json
Normal file
@@ -0,0 +1 @@
|
||||
{}
|
||||
@@ -18,6 +18,6 @@ module.exports = function obliterate (path) {
|
||||
}
|
||||
})
|
||||
.catch(err => {
|
||||
if (err !== 'ENOENT') throw err
|
||||
if (err.code !== 'ENOENT') throw err
|
||||
})
|
||||
}
|
||||
|
||||
@@ -4,16 +4,39 @@ var spawn = require('child_process').spawn
|
||||
var debug = require('debug')('pnpm:post_install')
|
||||
var delimiter = require('path').delimiter
|
||||
var byline = require('byline')
|
||||
var fs = require('mz/fs')
|
||||
|
||||
module.exports = function postInstall (root, pkg, log) {
|
||||
debug('postinstall', pkg)
|
||||
var scripts = pkg && pkg.scripts || {}
|
||||
return Promise.resolve()
|
||||
.then(_ => !scripts.install && checkBindingGyp(root, log))
|
||||
.then(_ => runScript(root, scripts.preinstall, log))
|
||||
.then(_ => runScript(root, scripts.install, log))
|
||||
.then(_ => runScript(root, scripts.postinstall, log))
|
||||
}
|
||||
|
||||
/*
|
||||
* Run node-gyp when binding.gyp is available. Only do this when there's no
|
||||
* `install` script (see `npm help scripts`).
|
||||
*/
|
||||
|
||||
function checkBindingGyp (root, log) {
|
||||
return fs.stat(join(root, 'binding.gyp'))
|
||||
.then(_ => runScript(root, 'node ' + nodeGypBin() + ' rebuild', log))
|
||||
.catch(err => {
|
||||
if (err.code !== 'ENOENT') throw err
|
||||
})
|
||||
}
|
||||
|
||||
/*
|
||||
* Returns the bin for node-gyp
|
||||
*/
|
||||
|
||||
function nodeGypBin () {
|
||||
return JSON.stringify(require.resolve('node-gyp/bin/node-gyp'))
|
||||
}
|
||||
|
||||
/*
|
||||
* Runs an npm script.
|
||||
*/
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
"meow": "3.7.0",
|
||||
"mkdirp": "0.5.1",
|
||||
"mz": "2.2.0",
|
||||
"node-gyp": "3.2.1",
|
||||
"node-uuid": "1.4.7",
|
||||
"npm-package-arg": "4.1.0",
|
||||
"object-assign": "4.0.1",
|
||||
|
||||
@@ -105,12 +105,17 @@ test('bundleDependencies (fsevents@1.0.6)', function (t) {
|
||||
}, t.end)
|
||||
})
|
||||
|
||||
test('compiled modules (fsevents@1.0.6)', function (t) {
|
||||
test('compiled modules (ursa@0.9.1)', function (t) {
|
||||
if (!process.env.CI) {
|
||||
t.skip('only ran on CI')
|
||||
return t.end()
|
||||
}
|
||||
|
||||
prepare()
|
||||
install({ input: ['fsevents@1.0.6'], flags: { quiet: true } })
|
||||
install({ input: ['ursa@0.9.1'], flags: { quiet: true } })
|
||||
.then(function () {
|
||||
var fsevents = require(join(process.cwd(), 'node_modules', 'fsevents'))
|
||||
t.ok(typeof fsevents === 'function', 'fsevents() is available')
|
||||
var ursa = require(join(process.cwd(), 'node_modules', 'ursa'))
|
||||
t.ok(typeof ursa === 'object', 'ursa() is available')
|
||||
t.end()
|
||||
}, t.end)
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user