Skip to content

Commit 6bde954

Browse files
committed
Add typescript
1 parent 404ee45 commit 6bde954

File tree

7 files changed

+56
-5
lines changed

7 files changed

+56
-5
lines changed

README.md

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,14 @@
1010

1111
### How to build and test
1212

13-
- TBD
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
17+
- [Firefox](https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/Your_first_WebExtension#installing)
18+
- [Chrome](https://developer.chrome.com/docs/extensions/mv3/getstarted/development-basics/#load-unpacked)
19+
20+
# License information
21+
22+
- Check out [LICENSE](LICENSE) for the license details
23+
- Icons by [Flatart](https://www.freepik.com/author/flatart)

package.json

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44
"description": "Browser extension to automate typical actions in JIRA",
55
"private": true,
66
"scripts": {
7-
"build": "webpack",
7+
"start": "webpack --watch --config webpack.dev.js",
8+
"build": "webpack --config webpack.prod.js",
89
"test": "echo \"Error: no test specified\" && exit 1"
910
},
1011
"repository": {
@@ -19,7 +20,10 @@
1920
"homepage": "https://github.com/kungfux/jira-automation-extension#readme",
2021
"devDependencies": {
2122
"copy-webpack-plugin": "^11.0.0",
23+
"ts-loader": "^9.4.2",
24+
"typescript": "^5.0.4",
2225
"webpack": "^5.78.0",
23-
"webpack-cli": "^5.0.1"
26+
"webpack-cli": "^5.0.1",
27+
"webpack-merge": "^5.8.0"
2428
}
2529
}
File renamed without changes.

tsconfig.json

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"compilerOptions": {
3+
"outDir": "./dist/",
4+
"sourceMap": true,
5+
"noImplicitAny": true,
6+
"module": "es6",
7+
"target": "es5",
8+
"jsx": "react",
9+
"allowJs": true,
10+
"moduleResolution": "node"
11+
}
12+
}

webpack.config.js renamed to webpack.common.js

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,23 @@ const path = require('path');
22
const CopyPlugin = require("copy-webpack-plugin");
33

44
module.exports = {
5-
entry: './src/index.js',
5+
entry: './src/index.ts',
66
output: {
77
filename: 'bundle.js',
88
path: path.resolve(__dirname, 'dist'),
99
},
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+
},
1022
plugins: [
1123
new CopyPlugin({
1224
patterns: [
@@ -15,4 +27,4 @@ module.exports = {
1527
],
1628
}),
1729
],
18-
};
30+
};

webpack.dev.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
const { merge } = require('webpack-merge');
2+
const common = require('./webpack.common.js');
3+
4+
module.exports = merge(common, {
5+
mode: 'development',
6+
devtool: 'inline-source-map',
7+
});

webpack.prod.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
const { merge } = require('webpack-merge');
2+
const common = require('./webpack.common.js');
3+
4+
module.exports = merge(common, {
5+
mode: 'production',
6+
});

0 commit comments

Comments
 (0)