Skip to content

Commit

Permalink
Enable hot-reloading in development
Browse files Browse the repository at this point in the history
  • Loading branch information
phacks committed Apr 26, 2023
1 parent e624385 commit bc6d363
Show file tree
Hide file tree
Showing 15 changed files with 65 additions and 13 deletions.
11 changes: 7 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ On Google Chrome:
1. Open [`chrome://extensions`](chrome://extensions);
2. Toggle the “developer mode” (_wink wink_) in the top-right corner;
3. Click on “Load unpacked”;
4. Select the `orbit-browser-extension/extension` folder;
4. Select the `orbit-browser-extension/dist` folder;
5. An Orbit logo should appear in the top-right corner of Chrome indicating that the extension is active;
6. Right-click on this logo, then click on Options;
7. Fill in the form with your API key and workspace name (the extension uses the prod API by default), and save;
Expand All @@ -52,14 +52,17 @@ To reload the extension after some changes, open [`chrome://extensions`](chrome:

To use the local API instead of the prod one, change `ORBIT_API_ROOT_URL` in `orbit-helper.js` to your ngrok tunnel address.


## Deployment

To deploy a new version of the browser extension:

- Update the `manifest.json` version number;
- Create a new Release in GitHub:
- Create a new commit on `main` titled `Prepare release X.Y.Z` with version bumps in `package.json`, `src/manifest.json`, and a CHANGELOG entry;
- Tag that commit with the new version: `git tag -a X.Y.Z -m 'vX.Y.Z'`
- Push the commit and the tags: `git push && git push --tags`
- [Create a new release in GitHub](https://github.com/orbit-love/orbit-browser-extension/releases/new)
- Run `yarn build`;
- Zip the `extension` folder;
- Zip the `dist` folder;
- On the [Google Webstore Developer Dashboard](https://chrome.google.com/webstore/developer/dashboard) (requires authentication), upload the zip file and submit a new version.

## About Orbit
Expand Down
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
"license": "MIT",
"private": true,
"scripts": {
"start": "mkdir -p extension && cp manifest.json extension/ && parcel src/github/background.js icons/* src/constants.js src/**/*.html src/**/*.css --dist-dir extension",
"build": "mkdir -p extension && cp manifest.json extension/ && parcel build src/github/background.js icons/* src/constants.js src/**/*.html src/**/*.css --dist-dir extension",
"start": "parcel watch src/manifest.json --host localhost --config @parcel/config-webextension",
"build": "parcel build src/manifest.json --config @parcel/config-webextension",
"test": "jest",
"test:watch": "jest --watch"
},
Expand All @@ -17,6 +17,7 @@
"@babel/plugin-proposal-optional-chaining": "^7.10.0",
"@babel/plugin-transform-modules-commonjs": "^7.9.6",
"@babel/plugin-transform-runtime": "^7.10.0",
"@parcel/config-webextension": "^2.8.3",
"@tailwindcss/forms": "^0.5.3",
"@testing-library/dom": "^9.2.0",
"jest": "^29.5.0",
Expand Down
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
11 changes: 7 additions & 4 deletions manifest.json → src/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
"https://github.com/*/*/issues*",
"https://github.com/*/*/discussions*"
],
"css": ["src/github/orbit-action.css"],
"js": ["src/github/background.js"]
"css": ["github/orbit-action.css"],
"js": ["github/background.js"]
}
],
"browser_action": {
Expand All @@ -32,7 +32,10 @@
"128": "icons/icon128.png"
},
"web_accessible_resources": ["icons/*.png"],
"options_page": "src/options/options.html",
"content_security_policy": "script-src 'self' https://cdn.jsdelivr.net 'unsafe-eval'; object-src 'self'",
"options_ui": {
"page": "options/options.html",
"open_in_tab": true
},
"content_security_policy": "script-src 'self' 'unsafe-eval'; object-src 'self'",
"key": "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAjhINKsJLOLT7AkGSNZrD/3TG96SLKOFgik5v7k/Mu4Erkmvead50nzdQkUZaJYx1EUVzlKFebFkCqvFw6RfrPkzUmiaOJVBQOo2BIvlrIIHpXsUctRp7nfeOrhO3OKCQugUrHivBYWcgqabJCXJjvhAKY9LKBjyZMyzoaipNoNGk15O2NGRAm2uDQntnJupf4m7lH1ot2NHtb/4rU02FRVWpb8AxC6FFSJ7JzDob6Y8CmmD9oIFt2DrN2i4b0v5KH0XbveKLiNICQs1KNZYYsn2kckwjV2HOP9x0tRrQK6RIwRGOWTYi6jgPv0S3pQkqTa6Vd0OWWvRozlDdZhU2WwIDAQAB"
}
6 changes: 3 additions & 3 deletions src/options/options.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@
<div class="flex-1 mx-auto w-full" style="width: 980px;">
<header class="flex items-center pb-3 pt-5 mt-2 mb-6">
<div class="mr-5">
<img alt="" src="../../icons/orbit-logo-color-1x.png" srcset="
../../icons/orbit-logo-color-2x.png 2x,
../../icons/orbit-logo-color-3x.png 3x
<img alt="" src="../icons/orbit-logo-color-1x.png" srcset="
../icons/orbit-logo-color-2x.png 2x,
../icons/orbit-logo-color-3x.png 3x
" style="height: 30px; max-width: inherit;" />
</div>
<div class="mx-auto"></div>
Expand Down
45 changes: 45 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -805,6 +805,17 @@
"@parcel/transformer-react-refresh-wrap" "2.8.3"
"@parcel/transformer-svg" "2.8.3"

