@naviyra/cloud-panel 0.0.2 → 0.0.3-beta

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/naviyra.mjs CHANGED
@@ -189,6 +189,11 @@ See docs/managed-runtime.md in the installed folder.`);
189
189
  // created pg already while leaving Next.js or the agent dependencies missing.
190
190
  console.log("Checking and installing dependencies…");
191
191
  await run("npm", ["install", "--omit=dev"], target);
192
+ const controlPath = path.join(source, "scripts", "panel-control.mjs");
193
+ if (await exists(controlPath)) {
194
+ const { linkBin } = await import(pathToFileURL(controlPath).href);
195
+ await linkBin(target);
196
+ }
192
197
  await run(process.execPath, ["scripts/setup-local.mjs"], target);
193
198
  const background = await enableBackground(target);
194
199
  if (background) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@naviyra/cloud-panel",
3
- "version": "0.0.2",
3
+ "version": "0.0.3-beta",
4
4
  "description": "Self-hosted Naviyra panel for projects, databases, DNS, and email routing.",
5
5
  "type": "module",
6
6
  "bin": {
@@ -21,7 +21,8 @@
21
21
  "README.md"
22
22
  ],
23
23
  "publishConfig": {
24
- "access": "public"
24
+ "access": "public",
25
+ "tag": "beta"
25
26
  },
26
27
  "workspaces": [
27
28
  "apps/*",
@@ -1,5 +1,5 @@
1
1
  import { spawn } from "node:child_process";
2
- import { access, readFile, rm } from "node:fs/promises";
2
+ import { access, mkdir, readFile, rm, writeFile } from "node:fs/promises";
3
3
  import path from "node:path";
4
4
  import {
5
5
  TASK_NAME,
@@ -137,6 +137,24 @@ async function readStatus(dir, taskState) {
137
137
  };
138
138
  }
139
139
 
140
+ export async function linkBin(root) {
141
+ const binDir = path.join(root, "node_modules", ".bin");
142
+ await mkdir(binDir, { recursive: true });
143
+ await writeFile(
144
+ path.join(binDir, "cloud-panel.cmd"),
145
+ '@ECHO off\r\nnode "%~dp0\\..\\..\\bin\\naviyra.mjs" %*\r\n',
146
+ );
147
+ await writeFile(
148
+ path.join(binDir, "cloud-panel.ps1"),
149
+ [
150
+ "$node = (Get-Command node -ErrorAction Stop).Source",
151
+ '& $node (Join-Path $PSScriptRoot "..\\..\\bin\\naviyra.mjs") @args',
152
+ "exit $LASTEXITCODE",
153
+ "",
154
+ ].join("\n"),
155
+ );
156
+ }
157
+
140
158
  export async function execute(command, options = {}) {
141
159
  const located = await locate(options);
142
160
  if (command === "status") {
@@ -186,6 +204,7 @@ export async function execute(command, options = {}) {
186
204
  throw Error("Run npx @naviyra/cloud-panel update so the newest package can replace this install.");
187
205
  await options.copy(options.source, root);
188
206
  await options.install(root);
207
+ await linkBin(root);
189
208
  const started = await startBootTask(run);
190
209
  if (!started.ok) throw Error(started.message || "Update copied, but Naviyra did not start.");
191
210
  console.log(`Updated Naviyra in ${root}. Check it with: npx @naviyra/cloud-panel status`);