attnmd 0.1.18 → 0.2.0

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/attn.js CHANGED
@@ -60,10 +60,12 @@ async function main() {
60
60
  const headless = isHeadlessInvocation(args);
61
61
 
62
62
  let appPath = null;
63
- try {
64
- appPath = await resolveAppPath(version);
65
- } catch (error) {
66
- console.error(`attn: app install unavailable (${error.message}); falling back to binary.`);
63
+ if (process.platform === "darwin") {
64
+ try {
65
+ appPath = await resolveAppPath(version);
66
+ } catch (error) {
67
+ console.error(`attn: app install unavailable (${error.message}); falling back to binary.`);
68
+ }
67
69
  }
68
70
 
69
71
  if (!appPath) {
@@ -122,7 +124,7 @@ async function ensureRuntimeBinary(version) {
122
124
  const assetSuffix = resolveAssetSuffix(process.platform, process.arch);
123
125
  if (!assetSuffix) {
124
126
  throw new Error(
125
- `unsupported platform ${process.platform}/${process.arch}. Currently supported: darwin-arm64.`
127
+ `unsupported platform ${process.platform}/${process.arch}. Currently supported: darwin-arm64, linux-x64.`
126
128
  );
127
129
  }
128
130
 
@@ -164,7 +166,7 @@ async function installManagedApp(version) {
164
166
  const assetSuffix = resolveAssetSuffix(process.platform, process.arch);
165
167
  if (!assetSuffix) {
166
168
  throw new Error(
167
- `unsupported platform ${process.platform}/${process.arch}. Currently supported: darwin-arm64.`
169
+ `unsupported platform ${process.platform}/${process.arch}. Currently supported: darwin-arm64, linux-x64.`
168
170
  );
169
171
  }
170
172
 
@@ -255,7 +257,8 @@ function installAliasLauncher() {
255
257
  mkdirSync(dirname(installLauncherPath), { recursive: true });
256
258
  mkdirSync(installLinkDir, { recursive: true });
257
259
 
258
- const launcher = `#!/usr/bin/env bash
260
+ const launcher = process.platform === "darwin"
261
+ ? `#!/usr/bin/env bash
259
262
  set -euo pipefail
260
263
  APP_LINK="${managedCurrentAppLink}"
261
264
  if [ ! -e "$APP_LINK" ]; then
@@ -275,6 +278,15 @@ if [ "$HEADLESS" -eq 1 ]; then
275
278
  exec "$BINARY" "$@"
276
279
  fi
277
280
  exec /usr/bin/open "$APP_LINK" --args "$@"
281
+ `
282
+ : `#!/usr/bin/env bash
283
+ set -euo pipefail
284
+ BINARY="${runtimeBinaryPath}"
285
+ if [ ! -x "$BINARY" ]; then
286
+ echo "attn: runtime binary is missing; run 'npx attnmd .' once to install." >&2
287
+ exit 1
288
+ fi
289
+ exec "$BINARY" "$@"
278
290
  `;
279
291
 
280
292
  writeFileSync(installLauncherPath, launcher, { mode: 0o755 });
@@ -304,6 +316,9 @@ function resolveAssetSuffix(platform, arch) {
304
316
  if (platform === "darwin" && arch === "arm64") {
305
317
  return "darwin-arm64";
306
318
  }
319
+ if (platform === "linux" && arch === "x64") {
320
+ return "linux-x64";
321
+ }
307
322
  return null;
308
323
  }
309
324
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "attnmd",
3
- "version": "0.1.18",
3
+ "version": "0.2.0",
4
4
  "description": "A beautiful markdown viewer that launches from the CLI",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -20,7 +20,7 @@ const assetSuffix = resolveAssetSuffix(process.platform, process.arch);
20
20
  if (!assetSuffix) {
21
21
  console.warn(
22
22
  `attn: unsupported platform ${process.platform}/${process.arch}. ` +
23
- "Currently supported: darwin-arm64."
23
+ "Currently supported: darwin-arm64, linux-x64."
24
24
  );
25
25
  process.exit(0);
26
26
  }
@@ -48,6 +48,9 @@ function resolveAssetSuffix(platform, arch) {
48
48
  if (platform === "darwin" && arch === "arm64") {
49
49
  return "darwin-arm64";
50
50
  }
51
+ if (platform === "linux" && arch === "x64") {
52
+ return "linux-x64";
53
+ }
51
54
  return null;
52
55
  }
53
56