gohere 0.1.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/LICENSE +13 -0
- package/README.md +114 -0
- package/bin/gohere.js +23 -0
- package/package.json +32 -0
- package/vendor/linux-x64/gohere +0 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
Copyright 2026 Roie Ambulo
|
|
2
|
+
|
|
3
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
you may not use this file except in compliance with the License.
|
|
5
|
+
You may obtain a copy of the License at
|
|
6
|
+
|
|
7
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
|
|
9
|
+
Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
+
See the License for the specific language governing permissions and
|
|
13
|
+
limitations under the License.
|
package/README.md
ADDED
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
# gohere
|
|
2
|
+
|
|
3
|
+
Tiny local dev URL launcher for `.localhost` projects.
|
|
4
|
+
|
|
5
|
+
```text
|
|
6
|
+
http://myproject.localhost
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
Run `gohere` inside a package project or static folder. It starts or serves the project on a hidden local port, routes a clean `.localhost` hostname to it, and prints the URL.
|
|
10
|
+
|
|
11
|
+
No script edits. No port memorization. No repo config.
|
|
12
|
+
|
|
13
|
+
## Install
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
npm i -g gohere
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
Or install the Go CLI directly:
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
go install github.com/roie/gohere/cmd/gohere@latest
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## Quick start
|
|
26
|
+
|
|
27
|
+
`gohere` supports package projects and static files.
|
|
28
|
+
|
|
29
|
+
Run the default `dev` script from the nearest `package.json`:
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
gohere
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
Run a named package script:
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
gohere dev:web
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
Run a raw command:
|
|
42
|
+
|
|
43
|
+
```bash
|
|
44
|
+
gohere -- npm run dev
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
Route to a known target port:
|
|
48
|
+
|
|
49
|
+
```bash
|
|
50
|
+
gohere --target 5173 -- npm run dev
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
For static folders, `gohere` serves `index.html`. You can also open a specific file, for example `gohere about.html`, which routes to `http://myproject.localhost/about.html`.
|
|
54
|
+
|
|
55
|
+
CSS, images, and scripts are served normally.
|
|
56
|
+
|
|
57
|
+
## Examples
|
|
58
|
+
|
|
59
|
+
```text
|
|
60
|
+
myproject -> http://myproject.localhost
|
|
61
|
+
@scope/web -> http://web.localhost
|
|
62
|
+
repo/apps/web -> http://web.repo.localhost
|
|
63
|
+
about.html -> http://myproject.localhost/about.html
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
## Route management
|
|
67
|
+
|
|
68
|
+
```bash
|
|
69
|
+
gohere list
|
|
70
|
+
gohere list --verbose
|
|
71
|
+
gohere stop
|
|
72
|
+
gohere clean
|
|
73
|
+
gohere doctor
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
`gohere list --verbose` shows host, target, status, PID, and working directory.
|
|
77
|
+
|
|
78
|
+
Route status can be `ready`, `dead`, or `unknown`. `clean` removes only routes that are confidently dead.
|
|
79
|
+
|
|
80
|
+
## How it works
|
|
81
|
+
|
|
82
|
+
`gohere` runs a local router on HTTP port `80`.
|
|
83
|
+
|
|
84
|
+
Each project gets a hidden local port. The router maps the clean `.localhost` hostname to that port using the request `Host` header.
|
|
85
|
+
|
|
86
|
+
State is stored in:
|
|
87
|
+
|
|
88
|
+
```text
|
|
89
|
+
~/.gohere/
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
On Linux/WSL, first-time setup may ask for permission so the router can bind to local port `80`.
|
|
93
|
+
|
|
94
|
+
## Platform support
|
|
95
|
+
|
|
96
|
+
Current target: Linux / WSL.
|
|
97
|
+
|
|
98
|
+
Planned: macOS and native Windows.
|
|
99
|
+
|
|
100
|
+
The npm package currently targets Linux x64 first.
|
|
101
|
+
|
|
102
|
+
## Limits
|
|
103
|
+
|
|
104
|
+
- HTTP only
|
|
105
|
+
- `.localhost` only
|
|
106
|
+
- no HTTPS
|
|
107
|
+
- no LAN sharing
|
|
108
|
+
- no custom TLDs
|
|
109
|
+
- no project config files
|
|
110
|
+
- no browser auto-open yet
|
|
111
|
+
|
|
112
|
+
## License
|
|
113
|
+
|
|
114
|
+
Apache-2.0
|
package/bin/gohere.js
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
const { spawnSync } = require("node:child_process");
|
|
4
|
+
const path = require("node:path");
|
|
5
|
+
|
|
6
|
+
const platform = process.platform;
|
|
7
|
+
const arch = process.arch;
|
|
8
|
+
const exe = platform === "win32" ? "gohere.exe" : "gohere";
|
|
9
|
+
const binary = path.join(__dirname, "..", "vendor", `${platform}-${arch}`, exe);
|
|
10
|
+
|
|
11
|
+
const result = spawnSync(binary, process.argv.slice(2), { stdio: "inherit" });
|
|
12
|
+
|
|
13
|
+
if (result.error) {
|
|
14
|
+
console.error(`gohere binary not available for ${platform}-${arch}`);
|
|
15
|
+
console.error(result.error.message);
|
|
16
|
+
process.exit(1);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
if (result.signal) {
|
|
20
|
+
process.kill(process.pid, result.signal);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
process.exit(result.status ?? 1);
|
package/package.json
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "gohere",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Tiny local dev URL launcher for .localhost projects.",
|
|
5
|
+
"bin": {
|
|
6
|
+
"gohere": "bin/gohere.js"
|
|
7
|
+
},
|
|
8
|
+
"files": [
|
|
9
|
+
"bin/",
|
|
10
|
+
"vendor/"
|
|
11
|
+
],
|
|
12
|
+
"license": "Apache-2.0",
|
|
13
|
+
"repository": {
|
|
14
|
+
"type": "git",
|
|
15
|
+
"url": "git+https://github.com/roie/gohere.git"
|
|
16
|
+
},
|
|
17
|
+
"bugs": {
|
|
18
|
+
"url": "https://github.com/roie/gohere/issues"
|
|
19
|
+
},
|
|
20
|
+
"homepage": "https://github.com/roie/gohere#readme",
|
|
21
|
+
"keywords": [
|
|
22
|
+
"localhost",
|
|
23
|
+
"dev-server",
|
|
24
|
+
"cli"
|
|
25
|
+
],
|
|
26
|
+
"os": [
|
|
27
|
+
"linux"
|
|
28
|
+
],
|
|
29
|
+
"cpu": [
|
|
30
|
+
"x64"
|
|
31
|
+
]
|
|
32
|
+
}
|
|
Binary file
|