process.env as feature flags

At Woovi we are always looking to optimize our processes. We want to improve the DX to increase the productivity of every software engineer. We want to make everything faster, consuming fewer memory and also providing the best usability.

Experimentat…


This content originally appeared on DEV Community 👩‍💻👨‍💻 and was authored by Sibelius Seraphini

At Woovi we are always looking to optimize our processes. We want to improve the DX to increase the productivity of every software engineer. We want to make everything faster, consuming fewer memory and also providing the best usability.

Experimentation leads to innovation. However, experimentation can also break what is stable. To avoid breaking any core process of our software engineer team, we release new DX improvement behind feature flags that can be turned on using process.env.

Below is an example of our Jest config that enable the developer to decide which jest transformer to use. Esbuild and SWC are faster transformer than babel-jest, although it breaks a few of our tests.

const jestTransformer = () => {
  if (
    !process.env?.JEST_TRANSFORMER ||
    process.env.JEST_TRANSFORMER === 'babel-jest'
  ) {
    return {
      '^.+\\.(js|ts|tsx)?$': 'babel-jest',
    };
  }

  if (process.env.JEST_TRANSFORMER === 'esbuild-jest') {
    return {
      '^.+\\.(js|ts|tsx)?$': 'esbuild-jest',
    };
  }

  if (process.env.JEST_TRANSFORMER === 'swc-jest') {
    return {
      '^.+\\.(js|ts|tsx)?$': [
        '@swc/jest',
        {
          sourceMaps: true,
          jsc: {
            parser: {
              syntax: 'typescript',
              tsx: true,
            },
          },
        },
      ],
    };
  }
};

What experimentation and DX improvement are you doing in your codebase?

If you care about DX and wanna work with us, we are hiring!


This content originally appeared on DEV Community 👩‍💻👨‍💻 and was authored by Sibelius Seraphini


Print Share Comment Cite Upload Translate Updates
APA

Sibelius Seraphini | Sciencx (2022-09-23T11:33:01+00:00) process.env as feature flags. Retrieved from https://www.scien.cx/2022/09/23/process-env-as-feature-flags/

MLA
" » process.env as feature flags." Sibelius Seraphini | Sciencx - Friday September 23, 2022, https://www.scien.cx/2022/09/23/process-env-as-feature-flags/
HARVARD
Sibelius Seraphini | Sciencx Friday September 23, 2022 » process.env as feature flags., viewed ,<https://www.scien.cx/2022/09/23/process-env-as-feature-flags/>
VANCOUVER
Sibelius Seraphini | Sciencx - » process.env as feature flags. [Internet]. [Accessed ]. Available from: https://www.scien.cx/2022/09/23/process-env-as-feature-flags/
CHICAGO
" » process.env as feature flags." Sibelius Seraphini | Sciencx - Accessed . https://www.scien.cx/2022/09/23/process-env-as-feature-flags/
IEEE
" » process.env as feature flags." Sibelius Seraphini | Sciencx [Online]. Available: https://www.scien.cx/2022/09/23/process-env-as-feature-flags/. [Accessed: ]
rf:citation
» process.env as feature flags | Sibelius Seraphini | Sciencx | https://www.scien.cx/2022/09/23/process-env-as-feature-flags/ |

Please log in to upload a file.




There are no updates yet.
Click the Upload button above to add an update.

You must be logged in to translate posts. Please log in or register.