owngit 1.0.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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 OwnGit contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,20 @@
1
+ # OwnGit
2
+
3
+ OwnGit is a self-hosted Git server for home labs and local machines. It keeps private repositories and their history on your own computer, NAS, or home server, with a browser dashboard for everyday use. Repositories remain ordinary bare Git repositories served by the Git installation on the host.
4
+
5
+ This package installs OwnGit 1.0.2 and the `owngit` command. It supports macOS on Apple silicon, Linux on x64, Linux on ARM64, and Windows on x64.
6
+
7
+ ```sh
8
+ npm install -g owngit
9
+ owngit serve
10
+ ```
11
+
12
+ The host also needs Git with an executable `git-http-backend`.
13
+
14
+ The OwnGit executable comes from a platform package that npm installs as an optional dependency, such as `owngit-darwin-arm64`. If npm left it out, for example with `--omit=optional` in a project install, or if your platform has no package, the `owngit` command reports this and lists the supported platforms.
15
+
16
+ Node.js 18 or newer is needed to install this package and to start the `owngit` command, a small launcher that runs the OwnGit executable with the same arguments. OwnGit itself does not use Node. The other installation routes, such as Homebrew or the portable archives, need no Node.
17
+
18
+ Two limits apply to the launcher. A server started with `nohup owngit serve &` still stops when the terminal or SSH session closes. A `SIGINT` sent only to the launcher, for example Ctrl+C in `docker run` without `-t`, does not stop the server; `SIGTERM` does. To keep a server running, use a service manager such as launchd or systemd, install with Homebrew and use `brew services`, or run the executable from the platform package or a release archive directly.
19
+
20
+ See the [project README](https://github.com/juliankang4/owngit) for setup, access, and the other installation routes.
package/bin/owngit.js ADDED
@@ -0,0 +1,88 @@
1
+ #!/usr/bin/env node
2
+ // OwnGit npm launcher. tools/release renders this file from
3
+ // packaging/npm/owngit.js.tmpl; edit the template, not a generated copy.
4
+ //
5
+ // It starts the OwnGit executable from the platform package that npm
6
+ // installed with this package, passes the arguments and standard streams
7
+ // through, and ends the way the executable ended.
8
+ "use strict";
9
+
10
+ const { spawn } = require("child_process");
11
+ const { constants } = require("os");
12
+ const path = require("path");
13
+
14
+ const platforms = {"darwin-arm64":{"package":"owngit-darwin-arm64","binary":"bin/owngit"},"linux-arm64":{"package":"owngit-linux-arm64","binary":"bin/owngit"},"linux-x64":{"package":"owngit-linux-x64","binary":"bin/owngit"},"win32-x64":{"package":"owngit-win32-x64","binary":"bin/owngit.exe"}};
15
+ const homepage = "https://github.com/juliankang4/owngit";
16
+
17
+ function stop(message) {
18
+ process.stderr.write("owngit: " + message + "\n");
19
+ process.exit(1);
20
+ }
21
+
22
+ function executablePath() {
23
+ const key = process.platform + "-" + process.arch;
24
+ const advice =
25
+ "The owngit npm package supports " + Object.keys(platforms).join(", ") + ". " +
26
+ "See " + homepage + " for other ways to install OwnGit.";
27
+ const platform = platforms[key];
28
+ if (!platform) {
29
+ stop("there is no OwnGit executable for " + key + ". " + advice);
30
+ }
31
+ let packageJSON;
32
+ try {
33
+ packageJSON = require.resolve(platform.package + "/package.json");
34
+ } catch {
35
+ stop(
36
+ "the platform package " + platform.package + " is not installed. " +
37
+ "npm leaves it out when optional dependencies are omitted, for example with --omit=optional in a project install. " +
38
+ "Reinstall owngit without omitting optional dependencies. " + advice
39
+ );
40
+ }
41
+ return path.join(path.dirname(packageJSON), platform.binary);
42
+ }
43
+
44
+ const executable = executablePath();
45
+ let child;
46
+
47
+ // A terminal delivers Ctrl+C and Ctrl+\ (Ctrl+C and Ctrl+Break on Windows) to
48
+ // the whole foreground process group, or to every process on the console, so
49
+ // the executable already receives them. The launcher only outlives them and
50
+ // does not send a copy, so OwnGit sees each key press once.
51
+ const survived = process.platform === "win32" ? ["SIGINT", "SIGBREAK", "SIGHUP"] : ["SIGINT", "SIGQUIT"];
52
+ // A service manager stops the launcher alone, and a closing terminal may
53
+ // signal it alone, so these are passed on unchanged. If the executable also
54
+ // received the signal directly, it sees the same signal again: during a
55
+ // shutdown OwnGit ignores a repeat, and SIGHUP already ended it.
56
+ const forwarded = process.platform === "win32" ? [] : ["SIGTERM", "SIGHUP"];
57
+
58
+ const listeners = [];
59
+ for (const signal of survived) {
60
+ listeners.push([signal, () => {}]);
61
+ }
62
+ for (const signal of forwarded) {
63
+ listeners.push([signal, () => child.kill(signal)]);
64
+ }
65
+ // The listeners are in place before the executable starts, so an early
66
+ // SIGTERM cannot end the launcher and leave the executable running. They run
67
+ // in a later event loop turn, after spawn has set child.
68
+ for (const [signal, listener] of listeners) {
69
+ process.on(signal, listener);
70
+ }
71
+ child = spawn(executable, process.argv.slice(2), { stdio: "inherit" });
72
+
73
+ child.on("error", (error) => {
74
+ stop("cannot start " + executable + ": " + error.message);
75
+ });
76
+
77
+ child.on("exit", (code, signal) => {
78
+ if (signal) {
79
+ // End with the same signal, so a shell or service manager sees what it
80
+ // would see without the launcher.
81
+ for (const [name, listener] of listeners) {
82
+ process.removeListener(name, listener);
83
+ }
84
+ process.kill(process.pid, signal);
85
+ process.exit(128 + (constants.signals[signal] || 0));
86
+ }
87
+ process.exit(code === null ? 1 : code);
88
+ });
package/package.json ADDED
@@ -0,0 +1,28 @@
1
+ {
2
+ "name": "owngit",
3
+ "version": "1.0.2",
4
+ "description": "Private Git storage and browser dashboard on your own computer",
5
+ "license": "MIT",
6
+ "homepage": "https://github.com/juliankang4/owngit",
7
+ "repository": {
8
+ "type": "git",
9
+ "url": "git+https://github.com/juliankang4/owngit.git"
10
+ },
11
+ "bin": {
12
+ "owngit": "bin/owngit.js"
13
+ },
14
+ "files": [
15
+ "bin/owngit.js",
16
+ "README.md",
17
+ "LICENSE"
18
+ ],
19
+ "engines": {
20
+ "node": ">=18"
21
+ },
22
+ "optionalDependencies": {
23
+ "owngit-darwin-arm64": "1.0.2",
24
+ "owngit-linux-arm64": "1.0.2",
25
+ "owngit-linux-x64": "1.0.2",
26
+ "owngit-win32-x64": "1.0.2"
27
+ }
28
+ }