Skip to content
This repository was archived by the owner on Sep 20, 2021. It is now read-only.

Commit f956975

Browse files
committed
Moved to a webpack build
1 parent dd0c438 commit f956975

File tree

4 files changed

+84
-38
lines changed

4 files changed

+84
-38
lines changed

package.json

+14-7
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,11 @@
22
"name": "@snowcoders/react-checkbox",
33
"version": "1.0.0",
44
"keywords": [
5+
"React",
56
"Unstyled",
67
"Base",
7-
"Checkbox"
8+
"Checkbox",
9+
"Accessibility"
810
],
911
"author": "Snowcoders",
1012
"license": "MIT",
@@ -13,9 +15,10 @@
1315
"main": "dist/component.js",
1416
"types": "dist/component.d.ts",
1517
"scripts": {
16-
"build": "npm run build-scss && npm run build-typescript",
18+
"build": "npm run build-scss && npm run build-webpack",
1719
"build-scss": "node-sass src/styles.scss dist/styles.css",
1820
"build-typescript": "tsc",
21+
"build-webpack": "webpack --mode production",
1922
"clean": "rimraf coverage dist",
2023
"prepare": "npm run clean && npm run build",
2124
"test": "npm run karma",
@@ -30,20 +33,18 @@
3033
"devDependencies": {
3134
"@snowcoders/react-unstyled-button": "1.2.2",
3235
"@snowcoders/sortier": "2.1.13",
33-
"classnames": "2.2.6",
34-
"tslib": "1.9.3",
3536
"@types/chai": "4.1.6",
3637
"@types/classnames": "2.2.6",
3738
"@types/enzyme": "3.1.14",
3839
"@types/mocha": "5.2.5",
3940
"@types/react": "16.4.18",
4041
"@types/sinon": "5.0.5",
4142
"chai": "4.2.0",
43+
"classnames": "2.2.6",
4244
"enzyme": "3.7.0",
4345
"enzyme-adapter-react-16": "1.6.0",
4446
"husky": "1.1.2",
4547
"jsdom": "12.2.0",
46-
"lint-staged": "7.3.0",
4748
"karma": "3.0.0",
4849
"karma-chai": "0.1.0",
4950
"karma-coverage": "1.1.2",
@@ -57,6 +58,7 @@
5758
"karma-typescript": "3.0.13",
5859
"karma-typescript-es6-transform": "1.0.4",
5960
"karma-typescript-preprocessor": "0.4.0",
61+
"lint-staged": "7.3.0",
6062
"mocha": "5.2.0",
6163
"mocha-typescript": "1.1.17",
6264
"node-sass": "4.9.4",
@@ -65,9 +67,14 @@
6567
"react-dom": "16.5.2",
6668
"rimraf": "2.6.2",
6769
"sinon": "7.0.0",
68-
"source-map-support": "0.5.9",
70+
"source-map-loader": "^0.2.4",
71+
"source-map-support": "^0.5.9",
72+
"ts-loader": "^5.2.2",
6973
"ts-node": "7.0.1",
7074
"tsconfig-paths": "3.6.0",
71-
"typescript": "3.1.3"
75+
"tslib": "1.9.3",
76+
"typescript": "3.1.3",
77+
"webpack": "^4.20.2",
78+
"webpack-command": "^0.4.1"
7279
}
7380
}

readme.md

+1
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ Renders a simple checkbox component with a button as the main visual element tha
2323

2424
- 1.0.0
2525
- Public release!
26+
- Moved to a webpack build
2627
- 0.2.0
2728
- Moved all dependencies to peer-dependencies
2829
- 0.1.1

tsconfig.json

+21-31
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,22 @@
11
{
2-
"compilerOptions": {
3-
"declaration": true,
4-
"experimentalDecorators": true,
5-
"forceConsistentCasingInFileNames": true,
6-
"importHelpers": true,
7-
"jsx": "react",
8-
"lib": [
9-
"es6",
10-
"dom"
11-
],
12-
"module": "commonjs",
13-
"moduleResolution": "node",
14-
"noImplicitAny": false,
15-
"noImplicitReturns": true,
16-
"noImplicitThis": true,
17-
"noUnusedLocals": false,
18-
"outDir": "./dist/",
19-
"preserveConstEnums": true,
20-
"sourceMap": true,
21-
"strictNullChecks": true,
22-
"target": "es5"
23-
},
24-
"include": [
25-
"./src/**/*.ts",
26-
"./src/**/*.tsx"
27-
],
28-
"exclude": [
29-
"./src/**/*.test.ts",
30-
"./src/**/*.test.tsx"
31-
]
32-
}
2+
"compilerOptions": {
3+
"declaration": true,
4+
"experimentalDecorators": true,
5+
"forceConsistentCasingInFileNames": true,
6+
"importHelpers": true,
7+
"jsx": "react",
8+
"module": "es6",
9+
"moduleResolution": "node",
10+
"noImplicitAny": true,
11+
"noImplicitReturns": true,
12+
"noImplicitThis": true,
13+
"noUnusedLocals": false,
14+
"outDir": "./dist/",
15+
"preserveConstEnums": true,
16+
"sourceMap": true,
17+
"strictNullChecks": true,
18+
"target": "es5"
19+
},
20+
"include": ["./src/**/*.ts", "./src/**/*.tsx"],
21+
"exclude": ["./src/**/*.test.ts", "./src/**/*.test.tsx"]
22+
}

webpack.config.js

+48
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
// import * as webpack from "webpack";
2+
let webpack = require("webpack");
3+
const path = require("path");
4+
5+
const config /*: webpack.Configuration*/ = {
6+
entry: {
7+
main: "./src/component.tsx"
8+
},
9+
output: {
10+
chunkFilename: "component.js",
11+
filename: "component.js",
12+
library: "@snowcoders/react-checkbox",
13+
libraryTarget: "umd"
14+
},
15+
16+
module: {
17+
rules: [
18+
{
19+
exclude: /node_modules/,
20+
test: /\.tsx?$/,
21+
use: "ts-loader"
22+
}
23+
]
24+
},
25+
26+
resolve: {
27+
// Add '.ts' and '.tsx' as resolvable extensions.
28+
extensions: [".ts", ".tsx", ".js", ".json"]
29+
},
30+
31+
// Here is a list of our peer-dependencies that we will not include but need to have access to
32+
// Specifically because we use umd, we have to specify more information
33+
// https://stackoverflow.com/questions/34252424/webpack-umd-lib-and-external-files
34+
externals: {
35+
"@snowcoders/react-unstyled-button": "@snowcoders/react-unstyled-button",
36+
classnames: "classnames",
37+
react: {
38+
amd: "react",
39+
commonjs: "react",
40+
commonjs2: "react",
41+
root: "React"
42+
},
43+
tslib: "tslib"
44+
}
45+
};
46+
47+
// export default config;
48+
module.exports = config;

0 commit comments

Comments
 (0)