"@parcel/config-webextension@^2.8.3":
version "2.8.3"
resolved "https://registry.yarnpkg.com/@parcel/config-webextension/-/config-webextension-2.8.3.tgz#24d1e0c391ef675dbd4aecf6199b826b6d034eb5"
integrity sha512-TWbnfMzVvJvSqLD0+5oA4lPa3yzDLtkXzZcoPp91HkvAH6G7iySOFUq0uAEecpzxQBpOf+90emQNgSvyBOkHgA==
dependencies:
"@parcel/config-default" "2.8.3"
"@parcel/packager-webextension" "2.8.3"
"@parcel/runtime-webextension" "2.8.3"
"@parcel/transformer-raw" "2.8.3"
"@parcel/transformer-webextension" "2.8.3"

"@parcel/core@2.8.3":
version "2.8.3"
resolved "https://registry.yarnpkg.com/@parcel/core/-/core-2.8.3.tgz#22a69f36095d53736ab10bf42697d9aa5f4e382b"
Expand Down Expand Up @@ -1036,6 +1047,15 @@
"@parcel/utils" "2.8.3"
posthtml "^0.16.4"

"@parcel/packager-webextension@2.8.3":
version "2.8.3"
resolved "https://registry.yarnpkg.com/@parcel/packager-webextension/-/packager-webextension-2.8.3.tgz#2cb618aa36d040688c1ce07f5e91d491b3772cc7"
integrity sha512-kcA0VOmuroM2XsVOtk+jWFkJxKYjVEsyJoEazg2sahpNx4dWmXXMGnRyQF0og9PqKow5UQIw7jl1PcvMVO9rCA==
dependencies:
"@parcel/plugin" "2.8.3"
"@parcel/utils" "2.8.3"
nullthrows "^1.1.1"

"@parcel/plugin@2.8.3":
version "2.8.3"
resolved "https://registry.yarnpkg.com/@parcel/plugin/-/plugin-2.8.3.tgz#7bb30a5775eaa6473c27f002a0a3ee7308d6d669"
Expand Down Expand Up @@ -1106,6 +1126,15 @@
"@parcel/utils" "2.8.3"
nullthrows "^1.1.1"

"@parcel/runtime-webextension@2.8.3":
version "2.8.3"
resolved "https://registry.yarnpkg.com/@parcel/runtime-webextension/-/runtime-webextension-2.8.3.tgz#774d9bd39fa7fdbc8275cac4efbda44a95f1ab2a"
integrity sha512-ZSSwcL5HtHmrqxJKkIrw7nnhCN5uOo6Qh6KIZevqL0+FCMiKS5qZG0bNTzwSHxwzQbeK7cgRerRWAdAJnvoSpA==
dependencies:
"@parcel/plugin" "2.8.3"
"@parcel/utils" "2.8.3"
nullthrows "^1.1.1"

"@parcel/source-map@^2.1.1":
version "2.1.1"
resolved "https://registry.yarnpkg.com/@parcel/source-map/-/source-map-2.1.1.tgz#fb193b82dba6dd62cc7a76b326f57bb35000a782"
Expand Down Expand Up @@ -1247,6 +1276,17 @@
posthtml-render "^3.0.0"
semver "^5.7.1"

"@parcel/transformer-webextension@2.8.3":
version "2.8.3"
resolved "https://registry.yarnpkg.com/@parcel/transformer-webextension/-/transformer-webextension-2.8.3.tgz#ae035539013ff67d98bc04d39f1cd8071aad35c5"
integrity sha512-YTNGE53G1cQwz5oNJxAxTM1nLzR/f1OSOhYC4AZJkxTwLGmcpS7T3KE0rmUMWfTZGbP2v0t7U7FjSDtU45j2nw==
dependencies:
"@mischnic/json-sourcemap" "^0.1.0"
"@parcel/diagnostic" "2.8.3"
"@parcel/plugin" "2.8.3"
"@parcel/utils" "2.8.3"
content-security-policy-parser "^0.3.0"

"@parcel/types@2.8.3":
version "2.8.3"
resolved "https://registry.yarnpkg.com/@parcel/types/-/types-2.8.3.tgz#3306bc5391b6913bd619914894b8cd84a24b30fa"
Expand Down Expand Up @@ -1935,6 +1975,11 @@ concat-map@0.0.1:
resolved "https://registry.yarnpkg.com/concat-map/-/concat-map-0.0.1.tgz#d8a96bd77fd68df7793a73036a3ba0d5405d477b"
integrity sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==

content-security-policy-parser@^0.3.0:
version "0.3.0"
resolved "https://registry.yarnpkg.com/content-security-policy-parser/-/content-security-policy-parser-0.3.0.tgz#a14d4ed54c8d098621ba46cabcd20a78be0c691e"
integrity sha512-ub90B4t9EfDPv3DCH7vEwGe4tVMkSm4Ow1HsmvmEQwinDfpTEDmkuJVa5WpzHDTt2bUirNRZuzL6S0msASlJhg==

convert-source-map@^1.6.0:
version "1.7.0"
resolved "https://registry.yarnpkg.com/convert-source-map/-/convert-source-map-1.7.0.tgz#17a2cb882d7f77d3490585e2ce6c524424a3a442"
Expand Down

0 comments on commit bc6d363

Please sign in to comment.