From 94d9de0b84f37295fc1ecc6e0be8f09c6425ad71 Mon Sep 17 00:00:00 2001 From: adam-stasiak-polidea Date: Tue, 27 Oct 2020 05:16:02 +0100 Subject: [PATCH] Configured babel plugin for removing data-test from production code (#11327) --- superset-frontend/babel.config.js | 10 ++++++++++ superset-frontend/package-lock.json | 6 ++++++ superset-frontend/package.json | 5 +++-- 3 files changed, 19 insertions(+), 2 deletions(-) diff --git a/superset-frontend/babel.config.js b/superset-frontend/babel.config.js index 1903dbd0f481e..647992f337c6f 100644 --- a/superset-frontend/babel.config.js +++ b/superset-frontend/babel.config.js @@ -69,5 +69,15 @@ module.exports = { instrumented: { plugins: ['istanbul'], }, + production: { + plugins: [ + [ + 'babel-plugin-jsx-remove-data-test-id', + { + attributes: 'data-test', + }, + ], + ], + }, }, }; diff --git a/superset-frontend/package-lock.json b/superset-frontend/package-lock.json index ca8cda976d57b..93219fa7e51e2 100644 --- a/superset-frontend/package-lock.json +++ b/superset-frontend/package-lock.json @@ -19763,6 +19763,12 @@ } } }, + "babel-plugin-jsx-remove-data-test-id": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/babel-plugin-jsx-remove-data-test-id/-/babel-plugin-jsx-remove-data-test-id-2.1.3.tgz", + "integrity": "sha512-FTpcmzr3avLVStllCT4BceTTZNEb+1mJVtLpsicvXDqjojEkyrga1GGOxWj768Ra3tev6KWgNOhZ/Lrucb+MuQ==", + "dev": true + }, "babel-plugin-lodash": { "version": "3.3.4", "resolved": "https://registry.npmjs.org/babel-plugin-lodash/-/babel-plugin-lodash-3.3.4.tgz", diff --git a/superset-frontend/package.json b/superset-frontend/package.json index 21bff0f236b69..0ccbe76e1bd3e 100644 --- a/superset-frontend/package.json +++ b/superset-frontend/package.json @@ -14,10 +14,10 @@ "cover": "NODE_ENV=test jest --coverage", "dev": "webpack --mode=development --colors --debug --watch", "dev-server": "NODE_ENV=development BABEL_ENV=development node --max_old_space_size=4096 ./node_modules/webpack-dev-server/bin/webpack-dev-server.js --mode=development", - "prod": "node --max_old_space_size=4096 ./node_modules/webpack/bin/webpack.js --mode=production --colors", + "prod": "node --max_old_space_size=4096 BABEL_ENV=production ./node_modules/webpack/bin/webpack.js --mode=production --colors", "build-dev": "cross-env NODE_OPTIONS=--max_old_space_size=8192 NODE_ENV=development webpack --mode=development --colors", "build-instrumented": "cross-env NODE_ENV=development BABEL_ENV=instrumented webpack --mode=development --colors", - "build": "cross-env NODE_OPTIONS=--max_old_space_size=8192 NODE_ENV=production webpack --mode=production --colors", + "build": "cross-env NODE_OPTIONS=--max_old_space_size=8192 NODE_ENV=production BABEL_ENV=production webpack --mode=production --colors", "lint": "eslint --ignore-path=.eslintignore --ext .js,.jsx,.ts,.tsx . && npm run type", "prettier-check": "prettier --check '{src,stylesheets}/**/*.{css,less,sass,scss}'", "lint-fix": "eslint --fix --ignore-path=.eslintignore --ext .js,.jsx,.ts,tsx . && npm run clean-css && npm run type", @@ -223,6 +223,7 @@ "babel-loader": "^8.0.6", "babel-plugin-dynamic-import-node": "^2.3.0", "babel-plugin-emotion": "^10.0.29", + "babel-plugin-jsx-remove-data-test-id": "^2.1.3", "babel-plugin-lodash": "^3.3.4", "cache-loader": "^1.2.2", "clean-webpack-plugin": "^3.0.0",