@farm.js/cli 0.1.0-beta.1 → 0.1.0-beta.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/bin/farm.js CHANGED
@@ -33,7 +33,7 @@ function collectOption(value, previous) {
33
33
  program
34
34
  .command("dev")
35
35
  .description("Start development server")
36
- .option("-p, --port <port>", "Port to run the server on", "3000")
36
+ .option("-p, --port <port>", "Override the port to run the server on")
37
37
  .option("-r, --root <root>", "Root directory", process.cwd())
38
38
  .option("--cron", "Run configured cron routes in-process during development")
39
39
  .action(async (options) => {
@@ -43,12 +43,12 @@ program
43
43
  {
44
44
  root: options.root,
45
45
  },
46
- parseInt(options.port),
46
+ options.port === undefined ? undefined : parseInt(options.port, 10),
47
47
  );
48
48
  if (options.cron) {
49
49
  const { startFarmCronScheduler } = require("../dist/index.js");
50
50
  const address = server.httpServer?.address();
51
- const port = typeof address === "object" && address ? address.port : parseInt(options.port);
51
+ const port = typeof address === "object" && address ? address.port : 3000;
52
52
  const scheduler = await startFarmCronScheduler({
53
53
  root: options.root,
54
54
  url: `http://localhost:${port}`,