-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
upgrade.js
25 lines (20 loc) · 1.07 KB
/
upgrade.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
const fs = require('fs')
const { execSync } = require('child_process')
const root = fs.readFileSync('./package.json', 'utf-8')
const rootObj = JSON.parse(root)
rootObj.version = process.argv[2]
fs.writeFileSync('./package.json', JSON.stringify(rootObj, null, 2))
const api = fs.readFileSync('./api/package.json', 'utf-8')
const apiObj = JSON.parse(api)
apiObj.version = process.argv[2]
fs.writeFileSync('./api/package.json', JSON.stringify(apiObj, null, 2))
// execSync('cd ./server && yarn install && cd ..')
const web = fs.readFileSync('./web/package.json', 'utf-8')
const webObj = JSON.parse(web)
webObj.version = process.argv[2]
fs.writeFileSync('./web/package.json', JSON.stringify(webObj, null, 2))
// execSync('cd ./web && yarn install && cd ..')
const webVersion = fs.readFileSync('./web/src/utils/Constant.ts', 'utf-8')
fs.writeFileSync('./web/src/utils/Constant.ts', webVersion.replace(/export const VERSION \= \'.*\'/, `export const VERSION = '${process.argv[2]}'`))
execSync('yarn install && yarn workspaces run build')
execSync(`git add . && git commit -m "${process.argv[2]}"`)