@staff0rd/assist 0.206.1 → 0.206.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.
Files changed (2) hide show
  1. package/dist/index.js +21 -3
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -6,7 +6,7 @@ import { Command } from "commander";
6
6
  // package.json
7
7
  var package_default = {
8
8
  name: "@staff0rd/assist",
9
- version: "0.206.1",
9
+ version: "0.206.2",
10
10
  type: "module",
11
11
  main: "dist/index.js",
12
12
  bin: {
@@ -12741,12 +12741,30 @@ async function auth() {
12741
12741
 
12742
12742
  // src/commands/roam/postRoamActivity.ts
12743
12743
  import { execFileSync as execFileSync4 } from "child_process";
12744
- import { readFileSync as readFileSync34 } from "fs";
12744
+ import { readdirSync as readdirSync6, readFileSync as readFileSync34, statSync as statSync5 } from "fs";
12745
12745
  import { join as join45 } from "path";
12746
+ function findPortFile(roamDir) {
12747
+ let entries;
12748
+ try {
12749
+ entries = readdirSync6(roamDir);
12750
+ } catch {
12751
+ return void 0;
12752
+ }
12753
+ const candidates = entries.filter((name) => /^roam-local-api(-[^.]+)?\.port$/.test(name)).map((name) => {
12754
+ const path53 = join45(roamDir, name);
12755
+ try {
12756
+ return { path: path53, mtimeMs: statSync5(path53).mtimeMs };
12757
+ } catch {
12758
+ return void 0;
12759
+ }
12760
+ }).filter((c) => c !== void 0).sort((a, b) => b.mtimeMs - a.mtimeMs);
12761
+ return candidates[0]?.path;
12762
+ }
12746
12763
  function postRoamActivity(app, event) {
12747
12764
  const appData = process.env.APPDATA;
12748
12765
  if (!appData) return;
12749
- const portFile = join45(appData, "Roam", "roam-local-api.port");
12766
+ const portFile = findPortFile(join45(appData, "Roam"));
12767
+ if (!portFile) return;
12750
12768
  let port;
12751
12769
  try {
12752
12770
  port = readFileSync34(portFile, "utf-8").trim();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@staff0rd/assist",
3
- "version": "0.206.1",
3
+ "version": "0.206.2",
4
4
  "type": "module",
5
5
  "main": "dist/index.js",
6
6
  "bin": {