@reliableapp/frontend-cli 1.0.1 → 1.0.3

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.
Files changed (3) hide show
  1. package/README.md +27 -4
  2. package/dist/index.js +13 -8
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -14,14 +14,21 @@ That's it on a supported platform — release SHA auto-detects, project IDs come
14
14
 
15
15
  ## Installation
16
16
 
17
- No install needed; use via `npx`:
17
+ Pick whichever fits your workflow:
18
18
 
19
+ **As a devDependency (recommended for build scripts):**
19
20
  ```bash
20
- npx @reliableapp/frontend-cli sourcemaps upload [options]
21
+ npm install --save-dev @reliableapp/frontend-cli
21
22
  ```
23
+ The `reliableapp-frontend` binary then resolves automatically inside any npm script — fastest option for repeat builds.
22
24
 
23
- Or install globally:
25
+ **Via `npx` (zero install):**
26
+ ```bash
27
+ npx --yes @reliableapp/frontend-cli sourcemaps upload [options]
28
+ ```
29
+ Slower on first run (downloads the package) but zero setup. Good for one-off CI YAML steps.
24
30
 
31
+ **Globally:**
25
32
  ```bash
26
33
  npm i -g @reliableapp/frontend-cli
27
34
  reliableapp-frontend sourcemaps upload [options]
@@ -29,6 +36,8 @@ reliableapp-frontend sourcemaps upload [options]
29
36
 
30
37
  Requires Node 18+.
31
38
 
39
+ > **Heads up:** if you write `reliableapp-frontend ...` directly in a shell or build script *without* installing the package locally or globally, you'll get `command not found`. The binary lives in `node_modules/.bin/` (after install) — npm scripts find it there automatically; raw shell does not.
40
+
32
41
  ## Setup (one-time)
33
42
 
34
43
  In the Reliable dashboard, generate an API token for your frontend project:
@@ -59,7 +68,11 @@ That's the only thing you need — the token already names the frontend project
59
68
 
60
69
  ### `package.json` script (Vercel, Netlify, Railway, Render, Coolify, Dokploy, anything Nixpacks-based)
61
70
 
62
- PaaS platforms that auto-build don't have CI step injection — chain the CLI into your build script instead:
71
+ PaaS platforms that auto-build don't have CI step injection — chain the CLI into your build script. Install it as a devDependency once so the binary resolves on every build:
72
+
73
+ ```bash
74
+ npm install --save-dev @reliableapp/frontend-cli
75
+ ```
63
76
 
64
77
  ```json
65
78
  {
@@ -69,6 +82,16 @@ PaaS platforms that auto-build don't have CI step injection — chain the CLI in
69
82
  }
70
83
  ```
71
84
 
85
+ **Or skip the install and use `npx --yes`** (slower on repeat builds — downloaded each time):
86
+
87
+ ```json
88
+ {
89
+ "scripts": {
90
+ "build": "vite build && npx --yes @reliableapp/frontend-cli sourcemaps upload --dist=./dist --url-prefix=https://app.example.com/"
91
+ }
92
+ }
93
+ ```
94
+
72
95
  Set `RELIABLE_TOKEN` in the platform's environment variables UI. The CLI auto-detects the commit SHA from the platform's own env vars (no `--release` needed).
73
96
 
74
97
  ## Required SDK config
package/dist/index.js CHANGED
@@ -124,12 +124,18 @@ function autodetectRelease() {
124
124
  async function sourcemapsUpload(opts) {
125
125
  const ci = detectCI();
126
126
  if (!ci && !opts.force) {
127
- console.error(red("\u2717 Refusing to upload \u2014 not running in CI."));
128
- console.error(gray(" No CI env var detected (CI, GITHUB_ACTIONS, VERCEL, etc)."));
129
- console.error(gray(" Pass --force to override (e.g. for testing locally)."));
130
- process.exit(2);
127
+ console.log(yellow("\u2298 Skipping sourcemap upload \u2014 not running in CI."));
128
+ console.log(gray(" This is normal for local builds. Add --force to override."));
129
+ return;
131
130
  }
132
131
  if (ci) console.log(gray(`CI detected via $${ci}`));
132
+ const token = (opts.token?.trim() || process.env.RELIABLE_TOKEN?.trim()) ?? "";
133
+ if (!token) {
134
+ console.error(red("\u2717 No API token provided."));
135
+ console.error(gray(" Pass --token=rl_fpt_... or set the RELIABLE_TOKEN environment variable."));
136
+ console.error(gray(" Generate a token in: Frontend Project \u2192 Settings \u2192 API Tokens."));
137
+ process.exit(2);
138
+ }
133
139
  const explicit = opts.release?.trim();
134
140
  const auto = explicit ? null : autodetectRelease();
135
141
  const release = explicit ?? auto?.release ?? "";
@@ -185,7 +191,7 @@ async function sourcemapsUpload(opts) {
185
191
  try {
186
192
  await uploadSourcemap({
187
193
  api: opts.api,
188
- token: opts.token,
194
+ token,
189
195
  release,
190
196
  environment: opts.environment,
191
197
  assetUrl,
@@ -220,10 +226,9 @@ function computeAssetUrl(urlPrefix, relativePath) {
220
226
  var program = new Command();
221
227
  program.name("reliableapp-frontend").description("Reliable frontend CLI \u2014 sourcemaps, releases, and other build-time uploads").version("1.0.0");
222
228
  var sourcemaps = program.command("sourcemaps").description("Sourcemap operations");
223
- sourcemaps.command("upload").description("Upload sourcemaps for a release to the Reliable backend").requiredOption(
229
+ sourcemaps.command("upload").description("Upload sourcemaps for a release to the Reliable backend").option(
224
230
  "--token <token>",
225
- "API token (rl_fpt_...). Falls back to $RELIABLE_TOKEN. The token already names which frontend project to upload to \u2014 no other IDs needed.",
226
- process.env.RELIABLE_TOKEN
231
+ "API token (rl_fpt_...). Falls back to $RELIABLE_TOKEN. The token already names which frontend project to upload to \u2014 no other IDs needed."
227
232
  ).option(
228
233
  "--release <id>",
229
234
  "Release identifier. Auto-detected from common platform env vars if omitted (GITHUB_SHA, VERCEL_GIT_COMMIT_SHA, RAILWAY_GIT_COMMIT_SHA, RENDER_GIT_COMMIT, etc.)."
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@reliableapp/frontend-cli",
3
- "version": "1.0.1",
3
+ "version": "1.0.3",
4
4
  "description": "Reliable frontend CLI — upload sourcemaps and manage frontend releases from CI. Built by Ziloris · https://ziloris.com",
5
5
  "homepage": "https://reliable.ziloris.com/docs",
6
6
  "bugs": {