Skip to content
Permalink
Browse files

feat: simplify development setup

Warns if .env is missing.  Combines the three docker installation
commands into one, updating the docs accordingly.

Also removes the libcimp patch as npm already has it.
  • Loading branch information
ojeytonwilliams authored and raisedadead committed Nov 28, 2019
1 parent 647e25a commit e3b77a62ccc9317a22c5bbaad7e8d2b1030f1b45
Showing with 8 additions and 22 deletions.
  1. +4 −0 config/env.js
  2. +2 −4 docs/how-to-setup-freecodecamp-locally.md
  3. +0 −13 libcimp_index_js.patch
  4. +2 −1 package.json
  5. +0 −4 patch_npm_and_install.sh
@@ -1,7 +1,11 @@
const path = require('path');
const fs = require('fs');

if (process.env.FREECODECAMP_NODE_ENV !== 'production') {
const envPath = path.resolve(__dirname, '../.env');
if (!fs.existsSync(envPath)) {
throw Error('.env not found, please copy sample.env to .env.');
}
require('dotenv').config({ path: envPath });
}

@@ -191,12 +191,10 @@ This step will install the dependencies required for the application to run:

**Docker Build:**
```shell
npm run docker:init
npm run docker:install
npm run docker:seed
npm run docker:run-once
```

Each of the Docker commands above will take some time to complete. You should wait for each command to fully complete before running the next.
There is a lot to install, this step may take a few minutes.

You will also need to install a few npm packages outside of Docker. You can skip this step if you are only running the app locally and will not use git.

This file was deleted.

@@ -17,10 +17,11 @@
"develop": "npm-run-all ensure-env -p develop:*",
"develop:client": "cd ./client && npm run develop",
"develop:server": "cd ./api-server && npm run develop",
"docker:run-once": "npm run docker:init && npm run docker:install && npm run docker:seed",
"docker:clean": "docker-compose run -u root --rm freecodecamp bash -c \"rm -rf **/node_modules/* **/node_modules/..?* **/node_modules/.[!.]* node_modules/* node_modules/..?* node_modules/.[!.]*\"",
"docker:develop": "docker-compose up client api-server",
"docker:init": "docker-compose run -u root --rm freecodecamp bash change_volumes_owner.sh && docker-compose run -u root --rm client bash -c \"cd .. && bash change_volumes_owner.sh\" && docker-compose run -u root --rm api-server bash -c \"cd .. && bash change_volumes_owner.sh\"",
"docker:install": "docker-compose run -u root --rm freecodecamp bash patch_npm_and_install.sh",
"docker:install": "docker-compose run --rm freecodecamp npm ci",
"docker:seed": "docker-compose run --rm freecodecamp npm run seed",
"docker:test": "docker-compose -f docker-compose.tests.yml run --rm tests bash",
"docker:test:init": "docker-compose -f docker-compose.tests.yml run -u root --rm tests bash change_volumes_owner.sh",

This file was deleted.

0 comments on commit e3b77a6

Please sign in to comment.
You can’t perform that action at this time.