npm shelljs
发布时间:2022-10-12 01:42:13 347 相关标签: # npm# git# 脚本
shelljs
可以直接执行shell脚本
//局部模式
var shell = require('shelljs');
//全局模式下,就不需要用shell开头了。
//require('shelljs/global');
if (shell.exec('npm run build').code !== 0) {//执行npm run build 命令
shell.echo('Error: Git commit failed');
shell.exit(1);
}
//由于我的用另外一个仓库存放dist目录,所以这里要将文件增量复制到目标目录。并切换到对应目录。
shell.cp ('-r', './dist/*', '../../Rychou');
shell.cd('../../Rychou');
shell.exec('git add .');
shell.exec("git commit -m 'autocommit'")
shell.exec('git push')
文章来源: https://blog.51cto.com/u_12836588/5742599
特别声明:以上内容(图片及文字)均为互联网收集或者用户上传发布,本站仅提供信息存储服务!如有侵权或有涉及法律问题请联系我们。
举报