Skip to content

Commit

Permalink
(refactor/deps): use parcel instead of webpack for example
Browse files Browse the repository at this point in the history
- finally nix webpack@1 and babel@6 from the codebase
  - remove babel@6 presets, add @babel/core@7
  - remove webpack loaders, parcel has built-in support for most
    - needed to add postcss-modules and a postcss.config.js to support
      the example's use of CSS modules
  - also fix a bunch of security warnings in the process

- restructure example file hierarchy to be closer to CRA's for better
  standardization
  • Loading branch information
agilgur5 committed Apr 20, 2022
1 parent 53f047d commit 962b902
Show file tree
Hide file tree
Showing 8 changed files with 8,382 additions and 6,814 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
### custom ###

# parcel cache
.cache/
# build output
dist/
# test coverage output
Expand Down
4 changes: 2 additions & 2 deletions example/index.html → example/public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@
</head>
<body>
<div id='container'></div>
<script src='build/bundle.js'></script>
<script src='../src/index.js'></script>
</body>
</html>
</html>
4 changes: 2 additions & 2 deletions example/app.js → example/src/index.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import React, { Component } from 'react'
import ReactDOM from 'react-dom'

import SignaturePad from '../src/index.js'
import SignaturePad from '../../src/index.js'

import styles from './styles.cssm'
import styles from './styles.module.css'

class App extends Component {
state = { trimmedDataURL: null }
Expand Down
File renamed without changes.
15,133 changes: 8,369 additions & 6,764 deletions package-lock.json

Large diffs are not rendered by default.

14 changes: 4 additions & 10 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@
"react-signature-pad"
],
"scripts": {
"start": "parcel example/public/index.html",
"lint": "tsdx lint '**/*.js'",
"lint:fix": "tsdx lint '**/*.js' --fix",
"start": "webpack-dev-server -d --inline --hot",
"build": "tsdx build",
"test": "tsdx test",
"test:pub": "npm run build && npm pack",
Expand All @@ -60,16 +60,11 @@
},
"devDependencies": {
"@agilgur5/changelog-maker": "^3.0.0",
"@babel/core": "^7.8.4",
"@babel/preset-react": "^7.8.3",
"@wojtekmaj/enzyme-adapter-react-17": "^0.6.6",
"babel-core": "^6.26.3",
"babel-eslint": "^10.0.2",
"babel-loader": "^6.0.0",
"babel-preset-es2015": "^6.14.0",
"babel-preset-react": "^6.11.1",
"babel-preset-stage-2": "^6.13.0",
"canvas": "^2.9.0",
"css-loader": "^0.24.0",
"enzyme": "^3.10.0",
"eslint": "^6.8.0",
"eslint-config-standard": "^14.1.0",
Expand All @@ -80,13 +75,12 @@
"eslint-plugin-standard": "^4.0.1",
"jest-environment-jsdom-fifteen": "^1.0.2",
"jest-without-globals": "^0.0.2",
"parcel": "^1.12.4",
"postcss-modules": "^1.5.0",
"react": "^17.0.2",
"react-dom": "^17.0.2",
"react-hot-loader": "^4.13.0",
"style-loader": "^0.13.1",
"tsdx": "^0.12.3",
"webpack": "^1.12.2",
"webpack-dev-server": "^1.10.1",
"window-resizeto": "0.0.2"
}
}
3 changes: 3 additions & 0 deletions postcss.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module.exports = {
modules: true
}
36 changes: 0 additions & 36 deletions webpack.config.js

This file was deleted.

0 comments on commit 962b902

Please sign in to comment.