@hamedb89/localghost 0.1.12 → 0.1.13

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/docs/flows.md CHANGED
@@ -5,13 +5,16 @@
5
5
  As a developer, I want Localghost to be a drop-in dev dependency so I can add friendly local hostnames without rebuilding the same Caddy and hosts setup in every repo.
6
6
 
7
7
  ```sh
8
+ npm install -D @hamedb89/localghost
9
+ pnpm add -D @hamedb89/localghost
8
10
  yarn add -D @hamedb89/localghost
11
+ bun add -d @hamedb89/localghost
9
12
  ```
10
13
 
11
- Then initialize the project contract:
14
+ Choose the install command for the repository's package manager. Then initialize the project contract:
12
15
 
13
16
  ```sh
14
- yarn localghost init --write-scripts
17
+ localghost init --write-scripts
15
18
  ```
16
19
 
17
20
  ## Project Contract
@@ -32,7 +35,7 @@ api.app.localhost 8787
32
35
  As a developer, I want to know whether my laptop is ready before Localghost changes system files.
33
36
 
34
37
  ```sh
35
- yarn localghost doctor
38
+ localghost doctor
36
39
  ```
37
40
 
38
41
  Localghost checks for Caddy and prints the exact install command when it is missing. It does not run Homebrew automatically.
@@ -42,8 +45,8 @@ Localghost checks for Caddy and prints the exact install command when it is miss
42
45
  As a developer, I want to know when Localghost itself is stale without paying for a network check on every run.
43
46
 
44
47
  ```sh
45
- yarn localghost update
46
- LOCALGHOST_NO_UPDATE_CHECK=1 yarn localghost doctor
48
+ localghost update
49
+ LOCALGHOST_NO_UPDATE_CHECK=1 localghost doctor
47
50
  ```
48
51
 
49
52
  Localghost checks npm after successful commands, caches the result for 24 hours, and ignores check failures. `LOCALGHOST_NO_UPDATE_CHECK=1` and `--no-update-check` disable the automatic check.
@@ -53,7 +56,7 @@ Localghost checks npm after successful commands, caches the result for 24 hours,
53
56
  As a developer, I want one explicit setup command that updates only the managed Localghost block in `/etc/hosts` and validates Caddy.
54
57
 
55
58
  ```sh
56
- yarn localghost:setup
59
+ localghost setup
57
60
  ```
58
61
 
59
62
  ## Daily Dev
@@ -61,8 +64,8 @@ yarn localghost:setup
61
64
  As a developer, I want a daily command that starts the local HTTP proxy from the same config file, with local HTTPS available only when I ask for it.
62
65
 
63
66
  ```sh
64
- yarn localghost:ready
65
- yarn localghost:proxy
67
+ localghost status --ready
68
+ localghost dev
66
69
  ```
67
70
 
68
71
  Most repos will run this next to their app server, for example Vite on `127.0.0.1:5173`.
@@ -70,7 +73,7 @@ Most repos will run this next to their app server, for example Vite on `127.0.0.
70
73
  When a repo really needs local certificates:
71
74
 
72
75
  ```sh
73
- yarn localghost:proxy:https
76
+ localghost dev --https
74
77
  ```
75
78
 
76
79
  ## Config Discovery
@@ -78,9 +81,9 @@ yarn localghost:proxy:https
78
81
  As a developer, I want Localghost to fit repos that already have naming conventions without hidden file searches.
79
82
 
80
83
  ```sh
81
- yarn localghost print --config .localghost.preview
82
- yarn localghost print --config .localghost.private --config .localghost
83
- yarn localghost print --config-pattern '^\.localghost\.(private|preview)$'
84
+ localghost print --config .localghost.preview
85
+ localghost print --config .localghost.private --config .localghost
86
+ localghost print --config-pattern '^\.localghost\.(private|preview)$'
84
87
  ```
85
88
 
86
89
  Localghost uses the first existing configured file. Regex discovery scans filenames in the project root.
@@ -90,7 +93,7 @@ Localghost uses the first existing configured file. Regex discovery scans filena
90
93
  As a developer, I want to see the local domain layer as a simple `domain -> upstream` map.
91
94
 
92
95
  ```sh
