Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve transformer #146

Open
wants to merge 13 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
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
1 change: 0 additions & 1 deletion .dockerignore

This file was deleted.

10 changes: 7 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,26 @@ git:
depth: 3
notifications:
email: false
node_js:
- "10"
services: docker
cache: yarn
node_js:
- 12
- 10

env:
global:
# NPM_TOKEN
- secure: "L/umajEryp4I1BSAbfQhwKhFcTfKFretCjrDawfzCj5RZdXpKc4s/5YqNHreDFrcccfKX22dEJjUMAqRUV9hHPP9wq+7GxFRK4RNsUwnTFFVPmxkEszchqZN8j7qKtGNkJ5R46roJNUTy9lhpeBRqE25xU96Z37a+EFJ5qPP1jmIT5P9l9U8wEBE6RE0BIyfpx9GzWOv7zBG0M7hNJWsZlU+Gm9Irn7US27kZ9sYOTBletWwy9C/FhTTZdDi9khN7NaS52AFK1806U4ChZSZv5ZyKxzmNIywM3fZDys1r0lXSVDyNVSepqFRsBXWvB25Fyq8y1BoZac6AYxtoF0YNPYUF78RiJobEI1VJXhL2gq1lye9O1o/IJfgEJ42bd3uC1zpdVqSARXosIjmGpASSKcFNLdhJEYd58sKzOxbYLCXVUxbkGY5LWpTPoUp/DEZuD0kkszGWtk/+rw/3TsBL2ZWlpdentauvZpVFF/+WyD+nNWkGFAM06jQRYtAdB+3+VJtXzQtXDdLgCcOpvH83JqDWyOKUSQWS2ePgvi+9i2rUhlfA8bVssB1Pr+Opnql8f5TH96JlGtPAX1uObxub6GjavayTc2fPHK52OGPDpP2FSoJ0k+9q5675EOdrPMN8XqSvCrullnCHMDZAnIxJwYn1OukgB50joTm77Afi2I="
# GH_TOKEN
- secure: "Nycvk6E3t+tHz6akzqZrGUTcboX7UXcPoAxDK7971c3XbWA9B9mI02t4R9AbuQLKwM4Z6ioCcRkWb6u1KPwUPlGPm3F8Ovoa7lmwUnDpoFsmBUSkwxgQ3Xb/O6EEL4xUFMqwvshm18K9pOC2UWZNr/a4XZVjmzRqPJwieKGbh0J72K0VEf7Dgie2NchDN/MSVf2pGHX8tHcZOLMn+lVcPYHreK4zb9Bipm/XZg7Hcb3bcqSCdiztSC7+V4uc1LisTVbiAigFK7IIMjODp0PAHBkr6/Sv3o+LxgM9pvH5Ety1jlimXq0WW5elX0B7B1IsZT4+wUUGtFH7v8fRi/1j8/1gynfqai/hetW41ta0ZdSroJZbPr7K39+FpodWnq6xai9xfAEhFITDT29hmvFVvlmZeH03OzhfKkhmN04JrobdV8ToIUa8KrE1Vq18IbS23ciLoPan0NbXiIZP3PW9e90e7OF1k6ssqBbgRQFF4d5k7GNaJDsyadGPHw7yIz4krCsknIO8W3HAnuWQkwRR2Pe71LtiBkIb1p42D6g6Ppba8iGK4DPcXSGYRg8RfVC5znAg6Zdhsjbx3t4fVK+UloWOkIalsDEbocfEpPZXP6m1iCxNIikXmUUM4iqFkgh8WHNL1n91LKFV2jCQ8yUjZAjPPc2seZy9Lw0dE3pKUbE="
jobs:
- NEO4J_VERSION=3.5
- NEO4J_VERSION=4.0

script:
- yarn validate
after_success:
- yarn --silent nyc report --reporter=text-lcov | sed "s|/app|$(pwd)|" | ./node_modules/.bin/coveralls
- yarn report
# Rebuild docs, only on master branch and not on pull requests
- '[[ $TRAVIS_PULL_REQUEST = "false" && $TRAVIS_BRANCH = "master" ]] && yarn docs'

Expand Down
6 changes: 0 additions & 6 deletions docker/Dockerfile-test

This file was deleted.

22 changes: 0 additions & 22 deletions docker/docker-compose.test.yml

This file was deleted.

