Skip to content

Fix clobbering of .env file

Waquid Valiya Peedikakkal requested to merge fix/dotenv-append into master

This fixes an issue that was introduced in https://gitlab.builder.ai/public-tools/deploy-templates/-/merge_requests/455/diffs. Some repo's have a pre-populated .env file with no new lines at the end, this causes appends to clobber the .env file, here is an example:

SKIP_PREFLIGHT_CHECK=trueREACT_APP_BASE_URL=https://store.builder.ai/restaurant/restaurantwebsiteapp398946

This change adds a new line before appending, so outputs will now be either of the two below depending on if a newline was already present or now:

SKIP_PREFLIGHT_CHECK=true
REACT_APP_BASE_URL="https://store.builder.ai/restaurant/degreesafricanrestaurantandbar401394"

or

SKIP_PREFLIGHT_CHECK=true

REACT_APP_BASE_URL="https://store.builder.ai/restaurant/degreesafricanrestaurantandbar401394"

Merge request reports