Skip to content

Commit ec0277b

Browse files
committed
feat(prompt): add prompt for Mozilla Polyfill (Kocal#335)
* chore(prompt): add prompt for Mozilla Polyfill * chore: setup tests for polyfill * use polyfill
1 parent 7614a75 commit ec0277b

File tree

12 files changed

+70
-6
lines changed

12 files changed

+70
-6
lines changed

.appveyor.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,11 @@ test_script:
4141
yarn prettier:write
4242
}
4343
44+
if ($env:VUE_TEMPLATE.startsWith('full')) {
45+
Write-Color "[$($env:VUE_TEMPLATE)]", " Testing Web extension polyfill..." -Color Yellow, White
46+
Invoke-Expression "$($env:APPVEYOR_BUILD_FOLDER)/tests/test_web_extension_polyfill.ps1"
47+
}
48+
4449
if ($env:VUE_TEMPLATE.startsWith('full')) {
4550
Write-Color "[$($env:VUE_TEMPLATE)]", " Testing options..." -Color Yellow, White
4651
Invoke-Expression "$($env:APPVEYOR_BUILD_FOLDER)/tests/test_options.ps1"

.travis.yml

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -70,12 +70,13 @@ before_install:
7070
tfold "Installing extension dependencies..." yarn install --frozen-lockfile
7171
tfold "Building extension..." yarn build
7272
tfold "Testing version behavior..." $TRAVIS_BUILD_DIR/tests/test_version.sh
73-
if [[ "$VUE_TEMPLATE" =~ ^full ]]; then tfold "Linting..." yarn lint --fix; fi
74-
if [[ "$VUE_TEMPLATE" =~ ^full ]]; then tfold "Prettying..." yarn prettier:write; fi
75-
if [[ "$VUE_TEMPLATE" =~ ^full ]]; then tfold "Testing options..." $TRAVIS_BUILD_DIR/tests/test_options.sh; fi
76-
if [[ "$VUE_TEMPLATE" =~ ^full ]]; then tfold "Testing axios..." $TRAVIS_BUILD_DIR/tests/test_axios.sh; fi
77-
if [[ "$VUE_TEMPLATE" =~ ^full ]]; then tfold "Testing vue-router..." $TRAVIS_BUILD_DIR/tests/test_router.sh; fi
78-
if [[ "$VUE_TEMPLATE" =~ ^full ]]; then tfold "Testing vuex..." $TRAVIS_BUILD_DIR/tests/test_store.sh; fi
73+
if [[ "$VUE_TEMPLATE" =~ ^full ]]; then tfold "Linting..." yarn lint --fix; fi
74+
if [[ "$VUE_TEMPLATE" =~ ^full ]]; then tfold "Prettying..." yarn prettier:write; fi
75+
if [[ "$VUE_TEMPLATE" =~ ^full ]]; then tfold "Testing Web extension polyfill..." $TRAVIS_BUILD_DIR/tests/test_web_extension_polyfill.sh; fi
76+
if [[ "$VUE_TEMPLATE" =~ ^full ]]; then tfold "Testing options..." $TRAVIS_BUILD_DIR/tests/test_options.sh; fi
77+
if [[ "$VUE_TEMPLATE" =~ ^full ]]; then tfold "Testing axios..." $TRAVIS_BUILD_DIR/tests/test_axios.sh; fi
78+
if [[ "$VUE_TEMPLATE" =~ ^full ]]; then tfold "Testing vue-router..." $TRAVIS_BUILD_DIR/tests/test_router.sh; fi
79+
if [[ "$VUE_TEMPLATE" =~ ^full ]]; then tfold "Testing vuex..." $TRAVIS_BUILD_DIR/tests/test_store.sh; fi
7980
}
8081
export -f test_extension
8182

meta.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,11 @@ module.exports = {
3737
type: 'string',
3838
message: 'License',
3939
},
40+
mozillaPolyfill: {
41+
when: 'isNotTest',
42+
type: 'confirm',
43+
message: "Use Mozilla's web-extension polyfill? (https://github.com/mozilla/webextension-polyfill)",
44+
},
4045
options: {
4146
when: 'isNotTest',
4247
type: 'confirm',

scenarios/full-airbnb.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
"description": "Extension generated with Kocal/vue-web-extension",
44
"author": "Travis",
55
"license": "MIT",
6+
"mozillaPolyfill": true,
67
"options": true,
78
"router": true,
89
"store": true,

scenarios/full.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
"description": "Extension generated with Kocal/vue-web-extension",
44
"author": "Travis",
55
"license": "MIT",
6+
"mozillaPolyfill": true,
67
"options": true,
78
"router": true,
89
"store": true,

scenarios/minimal.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
"description": "Extension generated with Kocal/vue-web-extension",
44
"author": "Travis",
55
"license": "MIT",
6+
"mozillaPolyfill": false,
67
"options": false,
78
"router": false,
89
"store": false,

template/package.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
"watch:dev": "cross-env HMR=true npm run build:dev -- --watch"
2626
},
2727
"dependencies": {
28+
{{#mozillaPolyfill}}"webextension-polyfill": "^0.3.1",{{/mozillaPolyfill}}
2829
{{#axios}}"axios": "^0.18.0",{{/axios}}
2930
{{#router}}"vue-router": "^3.0.1",{{/router}}
3031
{{#store}}"vuex": "^3.0.1",{{/store}}
@@ -65,7 +66,11 @@
6566
"eslint-config-prettier": "^3.1.0",
6667
{{/lint}}
6768
{{/prettier}}
69+
{{#mozillaPolyfill}}
70+
"web-ext-types": "^2.1.0",
71+
{{else}}
6872
"@types/chrome": "^0.0.74",
73+
{{/mozillaPolyfill}}
6974
"@babel/core": "^7.1.2",
7075
"@babel/plugin-proposal-optional-chaining": "^7.0.0",
7176
"@babel/preset-env": "^7.1.0",

template/src/background.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
{{#if mozillaPolyfill}}global.browser = require('webextension-polyfill'){{/if}}
12
{{#if store}}
23
import store from './store'
34

template/src/options/options.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
{{#if mozillaPolyfill}}global.browser = require('webextension-polyfill'){{/if}}
2+
13
import Vue from 'vue'
24
import App from './App'
35

template/src/popup/popup.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
{{#if mozillaPolyfill}}global.browser = require('webextension-polyfill'){{/if}}
2+
13
import Vue from 'vue'
24
import App from './App'
35
{{#if store}}import store from '../store'{{/if}}

0 commit comments

Comments
 (0)