Skip to content

Commit

Permalink
chore(env): added racking to check environment
Browse files Browse the repository at this point in the history
  • Loading branch information
4lessandrodev committed Mar 1, 2022
1 parent 30d300e commit aa3fbe2
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 3 deletions.
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*.types.ts
2 changes: 1 addition & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,4 @@ module.exports = {
'no-tabs': 0,
'space-before-function-paren': ['error', 'always'],
},
};
};
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"license": "MIT",
"scripts": {
"prestart:dev": "lsof -i:3000 | awk '/node/{print $2}' | awk 'NR == 1' | xargs -r kill -9 ",
"postinstall": "npm run generate:gql",
"postinstall": "./scripts/post-install.sh",
"prebuild": "rimraf dist",
"build": "nest build",
"format": "prettier --write \"src/**/*.ts\" \"test/**/*.ts\"",
Expand All @@ -25,7 +25,6 @@
},
"dependencies": {
"@apollo/gateway": "^0.34.0",
"@graphql-codegen/typescript-resolvers": "^2.5.2",
"@nestjs/common": "^8.1.2",
"@nestjs/core": "^8.1.2",
"@nestjs/graphql": "^8.0.2",
Expand Down Expand Up @@ -57,6 +56,7 @@
"devDependencies": {
"@graphql-codegen/cli": "^2.6.2",
"@graphql-codegen/typescript": "^2.4.5",
"@graphql-codegen/typescript-resolvers": "^2.5.2",
"@microsoft/tsdoc": "0.13.2",
"@nestjs/cli": "8.0.2",
"@nestjs/schematics": "8.0.2",
Expand Down
19 changes: 19 additions & 0 deletions scripts/post-install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/bin/bash

# This file check environment and run a specific command for each one

# Get node environment
NODE_ENV="$(printenv | awk '/^NODE_ENV/{print $1}')";


if [[ "$NODE_ENV" == "NODE_ENV=production" ]]; then

# Run production commands
echo "Production";

else

# Run dev commands
npm run generate:gql

fi;

0 comments on commit aa3fbe2

Please sign in to comment.