Skip to content

Commit bbef427

Browse files
committed
formatter sweep
1 parent 2ebae95 commit bbef427

File tree

2 files changed

+33
-16
lines changed

2 files changed

+33
-16
lines changed

README.md

Lines changed: 31 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
# vue-cli-plugin-browser-extension
2+
23
Browser extension development plugin for vue-cli 3.x
34

45
## What does it do?
6+
57
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).
68

79
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:
7375
- Using the vue cli `vue add browser-extension` command
7476

7577
## Usage
78+
7679
Running the Livereload server.
7780
This will build and write to the local `dist` directory.
7881

@@ -96,17 +99,19 @@ module.exports = {
9699
pluginOptions: {
97100
browserExtension: {
98101
// options...
99-
}
100-
}
101-
}
102+
},
103+
},
104+
};
102105
```
103106

104107
- **components**
108+
105109
- Type: `Object.<string, boolean>`
106110

107111
The browser extension components that will be managed by this plugin.
108112

109113
Valid components are:
114+
110115
- background
111116
- popup
112117
- options
@@ -122,11 +127,13 @@ module.exports = {
122127
```
123128

124129
- **componentOptions**
130+
125131
- Type: `Object.<string, Object>`
126132

127133
See [Component options](#component-options).
128134

129135
- **manifestSync**
136+
130137
- Type: `Array<string>`
131138
- Default: `['version']`
132139

@@ -135,8 +142,9 @@ module.exports = {
135142
Currently, the only supported keys are `version` and `description`.
136143

137144
- **manifestTransformer**
145+
138146
- Type: `Function`
139-
147+
140148
Function to modify the manifest JSON outputted by this plugin.
141149

142150
An example use case is adding or removing permissions depending on which browser is being targeted.
@@ -147,28 +155,32 @@ module.exports = {
147155
manifest.permissions.push('pageCapture');
148156
}
149157
return manifest;
150-
}
158+
};
151159
```
152160

153161
- **modesToZip**
162+
154163
- Type: `Array<string>`
155164
- Default: `['production']`
156165

157166
Array containing names of mode in which zipping up will trigger after build.
158167

159168
- **api**
169+
160170
- Type: `'chrome'|'browser'`
161171
- Default: `'browser'`
162172

163173
Browser extension API to use.
164174

165175
- **usePolyfill**
176+
166177
- Type: `boolean`
167178
- Default: `true`
168179

169180
Whether to add [webextension-polyfill](https://github.com/mozilla/webextension-polyfill) to polyfill WebExtension APIs in chrome.
170181

171182
- **autoImportPolyfill**
183+
172184
- Type: `boolean`
173185
- Default: `true`
174186

@@ -188,32 +200,34 @@ module.exports = {
188200
// e.g.
189201
contentScripts: {
190202
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+
};
199211
```
200212

201213
#### background
202214

203215
- **entry**
216+
204217
- Type: `string|Array<string>`
205218

206219
Background script as webpack entry using the [single entry shorthand syntax](https://webpack.js.org/concepts/entry-points/#single-entry-shorthand-syntax).
207220

208221
```js
209222
background: {
210-
entry: 'src/my-background-script.js'
223+
entry: 'src/my-background-script.js';
211224
}
212225
```
213226

214227
#### contentScripts
215228

216229
- **entries**
230+
217231
- Type: `{[entryChunkName: string]: string|Array<string>}`
218232

219233
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
236250
If you do not want to translate your app, simply delete the `public/_locales` directory, and no longer use the `browser.i18n` methods.
237251

238252
## Testing
253+
239254
This library is following the standard styling of vue projects, and those are really the only tests to perform.
240255

241256
```sh
242257
yarn test
243258
```
244259

245260
## Roadmap
261+
246262
- 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.
247263
- Dev Tools
248264
- A preset
249265
- Key Generation
250266
- Cleanup the dist-zip directory
251267

252268
## Credits
269+
253270
- [https://github.com/Kocal/vue-web-extension](https://github.com/Kocal/vue-web-extension) For inspiration on app and build structure
254271
- [https://github.com/YuraDev/vue-chrome-extension-template](https://github.com/YuraDev/vue-chrome-extension-template) For the logo crop and app/scaffold structure
255272
- [@YuraDev](https://github.com/YuraDev) for the wonderful WCER plugin for livereloading extensions

index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@ const performanceAssetFilterList = [
1818
(file) => !/^icons\//.test(file)
1919
]
2020

21-
function getManifestJsonString(pluginOptions, jsonContent) {
21+
function getManifestJsonString (pluginOptions, jsonContent) {
2222
if (pluginOptions.manifestTransformer) {
23-
const jsonContentCopy = Object.assign({}, jsonContent);
23+
const jsonContentCopy = Object.assign({}, jsonContent)
2424
jsonContent = pluginOptions.manifestTransformer(jsonContentCopy)
2525
}
2626
return JSON.stringify(jsonContent, null, 2)

0 commit comments

Comments
 (0)