Skip to content

Commit

Permalink
Cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
aklinker1 committed Jan 22, 2024
1 parent b1a9671 commit bf68905
Show file tree
Hide file tree
Showing 8 changed files with 19 additions and 33 deletions.
Binary file added .github/assets/demo.mp4
Binary file not shown.
Binary file removed .github/assets/publish-extension-demo.mov
Binary file not shown.
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<h1 align="center">Publish Browser Extension</h1>
<p align="center">Publish an extension to all the extension stores in a single command!</p>

https://github.com/aklinker1/publish-browser-extension/assets/10101283/654e2dd2-d36a-48dc-9730-2ca1464da677
https://github.com/aklinker1/publish-browser-extension/assets/10101283/b0e856ca-4e26-4c7e-9ff8-c900e203cab5

## Features

Expand Down Expand Up @@ -112,8 +112,8 @@ publishExtension({
> Make sure to set the Firefox channel to "unlisted", chrome's publish target to "trustedTesters", and don't submit the extension for review for Chrome or Edge. This will prevent you from accidentally releasing one of the test extensions publically.
5. Run the dev commands to upload a test extension to the stores:
```sh
pnpm dev:all
pnpm dev:chrome
pnpm dev:firefox
pnpm dev:edge
pnpm env-cmd -f .env.submit pnpm dev:all
pnpm env-cmd -f .env.submit pnpm dev:chrome
pnpm env-cmd -f .env.submit pnpm dev:firefox
pnpm env-cmd -f .env.submit pnpm dev:edge
```
9 changes: 1 addition & 8 deletions src/chrome/chrome-api.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import { createFetch } from 'ofetch';
import { FormData } from 'formdata-node';
import fs from 'fs';
import path from 'path';
import { fileFromPath } from 'formdata-node/file-from-path';
import consola from 'consola';
import { fetch } from '../utils/fetch';

export interface CwsApiOptions {
clientId: string;
Expand All @@ -19,12 +18,6 @@ export interface CwsTokenDetails {
token_type: string;
}

const fetch = createFetch({
defaults: {
onResponseError: consola.error,
},
});

export class CwsApi {
constructor(readonly options: CwsApiOptions) {}

Expand Down
7 changes: 1 addition & 6 deletions src/edge/edge-api.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { createFetch } from 'ofetch';
import fs from 'fs';
import consola from 'consola';
import { fetch } from '../utils/fetch';

export interface EdgeApiOptions {
productId: string;
Expand Down Expand Up @@ -32,12 +33,6 @@ export interface DraftOperation {
errors: string[] | null;
}

const fetch = createFetch({
defaults: {
onResponseError: consola.error,
},
});

export class EdgeApi {
constructor(readonly options: EdgeApiOptions) {}

Expand Down
2 changes: 1 addition & 1 deletion src/firefox/firefox-addon-store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ export class FirefoxAddonStore implements Store {
)}, ${plural(notices, 'notice')}`,
);
if (!upload.valid) throw Error(`Extension is invalid: ${validationUrl}`);
else console.log(validationUrl);
else console.log('Firefox validation results: ' + validationUrl);
}

private async uploadAndPollValidation(
Expand Down
14 changes: 1 addition & 13 deletions src/firefox/firefox-api.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
import { FormData } from 'formdata-node';
import { fileFromPath } from 'formdata-node/file-from-path';
import jwt from 'jsonwebtoken';
import fs from 'fs';
import path from 'path';
import { createFetch } from 'ofetch';
import consola from 'consola';
import { fetch } from '../utils/fetch';

export interface AddonsApiOptions {
jwtIssuer: string;
Expand Down Expand Up @@ -52,15 +49,6 @@ export interface AddonVersion {

export type AddonChannel = 'listed' | 'unlisted';

const fetch = createFetch({
defaults: {
onResponseError: ctx => {
console.log('Reqeust:', ctx.request);
console.log('Response:', JSON.stringify(ctx.response, null, 2));
},
},
});

export class AddonsApi {
constructor(readonly options: AddonsApiOptions) {}

Expand Down
10 changes: 10 additions & 0 deletions src/utils/fetch.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { createFetch } from 'ofetch';

export const fetch = createFetch({
defaults: {
onResponseError: ctx => {
console.log('Reqeust:', ctx.request);
console.log('Response:', JSON.stringify(ctx.response, null, 2));
},
},
});

0 comments on commit bf68905

Please sign in to comment.