-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: use
@fastify/http-proxy
(#203)
- Loading branch information
1 parent
a79b46f
commit ccdd079
Showing
50 changed files
with
1,498 additions
and
2,028 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
/** @type {import('eslint').Linter.Config} */ | ||
const config = { | ||
ignorePatterns: [ | ||
'**/node_modules/**', | ||
'**/build/**', | ||
'**/coverage/**', | ||
'**/cache/**', | ||
'**/commitlint.config.cjs', | ||
'**/lint-staged.config.cjs', | ||
'**/vitest.config.ts', | ||
'**/prettier.config.cjs', | ||
'**/.eslintrc.cjs', | ||
], | ||
root: true, | ||
env: { | ||
node: true, | ||
es2022: true, | ||
}, | ||
parser: '@typescript-eslint/parser', | ||
parserOptions: { | ||
project: ['./tsconfig.json'], | ||
}, | ||
plugins: ['@typescript-eslint'], | ||
extends: [ | ||
// Common | ||
'eslint:recommended', | ||
'plugin:import/recommended', | ||
// TS | ||
'plugin:import/typescript', | ||
'plugin:@typescript-eslint/recommended', | ||
'plugin:@typescript-eslint/recommended-requiring-type-checking', | ||
'plugin:@typescript-eslint/strict', | ||
// Prettier | ||
'plugin:prettier/recommended', | ||
], | ||
settings: { | ||
'import/resolver': { | ||
typescript: {}, | ||
}, | ||
}, | ||
rules: { | ||
'import/newline-after-import': 'error', | ||
'import/order': [ | ||
'error', | ||
{ | ||
'newlines-between': 'always', | ||
alphabetize: { order: 'asc', caseInsensitive: true }, | ||
}, | ||
], | ||
'object-shorthand': ['error', 'always'], | ||
'no-console': 'error', | ||
'func-style': ['error', 'declaration'], | ||
'@typescript-eslint/explicit-function-return-type': 'error', | ||
'@typescript-eslint/promise-function-async': 'error', | ||
'@typescript-eslint/consistent-type-imports': [ | ||
'warn', | ||
{ | ||
prefer: 'type-imports', | ||
fixStyle: 'inline-type-imports', | ||
}, | ||
], | ||
'@typescript-eslint/no-unused-vars': [ | ||
'warn', | ||
{ argsIgnorePattern: '^_' }, | ||
], | ||
}, | ||
} | ||
|
||
module.exports = config |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,6 @@ | ||
NODE_ENV="development" | ||
|
||
LOGGER_LEVEL="trace" | ||
LOG_REQUESTS="true" | ||
|
||
PROXY_PORT=8000 | ||
COMMIT_SHA="local" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,6 +3,6 @@ | |
node_modules | ||
build | ||
coverage | ||
.eslintcache | ||
cache | ||
|
||
.env |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,6 @@ | ||
node_modules | ||
build | ||
coverage | ||
cache | ||
.husky | ||
pnpm-lock.yaml |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,6 @@ | ||
{ | ||
"editor.tabSize": 4 | ||
"editor.tabSize": 4, | ||
"editor.insertSpaces": true, | ||
"typescript.tsdk": "node_modules/typescript/lib", | ||
"typescript.enablePromptUseWorkspaceTsdk": true | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
module.exports = { | ||
extends: ['@commitlint/config-conventional'], | ||
const config = { | ||
extends: ['@commitlint/config-conventional'], | ||
} | ||
|
||
module.exports = config |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,39 @@ | ||
const path = require('node:path') | ||
const { ESLint } = require('eslint') | ||
|
||
/** | ||
* @param {string} file | ||
*/ | ||
function toRelative(file) { | ||
return path.relative(process.cwd(), file) | ||
return path.relative(process.cwd(), file) | ||
} | ||
|
||
/** | ||
* @param {string[]} files | ||
*/ | ||
async function removeIgnoredFiles(files) { | ||
const eslint = new ESLint() | ||
const isIgnored = await Promise.all( | ||
files.map((file) => eslint.isPathIgnored(file)) | ||
) | ||
const filteredFiles = files.filter((_, i) => !isIgnored[i]) | ||
return filteredFiles | ||
const eslint = new ESLint() | ||
const isIgnored = await Promise.all( | ||
files.map((file) => eslint.isPathIgnored(file)) | ||
) | ||
const filteredFiles = files.filter((_, i) => !isIgnored[i]) | ||
return filteredFiles | ||
} | ||
|
||
module.exports = { | ||
'*': async (files) => { | ||
const filesToFormat = files.map(toRelative).join(' ') | ||
/** @type {import('lint-staged').Config} */ | ||
const config = { | ||
'*': async (files) => { | ||
const filesToFormat = files.map(toRelative).join(' ') | ||
|
||
return [`prettier --check ${filesToFormat}`] | ||
}, | ||
'**/*.ts': async (files) => { | ||
const filesToLint = (await removeIgnoredFiles(files)) | ||
.map(toRelative) | ||
.join(' ') | ||
return [`prettier --check ${filesToFormat}`] | ||
}, | ||
'**/*.ts': async (files) => { | ||
const filesToLint = (await removeIgnoredFiles(files)) | ||
.map(toRelative) | ||
.join(' ') | ||
|
||
return [`eslint --max-warnings=0 ${filesToLint}`] | ||
}, | ||
return [`eslint --max-warnings=0 ${filesToLint}`] | ||
}, | ||
} | ||
|
||
module.exports = config |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,44 +1,45 @@ | ||
{ | ||
"name": "smartlook-relay-proxy", | ||
"description": "Smartlook Relay Proxy", | ||
"license": "MIT", | ||
"version": "3.1.2", | ||
"private": true, | ||
"type": "module", | ||
"exports": "./build/src/main.js", | ||
"engines": { | ||
"node": ">=18", | ||
"pnpm": ">=8" | ||
}, | ||
"dependencies": { | ||
"fast-json-stringify": "5.7.0", | ||
"pino": "8.11.0", | ||
"undici": "5.21.0", | ||
"zod": "3.21.4" | ||
}, | ||
"devDependencies": { | ||
"@commitlint/cli": "17.5.1", | ||
"@commitlint/config-conventional": "17.4.4", | ||
"@types/convict": "6.1.1", | ||
"@types/node": "18.15.11", | ||
"@types/supertest": "2.0.12", | ||
"@typescript-eslint/eslint-plugin": "5.57.0", | ||
"@typescript-eslint/parser": "5.57.0", | ||
"@vitest/coverage-c8": "0.29.8", | ||
"dotenv": "16.0.3", | ||
"eslint": "8.37.0", | ||
"eslint-config-prettier": "8.8.0", | ||
"eslint-import-resolver-typescript": "3.5.4", | ||
"eslint-plugin-import": "2.27.5", | ||
"eslint-plugin-prettier": "4.2.1", | ||
"husky": "8.0.3", | ||
"lint-staged": "13.2.0", | ||
"pino-pretty": "10.0.0", | ||
"prettier": "2.8.7", | ||
"supertest": "6.3.3", | ||
"tsc-watch": "6.0.0", | ||
"tsx": "3.12.6", | ||
"typescript": "5.0.3", | ||
"vitest": "0.29.8" | ||
} | ||
"name": "smartlook-relay-proxy", | ||
"description": "Smartlook Relay Proxy", | ||
"license": "MIT", | ||
"version": "3.1.2", | ||
"private": true, | ||
"type": "module", | ||
"exports": "./build/src/main.js", | ||
"engines": { | ||
"node": ">=18", | ||
"pnpm": ">=8" | ||
}, | ||
"dependencies": { | ||
"@fastify/http-proxy": "9.1.0", | ||
"envey": "1.1.0", | ||
"fastify": "4.17.0", | ||
"gracy": "1.0.2", | ||
"pino": "8.14.1", | ||
"zod": "3.21.4" | ||
}, | ||
"devDependencies": { | ||
"@commitlint/cli": "17.6.3", | ||
"@commitlint/config-conventional": "17.6.3", | ||
"@types/eslint": "8.37.0", | ||
"@types/lint-staged": "13.2.0", | ||
"@types/node": "20.1.1", | ||
"@types/prettier": "2.7.2", | ||
"@typescript-eslint/eslint-plugin": "5.59.5", | ||
"@typescript-eslint/parser": "5.59.5", | ||
"@vitest/coverage-c8": "0.31.0", | ||
"dotenv": "16.0.3", | ||
"eslint": "8.40.0", | ||
"eslint-config-prettier": "8.8.0", | ||
"eslint-import-resolver-typescript": "3.5.5", | ||
"eslint-plugin-import": "2.27.5", | ||
"eslint-plugin-prettier": "4.2.1", | ||
"husky": "8.0.3", | ||
"lint-staged": "13.2.2", | ||
"pino-pretty": "10.0.0", | ||
"prettier": "2.8.8", | ||
"tsx": "3.12.7", | ||
"typescript": "5.0.4", | ||
"vitest": "0.31.0" | ||
} | ||
} |
Oops, something went wrong.