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 28, 2024
1 parent 0ae1d74 commit 45a3638
Show file tree
Hide file tree
Showing 41 changed files with 5,375 additions and 7,427 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
6 changes: 3 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ jobs:
run: sha256sum artifacts/*/*
if: startsWith(github.ref, 'refs/tags/v')
- name: Upload artifacts
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
if: startsWith(github.ref, 'refs/tags/v')
with:
name: artifacts
Expand All @@ -46,14 +46,14 @@ jobs:
contents: write
steps:
- name: Download artifacts
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4
with:
name: artifacts
path: artifacts/
- 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
2 changes: 1 addition & 1 deletion .github/workflows/label-actions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@ jobs:
action:
runs-on: ubuntu-latest
steps:
- uses: dessant/label-actions@v3
- uses: dessant/label-actions@v4
2 changes: 1 addition & 1 deletion .github/workflows/lockdown.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
action:
runs-on: ubuntu-latest
steps:
- uses: dessant/repo-lockdown@v3
- uses: dessant/repo-lockdown@v4
with:
exclude-pr-created-before: '2022-01-01T00:00:00Z'
pr-comment: 'This project does not accept pull requests. Please use issues to report bugs or suggest new features.'
Expand Down
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
20.9.0
20.12.2
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ https://github.com/dessant/web-archives/wiki/Search-engines

## License

Copyright (c) 2017-2023 Armin Sebastian
Copyright (c) 2017-2024 Armin Sebastian

This software is released under the terms of the GNU General Public License v3.0.
See the [LICENSE](LICENSE) file for further information.
43 changes: 32 additions & 11 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 All @@ -71,7 +79,10 @@ async function images(done) {
// Chrome Web Store does not correctly display optimized icons
if (isProduction && targetEnv !== 'chrome') {
await new Promise(resolve => {
src(path.join(distDir, 'src/assets/icons/app/*.png'), {base: '.'})
src(path.join(distDir, 'src/assets/icons/app/*.png'), {
base: '.',
encoding: false
})
.pipe(imagemin())
.pipe(dest('.'))
.on('error', done)
Expand All @@ -94,7 +105,10 @@ async function images(done) {
}
if (isProduction) {
await new Promise(resolve => {
src(path.join(distDir, 'src/assets/icons/engines/*.png'), {base: '.'})
src(path.join(distDir, 'src/assets/icons/engines/*.png'), {
base: '.',
encoding: false
})
.pipe(imagemin())
.pipe(dest('.'))
.on('error', done)
Expand All @@ -104,7 +118,10 @@ async function images(done) {
}

await new Promise(resolve => {
src('src/assets/icons/@(app|engines|misc)/*.@(png|svg)', {base: '.'})
src('src/assets/icons/@(app|engines|misc)/*.@(png|svg)', {
base: '.',
encoding: false
})
.pipe(gulpif(isProduction, imagemin()))
.pipe(dest(distDir))
.on('error', done)
Expand All @@ -113,7 +130,10 @@ async function images(done) {

if (enableContributions) {
await new Promise(resolve => {
src('node_modules/vueton/components/contribute/assets/*.@(png|svg)')
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 All @@ -133,7 +153,8 @@ async function fonts(done) {

await new Promise(resolve => {
src(
'node_modules/@fontsource/roboto/files/roboto-latin-@(400|500|700)-normal.woff2'
'node_modules/@fontsource/roboto/files/roboto-latin-@(400|500|700)-normal.woff2',
{encoding: false}
)
.pipe(dest(path.join(distDir, 'src/assets/fonts/files')))
.on('error', done)
Expand Down
Loading

0 comments on commit 45a3638

Please sign in to comment.