From 7440e3a8e9301bbc887ca6bf07939a192d03acfd Mon Sep 17 00:00:00 2001 From: Cosmin Popovici Date: Fri, 19 Jul 2024 13:45:12 +0300 Subject: [PATCH] feat: add --port option --- src/index.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/index.js b/src/index.js index 726e8cd..08ed357 100644 --- a/src/index.js +++ b/src/index.js @@ -80,17 +80,20 @@ export default async function() { .command('serve [environment]') .option('-b, --bin [bin]', 'path to the maizzle executable') .option('-c, --config [config]', 'path to a maizzle config file') - .option('-nc, --noclear [noclear]', 'do not clear the console log') + .option('-p, --port [port]', 'port number to run the server on') .description('Start a local development server') .action(async (env, options) => { + let config = options.config + let port = options.port + if (options.bin) { let { serve } = await importFrom(options.bin, '@maizzle/framework') - options.config ? await serve(options.config) : await serve({ env }) + config ? await serve(config) : await serve({ server: { port }, env }) } else { let { serve } = await importFrom(process.cwd(), '@maizzle/framework') - options.config ? await serve(options.config) : await serve({ env }) + config ? await serve(config) : await serve({ server: { port }, env }) } })