Last active
January 30, 2019 08:11
-
-
Save pxwise/c4833557930a5141c4e3c752347e2f2e to your computer and use it in GitHub Desktop.
Approximate `npm prune --production` using `yarn remove`
This file contains hidden or 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
/** | |
* Approximate `npm prune --production` using `yarn remove`. | |
* @see https://github.com/yarnpkg/yarn/issues/696 | |
*/ | |
const exec = require('child_process').exec; | |
const devDependencies = Object.keys(require('./package.json').devDependencies).join(' '); | |
const command = 'yarn remove ' + devDependencies; | |
const child = exec(command, (err, stdout, stderr) => { | |
if (err) throw err; | |
console.log(`stdout: \n${stdout}`); | |
console.log(`stderr: \n${stderr}`); | |
}); |
How to use this?
Here's a version that supports workspaces: https://gist.github.com/loopmode/318e881454dc0498874a4e764d3dce55
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@pxwise how is this called?
node ./yarn-prune.js
?