-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(App): Add manifest v3 for chrome + Misc
- Loading branch information
Showing
6 changed files
with
153 additions
and
83 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,25 +9,30 @@ | |
"email": "[email protected]" | ||
}, | ||
"scripts": { | ||
"build": "pnpm clean && pnpm build:webpack && pnpm build:ext", | ||
"build": "pnpm dev:clean && pnpm build:clean && pnpm build:chrome && pnpm build:firefox", | ||
"build:clean": "rimraf packages", | ||
"build:ext": "web-ext build --source-dir dist", | ||
"build:prepare": "./bin/prepare.sh", | ||
"build:webpack": "NODE_ENV=production webpack", | ||
"clean": "pnpm dev:clean && pnpm build:clean", | ||
"dev": "pnpm dev:chrome", | ||
"dev:chrome": "pnpm dev:clean && concurrently 'pnpm dev:webpack' 'wait-on dist/manifest.json && pnpm dev:ext:chrome'", | ||
"build:increment": "build/increment.sh", | ||
"build:chrome": "pnpm build:chrome:webpack && pnpm build:chrome:package", | ||
"build:chrome:package": "web-ext build --source-dir dist/chrome --filename chrome.zip", | ||
"build:chrome:webpack": "NODE_ENV=production pnpm webpack:chrome", | ||
"build:firefox": "pnpm build:firefox:webpack && pnpm build:firefox:package", | ||
"build:firefox:package": "web-ext build --source-dir dist/firefox --filename firefox.zip", | ||
"build:firefox:webpack": "NODE_ENV=production pnpm webpack:firefox", | ||
"dev:clean": "rimraf dist", | ||
"dev:ext:chrome": "web-ext run -t chromium", | ||
"dev:ext:firefox": "web-ext run", | ||
"dev:firefox": "pnpm dev:clean && concurrently 'pnpm dev:webpack' 'wait-on dist/manifest.json && pnpm dev:ext:firefox'", | ||
"dev:webpack": "webpack", | ||
"dev:chrome": "pnpm dev:clean && pnpm dev:chrome:watch", | ||
"dev:chrome:run": "web-ext run --source-dir dist/chrome -t chromium", | ||
"dev:chrome:watch": "concurrently 'pnpm webpack:chrome' 'wait-on dist/chrome/manifest.json && pnpm dev:chrome:run'", | ||
"dev:firefox": "pnpm dev:clean && pnpm dev:firefox:watch", | ||
"dev:firefox:run": "web-ext run --source-dir dist/firefox", | ||
"dev:firefox:watch": "concurrently 'pnpm webpack:firefox' 'wait-on dist/firefox/manifest.json && pnpm dev:firefox:run'", | ||
"lint": "eslint src --ext .js --fix", | ||
"package:reinstall": "rimraf node_modules && pnpm", | ||
"package:sort": "npx sort-package-json", | ||
"test": "jest", | ||
"test:coverage": "jest --coverage", | ||
"test:watch": "jest --watchAll" | ||
"test:watch": "jest --watchAll", | ||
"webpack:chrome": "webpack --env chrome", | ||
"webpack:firefox": "webpack --env firefox" | ||
}, | ||
"dependencies": { | ||
"speed-to-percentage": "^1.2.1", | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,38 +1,55 @@ | ||
/* eslint-disable no-template-curly-in-string */ | ||
|
||
module.exports = { | ||
'plugins': [ | ||
plugins: [ | ||
['@semantic-release/commit-analyzer'], | ||
['@semantic-release/release-notes-generator'], | ||
['@semantic-release/changelog', { | ||
changelogFile: 'CHANGELOG.md', | ||
}], | ||
['@semantic-release/exec', { | ||
prepareCmd: 'yarn build:prepare ${nextRelease.version} && yarn build', | ||
}], | ||
['semantic-release-firefox-add-on', { | ||
extensionId: '{891ed2be-6ca9-47d1-9466-1595afa33b80}', | ||
targetXpi: 'bandcamp-plus--extension-${nextRelease.version}.xpi', | ||
artifactsDir: 'packages', | ||
channel: 'listed', | ||
}], | ||
['semantic-release-chrome', { | ||
extensionId: 'hggjmjobahhmbmnfndhdgidchhhhjkad', | ||
asset: 'bandcamp-plus--extension-${nextRelease.version}.zip', | ||
}], | ||
['@semantic-release/github', { | ||
assets: [ | ||
'packages/bandcamp-plus--extension-${nextRelease.version}.xpi', | ||
'bandcamp-plus--extension-${nextRelease.version}.zip', | ||
], | ||
}], | ||
['@semantic-release/git', { | ||
assets: [ | ||
'CHANGELOG.md', | ||
'package.json', | ||
'src/manifest.json', | ||
], | ||
message: 'chore(release): ${nextRelease.version} [skip ci]\n\n${nextRelease.notes}', | ||
}], | ||
[ | ||
'@semantic-release/changelog', | ||
{ | ||
changelogFile: 'CHANGELOG.md', | ||
}, | ||
], | ||
[ | ||
'@semantic-release/exec', | ||
{ | ||
prepareCmd: 'pnpm build:increment ${nextRelease.version} && pnpm build', | ||
}, | ||
], | ||
[ | ||
'semantic-release-firefox-add-on', | ||
{ | ||
extensionId: '{891ed2be-6ca9-47d1-9466-1595afa33b80}', | ||
targetXpi: 'bandcamp-plus--extension-${nextRelease.version}.xpi', | ||
sourceDir: 'dist/firefox', | ||
artifactsDir: 'packages', | ||
channel: 'listed', | ||
}, | ||
], | ||
[ | ||
'semantic-release-chrome', | ||
{ | ||
extensionId: 'hggjmjobahhmbmnfndhdgidchhhhjkad', | ||
asset: 'bandcamp-plus--extension-${nextRelease.version}.zip', | ||
distFolder: 'dist/chrome', | ||
}, | ||
], | ||
[ | ||
'@semantic-release/github', | ||
{ | ||
assets: [ | ||
'packages/bandcamp-plus--extension-${nextRelease.version}.xpi', | ||
'bandcamp-plus--extension-${nextRelease.version}.zip', | ||
], | ||
}, | ||
], | ||
[ | ||
'@semantic-release/git', | ||
{ | ||
assets: ['CHANGELOG.md', 'package.json', 'src/manifest-*.json'], | ||
message: | ||
'chore(release): ${nextRelease.version} [skip ci]\n\n${nextRelease.notes}', | ||
}, | ||
], | ||
], | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
{ | ||
"name": "Bandcamp+", | ||
"short_name": "bandcamp-plus", | ||
"description": "Add multiple features to bandcamp.com", | ||
"version": "3.2.4", | ||
"manifest_version": 2, | ||
"icons": { | ||
"512": "assets/bandcamp-plus-icon.png" | ||
}, | ||
"action": { | ||
"default_title": "Bandcamp+", | ||
"default_icon": { | ||
"512": "assets/bandcamp-plus-icon.png" | ||
} | ||
}, | ||
"content_scripts": [ | ||
{ | ||
"matches": [ | ||
"*://*.bandcamp.com/*" | ||
], | ||
"js": [ | ||
"scripts/content.js" | ||
], | ||
"css": [ | ||
"assets/content.css" | ||
], | ||
"run_at": "document_start", | ||
"all_frames": false | ||
} | ||
], | ||
"background": { | ||
"scripts": [ | ||
"scripts/background.js" | ||
] | ||
} | ||
} |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,50 +1,61 @@ | ||
const CopyPlugin = require('copy-webpack-plugin'); | ||
const isProduction = process.env.NODE_ENV === 'production'; | ||
const path = require('path'); | ||
|
||
// eslint-disable-next-line no-console | ||
console.log('Production mode is: ', isProduction); | ||
|
||
module.exports = { | ||
watch: !isProduction, | ||
mode: isProduction ? 'production' : 'development', | ||
devtool: isProduction ? false : 'inline-source-map', | ||
entry: { | ||
'scripts/content': './src/app/content.ts', | ||
'scripts/background': './src/app/background.ts', | ||
}, | ||
resolve: { | ||
extensions: ['.ts', '.js'], | ||
}, | ||
output: { | ||
'publicPath': '', | ||
}, | ||
node: false, | ||
plugins: [ | ||
new CopyPlugin({ | ||
patterns: [ | ||
module.exports = (env) => { | ||
const getBrowserFlavour = () => { | ||
if (env.chrome === true) { | ||
return 'chrome'; | ||
} else if (env.firefox === true) { | ||
return 'firefox'; | ||
} | ||
}; | ||
|
||
return { | ||
watch: !isProduction, | ||
mode: isProduction ? 'production' : 'development', | ||
devtool: isProduction ? false : 'inline-source-map', | ||
entry: { | ||
'scripts/content': './src/app/content.ts', | ||
'scripts/background': './src/app/background.ts', | ||
}, | ||
resolve: { | ||
extensions: ['.ts', '.js'], | ||
}, | ||
output: { | ||
path: path.resolve(__dirname, `dist/${getBrowserFlavour()}`), | ||
}, | ||
node: false, | ||
plugins: [ | ||
new CopyPlugin({ | ||
patterns: [ | ||
{ | ||
from: `./src/manifest-${getBrowserFlavour()}.json`, | ||
to: 'manifest.json', | ||
}, | ||
{ | ||
from: './src/assets', | ||
to: 'assets', | ||
}, | ||
], | ||
}), | ||
], | ||
module: { | ||
rules: [ | ||
{ | ||
from: './src/manifest.json', | ||
to: 'manifest.json', | ||
test: /\.js$/, | ||
use: 'babel-loader', | ||
exclude: /node_modules/, | ||
}, | ||
{ | ||
from: './src/assets', | ||
to: 'assets', | ||
test: /\.tsx?$/, | ||
use: 'ts-loader', | ||
exclude: /node_modules/, | ||
}, | ||
], | ||
}), | ||
], | ||
module: { | ||
rules: [ | ||
{ | ||
test: /\.js$/, | ||
use: 'babel-loader', | ||
exclude: /node_modules/, | ||
}, | ||
{ | ||
test: /\.tsx?$/, | ||
use: 'ts-loader', | ||
exclude: /node_modules/, | ||
}, | ||
], | ||
}, | ||
}, | ||
}; | ||
}; |