npm-shell

1.0.11 • Public • Published

npm-shell

NPM version

一、简介篇

通过nodejs执行npm相关命令的工具

二、安装篇

npm install npm-shell

三、使用篇

 
const Npm = require('npm-shell');
 
const npm = new Npm(projectRoot);
 
//npm install
npm.install();
npm.install('react-native');
 
//npm uninstall
npm.unInstall('xxx')
 
//npm publish
npm.publish();
 
//npm start
npm.start();
 
//npm run command
npm.run('build');
npm.run('compile');
 
//npm execute node_modules bin
npm.exec('webpack',['--cofnig','./webpack.config.js'])
//with env
npm.exec('webpack',['--cofnig','./webpack.config.js'],{NODE_ENV:'production'})
 
//node xxx.js
npm.node('./test.js',['arg1','arg2'])
//with env
npm.node('./test.js',['arg1','arg2'],{NOdE_ENV:'production'});
 
//npm xxx
npm.command('install','react-native');
npm.command('test');
npm.command('link','xx')
//with env
npm.command('link','xx',{NODE_ENV:'xxx'})
npm.command('link','xx','xx'....,{NODE_ENV:'xxx'})
 
//execute shell command
npm.shell('react-native',['link','xx'],{NODE_ENV:'xxx'})
 

四、开源许可

基于 MIT License 开源,使用代码只需说明来源,或者引用 license.txt 即可。

Readme

Keywords

Package Sidebar

Install

npm i npm-shell

Weekly Downloads

6

Version

1.0.11

License

MIT

Unpacked Size

5.51 kB

Total Files

3

Last publish

Collaborators

  • beven