Skip to content

Commit cbd107f

Browse files
authored
chore: upgrade dependencies & add test (#135)
1 parent e254d58 commit cbd107f

11 files changed

Lines changed: 1183 additions & 843 deletions

File tree

package.json

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -6,30 +6,31 @@
66
"scripts": {
77
"build": "lerna run build",
88
"ci": "yarn build && yarn lint && yarn test --ci --coverage && codecov",
9+
"dev": "lerna run build --parallel -- --watch",
910
"format": "prettier --write \"packages/**/*.{js,json,md}\" \"*.{js,json,md}\"",
1011
"lint": "eslint .",
1112
"release": "lerna publish --conventional-commits && conventional-github-releaser --preset angular",
1213
"test": "jest --runInBand"
1314
},
1415
"devDependencies": {
15-
"@babel/cli": "^7.0.0-beta.49",
16-
"@babel/core": "^7.0.0-beta.49",
17-
"@babel/node": "^7.0.0-beta.49",
18-
"@babel/plugin-proposal-class-properties": "^7.0.0-beta.49",
19-
"@babel/plugin-proposal-object-rest-spread": "^7.0.0-beta.49",
20-
"@babel/preset-env": "^7.0.0-beta.49",
16+
"@babel/cli": "^7.0.0-beta.52",
17+
"@babel/core": "^7.0.0-beta.52",
18+
"@babel/node": "^7.0.0-beta.52",
19+
"@babel/plugin-proposal-class-properties": "^7.0.0-beta.52",
20+
"@babel/plugin-proposal-object-rest-spread": "^7.0.0-beta.52",
21+
"@babel/preset-env": "^7.0.0-beta.52",
2122
"babel-core": "^7.0.0-bridge.0",
22-
"babel-eslint": "^8.2.3",
23-
"babel-jest": "^23.0.1",
24-
"babel-loader": "^7.1.4",
25-
"codecov": "^3.0.2",
23+
"babel-eslint": "^8.2.5",
24+
"babel-jest": "^23.2.0",
25+
"babel-loader": "^7.1.5",
26+
"codecov": "^3.0.3",
2627
"conventional-github-releaser": "^3.1.2",
27-
"eslint": "^4.19.1",
28-
"eslint-config-airbnb-base": "^12.0.1",
28+
"eslint": "^5.0.1",
29+
"eslint-config-airbnb-base": "^13.0.0",
2930
"eslint-config-prettier": "^2.9.0",
30-
"eslint-plugin-import": "^2.12.0",
31-
"jest": "^23.1.0",
31+
"eslint-plugin-import": "^2.13.0",
32+
"jest": "^23.3.0",
3233
"lerna": "^2.11.0",
33-
"react": "^16.4.0"
34+
"react": "^16.4.1"
3435
}
3536
}

packages/cli/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
"dependencies": {
2626
"@svgr/core": "^2.0.0",
2727
"chalk": "^2.4.1",
28-
"commander": "^2.15.1",
28+
"commander": "^2.16.0",
2929
"glob": "^7.1.2",
3030
"output-file-sync": "^2.0.1",
3131
"recursive-readdir": "^2.2.2"

packages/core/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
"h2x-core": "^1.0.0",
2727
"h2x-plugin-jsx": "^1.0.0",
2828
"lodash": "^4.17.10",
29-
"prettier": "^1.13.5",
29+
"prettier": "^1.13.7",
3030
"svgo": "^1.0.5"
3131
}
3232
}

packages/core/src/convert.test.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import convert from './'
1+
import convert from '.'
22

33
const svgBaseCode = `
44
<?xml version="1.0" encoding="UTF-8"?>
@@ -216,8 +216,8 @@ describe('convert', () => {
216216
expect(
217217
await convert(svg, { svgAttribute: { focusable: false } }),
218218
).toMatchSnapshot()
219-
});
220-
219+
})
220+
221221
it('titleProp', async () => {
222222
const svg = `
223223
<svg width="0" height="0" style="position:absolute">

packages/core/src/index.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
/* eslint-disable-next-line import/no-cycle */
12
export { default } from './convert'
23
export * from './config'
34
export * from './util'

packages/core/src/plugins/h2x.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import {
1212
svgRef,
1313
titleProp,
1414
toReactNative,
15-
} from '../'
15+
} from '..'
1616

