Skip to content

Commit

Permalink
feat: upgrade to Manifest V3 in Chrome
Browse files Browse the repository at this point in the history
BREAKING CHANGE: browser versions older than Chrome 123, Edge 123,
Opera 109 and Safari 16.4 are no longer supported
  • Loading branch information
dessant committed May 29, 2024
1 parent d66e7bc commit aba275e
Show file tree
Hide file tree
Showing 51 changed files with 3,775 additions and 3,416 deletions.
14 changes: 7 additions & 7 deletions .browserslistrc
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
[chrome]
Chrome >= 92
Edge >= 92
Opera >= 78
Chrome >= 123
Edge >= 123
Opera >= 109

[edge]
Edge >= 92
Edge >= 123

[firefox]
Firefox >= 115
FirefoxAndroid >= 115

[opera]
Opera >= 78
Opera >= 109

[safari]
Safari >= 14.1
iOS >= 15
Safari >= 16.4
iOS >= 16.4

[samsung]
Samsung >= 14
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ jobs:
- name: Hash artifacts
run: sha256sum artifacts/*/*
- name: Create GitHub release
uses: softprops/action-gh-release@v1
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ github.ref_name }}
name: ${{ github.ref_name }}
Expand Down
27 changes: 18 additions & 9 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ const targetEnv = process.env.TARGET_ENV || 'chrome';
const isProduction = process.env.NODE_ENV === 'production';
const enableContributions =
(process.env.ENABLE_CONTRIBUTIONS || 'true') === 'true';

const mv3 = ['chrome'].includes(targetEnv);

const distDir = path.join(__dirname, 'dist', targetEnv);

function initEnv() {
Expand All @@ -46,12 +49,17 @@ function js(done) {
}

function html() {
return src(
enableContributions
? 'src/**/*.html'
: ['src/**/*.html', '!src/contribute/*.html'],
{base: '.'}
)
const htmlSrc = ['src/**/*.html'];

if (mv3) {
htmlSrc.push('!src/background/*.html');
}

if (!enableContributions) {
htmlSrc.push('!src/contribute/*.html');
}

return src(htmlSrc, {base: '.'})
.pipe(gulpif(isProduction, htmlmin({collapseWhitespace: true})))
.pipe(dest(distDir));
}
Expand Down Expand Up @@ -135,9 +143,10 @@ async function images(done) {

if (enableContributions) {
await new Promise(resolve => {
src('node_modules/vueton/components/contribute/assets/*.@(png|svg)', {
encoding: false
})
src(
'node_modules/vueton/components/contribute/assets/*.@(png|webp|svg)',
{encoding: false}
)
.pipe(gulpif(isProduction, imagemin()))
.pipe(dest(path.join(distDir, 'src/contribute/assets')))
.on('error', done)
Expand Down
Loading

0 comments on commit aba275e

Please sign in to comment.