@interfere/cli 0.0.2-canary.0 → 0.0.2-canary.1
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 +84 -7
- package/dist/package.mjs +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,23 +1,100 @@
|
|
|
1
1
|
# @interfere/cli
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
Command-line tool for [Interfere](https://interfere.com) release workflows.
|
|
3
|
+
Command-line tool for [Interfere](https://interfere.com) release workflows. Uploads source maps and registers releases so the collector accepts spans from your deployments.
|
|
6
4
|
|
|
7
5
|
## Install
|
|
8
6
|
|
|
9
7
|
```sh
|
|
8
|
+
npm install -D @interfere/cli
|
|
9
|
+
# or
|
|
10
10
|
bun add -d @interfere/cli
|
|
11
|
+
# or
|
|
12
|
+
pnpm add -D @interfere/cli
|
|
11
13
|
```
|
|
12
14
|
|
|
13
15
|
## Usage
|
|
14
16
|
|
|
15
|
-
|
|
17
|
+
Run after your build step to upload source maps and preflight the release:
|
|
16
18
|
|
|
17
19
|
```sh
|
|
18
|
-
|
|
20
|
+
interfere sourcemaps upload ./dist
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
Typically added as a `postbuild` script in `package.json`:
|
|
24
|
+
|
|
25
|
+
```json
|
|
26
|
+
{
|
|
27
|
+
"scripts": {
|
|
28
|
+
"build": "tsc",
|
|
29
|
+
"postbuild": "interfere sourcemaps upload ./dist"
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
### What it does
|
|
35
|
+
|
|
36
|
+
1. Derives a release slug from the commit SHA (same algorithm the SDK uses at runtime)
|
|
37
|
+
2. Registers the release with the collector (`POST /v1/releases/`)
|
|
38
|
+
3. Discovers `.js.map` files in the target directory
|
|
39
|
+
4. Uploads source maps via presigned URLs
|
|
40
|
+
5. Marks the release as preflight-confirmed so the collector accepts spans for it
|
|
41
|
+
|
|
42
|
+
### Options
|
|
43
|
+
|
|
44
|
+
```text
|
|
45
|
+
interfere sourcemaps upload <dir> [options]
|
|
46
|
+
|
|
47
|
+
Options:
|
|
48
|
+
--release <slug> Override the release slug (default: derived from commit SHA)
|
|
49
|
+
--url <api-url> Interfere collector URL (default: $INTERFERE_API_URL)
|
|
50
|
+
--auth-token <key> Interfere API key (default: $INTERFERE_API_KEY)
|
|
51
|
+
--skip-preflight Don't mark the release preflight-confirmed after upload
|
|
52
|
+
-h, --help Show help
|
|
53
|
+
--version Show version
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
## Environment Variables
|
|
57
|
+
|
|
58
|
+
| Variable | Required | Purpose |
|
|
59
|
+
|---|---|---|
|
|
60
|
+
| `INTERFERE_API_KEY` | Yes | Authenticates with the collector. Format: `interfere_ak_*` |
|
|
61
|
+
| `INTERFERE_SOURCE_ID` | No | Override the commit SHA used to derive the release slug. Falls back to `VERCEL_GIT_COMMIT_SHA`, `GITHUB_SHA`, or `git rev-parse HEAD`. |
|
|
62
|
+
| `INTERFERE_API_URL` | No | Override the default collector URL |
|
|
63
|
+
|
|
64
|
+
## How release identity works
|
|
65
|
+
|
|
66
|
+
The CLI and the SDK independently derive the same release slug from the commit SHA using a shared `deriveReleaseSlug()` function. For this to work, both must see the same SHA:
|
|
67
|
+
|
|
68
|
+
- **At build time (CLI):** reads from `INTERFERE_SOURCE_ID`, `GITHUB_SHA`, `VERCEL_GIT_COMMIT_SHA`, or `git rev-parse HEAD`
|
|
69
|
+
- **At runtime (SDK):** reads from the same env vars or git
|
|
70
|
+
|
|
71
|
+
In Docker deployments where `.git` isn't in the image, set `INTERFERE_SOURCE_ID` in the runtime environment to the same commit SHA used during the build.
|
|
72
|
+
|
|
73
|
+
## Examples
|
|
74
|
+
|
|
75
|
+
### GitHub Actions
|
|
76
|
+
|
|
77
|
+
```yaml
|
|
78
|
+
- name: Build
|
|
79
|
+
run: npm run build
|
|
80
|
+
|
|
81
|
+
- name: Upload source maps
|
|
82
|
+
run: npx interfere sourcemaps upload ./dist
|
|
83
|
+
env:
|
|
84
|
+
INTERFERE_API_KEY: ${{ secrets.INTERFERE_API_KEY }}
|
|
85
|
+
# GITHUB_SHA is automatically available
|
|
19
86
|
```
|
|
20
87
|
|
|
21
|
-
|
|
88
|
+
### Docker
|
|
89
|
+
|
|
90
|
+
```dockerfile
|
|
91
|
+
ARG GIT_SHA
|
|
92
|
+
ENV INTERFERE_SOURCE_ID=$GIT_SHA
|
|
93
|
+
|
|
94
|
+
COPY dist/ ./dist/
|
|
95
|
+
CMD ["node", "dist/main.js"]
|
|
96
|
+
```
|
|
22
97
|
|
|
23
|
-
|
|
98
|
+
```sh
|
|
99
|
+
docker build --build-arg GIT_SHA=$(git rev-parse HEAD) .
|
|
100
|
+
```
|
package/dist/package.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var name=`@interfere/cli`,version=`0.0.2-canary.
|
|
1
|
+
var name=`@interfere/cli`,version=`0.0.2-canary.1`;export{name,version};
|
package/package.json
CHANGED