@extension.dev/deploy 0.1.0

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 (50) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +237 -0
  3. package/bin/extension-deploy.cjs +3 -0
  4. package/dist/__tests__/cli.test.d.ts +2 -0
  5. package/dist/__tests__/cli.test.d.ts.map +1 -0
  6. package/dist/__tests__/config.test.d.ts +2 -0
  7. package/dist/__tests__/config.test.d.ts.map +1 -0
  8. package/dist/__tests__/deploy.test.d.ts +2 -0
  9. package/dist/__tests__/deploy.test.d.ts.map +1 -0
  10. package/dist/__tests__/dry-run.test.d.ts +2 -0
  11. package/dist/__tests__/dry-run.test.d.ts.map +1 -0
  12. package/dist/__tests__/types.test.d.ts +2 -0
  13. package/dist/__tests__/types.test.d.ts.map +1 -0
  14. package/dist/__tests__/utils.test.d.ts +2 -0
  15. package/dist/__tests__/utils.test.d.ts.map +1 -0
  16. package/dist/__tests__/verify.test.d.ts +2 -0
  17. package/dist/__tests__/verify.test.d.ts.map +1 -0
  18. package/dist/__tests__/watch.test.d.ts +2 -0
  19. package/dist/__tests__/watch.test.d.ts.map +1 -0
  20. package/dist/module.d.ts +2 -0
  21. package/dist/module.d.ts.map +1 -0
  22. package/dist/module.js +976 -0
  23. package/dist/module.mjs +886 -0
  24. package/dist/src/chrome.d.ts +42 -0
  25. package/dist/src/chrome.d.ts.map +1 -0
  26. package/dist/src/cli.d.ts +4 -0
  27. package/dist/src/cli.d.ts.map +1 -0
  28. package/dist/src/config.d.ts +68 -0
  29. package/dist/src/config.d.ts.map +1 -0
  30. package/dist/src/deploy.d.ts +3 -0
  31. package/dist/src/deploy.d.ts.map +1 -0
  32. package/dist/src/edge.d.ts +39 -0
  33. package/dist/src/edge.d.ts.map +1 -0
  34. package/dist/src/firefox.d.ts +56 -0
  35. package/dist/src/firefox.d.ts.map +1 -0
  36. package/dist/src/index.d.ts +14 -0
  37. package/dist/src/index.d.ts.map +1 -0
  38. package/dist/src/types.d.ts +242 -0
  39. package/dist/src/types.d.ts.map +1 -0
  40. package/dist/src/utils/async.d.ts +2 -0
  41. package/dist/src/utils/async.d.ts.map +1 -0
  42. package/dist/src/utils/fetch.d.ts +3 -0
  43. package/dist/src/utils/fetch.d.ts.map +1 -0
  44. package/dist/src/utils/fs.d.ts +4 -0
  45. package/dist/src/utils/fs.d.ts.map +1 -0
  46. package/dist/src/utils/log.d.ts +6 -0
  47. package/dist/src/utils/log.d.ts.map +1 -0
  48. package/dist/src/watch.d.ts +41 -0
  49. package/dist/src/watch.d.ts.map +1 -0
  50. package/package.json +78 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Extension Dev
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,237 @@
1
+ [npm-version-image]: https://img.shields.io/npm/v/%40extension.dev%2Fdeploy
2
+ [npm-version-url]: https://www.npmjs.com/package/@extension.dev/deploy
3
+ [action-image]: https://github.com/extensiondev/deploy/actions/workflows/ci.yml/badge.svg?branch=main
4
+ [action-url]: https://github.com/extensiondev/deploy/actions
5
+
6
+ [![Version][npm-version-image]][npm-version-url] [![workflow][action-image]][action-url]
7
+
8
+ # @extension.dev/deploy
9
+
10
+ Deploy browser extensions to Chrome Web Store, Firefox AMO, and Edge Partner Center from a single command.
11
+
12
+ - Upload and publish to one, two, or all three stores in a single run
13
+ - Works as a CLI or as a Node.js library
14
+ - Reads credentials from CLI flags, environment variables, or a `.env.submit` file
15
+ - Dry-run mode to verify auth without uploading anything
16
+ - Chrome staged rollout and expedited review support
17
+ - Zero runtime dependencies beyond [zod](https://zod.dev)
18
+
19
+ ## Install
20
+
21
+ ```bash
22
+ npm install @extension.dev/deploy
23
+ ```
24
+
25
+ ## CLI usage
26
+
27
+ ```bash
28
+ npx extension-deploy \
29
+ --chrome-zip dist/chrome.zip \
30
+ --chrome-extension-id abcdefghijklmnopabcdefghijklmnop \
31
+ --chrome-client-id 123.apps.googleusercontent.com \
32
+ --chrome-client-secret GOCSPX-xxx \
33
+ --chrome-refresh-token 1//0xxx
34
+ ```
35
+
36
+ Run `extension-deploy --help` for the full list of flags.
37
+
38
+ ### Global flags
39
+
40
+ | Flag | Description |
41
+ | --- | --- |
42
+ | `--dry-run` | Verify auth and validate ZIPs without uploading or publishing |
43
+ | `--help` | Show the help message |
44
+
45
+ ### Chrome Web Store
46
+
47
+ | Flag | Env var | Description |
48
+ | --- | --- | --- |
49
+ | `--chrome-zip <path>` | `CHROME_ZIP` | Path to the extension ZIP file |
50
+ | `--chrome-extension-id <id>` | `CHROME_EXTENSION_ID` | Chrome Web Store extension ID |
51
+ | `--chrome-client-id <id>` | `CHROME_CLIENT_ID` | OAuth2 client ID |
52
+ | `--chrome-client-secret <secret>` | `CHROME_CLIENT_SECRET` | OAuth2 client secret |
53
+ | `--chrome-refresh-token <token>` | `CHROME_REFRESH_TOKEN` | OAuth2 refresh token |
54
+ | `--chrome-publish-target <target>` | `CHROME_PUBLISH_TARGET` | `"default"` or `"trustedTesters"` |
55
+ | `--chrome-deploy-percentage <n>` | `CHROME_DEPLOY_PERCENTAGE` | Staged rollout percentage (1-100) |
56
+ | `--chrome-review-exemption` | `CHROME_REVIEW_EXEMPTION` | Request expedited review |
57
+ | `--chrome-skip-submit-review` | `CHROME_SKIP_SUBMIT_REVIEW` | Upload only, skip publish step |
58
+
59
+ ### Firefox AMO
60
+
61
+ | Flag | Env var | Description |
62
+ | --- | --- | --- |
63
+ | `--firefox-zip <path>` | `FIREFOX_ZIP` | Path to the extension ZIP file |
64
+ | `--firefox-sources-zip <path>` | `FIREFOX_SOURCES_ZIP` | Path to sources ZIP (optional, for review) |
65
+ | `--firefox-extension-id <id>` | `FIREFOX_EXTENSION_ID` | Addon GUID (`{uuid}`) or email-style ID |
66
+ | `--firefox-jwt-issuer <issuer>` | `FIREFOX_JWT_ISSUER` | AMO JWT issuer (API key) |
67
+ | `--firefox-jwt-secret <secret>` | `FIREFOX_JWT_SECRET` | AMO JWT secret |
68
+ | `--firefox-channel <channel>` | `FIREFOX_CHANNEL` | `"listed"` or `"unlisted"` |
69
+
70
+ ### Edge Partner Center
71
+
72
+ | Flag | Env var | Description |
73
+ | --- | --- | --- |
74
+ | `--edge-zip <path>` | `EDGE_ZIP` | Path to the extension ZIP file |
75
+ | `--edge-product-id <id>` | `EDGE_PRODUCT_ID` | Partner Center product ID |
76
+ | `--edge-client-id <id>` | `EDGE_CLIENT_ID` | Partner Center client ID |
77
+ | `--edge-api-key <key>` | `EDGE_API_KEY` | Partner Center API key (v1.1) |
78
+ | `--edge-skip-submit-review` | `EDGE_SKIP_SUBMIT_REVIEW` | Upload only, skip publish step |
79
+
80
+ ### Environment variables
81
+
82
+ All flags can be set via `SCREAMING_SNAKE_CASE` environment variables (e.g. `CHROME_ZIP`, `FIREFOX_JWT_SECRET`). CLI flags take precedence over environment variables.
83
+
84
+ A `.env.submit` file in the current working directory is loaded automatically. Existing environment variables are never overwritten.
85
+
86
+ ```bash
87
+ # .env.submit
88
+ CHROME_ZIP=dist/chrome.zip
89
+ CHROME_EXTENSION_ID=abcdefghijklmnopabcdefghijklmnop
90
+ CHROME_CLIENT_ID=123.apps.googleusercontent.com
91
+ CHROME_CLIENT_SECRET=GOCSPX-xxx
92
+ CHROME_REFRESH_TOKEN=1//0xxx
93
+ ```
94
+
95
+ ## Library usage
96
+
97
+ ```ts
98
+ import { deploy } from "@extension.dev/deploy";
99
+
100
+ const result = await deploy({
101
+ dryRun: false,
102
+ chrome: {
103
+ zip: "dist/chrome.zip",
104
+ extensionId: "abcdefghijklmnopabcdefghijklmnop",
105
+ clientId: "123.apps.googleusercontent.com",
106
+ clientSecret: "GOCSPX-xxx",
107
+ refreshToken: "1//0xxx",
108
+ publishTarget: "default",
109
+ deployPercentage: 10, // optional: staged rollout
110
+ },
111
+ firefox: {
112
+ zip: "dist/firefox.zip",
113
+ extensionId: "{12345678-1234-1234-1234-123456789abc}",
114
+ jwtIssuer: "user:12345:678",
115
+ jwtSecret: "your-jwt-secret",
116
+ channel: "listed",
117
+ },
118
+ edge: {
119
+ zip: "dist/edge.zip",
120
+ productId: "your-product-id",
121
+ clientId: "your-client-id",
122
+ apiKey: "your-api-key",
123
+ },
124
+ });
125
+
126
+ if (!result.success) {
127
+ for (const store of result.stores) {
128
+ if (!store.success) {
129
+ console.error(`${store.store} failed: ${store.error}`);
130
+ }
131
+ }
132
+ process.exit(1);
133
+ }
134
+ ```
135
+
136
+ ### `deploy(config): Promise<DeployResult>`
137
+
138
+ Deploys to all configured stores in parallel. Only stores with a config object are included — omit a store to skip it.
139
+
140
+ **`DeployConfig`**
141
+
142
+ | Field | Type | Required | Description |
143
+ | --- | --- | --- | --- |
144
+ | `dryRun` | `boolean` | No | Verify auth without uploading. Default `false` |
145
+ | `chrome` | `ChromeOptions` | No | Chrome Web Store config |
146
+ | `firefox` | `FirefoxOptions` | No | Firefox AMO config |
147
+ | `edge` | `EdgeOptions` | No | Edge Partner Center config |
148
+
149
+ **`DeployResult`**
150
+
151
+ | Field | Type | Description |
152
+ | --- | --- | --- |
153
+ | `dryRun` | `boolean` | Whether this was a dry run |
154
+ | `success` | `boolean` | `true` if all stores succeeded |
155
+ | `stores` | `StoreResult[]` | Per-store results |
156
+
157
+ **`StoreResult`**
158
+
159
+ | Field | Type | Description |
160
+ | --- | --- | --- |
161
+ | `store` | `"chrome" \| "firefox" \| "edge"` | Store identifier |
162
+ | `success` | `boolean` | Whether submission succeeded |
163
+ | `status` | `"dry_run" \| "submitted" \| "uploaded" \| "failed"` | Result status |
164
+ | `error` | `string?` | Error message on failure |
165
+ | `duration` | `number` | Duration in milliseconds |
166
+
167
+ ### Validation schemas
168
+
169
+ Zod schemas are exported for custom validation:
170
+
171
+ ```ts
172
+ import {
173
+ chromeOptionsSchema,
174
+ firefoxOptionsSchema,
175
+ edgeOptionsSchema,
176
+ deployConfigSchema,
177
+ } from "@extension.dev/deploy";
178
+ ```
179
+
180
+ ## CI example (GitHub Actions)
181
+
182
+ ```yaml
183
+ - name: Deploy extension
184
+ run: npx extension-deploy
185
+ env:
186
+ CHROME_ZIP: dist/chrome.zip
187
+ CHROME_EXTENSION_ID: ${{ secrets.CHROME_EXTENSION_ID }}
188
+ CHROME_CLIENT_ID: ${{ secrets.CHROME_CLIENT_ID }}
189
+ CHROME_CLIENT_SECRET: ${{ secrets.CHROME_CLIENT_SECRET }}
190
+ CHROME_REFRESH_TOKEN: ${{ secrets.CHROME_REFRESH_TOKEN }}
191
+ FIREFOX_ZIP: dist/firefox.zip
192
+ FIREFOX_EXTENSION_ID: ${{ secrets.FIREFOX_EXTENSION_ID }}
193
+ FIREFOX_JWT_ISSUER: ${{ secrets.FIREFOX_JWT_ISSUER }}
194
+ FIREFOX_JWT_SECRET: ${{ secrets.FIREFOX_JWT_SECRET }}
195
+ EDGE_ZIP: dist/edge.zip
196
+ EDGE_PRODUCT_ID: ${{ secrets.EDGE_PRODUCT_ID }}
197
+ EDGE_CLIENT_ID: ${{ secrets.EDGE_CLIENT_ID }}
198
+ EDGE_API_KEY: ${{ secrets.EDGE_API_KEY }}
199
+ ```
200
+
201
+ ## Exit codes
202
+
203
+ | Code | Meaning |
204
+ | --- | --- |
205
+ | `0` | All configured stores succeeded |
206
+ | `1` | One or more stores failed, or a validation/config error occurred |
207
+
208
+ ## Local development
209
+
210
+ ```bash
211
+ pnpm install
212
+ pnpm lint
213
+ pnpm build
214
+ pnpm test
215
+ ```
216
+
217
+ ## Release
218
+
219
+ This repository publishes through the `Release` GitHub Actions workflow.
220
+
221
+ Prerequisites:
222
+
223
+ - Add an `NPM_TOKEN` repository secret with publish access for `@extension.dev/deploy`
224
+ - Trigger the `Release` workflow from GitHub Actions with a plain semver like `0.1.0`
225
+
226
+ What the workflow does:
227
+
228
+ 1. Validates that the requested version and git tag do not already exist
229
+ 2. Installs dependencies, then runs lint, build, and test
230
+ 3. Updates `package.json`
231
+ 4. Creates commit `release: v<version>` and tag `v<version>`
232
+ 5. Pushes the commit and tag
233
+ 6. Publishes the package to npm
234
+
235
+ ## License
236
+
237
+ MIT
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env node
2
+ const { main } = require("../dist/module.js");
3
+ main();
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=cli.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cli.test.d.ts","sourceRoot":"","sources":["../../__tests__/cli.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=config.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config.test.d.ts","sourceRoot":"","sources":["../../__tests__/config.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=deploy.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"deploy.test.d.ts","sourceRoot":"","sources":["../../__tests__/deploy.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=dry-run.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dry-run.test.d.ts","sourceRoot":"","sources":["../../__tests__/dry-run.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=types.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.test.d.ts","sourceRoot":"","sources":["../../__tests__/types.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=utils.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.test.d.ts","sourceRoot":"","sources":["../../__tests__/utils.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=verify.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"verify.test.d.ts","sourceRoot":"","sources":["../../__tests__/verify.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=watch.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"watch.test.d.ts","sourceRoot":"","sources":["../../__tests__/watch.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ export * from "./src/index";
2
+ //# sourceMappingURL=module.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"module.d.ts","sourceRoot":"","sources":["../module.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC"}