fix: hide sentry instrumentation on debug builds (#604)
* fix: hide sentry instrumentation on debug builds * fix: amend documentation to reference zip:to-public rather than zip
This commit is contained in:
10
gulpfile.js
10
gulpfile.js
@@ -35,9 +35,13 @@ function removeExtraDatabaseDir(cb) {
|
|||||||
// Instrument with Sentry
|
// Instrument with Sentry
|
||||||
// Make sure sentry is configured https://docs.sentry.io/platforms/javascript/sourcemaps/uploading/typescript/#2-configure-sentry-cli
|
// Make sure sentry is configured https://docs.sentry.io/platforms/javascript/sourcemaps/uploading/typescript/#2-configure-sentry-cli
|
||||||
async function instrumentWithSentry(cb) {
|
async function instrumentWithSentry(cb) {
|
||||||
await exec(`sentry-cli sourcemaps inject ${DIST_DIR}`);
|
if (process.env.SENTRY_ENV && process.env.SENTRY_ENV !== 'development') {
|
||||||
await exec(`sentry-cli sourcemaps upload ${DIST_DIR}`);
|
await exec(`sentry-cli sourcemaps inject ${DIST_DIR}`);
|
||||||
log('Sentry instrumentation completed.');
|
await exec(`sentry-cli sourcemaps upload ${DIST_DIR}`);
|
||||||
|
log('Sentry instrumentation completed.');
|
||||||
|
} else {
|
||||||
|
logWarn('Skipping uploading/creating Sentry source maps. (development build)');
|
||||||
|
}
|
||||||
|
|
||||||
cb();
|
cb();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,8 +9,10 @@
|
|||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "vite",
|
"dev": "vite",
|
||||||
"build": "tsc && vite build",
|
"build": "tsc && vite build",
|
||||||
|
"build:dev": "tsc && NODE_ENV='development' vite build --mode development",
|
||||||
"build:watch": "NODE_ENV='development' vite build --mode development -w",
|
"build:watch": "NODE_ENV='development' vite build --mode development -w",
|
||||||
"zip": "PROD=true pnpm build && pnpm gulp zipProdBuild",
|
"zip": "pnpm build && pnpm gulp zipProdBuild",
|
||||||
|
"zip:to-publish": "SENTRY_ENV='production' pnpm zip",
|
||||||
"prettier": "prettier src --check",
|
"prettier": "prettier src --check",
|
||||||
"prettier:fix": "prettier src --write",
|
"prettier:fix": "prettier src --write",
|
||||||
"lint": "eslint src --ext ts,tsx --report-unused-disable-directives",
|
"lint": "eslint src --ext ts,tsx --report-unused-disable-directives",
|
||||||
|
|||||||
@@ -24,16 +24,14 @@ const pagesDir = resolve(root, 'pages');
|
|||||||
const assetsDir = resolve(root, 'assets');
|
const assetsDir = resolve(root, 'assets');
|
||||||
const publicDir = resolve(__dirname, 'public');
|
const publicDir = resolve(__dirname, 'public');
|
||||||
|
|
||||||
// Set default environment variables
|
|
||||||
process.env.PROD = process.env.NODE_ENV === 'production' ? 'true' : 'false';
|
|
||||||
|
|
||||||
const isBeta = !!process.env.BETA;
|
const isBeta = !!process.env.BETA;
|
||||||
if (isBeta) {
|
if (isBeta) {
|
||||||
process.env.VITE_BETA_BUILD = 'true';
|
process.env.VITE_BETA_BUILD = 'true';
|
||||||
}
|
}
|
||||||
process.env.VITE_PACKAGE_VERSION = packageJson.version;
|
process.env.VITE_PACKAGE_VERSION = packageJson.version;
|
||||||
// TODO: Debug this. If PROD is false, VITE_SENTRY_ENVIRONMENT is in production mode
|
|
||||||
if (process.env.PROD) {
|
// special condition for production sentry instrumentation, as many of our devs like to use `pnpm build` directly. Production instrumentation is added and uploaded during `pnpm zip:to-publish`.
|
||||||
|
if (process.env.SENTRY_ENV === 'production') {
|
||||||
process.env.VITE_SENTRY_ENVIRONMENT = 'production';
|
process.env.VITE_SENTRY_ENVIRONMENT = 'production';
|
||||||
} else if (isBeta) {
|
} else if (isBeta) {
|
||||||
process.env.VITE_SENTRY_ENVIRONMENT = 'beta';
|
process.env.VITE_SENTRY_ENVIRONMENT = 'beta';
|
||||||
|
|||||||
Reference in New Issue
Block a user