Append commit information at build time
This commit is contained in:
parent
4e5276ca87
commit
7d37bc6cb1
@ -31,6 +31,7 @@ class AppServiceProvider extends ServiceProvider
|
||||
Event::listen(Events\RenderingHeader::class, function ($event) {
|
||||
$blessing = [
|
||||
'version' => config('app.version'),
|
||||
'commit' => app('webpack')->commit,
|
||||
'locale' => config('app.locale'),
|
||||
'fallback_locale' => config('app.fallback_locale'),
|
||||
'base_url' => url('/'),
|
||||
|
@ -11,7 +11,7 @@
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"dev": "webpack-dev-server",
|
||||
"build": "rimraf public/app && webpack --mode=production -p",
|
||||
"build": "rimraf public/app && webpack --mode=production -p && node --experimental-modules scripts/commitish.mjs",
|
||||
"lint": "eslint --ext=.js,.vue,.ts -f=beauty .",
|
||||
"test": "tsc -p . && jest",
|
||||
"codecov": "codecov -F js"
|
||||
|
@ -5,6 +5,7 @@
|
||||
## Tweaked
|
||||
|
||||
- Tweaked UI text.
|
||||
- Appended commit information at build time.
|
||||
|
||||
## Fixed
|
||||
|
||||
|
@ -5,6 +5,7 @@
|
||||
## 调整
|
||||
|
||||
- 调整部分 UI 文本
|
||||
- 构建时附加 commit 信息
|
||||
|
||||
## 修复
|
||||
|
||||
|
15
scripts/commitish.mjs
Normal file
15
scripts/commitish.mjs
Normal file
@ -0,0 +1,15 @@
|
||||
import childProcess from 'child_process'
|
||||
import util from 'util'
|
||||
import fs from 'fs'
|
||||
|
||||
(async () => {
|
||||
const [manifest, commit] = 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))
|
||||
})()
|
Loading…
Reference in New Issue
Block a user