added format command and added trailing commas to reduce conflicts

This commit is contained in:
dswbx
2025-02-26 20:06:03 +01:00
parent 88b5359f1c
commit 7743f71a11
414 changed files with 3622 additions and 3610 deletions
+4 -4
View File
@@ -14,13 +14,13 @@ export async function serveStatic(server: Platform): Promise<MiddlewareHandler>
const m = await import("@hono/node-server/serve-static");
return m.serveStatic({
// somehow different for node
root: getRelativeDistPath() + "/static"
root: getRelativeDistPath() + "/static",
});
}
case "bun": {
const m = await import("hono/bun");
return m.serveStatic({
root: path.resolve(getRelativeDistPath(), "static")
root: path.resolve(getRelativeDistPath(), "static"),
});
}
}
@@ -40,14 +40,14 @@ export async function startServer(server: Platform, app: any, options: { port: n
const serve = await import("@hono/node-server").then((m) => m.serve);
serve({
fetch: (req) => app.fetch(req),
port
port,
});
break;
}
case "bun": {
Bun.serve({
fetch: (req) => app.fetch(req),
port
port,
});
break;
}
+10 -10
View File
@@ -13,7 +13,7 @@ import {
attachServeStatic,
getConfigPath,
getConnectionCredentialsFromEnv,
startServer
startServer,
} from "./platform";
dotenv.config();
@@ -26,26 +26,26 @@ export const run: CliCommand = (program) => {
new Option("-p, --port <port>", "port to run on")
.env("PORT")
.default(config.server.default_port)
.argParser((v) => Number.parseInt(v))
.argParser((v) => Number.parseInt(v)),
)
.addOption(
new Option("-m, --memory", "use in-memory database").conflicts([
"config",
"db-url",
"db-token"
])
"db-token",
]),
)
.addOption(new Option("-c, --config <config>", "config file"))
.addOption(
new Option("--db-url <db>", "database url, can be any valid libsql url").conflicts(
"config"
)
"config",
),
)
.addOption(new Option("--db-token <db>", "database token").conflicts("config"))
.addOption(
new Option("--server <server>", "server type")
.choices(PLATFORMS)
.default(isBun ? "bun" : "node")
.default(isBun ? "bun" : "node"),
)
.action(action);
};
@@ -76,7 +76,7 @@ async function makeApp(config: MakeAppConfig) {
await config.onBuilt(app);
}
},
"sync"
"sync",
);
await app.build();
@@ -95,7 +95,7 @@ export async function makeConfigApp(config: CliBkndConfig, platform?: Platform)
await config.onBuilt?.(app);
},
"sync"
"sync",
);
await config.beforeBuild?.(app);
@@ -141,7 +141,7 @@ async function action(options: {
console.info("Using connection", c.cyan(connection.url));
app = await makeApp({
connection,
server: { platform: options.server }
server: { platform: options.server },
});
}