blob: 875889c30cd6d5dd18d00c49597ac087ab160b3d (
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',
},
};
});
|