Skip to content
This repository was archived by the owner on Jun 27, 2019. It is now read-only.

Commit 62f7fe8

Browse files
committed
Do away with most yarn run scripts.
If you don't have a background process for mongo, how much of an effort is it to open a terminal?
1 parent bf59196 commit 62f7fe8

File tree

2 files changed

+53
-43
lines changed

2 files changed

+53
-43
lines changed

README.md

Lines changed: 48 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,13 @@ The API for a better world. More information under [human-connection.org](https:
1717

1818
> **Note:** This is only the API part of Human-Connection, you have to also checkout the [WebApp](https://github.com/Human-Connection/WebApp) which uses this API.
1919
20-
## Development
20+
## Local installation
2121

2222
> we recommand to install the project locally for the best development ease and performance
2323
2424
Getting up and running is as easy as 1, 2, 3, 4 ... 5.
2525

26-
1. Make sure you have [NodeJS](https://nodejs.org/), [yarn](https://yarnpkg.com), [mongoDB](https://www.mongodb.com/download-center#community) installed.
26+
1. Make sure you have a recent version of [NodeJS](https://nodejs.org/), [yarn](https://yarnpkg.com) and [mongoDB](https://www.mongodb.com/download-center#community) installed.
2727

2828
2. Clone this repo
2929
``` bash
@@ -43,71 +43,86 @@ Getting up and running is as easy as 1, 2, 3, 4 ... 5.
4343
```
4444

4545
5. Setup local mailserver (optional)
46-
47-
> **Note:**
46+
47+
> **Note:**
4848
> *You only have to start that mailserver when you want to register, reset your password or test emails in any form, it
4949
> does not affect the rest of the application.*
50-
50+
5151
Install the [MailDev](https://github.com/djfarrelly/MailDev)
5252
server to catch all sent emails in a nice web interface.
53-
53+
5454
``` bash
5555
# install mail dev (only has to be done once)
5656
$ yarn global add maildev
57-
58-
# start the server, it will output the web url
57+
58+
# start the server, it will output the web url
5959
# which normally is http://localhost:1080
6060
$ maildev
6161
```
62-
62+
6363
You could also insert your smtp credentials into the local.json but that is not recommended as all emails would be sent
6464
to the given addresses which should not happen in development.
65-
65+
6666
6. Start server
6767

68-
Make sure that the `data` folder exists according to the `mongod --dbpath` in `package.json` to write the data into, then start the server:
68+
You don't have a background process running for mongodb?
69+
Just open another terminal and run:
70+
71+
```bash
72+
# open up another terminal and run:
73+
$ yarn run mongo
74+
# or if you are on windows, run:
75+
$ yarn run mongo:win
76+
```
77+
78+
Start the API server with the following commands:
6979
``` bash
70-
# start mongodb, feathers and seed database
7180
$ yarn dev
72-
$ yarn dev:win if you're on windows
7381

74-
# start mongodb, feathers without seeding the database
75-
$ yarn dev:noseed
76-
77-
# start mongodb, feathers for production
82+
# without hot reload
7883
$ yarn start
84+
# you can customize the environment like this:
85+
$ NODE_ENV=production yarn start
7986
```
8087

81-
> ##### IMPORTANT for WIN users:
88+
> ##### IMPORTANT for WIN users:
8289
> - make sure you have mongo bin directory added to your PATH
83-
> - if you picked another data directory during mongodb setup make sure
84-
> to change package.json scripts section for key "dev:win" so it points to
85-
> the proper path. Otherwise you will get missing data path errors from mongodb.
86-
87-
If you did it right it will seed some fake data for you and downloads some images and avatar for faster development.
88-
Now you should be able to list some post at [http://localhost:3030/contributions](http://localhost:3030/contributions)
90+
91+
Now, your API should be running at [http://localhost:3030](http://localhost:3030).
92+
If you seeded your database, you will see some contributions at [http://localhost:3030/contributions](http://localhost:3030/contributions).
8993

9094
7. Setup and Start Thumbnail Service (optional)
9195

9296
We are using [Thumbor](https://github.com/thumbor/thumbor) as a Thumbnail Microservice.
9397
You can install it locally if you like but this is totally optional.
94-
98+
9599
**Install OR use docker**
96-
100+
97101
- At first you have to [install](http://thumbor.readthedocs.io/en/latest/installing.html) it locally and start it in the console with `thumbor` **OR** run it with docker `docker run -p 8000:8000 apsl/thumbor`
98102
- Set the `thumbor.url` in `config/local.json` to `http://localhost:8888` (with docker `http://localhost:8000`) if not defined differently. The `thumbor.key` does not necessarily have to be defined, it just makes the URL more secure.
99-
100-
> Do not forget to always start it if you choose that setup or otherwise you will not see any pictures at all.
101103

102-
## Local configuration
104+
> Do not forget to always start it if you choose that setup or otherwise you will not see any pictures at all.
103105
104-
If you need to configure anything you can do so inside the `config/local.json` file. For that the `config/local.example.json` will contain always a minimal setup to get it working.
106+
### Local configuration
105107

106-
E.g. if you want to change listen address, port or URL, you can do so. Entries in the `config/local.json` will override entries in the `config/default.json`.
108+
You can override any default configuration in `config/local.json`. You can find
109+
a list of availabe defaults in `config/default.json`.
110+
See [node-config documentation](https://github.com/lorenwest/node-config/wiki/Configuration-Files)
111+
for details.
107112

108113
## Testing
109114

110-
Simply run `yarn test` and all your tests in the `test/` directory will be run.
115+
Run the entire test suite with:
116+
```bash
117+
yarn run test
118+
```
119+
120+
If you want you can run specific tests:
121+
```bash
122+
yarn run mocha
123+
yarn run cucumber
124+
```
125+
111126

112127
## Scaffolding
113128

@@ -128,7 +143,7 @@ For more information on all the framework related things visit [docs.feathersjs.
128143

129144
The HC platform is documented in our [gitbook](https://www.gitbook.com/book/human-connection/documentation/) (work in progress).
130145

131-
## License
146+
## License
132147

133148
Copyright (c) 2018 [Human-Connection.org](https://human-connection.org)
134149

package.json

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -35,24 +35,19 @@
3535
"scripts": {
3636
"ci": "yarn run eslint && yarn run test:coverage",
3737
"clear": "rm -Rf tmp",
38+
"mongo": "mongod --dbpath data --quiet",
39+
"mongo:win": "mongod --dbpath /data/db --quiet",
3840
"test": "yarn run mocha && yarn run cucumber",
3941
"test:coverage": "nyc --reporter=lcovonly --reporter=text-summary yarn run test",
40-
"test:mongo": "yarn run eslint && cross-env NODE_ENV=test && nyc --reporter=lcovonly --reporter=text-summary yarn run mocha:mongo",
4142
"eslint": "eslint server/. test/. features/. --config .eslintrc.json",
42-
"start": "concurrently 'mongod' 'wait-on tcp:27017 && cross-env NODE_ENV=production node server/'",
43+
"start": "node server/",
4344
"dev:debug": "yarn run clear && concurrently '$npm_package_config_mongoDev &>/dev/null' 'wait-on tcp:27017 && cross-env DEBUG=feathers && cross-env NODE_ENV=development nodemon --inspect server/'",
4445
"dev": "yarn run clear && concurrently '$npm_package_config_mongoDev &>/dev/null' 'wait-on tcp:27017 && cross-env DEBUG=feathers && cross-env NODE_ENV=development nodemon server/'",
4546
"dev:local": "sh scripts/run-local.sh",
46-
"dev:noseed": "concurrently 'mongod --dbpath data' 'wait-on tcp:27017 && NODE_ENV=development DEBUG=feathers nodemon server/'",
47-
"dev:win": "yarn run clear && concurrently \"mongod --dbpath /data/db\" \"wait-on tcp:27017&&cross-env NODE_ENV=development&&cross-env DEBUG=feathers&& nodemon --inspect server/\"",
48-
"mocha": "yarn run clear && $npm_package_config_mocha",
49-
"mocha:mongo": "$npm_package_config_concurrently '$npm_package_config_mongoDev &>/dev/null' 'wait-on tcp:27017 && yarn run mocha'",
50-
"cucumber": "yarn run clear && concurrently --kill-others --success first 'cross-env NODE_ENV=test node server/' 'wait-on tcp:3031 && cross-env NODE_ENV=test cucumber-js'",
51-
"cucumber:mongo": "yarn run clear && concurrently --kill-others --success first '$npm_package_config_mongoDev &>/dev/null || sleep infinity' 'wait-on tcp:27017 && cross-env NODE_ENV=test node server/' 'wait-on tcp:3031 && cross-env NODE_ENV=test cucumber-js'"
47+
"mocha": "cross-env NODE_ENV=test node_modules/mocha/bin/_mocha test/ --recursive --timeout 10000 --exit",
48+
"cucumber": "yarn run clear && concurrently --kill-others --success first 'cross-env NODE_ENV=test node server/' 'wait-on tcp:3031 && cross-env NODE_ENV=test cucumber-js'"
5249
},
5350
"config": {
54-
"mongoDev": "mongod --dbpath data --quiet",
55-
"mocha": "cross-env NODE_ENV=test node_modules/mocha/bin/_mocha test/ --recursive --timeout 10000 --exit",
5651
"concurrently": "concurrently --kill-others --success first"
5752
},
5853
"dependencies": {

0 commit comments

Comments
 (0)