Skip to content

Commit

Permalink
cache_worker scaffold start
Browse files Browse the repository at this point in the history
  • Loading branch information
epipav committed Jan 9, 2024
1 parent db29676 commit f664043
Show file tree
Hide file tree
Showing 6 changed files with 127 additions and 0 deletions.
21 changes: 21 additions & 0 deletions services/apps/cache_worker/.eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
module.exports = {
parser: '@typescript-eslint/parser',
extends: [
'eslint:recommended',
'plugin:@typescript-eslint/recommended',
'plugin:prettier/recommended',
],
plugins: ['@typescript-eslint', 'prettier'],
parserOptions: {
ecmaVersion: 2022,
sourceType: 'module',
},
env: {
es6: true,
node: true,
},
rules: {
'prettier/prettier': 'error',
'@typescript-eslint/explicit-module-boundary-types': 'off',
},
}
3 changes: 3 additions & 0 deletions services/apps/cache_worker/.prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
dist/
.eslintrc.cjs
.prettierrc.cjs
7 changes: 7 additions & 0 deletions services/apps/cache_worker/.prettierrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
module.exports = {
singleQuote: true,
arrowParens: 'always',
printWidth: 100,
trailingComma: 'all',
semi: false,
}
47 changes: 47 additions & 0 deletions services/apps/cache_worker/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
{
"name": "@crowd/merge-suggestions-worker",
"version": "1.0.0",
"private": true,
"scripts": {
"start": "CROWD_TEMPORAL_TASKQUEUE=merge-suggestions SERVICE=merge-suggestions-worker TS_NODE_TRANSPILE_ONLY=true node -r tsconfig-paths/register -r ts-node/register src/main.ts",
"start:debug:local": "set -a && . ../../../backend/.env.dist.local && . ../../../backend/.env.override.local && set +a && CROWD_TEMPORAL_TASKQUEUE=merge-suggestions SERVICE=merge-suggestions-worker TS_NODE_TRANSPILE_ONLY=true LOG_LEVEL=trace node --inspect=0.0.0.0:9232 -r tsconfig-paths/register -r ts-node/register src/main.ts",
"start:debug": "CROWD_TEMPORAL_TASKQUEUE=merge-suggestions SERVICE=merge-suggestions-worker TS_NODE_TRANSPILE_ONLY=true LOG_LEVEL=trace node --inspect=0.0.0.0:9232 -r tsconfig-paths/register -r ts-node/register src/main.ts",
"dev:local": "./node_modules/.bin/nodemon --watch src --watch ../../libs --ext ts --exec pnpm run start:debug:local",
"dev": "./node_modules/.bin/nodemon --watch src --watch ../../libs --ext ts --exec pnpm run start:debug",
"lint": "./node_modules/.bin/eslint --ext .ts src --max-warnings=0",
"format": "./node_modules/.bin/prettier --write \"src/**/*.ts\"",
"format-check": "./node_modules/.bin/prettier --check .",
"tsc-check": "./node_modules/.bin/tsc --noEmit"
},
"dependencies": {
"@crowd/archetype-standard": "file:../../archetypes/standard",
"@crowd/archetype-worker": "file:../../archetypes/worker",
"@crowd/common": "file:../../libs/common",
"@crowd/cubejs": "file:../../libs/cubejs",
"@crowd/types": "file:../../libs/types",
"@crowd/feature-flags": "file:../../libs/feature-flags",
"@temporalio/activity": "~1.8.6",
"@temporalio/client": "~1.8.6",
"@temporalio/workflow": "~1.8.6",
"axios": "~1.5.1",
"fast-levenshtein": "^3.0.0",
"html-to-text": "~9.0.5",
"lodash": "~4.17.21",
"moment": "~2.29.4",
"ts-node": "^10.9.1",
"tsconfig-paths": "^4.2.0",
"typescript": "^5.2.2",
"uuid": "~9.0.1"
},
"devDependencies": {
"@types/node": "^20.8.2",
"@types/uuid": "~9.0.6",
"@typescript-eslint/eslint-plugin": "^6.7.4",
"@typescript-eslint/parser": "^6.7.4",
"eslint": "^8.50.0",
"eslint-config-prettier": "^9.0.0",
"eslint-plugin-prettier": "^5.0.0",
"nodemon": "^3.0.1",
"prettier": "^3.0.3"
}
}
31 changes: 31 additions & 0 deletions services/apps/cache_worker/src/main.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import { Config } from '@crowd/archetype-standard'
import { ServiceWorker, Options } from '@crowd/archetype-worker'

const config: Config = {
envvars: [],
producer: {
enabled: false,
},
temporal: {
enabled: true,
},
redis: {
enabled: true,
},
}

const options: Options = {
postgres: {
enabled: true,
},
opensearch: {
enabled: false,
},
}

export const svc = new ServiceWorker(config, options)

setImmediate(async () => {
await svc.init()
await svc.start()
})
18 changes: 18 additions & 0 deletions services/apps/cache_worker/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"compilerOptions": {
"target": "es2017",
"module": "Node16",
"lib": ["es6", "es7", "es2017", "es2017.object", "es2015.promise", "ES2021.String"],
"skipLibCheck": true,
"sourceMap": true,
"moduleResolution": "node16",
"experimentalDecorators": true,
"esModuleInterop": true,
"baseUrl": "./src",
"paths": {
"@crowd/*": ["../../../libs/*/src"],
"@crowd/archetype-*": ["../../../archetypes/*/src"]
}
},
"include": ["src/**/*"]
}

0 comments on commit f664043

Please sign in to comment.