blessing-skin-server/scripts/commitish.ts
2019-05-07 17:04:45 +08:00

21 lines
557 B
TypeScript

import childProcess from 'child_process'
import util from 'util'
import fs from 'fs'
(async () => {
const [manifest, commit]: [object & { commit: string }, string] = await Promise.all([
util
.promisify(fs.readFile)('./public/app/manifest.json', 'utf8')
.then(JSON.parse),
util
.promisify(childProcess.exec)('git log --pretty=%H -1')
.then(value => value.stdout.trim()),
])
manifest.commit = commit
await util.promisify(fs.writeFile)(
'./public/app/manifest.json',
JSON.stringify(manifest, null, 2)
)
})()