We really want Parse to be yours, to see it grow and thrive in the open source community.
If you are not familiar with Pull Requests and want to know more about them, you can visit the Creating a pull request article. It contains detailed informations about the process.
- vscode, the popular IDE.
- Jasmine Test Explorer, a very practical test exploration plugin which let you run, debug and see the test results inline.
- Fork this project and clone the fork on your local machine:
$ git clone https://github.com/parse-community/parse-server
$ cd parse-server # go into the clone directory
$ npm install # install all the node dependencies
$ code . # launch vscode
$ npm run watch # run babel watching for local file changes
To launch VS Code from the terminal with the
code
command you first need to follow the launching from the command line section in the VS Code setup documentation.
Once you have babel running in watch mode, you can start making changes to parse-server.
- The
lib/
folder is not commited, so never make changes in there. - Always make changes to files in the
src/
folder. - All the tests should point to sources in the
lib/
folder.
Question: I modify the code in the src folder but it doesn't seem to have any effect.
Answer: Check that npm run watch
is running
Question: How do I use breakpoints and debug step by step?
Answer: The easiest way is to install Jasmine Test Explorer, it will let you run selectively tests and debug them.
Question: How do I deploy my forked version on my servers?
Answer: In your package.json
, update the parse-server
dependency to https://github.com/MY_USERNAME/parse-server#MY_FEATURE
. Run npm install
, commit the changes and deploy to your servers.
- Begin by reading the Development Guide to learn how to get started running the parse-server.
- Take testing seriously! Aim to increase the test coverage with every pull request. To obtain the test coverage of the project, run:
npm run coverage
- Run the tests for the file you are working on with the following command:
npm test spec/MyFile.spec.js
- Run the tests for the whole project to make sure the code passes all tests. This can be done by running the test command for a single file but removing the test file argument. The results can be seen at <PROJECT_ROOT>/coverage/lcov-report/index.html.
- Lint your code by running
npm run lint
to make sure the code is not going to be rejected by the CI. - Do not publish the lib folder.
If your pull request introduces a change that may affect the storage or retrieval of objects, you may want to make sure it plays nice with Postgres.
-
Run the tests against the postgres database with
PARSE_SERVER_TEST_DB=postgres PARSE_SERVER_TEST_DATABASE_URI=postgres://postgres:password@localhost:5432/parse_server_postgres_adapter_test_database npm run testonly
. You'll need to have postgres running on your machine and setup appropriately or useDocker
. -
The Postgres adapter has a special debugger that traces all the sql commands. You can enable it with setting the environment variable
PARSE_SERVER_LOG_LEVEL=debug
-
If your feature is intended to only work with MongoDB, you should disable PostgreSQL-specific tests with:
describe_only_db('mongo')
// will create adescribe
that runs only on mongoDBit_only_db('mongo')
// will make a test that only runs on mongoit_exclude_dbs(['postgres'])
// will make a test that runs against all DB's but postgres
-
Similarly, if your feature is intended to only work with PostgreSQL, you should disable MongoDB-specific tests with:
describe_only_db('postgres')
// will create adescribe
that runs only on postgresit_only_db('postgres')
// will make a test that only runs on postgresit_exclude_dbs(['mongo'])
// will make a test that runs against all DB's but mongo
PostGIS images (select one with v2.2 or higher) on docker dashboard is based off of the official postgres image and will work out-of-the-box (as long as you create a user with the necessary extensions for each of your Parse databases; see below). To launch the compatible Postgres instance, copy and paste the following line into your shell:
docker run -d --name parse-postgres -p 5432:5432 -e POSTGRES_PASSWORD=password --rm postgis/postgis:11-3.0-alpine && sleep 20 && docker exec -it parse-postgres psql -U postgres -c 'CREATE DATABASE parse_server_postgres_adapter_test_database;' && docker exec -it parse-postgres psql -U postgres -c 'CREATE EXTENSION postgis;' -d parse_server_postgres_adapter_test_database && docker exec -it parse-postgres psql -U postgres -c 'CREATE EXTENSION postgis_topology;' -d parse_server_postgres_adapter_test_database
To stop the Postgres instance:
docker stop parse-postgres
You can also use the postgis/postgis:11-2.5-alpine image in a Dockerfile and copy this script to the image by adding the following lines:
#Install additional scripts. These are run in abc order during initial start
COPY ./scripts/setup-dbs.sh /docker-entrypoint-initdb.d/setup-dbs.sh
RUN chmod +x /docker-entrypoint-initdb.d/setup-dbs.sh
Note that the script above will ONLY be executed during initialization of the container with no data in the database, see the official Postgres image for details. If you want to use the script to run again be sure there is no data in the /var/lib/postgresql/data of the container.
If you want to make changes to Parse Server Configuration add the desired configuration to src/Options/index.js and run npm run definitions
. This will output src/Options/Definitions.js and src/Options/docs.js.
To view docs run npm run docs
and check the /out
directory.
This project adheres to the Contributor Covenant Code of Conduct. By participating, you are expected to honor this code.