Thanks so much for thinking of contributing to neo4j-graphql-js
, we really
appreciate it! ❤️
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.
Clone the repository, install dependencies and build the project:
git clone [email protected]:neo4j-graphql/neo4j-graphql-js.git
cd neo4j-graphql-js
npm install
npm run build
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.
If you want to run integration tests locally, make sure your setup meets the following requirements:
- A local Neo4J instance with username
neo4j
and passwordletmein
- 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.
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.
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 [email protected]:your-username/neo4j-graphql-js.git
git push your-fork your-branch
# now go to Github and create a pull request
We ❤️ you.