93
- yarn localghost routes
96
+ localghost routes
94
97
  ```
95
98
 
96
99
  ```txt
@@ -115,7 +118,7 @@ export default {
115
118
 
116
119
  The plugin defaults to HTTP. Pass `https: true` only when Vite is expected to sit behind a Caddy HTTPS proxy. Localghost prints URLs but does not open browser tabs.
117
120
 
118
- If `.localghost` is missing, an interactive `yarn dev` asks whether to create it, asks for the primary `.localhost` domain, allows extra domains, explains the `/etc/hosts` password prompt, and runs setup when confirmed. Non-interactive runs fail with the exact setup command instead of guessing.
121
+ If `.localghost` is missing, an interactive development run asks whether to create it, asks for the primary `.localhost` domain, allows extra domains, explains the `/etc/hosts` password prompt, and runs setup when confirmed. Non-interactive runs fail with the exact setup command instead of guessing.
119
122
 
120
123
  ## Ghost Tunnel
121
124
 
@@ -141,8 +144,8 @@ When `ghostTunnel` is configured, route and Vite startup logs print the producti
141
144
  As a developer, I want to retest setup without deleting my project config.
142
145
 
143
146
  ```sh
144
- yarn localghost reset
145
- yarn localghost setup
147
+ localghost reset
148
+ localghost setup
146
149
  ```
147
150
 
148
151
  `reset` removes only the managed hosts block, generated Caddyfile, and setup state. It leaves `.localghost` in place.
@@ -152,8 +155,8 @@ yarn localghost setup
152
155
  As a developer, I want to cleanly remove Localghost from a project when the repo is archived or no longer needs friendly hostnames.
153
156
 
154
157
  ```sh
155
- yarn localghost teardown
156
- yarn localghost teardown --remove-caddyfile
158
+ localghost teardown
159
+ localghost teardown --remove-caddyfile
157
160
  ```
158
161
 
159
162
  `teardown` removes only the Localghost managed `/etc/hosts` block. The generated Caddyfile is kept unless `--remove-caddyfile` is passed.
@@ -163,8 +166,8 @@ yarn localghost teardown --remove-caddyfile
163
166
  As a developer or agent, I want to see what Localghost changed without reading system files directly.
164
167
 
165
168
  ```sh
166
- yarn localghost status
167
- yarn localghost status --json
169
+ localghost status
170
+ localghost status --json
168
171
  ```
169
172
 
170
173
  Localghost records setup and teardown in `ops/local/localghost-state.json`. That file is project-local state, not OS temp state.
@@ -174,9 +177,9 @@ Localghost records setup and teardown in `ops/local/localghost-state.json`. That
174
177
  As a Codex or agent user, I want commands that are inspectable and scriptable without opening a browser.
175
178
 
176
179
  ```sh
177
- yarn localghost print
178
- yarn localghost doctor
179
- yarn localghost update
180
+ localghost print
181
+ localghost doctor
182
+ localghost update
180
183
  ```
181
184
 
182
185
  The CLI reference lives in [localghost(1)](./localghost.1.md). Future flows can add MCP helpers and repo templates, but the base package should remain a small, predictable CLI.
package/docs/github.md CHANGED
@@ -4,11 +4,11 @@ Use this copy for the GitHub repo About box, topics, and social cards. Keep it s
4
4
 
5
5
  ## Repository Description
6
6
 
7
- Friendly local hostnames for app repos. Install the dev dependency, run `yarn dev`, and get clean `.localhost` URLs with Caddy and Vite-safe hosts.
7
+ Friendly local hostnames for app repos. Install with npm, pnpm, Yarn, or Bun and get clean `.localhost` URLs with Caddy and Vite-safe hosts.
8
8
 
9
9
  Shorter alternative:
10
10
 
11
- Friendly local hostnames for app repos. `yarn add -D`, `yarn dev`, ready.
11
+ Friendly local hostnames for app repos. Add the package, run `localghost`, ready.
12
12
 
13
13
  ## Topics
14
14
 
@@ -62,7 +62,7 @@ After creating `hamedb89/localghost`, this sets the public repo metadata:
62
62
 
63
63
  ```sh
64
64
  gh repo edit hamedb89/localghost \
65
- --description "Friendly local hostnames for app repos. Install the dev dependency, run yarn dev, and get clean .localhost URLs with Caddy and Vite-safe hosts." \
65
+ --description "Friendly local hostnames for app repos. Install with npm, pnpm, Yarn, or Bun and get clean .localhost URLs with Caddy and Vite-safe hosts." \
66
66
  --homepage "https://hamedb89.github.io/localghost/" \
67
67
  --add-topic localhost \
68
68
  --add-topic local-development \
@@ -81,7 +81,7 @@ gh repo edit hamedb89/localghost \
81
81
  The first visible paragraph should make the entrypoint feel obvious before it gets into configuration:
82
82
 
83
83
  ```txt
84
- Localghost is a tiny Node.js CLI for friendly local domains in app repos. Add it as a dev dependency, run `yarn dev`, and use `http://app.localhost/` instead of remembering which localhost port belongs to which process.
84
+ Localghost is a tiny Node.js CLI for friendly local domains in app repos. Add it with your package manager, run `localghost`, and use `http://app.localhost/` instead of remembering which localhost port belongs to which process.
85
85
  ```
86
86
 
87
87
  Then the next docs layer can explain `.localghost`, Caddy, `/etc/hosts`, Vite `allowedHosts`, and configuration options.
@@ -23,15 +23,15 @@ localghost run [--config file] [--config-pattern regex] [--https|--ssl] [--auto-
23
23
  localghost print [--config file] [--config-pattern regex]
24
24
  ```
25
25
 
26
- With no subcommand, Localghost detects the package manager from `packageManager` or a lockfile, prefers a non-recursive `dev:raw` script, falls back to `dev`, and runs the result through the normal Caddy lifecycle. `--dry-run` prints the detected command without checking or changing machine setup. Set `command: ["pnpm", "dev:web"]` in `localghost.config.mjs` when inference should be explicit.
26
+ With no subcommand, Localghost detects npm, pnpm, Yarn, or Bun from `packageManager` or a lockfile, prefers a non-recursive `dev:raw` script, falls back to `dev`, and runs the result through the normal Caddy lifecycle. `--dry-run` prints the detected command without checking or changing machine setup. Set `command: ["<package-manager>", "dev:web"]` in `localghost.config.mjs` when inference should be explicit.
27
27
 
28
28
  For multiple independently started applications, configure `services` in `localghost.config.mjs`. Each service declares a unique name and host plus its project-relative working directory, requested port, and optional command. Bare `localghost` starts one Caddy process and all service commands, passes service-specific `LOCALGHOST_PORT`, `VITE_PORT`, and `LOCALGHOST_SERVICE` variables, and stops the group when any process exits.
29
29
 
30
30
  ```js
31
31
  export default {
32
32
  services: [
33
- { name: "web", cwd: "apps/web", host: "xyz.localhost", port: 5173, command: ["pnpm", "dev"] },
34
- { name: "api", cwd: "apps/api", host: "api.xyz.localhost", port: 8787, command: ["pnpm", "dev"] }
33
+ { name: "web", cwd: "apps/web", host: "xyz.localhost", port: 5173 },
34
+ { name: "api", cwd: "apps/api", host: "api.xyz.localhost", port: 8787 }
35
35
  ]
36
36
  };
37
37
  ```
@@ -63,7 +63,7 @@ Options:
63
63
  - `--port <number>`: primary app port.
64
64
  - `--api-host <host>`: API hostname.
65
65
  - `--api-port <number>`: API port.
66
- - `--package-manager <npm|yarn|pnpm>`: package manager for suggested commands.
66
+ - `--package-manager <npm|pnpm|yarn|bun>`: package manager for suggested commands.
67
67
  - `--write-scripts`: add Localghost scripts to `package.json`.
68
68
  - `--force`: overwrite an existing config file.
69
69
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hamedb89/localghost",
3
- "version": "0.1.12",
3
+ "version": "0.1.13",
4
4
  "description": "Friendly local hostnames for app repos with .localghost, Caddy, /etc/hosts, and Vite.",
5
5
  "type": "module",
6
6
  "bin": {