Skip to content

Commit

Permalink
feat: Read variables from .env.submit
Browse files Browse the repository at this point in the history
  • Loading branch information
aklinker1 committed Jan 31, 2024
1 parent 337244d commit ff567b7
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 13 deletions.
16 changes: 5 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,7 @@ publish-extension \
--edge-zip dist/chrome.zip
```

> [!NOTE]
>
> `publish-extension` does not load any `.env` files, you're responsible for making sure the environment varaibles are set while running the command. In CI, this is easy, but to run the command locally, you'll need to use something like the `env-cmd` package:
>
> ```sh
> pnpm env-cmd -f .env.submit publish-extension ...
> ```
`publish-extesion` will automatically look for a `.env.submit` file and load it if it exists.

## JS Usage

Expand Down Expand Up @@ -112,8 +106,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 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
pnpm dev:all
pnpm dev:chrome
pnpm dev:firefox
pnpm dev:edge
```
3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@
"dev:firefox": "./scripts/dev.sh firefox",
"dev:edge": "./scripts/dev.sh edge",
"dev:help": "./scripts/dev.sh help",
"publish-extension": "env-cmd -f .env.submit tsx src/cli.ts",
"publish-extension": "tsx src/cli.ts",
"prepack": "pnpm build",
"prepare": "simple-git-hooks"
},
Expand Down Expand Up @@ -98,7 +98,6 @@
"@types/prompts": "^2.4.4",
"@vitest/coverage-v8": "^1.2.0",
"archiver": "^5.3.1",
"env-cmd": "^10.1.0",
"jsonwebtoken": "^8.5.1",
"lint-staged": "^15.2.0",
"npm-run-all": "^4.1.5",
Expand Down
3 changes: 3 additions & 0 deletions src/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ import { submit } from './submit';
import { InlineConfig } from './config';
import { init } from './init';
import consola from 'consola';
import { config } from 'dotenv';

config({ path: '.env.submit' });

const cli = cac('publish-extension');
cli.version(version);
Expand Down

0 comments on commit ff567b7

Please sign in to comment.