
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
mkdir shell-git
yarn init -y
安装child_process,commander
yarn add commander
编辑package.json
{
"name": "shell-git",
"version": "1.0.0",
"main": "index.js",
"bin": {
"xxx-cli": "./index.js"
},
"repository": "git@github.com:wuhaohao1234/shell-git.git",
"author": "wuhaohao1234 <1611499758@qq.com>",
"license": "MIT",
"dependencies": {
"child_process": "^1.0.2",
"commander": "^6.1.0"
}
}
编写index.js
#!/usr/bin/env node
console.log('Hello, cli!')
const program = require('commander')
program
.version(require('./package').version, '-v, --version')
.command('init <name>')
.action((name) => {
console.log(name)
})
program.parse(process.argv)
这里npm必须切换为npm源
npm login
# 填写npm账号名
# 填写npm密码
# 填写npm邮箱
npm publish
全局安装shell-git
npm i -g shell-git
使用
xxx-cli -v
xxx-cli init xxx
yarn add shellljs
index.js修改为
#!/usr/bin/env node
const program = require("commander");
const exec = require("shelljs").exec;
program
.version(require("./package").version, "-v, --version")
.command("submit <msg>")
.action((msg) => {
exec("git add .");
console.log('添加文件到缓存区')
exec(`git commit -m ${msg}`);
console.log(`添加commit 为 ${msg}`)
exec(`git push`)
});
// .command('init <name>')
// .action((name) => {
// console.log(name)
// })
program.parse(process.argv);
package.json改为
{
"name": "shell-git",
"version": "1.0.1",
"main": "index.js",
"bin": {
"git-cli": "./index.js"
},
"repository": "git@github.com:wuhaohao1234/shell-git.git",
"author": "wuhaohao1234 <1611499758@qq.com>",
"license": "MIT",
"dependencies": {
"commander": "^6.1.0",
"shelljs": "^0.8.4"
}
}
这里记得每次修改升级npm version
然后卸载全局,重新发布,再重新安装
最后执行
git-cli submit 修改文档
FAQs
`mkdir shell-git`
We found that shell-git 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
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.