Created
September 10, 2020 19:06
-
-
Save stuart-haas/fff9a330b01bc056058cf431ab352e94 to your computer and use it in GitHub Desktop.
Typeorm project setup
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
# Install dependencies | |
echo "Installing dependencies" | |
npm install --prefix ./client && npm install --prefix ./server && npm install | |
# Copy the .env.example to .env | |
cd server | |
if [ ! -f .env ]; then | |
echo "\nCreating the .env file" | |
cp -v .env.example .env | |
# Generate the session secret key and add it to the .env | |
SESSION_SECRET=$(openssl rand -base64 32) | |
sed -i '' "/^SESSION_SECRET=/s/=.*/=$SESSION_SECRET/" .env | |
else | |
echo "\nThe .env already exists" | |
fi | |
# Generate and run migrations | |
echo "\nRunning migrations" | |
npm run migration:generate "initial_migration" | |
npm run migration:run | |
echo "\nSetup complete!" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment