Skip to content

Commit 4c036f5

Browse files
committed
perf(general): Trim fat (#35) 🐎
* perf(pencil): Over 90% reduction in file size and over 80% reduction in Gzipped file after refactoring and reducing dependency footprint. Before: Stat: 611.06KB Parsed: 105.41KB Gzipped: 32.8KB After: Stat: 56.67KB Parsed: 22.38KB Gzipped: 6.02KB
1 parent 48ec7e5 commit 4c036f5

File tree

20 files changed

+2341
-2760
lines changed

20 files changed

+2341
-2760
lines changed

.babelrc

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
{
22
"presets": [["es2015", { "modules": false }], "stage-0", "react"],
3-
"plugins": ["transform-class-properties"],
3+
"plugins": [
4+
"transform-class-properties",
5+
"transform-react-remove-prop-types"
6+
],
47
"env": {
58
"test": {
69
"presets": ["es2015", "stage-0", "react"],

.eslintignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
docs/bundle.js
1+
docs/**/bundle.js

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,4 +43,5 @@ dist
4343
*.tgz
4444

4545
# Webstorm cache
46-
.idea
46+
.idea
47+
/webpack-stats.json

.travis.yml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,17 @@ cache:
44
- node_modules
55
node_js:
66
- '8'
7-
- '7'
87
- '6'
98
before_install:
109
- npm install -g npm@5
1110
- npm install -g greenkeeper-lockfile@1
11+
install:
12+
- yarn install --ignore-engines
1213
before_script: greenkeeper-lockfile-update
1314
after_script: greenkeeper-lockfile-upload
1415
after_success:
15-
- npm run coveralls
16-
- npm run semantic-release
16+
- npm run coveralls
17+
- npm run travis-deploy-once "npm run semantic-release"
1718
branches:
1819
except:
1920
- /^v\d+\.\d+\.\d+$/

docs/examples/bootstrap/bundle.js

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

docs/examples/bootstrap/index.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,10 @@ const onAction = ({action, node}) => { console.log(`onAction:: [${action}]`, nod
88
const onNodeToggle = (curNode) => { console.log('onNodeToggle::', curNode) }
99

1010
ReactDOM.render(
11-
<DropdownTreeSelect
12-
data={data}
13-
onChange={onChange}
14-
onAction={onAction}
15-
onNodeToggle={onNodeToggle}
11+
<DropdownTreeSelect
12+
data={data}
13+
onChange={onChange}
14+
onAction={onAction}
15+
onNodeToggle={onNodeToggle}
1616
className="bootstrap-demo"
17-
/>, document.getElementById('app'))
17+
/>, document.getElementById('app'))

docs/examples/material/bundle.js

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

docs/examples/material/index.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,10 @@ const onAction = ({action, node}) => { console.log(`onAction:: [${action}]`, nod
88
const onNodeToggle = (curNode) => { console.log('onNodeToggle::', curNode) }
99

1010
ReactDOM.render(
11-
<DropdownTreeSelect
12-
data={data}
13-
onChange={onChange}
14-
onAction={onAction}
15-
onNodeToggle={onNodeToggle}
11+
<DropdownTreeSelect
12+
data={data}
13+
onChange={onChange}
14+
onAction={onAction}
15+
onNodeToggle={onNodeToggle}
1616
className="mdl-demo"
17-
/>, document.getElementById('app'))
17+
/>, document.getElementById('app'))

package.json

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@
1212
"demo": "webpack-dev-server --config docs/webpack.config.js",
1313
"prepublishOnly": "npm run build",
1414
"lint": "eslint --fix src docs webpack.config.js",
15-
"semantic-release": "semantic-release pre && npm publish && semantic-release post",
15+
"semantic-release": "semantic-release",
16+
"travis-deploy-once": "travis-deploy-once",
1617
"test": "cross-env NODE_ENV=test ava",
1718
"test:cov": "rimraf .nyc_output && nyc npm test"
1819
},
@@ -21,7 +22,7 @@
2122
],
2223
"dependencies": {
2324
"classnames": "^2.2.5",
24-
"lodash": "^4.17.4",
25+
"lodash.debounce": "^4.0.8",
2526
"prop-types": "^15.5.8",
2627
"react-simple-dropdown": "^3.2.0"
2728
},
@@ -32,6 +33,8 @@
3233
"babel-loader": "^7.1.2",
3334
"babel-plugin-istanbul": "^4.1.3",
3435
"babel-plugin-transform-class-properties": "^6.24.1",
36+
"babel-plugin-transform-imports": "^1.4.1",
37+
"babel-plugin-transform-react-remove-prop-types": "^0.4.12",
3538
"babel-preset-es2015": "^6.24.1",
3639
"babel-preset-react": "^6.24.1",
3740
"babel-preset-stage-0": "^6.24.1",
@@ -57,10 +60,12 @@
5760
"react-dom": "^16.0.0",
5861
"react-test-renderer": "^16.0.0",
5962
"rimraf": "^2.6.1",
60-
"semantic-release": "^11.0.2",
63+
"semantic-release": "^12.2.2",
6164
"sinon": "^4.0.0",
6265
"style-loader": "^0.19.0",
66+
"travis-deploy-once": "^4.3.2",
6367
"webpack": "^3.5.6",
68+
"webpack-bundle-analyzer": "^2.9.2",
6469
"webpack-dev-server": "^2.9.4"
6570
},
6671
"peerDependencies": {

src/index.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -128,10 +128,10 @@ class DropdownTreeSelect extends Component {
128128
{this.state.allNodesHidden
129129
? <span className='no-matches'>No matches found</span>
130130
: (<Tree data={this.state.tree}
131-
searchModeOn={this.state.searchModeOn}
132-
onAction={this.onAction}
133-
onCheckboxChange={this.onCheckboxChange}
134-
onNodeToggle={this.onNodeToggle} />)
131+
searchModeOn={this.state.searchModeOn}
132+
onAction={this.onAction}
133+
onCheckboxChange={this.onCheckboxChange}
134+
onNodeToggle={this.onNodeToggle} />)
135135
}
136136
</DropdownContent>
137137
</Dropdown>

0 commit comments

Comments
 (0)