Chrome Extension boilerplate for manifest v3.
Uses Parcel Web Extension Config and release-it for GitHub releases.
- After project initialization change
name
field in thepackage.json
file. This field will be used as name for.zip
with release. Not thename
field from themanifest.json
. - Version number for release is used as per
package.json
.Manifest.json
will be updated during release with the same value. So no need to update version insidemanifes.json
manually if you will userelease
script. - there is configured Dependabot version updates.
If you do not want to have PRs with your dependencies version updates, remove
.github/dependabot.yml
file.
- Check if your Node.js version is >= 16.
- Run
npm install
to install the dependencies. - Run
npm start
- Load your extension on Chrome following:
- Access
chrome://extensions/
- Check
Developer mode
- Click on
Load unpacked extension
- Select the
dist
folder.
- Access
- Stop development script (if it is running)
- Remove installed dev. extension at
chrome://extensions/
- Run
npm run build
- Load your extension on Chrome following:
- Access
chrome://extensions/
- Check
Developer mode
- Click on
Load unpacked extension
- Select the
dist
folder
- Access
Also, zip
file with production extension's code will be created in releases
folder.
This code is ready for uploading to Chrome Web Store.
Template uses release-it for release on GitHub.
- Generate
personal access token
in GitHub. Go to Github->Settings->DeveloperSettings->PersonalAccessTokens. Onlyrepo
scope is required. - Rename already existing
.env.example
file to.env
and put generatedpersonal access token
there. It will look like:GITHUB_TOKEN="your generated token"
- Run
npm run release
. Under the hood it will runnpm run build
steps, make version bump (in bothpackage.json
andmanifest.json
), commit, push and make GitHub release with generatedzip
file attached.
If you need to have some page which is not listed in manifest.json
, you may add it as additional entry point.
Something like that:
"start": "parcel watch src/manifest.json src/panel/panel.html --host localhost",
"build": "parcel build src/manifest.json src/panel/panel.html --no-cache"
In that case panel
folder will be created in dist
and you may reference it from your code like panel/panel.html
.