Skip to content
This repository has been archived by the owner on Sep 3, 2021. It is now read-only.

Write CONTRIBUTING.md that would have helped me #250

Merged
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
114 changes: 114 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
# Contributing

Thanks so much for thinking of contributing to `neo4j-graphql-js`, we really
appreciate it! :heart:

## Get in Touch

There's an active [mailing list](https://groups.google.com/forum/#!forum/neo4j)
and [Slack channel](https://neo4j.com/slack) 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 [email protected]: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](https://circleci.com/gh/neo4j-graphql/neo4j-graphql-js) 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`
- Your Neo4J instance runs on [this database](https://s3.amazonaws.com/neo4j-sandbox-usecase-datastores/v3_5/recommendations.db.zip)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@johnymontana thank you for providing the file. Could you upload a dump of your database to s3.amazonaws.com..?

neo4j-admin dump --to=./recommendations-db
# upload recommendations-db to amazon aws

We could improve the documentation here and use neo4j-admin load ....

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

By now I would prefer to check the file into version control. Opinions?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd prefer not to check the datastore into git. Let's plan for a long term goal of refactoring the tests to use Cypher script fixtures rather than loading the datastore.

In the meantime a .dump version of the datastore is available here: https://s3-us-west-2.amazonaws.com/neo4j-datasets-public/recommendations.dump


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
```

### 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](https://github.com/neo4j-graphql/neo4j-graphql-js/issues/249) 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](https://help.github.com/en/articles/fork-a-repo)
on Github. Add the fork as a separate remote, push your branch and create a pull
request:

```sh
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 :heart: you.
12 changes: 2 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -99,17 +99,9 @@ A package to make it easier to use GraphQL and [Neo4j](https://neo4j.com/) toget
- No need to write queries for each resolver
- Exposes the power of the Cypher query language through GraphQL

## Test
## Contributing

We use the `ava` test runner.

```
npm install
npm build
npm 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 a test environment. Full integration tests can be found in `/test` and are [run on CircleCI](https://circleci.com/gh/neo4j-graphql/neo4j-graphql-js) as part of the CI process.
See our [detailed contribution guidelines](./CONTRIBUTING.md).

## Examples

Expand Down