Skip to content

Commit be581e5

Browse files
committed
(change/feat): begin using TSDX for the dev environment
- adds a Dev CJS build, an ESM build, and some inferred typings - and has a similar Prod minified CJS build, which was the only build we had previously - no need for webpack production config anymore as TSDX handles that - add a tsconfig instead, in particular, ensure allowJs and esModuleInterop are true - switch .babelrc to .babelrc.js as TSDX is using Babel 7 everywhere - use TSDX's built-in babel config plus preset-react (deps): add TSDX and @babel/preset-react to support it - will begin removing deps in the next commit as other parts of the dev env are replaced by TSDX
1 parent 4aa04df commit be581e5

File tree

7 files changed

+14169
-6935
lines changed

7 files changed

+14169
-6935
lines changed

.babelrc

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

.babelrc.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
module.exports = {
2+
presets: [
3+
['@babel/preset-env'], // needed at least until https://github.com/jaredpalmer/tsdx/pull/473 is released
4+
['@babel/preset-react']
5+
]
6+
}

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
### custom ###
22

33
# build output
4-
build/
4+
dist/
55
# test coverage output
66
coverage/
77

package-lock.json

Lines changed: 14132 additions & 6903 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,12 @@
22
"name": "react-signature-canvas",
33
"version": "1.0.3",
44
"description": "A React wrapper component around signature_pad. Unopinionated and heavily updated fork of react-signature-pad",
5-
"main": "build/index.js",
5+
"main": "dist/index.js",
6+
"module": "dist/react-signature-canvas.esm.js",
7+
"typings": "dist/index.d.ts",
68
"files": [
79
"src/",
8-
"build/"
10+
"dist/"
911
],
1012
"author": "Anton Gilgur",
1113
"license": "Apache-2.0",
@@ -38,7 +40,7 @@
3840
"lint": "standard --parser babel-eslint",
3941
"lint:fix": "standard --parser babel-eslint --fix",
4042
"start": "webpack-dev-server -d --inline --hot",
41-
"dist": "webpack -p --config webpack.production.config.js",
43+
"dist": "tsdx build",
4244
"test": "jest",
4345
"test:pub": "npm run dist && npm pack",
4446
"pub": "npm run dist && npm publish",
@@ -55,6 +57,7 @@
5557
},
5658
"devDependencies": {
5759
"@agilgur5/changelog-maker": "^3.0.0",
60+
"@babel/preset-react": "^7.8.3",
5861
"babel-core": "^6.26.3",
5962
"babel-eslint": "^10.0.2",
6063
"babel-jest": "^23.6.0",
@@ -73,6 +76,7 @@
7376
"react-hot-loader": "^1.2.7",
7477
"standard": "^13.0.2",
7578
"style-loader": "^0.13.1",
79+
"tsdx": "^0.12.3",
7680
"webpack": "^1.12.2",
7781
"webpack-dev-server": "^1.10.1"
7882
}

tsconfig.json

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
{
2+
"include": ["src", "types"],
3+
"compilerOptions": {
4+
"module": "esnext",
5+
"lib": ["dom", "esnext"],
6+
"importHelpers": true,
7+
"declaration": true,
8+
"sourceMap": true,
9+
"rootDir": "./",
10+
"strict": true,
11+
"noUnusedLocals": true,
12+
"noUnusedParameters": true,
13+
"noImplicitReturns": true,
14+
"noFallthroughCasesInSwitch": true,
15+
"moduleResolution": "node",
16+
"baseUrl": "./",
17+
"paths": {
18+
"*": ["src/*", "node_modules/*"]
19+
},
20+
"esModuleInterop": true,
21+
"allowJs": true
22+
}
23+
}

webpack.production.config.js

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

0 commit comments

Comments
 (0)