23 changes: 10 additions & 13 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,15 @@
],
"scripts": {
"commit": "git-cz",
"build": "yarn build:declaration && yarn build:rollup",
"build:declaration": "tsc --project tsconfig.declaration.json --outDir dist/typings --declaration --emitDeclarationOnly",
"build:rollup": "rollup -c",
"lint": "tslint --project ./tsconfig.json",
"test": "docker-compose -f docker/docker-compose.test.yml -p cypher-query-builder up --exit-code-from tests",
"test:unit": "nyc --reporter=html --reporter=text-summary mocha src/*.spec.ts src/**/*.spec.ts",
"validate": "yarn --silent lint && yarn --silent build && yarn --silent test",
"release": "./scripts/release.sh",
"merge": "./scripts/merge.sh",
"docs": "typedoc src/builder.ts src/query.ts src/connection.ts src/clauses/index.ts src/clauses/where-comparators.ts src/clauses/where-operators.ts --mode file --theme minimal --out ./docs --excludeExternals --excludeProtected --excludePrivate --ignoreCompilerErrors"
"build": "scripts/build declaration && scripts/build rollup",
"build:declaration": "scripts/build declaration",
"build:rollup": "scripts/build rollup",
"docs": "scripts/docs",
"lint": "scripts/lint",
"report": "scripts/report",
"test": "scripts/test-integration",
"test:unit": "scripts/test",
"validate": "scripts/validate"
},
"config": {
"commitizen": {
Expand Down Expand Up @@ -91,10 +90,8 @@
"dependencies": {
"@types/lodash": "^4.14.136",
"@types/node": "^12.6.1",
"any-observable": "^0.5.0",
"any-promise": "^1.3.0",
"lodash": "^4.17.15",
"neo4j-driver": "^1.5.0",
"neo4j-driver": "^4.0.1",
"node-cleanup": "^2.1.2",
"rxjs": "^6.5.2",
"tslib": "^1.10.0"
Expand Down
6 changes: 0 additions & 6 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -157,12 +157,6 @@ const results = db.matchNode('project', 'Project')
results.subscribe(row => console.log(row.project.properties.name));
```

Under the hood, the promises and observables used by this library are constructed
by [any-promise](https://github.com/kevinbeaty/any-promise) and
[any-observable](https://github.com/sindresorhus/any-observable) respectively. They
default to using the global Promise class and the RxJS observable library, but you
can change that by registering another implementation before importing this module.

### Processing

To extract the results, you can use ES5 array methods or a library like lodash:
Expand Down
15 changes: 15 additions & 0 deletions scripts/build
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/usr/bin/env bash

kind="$1"
case "$kind" in
rollup)
yarn rollup -c
;;
declaration)
tsc --project tsconfig.declaration.json --outDir dist/typings --declaration --emitDeclarationOnly
;;
*)
>&2 echo "Unknown build kind '$kind'. Expected rollup or declaration."
exit 1
;;
esac
16 changes: 16 additions & 0 deletions scripts/docs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/usr/bin/env bash

yarn typedoc \
src/builder.ts \
src/query.ts \
src/connection.ts \
src/clauses/index.ts \
src/clauses/where-comparators.ts \
src/clauses/where-operators.ts \
--mode file \
--theme minimal \
--out ./docs \
--excludeExternals \
--excludeProtected \
--excludePrivate \
--ignoreCompilerErrors
3 changes: 3 additions & 0 deletions scripts/lint
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/usr/bin/env bash

yarn tslint --project ./tsconfig.json
5 changes: 5 additions & 0 deletions scripts/report
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/usr/bin/env bash

yarn --silent nyc report --reporter=text-lcov \
| sed "s|/app|$(pwd)|" \
| ./node_modules/.bin/coveralls
7 changes: 7 additions & 0 deletions scripts/test
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/usr/bin/env bash

yarn --silent nyc \
--reporter=html \
--reporter=text-summary \
mocha \
src/**/*.spec.ts
37 changes: 37 additions & 0 deletions scripts/test-integration
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
#!/usr/bin/env bash

start-neo4j() {
docker run \
-d \
-p 7474:7474 \
-p 7687:7687 \
-e NEO4J_AUTH=neo4j/admin \
"neo4j:${NEO4J_VERSION-latest}"
}

run-tests() {
yarn --silent nyc \
--reporter=html \
--reporter=text-summary \
mocha \
src/*.spec.ts \
src/**/*.spec.ts \
tests/*.test.ts \
tests/**/*.test.ts "$@"
}

# Start the neo4j docker container
echo "Starting neo4j..."
id=$(start-neo4j) || exit 1

# Run the tests
echo "Running tests..."
NEO4J_URL=bolt://localhost NEO4J_USER=neo4j NEO4J_PASS=admin run-tests "$@"
code="$?"

# Stop the container
echo "Stopping neo4j..."
docker container stop "$id" > /dev/null

# Exit with the same code as the tests
exit "$code"
3 changes: 3 additions & 0 deletions scripts/validate
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/usr/bin/env bash

yarn --silent lint && yarn --silent build && yarn --silent test
Loading