Skip to content

Commit

Permalink
Add biome and format
Browse files Browse the repository at this point in the history
  • Loading branch information
KomelT committed Sep 27, 2024
1 parent ffa044c commit 2ce2412
Show file tree
Hide file tree
Showing 39 changed files with 1,006 additions and 317 deletions.
7 changes: 7 additions & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"recommendations": [
"ms-azuretools.vscode-docker",
"vue.volar",
"biomejs.biome"
]
}
6 changes: 6 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"editor.detectIndentation": false,
"editor.insertSpaces": false,
"editor.tabSize": 4,
"editor.defaultFormatter": "biomejs.biome"
}
40 changes: 40 additions & 0 deletions api/biome.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
{
"$schema": "https://biomejs.dev/schemas/1.8.3/schema.json",
"organizeImports": {
"enabled": true
},
"files": {
"ignoreUnknown": true,
"ignore": ["node_modules", "dist"]
},
"formatter": {
"enabled": true,
"indentStyle": "tab",
"indentWidth": 4,
"lineWidth": 80
},
"linter": {
"enabled": true,
"rules": {
"recommended": true
}
},
"javascript": {
"formatter": {
"enabled": true,
"quoteStyle": "double",
"jsxQuoteStyle": "double",
"quoteProperties": "asNeeded",
"trailingCommas": "all",
"semicolons": "always",
"arrowParentheses": "always",
"indentStyle": "tab",
"indentWidth": 4,
"lineEnding": "lf",
"lineWidth": 80,
"bracketSameLine": true,
"bracketSpacing": true,
"attributePosition": "auto"
}
}
}
10 changes: 5 additions & 5 deletions api/nodemon.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"verbose": true,
"ignore": ["./dist/*"],
"execMap": {
"ts": "npx tsx"
}
"verbose": true,
"ignore": ["./dist/*"],
"execMap": {
"ts": "npx tsx"
}
}
165 changes: 165 additions & 0 deletions api/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

69 changes: 36 additions & 33 deletions api/package.json
Original file line number Diff line number Diff line change
@@ -1,35 +1,38 @@
{
"name": "meshtastic-map-api",
"version": "1.0.0",
"description": "API for a map of all Meshtastic nodes heard via MQTT.",
"main": "src/index.ts",
"type": "module",
"scripts": {
"start": "npx prisma migrate deploy && node dist/index.js",
"build": "npx tsc",
"dev": "npx prisma generate && npx prisma migrate deploy && nodemon"
},
"repository": {
"type": "git",
"url": "git+https://github.com/liamcottle/meshtastic-map.git"
},
"author": "",
"license": "ISC",
"bugs": {
"url": "https://github.com/liamcottle/meshtastic-map/issues"
},
"homepage": "https://github.com/liamcottle/meshtastic-map#readme",
"devDependencies": {
"@types/express": "^4.17.21",
"@types/node": "^22.2.0",
"nodemon": "^3.1.4",
"prisma": "^5.18.0",
"tsx": "^4.17.0",
"typescript": "^5.5.4"
},
"dependencies": {
"@buf/meshtastic_protobufs.bufbuild_es": "^2.0.0-20240813231743-2730236cd9ec.2",
"@prisma/client": "^5.18.0",
"express": "^4.19.2"
}
"name": "meshtastic-map-api",
"version": "1.0.0",
"description": "API for a map of all Meshtastic nodes heard via MQTT.",
"main": "src/index.ts",
"type": "module",
"scripts": {
"start": "npx prisma migrate deploy && node dist/index.js",
"build": "npm run check && npx tsc",
"check": "biome check",
"check:fix": "biome check --write --unsafe",
"dev": "npx prisma generate && npx prisma migrate deploy && nodemon"
},
"repository": {
"type": "git",
"url": "git+https://github.com/liamcottle/meshtastic-map.git"
},
"author": "",
"license": "ISC",
"bugs": {
"url": "https://github.com/liamcottle/meshtastic-map/issues"
},
"homepage": "https://github.com/liamcottle/meshtastic-map#readme",
"devDependencies": {
"@biomejs/biome": "1.9.2",
"@types/express": "^4.17.21",
"@types/node": "^22.2.0",
"nodemon": "^3.1.4",
"prisma": "^5.18.0",
"tsx": "^4.17.0",
"typescript": "^5.5.4"
},
"dependencies": {
"@buf/meshtastic_protobufs.bufbuild_es": "^2.0.0-20240813231743-2730236cd9ec.2",
"@prisma/client": "^5.18.0",
"express": "^4.19.2"
}
}
14 changes: 7 additions & 7 deletions api/src/db.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ import { PrismaClient } from "@prisma/client";
export const prisma = new PrismaClient();

export const healthy = new Promise<boolean>((resolve) => {
try {
prisma.$queryRaw`SELECT 1;`;
resolve(true);
} catch (e) {
console.error("DB:HEALTH", e);
resolve(false);
}
try {
prisma.$queryRaw`SELECT 1;`;
resolve(true);
} catch (e) {
console.error("DB:HEALTH", e);
resolve(false);
}
});
2 changes: 1 addition & 1 deletion api/src/http.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export const http = Http.createServer();
http.on("request", express);

http.listen(settings.HTTP_PORT, () => {
console.log(`
console.log(`
.- - - - - - - - - - - - - - - - - - - -
| Started the API http server on port ${settings.HTTP_PORT}
'- - - - - - - - - - - - - - - - - - - -
Expand Down
Loading

0 comments on commit 2ce2412

Please sign in to comment.