@pablozaiden/installer 0.0.3 → 0.0.4
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 +35 -68
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -2,21 +2,12 @@
|
|
|
2
2
|
|
|
3
3
|
Reusable installer, updater, and release tooling for GitHub-hosted Bun binaries.
|
|
4
4
|
|
|
5
|
-
This package factors out the shared behavior used by projects like `pablozaiden/link` and `pablozaiden/ralpher`:
|
|
6
|
-
|
|
7
|
-
- a generic one-line shell installer that can target a GitHub repository,
|
|
8
|
-
- a TypeScript updater library for installed CLI binaries,
|
|
9
|
-
- a reusable GitHub Actions workflow for release binary assets,
|
|
10
|
-
- an npm publishing workflow for this TypeScript-only package.
|
|
11
|
-
|
|
12
5
|
## Install this package
|
|
13
6
|
|
|
14
7
|
```bash
|
|
15
8
|
bun add @pablozaiden/installer
|
|
16
9
|
```
|
|
17
10
|
|
|
18
|
-
The package exports TypeScript source directly, following the same style as `@pablozaiden/terminatui`.
|
|
19
|
-
|
|
20
11
|
## Binary asset contract
|
|
21
12
|
|
|
22
13
|
All tools use the same release asset naming convention:
|
|
@@ -60,18 +51,18 @@ The installer:
|
|
|
60
51
|
|
|
61
52
|
### Manifest schema
|
|
62
53
|
|
|
63
|
-
Single-binary example
|
|
54
|
+
Single-binary example:
|
|
64
55
|
|
|
65
56
|
```json
|
|
66
57
|
{
|
|
67
58
|
"schemaVersion": 1,
|
|
68
|
-
"repo": "pablozaiden/
|
|
59
|
+
"repo": "pablozaiden/myproject",
|
|
69
60
|
"installDir": "$HOME/.local/bin",
|
|
70
61
|
"binaries": [
|
|
71
62
|
{
|
|
72
|
-
"name": "
|
|
73
|
-
"assetPrefix": "
|
|
74
|
-
"postInstallMessage": "Run '
|
|
63
|
+
"name": "myproject-cli",
|
|
64
|
+
"assetPrefix": "myproject-cli",
|
|
65
|
+
"postInstallMessage": "Run 'myproject-cli' to start MyProject."
|
|
75
66
|
}
|
|
76
67
|
],
|
|
77
68
|
"checksums": {
|
|
@@ -85,27 +76,27 @@ Single-binary example for Link:
|
|
|
85
76
|
}
|
|
86
77
|
```
|
|
87
78
|
|
|
88
|
-
Multi-binary example
|
|
79
|
+
Multi-binary example:
|
|
89
80
|
|
|
90
81
|
```json
|
|
91
82
|
{
|
|
92
83
|
"schemaVersion": 1,
|
|
93
|
-
"repo": "pablozaiden/
|
|
84
|
+
"repo": "pablozaiden/myproject",
|
|
94
85
|
"installDir": "$HOME/.local/bin",
|
|
95
86
|
"binaries": [
|
|
96
87
|
{
|
|
97
|
-
"name": "
|
|
98
|
-
"assetPrefix": "
|
|
99
|
-
"postInstallMessage": "Run '
|
|
88
|
+
"name": "myproject",
|
|
89
|
+
"assetPrefix": "myproject",
|
|
90
|
+
"postInstallMessage": "Run 'myproject' to start the local server."
|
|
100
91
|
},
|
|
101
92
|
{
|
|
102
|
-
"name": "
|
|
103
|
-
"assetPrefix": "
|
|
104
|
-
"postInstallMessage": "Run '
|
|
93
|
+
"name": "myproject-cli",
|
|
94
|
+
"assetPrefix": "myproject-cli",
|
|
95
|
+
"postInstallMessage": "Run 'myproject-cli --help' to use the API client."
|
|
105
96
|
}
|
|
106
97
|
],
|
|
107
98
|
"checksums": {
|
|
108
|
-
"required":
|
|
99
|
+
"required": true,
|
|
109
100
|
"extension": ".sha256"
|
|
110
101
|
}
|
|
111
102
|
}
|
|
@@ -120,7 +111,7 @@ For projects without a manifest, pass binaries explicitly:
|
|
|
120
111
|
|
|
121
112
|
```bash
|
|
122
113
|
curl -fsSL https://raw.githubusercontent.com/pablozaiden/installer/main/install.sh \
|
|
123
|
-
| sh -s -- pablozaiden/
|
|
114
|
+
| sh -s -- pablozaiden/myproject --binary myproject-cli
|
|
124
115
|
```
|
|
125
116
|
|
|
126
117
|
Useful options:
|
|
@@ -141,7 +132,7 @@ Use `runUpdateCommand` from an installed binary's `update` command.
|
|
|
141
132
|
|
|
142
133
|
```ts
|
|
143
134
|
import { runUpdateCommand } from "@pablozaiden/installer";
|
|
144
|
-
import {
|
|
135
|
+
import { MYPROJECT_VERSION } from "./version";
|
|
145
136
|
|
|
146
137
|
export async function runCliCommand(command: { kind: string; checkOnly?: boolean; version?: string }) {
|
|
147
138
|
if (command.kind === "update") {
|
|
@@ -151,10 +142,10 @@ export async function runCliCommand(command: { kind: string; checkOnly?: boolean
|
|
|
151
142
|
version: command.version,
|
|
152
143
|
},
|
|
153
144
|
{
|
|
154
|
-
repository: "pablozaiden/
|
|
155
|
-
binaryName: "
|
|
156
|
-
currentVersion:
|
|
157
|
-
productName: "
|
|
145
|
+
repository: "pablozaiden/myproject",
|
|
146
|
+
binaryName: "myproject-cli",
|
|
147
|
+
currentVersion: MYPROJECT_VERSION,
|
|
148
|
+
productName: "MyProject",
|
|
158
149
|
checksum: { required: true },
|
|
159
150
|
},
|
|
160
151
|
);
|
|
@@ -166,7 +157,7 @@ For a CLI with a companion binary installed beside it:
|
|
|
166
157
|
|
|
167
158
|
```ts
|
|
168
159
|
import { runUpdateCommand } from "@pablozaiden/installer";
|
|
169
|
-
import {
|
|
160
|
+
import { MYPROJECT_VERSION } from "./version";
|
|
170
161
|
|
|
171
162
|
await runUpdateCommand(
|
|
172
163
|
{
|
|
@@ -174,15 +165,15 @@ await runUpdateCommand(
|
|
|
174
165
|
version: undefined,
|
|
175
166
|
},
|
|
176
167
|
{
|
|
177
|
-
repository: "pablozaiden/
|
|
178
|
-
binaryName: "
|
|
179
|
-
currentVersion:
|
|
180
|
-
productName: "
|
|
168
|
+
repository: "pablozaiden/myproject",
|
|
169
|
+
binaryName: "myproject-cli",
|
|
170
|
+
currentVersion: MYPROJECT_VERSION,
|
|
171
|
+
productName: "MyProject",
|
|
181
172
|
checksum: { required: false },
|
|
182
173
|
companionBinaries: [
|
|
183
174
|
{
|
|
184
|
-
binaryName: "
|
|
185
|
-
assetPrefix: "
|
|
175
|
+
binaryName: "myproject",
|
|
176
|
+
assetPrefix: "myproject",
|
|
186
177
|
required: false
|
|
187
178
|
}
|
|
188
179
|
],
|
|
@@ -237,8 +228,8 @@ jobs:
|
|
|
237
228
|
binaries: |
|
|
238
229
|
[
|
|
239
230
|
{
|
|
240
|
-
"name": "
|
|
241
|
-
"asset_prefix": "
|
|
231
|
+
"name": "myproject-cli",
|
|
232
|
+
"asset_prefix": "myproject-cli",
|
|
242
233
|
"build_command": "bun run build-binary.ts --target=$BUN_TARGET --outfile=$ASSET_PATH",
|
|
243
234
|
"output_path": "$ASSET_PATH"
|
|
244
235
|
}
|
|
@@ -258,16 +249,16 @@ jobs:
|
|
|
258
249
|
binaries: |
|
|
259
250
|
[
|
|
260
251
|
{
|
|
261
|
-
"name": "
|
|
262
|
-
"asset_prefix": "
|
|
252
|
+
"name": "myproject",
|
|
253
|
+
"asset_prefix": "myproject",
|
|
263
254
|
"build_command": "cd apps/server && bun src/build.ts --target=$BUN_TARGET",
|
|
264
|
-
"output_path": "apps/server/dist/
|
|
255
|
+
"output_path": "apps/server/dist/myproject-$RELEASE_TARGET"
|
|
265
256
|
},
|
|
266
257
|
{
|
|
267
|
-
"name": "
|
|
268
|
-
"asset_prefix": "
|
|
258
|
+
"name": "myproject-cli",
|
|
259
|
+
"asset_prefix": "myproject-cli",
|
|
269
260
|
"build_command": "cd apps/cli && bun src/build.ts --target=$BUN_TARGET",
|
|
270
|
-
"output_path": "apps/cli/dist/
|
|
261
|
+
"output_path": "apps/cli/dist/myproject-cli-$RELEASE_TARGET"
|
|
271
262
|
}
|
|
272
263
|
]
|
|
273
264
|
```
|
|
@@ -297,24 +288,6 @@ On a published GitHub release, it:
|
|
|
297
288
|
|
|
298
289
|
Manual `workflow_dispatch` publishes with the `unstable` tag.
|
|
299
290
|
|
|
300
|
-
## Migration guide: Link
|
|
301
|
-
|
|
302
|
-
1. Add `.github/installer.json` using the single-binary manifest above.
|
|
303
|
-
2. Replace `src/server/update.ts` logic with a thin wrapper around `runUpdateCommand`.
|
|
304
|
-
3. Keep Link's command parser and `LINK_VERSION`; pass them into the updater config.
|
|
305
|
-
4. Replace `.github/workflows/binary-release.yml` with a caller workflow that uses `reusable-binary-release.yml`.
|
|
306
|
-
5. Keep checksum publication enabled.
|
|
307
|
-
6. Optionally update the README one-liner to point at `pablozaiden/installer`.
|
|
308
|
-
|
|
309
|
-
## Migration guide: Ralpher
|
|
310
|
-
|
|
311
|
-
1. Add `.github/installer.json` using the multi-binary manifest above.
|
|
312
|
-
2. Decide whether to publish checksums immediately. If not, use `checksums.required: false` temporarily.
|
|
313
|
-
3. Replace `src/cli/update.ts` logic with `runUpdateCommand` configured with `binaryName: "ralpher-cli"` and `companionBinaries: [{ binaryName: "ralpher" }]`.
|
|
314
|
-
4. Replace `.github/workflows/binary-release.yml` with a caller workflow that builds both server and CLI binaries.
|
|
315
|
-
5. Once checksum assets are published, switch installer/updater checksum policy to required.
|
|
316
|
-
6. Optionally update the README one-liner to point at `pablozaiden/installer`.
|
|
317
|
-
|
|
318
291
|
## Development
|
|
319
292
|
|
|
320
293
|
```bash
|
|
@@ -322,9 +295,3 @@ bun install
|
|
|
322
295
|
bun run build
|
|
323
296
|
bun test
|
|
324
297
|
```
|
|
325
|
-
|
|
326
|
-
Shell syntax for the installer is covered by tests and can be checked directly:
|
|
327
|
-
|
|
328
|
-
```bash
|
|
329
|
-
sh -n install.sh
|
|
330
|
-
```
|