Skip to content

Commit

Permalink
feat(upgrade): fastify v4 support
Browse files Browse the repository at this point in the history
fastify v4 support

 major refactor

 new config

BREAKING CHANGE: new configuration (incompatible with all previous versions)

Closes #44, #41, #10
  • Loading branch information
SkeLLLa committed Jul 3, 2022
1 parent 2b32aa3 commit b7f7bb6
Show file tree
Hide file tree
Showing 103 changed files with 11,920 additions and 8,601 deletions.
13 changes: 11 additions & 2 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,15 @@
module.exports = {
root: true,
plugins: [
'prettier',
'@typescript-eslint/eslint-plugin',
'eslint-plugin-tsdoc',
],
extends: [
'eslint:recommended',
'google',
'prettier',
'plugin:@typescript-eslint/recommended',
'plugin:@typescript-eslint/eslint-recommended',
'plugin:@typescript-eslint/recommended',
'plugin:@typescript-eslint/recommended-requiring-type-checking',
Expand All @@ -12,16 +18,19 @@ module.exports = {
parserOptions: {
project: 'tsconfig.json',
sourceType: 'module',
ecmaVersion: 2018,
ecmaVersion: 2020,
},
env: {
es6: true,
node: true,
jest: false,
},
plugins: ['prettier', '@typescript-eslint'],

rules: {
'new-cap': ['error', { capIsNewExceptions: ['ObjectId', 'Fastify'] }],
'require-jsdoc': 'off',
'valid-jsdoc': 'off',
'tsdoc/syntax': 'error',
'prettier/prettier': 'error',
'@typescript-eslint/require-await': 'off',
'@typescript-eslint/no-unsafe-member-access': 'off',
Expand Down
34 changes: 20 additions & 14 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,27 +20,29 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [10.x, 12.x, 14.x, 16.x]
node-version: [16.x, 18.x]
steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- name: Install dependencies
run: npm ci
uses: pnpm/action-setup@v2
with:
run_install: |
- recursive: true
args: [--frozen-lockfile, --strict-peer-dependencies]
- name: Build
run: npm run build --if-present
run: pnpm run build --if-present
- name: Audit
run: npm audit --production
run: pnpm audit --production
- name: Lint
run: npm run lint --if-present
run: pnpm run lint --if-present
- name: Test
run: npm run unit --if-present -- --coverage
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
run: pnpm run unit --if-present -- --coverage
- name: Archive code coverage results
if: matrix.node-version == '14.x'
if: matrix.node-version == '18.x'
uses: actions/upload-artifact@v1
with:
name: code-coverage-report
Expand All @@ -57,20 +59,24 @@ jobs:
- name: Setup node
uses: actions/setup-node@v1
with:
node-version: 14
node-version: 18
- name: Install dependencies
run: npm ci
uses: pnpm/action-setup@v2
with:
run_install: |
- recursive: true
args: [--frozen-lockfile, --strict-peer-dependencies]
- name: Store version
run: npm run version:update
run: pnpm run version:update
- name: Commit version changes
if: ${{ github.ref == 'refs/heads/master' }}
run: |
git config --global user.name 'Release Bot'
git config --global user.email '[email protected]'
npm run release
pnpm run release
- name: Commit version changes
if: ${{ github.ref == 'refs/heads/next' }}
run: |
git config --global user.name 'Release Bot'
git config --global user.email '[email protected]'
npm run release -- --prerelease rc --skip.changelog
pnpm run release -- --prerelease rc --skip.changelog
22 changes: 15 additions & 7 deletions .github/workflows/release-next.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,17 @@ jobs:
- name: Setup node
uses: actions/setup-node@v1
with:
node-version: 14
node-version: 18
- name: Install dependencies
run: npm ci
uses: pnpm/action-setup@v2
with:
run_install: |
- recursive: true
args: [--frozen-lockfile, --strict-peer-dependencies]
- name: Get latest changelog
id: Changelog
run: |
changelog=$(npm run --silent get-changelog | tail -n +1)
changelog=$(pnpm run --silent get-changelog | tail -n +1)
echo $changelog
changelog="${changelog//'%'/'%25'}"
changelog="${changelog//$'\n'/'%0A'}"
Expand Down Expand Up @@ -64,13 +68,17 @@ jobs:
ref: refs/heads/next
- uses: actions/setup-node@v1
with:
node-version: 14
node-version: 18
registry-url: https://registry.npmjs.org/
- name: Install dependencies
run: npm ci
uses: pnpm/action-setup@v2
with:
run_install: |
- recursive: true
args: [--frozen-lockfile, --strict-peer-dependencies]
- name: Build
run: npm run build --if-present
run: pnpm run build --if-present
- name: Publish
run: npm publish --tag next
run: pnpm publish --tag next
env:
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
32 changes: 20 additions & 12 deletions .github/workflows/release-stable.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,17 @@ jobs:
- name: Setup node
uses: actions/setup-node@v1
with:
node-version: 14
node-version: 18
- name: Install dependencies
run: npm ci
uses: pnpm/action-setup@v2
with:
run_install: |
- recursive: true
args: [--frozen-lockfile, --strict-peer-dependencies]
- name: Get latest changelog
id: Changelog
run: |
changelog=$(npm run --silent get-changelog -- --skipUnstable | tail -n +1)
changelog=$(pnpm run --silent get-changelog -- --skipUnstable | tail -n +1)
echo $changelog
changelog="${changelog//'%'/'%25'}"
changelog="${changelog//$'\n'/'%0A'}"
Expand Down Expand Up @@ -62,14 +66,18 @@ jobs:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: 14
node-version: 18
registry-url: https://registry.npmjs.org/
- name: Install dependencies
run: npm ci
uses: pnpm/action-setup@v2
with:
run_install: |
- recursive: true
args: [--frozen-lockfile, --strict-peer-dependencies]
- name: Build
run: npm run build --if-present
run: pnpm run build --if-present
- name: Publish
run: npm publish --tag latest
run: pnpm publish --tag latest
env:
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
# publish-gh:
Expand All @@ -79,17 +87,17 @@ jobs:
# - uses: actions/checkout@v2
# - uses: actions/setup-node@v1
# with:
# node-version: 14
# node-version: 18
# registry-url: https://npm.pkg.github.com/
# - name: Install dependencies
# run: npm ci
# run: pnpm ci
# - name: Build
# run: npm run build --if-present
# - name: Get npm tag
# run: pnpm run build --if-present
# - name: Get pnpm tag
# id: npm_tag
# run: |
# NPM_TAG=$([[ ${{ github.ref }} == *"-rc"* ]] && echo "next" || echo "latest")
# echo "::set-output name=tag::$NPM_TAG"
# - run: npm publish --access public
# - run: pnpm publish --access public
# env:
# NODE_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}}
14 changes: 9 additions & 5 deletions .github/workflows/verify-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:

strategy:
matrix:
node-version: [10.x, 12.x, 14.x, 16.x]
node-version: [16.x, 18.x]

steps:
- uses: actions/checkout@v2
Expand All @@ -19,19 +19,23 @@ jobs:
with:
node-version: ${{ matrix.node-version }}
- name: Install dependencies
run: npm ci
uses: pnpm/action-setup@v2
with:
run_install: |
- recursive: true
args: [--frozen-lockfile, --strict-peer-dependencies]
- name: Build
run: npm run build --if-present
run: pnpm run build --if-present
- name: Audit
run: npm audit --production
run: pnpm audit --production
- name: lint
uses: reviewdog/action-eslint@v1
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
reporter: github-pr-review
eslint_flags: '. --ext js,jsx,ts,tsx'
- name: Test
run: npm run unit --if-present
run: pnpm run unit --if-present
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v1
with:
Expand Down
10 changes: 3 additions & 7 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
.idea
node_modules
deploy
build
coverage
config/local.*
**/*.xxx.js
dist/
temp/
node_modules/
etc/*
6 changes: 2 additions & 4 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
nginx/
build/
dist/
coverage/
static/
node_modules/
**/*.conf
**/*.min.*
pnpm-lock.yaml
12 changes: 0 additions & 12 deletions .prettierrc.js

This file was deleted.

20 changes: 20 additions & 0 deletions .prettierrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"$schema": "https://json.schemastore.org/prettierrc",
"arrowParens": "always",
"bracketSpacing": true,
"endOfLine": "lf",
"plugins": [
"./node_modules/prettier-plugin-organize-imports",
"./node_modules/prettier-plugin-packagejson",
"./node_modules/prettier-plugin-sort-json",
"./node_modules/prettier-plugin-jsdoc"
],
"printWidth": 80,
"quoteProps": "consistent",
"semi": true,
"singleQuote": true,
"tabWidth": 2,
"trailingComma": "es5",
"tsdoc": true,
"useTabs": false
}
32 changes: 32 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"type": "node",
"name": "vscode-jest-tests.v2",
"request": "launch",
"runtimeExecutable": "/home/m03geek/.local/share/pnpm/node",
"args": [
"--runInBand",
"--watchAll=false",
"--testTimeout=100000000",
"--testNamePattern",
"${jest.testNamePattern}",
"--runTestsByPath",
"${jest.testFile}"
],
// "runtimeArgs": ["--preserve-symlinks"],
"cwd": "${workspaceFolder}",
"console": "integratedTerminal",
"internalConsoleOptions": "neverOpen",
"disableOptimisticBPs": true,
"program": "${workspaceFolder}/node_modules/jest/bin/jest.js",
"windows": {
"program": "${workspaceFolder}/node_modules/jest/bin/jest"
}
}
]
}
4 changes: 4 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"jest.autoRun": "off",
"jest.coverageFormatter": "GutterFormatter"
}
9 changes: 5 additions & 4 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
Feel free to contribute to this project.

* Make sure that all your changes fit codestyle, run `npm run lint`.
* Make sure that all your changes have tests, run `npm run unit`.
* Make sure that all your changes have documented in [README](README.md).
* Make sure that all your commits follow conventional commit [guide](https://conventionalcommits.org/).
- Use `pnpm` to manage deps.
- Make sure that all your changes fit codestyle, run `pnpm run lint`.
- Make sure that all your changes have tests, run `pnpm run unit`.
- Make sure that all your changes have documented in [README](README.md).
- Make sure that all your commits follow conventional commit [guide](https://conventionalcommits.org/).
Loading

0 comments on commit b7f7bb6

Please sign in to comment.