@ubean/cli 0.5.0 → 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 +15 -7
  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
  });
@@ -1232,9 +1236,13 @@ const devCommand = {
1232
1236
  getCustomTabs: () => getCustomTabs(),
1233
1237
  triggerRescan: () => rescan()
1234
1238
  },
1235
- onListen({ url }) {
1239
+ onListen({ url, networkUrls }) {
1236
1240
  const label = (text) => dim(text);
1237
- 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
+ ];
1238
1246
  const hasBackend = config.mode !== "ssg" && config.mode !== "spa";
1239
1247
  if (hasBackend) lines.push(` → ${label("Scalar UI:")} ${cyan(`${url}/_scalar`)}`, ` → ${label("OpenAPI:")} ${cyan(`${url}/_openapi.json`)}`);
1240
1248
  if (config.devtools.enabled) lines.push(` → ${label("DevTools:")} ${cyan(`${url}${config.devtools.route}`)}`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ubean/cli",
3
- "version": "0.5.0",
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.5.0",
28
- "@ubean/build": "0.5.0",
29
- "@ubean/client": "0.5.0",
30
- "@ubean/config": "0.5.0",
31
- "@ubean/i18n": "0.5.0",
32
- "@ubean/islands": "0.5.0",
33
- "@ubean/preset": "0.5.0",
34
- "@ubean/scan": "0.5.0",
35
- "@ubean/shared": "0.5.0",
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.5.0",
49
- "@ubean/devtools": "0.5.0",
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
  },