2023-11-14 05:17:17 +00:00
|
|
|
const childProcess = require('child_process');
|
2022-02-11 13:56:28 +00:00
|
|
|
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
2023-07-04 11:01:25 +00:00
|
|
|
const withNx = require('@nx/next/plugins/with-nx');
|
2022-04-04 19:45:40 +00:00
|
|
|
const { withSentryConfig } = require('@sentry/nextjs');
|
|
|
|
|
|
|
|
const SENTRY_AUTH_TOKEN = process.env.SENTRY_AUTH_TOKEN;
|
|
|
|
|
|
|
|
const sentryWebpackOptions = {
|
|
|
|
org: 'vega-o3',
|
|
|
|
project: 'trading',
|
|
|
|
token: SENTRY_AUTH_TOKEN,
|
|
|
|
};
|
2022-02-11 13:56:28 +00:00
|
|
|
|
2023-11-14 05:17:17 +00:00
|
|
|
const commitHash = childProcess
|
|
|
|
.execSync('git rev-parse HEAD')
|
|
|
|
.toString()
|
|
|
|
.trim();
|
|
|
|
|
|
|
|
// Get the tag of the last commit
|
|
|
|
const commitLog = childProcess
|
|
|
|
.execSync('git log --decorate --oneline -1')
|
|
|
|
.toString()
|
|
|
|
.trim();
|
|
|
|
|
|
|
|
const tagMatch = commitLog.match(/tag: ([^,)]+)/);
|
|
|
|
const tag = tagMatch ? tagMatch[1] : '';
|
|
|
|
|
2022-02-11 13:56:28 +00:00
|
|
|
/**
|
2023-07-04 11:01:25 +00:00
|
|
|
* @type {import('@nx/next/plugins/with-nx').WithNxOptions}
|
2022-02-11 13:56:28 +00:00
|
|
|
**/
|
|
|
|
const nextConfig = {
|
|
|
|
nx: {
|
|
|
|
// Set this to true if you would like to to use SVGR
|
|
|
|
// See: https://github.com/gregberge/svgr
|
|
|
|
svgr: false,
|
|
|
|
},
|
2022-03-01 00:59:18 +00:00
|
|
|
pageExtensions: ['page.tsx', 'page.jsx'],
|
2023-11-14 05:17:17 +00:00
|
|
|
env: {
|
|
|
|
GIT_COMMIT: commitHash,
|
|
|
|
GIT_TAG: tag,
|
|
|
|
},
|
2022-02-11 13:56:28 +00:00
|
|
|
};
|
|
|
|
|
2022-04-04 19:45:40 +00:00
|
|
|
module.exports = SENTRY_AUTH_TOKEN
|
|
|
|
? withNx(withSentryConfig(nextConfig, sentryWebpackOptions))
|
|
|
|
: withNx(nextConfig);
|