Skip to content

Commit eb60a51

Browse files
authored
Merge pull request #32 from shaydoc/support-overrride-option
add override support
2 parents 1bfc292 + 09cd5f4 commit eb60a51

File tree

7 files changed

+94
-16
lines changed

7 files changed

+94
-16
lines changed

README.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,15 @@ I hope to be able to scaffold an app so that identifying the below in unnecessar
3737
|- App.vue
3838
|- popup.html
3939
|- popup.js
40+
|- override/
41+
|- router/
42+
|- pages/
43+
|- Index.vue
44+
|- index.js
45+
|- routes.js
46+
|- App.vue
47+
|- override.html
48+
|- override.js
4049
|- standalone/
4150
|- router/
4251
|- pages/
@@ -102,6 +111,7 @@ module.exports = {
102111
- popup
103112
- options
104113
- contentScripts
114+
- override
105115
- standalone
106116

107117
```js

generator/index.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,15 @@ module.exports = (api, _options) => {
8181
}
8282
}
8383

84+
if (options.components.override) {
85+
api.render('./template/override', { name, ...options })
86+
87+
pkg.vue.pages['override/override'] = {
88+
entry: 'src/override/override.js',
89+
title: 'Override'
90+
}
91+
}
92+
8493
if (options.components.standalone) {
8594
console.log('Generating standalone app')
8695
api.render('./template/standalone', { name, ...options })

generator/template/base-app/src/manifest.json

Lines changed: 23 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -12,30 +12,42 @@
1212
"permissions": [
1313
<%_ if (options.components.contentScripts) { -%>
1414
"activeTab",
15-
<%_ } -%>
15+
<%_
16+
} -%>
1617
"<all_urls>",
1718
"*://*/*"
1819
],
1920
<%_ if (options.components.background) { -%>
2021
"background": {
21-
"scripts": ["background.js"],
22-
"persistent": false
23-
},
24-
<%_ } -%>
22+
"scripts": [
23+
"background.js"
24+
],
25+
"persistent": false
26+
},
27+
<%_
28+
} -%>
2529
"browser_action": {
2630
<%_ if (options.components.popup) { -%>
2731
"default_popup": "popup/popup.html",
28-
<%_ } -%>
32+
<%_
33+
} -%>
2934
"default_title": "__MSG_extName__",
3035
"default_icon": {
3136
"19": "icons/19.png",
3237
"38": "icons/38.png"
3338
}
3439
<%_ if (options.components.options) { -%>
35-
},
36-
"options_ui": {
37-
"page": "options/options.html",
38-
"<%- options.api %>_style": true
39-
<%_ } -%>
40+
},
41+
"options_ui": {
42+
"page": "options/options.html",
43+
"<%- options.api %>_style": true
44+
<%_
45+
} -%>
4046
}
47+
<%_ if (options.components.override) { -%>
48+
"chrome_url_overrides": {
49+
"<%- options.components.overrideOption || 'newtab' %>": "override/override.html"
50+
}
51+
<%_
52+
} -%>
4153
}
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<template>
2+
<div>
3+
<p>{{ defaultText }}</p>
4+
</div>
5+
</template>
6+
7+
<script>
8+
export default {
9+
name: 'App',
10+
computed: {
11+
defaultText() {
12+
return <%- options.api %>.i18n.getMessage('extName');
13+
}
14+
}
15+
}
16+
</script>
17+
18+
<style scoped>
19+
p {
20+
font-size: 20px;
21+
}
22+
</style>
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8">
5+
<meta http-equiv="X-UA-Compatible" content="IE=edge">
6+
<meta name="viewport" content="width=device-width,initial-scale=1.0">
7+
<title><%- '\<\%= htmlWebpackPlugin.options.title \%\>' %></title>
8+
</head>
9+
<body>
10+
<div id="app"></div>
11+
</body>
12+
</html>
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
import Vue from 'vue'
2+
import App from './App'
3+
4+
/* eslint-disable no-new */
5+
new Vue({
6+
el: '#app',
7+
render: h => h(App)
8+
})

prompts.js

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,15 +27,20 @@ module.exports = [
2727
value: 'contentScripts',
2828
short: 'content scripts'
2929
},
30+
{
31+
name: 'Override Page',
32+
value: 'override',
33+
short: 'override'
34+
},
3035
{
3136
name: 'Standalone Tab',
3237
value: 'standalone',
3338
short: 'standalone'
34-
// },
35-
// {
36-
// name: 'Dev Tools Tab',
37-
// value: 'devTools',
38-
// short: 'dev tools'
39+
// },
40+
// {
41+
// name: 'Dev Tools Tab',
42+
// value: 'devTools',
43+
// short: 'dev tools'
3944
}
4045
],
4146
filter: async (input) => {

0 commit comments

Comments
 (0)