-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathnext.config.ts
More file actions
33 lines (27 loc) · 858 Bytes
/
next.config.ts
File metadata and controls
33 lines (27 loc) · 858 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
import type {NextConfig} from 'next';
import manifest from './package.json';
import {execSync} from 'child_process';
import createNextIntlPlugin from 'next-intl/plugin';
function run(cmd: string) {
return execSync(cmd).toString().trim();
}
function getGitBranchFormatted(): string {
const branch = run('git rev-parse --abbrev-ref HEAD');
return branch.replace(/[^0-9A-Za-z-]/g, '-');
}
function getCommitHash(): string {
return run('git rev-parse --short HEAD');
}
const longVersionName = `${manifest.version}-${getGitBranchFormatted()}+${getCommitHash()}`;
const withNextIntl = createNextIntlPlugin();
const nextConfig: NextConfig = withNextIntl({
output: 'export',
basePath: '',
images: {
unoptimized: true,
},
env: {
NEXT_PUBLIC_APP_VERSION: longVersionName,
},
});
export default nextConfig;