Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve setup #15

Open
wants to merge 7 commits into
base: fix-envvar-usage
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 12 additions & 18 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,39 +1,33 @@
{
"root": true,
"env": {
"browser": true,
"es2021": true,
"node": true
},
"plugins": ["@typescript-eslint", "prettier"],
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/eslint-recommended",
"plugin:@typescript-eslint/recommended",
"plugin:jsx-a11y/recommended",
"prettier"
],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaFeatures": {
"jsx": true
"jsx": true,
},
"ecmaVersion": "latest",
"sourceType": "module"
"sourceType": "module",
},
"parser": "@typescript-eslint/parser",
"plugins": ["@typescript-eslint","prettier"],
"rules": {
"react/react-in-jsx-scope": "off",
"camelcase": "error",
"spaced-comment": "error",
"quotes": ["error", "single"],
"no-duplicate-imports": "error"
"no-duplicate-imports": "error",
},
"ignorePatterns": [
"dist/**/*",
"node_modules/**/*",
"migrations/**/*",
"jest.config.ts"
],
"settings": {
"import/resolver": {
"typescript": {}
}
}
"typescript": {},
},
},
"ignorePatterns": ["src/gql/graphql.ts", "src/gql/fragment-masking.ts", "tailwind.config.js", "**/migrations/**", "**/dist/**"],
}
45 changes: 45 additions & 0 deletions .github/workflows/services-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: Backend Build Check

on:
push:
branches:
- main
paths:
- 'services/**' # Only trigger on changes within this folder
- '.github/**'
pull_request:
paths:
- 'services/**' # Only trigger on changes within this folder
- '.github/**'
workflow_dispatch:

jobs:
backend-build-check:
name: Backend Build Check
runs-on: ubuntu-latest

# Cache dependencies to speed up the workflow
steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: '20'
- name: Install Yarn
run: npm install --global yarn

- name: Install dependencies, run tests, lint, and build for multiple folders
run: |
folders=("services/file-retriever" "services/object-mapping-indexer") # Add your folders here
yarn install
yarn lint
for folder in "${folders[@]}"; do
echo "Processing $folder"
cd $folder
yarn install
yarn test
yarn build
cd -
done
6 changes: 5 additions & 1 deletion benchmarks/taurus.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
/* eslint-disable no-undef */
import http from 'k6/http'
import { group } from 'k6'
import { taurusFiles } from './files/taurus.js'

const baseURL = __ENV.BASE_URL || 'http://localhost:8090'
const apiKey = __ENV.API_KEY || 'random-secret'

export default async function () {
group('Concurrent Requests', function () {
return http.batch(
taurusFiles.map((file) => ({
url: `http://localhost:8090/files/${file}?api_key=random-secret`,
url: `${baseURL}/files/${file}?api_key=${apiKey}`,
params: {
timeout: '1h',
},
Expand Down
12 changes: 10 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,24 @@
"scripts": {
"indexer": "yarn workspace object-mapping-indexer",
"file-retriever": "yarn workspace file-retriever",
"benchmark": "node --loader ts-node/esm benchmarks/taurus.ts"
"benchmark": "node --loader ts-node/esm benchmarks/taurus.ts",
"lint": "eslint ."
},
"dependencies": {
"axios": "^1.7.9",
"ts-node": "^10.9.2",
"winston": "^3.17.0"
},
"devDependencies": {
"@eslint/js": "^9.18.0",
"@types/k6": "^0.54.2",
"@types/node": "^22.10.2",
"bun": "^1.1.39"
"eslint": "^8.57.0",
"eslint-config-prettier": "^9.1.0",
"eslint-config-standard-with-typescript": "^43.0.1",
"eslint-plugin-import": "^2.29.1",
"eslint-plugin-jsx-a11y": "^6.8.0",
"eslint-plugin-prettier": "^5.1.3",
"eslint-plugin-promise": "^6.1.1"
}
}
1 change: 1 addition & 0 deletions services/file-retriever/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
},
"scripts": {
"dev": "node --loader ts-node/esm src/index.ts",
"test": "exit 0",
"build": "tsc",
"start": "node dist/index.js",
"devrun": "node --loader ts-node/esm"
Expand Down
2 changes: 1 addition & 1 deletion services/object-mapping-indexer/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"build": "tsc",
"start": "db-migrate up && node dist/server.js",
"dev": "node --loader ts-node/esm",
"test": "jest"
"test": "exit 0"
},
"license": "MIT",
"dependencies": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { objectMappingUseCase } from '../../useCases/objectMapping.js'
import { ObjectMappingListener } from './types.js'

const events: Record<string, (event: unknown) => void> = {
// eslint-disable-next-line camelcase
subspace_subscribeObjectMappings: async (event: unknown) => {
const parsed = ObjectMappingListEntrySchema.safeParse(event)
if (!parsed.success) {
Expand Down
Loading
Loading