1717
function configToPlugins(config) {
1818
const plugins = [

packages/rollup/package.json

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,16 +22,16 @@
2222
"prepublishOnly": "yarn run build"
2323
},
2424
"dependencies": {
25-
"@babel/core": "^7.0.0-beta.49",
26-
"@babel/plugin-proposal-object-rest-spread": "^7.0.0-beta.49",
27-
"@babel/plugin-transform-react-constant-elements": "^7.0.0-beta.49",
28-
"@babel/preset-env": "^7.0.0-beta.49",
29-
"@babel/preset-react": "^7.0.0-beta.49",
25+
"@babel/core": "^7.0.0-beta.52",
26+
"@babel/plugin-proposal-object-rest-spread": "^7.0.0-beta.52",
27+
"@babel/plugin-transform-react-constant-elements": "^7.0.0-beta.52",
28+
"@babel/preset-env": "^7.0.0-beta.52",
29+
"@babel/preset-react": "^7.0.0-beta.52",
3030
"@svgr/core": "^2.0.0",
3131
"rollup-pluginutils": "^2.3.0"
3232
},
3333
"devDependencies": {
34-
"rollup": "^0.60.2",
34+
"rollup": "^0.62.0",
3535
"rollup-plugin-image": "^1.0.2",
3636
"rollup-plugin-url": "^1.4.0"
3737
}

packages/webpack/package.json

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,17 +22,18 @@
2222
"prepublishOnly": "yarn run build"
2323
},
2424
"dependencies": {
25-
"@babel/core": "^7.0.0-beta.49",
26-
"@babel/plugin-proposal-object-rest-spread": "^7.0.0-beta.49",
27-
"@babel/plugin-transform-react-constant-elements": "^7.0.0-beta.49",
28-
"@babel/preset-env": "^7.0.0-beta.49",
29-
"@babel/preset-react": "^7.0.0-beta.49",
25+
"@babel/core": "^7.0.0-beta.52",
26+
"@babel/plugin-proposal-object-rest-spread": "^7.0.0-beta.52",
27+
"@babel/plugin-transform-react-constant-elements": "^7.0.0-beta.52",
28+
"@babel/preset-env": "^7.0.0-beta.52",
29+
"@babel/preset-react": "^7.0.0-beta.52",
3030
"@svgr/core": "^2.0.0",
3131
"loader-utils": "^1.1.0"
3232
},
3333
"devDependencies": {
34-
"babel-loader": "^8.0.0-beta.3",
34+
"babel-loader": "^8.0.0-beta.4",
3535
"memory-fs": "^0.4.1",
36-
"webpack": "^4.12.0"
36+
"url-loader": "^1.0.1",
37+
"webpack": "^4.15.1"
3738
}
3839
}

packages/webpack/src/__snapshots__/index.test.js.snap

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,3 +51,29 @@ var SvgComponent = function SvgComponent() {
5151
5252
export default SvgComponent;"
5353
`;
54+
55+
exports[`webpack loader should support url-loader 1`] = `
56+
"import React from 'react';
57+
58+
var _ref =
59+
/*#__PURE__*/
60+
React.createElement(\\"svg\\", {
61+
width: 88,
62+
height: 88
63+
}, React.createElement(\\"g\\", {
64+
stroke: \\"#063855\\",
65+
strokeWidth: 2,
66+
fill: \\"none\\",
67+
fillRule: \\"evenodd\\",
68+
strokeLinecap: \\"square\\"
69+
}, React.createElement(\\"path\\", {
70+
d: \\"M51 37L37 51M51 51L37 37\\"
71+
})));
72+
73+
var SvgComponent = function SvgComponent() {
74+
return _ref;
75+
};
76+
77+
export default 'data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4KPHN2ZyB3aWR0aD0iODhweCIgaGVpZ2h0PSI4OHB4IiB2aWV3Qm94PSIwIDAgODggODgiIHZlcnNpb249IjEuMSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayI+CiAgICA8IS0tIEdlbmVyYXRvcjogU2tldGNoIDQ2LjIgKDQ0NDk2KSAtIGh0dHA6Ly93d3cuYm9oZW1pYW5jb2RpbmcuY29tL3NrZXRjaCAtLT4KICAgIDx0aXRsZT5EaXNtaXNzPC90aXRsZT4KICAgIDxkZXNjPkNyZWF0ZWQgd2l0aCBTa2V0Y2guPC9kZXNjPgogICAgPGRlZnM+PC9kZWZzPgogICAgPGcgaWQ9IkJsb2NrcyIgc3Ryb2tlPSJub25lIiBzdHJva2Utd2lkdGg9IjEiIGZpbGw9Im5vbmUiIGZpbGwtcnVsZT0iZXZlbm9kZCIgc3Ryb2tlLWxpbmVjYXA9InNxdWFyZSI+CiAgICAgICAgPGcgaWQ9IkRpc21pc3MiIHN0cm9rZT0iIzA2Mzg1NSIgc3Ryb2tlLXdpZHRoPSIyIj4KICAgICAgICAgICAgPHBhdGggZD0iTTUxLDM3IEwzNyw1MSIgaWQ9IlNoYXBlIj48L3BhdGg+CiAgICAgICAgICAgIDxwYXRoIGQ9Ik01MSw1MSBMMzcsMzciIGlkPSJTaGFwZSI+PC9wYXRoPgogICAgICAgIDwvZz4KICAgIDwvZz4KPC9zdmc+Cg==';
78+
export { SvgComponent as ReactComponent };"
79+
`;

packages/webpack/src/index.test.js

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,29 @@ describe('webpack loader', () => {
5353
15000,
5454
)
5555

56+
it(
57+
'should support url-loader',
58+
async () => {
59+
const source = await compile([
60+
{
61+
test: /\.svg$/,
62+
use: [
63+
{
64+
loader: path.resolve(__dirname, './index.js'),
65+
options: {
66+
expandProps: false,
67+
},
68+
},
69+
'url-loader',
70+
],
71+
},
72+
])
73+
74+
expect(source).toMatchSnapshot()
75+
},
76+
15000,
77+
)
78+
5679
it(
5780
'should convert file (babel: false)',
5881
async () => {

0 commit comments

Comments
 (0)