ryugi-artifacts 1.9.0 → 1.9.2

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/dist/cli.cjs CHANGED
@@ -64,6 +64,7 @@ function projectPaths(dir) {
64
64
  lock: import_node_path.default.join(state, "start.lock")
65
65
  };
66
66
  }
67
+ var invocation = () => process.env.RYUGI_ARTIFACTS_COMMAND || "ryugi-artifacts";
67
68
  var ARTIFACT_PATTERN = /^(artboard|document|html)\/[a-z0-9][a-z0-9-]*$/;
68
69
  var ARTIFACT_ERROR = "--artifact must be <type>/<id>: type artboard, document or html, id of lowercase letters, digits and hyphens";
69
70
 
@@ -148,9 +149,14 @@ function commandLine(pid) {
148
149
  const line = full.stdout.split("\n").slice(1).join(" ").trim();
149
150
  return line ? line.split(/\s+/) : null;
150
151
  }
152
+ var isNodeImage = (tasklistLine) => /^"node\.exe"/i.test(tasklistLine.trim());
153
+ function windowsNodeAt(pid) {
154
+ const result = (0, import_node_child_process.spawnSync)("tasklist", ["/FI", `PID eq ${pid}`, "/FO", "CSV", "/NH"], { encoding: "utf8", windowsHide: true });
155
+ return result.status === 0 && isNodeImage(result.stdout);
156
+ }
151
157
  function hasServerId(pid, id) {
152
158
  if (!alive(pid)) return false;
153
- if (process.platform === "win32") return true;
159
+ if (process.platform === "win32") return windowsNodeAt(pid);
154
160
  return commandLine(pid)?.includes(`--artifacts-server-id=${id}`) ?? false;
155
161
  }
