mirror of
https://github.com/tusen-ai/naive-ui.git
synced 2025-01-30 12:52:43 +08:00
build: post changelog to dingtalk script
This commit is contained in:
parent
ea4b3afe80
commit
3120750135
@ -22,6 +22,7 @@
|
|||||||
"test:cov": "cross-env NODE_ENV=test jest",
|
"test:cov": "cross-env NODE_ENV=test jest",
|
||||||
"test:watch": "cross-env NODE_ENV=test jest ---watch --verbose --coverage",
|
"test:watch": "cross-env NODE_ENV=test jest ---watch --verbose --coverage",
|
||||||
"gen-version": "node scripts/gen-version",
|
"gen-version": "node scripts/gen-version",
|
||||||
|
"post-changelog": "node scripts/post-changelog",
|
||||||
"build:site:ts": "./scripts/pre-build-site/pre-build-site.sh && cross-env TUSIMPLE=true NODE_ENV=production NODE_OPTIONS=--max-old-space-size=4096 vite build && ./scripts/post-build-site/post-build-site.sh"
|
"build:site:ts": "./scripts/pre-build-site/pre-build-site.sh && cross-env TUSIMPLE=true NODE_ENV=production NODE_OPTIONS=--max-old-space-size=4096 vite build && ./scripts/post-build-site/post-build-site.sh"
|
||||||
},
|
},
|
||||||
"author": "07akioni",
|
"author": "07akioni",
|
||||||
@ -96,11 +97,13 @@
|
|||||||
"express": "^4.17.1",
|
"express": "^4.17.1",
|
||||||
"fs-extra": "^10.0.0",
|
"fs-extra": "^10.0.0",
|
||||||
"husky": "^4.3.5",
|
"husky": "^4.3.5",
|
||||||
|
"inquirer": "^6.5.2",
|
||||||
"jest": "^27.0.4",
|
"jest": "^27.0.4",
|
||||||
"lint-staged": "^11.0.0",
|
"lint-staged": "^11.0.0",
|
||||||
"marked": "^2.0.1",
|
"marked": "^2.0.1",
|
||||||
"prettier": "^2.2.1",
|
"prettier": "^2.2.1",
|
||||||
"rimraf": "^3.0.2",
|
"rimraf": "^3.0.2",
|
||||||
|
"superagent": "^6.1.0",
|
||||||
"typescript": "^4.3.2",
|
"typescript": "^4.3.2",
|
||||||
"vite": "^2.1.3"
|
"vite": "^2.1.3"
|
||||||
},
|
},
|
||||||
|
46
scripts/post-changelog.js
Normal file
46
scripts/post-changelog.js
Normal file
@ -0,0 +1,46 @@
|
|||||||
|
const request = require('superagent')
|
||||||
|
const fs = require('fs')
|
||||||
|
const path = require('path')
|
||||||
|
const inquirer = require('inquirer')
|
||||||
|
|
||||||
|
const { DINGTALK_TOKEN } = process.env
|
||||||
|
|
||||||
|
if (!DINGTALK_TOKEN) {
|
||||||
|
console.log('No DINGTALK_TOKEN in your env.')
|
||||||
|
process.exit(0)
|
||||||
|
}
|
||||||
|
|
||||||
|
const changelog = fs
|
||||||
|
.readFileSync(path.resolve(__dirname, '../CHANGELOG.zh-CN.md'), 'utf-8')
|
||||||
|
.split(/^## /gm)[1]
|
||||||
|
.replace(/^##/gm, '')
|
||||||
|
|
||||||
|
const message = `变更日志 ${changelog}`
|
||||||
|
|
||||||
|
inquirer
|
||||||
|
.prompt([
|
||||||
|
{
|
||||||
|
type: 'confirm',
|
||||||
|
name: 'post-changelog',
|
||||||
|
message: `发布以下变更日志到钉钉群:\n\n${message}`
|
||||||
|
}
|
||||||
|
])
|
||||||
|
.then((ans) => {
|
||||||
|
if (ans['post-changelog']) {
|
||||||
|
request
|
||||||
|
.post('https://oapi.dingtalk.com/robot/send')
|
||||||
|
.query({
|
||||||
|
access_token: DINGTALK_TOKEN
|
||||||
|
})
|
||||||
|
.type('application/json')
|
||||||
|
.send({
|
||||||
|
msgtype: 'text',
|
||||||
|
text: {
|
||||||
|
content: message
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.then((res) => {
|
||||||
|
console.log(res.text)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
Loading…
Reference in New Issue
Block a user