diff --git a/.github/workflows/pr-checks.yml b/.github/workflows/pr-checks.yml index 84f00a6b..ee81c342 100644 --- a/.github/workflows/pr-checks.yml +++ b/.github/workflows/pr-checks.yml @@ -28,13 +28,13 @@ jobs: - name: Build shell: bash - run: pnpm build ${{ matrix.browser }} nightly + run: pnpm build ${{ matrix.browser }} --channel=nightly - name: Upload artifacts - uses: actions/upload-artifact@v3.1.3 + uses: actions/upload-artifact@v4 with: name: ${{ github.event.pull_request.number }}-${{ matrix.browser }} - path: dist/${{ matrix.browser }}.zip + path: dist/${{ matrix.browser }}/ if-no-files-found: error lint: diff --git a/.github/workflows/sanity.yml b/.github/workflows/sanity.yml index 8a11dc20..5f9ad092 100644 --- a/.github/workflows/sanity.yml +++ b/.github/workflows/sanity.yml @@ -24,7 +24,7 @@ jobs: - name: Build shell: bash - run: pnpm build ${{ matrix.browser}} nightly + run: pnpm build ${{ matrix.browser}} --channel=nightly test: name: Test diff --git a/README.md b/README.md index 000912ba..d0b09bcf 100755 --- a/README.md +++ b/README.md @@ -39,11 +39,11 @@ pnpm i All commands are run from the root of the project, from a terminal: -| Command | Action | -| :------------------------------ | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -| `pnpm dev [target]` | Builds the extension for development, rebuilding on source code changes, for a specified target (`chrome` or `firefox`). If the target is not specified the script will build the extension for a Chromium based browser. Output folder: `dev`. | -| `pnpm build [TARGET] [CHANNEL]` | Builds the extension for production usage, for a specified target (`chrome` or `firefox`) and channel (`nightly`, `preview` or `stable`). If the target is not specified the script will build the extension for all available targets. If the channel is not specified the script will build the extension for the `nightly` channel. Output folder: `dist`. | -| `pnpm test` | Runs all test files using Jest. | +| Command | Action | +| :-------------------------------------- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| `pnpm dev [target]` | Builds the extension for development, rebuilding on source code changes, for a specified target (`chrome` or `firefox`). If the target is not specified the script will build the extension for a Chromium based browser. Output folder: `dev`. | +| `pnpm build [TARGET] --channel=CHANNEL` | Builds the extension for production usage, for a specified target (`chrome` or `firefox`) and channel (`nightly`, `preview` or `stable`). If the target is not specified the script will build the extension for all available targets. If the channel is not specified the script will build the extension for the `nightly` channel. Output folder: `dist`. | +| `pnpm test` | Runs all test files using Jest. | ### Installing the extension from source, in Chromium based browsers (Chrome, Opera, Edge, Brave, Arc, Vivaldi) diff --git a/scripts/build.ts b/scripts/build.ts index 4609ea54..8365cb9a 100644 --- a/scripts/build.ts +++ b/scripts/build.ts @@ -7,7 +7,6 @@ import fs from 'node:fs' import esbuild from 'esbuild' import { BuildArgs, - Channel, CHANNELS, DEV_DIR, DIST_DIR, @@ -19,16 +18,14 @@ import { import { getDevOptions } from '../esbuild/dev' import { getProdOptions } from '../esbuild/prod' -sade('build [target] [channel]', true) +sade('build [target]', true) + .option('--channel', `One of: ${CHANNELS.join(', ')}`, 'nightly') .option('--dev', 'Dev-mode (watch, live-reload)', false) - .example('chrome nightly') - .example('firefox stable') - .describe([ - '`target` should be one of ' + TARGETS.join(', '), - '`channel` should be one of ' + CHANNELS.join(', ') - ]) - .action(async (target: Target, channel: Channel, opts: BuildArgs) => { - const options = { ...opts, target, channel: channel || 'nightly' } + .example('chrome --channel=nightly') + .example('firefox --channel=stable') + .describe(['`target` should be one of ' + TARGETS.join(', ')]) + .action(async (target: Target, opts: BuildArgs) => { + const options = { ...opts, target } if (!options.target && !options.dev) { console.log(`Building all targets with channel: ${options.channel}`) return Promise.all(TARGETS.map((t) => build({ ...options, target: t }))) @@ -37,7 +34,6 @@ sade('build [target] [channel]', true) // Default to chrome in dev build if (options.dev) { options.target ||= 'chrome' - options.channel ||= 'nightly' } if (!TARGETS.includes(options.target)) {