Skip to content

Commit 2c9f74b

Browse files
committed
build: build for default only
1 parent 2698cba commit 2c9f74b

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

package.json

+1
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
},
1313
"scripts": {
1414
"dev": "VERSION=dev-v$(node scripts/get-version.js) NODE_OPTIONS=--openssl-legacy-provider webpack-dashboard -- webpack --watch",
15+
"dev:all": "GITAKO_TARGET= yarn run dev",
1516
"debug-firefox": "web-ext run --source-dir=dist-firefox --keep-profile-changes --start-url https://github.com/EnixCoda/Gitako",
1617
"prepare": "husky install",
1718
"postinstall": "patch-package",

webpack.config.ts

+7-3
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,9 @@ const { CleanWebpackPlugin } = require('clean-webpack-plugin')
1111

1212
const IN_PRODUCTION_MODE = process.env.NODE_ENV === 'production'
1313

14-
function createConfig({ envTarget }: { envTarget: 'default' | 'firefox' | 'safari' }) {
14+
type Target = 'default' | 'firefox' | 'safari'
15+
16+
function createConfig({ envTarget }: { envTarget: Target }) {
1517
const outputPath = {
1618
default: path.resolve(__dirname, 'dist'),
1719
firefox: path.resolve(__dirname, 'dist-firefox'),
@@ -196,9 +198,11 @@ function createConfig({ envTarget }: { envTarget: 'default' | 'firefox' | 'safar
196198
return webpackConfig
197199
}
198200

199-
const configs = (['default', 'firefox', 'safari'] as const).map(envTarget =>
200-
createConfig({ envTarget }),
201+
const gitakoTarget = process.env.GITAKO_TARGET ?? 'default'
202+
const enabledTargets = (['default', 'firefox', 'safari'] as Target[]).filter(
203+
target => !gitakoTarget || gitakoTarget === target,
201204
)
205+
const configs = enabledTargets.map(envTarget => createConfig({ envTarget }))
202206

203207
// Enable parallelism for faster build
204208
// https://webpack.js.org/configuration/configuration-types/#parallelism

0 commit comments

Comments
 (0)