blob: a858e696f749bfd361ce78c7dc571ff908686633 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
import { execSync } from 'child_process';
import { defineNuxtPrepareHandler } from 'nuxt-prepare/config'
export default defineNuxtPrepareHandler(async () => {
const gitCommitHash = execSync('git rev-parse HEAD').toString().trim();
const gitCommitHashShort = gitCommitHash.slice(0, 8);
const gitBranch = execSync('git rev-parse --abbrev-ref HEAD').toString().trim();
return {
runtimeConfig: {
public: {
gitCommitHash: gitCommitHash,
gitCommitHashShort: gitCommitHashShort,
gitBranch: gitBranch
}
},
state: {
foo: 'bar',
},
}
})
|