Skip to content

Commit a4e729e

Browse files
authored
chore: update dependencies & add pre-push hook (#17)
1 parent 2983db0 commit a4e729e

8 files changed

+3701
-2670
lines changed

.babelrc

-21
This file was deleted.

babel.config.js

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
module.exports = (api) => {
2+
api.cache(true);
3+
4+
return {
5+
presets: [
6+
'@babel/preset-env',
7+
'@babel/preset-react',
8+
],
9+
plugins: [
10+
'@babel/plugin-proposal-class-properties',
11+
],
12+
};
13+
};

commitlint.config.js

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
module.exports = { extends: ['@commitlint/config-conventional'] };

jest.config.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ module.exports = {
44
coveragePathIgnorePatterns: [
55
'/node_modules/',
66
'/coverage/',
7-
'jest.setup.js'
7+
'jest.setup.js',
88
],
99
coverageThreshold: {
1010
global: {
@@ -15,4 +15,5 @@ module.exports = {
1515
},
1616
},
1717
setupFiles: ['./jest.setup.js'],
18+
snapshotSerializers: ['enzyme-to-json/serializer']
1819
};

package.json

+44-36
Original file line numberDiff line numberDiff line change
@@ -1,56 +1,64 @@
11
{
22
"name": "react-scroll-into-view-if-needed",
3-
"version": "2.1.7",
3+
"version": "2.1.8",
44
"description": "A thin component wrapper around scroll-into-view-if-needed",
55
"main": "dist/umd/index.js",
66
"module": "dist/es/index.js",
77
"repository": "[email protected]:icd2k3/react-scroll-into-view-if-needed.git",
8-
"author": "Justin Schrader <[email protected]>",
8+
"author": "Justin Schrader <[email protected]>",
9+
"license": "MIT",
910
"keywords": [
1011
"react",
1112
"scroll-into-view-if-needed",
1213
"scroll",
1314
"scrolling"
1415
],
15-
"license": "MIT",
16-
"peerDependencies": {
17-
"prop-types": "^15.6.1",
18-
"react": "^16.0.0"
19-
},
20-
"dependencies": {},
21-
"devDependencies": {
22-
"babel-cli": "^6.26.0",
23-
"babel-core": "^6.26.3",
24-
"babel-eslint": "^8.2.6",
25-
"babel-jest": "^23.4.0",
26-
"babel-plugin-external-helpers": "^6.22.0",
27-
"babel-preset-env": "^1.7.0",
28-
"babel-preset-react": "^6.24.1",
29-
"babel-preset-stage-2": "^6.24.1",
30-
"coveralls": "^3.0.2",
31-
"cross-env": "^5.2.0",
32-
"enzyme": "^3.3.0",
33-
"enzyme-adapter-react-16": "^1.1.1",
34-
"eslint": "^5.1.0",
35-
"eslint-config-airbnb": "^17.0.0",
36-
"eslint-plugin-import": "^2.13.0",
37-
"eslint-plugin-jsx-a11y": "^6.1.0",
38-
"eslint-plugin-react": "^7.10.0",
39-
"jest": "^23.4.0",
40-
"prop-types": "^15.6.2",
41-
"react": "^16.4.1",
42-
"react-dom": "^16.4.1",
43-
"rollup": "^0.62.0",
44-
"rollup-plugin-babel": "^3.0.7",
45-
"rollup-plugin-commonjs": "^9.1.3",
46-
"rollup-plugin-node-resolve": "^3.3.0",
47-
"scroll-into-view-if-needed": "^2.2.16"
48-
},
4916
"scripts": {
5017
"build": "rollup -c && cross-env BUILD_TYPE=standalone rollup -c",
5118
"lint": "eslint ./src/**",
5219
"prepublishOnly": "yarn build",
5320
"test": "jest",
5421
"travis": "yarn run lint && jest && cat ./coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js"
22+
},
23+
"husky": {
24+
"hooks": {
25+
"commit-msg": "commitlint -E HUSKY_GIT_PARAMS",
26+
"pre-push": "yarn lint && yarn test"
27+
}
28+
},
29+
"peerDependencies": {
30+
"prop-types": ">=15",
31+
"react": ">=16"
32+
},
33+
"dependencies": {},
34+
"devDependencies": {
35+
"@babel/cli": "^7.4.4",
36+
"@babel/core": "^7.4.4",
37+
"@babel/plugin-proposal-class-properties": "^7.4.4",
38+
"@babel/preset-env": "^7.4.4",
39+
"@babel/preset-react": "^7.0.0",
40+
"@commitlint/config-conventional": "^7.6.0",
41+
"babel-eslint": "^10.0.1",
42+
"commitlint": "^7.6.1",
43+
"coveralls": "^3.0.3",
44+
"cross-env": "^5.2.0",
45+
"enzyme": "^3.9.0",
46+
"enzyme-adapter-react-16": "^1.12.1",
47+
"enzyme-to-json": "^3.3.5",
48+
"eslint": "^5.16.0",
49+
"eslint-config-airbnb": "^17.1.0",
50+
"eslint-plugin-import": "^2.17.2",
51+
"eslint-plugin-jsx-a11y": "^6.2.1",
52+
"eslint-plugin-react": "^7.13.0",
53+
"husky": "^2.2.0",
54+
"jest": "^24.8.0",
55+
"prop-types": "^15.7.2",
56+
"react": "^16.8.6",
57+
"react-dom": "^16.8.6",
58+
"rollup": "^1.11.3",
59+
"rollup-plugin-babel": "^4.3.2",
60+
"rollup-plugin-commonjs": "^9.3.4",
61+
"rollup-plugin-node-resolve": "^4.2.3",
62+
"scroll-into-view-if-needed": "^2.2.20"
5563
}
5664
}

rollup.config.js

+6-7
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,11 @@ const IS_STANDALONE_BUILD = process.env.BUILD_TYPE === 'standalone';
88
const name = 'react-scroll-into-view-if-needed';
99
const external = Object.keys(pkg.peerDependencies)
1010
.concat(IS_STANDALONE_BUILD ? 'scroll-into-view-if-needed' : []);
11-
const globals = { react: 'React' };
11+
const globals = {
12+
react: 'React',
13+
'prop-types': 'PropTypes',
14+
'scroll-into-view-if-needed': 'scrollIntoViewIfNeeded',
15+
};
1216
const rootOutputProps = {
1317
exports: 'named',
1418
globals,
@@ -30,13 +34,8 @@ const config = {
3034
plugins: [
3135
babel({
3236
exclude: 'node_modules/**',
33-
plugins: ['external-helpers'],
34-
}),
35-
resolve({
36-
module: true,
37-
jsnext: true,
38-
main: true,
3937
}),
38+
resolve(),
4039
commonjs(),
4140
],
4241
external,
+6-148
Original file line numberDiff line numberDiff line change
@@ -1,155 +1,13 @@
11
// Jest Snapshot v1, https://goo.gl/fbAQLP
22

33
exports[`Render in inactive state, then toggle active state 1`] = `
4-
ShallowWrapper {
5-
"length": 1,
6-
Symbol(enzyme.__root__): [Circular],
7-
Symbol(enzyme.__unrendered__): <ScrollIntoViewIfNeeded
8-
active={false}
9-
elementType="div"
10-
options={
11-
Object {
12-
"behavior": "smooth",
13-
"scrollMode": "if-needed",
14-
}
15-
}
16-
>
17-
<MockChild />
18-
</ScrollIntoViewIfNeeded>,
19-
Symbol(enzyme.__renderer__): Object {
20-
"batchedUpdates": [Function],
21-
"getNode": [Function],
22-
"render": [Function],
23-
"simulateEvent": [Function],
24-
"unmount": [Function],
25-
},
26-
Symbol(enzyme.__node__): Object {
27-
"instance": null,
28-
"key": undefined,
29-
"nodeType": "host",
30-
"props": Object {
31-
"children": <MockChild />,
32-
},
33-
"ref": Object {
34-
"current": null,
35-
},
36-
"rendered": Object {
37-
"instance": null,
38-
"key": undefined,
39-
"nodeType": "function",
40-
"props": Object {},
41-
"ref": null,
42-
"rendered": null,
43-
"type": [Function],
44-
},
45-
"type": "div",
46-
},
47-
Symbol(enzyme.__nodes__): Array [
48-
Object {
49-
"instance": null,
50-
"key": undefined,
51-
"nodeType": "host",
52-
"props": Object {
53-
"children": <MockChild />,
54-
},
55-
"ref": Object {
56-
"current": null,
57-
},
58-
"rendered": Object {
59-
"instance": null,
60-
"key": undefined,
61-
"nodeType": "function",
62-
"props": Object {},
63-
"ref": null,
64-
"rendered": null,
65-
"type": [Function],
66-
},
67-
"type": "div",
68-
},
69-
],
70-
Symbol(enzyme.__options__): Object {
71-
"adapter": ReactSixteenAdapter {
72-
"options": Object {
73-
"enableComponentDidUpdateOnSetState": true,
74-
},
75-
},
76-
},
77-
}
4+
<div>
5+
<MockChild />
6+
</div>
787
`;
798

809
exports[`Render with no props 1`] = `
81-
ShallowWrapper {
82-
"length": 1,
83-
Symbol(enzyme.__root__): [Circular],
84-
Symbol(enzyme.__unrendered__): <ScrollIntoViewIfNeeded
85-
active={true}
86-
elementType="div"
87-
options={
88-
Object {
89-
"behavior": "smooth",
90-
"scrollMode": "if-needed",
91-
}
92-
}
93-
>
94-
<MockChild />
95-
</ScrollIntoViewIfNeeded>,
96-
Symbol(enzyme.__renderer__): Object {
97-
"batchedUpdates": [Function],
98-
"getNode": [Function],
99-
"render": [Function],
100-
"simulateEvent": [Function],
101-
"unmount": [Function],
102-
},
103-
Symbol(enzyme.__node__): Object {
104-
"instance": null,
105-
"key": undefined,
106-
"nodeType": "host",
107-
"props": Object {
108-
"children": <MockChild />,
109-
},
110-
"ref": Object {
111-
"current": null,
112-
},
113-
"rendered": Object {
114-
"instance": null,
115-
"key": undefined,
116-
"nodeType": "function",
117-
"props": Object {},
118-
"ref": null,
119-
"rendered": null,
120-
"type": [Function],
121-
},
122-
"type": "div",
123-
},
124-
Symbol(enzyme.__nodes__): Array [
125-
Object {
126-
"instance": null,
127-
"key": undefined,
128-
"nodeType": "host",
129-
"props": Object {
130-
"children": <MockChild />,
131-
},
132-
"ref": Object {
133-
"current": null,
134-
},
135-
"rendered": Object {
136-
"instance": null,
137-
"key": undefined,
138-
"nodeType": "function",
139-
"props": Object {},
140-
"ref": null,
141-
"rendered": null,
142-
"type": [Function],
143-
},
144-
"type": "div",
145-
},
146-
],
147-
Symbol(enzyme.__options__): Object {
148-
"adapter": ReactSixteenAdapter {
149-
"options": Object {
150-
"enableComponentDidUpdateOnSetState": true,
151-
},
152-
},
153-
},
154-
}
10+
<div>
11+
<MockChild />
12+
</div>
15513
`;

0 commit comments

Comments
 (0)