Skip to content

Commit bf7a463

Browse files
authored
Merge pull request #215 from bhollis/manifest-v3
Manifest v3
2 parents 71b6ffc + c208220 commit bf7a463

22 files changed

+3166
-2569
lines changed

.eslintrc

Lines changed: 0 additions & 186 deletions
This file was deleted.

.github/workflows/pr-build.yml

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,17 +10,19 @@ jobs:
1010
steps:
1111
- uses: actions/checkout@v3
1212

13+
- uses: pnpm/action-setup@v4
14+
1315
- name: Setup Node
1416
uses: actions/setup-node@v3
1517
with:
16-
node-version: 20.x
17-
cache: yarn
18+
node-version-file: ".nvmrc"
19+
cache: pnpm
1820

1921
- name: Install
20-
run: yarn install --frozen-lockfile --prefer-offline
22+
run: pnpm install --frozen-lockfile --prefer-offline
2123

2224
- name: Lint
23-
run: yarn lint
25+
run: pnpm lint
2426

2527
- name: Build
26-
run: yarn start
28+
run: pnpm start

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,6 @@
33
.tern-port
44
/ts-out
55
/build
6+
/build-*
67
/node_modules
78

.nvmrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
20

.vscode/extensions.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
// for the documentation about the extensions.json format
44
"recommendations": [
55
// Extension identifier format: ${publisher}.${name}. Example: vscode.csharp
6-
"gamunu.vscode-yarn",
6+
"Jacano.vscode-pnpm",
77
"esbenp.prettier-vscode",
88
"dbaeumer.vscode-eslint"
99
]

