supabase-worker-previews 0.1.0 → 0.1.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 CHANGED
@@ -58,14 +58,14 @@ You need a Worker deployed by Workers Builds from a GitHub repo, wrangler 4.135.
58
58
 
59
59
  ```bash
60
60
  npm install --save-dev supabase-worker-previews
61
- npx swp init --project-ref <production project ref>
61
+ npx supabase-worker-previews init --project-ref <production project ref>
62
62
  ```
63
63
 
64
64
  `init` writes `swp.config.json`, a grants migration and the PR workflow, and prints the rest. Then:
65
65
 
66
66
  1. Connect the Supabase GitHub integration (automatic branching on, deploy to production off).
67
67
  2. Add a `previews` block to your wrangler config.
68
- 3. `npx swp shared` creates the shared Preview database and prints its `previews.vars`.
68
+ 3. `npx supabase-worker-previews shared` creates the shared Preview database and prints its `previews.vars`.
69
69
  4. Wrap the Worker:
70
70
 
71
71
  ```ts
@@ -77,7 +77,7 @@ npx swp init --project-ref <production project ref>
77
77
 
78
78
  and create the browser client from `readPublicConfig()`.
79
79
 
80
- 5. Turn on Preview builds in Workers Builds, add three Actions secrets, run `npx swp doctor`, and open a PR.
80
+ 5. Turn on Preview builds in Workers Builds, add three Actions secrets, run `npx supabase-worker-previews doctor`, and open a PR.
81
81
 
82
82
  The **[full quickstart](docs/quickstart.md)** walks through every step with the dashboard settings and the output to expect. For a complete working project, see [`examples/hono-notes`](examples/hono-notes).
83
83
 
@@ -94,6 +94,8 @@ The **[full quickstart](docs/quickstart.md)** walks through every step with the
94
94
  | **In CI** | `swp pr` | All of the above for a `pull_request` workflow, plus the PR comment and deployment |
95
95
  | | `swp prune` | List leftovers of deleted branches and closed PRs; delete them with `--yes` |
96
96
 
97
+ `swp` is the short name once the package is installed; the full name `supabase-worker-previews` runs the same CLI. With `npx`, always use the full name: `npx swp` on a machine without this package installed downloads [an unrelated npm package named `swp`](https://www.npmjs.com/package/swp) that deletes dependency and build folders.
98
+
97
99
  `swp <command> --help` shows one command's flags and examples, and `swp --version` prints the version. Flags, environment variables, every `swp.config.json` field and the GitHub Action inputs are in the [configuration reference](docs/configuration.md).
98
100
 
99
101
  ## Safety
@@ -104,7 +104,7 @@ export function init(options = {}, cwd = process.cwd()) {
104
104
  log(`+ ${WORKFLOW}`);
105
105
  log(options.action
106
106
  ? " It uses the published action, mattruby/supabase-worker-previews@v0."
107
- : " It runs the installed swp (npx swp pr); `swp init --action` writes one that uses the published action.");
107
+ : " It runs `npx supabase-worker-previews pr`; `npx supabase-worker-previews init --action` writes one that uses the published action instead.");
108
108
  }
109
109
  const steps = [
110
110
  ...(needsRef
@@ -119,13 +119,13 @@ export function init(options = {}, cwd = process.cwd()) {
119
119
  : [`Add a "previews" block to ${wrangler.file}, redeclaring every binding the Worker uses.`]),
120
120
  "Put SUPABASE_ACCESS_TOKEN, CLOUDFLARE_API_TOKEN and CLOUDFLARE_ACCOUNT_ID in .env.swp\n" +
121
121
  `(git-ignore it; scopes: ${TOKENS_URL}),\n` +
122
- "then run `npx swp shared` and paste the previews.vars it prints.",
122
+ "then run `npx supabase-worker-previews shared` and paste the previews.vars it prints.",
123
123
  "Wrap the Worker's default export:\n" +
124
124
  ' import { withSupabasePreviews } from "supabase-worker-previews";\n' +
125
125
  " export default withSupabasePreviews(app);",
126
126
  "Workers Builds: turn on non-production branch builds, deploy command `npx wrangler preview`.",
127
127
  "GitHub repo, Settings, Secrets and variables, Actions: add the same three tokens.",
128
- "Run `npx swp doctor` until it passes, then commit and open a PR.",
128
+ "Run `npx supabase-worker-previews doctor` until it passes, then commit and open a PR.",
129
129
  ];
130
130
  log(`\nNext, by hand (the full guide: ${QUICKSTART_URL}):`);
131
131
  steps.forEach((step, i) => log(` ${i + 1}. ${step.replace(/\n/g, "\n ")}`));
package/dist/usage.js CHANGED
@@ -37,7 +37,10 @@ export const COMMANDS = [
37
37
  value: "<branch>",
38
38
  help: "Branch the shared database tracks (default: origin/HEAD, else main)",
39
39
  },
40
- { name: "action", help: "Write a workflow that uses the published GitHub Action instead of npx swp" },
40
+ {
41
+ name: "action",
42
+ help: "Write a workflow that uses the published GitHub Action instead of npx supabase-worker-previews",
43
+ },
41
44
  { ...DRY_RUN, help: "Print what it would write; write nothing" },
42
45
  ],
43
46
  env: [],
@@ -185,9 +188,9 @@ export function mainHelp(s = makeStyle(false)) {
185
188
  ` Where to get them: ${TOKENS_URL}`,
186
189
  "",
187
190
  s.bold("Examples"),
188
- " npx swp init --project-ref abcdefghijklmnopqrst",
189
- " npx swp doctor",
190
- " npx swp shared --dry-run",
191
+ " npx supabase-worker-previews init --project-ref abcdefghijklmnopqrst",
192
+ " npx supabase-worker-previews doctor",
193
+ " npx supabase-worker-previews shared --dry-run",
191
194
  "",
192
195
  `Run ${s.cyan("swp <command> --help")} for one command. Docs: ${DOCS_URL}`,
193
196
  ].join("\n");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "supabase-worker-previews",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "Branch previews for Cloudflare Workers on Supabase branching: every git branch gets a Worker Preview, and every PR that changes the schema gets its own Supabase database.",
5
5
  "license": "MIT",
6
6
  "author": "Matt Ruby",
@@ -34,7 +34,8 @@
34
34
  "node": ">=22.0.0"
35
35
  },
36
36
  "bin": {
37
- "swp": "dist/cli.js"
37
+ "swp": "dist/cli.js",
38
+ "supabase-worker-previews": "dist/cli.js"
38
39
  },
39
40
  "main": "./dist/runtime.js",
40
41
  "types": "./dist/runtime.d.ts",
@@ -30,7 +30,7 @@ jobs:
30
30
  node-version: 24
31
31
  cache: npm
32
32
  - run: npm ci --no-audit --no-fund
33
- - run: npx swp pr
33
+ - run: npx supabase-worker-previews pr
34
34
  env:
35
35
  GITHUB_TOKEN: ${{ github.token }}
36
36
  SUPABASE_ACCESS_TOKEN: ${{ secrets.SUPABASE_ACCESS_TOKEN }}