-
-
Notifications
You must be signed in to change notification settings - Fork 370
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[WIP] introducing typescript, still unstable
- Loading branch information
1 parent
eff1f7a
commit 778027a
Showing
26 changed files
with
2,381 additions
and
161 deletions.
There are no files selected for viewing
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,43 @@ | ||
module.exports = { | ||
parser: '@typescript-eslint/parser', | ||
root: true, | ||
extends: [ | ||
'plugin:@typescript-eslint/recommended', // Uses the recommended rules from the @typescript-eslint/eslint-plugin | ||
'prettier', | ||
'prettier/@typescript-eslint', // Uses eslint-config-prettier to disable ESLint rules from @typescript-eslint/eslint-plugin that would conflict with prettier | ||
'plugin:prettier/recommended', // Enables eslint-plugin-prettier and eslint-config-prettier. This will display prettier errors as ESLint errors. Make sure this is always the last configuration in the extends array. | ||
], | ||
plugins: ['@typescript-eslint', 'no-only-tests'], | ||
parserOptions: { | ||
ecmaVersion: 2019, // Allows for the parsing of modern ECMAScript features | ||
sourceType: 'module', // Allows for the use of imports | ||
ecmaFeatures: { | ||
modules: true, | ||
}, | ||
}, | ||
env: { | ||
node: true, | ||
es6: true, | ||
jest: true, | ||
browser: true, | ||
}, | ||
settings: { | ||
react: { | ||
version: 'detect', | ||
}, | ||
}, | ||
rules: { | ||
// Routes | ||
'no-console': 'warn', | ||
'no-only-tests/no-only-tests': 'error', | ||
'@typescript-eslint/explicit-function-return-type': 'off', | ||
'@typescript-eslint/no-use-before-define': 'off', | ||
'@typescript-eslint/no-explicit-any': 'off', | ||
'@typescript-eslint/no-empty-interface': 'off', | ||
|
||
// UI | ||
'prettier/prettier': 'error', | ||
'react/prop-types': 'off', | ||
'react/display-name': 'off', | ||
}, | ||
} |
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,5 @@ | ||
node_modules/ | ||
static/ | ||
dist/ | ||
yarn-error.log | ||
*.rdb |
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 was deleted.
Oops, something went wrong.
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,56 @@ | ||
import express, { RequestHandler } from 'express' | ||
import path from 'path' | ||
import {} from 'bull' | ||
|
||
import { queues as queuesRoute } from './routes/queues' | ||
import { retryAll } from './routes/retryAll' | ||
import { retryJob } from './routes/retryJob' | ||
import { cleanAll } from './routes/cleanAll' | ||
import { entryPoint } from './routes/index' | ||
|
||
const app = express() | ||
const queues = {} | ||
|
||
const wrapAsync = (fn: RequestHandler): RequestHandler => async ( | ||
req, | ||
res, | ||
next, | ||
) => Promise.resolve(fn(req, res, next)).catch(next) | ||
|
||
const UI = () => { | ||
app.locals.queues = queues | ||
|
||
app.set('view engine', 'ejs') | ||
app.set('views', `${__dirname}/ui`) | ||
|
||
app.use('/static', express.static(path.join(__dirname, './static'))) | ||
|
||
app.get('/', entryPoint) | ||
app.get('/queues', wrapAsync(queuesRoute)) | ||
app.put('/queues/:queueName/retry', wrapAsync(retryAll)) | ||
app.put('/queues/:queueName/:id/retry', wrapAsync(retryJob)) | ||
app.put('/queues/:queueName/clean/:queueStatus', wrapAsync(cleanAll)) | ||
|
||
return app | ||
} | ||
|
||
const getQueueVersion = queue => { | ||
if (typeof queue.drain === 'function') { | ||
return 4 | ||
} | ||
|
||
if (typeof queue.pauseWorker === 'function') { | ||
return 4 | ||
} | ||
|
||
return 3 | ||
} | ||
|
||
export default { | ||
UI: UI(), | ||
setQueues(bullQueues) { | ||
bullQueues.forEach(item => { | ||
queues[item.name] = { ...item, version: getQueueVersion(item) } | ||
}) | ||
}, | ||
} |
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 |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import { RequestHandler } from 'express' | ||
|
||
export const entryPoint: RequestHandler = (req, res) => { | ||
const basePath = req.proxyUrl || req.baseUrl | ||
|
||
res.render('index', { basePath }) | ||
} |
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
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
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,19 @@ | ||
{ | ||
"compilerOptions": { | ||
"outDir": "./dist", | ||
"esModuleInterop": true, | ||
"lib": ["es2019"], | ||
"module": "commonjs", | ||
"moduleResolution": "node", | ||
"noImplicitAny": true, | ||
"sourceMap": true, | ||
"strict": true, | ||
"target": "es2019", | ||
"noUnusedParameters": true, | ||
"noUnusedLocals": true, | ||
"resolveJsonModule": true, | ||
"declaration": true | ||
}, | ||
"include": ["./src"], | ||
"exclude": ["./src/ui"] | ||
} |
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
Oops, something went wrong.