Skip to content

Commit

Permalink
refactor(script): set env script to be executable with node
Browse files Browse the repository at this point in the history
  • Loading branch information
artyorsh committed Sep 27, 2019
1 parent aa11e1c commit f317e38
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 5 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"start:pg": "npm run install:pg && npm start --prefix ./src/playground",
"start:pg:prod": "npm run env:set -- prod && npm run start:pg",
"start:pg:dev": "npm run env:set -- dev && npm run start:pg",
"env:set": "./scripts/environment/set-env.sh",
"env:set": "node ./scripts/environment/set-env.js",
"build": "./scripts/build/compile-ts.sh",
"build:transform": "./scripts/build/transform-paths.sh",
"build:dev": "npm run build -- dev && npm run build:transform -- dev",
Expand Down
13 changes: 13 additions & 0 deletions scripts/environment/set-env.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
const path = require('path');
const fs = require('fs');

const scriptArguments = process.argv.splice(2);
const { [0]: envArgument } = scriptArguments;

const rootDir = path.resolve(__dirname, '../../');

const envConfigFile = path.resolve(rootDir, `config/${envArgument}.env.js`);
const envConfigMainFile = path.resolve(rootDir, `config/index.js`);

fs.copyFileSync(envConfigFile, envConfigMainFile);

4 changes: 0 additions & 4 deletions scripts/environment/set-env.sh

This file was deleted.

0 comments on commit f317e38

Please sign in to comment.