Skip to content

Commit 5684db5

Browse files
authored
nodejs rewrite (#13)
1 parent 14a8a73 commit 5684db5

File tree

90 files changed

+4673
-4006
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

90 files changed

+4673
-4006
lines changed

.dockerignore

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
node_modules
2+
npm-debug.log
3+
coverage
4+
.env
5+
/.github
6+
/.vscode
7+
/build

.env.example

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
DATABASE_URL="postgresql://postgres:changeme@localhost:5440/graphql-registry?schema=public"
2+
BASIC_AUTH=123,456
3+
JWT_SECRET=secret

.github/workflows/bench.yml

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
name: BENCH
2+
3+
on:
4+
push:
5+
paths:
6+
- '!**.md'
7+
- '!*.md'
8+
branches:
9+
- '**'
10+
tags-ignore:
11+
- '**'
12+
13+
pull_request:
14+
branches:
15+
- '**'
16+
17+
jobs:
18+
test:
19+
name: Node.js v${{ matrix.nodejs }}
20+
runs-on: ubuntu-latest
21+
strategy:
22+
matrix:
23+
nodejs: [14]
24+
steps:
25+
- uses: actions/checkout@v2
26+
- uses: actions/setup-node@v2
27+
with:
28+
node-version: ${{ matrix.nodejs }}
29+
30+
- name: (env) cache
31+
uses: actions/cache@v2
32+
with:
33+
# npm cache files are stored in `~/.npm` on Linux/macOS
34+
path: ~/.npm
35+
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
36+
restore-keys: |
37+
${{ runner.os }}-build-${{ env.cache-name }}-
38+
${{ runner.os }}-build-
39+
${{ runner.os }}-
40+
41+
- name: Start services
42+
run: |
43+
docker-compose up -d
44+
./scripts/wait-for-healthy-container.sh postgres 30
45+
46+
- name: Install
47+
run: npm ci --prefer-offline --no-audit
48+
49+
- name: Create db schema
50+
run: DATABASE_URL="postgresql://postgres:changeme@localhost:5440/graphql-registry?schema=public" npx prisma db push --preview-feature
51+
52+
- name: Build app image
53+
run: docker-compose up -d app
54+
55+
- name: Bench
56+
run: |
57+
docker-compose run k6 run /benchmark/composed-schema.js
58+
59+
- name: Clean services
60+
if: always()
61+
run: docker-compose down

.github/workflows/ci.yml

Lines changed: 34 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -20,32 +20,38 @@ jobs:
2020
runs-on: ubuntu-latest
2121
strategy:
2222
matrix:
23-
nodejs: [14, 16]
23+
nodejs: [14]
2424
steps:
25-
- uses: actions/checkout@v2
26-
- uses: actions/setup-node@v2
27-
with:
28-
node-version: ${{ matrix.nodejs }}
29-
30-
- name: (env) cache
31-
uses: actions/cache@v2
32-
with:
33-
# npm cache files are stored in `~/.npm` on Linux/macOS
34-
path: ~/.npm
35-
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
36-
restore-keys: |
37-
${{ runner.os }}-build-${{ env.cache-name }}-
38-
${{ runner.os }}-build-
39-
${{ runner.os }}-
40-
41-
- name: Install
42-
run: npm install
43-
44-
- name: Run Tests
45-
run: npm test
46-
47-
- name: Check Types
48-
run: npm run types
49-
50-
- name: Compiles
51-
run: npm run build
25+
- uses: actions/checkout@v2
26+
- uses: actions/setup-node@v2
27+
with:
28+
node-version: ${{ matrix.nodejs }}
29+
30+
- name: Start services
31+
run: |
32+
docker-compose up -d
33+
./scripts/wait-for-healthy-container.sh postgres 30
34+
35+
- name: (env) cache
36+
uses: actions/cache@v2
37+
with:
38+
# npm cache files are stored in `~/.npm` on Linux/macOS
39+
path: ~/.npm
40+
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
41+
restore-keys: |
42+
${{ runner.os }}-build-${{ env.cache-name }}-
43+
${{ runner.os }}-build-
44+
${{ runner.os }}-
45+
46+
- name: Install
47+
run: npm ci --prefer-offline --no-audit
48+
49+
- name: Run Tests
50+
run: npm test
51+
52+
- name: Compiles
53+
run: npm run build
54+
55+
- name: Clean services
56+
if: always()
57+
run: docker-compose down

.github/workflows/deploy.yml

Lines changed: 0 additions & 49 deletions
This file was deleted.

.gitignore

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,5 @@
1-
/target
2-
/dist
3-
**/*.rs.bk
4-
Cargo.lock
5-
pkg/
61
/build
7-
wasm-pack.log
8-
worker/
92
node_modules/
10-
.cargo-ok
113
/.nyc_output
124
coverage
13-
wrangler.toml
5+
.env

.husky/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
_

.husky/pre-commit

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#!/bin/sh
2+
. "$(dirname "$0")/_/husky.sh"
3+
4+
npm test
5+
6+
npx --yes pretty-quick

.prettierrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,5 @@
33
"semi": false,
44
"trailingComma": "all",
55
"tabWidth": 2,
6-
"printWidth": 80
6+
"printWidth": 120
77
}

.vscode/launch.json

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,7 @@
1111
"runtimeExecutable": "${workspaceFolder}/node_modules/.bin/ava",
1212
"runtimeArgs": ["--serial", "${file}"],
1313
"outputCapture": "std",
14-
"skipFiles": [
15-
"<node_internals>/**/*.js",
16-
"${workspaceFolder}/node_modules/**/*.js"
17-
]
14+
"skipFiles": ["<node_internals>/**/*.js", "${workspaceFolder}/node_modules/**/*.js"]
1815
}
1916
]
2017
}

0 commit comments

Comments
 (0)