diff --git a/index.js b/index.js new file mode 100644 index 0000000000..4b0d91ca83 --- /dev/null +++ b/index.js @@ -0,0 +1,10 @@ +var pnpm = {} + +Object.defineProperty(pnpm, 'install', { + enumerable: true, + get: function () { + return require('./lib/cmd/install') + } +}) + +module.exports = pnpm diff --git a/lib/cmd/install.js b/lib/cmd/install.js index d322ac05cd..f941a36313 100644 --- a/lib/cmd/install.js +++ b/lib/cmd/install.js @@ -21,7 +21,7 @@ function installCmd (input, flags) { var pkg var packagesToInstall var installType - var isProductionInstall = cli.flags.production || process.env.NODE_ENV === 'production' + var isProductionInstall = flags.production || process.env.NODE_ENV === 'production' return readPkgUp() .then(_ => { pkg = _ }) diff --git a/test/index.js b/test/index.js index 3e972be9c3..155c453ca6 100644 --- a/test/index.js +++ b/test/index.js @@ -3,7 +3,7 @@ var join = require('path').join var fs = require('fs') var prepare = require('./support/prepare') var basicPackageJson = require('./support/simple-package.json') -var install = require('../lib/cmd/install') +var install = require('../index').install require('./support/sepia') var stat, _ @@ -249,7 +249,7 @@ test('production install (with --production flag)', function (t) { prepare() fs.writeFileSync('package.json', JSON.stringify(basicPackageJson), 'utf-8') - return install({ input: [], flags: { quiet: true, production: true } }) + return install([], { quiet: true, production: true }) .then(function () { var rimrafDir = fs.statSync(join(process.cwd(), 'node_modules', 'rimraf')) @@ -271,7 +271,7 @@ test('production install (with production NODE_ENV)', function (t) { prepare() fs.writeFileSync('package.json', JSON.stringify(basicPackageJson), 'utf-8') - return install({ input: [], flags: { quiet: true } }) + return install([], { quiet: true }) .then(function () { // reset NODE_ENV process.env.NODE_ENV = originalNODE_ENV