Skip to content

Commit 68fb49b

Browse files
authored
Merge pull request #26 from naokazuterada/add-modesToZip
Add 'modesToZip' option
2 parents 88e664e + 776f202 commit 68fb49b

File tree

2 files changed

+20
-13
lines changed

2 files changed

+20
-13
lines changed

README.md

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -116,24 +116,30 @@ module.exports = {
116116

117117
See [Component options](#component-options).
118118

119-
- **manifestSync**
120-
- Type: `Array<string>`
119+
- **manifestSync**
120+
- Type: `Array<string>`
121121
- Default: `['version']`
122-
122+
123123
Array containing names of `manifest.json` keys that will be automatically synced with `package.json` on build.
124124

125125
Currently, the only supported keys are `version` and `description`.
126126

127-
- **api**
127+
- **modesToZip**
128+
- Type: `Array<string>`
129+
- Default: `['production']`
130+
131+
Array containing names of mode in which zipping up will trigger after build.
132+
133+
- **api**
128134
- Type: `'chrome'|'browser'`
129135
- Default: `'browser'`
130-
136+
131137
Browser extension API to use.
132138

133139
- **usePolyfill**
134140
- Type: `boolean`
135141
- Default: `true`
136-
142+
137143
Whether to add [webextension-polyfill](https://github.com/mozilla/webextension-polyfill) to polyfill WebExtension APIs in chrome.
138144

139145
- **autoImportPolyfill**
@@ -168,9 +174,9 @@ module.exports = {
168174

169175
#### background
170176

171-
- **entry**
177+
- **entry**
172178
- Type: `string|Array<string>`
173-
179+
174180
Background script as webpack entry using the [single entry shorthand syntax](https://webpack.js.org/concepts/entry-points/#single-entry-shorthand-syntax).
175181

176182
```js
@@ -181,9 +187,9 @@ module.exports = {
181187

182188
#### contentScripts
183189

184-
- **entries**
190+
- **entries**
185191
- Type: `{[entryChunkName: string]: string|Array<string>}`
186-
192+
187193
Content scripts as webpack entries using using the [object syntax](https://webpack.js.org/concepts/entry-points/#object-syntax).
188194

189195
```js

index.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@ const ZipPlugin = require('zip-webpack-plugin')
88
const defaultOptions = {
99
components: {},
1010
componentOptions: {},
11-
manifestSync: ['version']
11+
manifestSync: ['version'],
12+
modesToZip: ['production']
1213
}
1314

1415
module.exports = (api, options) => {
@@ -105,10 +106,10 @@ module.exports = (api, options) => {
105106
}
106107
}]))
107108

108-
if (isProduction) {
109+
if (pluginOptions.modesToZip.includes(api.service.mode)) {
109110
webpackConfig.plugins.push(new ZipPlugin({
110111
path: api.resolve(`${options.outputDir || 'dist'}-zip`),
111-
filename: `${packageJson.name}-v${packageJson.version}.zip`
112+
filename: `${packageJson.name}-v${packageJson.version}-${api.service.mode}.zip`
112113
}))
113114
}
114115

0 commit comments

Comments
 (0)