.vscode/settings.json

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,20 +4,19 @@
44
"files.trimTrailingWhitespace": true,
55
"typescript.tsdk": "node_modules/typescript/lib",
66
"editor.formatOnSave": true,
7-
"eslint.packageManager": "yarn",
87
"eslint.validate": ["javascript", "typescript"],
98
"editor.codeActionsOnSave": {
109
"source.fixAll": "explicit"
1110
},
12-
"jest.jestCommandLine": "yarn test",
11+
"jest.jestCommandLine": "pnpm test --",
1312
"[javascript]": {
1413
"editor.codeActionsOnSave": {
15-
"source.organizeImports": false
14+
"source.organizeImports": "never"
1615
}
1716
},
1817
"[typescript]": {
1918
"editor.codeActionsOnSave": {
20-
"source.organizeImports": false
19+
"source.organizeImports": "never"
2120
}
2221
},
2322
"[javascript][typescript]": {

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
## JSONView 3.0.0
2+
3+
- JSONView is now compatible with Manifest V3, which is required in Chrome.
4+
- The JSON object is _no longer available_ from the console via the global "data" property in Chrome, due to Manifest V3 changes.
5+
- Fixed JSONView in Edge, where it was conflicting with Edge's new built-in JSON viewer. If you like Edge's default viewer you can uninstall JSONView.
6+
- Fixed detection of "bare" object keys to more reliably follow what a JavaScript object literal would allow.
7+
18
## JSONView 2.6.1
29

310
- Restore JSONView's ability to work in Firefox without having to manually disable the built-in JSON viewer.

README.md

Lines changed: 22 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,56 +1,51 @@
1-
JSONView
2-
========
1+
# JSONView
32

43
[JSONView](http://jsonview.com) is a Web extension compatible with Firefox and Google Chrome that helps you view JSON documents in the browser.
54

6-
* [Install for Firefox](https://addons.mozilla.org/en-US/firefox/addon/jsonview/)
7-
* [Install for Chrome](https://chrome.google.com/webstore/detail/jsonview/gmegofmjomhknnokphhckolhcffdaihd)
8-
* [Install for Edge](https://microsoftedge.microsoft.com/addons/detail/jsonview/kmpfgkgaimakokfhgdahhiaaiidiphco)
5+
- [Install for Firefox](https://addons.mozilla.org/en-US/firefox/addon/jsonview/)
6+
- [Install for Chrome](https://chrome.google.com/webstore/detail/jsonview/gmegofmjomhknnokphhckolhcffdaihd)
7+
- [Install for Edge](https://microsoftedge.microsoft.com/addons/detail/jsonview/kmpfgkgaimakokfhgdahhiaaiidiphco)
98

109
Normally, when encountering a [JSON](http://json.org) document (content type `application/json`), Firefox simply prompts you to download the view. With the JSONView extension, JSON documents are shown in the browser similar to how XML documents are shown. The document is formatted, highlighted, and arrays and objects can be collapsed. Even if the JSON document contains errors, JSONView will still show the raw text.
1110

1211
Once you've got JSONView installed, check out [this example JSON file](http://jsonview.com/example.json) to see the extension in action!
1312

1413
If you'd like to contribute to JSONView but don't want to code, consider contributing a translation. Copy the existing localization files from `src/_locale` and fill them in for your own language, then send a pull request. You can do it all from the GitHub interface. There are not many strings to translate!
1514

16-
Keyboard Shortcuts
17-
----------------
15+
## Keyboard Shortcuts
1816

19-
* Left Arrow - Collapses the json on key up
20-
* Right Arrow - Expands the json on key up
17+
- Left Arrow - Collapses the json on key up
18+
- Right Arrow - Expands the json on key up
2119

22-
Reporting Issues
23-
----------------
20+
## Reporting Issues
2421

2522
Use the GitHub [Issue tracker for JSONView](https://github.com/bhollis/jsonview/issues) to file issues. Pull requests are especially welcome.
2623

27-
Developing JSONView
28-
-------------------
24+
## Developing JSONView
2925

3026
Before contributing to JSONView, make sure to read the [Contributing Guidelines](CONTRIBUTING.md). I appreciate contributions people make to JSONView, but the goal of the extension is to be simple and straightforward, so I frequently reject contributions that add complexity or unnecessary features. Please consider filing an issue before doing any work, so you don't waste time on something I won't accept.
3127

32-
* Install [NodeJS](https://nodejs.org/en/) and [Yarn](https://yarnpkg.com/en/docs/install).
33-
* Check out jsonview.
34-
* Run `yarn` inside the jsonview repository.
35-
* Run `yarn start` to build the extension.
36-
* In Firefox, go to `about:debugging#addons` in the address bar, check "Enable add-on debugging", select "Load Temporary Add-on", and choose the `jsonview/build` folder.
37-
* In Chrome, go to `chrome://extensions/` in the address bar, select "Load Unpacked", and choose the `jsonview/build` folder.
28+
- Install [NodeJS](https://nodejs.org/en/) and run `corepack enable`.
29+
- Check out jsonview.
30+
- Run `pnpm i` inside the jsonview repository.
31+
- Run `pnpm start` to build the extension.
32+
- In Firefox, go to `about:debugging#addons` in the address bar, check "Enable add-on debugging", select "Load Temporary Add-on", and choose the `jsonview/build-firefox/manifest.json` file.
33+
- In Chrome, Edge, etc., go to `edge://extensions/`, in the address bar, enable "Developer mode", select "Load Unpacked", and choose the `jsonview/build-chrome` folder.
3834

3935
JSONView makes use of [TypeScript](https://www.typescriptlang.org/). I recommend [VSCode](https://code.visualstudio.com/) for editing the code - it will automatically prompt to install the correct extensions, and will highlight errors. All of the code that makes up the extension itself are in `src/`.
4036

41-
Common Issues
42-
-------------
43-
* **JSONView isn't displaying my file as JSON**: You are probably not serving
37+
## Common Issues
38+
39+
- **JSONView isn't displaying my file as JSON**: You are probably not serving
4440
the JSON with the "application/json" MIME type.
45-
* **Opening a local .json file uses the Firefox default JSON viewer**: You need to disable the built-in JSON viewer to use JSONView. Go to "about:config" and set "devtools.jsonview.enabled" to "false".
41+
- **Opening a local .json file uses the Firefox default JSON viewer**: You need to disable the built-in JSON viewer to use JSONView. Go to "about:config" and set "devtools.jsonview.enabled" to "false".
4642

4743
JSONView is open source software under the MIT license.
4844

49-
Publishing
50-
----------
45+
## Publishing
5146

5247
```
53-
npm start
48+
pnpm start
5449
```
5550

56-
`jsonview.zip` can then be manually uploaded to the extension sites.
51+
`jsonview-chrome.zip` and `jsonview-firefox.zip` can then be manually uploaded to the extension sites.

build.sh

Lines changed: 33 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -6,19 +6,37 @@ tsc
66

77
node --test
88

9-
rm -rf build
10-
mkdir -p build
11-
12-
rollup ts-out/background.js --format iife --name 'background' --file build/background.js
13-
rollup ts-out/content.js --format iife --name 'background' --file build/content.js
14-
rollup ts-out/viewer.js --format iife --name 'background' --file build/viewer.js
15-
cp src/viewer.css build/viewer.css
16-
cp src/manifest.json build/manifest.json
17-
cp license.txt build/license.txt
18-
cp -r src/_locales build
19-
cp src/icon*.png build
20-
21-
rm -f jsonview.zip
22-
pushd build
23-
zip -r ../jsonview.zip *
9+
# Chrome
10+
rm -rf build-chrome
11+
mkdir -p build-chrome
12+
13+
rollup ts-out/background-chrome.js --format es --name 'background' --file build-chrome/background.js
14+
rollup ts-out/content.js --format es --name 'content' --file build-chrome/content.js
15+
cp src/viewer.css build-chrome/viewer.css
16+
cp src/manifest.chrome.json build-chrome/manifest.json
17+
cp license.txt build-chrome/license.txt
18+
cp -r src/_locales build-chrome
19+
cp src/icon*.png build-chrome
20+
21+
rm -f jsonview-chrome.zip
22+
pushd build-chrome
23+
zip -r -q ../jsonview-chrome.zip *
2424
popd
25+
26+
27+
# Firefox
28+
rm -rf build-firefox
29+
mkdir -p build-firefox
30+
31+
rollup ts-out/background-firefox.js --format es --name 'background' --file build-firefox/background.js
32+
rollup ts-out/content.js --format es --name 'content' --file build-firefox/content.js
33+
cp src/viewer.css build-firefox/viewer.css
34+
cp src/manifest.firefox.json build-firefox/manifest.json
35+
cp license.txt build-firefox/license.txt
36+
cp -r src/_locales build-firefox
37+
cp src/icon*.png build-firefox
38+
39+
rm -f jsonview-firefox.zip
40+
pushd build-firefox
41+
zip -r -q ../jsonview-firefox.zip *
42+
popd

0 commit comments

Comments
 (0)