2024-04-11 15:02:27 +00:00
|
|
|
// @ts-check
|
2024-04-24 20:02:35 +00:00
|
|
|
import { spawn } from 'child_process'
|
2024-04-11 15:02:27 +00:00
|
|
|
|
2024-04-24 20:02:35 +00:00
|
|
|
const config = async (_phase, { _defaultConfig }) => {
|
|
|
|
const gitHash = await new Promise((resolve) => {
|
|
|
|
const git = spawn('git', ['rev-parse', '--short', 'HEAD'])
|
|
|
|
git.stdout.on('data', (data) => {
|
|
|
|
resolve(data.toString().trim())
|
|
|
|
})
|
2024-04-24 20:49:35 +00:00
|
|
|
git.on('error', () => {
|
|
|
|
resolve(undefined)
|
|
|
|
})
|
2024-04-24 20:02:35 +00:00
|
|
|
})
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @type {import('next').NextConfig}
|
|
|
|
*/
|
|
|
|
const nextConfig = {
|
|
|
|
publicRuntimeConfig: {
|
|
|
|
modifiedDate: new Date().toISOString(),
|
|
|
|
modifiedYear: new Date().getFullYear(),
|
|
|
|
gitHash,
|
|
|
|
},
|
|
|
|
}
|
|
|
|
return nextConfig
|
2024-04-11 15:02:27 +00:00
|
|
|
}
|
|
|
|
|
2024-04-24 20:02:35 +00:00
|
|
|
export default config
|