From 600969054ec43c49c8204e5832ff90fb16568cc0 Mon Sep 17 00:00:00 2001 From: Vortex Date: Fri, 2 Feb 2024 17:00:18 -0600 Subject: [PATCH] Added /metadata Fixed build:docs entry point Changed prettier path from src to . Added .dev.vars to .gitignore Formatting --- .gitignore | 2 +- .vscode/settings.json | 3 +-- functions/metadata.ts | 10 +++++++++- license.md | 1 - package.json | 6 +++--- readme.md | 6 +++--- tsconfig.json | 4 ++-- 7 files changed, 19 insertions(+), 13 deletions(-) diff --git a/.gitignore b/.gitignore index 2a443f2..76f71c8 100644 --- a/.gitignore +++ b/.gitignore @@ -5,6 +5,6 @@ docs .env* .wrangler *.log -#temporaries +.dev.vars tmp temp \ No newline at end of file diff --git a/.vscode/settings.json b/.vscode/settings.json index 7a73a41..0967ef4 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,2 +1 @@ -{ -} \ No newline at end of file +{} diff --git a/functions/metadata.ts b/functions/metadata.ts index a51f87a..5a5a75e 100644 --- a/functions/metadata.ts +++ b/functions/metadata.ts @@ -2,11 +2,19 @@ import { StatusCodes } from 'http-status-codes'; import { setDB } from '../src/backend/api'; import type { RequestContext } from '../src/backend/context'; import { error, response } from '../src/backend/utils'; +import { version } from '../package.json'; export async function onRequest({ env }: RequestContext) { try { setDB(env.DB); - return response(StatusCodes.OK, {}, false); + return response( + StatusCodes.OK, + { + version, + debug: !!env.DEBUG, + }, + false + ); } catch (e) { console.error(e); return error(StatusCodes.INTERNAL_SERVER_ERROR, env.DEBUG && e?.message); diff --git a/license.md b/license.md index f6afadd..9067a23 100644 --- a/license.md +++ b/license.md @@ -34,7 +34,6 @@ The licensor reserve's the right to take down any content at their discretion. The licensor might make upgrades, updates or patches (collectivly "updates") available from time to time, but they don't have to. they are also not obliged to provide ongoing support or maintenance of any Game. With updates come changes that might not work well with other software, such as Mods. This is unfortunate, but it is something the licensor does not take responsibility for. - ## Warranty and Liability THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/package.json b/package.json index 2d62977..1b30874 100644 --- a/package.json +++ b/package.json @@ -24,11 +24,11 @@ "license.md" ], "scripts": { - "format:check": "prettier --check src", - "format": "prettier --write src", + "format:check": "prettier --check .", + "format": "prettier --write .", "lint": "eslint src functions && tsc --project tsconfig.json --noEmit", "build:frontend": "node scripts/build.js", - "build:docs": "typedoc src/index.ts --includeVersion --readme readme.md --darkHighlightTheme monokai --lightHighlightTheme monokai", + "build:docs": "typedoc src/frontend/index.ts --includeVersion --readme readme.md --darkHighlightTheme monokai --lightHighlightTheme monokai", "prepublishOnly": "npm run build:frontend", "dev": "wrangler pages dev public --compatibility-flags='nodejs_compat' --ip localhost" }, diff --git a/readme.md b/readme.md index 6b2d3a2..c97194a 100644 --- a/readme.md +++ b/readme.md @@ -1,8 +1,8 @@ # Blankstorm API -This is the code for Blankstorm's REST API. +This is the code for Blankstorm's REST API. -# @blankstorm/api +### @blankstorm/api This is the client-side library. It provides typings and convience functions. @@ -26,4 +26,4 @@ auth(authToken); const { id } = await getAccount('token', authToken); await logout(id); -``` \ No newline at end of file +``` diff --git a/tsconfig.json b/tsconfig.json index 04c185f..931a006 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -10,6 +10,6 @@ "noEmit": true, "esModuleInterop": true, "allowJs": true, - "strictFunctionTypes": true - } + "strictFunctionTypes": true, + }, }