diff options
Diffstat (limited to 'server.prepare.ts')
| -rw-r--r-- | server.prepare.ts | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/server.prepare.ts b/server.prepare.ts new file mode 100644 index 0000000..a858e69 --- /dev/null +++ b/server.prepare.ts @@ -0,0 +1,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', + }, + } +})
\ No newline at end of file |
