Skip to content

Latest commit

 

History

History
122 lines (90 loc) · 3.72 KB

CONTRIBUTING.md

File metadata and controls

122 lines (90 loc) · 3.72 KB

Contributing

Thanks so much for thinking of contributing to neo4j-graphql-js, we really appreciate it! ❤️

Get in Touch

There's an active mailing list and Slack channel where we work directly with the community. If you're not already a member, sign up!

We love our community and wouldn't be where we are without you.

Getting Set Up

Clone the repository, install dependencies and build the project:

git clone git@github.com:neo4j-graphql/neo4j-graphql-js.git
cd neo4j-graphql-js
npm install
npm run build

Testing

We use the ava test runner. Run the tests with:

npm run test

The npm test script will run unit tests that check GraphQL -> Cypher translation and the schema augmentation features and can be easily run locally without any extra dependencies.

Full integration tests can be found in /test and are run on CircleCI as part of the CI process.

Integration Testing

If you want to run integration tests locally, make sure your setup meets the following requirements:

  • A local Neo4J instance with username neo4j and password letmein
  • APOC plugin installed (see instructions here)
  • Your Neo4J instance runs on this database

In order to import the database, you can download the zipped files and extract it to the databases folder of your Neo4J instance. Restart the database on the new data.

Once you're done with that:

npm run start-middleware
# open another terminal and run
npm run parse-tck
npm run test-all

Note that npm run test-all will fail on consecutive runs! Some of the integration tests create data and get in the way of other tests. Running the whole test suite twice will result in some failing tests. There is an issue for it, check if it is still active. Your best option for now is to re-import the data after each test run.

Local Development

If you include this library inside your project and you want point the dependency to the files on your local machine, you will probably run into the following error:

Error: Cannot use GraphQLObjectType "Query" from another module or realm.

Ensure that there is only one instance of "graphql" in the node_modules
directory. If different versions of "graphql" are the dependencies of other
relied on modules, use "resolutions" to ensure only one version is installed.

This is because we currently don't have graphql as a peer dependency. See if this issue still exists. Until this is fixed a possible workaround is to overwrite the target folder of npm run build.

Open package.json and simply replace dist/ with the path to the node_modules/ folder of your project:

{
  ...
  "scripts": {
    ...
    "build": "babel src --presets babel-preset-env --out-dir /path/to/your/projects/node_modules/",
    ..
  }
  ..
}

If you run npm run build now, it will be build right into your project and you should not face the error above.

Spread the love

If you want to merge back your changes into the main repository, it would be best if you could fork the repository on Github. Add the fork as a separate remote, push your branch and create a pull request:

git remote add your-fork git@github.com:your-username/neo4j-graphql-js.git
git push your-fork your-branch
# now go to Github and create a pull request

We ❤️ you.