Skip to content

Commit

Permalink
Merge pull request #60 from smooth-code/upgrade-dependencies
Browse files Browse the repository at this point in the history
chore: upgrade deps
  • Loading branch information
gregberge committed Mar 8, 2018
2 parents 7357e7c + c424ca7 commit 95877e7
Show file tree
Hide file tree
Showing 8 changed files with 1,575 additions and 816 deletions.
2 changes: 0 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -355,7 +355,6 @@ being alone on the next line (does not apply to self closing elements). See
| ------- | ------------------------- | ---------------------------- |
| `false` | `--jsx-bracket-same-line` | `jsxBracketSameLine: <bool>` |


### Useless Defs

Keep elements of `<defs>` without `id`. It also keep unused symbols. See
Expand All @@ -374,7 +373,6 @@ react-native-svg imports. **All unsupported nodes will be removed.**
| ------- | ------------ | ---------------- |
| `false` | `--native` | `native: <bool>` |


### Bracket Spacing

Print spaces between brackets in object literals. See
Expand Down
42 changes: 21 additions & 21 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,42 +15,42 @@
],
"license": "MIT",
"devDependencies": {
"@babel/cli": "^7.0.0-beta.39",
"@babel/plugin-proposal-class-properties": "^7.0.0-beta.39",
"@babel/cli": "^7.0.0-beta.40",
"@babel/plugin-proposal-class-properties": "^7.0.0-beta.40",
"babel-core": "^7.0.0-bridge.0",
"babel-eslint": "^8.2.1",
"babel-jest": "^22.1.0",
"babel-loader": "^7.1.2",
"babel-eslint": "^8.2.2",
"babel-jest": "^22.4.1",
"babel-loader": "^7.1.4",
"codecov": "^3.0.0",
"conventional-github-releaser": "^2.0.0",
"eslint": "^4.16.0",
"eslint": "^4.18.2",
"eslint-config-airbnb-base": "^12.0.1",
"eslint-config-prettier": "^2.9.0",
"eslint-plugin-import": "^2.7.0",
"jest": "^22.1.4",
"eslint-plugin-import": "^2.9.0",
"jest": "^22.4.2",
"memory-fs": "^0.4.1",
"react": "^16.2.0",
"standard-version": "^4.3.0",
"webpack": "^3.10.0"
"webpack": "^4.1.1"
},
"dependencies": {
"@babel/core": "^7.0.0-beta.39",
"@babel/plugin-proposal-object-rest-spread": "^7.0.0-beta.39",
"@babel/plugin-transform-react-constant-elements": "^7.0.0-beta.39",
"@babel/preset-env": "^7.0.0-beta.39",
"@babel/preset-react": "^7.0.0-beta.39",
"chalk": "^2.1.0",
"commander": "^2.13.0",
"@babel/core": "^7.0.0-beta.40",
"@babel/plugin-proposal-object-rest-spread": "^7.0.0-beta.40",
"@babel/plugin-transform-react-constant-elements": "^7.0.0-beta.40",
"@babel/preset-env": "^7.0.0-beta.40",
"@babel/preset-react": "^7.0.0-beta.40",
"chalk": "^2.3.2",
"commander": "^2.15.0",
"glob": "^7.1.2",
"h2x-core": "^0.1.9",
"h2x-plugin-jsx": "^0.1.9",
"loader-utils": "^1.1.0",
"lodash": "^4.17.4",
"lodash": "^4.17.5",
"mz": "^2.6.0",
"output-file-sync": "^2.0.0",
"prettier": "^1.10.2",
"recursive-readdir": "^2.2.1",
"svgo": "^1.0.3"
"output-file-sync": "^2.0.1",
"prettier": "^1.11.1",
"recursive-readdir": "^2.2.2",
"svgo": "^1.0.5"
},
"bin": {
"svgr": "./bin/svgr"
Expand Down
1 change: 0 additions & 1 deletion src/cli/__snapshots__/index.test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ exports[`cli --help 1`] = `
"
Usage: svgr [options] <file>
Options:
-V, --version output the version number
Expand Down
30 changes: 22 additions & 8 deletions src/cli/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,16 @@ describe('cli', () => {
})

it('--jsx-bracket-same-line', async () => {
const [stdout] = await exec('bin/svgr --jsx-bracket-same-line __fixtures__/one.svg')
const [stdout] = await exec(
'bin/svgr --jsx-bracket-same-line __fixtures__/one.svg',
)
expect(stdout).toMatchSnapshot()
})

it('--keep-useless-defs', async () => {
const [stdout] = await exec('bin/svgr --keep-useless-defs __fixtures__/one.svg')
const [stdout] = await exec(
'bin/svgr --keep-useless-defs __fixtures__/one.svg',
)
expect(stdout).toMatchSnapshot()
})

Expand All @@ -43,7 +47,9 @@ describe('cli', () => {
})

it('--no-bracket-spacing', async () => {
const [stdout] = await exec('bin/svgr --no-bracket-spacing __fixtures__/one.svg')
const [stdout] = await exec(
'bin/svgr --no-bracket-spacing __fixtures__/one.svg',
)
expect(stdout).toMatchSnapshot()
})

Expand All @@ -53,7 +59,9 @@ describe('cli', () => {
})

it('--no-dimensions --no-view-box', async () => {
const [stdout] = await exec('bin/svgr --no-dimensions --no-view-box __fixtures__/one.svg')
const [stdout] = await exec(
'bin/svgr --no-dimensions --no-view-box __fixtures__/one.svg',
)
expect(stdout).toMatchSnapshot()
})

Expand Down Expand Up @@ -127,17 +135,23 @@ describe('cli', () => {

describe('--trailing-comma', () => {
it('none', async () => {
const [stdout] = await exec(`bin/svgr --trailing-comma none __fixtures__/one.svg`)
const [stdout] = await exec(
`bin/svgr --trailing-comma none __fixtures__/one.svg`,
)
expect(stdout).toMatchSnapshot()
})

it('es5', async () => {
const [stdout] = await exec(`bin/svgr --trailing-comma es5 __fixtures__/one.svg`)
const [stdout] = await exec(
`bin/svgr --trailing-comma es5 __fixtures__/one.svg`,
)
expect(stdout).toMatchSnapshot()
})

it('all', async () => {
const [stdout] = await exec(`bin/svgr --trailing-comma all __fixtures__/one.svg`)
const [stdout] = await exec(
`bin/svgr --trailing-comma all __fixtures__/one.svg`,
)
expect(stdout).toMatchSnapshot()
})
})
Expand All @@ -161,7 +175,7 @@ describe('cli', () => {
const [stdout] = await exec('bin/svgr --help')
const [shorthand] = await exec('bin/svgr -h')
expect(stdout).toMatchSnapshot()
expect(shorthand).toEqual(stdout);
expect(shorthand).toEqual(stdout)
})

it('--precision', async () => {
Expand Down
1 change: 0 additions & 1 deletion src/h2x/removeDimensions.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

const dimensionAttrs = ['width', 'height']

const filterDimensionAttrs = attr => !dimensionAttrs.includes(attr.name)
Expand Down
4 changes: 3 additions & 1 deletion src/webpack.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@ function svgrLoader(source) {
})
})

const exportMatches = source.match(/^module.exports\s*=\s*(.*)/)
const exportMatches = source
.toString('utf-8')
.match(/^module.exports\s*=\s*(.*)/)
const previousExport = exportMatches ? exportMatches[1] : null

const pBabelTransform = async jsCode =>
Expand Down
84 changes: 46 additions & 38 deletions src/webpack.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,55 +22,63 @@ function compile(rules) {
resolve(
stats
.toJson()
.modules.find(({ name }) => name === './src/__fixtures__/icon.svg')
.modules.find(({ name }) => name === './__fixtures__/icon.svg')
.source,
)
})
})
}

describe('webpack loader', () => {
it('should convert file', async () => {
const source = await compile([
{
test: /\.svg$/,
use: [
{
loader: path.resolve(__dirname, './webpack.js'),
options: {
expandProps: false,
it(
'should convert file',
async () => {
const source = await compile([
{
test: /\.svg$/,
use: [
{
loader: path.resolve(__dirname, './webpack.js'),
options: {
expandProps: false,
},
},
},
],
},
])
],
},
])

expect(source).toMatchSnapshot()
})
expect(source).toMatchSnapshot()
},
15000,
)

it('should convert file (babel: false)', async () => {
const source = await compile([
{
test: /\.svg$/,
use: [
{
loader: 'babel-loader',
options: {
babelrc: false,
presets: ['@babel/preset-react'],
it(
'should convert file (babel: false)',
async () => {
const source = await compile([
{
test: /\.svg$/,
use: [
{
loader: 'babel-loader',
options: {
babelrc: false,
presets: ['@babel/preset-react'],
},
},
},
{
loader: path.resolve(__dirname, './webpack.js'),
options: {
babel: false,
expandProps: false,
{
loader: path.resolve(__dirname, './webpack.js'),
options: {
babel: false,
expandProps: false,
},
},
},
],
},
])
],
},
])

expect(source).toMatchSnapshot()
})
expect(source).toMatchSnapshot()
},
15000,
)
})
Loading

0 comments on commit 95877e7

Please sign in to comment.