Skip to content

Commit e3519ed

Browse files
committed
Add browser specific manifests
1 parent 24159d5 commit e3519ed

File tree

9 files changed

+99
-48
lines changed

9 files changed

+99
-48
lines changed

.github/workflows/build.yml

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Build with NodeJS and Webpack
1+
name: Build extension
22

33
on:
44
push:
@@ -10,22 +10,28 @@ jobs:
1010
build:
1111
runs-on: ubuntu-latest
1212

13+
strategy:
14+
matrix:
15+
browser: ['chrome', 'firefox']
16+
1317
steps:
1418
- uses: actions/checkout@v3
1519

16-
- name: Use Node.js
20+
- name: Setup Node.js LTS
1721
uses: actions/setup-node@v3
1822
with:
1923
node-version: lts/*
2024

2125
- name: Build
2226
run: |
2327
npm install
24-
npm run build
28+
npm run build:${{matrix.browser}}
2529
2630
- name: Archive artifacts
2731
uses: actions/upload-artifact@v3
2832
with:
2933
name: jira-automation-extension
3034
path: |
31-
dist/**/*.*
35+
dist/
36+
!dist/**/*.zip
37+
if-no-files-found: error

README.md

Lines changed: 25 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,36 @@
11
# Introduction
22

3-
`JIRA Automation` is a browser extension to automate typical actions in JIRA.
3+
`JIRA Automation` is a browser extension to add extra features to JIRA.
44

5-
## Features
5+
# Features
66

77
- TBD
88

9-
## Development
9+
# Install
1010

11-
### How to build and test
11+
Add an extension to your favorite browser by visiting extensions store
1212

13-
- Install latest LTS versions of [Node.js](https://nodejs.org/en) and npm
14-
- Execute `npm install` to restore project dependencies
15-
- Run `npm run start` to compile and bundle source code
16-
- Load unpacked extension from `dist` folder into your browser
13+
TBD
14+
15+
# Build and test locally
16+
17+
- Install [Node.js](https://nodejs.org/) (LTS version)
18+
- Run following commands from project's root directory to build extension
19+
20+
```bash
21+
$ npm install # Restore project dependencies
22+
$ npm run build:chrome # Build extension for Chrome
23+
$ npm run build:firefox # Build extension for Firefox
24+
```
25+
26+
- Run following commands to debug extension
27+
28+
```bash
29+
$ npm run watch:chrome
30+
$ npm run watch:firefox
31+
```
32+
33+
- Follow these articles to load unpacked extension from `dist` folder into your browser
1734
- [Firefox](https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/Your_first_WebExtension#installing)
1835
- [Chrome](https://developer.chrome.com/docs/extensions/mv3/getstarted/development-basics/#load-unpacked)
1936

package.json

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,15 @@
11
{
22
"name": "jira-automation-extension",
33
"version": "1.0.0",
4-
"description": "Browser extension to automate typical actions in JIRA",
4+
"description": "Add extra features to JIRA.",
55
"private": true,
66
"scripts": {
7-
"start": "webpack --watch --config webpack.dev.js",
7+
"build:chrome": "npm run build -- --env BROWSER=chrome",
8+
"build:firefox": "npm run build -- --env BROWSER=firefox",
89
"build": "webpack --config webpack.prod.js",
10+
"watch:chrome": "npm run watch -- --env BROWSER=chrome",
11+
"watch:firefox": "npm run watch -- --env BROWSER=firefox",
12+
"watch": "webpack --watch --config webpack.dev.js",
913
"test": "echo \"Error: no test specified\" && exit 1"
1014
},
1115
"repository": {
@@ -20,6 +24,7 @@
2024
"homepage": "https://github.com/kungfux/jira-automation-extension#readme",
2125
"devDependencies": {
2226
"copy-webpack-plugin": "^11.0.0",
27+
"merge-jsons-webpack-plugin": "^2.0.1",
2328
"ts-loader": "^9.4.2",
2429
"typescript": "^5.0.4",
2530
"webpack": "^5.78.0",

src/manifest.chrome.json

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

src/manifest.firefox.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"browser_specific_settings": {
3+
"gecko": {
4+
"id": "{eb6d1100-3fa7-4869-8370-11bc3e058fe1}",
5+
"strict_min_version": "109.0"
6+
}
7+
}
8+
}

src/manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"manifest_version": 3,
3-
"name": "jira-automation-extension",
3+
"name": "JIRA Automation",
44
"version": "1.0",
55
"description": "Browser extension to automate typical actions in JIRA.",
66
"icons": {

webpack.common.js

Lines changed: 36 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,40 @@
11
const path = require('path');
2-
const CopyPlugin = require("copy-webpack-plugin");
2+
const CopyPlugin = require('copy-webpack-plugin');
3+
const MergeJsonWebpackPlugin = require('merge-jsons-webpack-plugin');
34

4-
module.exports = {
5-
entry: './src/index.ts',
6-
output: {
7-
filename: 'bundle.js',
8-
path: path.resolve(__dirname, 'dist'),
9-
},
10-
module: {
11-
rules: [
12-
{
13-
test: /\.tsx?$/,
14-
use: 'ts-loader',
15-
exclude: /node_modules/,
16-
},
17-
],
18-
},
19-
resolve: {
20-
extensions: ['.tsx', '.ts', '.js'],
21-
},
22-
plugins: [
23-
new CopyPlugin({
24-
patterns: [
25-
'./src/manifest.json',
26-
{ from: './src/icons', to: 'icons' }
5+
module.exports = (env) => {
6+
return {
7+
entry: './src/index.ts',
8+
output: {
9+
filename: 'bundle.js',
10+
path: path.resolve(__dirname, `dist/${env.BROWSER ?? 'chrome'}`),
11+
clean: true
12+
},
13+
module: {
14+
rules: [
15+
{
16+
test: /\.tsx?$/,
17+
use: 'ts-loader',
18+
exclude: /node_modules/,
19+
},
2720
],
28-
}),
29-
],
21+
},
22+
resolve: {
23+
extensions: ['.tsx', '.ts', '.js'],
24+
},
25+
plugins: [
26+
new CopyPlugin({
27+
patterns: [
28+
{ from: './src/icons', to: 'icons' }
29+
],
30+
}),
31+
new MergeJsonWebpackPlugin({
32+
space: 2,
33+
files: ['./src/manifest.json', `./src/manifest.${env.BROWSER ?? 'chrome'}.json`],
34+
output: {
35+
fileName: 'manifest.json',
36+
},
37+
}),
38+
],
39+
}
3040
};

webpack.dev.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
const { merge } = require('webpack-merge');
22
const common = require('./webpack.common.js');
33

4-
module.exports = merge(common, {
5-
mode: 'development',
6-
devtool: 'inline-source-map',
7-
});
4+
module.exports = (env) => {
5+
return merge(common(env), {
6+
mode: 'development',
7+
devtool: 'inline-source-map',
8+
});
9+
}

webpack.prod.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
const { merge } = require('webpack-merge');
22
const common = require('./webpack.common.js');
33

4-
module.exports = merge(common, {
5-
mode: 'production',
6-
});
4+
module.exports = (env) => {
5+
return merge(common(env), {
6+
mode: 'production',
7+
});
8+
}

0 commit comments

Comments
 (0)