Skip to content
This repository was archived by the owner on Oct 17, 2021. It is now read-only.

Commit

Permalink
feat: プロトタイプ (#1)
Browse files Browse the repository at this point in the history
  • Loading branch information
SnO2WMaN authored Jul 17, 2021
1 parent 1695907 commit 56d7f56
Show file tree
Hide file tree
Showing 81 changed files with 11,523 additions and 0 deletions.
27 changes: 27 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
root = true

[*]
charset = utf-8
end_of_line = lf
indent_size = 2
indent_style = space
insert_final_newline = true
trim_trailing_whitespace = true

[*.yml]
indent_style = space

[.*-version]
insert_final_newline = false

[*.md]
trim_trailing_whitespace = false

[*.diff]
trim_trailing_whitespace = false

[Makefile]
indent_style = tab

[LICENSE]
insert_final_newline = false
27 changes: 27 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
PORT=4000

# required
JWT_SECRET="changeme"

NEO4J_USERNAME="neo4j"
NEO4J_PASSWORD="changeme"
NEO4J_HOST="localhost"
NEO4J_HTTP_PORT=7474
NEO4J_BOLT_PORT=7687
NEO4J_URL="bolt://${NEO4J_HOST}:${NEO4J_BOLT_PORT}"

MYSQL_PASSWORD="changeme"
MYSQL_HOST="localhost"
MYSQL_PORT=3306
MYSQL_DATABASE="database"
PRISMA_DATABASE_URL="mysql://root:${MYSQL_PASSWORD}@${MYSQL_HOST}:${MYSQL_PORT}/${MYSQL_DATABASE}"

# required for local test
TEST_NEO4J_HOST="localhost"
TEST_NEO4J_BOLT_PORT=7688
TEST_NEO4J_URL="bolt://${TEST_NEO4J_HOST}:${TEST_NEO4J_BOLT_PORT}"

TEST_MYSQL_HOST="localhost"
TEST_MYSQL_PORT=3307
TEST_MYSQL_DATABASE="testdb"
TEST_PRISMA_DATABASE_URL="mysql://root:@${TEST_MYSQL_HOST}:${TEST_MYSQL_PORT}/${TEST_MYSQL_DATABASE}"
11 changes: 11 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# dependencies
package-lock.json

# output
dist/

# test
coverage/

# auto generated
src/graphql.ts
29 changes: 29 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{
"root": true,
"extends": [
"plugin:@shopify/typescript",
"plugin:@shopify/jest",
"plugin:@shopify/prettier"
],
"plugins": ["unused-imports"],
"rules": {
"import/extensions": [0],
"unused-imports/no-unused-imports": [2],
"@typescript-eslint/consistent-type-definitions": [2, "type"],
"@typescript-eslint/consistent-indexed-object-style": [2, "record"]
},
"overrides": [
{
"files": ["*.module.ts"],
"rules": {
"@typescript-eslint/no-extraneous-class": 0
}
},
{
"files": ["*.config.ts"],
"rules": {
"no-process-env": 0
}
}
]
}
84 changes: 84 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
name: CI

on:
push:
branches:
- main
pull_request:

jobs:
ts-check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: 14
cache: yarn
- run: yarn install --frozen-lockfile
- run: yarn run ts-check

eslint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: 14
cache: yarn
- run: yarn install --frozen-lockfile
- run: yarn run lint:eslint

prettier:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: 14
cache: yarn
- run: yarn install --frozen-lockfile
- run: yarn run lint:prettier

test-large:
runs-on: ubuntu-latest

env:
TEST_NEO4J_URL: bolt://localhost:7687
TEST_PRISMA_DATABASE_URL: mysql://root:@localhost:3306/testdb

services:
neo4j:
image: neo4j:4.2
env:
NEO4J_AUTH: none
NEO4JLABS_PLUGINS: '["apoc"]'
ports:
- 7474:7474
- 7687:7687
options: >-
--health-cmd "wget http://localhost:7474/browser -O-"
--health-interval 5s
--health-timeout 3s
--health-retries 5
mysql:
image: mysql:8
env:
MYSQL_ALLOW_EMPTY_PASSWORD: 'yes'
MYSQL_DATABASE: testdb
ports:
- 3306:3306
options: >-
--health-cmd "mysqladmin ping -h localhost"
--health-interval 5s
--health-timeout 3s
--health-retries 5
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: 14
cache: yarn
- run: yarn install --frozen-lockfile
- run: yarn run test:large
26 changes: 26 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# dependencies
node_modules/
package-lock.json

# logfiles
*.log

# output
dist/

# test
coverage/

# env
.env*
!.env.example

# OS
.DS_Store

# VSCode
.vscode/*
!.vscode/extensions.json

# ESLint
.eslintcache
1 change: 1 addition & 0 deletions .node-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
14.16.1
11 changes: 11 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# dependencies
package-lock.json

# output
dist/

# test
coverage/

# auto generated
src/graphql.ts
1 change: 1 addition & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
"@shopify/prettier-config"
11 changes: 11 additions & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"recommendations": [
"EditorConfig.EditorConfig",
"dbaeumer.vscode-eslint",
"esbenp.prettier-vscode",
"christian-kohler.path-intellisense",
"ms-azuretools.vscode-docker",
"graphql.vscode-graphql",
"prisma.prisma"
]
}
20 changes: 20 additions & 0 deletions docker-compose.test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
version: '3.8'

services:
test-neo4j:
image: neo4j:4.2
ports:
- published: $TEST_NEO4J_BOLT_PORT
target: 7687
environment:
NEO4J_AUTH: none
NEO4JLABS_PLUGINS: '["apoc"]'

test-mysql:
image: mysql:8
ports:
- published: $TEST_MYSQL_PORT
target: 3306
environment:
MYSQL_ALLOW_EMPTY_PASSWORD: 'yes'
MYSQL_DATABASE: $TEST_MYSQL_DATABASE
41 changes: 41 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
version: '3.8'

services:
neo4j:
image: neo4j:4.2
ports:
- published: $NEO4J_HTTP_PORT
target: 7474
- published: $NEO4J_BOLT_PORT
target: 7687
healthcheck:
test: wget http://localhost:7474/browser -O-
interval: 5s
timeout: 3s
retries: 30
environment:
NEO4J_AUTH: ${NEO4J_USERNAME}/${NEO4J_PASSWORD}
NEO4JLABS_PLUGINS: '["apoc"]'
volumes:
- henken-club-backend-prototype-neo4j-data:/data
- henken-club-backend-prototype-neo4j-logs:/logs
- henken-club-backend-prototype-neo4j-import:/var/lib/neo4j/import
- henken-club-backend-prototype-neo4j-plugins:/plugins

mysql:
image: mysql:8
ports:
- published: $MYSQL_PORT
target: 3306
environment:
MYSQL_ROOT_PASSWORD: $MYSQL_PASSWORD
MYSQL_DATABASE: $MYSQL_DATABASE
volumes:
- henken-club-backend-prototype-mysql-data:/var/lib/mysql

volumes:
henken-club-backend-prototype-neo4j-data:
henken-club-backend-prototype-neo4j-logs:
henken-club-backend-prototype-neo4j-import:
henken-club-backend-prototype-neo4j-plugins:
henken-club-backend-prototype-mysql-data:
19 changes: 19 additions & 0 deletions jest.large.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import type {Config} from '@jest/types';
import {pathsToModuleNameMapper} from 'ts-jest/utils';

import {compilerOptions} from './tsconfig.json';

const config: Config.InitialOptions = {
preset: 'ts-jest',
testTimeout: 30000,
testEnvironment: 'node',
rootDir: './',
testMatch: ['<rootDir>/src/**/test/large/*.test.ts'],
moduleNameMapper: pathsToModuleNameMapper(compilerOptions.paths, {
prefix: '<rootDir>/',
}),
collectCoverage: true,
coverageDirectory: './coverage/large',
reporters: ['default'],
};
export default config;
7 changes: 7 additions & 0 deletions lefthook.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
pre-commit:
parallel: true
commands:
eslint:
run: yarn run lint:eslint
prettier:
run: yarn run lint:prettier
3 changes: 3 additions & 0 deletions nest-cli.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"sourceRoot": "src"
}
Loading

0 comments on commit 56d7f56

Please sign in to comment.