A self-hostable bookmark-everything app (links, notes and images) with AI-based automatic tagging and full text search
build: Add an open-api husky check
Mohamed Bassem71458166108a
diff --git a/.husky/pre-commit b/.husky/pre-commitindex 5a448e3b..eb3cb0a2 100644--- a/.husky/pre-commit+++ b/.husky/pre-commit@@ -2,3 +2,4 @@ pnpm typecheckpnpm format --checkpnpm lintpnpm exec sherif+pnpm run --filter @karakeep/open-api checkdiff --git a/packages/open-api/index.ts b/packages/open-api/index.tsindex 06fbc913..057a823f 100644--- a/packages/open-api/index.ts+++ b/packages/open-api/index.ts@@ -1,4 +1,5 @@import * as fs from "fs";+import * as process from "process";import {OpenApiGeneratorV3,OpenAPIRegistry,@@ -54,4 +55,19 @@ function writeDocumentation() {});}-writeDocumentation();+function checkDocumentation() {+ const docs = getOpenApiDocumentation();+ const fileContent = JSON.stringify(docs, null, 2);+ const oldContent = fs.readFileSync(`./karakeep-openapi-spec.json`, {+ encoding: "utf-8",+ });+ if (oldContent !== fileContent) {+ process.exit(1);+ }+}++if (process.argv[2] === "check") {+ checkDocumentation();+} else {+ writeDocumentation();+}diff --git a/packages/open-api/package.json b/packages/open-api/package.jsonindex d88543a9..a2a20ef7 100644--- a/packages/open-api/package.json+++ b/packages/open-api/package.json@@ -16,6 +16,7 @@},"scripts": {"typecheck": "tsc --noEmit",+ "check": "tsx index.ts check","generate": "tsx index.ts","format": "prettier . --ignore-path ../../.prettierignore","format:fix": "prettier . --write --ignore-path ../../.prettierignore",