GCTC-NTGC / gc-digital-talent

GC Digital Talent is the new recruitment platform for digital and tech jobs in the Government of Canada. // Talents numériques du GC est la nouvelle plateforme de recrutement pour les emplois numériques et technologiques au gouvernement du Canada.
https://talent.canada.ca
GNU Affero General Public License v3.0
22 stars 9 forks source link

Inconsistent npm run scripts for different environments #3768

Closed mnigh closed 1 year ago

mnigh commented 2 years ago

Description

The refresh scripts execute npm run dev locally but the deploy script executes npm run production. Same goes for the setup.sh script that executes npm run dev and is used in the e2e-tests github workflow.

Question

Should the refresh scripts and setup.sh be executing npm run production instead of npm run dev for consistency across environments?

patcon commented 2 years ago

Should the refresh scripts and setup.sh be executing npm run production instead of npm run dev for consistency across environments?

I understand this different between local and prod environments to be very standard.

npm run dev vs production is different because we do want different builds for development -- for example, react component profiling is something one would want in development environment and not in production, and there are some other things that one might want different (sourcemaps, minification). By as practical example, try to open react tab of chrome devtools on production, and the component tree names are all obfuscated, flamegraphs don't work, many helpful console errors are stripped, and I'm sure there are other things

The place where we could catch this would be UAT, which should be built with the same scripts as production.

Having said this, we could def run unit tests and cypress tests on a more prod-like build though, and that's prob doable!

mnigh commented 2 years ago

Having said this, we could def run unit tests and cypress tests on a more prod-like build though, and that's prob doable!

Yes, I think we should. Perhaps we can set an environment variable somewhere in setup.sh that allows to set the npm run script as dev (locally) or production (github workflows)?

patcon commented 1 year ago

Related: This inconsistentcy will now fail tests against npm run dev until #4798 is resolved