Skip to content

Commit

Permalink
Merge pull request #387 from freelawproject/feat-upgrade-to-manifest-v3
Browse files Browse the repository at this point in the history
  • Loading branch information
mlissner authored Aug 28, 2024
2 parents b7f4f3b + 75c5475 commit 3ebcd1d
Show file tree
Hide file tree
Showing 39 changed files with 2,680 additions and 2,630 deletions.
7 changes: 6 additions & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ module.exports = {
'rules': {
'indent': [
'error',
2
2,
{ "SwitchCase": 1 }
],
'linebreak-style': [
'error',
Expand All @@ -34,6 +35,10 @@ module.exports = {
{
'code': 80,
}
],
'multiline-ternary': [
"error",
"always-multiline"
]
}
};
3 changes: 3 additions & 0 deletions .git-blame-ignore-revs
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,6 @@ d36f8b36a38873b775efd7edd30bbed4b3ceaa66

# Update code styling in recap.js
fafff6c2bc400d574cf7c3ca3401f067101439b4

# Update code styling in utils.js
851609d953d88363684323316bb0faa936641cc6
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@ coverage
/src/recap.zip
/recap-chrome.iml
/.idea/
.vscode/
.vscode/
build/
2 changes: 1 addition & 1 deletion .prettierrc.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"trailingComma": "es5",
"printWidth": 120,
"printWidth": 80,
"tabWidth": 2,
"semi": true,
"singleQuote": true
Expand Down
9 changes: 9 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,15 @@ Fixes:
For developers:
- Nothing yet

## 2.8.0 (2024-08-27)

Features:
- Upgrade to manifest v3([333](https://github.com/freelawproject/recap/issues/333), [387](https://github.com/freelawproject/recap-chrome/pull/387))

For developers:
- Adds script to automate release package creation ([388](https://github.com/freelawproject/recap-chrome/pull/388))


## 2.7.2 (2024-07-21)

Fixes:
Expand Down
15 changes: 9 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,6 @@ When a new version is needed, the release process is:

1. Do the [manual QA tests][qa]
1. Update `package.json` and `manifest.json` with a new release version.
1. Run `web-ext lint` to ensure no regressions.
1. Update CHANGES.md
1. Commit the code.
1. Tag the code with something like:
Expand All @@ -86,13 +85,16 @@ When a new version is needed, the release process is:
git push --tags -f

1. Make sure you don't have any working/testing code in your tree that could get zipped up in the next step.
1. Zip up the archive with the rather archaic:
1. Run the following commands in your terminal from the project root directory to create release packages for Chrome and Firefox in the `build` folder:

cd src && zip -FSr recap.zip *
npm run release-chrome
npm run release-firefox

1. Make a new release on [Github announcing the release][ghtags] that includes the .zip file.
1. Upload that to the [Chrome Market][market].
1. Upload that to addons.mozilla.org
The `build.sh` script relies on the [jq][jq] command-line JSON processor. Make sure you have it installed before proceeding.

1. Make a new release on [Github announcing the release][ghtags] that includes the .zip files in the release assets.
1. Upload the `chrome-release.zip` file to the [Chrome Web Store.][market].
1. Upload the `firefox-release.zip` file to addons.mozilla.org.


Copyright
Expand Down Expand Up @@ -131,3 +133,4 @@ RECAP for Chrome. If not, see: http://www.gnu.org/licenses/
[recap-issues]: https://github.com/freelawproject/recap/issues
[commits]: https://github.com/angular/angular.js/blob/master/DEVELOPERS.md#-git-commit-guidelines
[qa]: https://github.com/freelawproject/recap/wiki/QA-Testing
[jq]: https://jqlang.github.io/jq/
15 changes: 6 additions & 9 deletions karma.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,13 @@ module.exports = function(config) {
files: [
{ pattern: 'node_modules/whatwg-fetch/fetch.js', type: 'module' },
'src/assets/js/FileSaver.js',
'src/notifier.js',
'src/utils/fetch.js',
'src/utils/notifier.js',
'src/pacer.js',
'src/recap.js',
'src/toolbar_button.js',
'src/utils.js',
'src/action_button.js',
'src/pdf_upload.js',
'test/mock-utils.js',
'src/content_delegate.js',
'src/appellate/utils.js',
'src/appellate/appellate.js',
Expand All @@ -42,9 +41,7 @@ module.exports = function(config) {


// list of files / patterns to exclude
exclude: [
'spec/*ZipSpec.js',
],
exclude: [],


// preprocess matching files before serving them to the browser
Expand Down Expand Up @@ -79,7 +76,7 @@ module.exports = function(config) {
browsers: ['ChromeHeadless'],

// set these options to view logs in development
// see https://github.com/karma-runner/karma/issues/2582#issuecomment-413660796
// see https://github.com/karma-runner/karma/issues/2582#issuecomment-413660796
// browserConsoleLogOptions: {
// level: 'log',
// format: '%b %T: %m',
Expand All @@ -91,7 +88,7 @@ module.exports = function(config) {
client: {
captureConsole: true,
},

customLaunchers: {
CustomChromeHeadless: {
base: 'ChromeHeadless',
Expand All @@ -112,4 +109,4 @@ module.exports = function(config) {
// how many browser should be started simultaneous
concurrency: Infinity
})
};
};
6 changes: 4 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
{
"name": "recap-chrome",
"version": "2.7.2",
"version": "2.8.0",
"description": "RECAP improves the experience of using PACER, the online public acces system for the U.S. federal courts",
"main": " ",
"directories": {
"test": "test"
},
"scripts": {
"test": "./node_modules/.bin/karma start --single-run",
"postinstall": "vendor-copy"
"postinstall": "vendor-copy",
"release-chrome": "./scripts/build.sh chrome",
"release-firefox": "./scripts/build.sh firefox"
},
"repository": {
"type": "git",
Expand Down
57 changes: 57 additions & 0 deletions scripts/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
#!/bin/bash
# Create a browser extension release package
set -e

# Checks if jq is installed
if ! command -v jq >/dev/null 2>&1; then
echo "jq is not installed. Please install jq before continuing."
exit 1
fi

# 1. Capture browser type from argument
browserType=$1

# 2. Construct release zip filename
zipName=$browserType-release.zip

# 3. Rename base manifest file
cd src/ && mv manifest.json manifest.base.json
if [[ "$browserType" == "firefox" ]]; then
faviconUrl='assets/images/favicon.icon'
# Remove unnecessary properties for Firefox manifest
jq 'del(.background.service_worker)' manifest.base.json >manifest.json
else
faviconUrl='https://www.courtlistener.com/static/ico/favicon.ico'
# Remove unnecessary property for Chrome/Chromium manifest
jq 'del(.background.scripts, .browser_specific_settings)' manifest.base.json >manifest.json
fi

# 4. Add search provider configuration to manifest
jq --arg favicon "$faviconUrl" '.chrome_settings_overrides.search_provider += {
"name": "RECAP Archive",
"search_url": "https://www.courtlistener.com/?type=r&q={searchTerms}&order_by=score+desc",
"favicon_url": $favicon,
"keyword": "recap",
"encoding": "UTF-8",
"is_default": false
}' manifest.json >manifest.tmp && mv manifest.tmp manifest.json

# 5. Create release package
# - Include all files except the base manifest
zip -rq $zipName * -x "*.base.json"

# 6. Ensure release directory exists (create if needed)
mkdir -p ../build/release/

# 7. Clean up any existing release zip
file="../build/release/$browserType-release.zip"
if [ -f "$file" ] ; then
rm "$file"
fi

# 8. Move package to release directory
mv $zipName ../build/release

# 9. Remove Browser-Specific Manifest File
# Rename base manifest back to main manifest
mv manifest.base.json manifest.json
Loading

0 comments on commit 3ebcd1d

Please sign in to comment.