Skip to content

Commit

Permalink
Tech Stack Changes (#60)
Browse files Browse the repository at this point in the history
* build: migrate to pnpm (#58)

* build: remove patch-package in favor of pnpm patch

* build(docker): move from npm to pnpm

* ci: migrate ci to pnpm

* fix: use a different method to set script

Apparently on npm@9, `npm set-script` has been removed.

https://github.blog/changelog/2022-10-24-npm-v9-0-0-released/

* build(docker): fix final stage

* build(docker): copy missing files required by pnpm

* build: drop commitlint (#59)

* build: remove standard-version

* refactor: remove unused commitlint config

* ci: change "on" filters

* build: drop hygen and inquirer (#61)

* build: upgrade to typescript 5 (#62)

* style: simplify eslint rules (#63)

* build: add eslint-patch

* style: simplify eslint rules

* build: migrate to prisma, kysely and zod (#64)

* build: migrate to apollo server 4 (#65)

* chore: upgrade deps

* style: improve base error stack message

* refactor: remove apollo studio from cors

Apollo now offers an embedded Apollo Studio as the landing page for local dev.

https://www.apollographql.com/docs/apollo-server/migration/#local-landing-page-defaults-to-embedded-apollo-sandbox

* refactor: use apollo server's error helper

https://www.apollographql.com/docs/apollo-server/migration/#error-formatting-changes

* refactor: comply on the migration guide

* build: upgrade supertokens (#66)

* chore: update graphql-tools deps

* refactor: make initializeSchema synchronous

* chore: update lockfile

* feat: graceful shutdown with terminus (#67)

* chore: update deps

* refactor(graphql)!: simplify websocket handling (#68)

* refactor(graphql)!: simplify websocket handling

* chore: remove subscriptions-transport-ws package

* refactor: drop UniqueID in favor of string (#69)

* refactor: error handling (#70)

* feat: prisma seeding (#71)

* chore: remove unnecessary metadata

* chore: remove apollo config

* chore: remove aws config

* refactor: rename redis file

* docs: update readme and diagram (#72)

* feat: update readme and diagram

* docs(readme): update based on tech stack changes

* refactor: remove unnecessary comment
  • Loading branch information
cerinoligutom authored Apr 15, 2023
1 parent 7ea4990 commit 35c482c
Show file tree
Hide file tree
Showing 137 changed files with 9,742 additions and 31,654 deletions.
3 changes: 0 additions & 3 deletions .commitlintrc.json

This file was deleted.

1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
node_modules
build
src/db/*.d.ts
46 changes: 8 additions & 38 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,29 +1,21 @@
/* eslint-env node */
require('@rushstack/eslint-patch/modern-module-resolution');

module.exports = {
root: true,
parser: '@typescript-eslint/parser',
parserOptions: {
ecmaVersion: 2020,
ecmaVersion: 'latest',
project: ['./tsconfig.eslint.json'],
},
plugins: ['@typescript-eslint'],
extends: ['eslint:recommended', 'plugin:@typescript-eslint/recommended', 'airbnb-base', 'airbnb-typescript/base', 'prettier'],
extends: ['eslint:recommended', 'plugin:@typescript-eslint/recommended', 'prettier'],
rules: {
'no-console': ['warn', { allow: ['info', 'error'] }],
quotes: ['error', 'single'],
'arrow-body-style': ['error', 'as-needed'],
'no-underscore-dangle': 'off',
'no-restricted-syntax': 'off',
'no-extra-boolean-cast': 'off',

'import/prefer-default-export': 'off',
'import/order': 'off',
'import/no-extraneous-dependencies': 'off',
'import/no-cycle': 'off',
'import/extensions': 'off',

'@typescript-eslint/no-var-requires': 'off',
'@typescript-eslint/no-explicit-any': 'error',
'@typescript-eslint/array-type': ['error', { default: 'array-simple', readonly: 'array-simple' }],
'@typescript-eslint/lines-between-class-members': 'off',
'@typescript-eslint/no-unused-vars': [
'error',
{
Expand All @@ -33,41 +25,19 @@ module.exports = {
'@typescript-eslint/no-empty-interface': 'off',
},
overrides: [
// TODO: Revisit this rule when migration to Prisma and Kysely starts
// Database
{
files: ['./src/db/seeds/**/*.ts', './src/db/migrations/**/*.ts', './src/db/helpers/**/*.ts'],
rules: {
'@typescript-eslint/no-explicit-any': 'off',
'arrow-body-style': 'off',
},
},
// GraphQL Dataloaders
{
files: ['./src/**/*.dataloader.ts'],
rules: {
'arrow-body-style': 'off',
'@typescript-eslint/explicit-module-boundary-types': 'off',
},
},

{
files: ['./src/config/**/*.ts', './src/**/*.util.ts'],
rules: {
'@typescript-eslint/no-non-null-assertion': 'off',
'arrow-body-style': 'off',
},
},
{
files: ['./src/**/*.error.ts', './src/**/*.handler.ts', './src/**/*.util.ts', './src/**/*.factory.ts'],
files: ['./src/**/*.error.ts', './src/**/*.handler.ts', './src/**/*.factory.ts'],
rules: {
'@typescript-eslint/no-explicit-any': 'off',
},
},
{
files: ['./_templates/**/*.prompt.js'],
rules: {
'no-param-reassign': 'off',
},
},
],
};
33 changes: 9 additions & 24 deletions .github/workflows/build.yml → .github/workflows/CI.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,12 @@
name: Build
name: CI
on:
push:
branches:
- 'main'
- 'develop'
paths-ignore:
- '**/README.md'

pull_request:
branches:
- 'main'
- 'develop'
paths-ignore:
- '**/README.md'

Expand All @@ -26,19 +22,23 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup pnpm
uses: pnpm/action-setup@v2
with:
version: 8
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: '18'
cache: 'npm'
cache: 'pnpm'
- name: Install dependencies
run: npm ci
run: pnpm install --frozen-lockfile

- name: Run linter
run: npm run lint
run: pnpm lint

- name: Build project
run: npm run build
run: pnpm build

build-docker-image:
name: Build Docker Image
Expand All @@ -50,18 +50,3 @@ jobs:

- name: Build Docker Image
run: docker build -f Dockerfile -t ${{ env.IMAGE_NAME }}:build .

### Uncomment the step below if you want to be notified on Slack ###
### Just make sure your secrets are configured ###

# - name: Notify Slack
# uses: 8398a7/action-slack@v3
# with:
# author_name: ${{ github.workflow }} by ${{ github.actor }}
# status: ${{ job.status }}
# mention: channel
# if_mention: failure,cancelled
# fields: message,commit,author,eventName,ref,workflow,job,took
# env:
# SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} # required
# if: always() # Pick up events even if the job fails or is canceled.
4 changes: 0 additions & 4 deletions .husky/commit-msg

This file was deleted.

1 change: 0 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
"cSpell.words": [
"casl",
"codegen",
"commitlint",
"dataloader",
"dataloaders",
"datetime",
Expand Down
14 changes: 0 additions & 14 deletions @types/objection-cursor/index.d.ts

This file was deleted.

11 changes: 0 additions & 11 deletions @types/objection/index.d.ts

This file was deleted.

21 changes: 15 additions & 6 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,20 @@ FROM node:${NODE_IMAGE_VERSION} as builder

WORKDIR /usr/src/app

COPY package*.json ./
RUN npm install -g pnpm

COPY package.json ./
COPY pnpm-lock.yaml ./
COPY patches ./patches
RUN ls -al
RUN npm ci
RUN pnpm install --frozen-lockfile

# Copy files from host to container then list it
COPY ./ ./
RUN ls -al

# Build project
RUN npm run build:prod
RUN pnpm build:prod

# List files under build directory for reference
RUN ls -al build
Expand All @@ -35,10 +38,16 @@ WORKDIR /usr/src/app
# Copy the necessary files from the builder stage to this stage
COPY --chown=node:node --from=builder /usr/src/app/build .

# https://typicode.github.io/husky/#/?id=with-npm
RUN npm set-script prepare ""
RUN npm install -g pnpm

# On npm@9, `npm set-script` has been removed: https://github.blog/changelog/2022-10-24-npm-v9-0-0-released/
# This is mainly for disabling Husky on Docker and CI.
RUN npm pkg set scripts.prepare=" "

COPY pnpm-lock.yaml ./
COPY patches ./patches
# Install production dependencies only
RUN npm ci --production
RUN pnpm install --frozen-lockfile --prod

# List the final directory for reference
RUN ls -al
Expand Down
9 changes: 6 additions & 3 deletions Dockerfile.dev
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,17 @@ EXPOSE 8080

WORKDIR /usr/src/app

COPY package*.json ./
RUN npm install -g pnpm

COPY package.json ./
COPY pnpm-lock.yaml ./
COPY patches ./patches
RUN npm install
RUN pnpm install

# Copy files from host to container
COPY ./ ./

RUN npm run build
RUN pnpm build

RUN ls -al

Expand Down
Loading

0 comments on commit 35c482c

Please sign in to comment.