attnmd 0.1.18 → 0.3.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/README.md +1 -1
- package/bin/attn.js +22 -7
- package/package.json +1 -1
- package/scripts/postinstall.mjs +4 -1
package/README.md
CHANGED
|
@@ -28,7 +28,7 @@ That's it. A native window opens with your project's markdown rendered beautiful
|
|
|
28
28
|
|
|
29
29
|
Most markdown previewers are either browser tabs you have to manually refresh, or Electron apps that eat your RAM for breakfast.
|
|
30
30
|
|
|
31
|
-
attn is a **single
|
|
31
|
+
attn is a **single <20MB binary**. It forks to background as a daemon, opens a native macOS window, and watches your files. Edit in Vim, VS Code, whatever — attn reloads instantly. Open another file? It joins the same window as a tab.
|
|
32
32
|
|
|
33
33
|
**What you get:**
|
|
34
34
|
|
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
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
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 =
|
|
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
package/scripts/postinstall.mjs
CHANGED
|
@@ -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
|
|