@ubean/cli 0.4.10 → 0.5.1

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.
Files changed (2) hide show
  1. package/dist/cli.js +19 -14
  2. package/package.json +12 -12
package/dist/cli.js CHANGED
@@ -22,7 +22,7 @@ import { ubeanPlugin } from "@ubean/build/vite";
22
22
  import { VUE_PLUGIN_INCLUDE, ubeanVite } from "@ubean/build/vue";
23
23
  import { getVueLocaleParam, toVueRouterLocalePath } from "@ubean/i18n";
24
24
  import { ubeanIslandsPlugin } from "@ubean/islands/vite";
25
- import { findAvailablePort, findUserViteConfig, waitForPort } from "@ubean/shared/node";
25
+ import { findAvailablePort, findUserViteConfig, getLanAddresses, isLoopbackHost, isWildcardHost, waitForPort } from "@ubean/shared/node";
26
26
  import { execSync, spawn } from "node:child_process";
27
27
  //#region src/config.ts
28
28
  const logger$11 = getLogger("cli");
@@ -867,7 +867,9 @@ async function createViteDevServer(options) {
867
867
  app.resetInit();
868
868
  }
869
869
  enhanceAppWithVite(currentApp, currentLayouts);
870
- const getUrl = () => `http://${host}:${actualPort}`;
870
+ const displayHost = isWildcardHost(host) ? "localhost" : host;
871
+ const getNetworkUrls = () => isLoopbackHost(host) ? [] : getLanAddresses().map((address) => `http://${address}:${actualPort}`);
872
+ const getUrl = () => `http://${displayHost}:${actualPort}`;
871
873
  return {
872
874
  get port() {
873
875
  return actualPort;
@@ -902,7 +904,8 @@ async function createViteDevServer(options) {
902
904
  options.onListen?.({
903
905
  port: actualPort,
904
906
  host,
905
- url: getUrl()
907
+ url: getUrl(),
908
+ networkUrls: getNetworkUrls()
906
909
  });
907
910
  },
908
911
  async stop() {
@@ -969,12 +972,13 @@ var ViteNodeDevRunner = class {
969
972
  app: this.currentApp,
970
973
  layouts: this.currentLayouts,
971
974
  devtools: this.options.devtools,
972
- onListen: ({ port, host, url }) => {
975
+ onListen: ({ port, host, url, networkUrls }) => {
973
976
  this._port = port;
974
977
  this.options.onListen?.({
975
978
  port,
976
979
  host,
977
- url
980
+ url,
981
+ networkUrls
978
982
  });
979
983
  }
980
984
  });
@@ -1149,13 +1153,11 @@ const devCommand = {
1149
1153
  args: {
1150
1154
  port: {
1151
1155
  type: "string",
1152
- description: "Port to listen on",
1153
- default: "9527"
1156
+ description: "Port to listen on (overrides ubean.config.ts dev.port)"
1154
1157
  },
1155
1158
  host: {
1156
1159
  type: "string",
1157
- description: "Host to listen on",
1158
- default: "localhost"
1160
+ description: "Host to listen on (overrides ubean.config.ts dev.host)"
1159
1161
  },
1160
1162
  strictPort: {
1161
1163
  type: "boolean",
@@ -1164,8 +1166,7 @@ const devCommand = {
1164
1166
  },
1165
1167
  open: {
1166
1168
  type: "boolean",
1167
- description: "Open browser on startup",
1168
- default: false
1169
+ description: "Open browser on startup"
1169
1170
  },
1170
1171
  cwd: {
1171
1172
  type: "string",
@@ -1235,9 +1236,13 @@ const devCommand = {
1235
1236
  getCustomTabs: () => getCustomTabs(),
1236
1237
  triggerRescan: () => rescan()
1237
1238
  },
1238
- onListen({ url }) {
1239
+ onListen({ url, networkUrls }) {
1239
1240
  const label = (text) => dim(text);
1240
- const lines = [`${green(bold("🚀 ubean dev server ready"))}\n`, ` → ${label("Local:")} ${cyan(url)}`];
1241
+ const lines = [
1242
+ `${green(bold("🚀 ubean dev server ready"))}\n`,
1243
+ ` → ${label("Local:")} ${cyan(url)}`,
1244
+ ...(networkUrls || []).map((n) => ` → ${label("Network:")} ${cyan(n)}`)
1245
+ ];
1241
1246
  const hasBackend = config.mode !== "ssg" && config.mode !== "spa";
1242
1247
  if (hasBackend) lines.push(` → ${label("Scalar UI:")} ${cyan(`${url}/_scalar`)}`, ` → ${label("OpenAPI:")} ${cyan(`${url}/_openapi.json`)}`);
1243
1248
  if (config.devtools.enabled) lines.push(` → ${label("DevTools:")} ${cyan(`${url}${config.devtools.route}`)}`);
@@ -1259,7 +1264,7 @@ const devCommand = {
1259
1264
  try {
1260
1265
  await runner.start();
1261
1266
  } catch (err) {
1262
- logger$6.error(err?.message || String(err));
1267
+ logger$6.error(err?.stack || err?.message || String(err));
1263
1268
  process.exit(1);
1264
1269
  }
1265
1270
  const watcher = createDevWatcher({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ubean/cli",
3
- "version": "0.4.10",
3
+ "version": "0.5.1",
4
4
  "description": "CLI for ubean (ubean-next binary: dev, build, prepare, init, preview, page, env, config, devtools, api/layout/middleware/cron/plugin scaffolds) plus the Vite dev server runner",
5
5
  "bin": {
6
6
  "ubean-next": "./bin/ubean-next.mjs"
@@ -24,15 +24,15 @@
24
24
  }
25
25
  },
26
26
  "dependencies": {
27
- "@ubean/app": "0.4.10",
28
- "@ubean/build": "0.4.10",
29
- "@ubean/client": "0.4.10",
30
- "@ubean/config": "0.4.10",
31
- "@ubean/i18n": "0.4.10",
32
- "@ubean/islands": "0.4.10",
33
- "@ubean/preset": "0.4.10",
34
- "@ubean/scan": "0.4.10",
35
- "@ubean/shared": "0.4.10",
27
+ "@ubean/app": "0.5.1",
28
+ "@ubean/build": "0.5.1",
29
+ "@ubean/client": "0.5.1",
30
+ "@ubean/config": "0.5.1",
31
+ "@ubean/i18n": "0.5.1",
32
+ "@ubean/islands": "0.5.1",
33
+ "@ubean/preset": "0.5.1",
34
+ "@ubean/scan": "0.5.1",
35
+ "@ubean/shared": "0.5.1",
36
36
  "citty": "^0.2.2",
37
37
  "kolorist": "^1.8.0",
38
38
  "pathe": "^2.0.3"
@@ -45,8 +45,8 @@
45
45
  "vite-plus": "0.3.1"
46
46
  },
47
47
  "peerDependencies": {
48
- "@ubean/content": "0.4.10",
49
- "@ubean/devtools": "0.4.10",
48
+ "@ubean/content": "0.5.1",
49
+ "@ubean/devtools": "0.5.1",
50
50
  "@vitejs/plugin-vue": "^6.0.8",
51
51
  "vite": "npm:@voidzero-dev/vite-plus-core@0.3.1"
52
52
  },