-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Create a publishable mizu hono middleware client library (#18)
* Replace neon with libsql * Fix json parsing of messages and add support for drizzle studio * Define db in middleware for the hono app * Remove the node:dev script * Add comment to the db middleware * Remove wrangler toml from api to reduce confusion * Barebones prototype of npx support * Improve migration logic for when we are in dist folder * Hacky ability to serve frontend * Add catchall for frontend routes * Allow configuring the port for mizu via env var MIZU_PORT * Start preparing a publish * Remove @/ imports because they did not get transpiled correctly and NOW IT WORKS kinda * Proxy api requests in vite on frontend to the api server * Update readme and package.json * Suppress type errors in find-source-function.ts * Update tsconfig and then appease typescript - changed types to "node" instead of cloudflare workers - changed "module" to NodeNext, which required renaming a bunch of imports * Remove more @/ imports because they do not play nicely with node * Add comments to some confusing helpers * Modify additional files after transition to node modules * Bump package.json * Fix more conflicts and format * Modify biome to ignore all files in dist folders (including d.ts, which caused issues for me) * Organize import test * Okay vscode is confused about import org * Change cli.cjs to cli.js * Hackily automigrate * Fix cli.js to work with modern node * Simplify build and update readmes * Update root readme * Format * Update api package.json license * Ignore the biome config from published package * Update readme * Improve comments in cli.js * Add comments about __dirname shim * Write a comment to explain the getMigrationsFolder function * Move typescript to dev deps * Remove wrangler from the api * Ignore drizzle.config.ts in the published package * Bump package version of api to 0.0.8 * Format * Update comment in index.node.ts about the GET catchall * Fix references to renamed scripts folder (now test-content) * Update npmignore and package.json in api after merge * Format * Prepare client library for publishing on npm * Remove postinstall script from client-library * Update README * Add default createConfig to createHonoMiddleware * Make installation easier * Rename to @mizu-dev/hono * Update package-lock * Update README * Hissssss tabs
- Loading branch information
Showing
6 changed files
with
291 additions
and
69 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
node_modules | ||
.dev.vars | ||
.dev.vars.example | ||
|
||
# do not publish src | ||
src/* | ||
|
||
# do not publish tsconfig or swcrc | ||
tsconfig.json | ||
.swcrc | ||
|
||
# do not publish biome config | ||
biome.jsonc | ||
|
||
# Change them to your taste: | ||
package-lock.json | ||
yarn.lock | ||
pnpm-lock.yaml | ||
bun.lockb | ||
|
||
# mac | ||
.DS_Store | ||
|
||
# env files | ||
.env | ||
.envrc | ||
|
||
# VS Code | ||
.vscode/* | ||
*.code-workspace | ||
|
||
# CLion | ||
.idea | ||
|
||
# TypeScript / Yarn | ||
.yarn/* | ||
!.yarn/patches | ||
!.yarn/plugins | ||
!.yarn/releases | ||
!.yarn/sdks | ||
!.yarn/versions | ||
node_modules | ||
package-lock.json | ||
yarn-error.log | ||
|
||
# Build tools | ||
.parcel-cache* | ||
.nx/cache | ||
*.tsbuildinfo | ||
|
||
# Personal files | ||
mizu.boots.code-workspace | ||
start-dev.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,36 @@ | ||
{ | ||
"name": "mizu", | ||
"name": "@mizu-dev/hono", | ||
"description": "Hono middleware to forward data to a local instance of @mizu-dev/studio", | ||
"author": "Fiberplane<[email protected]>", | ||
"type": "module", | ||
"main": "dist/index.js", | ||
"version": "0.1.0", | ||
"version": "0.0.1", | ||
"dependencies": { | ||
"@biomejs/biome": "^1.7.3", | ||
"@neondatabase/serverless": "^0.9.3", | ||
"@swc/cli": "^0.3.12", | ||
"@swc/core": "^1.5.22", | ||
"@swc/plugin-transform-imports": "^2.0.4", | ||
"hono": "^4.3.9" | ||
}, | ||
"devDependencies": { | ||
"@biomejs/biome": "^1.7.3", | ||
"@cloudflare/workers-types": "^4.20240403.0", | ||
"dotenv": "^16.4.5", | ||
"tsx": "^4.10.5", | ||
"typescript": "^5.4.5", | ||
"wrangler": "^3.47.0" | ||
"@swc/cli": "^0.3.12", | ||
"@swc/core": "^1.5.22", | ||
"@swc/plugin-transform-imports": "^2.0.4", | ||
"rimraf": "^5.0.7", | ||
"typescript": "^5.4.5" | ||
}, | ||
"publishConfig": { | ||
"access": "public" | ||
}, | ||
"license": "MIT or Apache 2", | ||
"keywords": ["hono", "hono middleware", "local", "debugging"], | ||
"scripts": { | ||
"build": "cd src && swc . -d ../dist", | ||
"format": "biome check . --write", | ||
"lint": "biome lint .", | ||
"lint:ci": "biome ci .", | ||
"postinstall": "cd src && swc . -d ../dist" | ||
"build": "npm run clean && npm run build:types && npm run build:swc", | ||
"build:types": "tsc --project tsconfig.json", | ||
"build:swc": "swc src -d dist --source-maps", | ||
"prepublishOnly": "npm run build", | ||
"clean": "rimraf dist" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,16 @@ | ||
{ | ||
"compilerOptions": { | ||
"target": "ESNext", | ||
"module": "ESNext", | ||
"target": "ES2020", | ||
"module": "ES6", | ||
"moduleResolution": "Bundler", | ||
"strict": true, | ||
"skipLibCheck": true, | ||
"lib": ["ESNext"], | ||
"types": ["@cloudflare/workers-types"], | ||
"noEmit": true | ||
} | ||
"esModuleInterop": true, | ||
"outDir": "./dist", | ||
"rootDir": "./src", | ||
"declaration": true | ||
}, | ||
"include": ["src"] | ||
} |
Oops, something went wrong.