# git-npm-auto-publish **Repository Path**: liu_gui/git-npm-auto-publish ## Basic Information - **Project Name**: git-npm-auto-publish - **Description**: npm 自动发布,附带git提交 - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2023-05-12 - **Last Updated**: 2026-03-16 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # git-npm-auto-publish ### npm自动发布 ## 配置 ### 推送配置 ### 在项目根目录(即package.json同级目录)创建名称为npm.auto.publish.js文件 ``` javascript module.exports = { git: 'git add .; git commit -m "${commit}"; git push origin master', publish: 'npm publish', /* npm相关配置建议在全局配置,如果配置在此处建议添加git忽略 */ /* 全局配置参考 插件NPM全局配置 */ username: '', // npm 用户名 password: '', // npm 密码 email: '' // npm Email } ``` ### 插件NPM全局配置 ### 此全局配置为插件级别配置,与npm配置无关 ``` shell 命令名称 git-npm-auto-publish 帮助 git-npm-auto-publish --help 查看npm配置 git-npm-auto-publish --config get 配置结果:{ username: 'pdjxeyg5428', password: '123456', email: '11111111@qq.com' } 设置npm配置 git-npm-auto-publish --config set 删除npm配置 git-npm-auto-publish --config remove ``` ## 推送 ### 配置完 npm,及推送命令后,即可推送代码到npm及git ### 推送到npm请更新版本号,版本号需要手动更新 ``` shell 推送到npm及git git-npm-auto-publish --publish 'git初始化提交' // git的commit可省略,默认为commit字符串 单独推送到git git-npm-auto-publish --git 'git初始化提交' ``` ### npm 默认命令为 npm publish,可以在npm.auto.publish.js重写 publish 字段 ### git 没有默认命令 需要在npm.auto.publish.js配置 git 字段,如果缺省,则不进行git提交