mirror of
https://github.com/142vip/408CSFamily.git
synced 2026-04-03 10:38:38 +08:00
feat: 新增release发布脚本
This commit is contained in:
36
scripts/.exec
Executable file
36
scripts/.exec
Executable file
@@ -0,0 +1,36 @@
|
||||
#!/usr/bin/env node
|
||||
const {join} = require('path')
|
||||
const cwd = join(__dirname, '..')
|
||||
process.env.PATH = `${join(cwd, 'node_modules', '.bin')}:${process.env.PATH}`
|
||||
const {exec,exit} = require('shelljs');
|
||||
|
||||
|
||||
/**
|
||||
* 监听进程
|
||||
* - 退出进程
|
||||
*/
|
||||
process.on('exit', () => {
|
||||
exit()
|
||||
})
|
||||
|
||||
/**
|
||||
* 执行shell指令
|
||||
* @param commands
|
||||
*/
|
||||
exports.execShell = commands => {
|
||||
let runCommands=[]
|
||||
if(typeof commands ==='string'){
|
||||
runCommands.push(commands)
|
||||
}
|
||||
|
||||
// 批量执行
|
||||
if(Array.isArray(commands)){
|
||||
runCommands=commands
|
||||
}
|
||||
|
||||
for (const command of runCommands) {
|
||||
console.log(`------- command: >>> ${command} <<< start -------`)
|
||||
exec(command)
|
||||
console.log(`------- command: >>> ${command} <<< ending -------`)
|
||||
}
|
||||
}
|
||||
8
scripts/build
Normal file
8
scripts/build
Normal file
@@ -0,0 +1,8 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
const {execShell} = require("./.exec");
|
||||
const inquirer = require('inquirer');
|
||||
|
||||
(async ()=>{
|
||||
await execShell(['pnpm build','pnpm build:proxy'])
|
||||
})()
|
||||
27
scripts/release
Executable file
27
scripts/release
Executable file
@@ -0,0 +1,27 @@
|
||||
#!/usr/bin/env node
|
||||
/**
|
||||
* 版本发布脚本
|
||||
* 链接:https://jstools.dev/version-bump-prompt/
|
||||
* 使用: ./scripts/release
|
||||
*/
|
||||
|
||||
const {execShell} = require("./.exec");
|
||||
|
||||
|
||||
// 利用commit-and-tag-version生成changelog文档,并跳过commit、tag操作
|
||||
const generateChangeLog='pnpm commit-and-tag-version && git add CHANGELOG.md'
|
||||
// git提交信息
|
||||
const commitInfo='chore(release): publish v%s'
|
||||
|
||||
const releaseCommands=
|
||||
"bumpp " +
|
||||
"--preid alpha "+
|
||||
`--execute= "${generateChangeLog}" `+
|
||||
`--commit "${commitInfo}" `+
|
||||
"--all "+
|
||||
"--tag "+
|
||||
"--push "
|
||||
|
||||
;(async ()=>{
|
||||
await execShell(releaseCommands)
|
||||
})()
|
||||
7
scripts/test
Executable file
7
scripts/test
Executable file
@@ -0,0 +1,7 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
const {execShell} = require("./.exec");
|
||||
|
||||
(async ()=>{
|
||||
await execShell(['pnpm build','pnpm build:proxy'])
|
||||
})()
|
||||
Reference in New Issue
Block a user