Skip to content

Commit

Permalink
feat: sequelize integration part 7.5 - fixed express and fastify case
Browse files Browse the repository at this point in the history
TODO:
  - fix tests with graphql
  • Loading branch information
AnthonyLzq committed Sep 5, 2022
1 parent fae427f commit d3eb286
Show file tree
Hide file tree
Showing 143 changed files with 16,824 additions and 504 deletions.
13 changes: 13 additions & 0 deletions example/express-graphql-sequelize/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
.eslintignore
.eslintrc
.gitignore
CHANGELOG.md
Dockerfile
heroku.yml
*.http
LICENSE
nodemon.json
README.md

# optionally you may want to ignore the .env file, but that depends on your own implementation
.env
1 change: 1 addition & 0 deletions example/express-graphql-sequelize/.eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/dist
101 changes: 101 additions & 0 deletions example/express-graphql-sequelize/.eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
{
"env": {
"node": true,
"jest": true
},
"root": true,
"parser": "@typescript-eslint/parser",
"plugins": [
"@typescript-eslint",
"import",
"prettier",
"jest"
],
"extends": [
"standard",
"eslint:recommended",
"plugin:@typescript-eslint/eslint-recommended",
"plugin:@typescript-eslint/recommended",
"prettier"
],
"rules": {
"@typescript-eslint/no-var-requires": "off",
"@typescript-eslint/no-empty-interface": "off",
"arrow-parens": [
"error",
"as-needed"
],
"import/extensions": [
2,
{
"ts": "never",
"js": "always",
"json": "always"
}
],
"import/no-extraneous-dependencies": [
"error",
{
"devDependencies": [
"**/*.test.ts",
"webpack.config.js",
"jest.config.ts",
"src/database/postgres/config.js"
],
"optionalDependencies": [
"**/*.test.ts"
],
"peerDependencies": [
"**/*.test.ts"
]
}
],
"max-len": [
"error",
{
"code": 80,
"ignoreComments": true,
"ignoreRegExpLiterals": true,
"ignoreTemplateLiterals": true,
"ignoreTrailingComments": true,
"ignoreStrings": true,
"ignoreUrls": true
}
],
"newline-before-return": "error",
"object-curly-spacing": [
"error",
"always"
],
"object-shorthand": [
"error",
"always"
],
"prefer-const": "error",
"prettier/prettier": [
"error",
{
"arrowParens": "avoid",
"bracketSpacing": true,
"printWidth": 80,
"quoteProps": "as-needed",
"semi": false,
"singleQuote": true,
"tabWidth": 2,
"trailingComma": "none"
}
],
"radix": [
"error",
"as-needed"
],
"spaced-comment": [
"error",
"always"
],
"curly": [
"error",
"multi"
]
}
}
32 changes: 32 additions & 0 deletions example/express-graphql-sequelize/.github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Lint - example/express-graphql-sequelize

on: [push]

jobs:
run-linters:
name: Run linters
runs-on: ubuntu-latest

steps:
- name: Check out Git repository
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: 16.x

- name: Install Node.js dependencies
run: npm ci

- name: Revert changes into the package-lock.json file
run: git checkout -- package-lock.json

- name: Run linters
uses: wearerequired/lint-action@v1
with:
auto_fix: true
eslint: true
eslint_extensions: js
32 changes: 32 additions & 0 deletions example/express-graphql-sequelize/.github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Tests - example/express-graphql-sequelize

on: [push]

jobs:
test:
environment: Test
name: Testing Simba.js API
runs-on: ubuntu-latest

steps:
- name: Check out Git repository
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: 16.x

- name: Install Node.js dependencies
run: npm ci

- name: Revert changes into the package-lock.json file
run: git checkout -- package-lock.json

- name: Run test
run: npm run test:ci
env:
DB_URI: ${{ secrets.DB_URI }}
NODE_ENV: ci
129 changes: 129 additions & 0 deletions example/express-graphql-sequelize/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,129 @@
# Created by https://www.toptal.com/developers/gitignore/api/node,yarn
# Edit at https://www.toptal.com/developers/gitignore?templates=node,yarn

### Node ###
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
lerna-debug.log*

# Diagnostic reports (https://nodejs.org/api/report.html)
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json

# Runtime data
pids
*.pid
*.seed
*.pid.lock

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage
*.lcov

# nyc test coverage
.nyc_output

# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# Bower dependency directory (https://bower.io/)
bower_components

# node-waf configuration
.lock-wscript

# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release

# Dependency directories
node_modules/
jspm_packages/

# TypeScript v1 declaration files
typings/

# TypeScript cache
*.tsbuildinfo

# Optional npm cache directory
.npm

# Optional eslint cache
.eslintcache

# Microbundle cache
.rpt2_cache/
.rts2_cache_cjs/
.rts2_cache_es/
.rts2_cache_umd/

# Optional REPL history
.node_repl_history

# Output of 'npm pack'
*.tgz

# Yarn Integrity file
.yarn-integrity

# dotenv environment variables file
.env

# parcel-bundler cache (https://parceljs.org/)
.cache

# Next.js build output
.next

# Nuxt.js build / generate output
.nuxt

# Gatsby files
.cache/
# Comment in the public line in if your project uses Gatsby and not Next.js
# https://nextjs.org/blog/next-9-1#public-directory-support
# public

# vuepress build output
.vuepress/dist

# Serverless directories
.serverless/

# FuseBox cache
.fusebox/

# DynamoDB Local files
.dynamodb/

# TernJS port file
.tern-port

# Stores VSCode versions used for testing VSCode extensions
.vscode*

### yarn ###
# https://yarnpkg.com/advanced/qa#which-files-should-be-gitignored

# .yarn/unplugged and .yarn/build-state.yml should likely always be ignored since
# they typically hold machine-specific build artifacts. Ignoring them might however
# prevent Zero-Installs from working (to prevent this, set enableScripts to false).
.yarn/unplugged
.yarn/build-state.yml

# .yarn/cache and .pnp.* may be safely ignored, but you'll need to run yarn install
# to regenerate them between each branch switch.
# Uncomment the following lines if you're not using Zero-Installs:
# .yarn/cache
# .pnp.*

# End of https://www.toptal.com/developers/gitignore/api/node,yarn

dist
test/setEnvVars.ts
4 changes: 4 additions & 0 deletions example/express-graphql-sequelize/.sequelizerc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
module.exports = {
config: './src/database/postgres/config.js',
'migrations-path': './src/database/postgres/migrations/'
}
1 change: 1 addition & 0 deletions example/express-graphql-sequelize/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Example/express Graphql Sequelize
15 changes: 15 additions & 0 deletions example/express-graphql-sequelize/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
FROM node:16-alpine

WORKDIR /app

COPY . ./

RUN yarn install --prod

RUN yarn add webpack webpack-node-externals tsconfig-paths-webpack-plugin -D

RUN yarn build

RUN yarn remove webpack webpack-node-externals tsconfig-paths-webpack-plugin

CMD [ "yarn", "start" ]
21 changes: 21 additions & 0 deletions example/express-graphql-sequelize/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2022 AnthonyLzq

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
3 changes: 3 additions & 0 deletions example/express-graphql-sequelize/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Example/express Graphql Sequelize

This is a test using express with graphql and sequelize.
3 changes: 3 additions & 0 deletions example/express-graphql-sequelize/heroku.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
build:
docker:
web: Dockerfile
Loading

0 comments on commit d3eb286

Please sign in to comment.