@satcomx00/ain-fedora43 0.0.0-stage → 0.19.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.
Files changed (4) hide show
  1. package/README.md +34 -2
  2. package/ain +4 -0
  3. package/bin/ain.js +112 -0
  4. package/package.json +31 -4
package/README.md CHANGED
@@ -1,3 +1,35 @@
1
- # Temporary Holding Version
1
+ # AiN
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ A dynamic-island style widget bar for the desktop. Installs the app for your platform from npm:
4
+
5
+ ```sh
6
+ bun i -g @satcomx00/ain # or: npm i -g @satcomx00/ain
7
+ ain # starts it
8
+ ```
9
+
10
+ Only the build for your machine is downloaded. To pick one yourself, install it directly:
11
+
12
+ | Platform | Package |
13
+ | --- | --- |
14
+ | Windows x64 | `@satcomx00/ain-win32-x64` |
15
+ | Linux x64 (AppImage, any distro) | `@satcomx00/ain-linux-x64` |
16
+ | Fedora 43 x64 (built on Fedora, uses its libraries) | `@satcomx00/ain-fedora43` |
17
+ | Fedora 44 x64 (built on Fedora, uses its libraries) | `@satcomx00/ain-fedora44` |
18
+
19
+ Remove it with `ain uninstall` (`ain uninstall --purge` also deletes the settings and downloaded
20
+ speech models): it turns off launching at login first, which `bun rm -g` alone would leave behind.
21
+ Keep a single copy of AiN: `ain` won't start while one from an installer is on the machine.
22
+
23
+ Update with `bun update -g @satcomx00/ain` (or `npm update -g @satcomx00/ain`): copies installed
24
+ this way don't update themselves.
25
+
26
+ Needs Node.js 18+ or Bun, and per platform: WebView2 on Windows (built into Windows 11); FUSE 2 and glibc 2.39+ on Linux for the AppImage (`libfuse2t64`
27
+ on Ubuntu/Debian, `fuse-libs` on Fedora). The full table is in the
28
+ [main README](https://github.com/Satcomx00-x00/AiN#what-each-install-needs). npm can't tell Linux distros apart, so the Fedora build is only installed
29
+ by name, with its libraries from dnf:
30
+
31
+ ```sh
32
+ sudo dnf install webkit2gtk4.1 gtk-layer-shell libayatana-appindicator-gtk3 alsa-lib
33
+ bun i -g @satcomx00/ain-fedora44 # or ain-fedora43
34
+ ```
35
+ Installers, features and docs: https://github.com/Satcomx00-x00/AiN
package/ain ADDED
@@ -0,0 +1,4 @@
1
+ [diffend] Oversized file quarantined before diffing.
2
+ name: package/ain
3
+ size: 81523272 bytes
4
+ sha256: 935a998b52caf810dba802a4d8e097c6207930f35912651131e454615cbfd581
package/bin/ain.js ADDED
@@ -0,0 +1,112 @@
1
+ #!/usr/bin/env node
2
+ // @ts-check
3
+ // Starts AiN: from this package when it is a platform package installed by name, else from the one
4
+ // npm/bun picked among the optional dependencies.
5
+ //
6
+ // ain [args…] starts the app (refuses when an installer already put AiN on this machine)
7
+ // ain uninstall [--purge] removes launching at login (and with --purge the settings and models),
8
+ // then this package: npm and bun run nothing on removal themselves
9
+ import { spawn, spawnSync } from "node:child_process";
10
+ import { accessSync, chmodSync, constants, existsSync } from "node:fs";
11
+ import { createRequire } from "node:module";
12
+ import { basename, dirname, join, sep } from "node:path";
13
+
14
+ const require = createRequire(import.meta.url);
15
+ const platform = `@satcomx00/ain-${process.platform}-${process.arch}`;
16
+ const manifest = require.resolve("../package.json");
17
+
18
+ /** @param {string} message @returns {never} */
19
+ const fail = (message) => {
20
+ console.error(`ain: ${message}`);
21
+ process.exit(1);
22
+ };
23
+
24
+ /** The `executable` a package's manifest names, as an absolute path, if it names one. @param {string} path */
25
+ const named = (path) => {
26
+ /** @type {{ executable?: unknown }} */
27
+ const { executable } = require(path);
28
+ return typeof executable === "string" ? join(dirname(path), executable) : undefined;
29
+ };
30
+
31
+ /** The platform package of this machine's manifest. */
32
+ const platformManifest = () => {
33
+ try {
34
+ return require.resolve(`${platform}/package.json`);
35
+ } catch {
36
+ return fail(
37
+ `no build for ${process.platform}-${process.arch} (${platform} isn't installed).\n` +
38
+ "Reinstall without --omit=optional, or get an installer: https://github.com/Satcomx00-x00/AiN/releases",
39
+ );
40
+ }
41
+ };
42
+
43
+ /** The app's path. */
44
+ const executable = () => named(manifest) ?? named(platformManifest()) ?? fail(`${platform} names no executable.`);
45
+
46
+ /** Some package managers drop the executable bit: put it back. @param {string} path */
47
+ const ensureExecutable = (path) => {
48
+ if (process.platform === "win32") return;
49
+ try {
50
+ accessSync(path, constants.X_OK);
51
+ } catch {
52
+ chmodSync(path, 0o755);
53
+ }
54
+ };
55
+
56
+ /** Where AiN's installers put it: NSIS and MSI, the .deb and .rpm. */
57
+ const installerPaths = () => {
58
+ const { LOCALAPPDATA, ProgramFiles } = process.env;
59
+ switch (process.platform) {
60
+ case "win32":
61
+ return [LOCALAPPDATA, ProgramFiles].filter((d) => d !== undefined).map((d) => join(d, "AiN", "AiN.exe"));
62
+ default:
63
+ return ["/usr/bin/ain", "/usr/bin/AiN"];
64
+ }
65
+ };
66
+
67
+ /** The package manager command that removes this package, from where it is installed. */
68
+ const removal = () => {
69
+ /** @type {{ name: string }} */
70
+ const { name } = require(manifest);
71
+ const root = dirname(manifest);
72
+ if (root.includes(`${sep}.bun${sep}`)) return ["bun", "remove", "--global", name];
73
+ // npm: <prefix>/lib/node_modules/<name> (<prefix>/node_modules/<name> on Windows).
74
+ let prefix = root.slice(0, root.lastIndexOf(`${sep}node_modules${sep}`));
75
+ if (basename(prefix) === "lib" && process.platform !== "win32") prefix = dirname(prefix);
76
+ return ["npm", "rm", "--global", "--prefix", prefix, name];
77
+ };
78
+
79
+ /** @param {string} app @param {readonly string[]} args */
80
+ const uninstall = (app, args) => {
81
+ const cleanup = spawnSync(app, ["--cleanup", ...args.filter((a) => a === "--purge")], { stdio: "inherit" });
82
+ if (cleanup.status !== 0) fail(`cleanup failed (${cleanup.error?.message ?? `exit ${cleanup.status}`}): nothing was uninstalled.`);
83
+ const [command = "npm", ...rest] = removal();
84
+ // Windows runs npm/bun through their .cmd shims, hence a shell, which needs paths quoted.
85
+ const shell = process.platform === "win32";
86
+ const removed = spawnSync(command, shell ? rest.map((a) => (/\s/.test(a) ? `"${a}"` : a)) : rest, {
87
+ stdio: "inherit",
88
+ shell,
89
+ });
90
+ if (removed.status !== 0) fail(`couldn't remove the package; run: ${[command, ...rest].join(" ")}`);
91
+ };
92
+
93
+ /** @param {string} app @param {readonly string[]} args */
94
+ const start = (app, args) => {
95
+ const installed = installerPaths().find((p) => existsSync(p));
96
+ if (installed) {
97
+ fail(
98
+ `AiN is already installed at ${installed}. Two copies share their settings and launching at login:\n` +
99
+ "keep one. To remove this one: ain uninstall",
100
+ );
101
+ }
102
+ // A desktop app: detached, so the terminal is free again and closing it leaves the app running.
103
+ spawn(app, args, { detached: true, stdio: "ignore" })
104
+ .on("error", (e) => fail(`could not start ${app}: ${e.message}`))
105
+ .unref();
106
+ };
107
+
108
+ const app = executable();
109
+ ensureExecutable(app);
110
+ const [command, ...args] = process.argv.slice(2);
111
+ if (command === "uninstall") uninstall(app, args);
112
+ else start(app, process.argv.slice(2));
package/package.json CHANGED
@@ -1,6 +1,33 @@
1
1
  {
2
2
  "name": "@satcomx00/ain-fedora43",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "0.19.0",
4
+ "description": "AiN for Fedora 43 x64, using the system's WebKitGTK (see the README for the dnf line).",
5
+ "license": "MIT",
6
+ "homepage": "https://github.com/Satcomx00-x00/AiN",
7
+ "repository": {
8
+ "type": "git",
9
+ "url": "git+https://github.com/Satcomx00-x00/AiN.git",
10
+ "directory": "npm"
11
+ },
12
+ "keywords": [
13
+ "desktop",
14
+ "widget",
15
+ "dynamic-island",
16
+ "tauri"
17
+ ],
18
+ "type": "module",
19
+ "engines": {
20
+ "node": ">=18"
21
+ },
22
+ "bin": {
23
+ "ain": "bin/ain.js"
24
+ },
25
+ "os": [
26
+ "linux"
27
+ ],
28
+ "cpu": [
29
+ "x64"
30
+ ],
31
+ "executable": "ain",
32
+ "preferUnplugged": true
33
+ }