You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+31-14Lines changed: 31 additions & 14 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,7 +1,9 @@
1
1
# vue-cli-plugin-browser-extension
2
+
2
3
Browser extension development plugin for vue-cli 3.x
3
4
4
5
## What does it do?
6
+
5
7
This is intended to be a vue-cli@3.x replacement for [https://github.com/Kocal/vue-web-extension](https://github.com/Kocal/vue-web-extension).
6
8
7
9
This plugin changes the `serve` command for your vue applications.
@@ -73,6 +75,7 @@ This can be added to your vuejs project by one of the following methods:
73
75
- Using the vue cli `vue add browser-extension` command
74
76
75
77
## Usage
78
+
76
79
Running the Livereload server.
77
80
This will build and write to the local `dist` directory.
78
81
@@ -96,17 +99,19 @@ module.exports = {
96
99
pluginOptions: {
97
100
browserExtension: {
98
101
// options...
99
-
}
100
-
}
101
-
}
102
+
},
103
+
},
104
+
};
102
105
```
103
106
104
107
-**components**
108
+
105
109
- Type: `Object.<string, boolean>`
106
110
107
111
The browser extension components that will be managed by this plugin.
108
112
109
113
Valid components are:
114
+
110
115
- background
111
116
- popup
112
117
- options
@@ -122,11 +127,13 @@ module.exports = {
122
127
```
123
128
124
129
-**componentOptions**
130
+
125
131
- Type: `Object.<string, Object>`
126
132
127
133
See [Component options](#component-options).
128
134
129
135
-**manifestSync**
136
+
130
137
- Type: `Array<string>`
131
138
- Default: `['version']`
132
139
@@ -135,8 +142,9 @@ module.exports = {
135
142
Currently, the only supported keys are `version` and `description`.
136
143
137
144
-**manifestTransformer**
145
+
138
146
- Type: `Function`
139
-
147
+
140
148
Function to modify the manifest JSON outputted by this plugin.
141
149
142
150
An example use case is adding or removing permissions depending on which browser is being targeted.
@@ -147,28 +155,32 @@ module.exports = {
147
155
manifest.permissions.push('pageCapture');
148
156
}
149
157
return manifest;
150
-
}
158
+
};
151
159
```
152
160
153
161
-**modesToZip**
162
+
154
163
- Type: `Array<string>`
155
164
- Default: `['production']`
156
165
157
166
Array containing names of mode in which zipping up will trigger after build.
158
167
159
168
-**api**
169
+
160
170
- Type: `'chrome'|'browser'`
161
171
- Default: `'browser'`
162
172
163
173
Browser extension API to use.
164
174
165
175
-**usePolyfill**
176
+
166
177
- Type: `boolean`
167
178
- Default: `true`
168
179
169
180
Whether to add [webextension-polyfill](https://github.com/mozilla/webextension-polyfill) to polyfill WebExtension APIs in chrome.
170
181
171
182
-**autoImportPolyfill**
183
+
172
184
- Type: `boolean`
173
185
- Default: `true`
174
186
@@ -188,32 +200,34 @@ module.exports = {
188
200
// e.g.
189
201
contentScripts: {
190
202
entries: {
191
-
'content1':'src/content-script1.js',
192
-
'content2':'src/content-script2.js'
193
-
}
194
-
}
195
-
}
196
-
}
197
-
}
198
-
}
203
+
content1:'src/content-script1.js',
204
+
content2:'src/content-script2.js',
205
+
},
206
+
},
207
+
},
208
+
},
209
+
},
210
+
};
199
211
```
200
212
201
213
#### background
202
214
203
215
-**entry**
216
+
204
217
- Type: `string|Array<string>`
205
218
206
219
Background script as webpack entry using the [single entry shorthand syntax](https://webpack.js.org/concepts/entry-points/#single-entry-shorthand-syntax).
Content scripts as webpack entries using using the [object syntax](https://webpack.js.org/concepts/entry-points/#object-syntax).
@@ -236,20 +250,23 @@ Since this is largely an out of the box solution provided by the browsers, it is
236
250
If you do not want to translate your app, simply delete the `public/_locales` directory, and no longer use the `browser.i18n` methods.
237
251
238
252
## Testing
253
+
239
254
This library is following the standard styling of vue projects, and those are really the only tests to perform.
240
255
241
256
```sh
242
257
yarn test
243
258
```
244
259
245
260
## Roadmap
261
+
246
262
- Add some generator options for other pieces of browser extensions. This includes scaffolding the components/dirs, and registering the build options into the build time hooks.
247
263
- Dev Tools
248
264
- A preset
249
265
- Key Generation
250
266
- Cleanup the dist-zip directory
251
267
252
268
## Credits
269
+
253
270
-[https://github.com/Kocal/vue-web-extension](https://github.com/Kocal/vue-web-extension) For inspiration on app and build structure
254
271
-[https://github.com/YuraDev/vue-chrome-extension-template](https://github.com/YuraDev/vue-chrome-extension-template) For the logo crop and app/scaffold structure
255
272
-[@YuraDev](https://github.com/YuraDev) for the wonderful WCER plugin for livereloading extensions
0 commit comments