
Security News
Axios Supply Chain Attack Reaches OpenAI macOS Signing Pipeline, Forces Certificate Rotation
OpenAI rotated macOS signing certificates after a malicious Axios package reached its CI pipeline in a broader software supply chain attack.
一步完成文件的复制和提交(git)
前后端分离的开发过程中, 每次前端将静态资源文件上传到 CDN 之后, 还需要将页面放置到后端项目的目录中, 然后再提交到 git.
因此每次都需要重复的执行: pull -> copy -> add -> commit -> push, 整个过程很是繁琐.
对于重复的工作, 很懒的我们肯定是需要自动化工具代劳之.

需要先安装好 Git
全局安装使用
npm install copy-push -g
cd fe-project
copy-push --destRoot=../backend-project --destDir=dir
也可以局部安装, 配置在 npm scripts 中来使用
cd fe-project
npm install copy-push --save-dev
"scripts": {
"copy-push": "copy-push --repoUrl=http://gitlab.com/xxx/backend-project.git --destRoot=../backend-project --destDir=dir"
}
npm run copy-push
做为模块使用
npm install copy-push --save-dev
cd fe-project
// fe-project/copy-push.js
var copyPush = require('copy-push');
var repoUrl = 'http://gitlab.com/xxx/backend-project.git';
var destRoot = '../backend-project';
var destDir = 'dir';
copyPush(destRoot, { // 详见参数说明
repoUrl: repoUrl,
destDir: destDir
});
全局安装使用时, 可以运行 copy-push --help 来查看参数说明
| 参数 | 说明 | 默认值 | 是否必选 |
|---|---|---|---|
| repoUrl | 远程仓库的 URL | ||
| destRoot | 复制文件到哪个项目(git项目的根目录) | 是 | |
| src | 需要复制的文件(glob) | ./dist/**/*.html | |
| destDir | 复制文件到哪个目录(相对于 destRoot 目录) | src/main/webapp/views | |
| remote | 远程仓库 | origin | |
| branch | 分支名 | master | |
| message | 提交信息 | sync [./dist/**/*.html] ${远端项目名}:${当前分支名} ${最近一次的提交日志} |
repoUrl 参考推荐使用 SSH 的 URLFAQs
clone & copy & push: clone -> pull -> copy -> add -> commit -> push
We found that copy-push demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
OpenAI rotated macOS signing certificates after a malicious Axios package reached its CI pipeline in a broader software supply chain attack.

Security News
Open source is under attack because of how much value it creates. It has been the foundation of every major software innovation for the last three decades. This is not the time to walk away from it.

Security News
Socket CEO Feross Aboukhadijeh breaks down how North Korea hijacked Axios and what it means for the future of software supply chain security.