From d4f63627cd730a522bc2cff44bb638801fb12049 Mon Sep 17 00:00:00 2001 From: Gregor Adams Date: Thu, 26 Aug 2021 07:21:17 +0200 Subject: [PATCH] chore: strip test ids on production builds --- .babelrc.js | 5 +++++ .github/workflows/cypress.yml | 2 +- package.json | 2 ++ yarn.lock | 5 +++++ 4 files changed, 13 insertions(+), 1 deletion(-) diff --git a/.babelrc.js b/.babelrc.js index 997832d2..d811333e 100644 --- a/.babelrc.js +++ b/.babelrc.js @@ -11,4 +11,9 @@ module.exports = { }, ], ], + env: { + production: { + plugins: ["babel-plugin-jsx-remove-data-test-id"], + }, + }, }; diff --git a/.github/workflows/cypress.yml b/.github/workflows/cypress.yml index 0ae273df..5e64e821 100644 --- a/.github/workflows/cypress.yml +++ b/.github/workflows/cypress.yml @@ -81,7 +81,7 @@ jobs: NODE_AUTH_TOKEN: ${{ secrets.NODE_AUTH_TOKEN }} - name: Build - run: yarn build + run: yarn build:dev - name: Test run: yarn test diff --git a/package.json b/package.json index 5355d5d9..a3ca7fdc 100644 --- a/package.json +++ b/package.json @@ -6,6 +6,7 @@ "scripts": { "prebuild": "npx rimraf@3.0.2 node_modules/@dekk-app/dekk-backend/src/colonies/prisma/client/query-engine-darwin node_modules/@dekk-app/dekk-backend/src/colonies/prisma/client/query-engine-debian-openssl-1.1.x", "build": "next build", + "build:dev": "npx cross-env@7.0.3 NODE_ENV=development next build", "build:analyze": "npx cross-env@7.0.3 ANALYZE=true next build", "cypress:run": "npx cypress@8.3.0 run --record", "cypress:run:firefox": "npx cypress@8.3.0 run --record --browser firefox", @@ -96,6 +97,7 @@ "@types/uuid": "^8.3.1", "@typescript-eslint/eslint-plugin": "^4.29.1", "@typescript-eslint/parser": "^4.29.1", + "babel-plugin-jsx-remove-data-test-id": "^3.0.0", "cypress-cucumber-preprocessor": "^4.2.0", "dotenv": "^10.0.0", "duplicate-package-checker-webpack-plugin": "^3.0.0", diff --git a/yarn.lock b/yarn.lock index db799b12..43cb7347 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3409,6 +3409,11 @@ babel-plugin-dynamic-import-node@^2.3.3: dependencies: object.assign "^4.1.0" +babel-plugin-jsx-remove-data-test-id@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/babel-plugin-jsx-remove-data-test-id/-/babel-plugin-jsx-remove-data-test-id-3.0.0.tgz#15c95f97ce0ff60d72b29e403bde245f86393288" + integrity sha512-E4uM/LIUizjy2Z5tVAfa8pSXsYgoKWJ97kzuEMfsIxSLSNDWsAhgFVPkgNuakViX5dkNjw1DKIi0VpWP6djqbw== + babel-plugin-macros@^2.6.1: version "2.8.0" resolved "https://registry.yarnpkg.com/babel-plugin-macros/-/babel-plugin-macros-2.8.0.tgz#0f958a7cc6556b1e65344465d99111a1e5e10138"