@arkstack/console 0.14.22 → 0.15.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/index.js +25 -7
  2. package/package.json +3 -3
package/dist/index.js CHANGED
@@ -48,13 +48,15 @@ var BuildCommand = class extends Command {
48
48
 
49
49
  //#endregion
50
50
  //#region dist/commands/DevCommand.js
51
- var DevCommand = class extends Command {
51
+ var DevCommand = class DevCommand extends Command {
52
52
  signature = `dev
53
- {--t|tunnel : tunnel the dev server through Ngrok}
53
+ {--t|tunnel : Tunnel the dev server through Ngrok}
54
+ {--host : Expose the dev server on the local network}
55
+ {--s|secure : Serve the dev server over HTTPS with a self-signed certificate}
54
56
  `;
55
57
  description = "Run the development server";
56
58
  async handle() {
57
- const tunnel = this.option?.("tunnel");
59
+ const vars = DevCommand.devServerEnv(this.options());
58
60
  await new Promise((resolve, reject) => {
59
61
  const child = spawn(process.platform === "win32" ? "pnpm.cmd" : "pnpm", [
60
62
  "exec",
@@ -64,10 +66,7 @@ var DevCommand = class extends Command {
64
66
  ], {
65
67
  cwd: Arkstack.rootDir(),
66
68
  stdio: "inherit",
67
- env: Object.assign(process.env, {
68
- NODE_ENV: "development",
69
- TUNNEL: tunnel ? "true" : void 0
70
- })
69
+ env: Object.assign(process.env, vars)
71
70
  });
72
71
  child.on("error", (error) => {
73
72
  reject(error);
@@ -81,6 +80,25 @@ var DevCommand = class extends Command {
81
80
  });
82
81
  });
83
82
  }
83
+ /**
84
+ * Map `dev` command flags to the environment variables the running server reads.
85
+ *
86
+ * The dev server binds `127.0.0.1` by default so it is local-only; `--host`
87
+ * switches it to `0.0.0.0` to expose it on the local network. `--secure` flags
88
+ * the driver to serve HTTPS, and `--tunnel` enables the Ngrok tunnel.
89
+ *
90
+ * @param options
91
+ * @returns
92
+ */
93
+ static devServerEnv(options) {
94
+ const vars = {
95
+ NODE_ENV: "development",
96
+ APP_HOST: options.host ? "0.0.0.0" : "127.0.0.1"
97
+ };
98
+ if (options.tunnel) vars.TUNNEL = "true";
99
+ if (options.secure) vars.APP_SECURE = "true";
100
+ return vars;
101
+ }
84
102
  };
85
103
 
86
104
  //#endregion
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@arkstack/console",
3
- "version": "0.14.22",
3
+ "version": "0.15.1",
4
4
  "type": "module",
5
5
  "description": "Console module for Arkstack, providing the command-line runtime and console integration layer.",
6
6
  "homepage": "https://arkstack.toneflix.net/guide/cli",
@@ -51,8 +51,8 @@
51
51
  "chalk": "^5.6.2",
52
52
  "resora": "^1.3.27",
53
53
  "ts-morph": "^28.0.0",
54
- "@arkstack/common": "^0.14.22",
55
- "@arkstack/contract": "^0.14.22"
54
+ "@arkstack/common": "^0.15.1",
55
+ "@arkstack/contract": "^0.15.1"
56
56
  },
57
57
  "scripts": {
58
58
  "build": "tsdown",