156
162
  function parentOf(pid) {
@@ -230,7 +236,7 @@ function recordAgent(paths) {
230
236
  if (Object.keys(markers).length) import_node_fs3.default.writeFileSync(paths.agent, `${JSON.stringify(markers)}
231
237
  `);
232
238
  }
233
- async function replace(pid) {
239
+ async function replace(pid, paths) {
234
240
  try {
235
241
  process.kill(pid, "SIGTERM");
236
242
  } catch {
@@ -241,7 +247,7 @@ async function replace(pid) {
241
247
  } catch {
242
248
  }
243
249
  if (await waitForExit(pid, 2e3)) return;
244
- throw new CliError(`The running server (pid ${pid}) is on another release and did not stop; stop it with \`ryugi-artifacts stop\` and retry`);
250
+ throw new CliError(`The running server (pid ${pid}) is on another release and did not stop; stop it with \`${invocation()} stop --project-dir ${paths.project}\` and retry`);
245
251
  }
246
252
  function serverEnv(paths, options) {
247
253
  const env = { ...process.env, ARTIFACTS_ROOT: paths.root, ARTIFACTS_HOST: options.host, ARTIFACTS_URL_HOST: options.urlHost, ARTIFACTS_OPEN: options.open ? "1" : "0" };
@@ -249,6 +255,7 @@ function serverEnv(paths, options) {
249
255
  if (options.idleTimeoutMinutes) env.ARTIFACTS_IDLE_TIMEOUT_MS = String(Number(options.idleTimeoutMinutes) * 6e4);
250
256
  delete env.RYUGI_ARTIFACTS_OWNER;
251
257
  delete env.RYUGI_ARTIFACTS_VERSION;
258
+ delete env.RYUGI_ARTIFACTS_COMMAND;
252
259
  return env;
253
260
  }
254
261
  async function start(options, emit) {
@@ -282,7 +289,7 @@ async function start(options, emit) {
282
289
  emit(withLink(JSON.parse(info), options.artifact, true));
283
290
  return 0;
284
291
  }
285
- await replace(running);
292
+ await replace(running, paths);
286
293
  }
287
294
  registerOwner(paths);
288
295
  recordAgent(paths);
@@ -326,7 +333,7 @@ async function start(options, emit) {
326
333
  const started = lines.find((line) => line.includes('"server-started"'));
327
334
  if (started) {
328
335
  for (let check = 0; check < 20; check++) {
329
- if (!alive(child.pid)) throw new CliError(`Server started but was killed. Retry in a persistent terminal with: ryugi-artifacts start --project-dir ${paths.project} --host ${options.host} --url-host ${options.urlHost} --foreground`);
336
+ if (!alive(child.pid)) throw new CliError(`Server started but was killed. Retry in a persistent terminal with: ${invocation()} start --project-dir ${paths.project}${options.artifact ? ` --artifact ${options.artifact}` : ""} --host ${options.host} --url-host ${options.urlHost} --foreground`);
330
337
  await sleep(100);
331
338
  }
332
339
  emit(withLink(JSON.parse(started), options.artifact, false));
@@ -346,7 +353,7 @@ async function start(options, emit) {
346
353
  }
347
354
 
348
355
  // src/cli/publish.ts
349
- var NOT_RUNNING = "No artifacts server is running for this project. Start it with `ryugi-artifacts start`, then run this again.";
356
+ var notRunning = (project) => `No artifacts server is running for this project. Start it with \`${invocation()} start --project-dir ${project}\`, then run this again.`;
350
357
  async function publish(options, emit) {
351
358
  if (options.action === "publish" || options.action === "unpublish") {
352
359
  if (!options.artifact) throw new CliError("--artifact <type>/<id> is required");
@@ -358,7 +365,7 @@ async function publish(options, emit) {
358
365
  try {
359
366
  info = JSON.parse(readText(paths.info) ?? "");
360
367
  } catch {
361
- throw new CliError(NOT_RUNNING);
368
+ throw new CliError(notRunning(paths.project));
362
369
  }
363
370
  const base = new URL(info.url);
364
371
  const key = base.searchParams.get("key") ?? "";
@@ -372,7 +379,7 @@ async function publish(options, emit) {
372
379
  body: body ? JSON.stringify(body) : void 0
373
380
  });
374
381
  } catch {
375
- throw new CliError(NOT_RUNNING);
382
+ throw new CliError(notRunning(paths.project));
376
383
  }
377
384
  const json = await res.json().catch(() => ({}));
378
385
  if (res.status === 401) throw new CliError("", { type: "login-required", url: json.loginUrl, message: "Open url to sign in to the Ryugi cloud, then run the same command again." }, 2);
@@ -569,7 +576,7 @@ async function main(argv) {
569
576
  }, emit);
570
577
  }
571
578
  if (command === "--version" || command === "-v") {
572
- console.log("1.9.0");
579
+ console.log("1.9.2");
573
580
  return 0;
574
581
  }
575
582
  if (command === "--help" || command === "-h") {
package/dist/server.cjs CHANGED
@@ -36508,7 +36508,7 @@ decorateMethods(EphemeralStoreWasm.prototype, [
36508
36508
  ]);
36509
36509
  decorateMethods(UndoManager.prototype, ["undo", "redo"]);
36510
36510
 
36511
- // node_modules/.pnpm/@haklex+rich-collab-loro@0.51.0_lexical@0.52.0_typescript@5.9.3__loro-crdt@1.16.4/node_modules/@haklex/rich-collab-loro/dist/index.mjs
36511
+ // node_modules/.pnpm/@haklex+rich-collab-loro@0.51.1_lexical@0.52.0_typescript@5.9.3__loro-crdt@1.16.4/node_modules/@haklex/rich-collab-loro/dist/index.mjs
36512
36512
  function transformOffset(previous, next, offset) {
36513
36513
  const limit = Math.min(previous.length, next.length);
36514
36514
  let prefix = 0;
@@ -67919,7 +67919,7 @@ var UNORDERED_LIST2 = mod28.UNORDERED_LIST;
67919
67919
  var isTableRowDivider2 = mod28.isTableRowDivider;
67920
67920
  var registerMarkdownShortcuts2 = mod28.registerMarkdownShortcuts;
67921
67921
 
67922
- // node_modules/.pnpm/@haklex+rich-headless@0.51.0_lexical@0.52.0_typescript@5.9.3__typescript@5.9.3/node_modules/@haklex/rich-headless/dist/transformers.mjs
67922
+ // node_modules/.pnpm/@haklex+rich-headless@0.51.1_lexical@0.52.0_typescript@5.9.3__typescript@5.9.3/node_modules/@haklex/rich-headless/dist/transformers.mjs
67923
67923
  var NEVER = /a^/;
67924
67924
  var NOOP = () => {
67925
67925
  };
@@ -70576,7 +70576,7 @@ var signal2 = mod43.signal;
70576
70576
  var untracked2 = mod43.untracked;
70577
70577
  var watchedSignal3 = mod43.watchedSignal;
70578
70578
 
70579
- // node_modules/.pnpm/@haklex+rich-headless@0.51.0_lexical@0.52.0_typescript@5.9.3__typescript@5.9.3/node_modules/@haklex/rich-headless/dist/index.mjs
70579
+ // node_modules/.pnpm/@haklex+rich-headless@0.51.1_lexical@0.52.0_typescript@5.9.3__typescript@5.9.3/node_modules/@haklex/rich-headless/dist/index.mjs
70580
70580
  var builtinNodes = [
70581
70581
  HeadingNode2,
70582
70582
  QuoteNode2,
@@ -71369,7 +71369,7 @@ function customAlphabet(alphabet, defaultSize = 21) {
71369
71369
  }
71370
71370
  var nanoid2 = customAlphabet(urlAlphabet2);
71371
71371
 
71372
- // node_modules/.pnpm/@haklex+rich-litexml@0.51.0_typescript@5.9.3/node_modules/@haklex/rich-litexml/dist/src-COIhAhyB.js
71372
+ // node_modules/.pnpm/@haklex+rich-litexml@0.51.1_typescript@5.9.3/node_modules/@haklex/rich-litexml/dist/src-COIhAhyB.js
71373
71373
  var impl = null;
71374
71374
  function registerParseHTML(fn5) {
71375
71375
  impl = fn5;
@@ -83473,7 +83473,7 @@ function Document4() {
83473
83473
  }
83474
83474
  setPrototypeOf(Document4, Document2).prototype = Document2.prototype;
83475
83475
 
83476
- // node_modules/.pnpm/@haklex+rich-litexml@0.51.0_typescript@5.9.3/node_modules/@haklex/rich-litexml/dist/node.mjs
83476
+ // node_modules/.pnpm/@haklex+rich-litexml@0.51.1_typescript@5.9.3/node_modules/@haklex/rich-litexml/dist/node.mjs
83477
83477
  registerParseHTML((html) => parseHTML2(html).document);
83478
83478
 
83479
83479
  // src/shared/dynamic.ts