|
| 1 | +# Contributing to js-data-sql |
| 2 | + |
| 3 | +[Read the general Contributing Guide](http://js-data.io/docs/contributing). |
| 4 | + |
| 5 | +## Project structure |
| 6 | + |
| 7 | +* `dist/` - Contains final build files for distribution |
| 8 | +* `doc/` - Output folder for JSDocs |
| 9 | +* `src/` - Project source code |
| 10 | +* `test/` - Project tests |
| 11 | + |
| 12 | +## Clone, build & test |
| 13 | + |
| 14 | +1. `clone git@github.com:js-data/js-data-sql.git` |
| 15 | +1. `cd js-data-sql` |
| 16 | +1. `npm install` |
| 17 | +1. `npm run build` - Lint and build distribution files |
| 18 | +1. `npm run mocha` - Run tests (A compatible sql server must be running) |
| 19 | + |
| 20 | +#### Submitting Pull Requests |
| 21 | + |
| 22 | +1. Contribute to the issue/discussion that is the reason you'll be developing in |
| 23 | +the first place |
| 24 | +1. Fork js-data-sql |
| 25 | +1. `git clone git@github.com:<you>/js-data-sql.git` |
| 26 | +1. `cd js-data-sql; npm install;` |
| 27 | +1. Write your code, including relevant documentation and tests |
| 28 | +1. Run `npm test` (build and test) |
| 29 | + - You need Node 4.x that includes generator support without a flag |
| 30 | + - The tests expect a database to be running as follows, but can be overridden by passing the applicable environment variable as indicated (ex. `DB_HOST=192.168.99.100 npm test`). |
| 31 | + - `DB_HOST`: `localhost` |
| 32 | + - `DB_NAME`: `circle_test` |
| 33 | + - `DB_USER`: `ubuntu` |
| 34 | + - You may use `docker`/`docker-compose` to create MySql and Postgres containers to test against |
| 35 | + - `docker-compose up -d` |
| 36 | + - Start containers named `js-data-sql-mysql` and `js-data-sql-pg` |
| 37 | + - MySQL |
| 38 | + - Environment variables |
| 39 | + - `DB_CLIENT` = `mysql` |
| 40 | + - `DB_USER` = `root` |
| 41 | + - `DB_HOST` = `IP of docker-machine if not localhost` |
| 42 | + - Populate schema |
| 43 | + - `DB_CLIENT=mysql DB_USER=root npm run migrate-db` |
| 44 | + - Also set `DB_HOST` if different from `localhost` |
| 45 | + - Run tests |
| 46 | + - `npm run mocha-mysql` |
| 47 | + - Set `DB_HOST` if different from `localhost` |
| 48 | + - Run cli |
| 49 | + - `docker exec -it js-data-sql-mysql mysql circle_test` |
| 50 | + - Postgres |
| 51 | + - Environment variables |
| 52 | + - `DB_CLIENT` = `pg` |
| 53 | + - `DB_USER` = `ubuntu` |
| 54 | + - `DB_HOST` = `IP of docker-machine if not localhost` |
| 55 | + - Populate schema |
| 56 | + - `DB_CLIENT=pg npm run migrate-db` |
| 57 | + - Also set `DB_HOST` if different from `localhost` |
| 58 | + - Run tests |
| 59 | + - `npm run mocha-pg` |
| 60 | + - Also set `DB_HOST` if different from `localhost` |
| 61 | + - `docker exec -it js-data-sql-pg psql -U ubuntu -d circle_test` |
| 62 | + - Run cli |
| 63 | + - All databases |
| 64 | + - Run all tests against MySQL and Postgres |
| 65 | + - `npm run mocha-all` |
| 66 | + - Also set `DB_HOST` if different from `localhost` |
| 67 | + |
| 68 | +1. Your code will be linted and checked for formatting, the tests will be run |
| 69 | +1. The `dist/` folder & files will be generated, do NOT commit `dist/*`! They |
| 70 | +will be committed when a release is cut. |
| 71 | +1. Submit your PR and we'll review! |
| 72 | +1. Thanks! |
| 73 | + |
| 74 | +## To cut a release |
| 75 | + |
| 76 | +1. Checkout master |
| 77 | +1. Bump version in `package.json` appropriately |
| 78 | +1. Update `CHANGELOG.md` appropriately |
| 79 | +1. Run `npm run release` |
| 80 | +1. Commit and push changes |
| 81 | +1. Checkout `release`, merge `master` into `release` |
| 82 | +1. Run `npm run release` again |
| 83 | +1. Commit and push changes |
| 84 | +1. Make a GitHub release |
| 85 | + - tag from `release` branch |
| 86 | + - set tag name to version |
| 87 | + - set release name to version |
| 88 | + - set release body to changelog entry for the version |
| 89 | +1. `npm publish .` |
| 90 | + |
| 91 | +See also [Community & Support](http://js-data.io/docs/community). |
0 commit comments