Created
August 4, 2020 02:07
-
-
Save emeraldsanto/ffc6e2176d035166792bcc1fc90d6904 to your computer and use it in GitHub Desktop.
Script to be run via NPM commands to generate the correct `env.json` file based on the provided environment name and the existing environment files
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/node | |
/** | |
* This scripts will create a `env.json` file at the root of the project | |
* with the content matching that of the desired environment file, as defined in `/src/env/` | |
* | |
* @example | |
* npx ts-node src/scripts/set-environment.ts production | |
*/ | |
import fs from "fs"; | |
const environment = process.argv[2]; | |
const environmentFile = require(`../env/${environment}.json`); | |
fs.writeFileSync( | |
"env.json", | |
JSON.stringify(environmentFile, null, 4) | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment