Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(cli): add listhen options for dev command #1622

Merged
merged 2 commits into from
Aug 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@
"jiti": "^1.19.3",
"klona": "^2.0.6",
"knitwork": "^1.0.0",
"listhen": "^1.3.0",
"listhen": "^1.4.0",
"magic-string": "^0.30.3",
"mime": "^3.0.0",
"mlly": "^1.4.0",
Expand Down
23 changes: 10 additions & 13 deletions pnpm-lock.yaml

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

7 changes: 5 additions & 2 deletions src/cli/commands/dev.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { defineCommand } from "citty";
import { ParsedArgs, defineCommand } from "citty";
import { resolve } from "pathe";
import { consola } from "consola";
import { getArgs, parseArgs } from "listhen/cli";
import { createNitro } from "../../nitro";
import { build, prepare } from "../../build";
import { createDevServer } from "../../dev/server";
Expand All @@ -16,6 +17,7 @@ export default defineCommand({
},
args: {
...commonArgs,
...getArgs(),
},
async run({ args }) {
const rootDir = resolve((args.dir || args._dir || ".") as string);
Expand Down Expand Up @@ -58,7 +60,8 @@ export default defineCommand({
);
nitro.hooks.hookOnce("restart", reload);
const server = createDevServer(nitro);
await server.listen({});
const listhenOptions = parseArgs(args);
await server.listen(listhenOptions.port, listhenOptions);
await prepare(nitro);
await build(nitro);
};
Expand Down