Skip to content

Commit

Permalink
refactor(script): 把 version 跟 changelog 操作拆分开来
Browse files Browse the repository at this point in the history
  • Loading branch information
liuweiGL committed Jul 3, 2021
1 parent 28af01f commit c1480a7
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 23 deletions.
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,15 @@

# Changelog

## v1.3.2(2021-07-03)


### :beetle: Bug Fixes

1. [fix(script): 修复发包之前没有构建资源](https://github.com/liuweiGL/vite-plugin-mkcert/commit/dbd4b76) :point_right: ( [liuweigl](https://github.com/liuweigl) )



## v1.3.1(2021-07-03)


Expand Down
5 changes: 3 additions & 2 deletions packages/script/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,13 @@
"scripts": {
"build:plugin": "pnpm build --filter vite-plugin-mkcert",
"publish:plugin": "pnpm publish --filter vite-plugin-mkcert",
"changelog": "ts-node src/changelog.ts",
"github": "ts-node src/github.ts",
"release": "pnpm build:plugin && pnpm publish:plugin && pnpm github",
"version:beta": "ts-node src/version.ts prerelease beta",
"version:patch": "ts-node src/version.ts patch",
"version:minor": "ts-node src/version.ts minor",
"version:major": "ts-node src/version.ts major",
"github": "ts-node src/github.ts",
"release": "pnpm build:plugin && pnpm publish:plugin && pnpm github",
"release:beta": "pnpm version:beta && pnpm release",
"release:patch": "pnpm version:patch && pnpm release",
"release:minor": "pnpm version:minor && pnpm release",
Expand Down
12 changes: 5 additions & 7 deletions packages/script/src/changelog.ts
Original file line number Diff line number Diff line change
Expand Up @@ -116,12 +116,10 @@ ${tags
fs.writeFileSync(resolveRoot('CHANGELOG.md'), file, 'utf8')
}

export const updateChangeLog = () => {
const tagVersion = `v${getLatestVersion()}`
const tagVersion = `v${getLatestVersion()}`

generateChangeLogFile()
console.log('🎉:Changelog generate success!')
generateChangeLogFile()
console.log('🎉:Changelog generate success!')

tagGit(tagVersion)
console.log(`🎉:Git create tag ${tagVersion} success!`)
}
tagGit(tagVersion)
console.log(`🎉:Git create tag ${tagVersion} success!`)
22 changes: 8 additions & 14 deletions packages/script/src/version.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import path from 'path'
import semver from 'semver'
import { resolveRoot } from './util'
import config from './config.json'
import { updateChangeLog } from './changelog'

const { version: currentVersion } = config

Expand Down Expand Up @@ -55,19 +54,14 @@ const updateConfig = (version: string) => {
)
}

const updateVersion = () => {
let [, , releaseType, preid] = process.argv
const [, , releaseType, preid] = process.argv

const newVersion = getNewVersion({
releaseType: releaseType as semver.ReleaseType,
preid
})
const newVersion = getNewVersion({
releaseType: releaseType as semver.ReleaseType,
preid
})

updatePackage(newVersion)
updateConfig(newVersion)

console.log(`🎉:Update version success: ${currentVersion} => ${newVersion}`)
}
updatePackage(newVersion)
updateConfig(newVersion)

updateVersion()
updateChangeLog()
console.log(`🎉:Update version success: ${currentVersion} => ${newVersion}`)

0 comments on commit c1480a7

Please sign in to comment.