Skip to content

Commit

Permalink
feat: remove "svgAttributes" option
Browse files Browse the repository at this point in the history
BREAKING CHANGE: `svgAttributes` has been removed, please use `svgProps` instead.

Closes #173
  • Loading branch information
gregberge committed Sep 30, 2018
1 parent cbee51c commit 4e46a5d
Show file tree
Hide file tree
Showing 14 changed files with 0 additions and 244 deletions.
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,6 @@ Options:
--ref forward ref to SVG root element
--no-dimensions remove width and height from root SVG tag
--no-expand-props disable props expanding
--svg-attributes <property=value> add attributes to the svg element (deprecated)
--svg-props <property=value> add props to the svg element
--replace-attr-values <old=new> replace an attribute value
--template <file> specify a custom template to use
Expand Down
1 change: 0 additions & 1 deletion packages/cli/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ Options:
--ref forward ref to SVG root element
--no-dimensions remove width and height from root SVG tag
--no-expand-props disable props expanding
--svg-attributes <property=value> add attributes to the svg element (deprecated)
--svg-props <property=value> add props to the svg element
--replace-attr-values <old=new> replace an attribute value
--template <file> specify a custom template to use
Expand Down
14 changes: 0 additions & 14 deletions packages/cli/src/__snapshots__/index.test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -313,20 +313,6 @@ export default SvgFile
"
`;

exports[`cli should support various args: --svg-attributes "focusable=false" 1`] = `
"import React from 'react'
const SvgFile = props => (
<svg focusable=\\"false\\" width={48} height={1} {...props}>
<path d=\\"M0 0h48v1H0z\\" fill=\\"#063855\\" fillRule=\\"evenodd\\" />
</svg>
)
export default SvgFile
"
`;

exports[`cli should support various args: --svg-props "hidden={true}" 1`] = `
"import React from 'react'
Expand Down
14 changes: 0 additions & 14 deletions packages/cli/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,6 @@ program
.option('--ref', 'forward ref to SVG root element')
.option('--no-dimensions', 'remove width and height from root SVG tag')
.option('--no-expand-props', 'disable props expanding')
.option(
'--svg-attributes <property=value>',
'add attributes to the svg element (deprecated)',
parseObject,
)
.option(
'--svg-props <property=value>',
'add props to the svg element',
Expand Down Expand Up @@ -146,15 +141,6 @@ async function run() {
}
}

// TODO remove in v3
if (program.outDir && program.svgAttributes) {
console.log(
chalk.yellow(
'--svg-attributes option is deprecated an will be removed in v3, please use --svg-props instead',
),
)
}

const command = program.outDir ? dirCommand : fileCommand
await command(program, filenames, config)
}
Expand Down
1 change: 0 additions & 1 deletion packages/cli/src/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,6 @@ describe('cli', () => {
['--native --ref'],
['--ref'],
['--replace-attr-values "#063855=currentColor"'],
['--svg-attributes "focusable=false"'],
[`--svg-props "hidden={true}"`],
['--no-svgo'],
['--no-prettier'],
Expand Down
34 changes: 0 additions & 34 deletions packages/core/src/__snapshots__/convert.test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -227,27 +227,6 @@ export default SvgComponent
"
`;

exports[`convert config should support options { svgAttributes: { focusable: false } } 1`] = `
"import React from 'react'
const SvgComponent = props => (
<svg focusable=\\"false\\" width={88} height={88} {...props}>
<g
stroke=\\"#063855\\"
strokeWidth={2}
fill=\\"none\\"
fillRule=\\"evenodd\\"
strokeLinecap=\\"square\\"
>
<path d=\\"M51 37L37 51M51 51L37 37\\" />
</g>
</svg>
)
export default SvgComponent
"
`;

exports[`convert config should support options { svgo: false } 1`] = `
"import React from 'react'
Expand Down Expand Up @@ -310,19 +289,6 @@ export default SvgComponent
"
`;

exports[`convert config svgAttribute 1`] = `
"import React from 'react'
const SvgComponent = props => (
<svg {...props}>
<path d=\\"M0 0h24v24H0z\\" fill=\\"none\\" />
</svg>
)
export default SvgComponent
"
`;

exports[`convert config titleProp 1`] = `
"import React from 'react'
Expand Down
1 change: 0 additions & 1 deletion packages/core/src/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ export const DEFAULT_CONFIG = {
prettierConfig: null,
ref: false,
replaceAttrValues: null,
svgAttributes: null,
svgProps: null,
svgo: true,
svgoConfig: null,
Expand Down
4 changes: 0 additions & 4 deletions packages/core/src/config.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ Object {
"ref": false,
"replaceAttrValues": null,
"runtimeConfig": true,
"svgAttributes": null,
"svgProps": null,
"svgo": true,
"svgoConfig": null,
Expand Down Expand Up @@ -82,7 +81,6 @@ Object {
],
],
"runtimeConfig": true,
"svgAttributes": null,
"svgProps": null,
"svgo": true,
"svgoConfig": null,
Expand Down Expand Up @@ -115,7 +113,6 @@ Object {
],
],
"runtimeConfig": true,
"svgAttributes": null,
"svgProps": null,
"svgo": true,
"svgoConfig": null,
Expand Down Expand Up @@ -149,7 +146,6 @@ Object {
],
],
"runtimeConfig": true,
"svgAttributes": null,
"svgProps": null,
"svgo": true,
"svgoConfig": null,
Expand Down
9 changes: 0 additions & 9 deletions packages/core/src/convert.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,6 @@ describe('convert', () => {
[{ native: true, ref: true }],
[{ ref: true }],
[{ replaceAttrValues: { none: 'black' } }],
[{ svgAttributes: { focusable: false } }],
[{ svgo: false }],
[{ prettier: false }],
[{ template: () => 'nothing' }],
Expand All @@ -232,14 +231,6 @@ describe('convert', () => {
expect(result).toMatchSnapshot()
})

it('svgAttribute', async () => {
const svg = `<svg><path d="M0 0h24v24H0z" fill="none" /></svg>`

expect(
await convert(svg, { svgAttribute: { focusable: false } }),
).toMatchSnapshot()
})

it('titleProp', async () => {
const svg = `
<svg width="0" height="0" style="position:absolute">
Expand Down
37 changes: 0 additions & 37 deletions packages/core/src/h2x/__snapshots__/svgAttributes.test.js.snap

This file was deleted.

53 changes: 0 additions & 53 deletions packages/core/src/h2x/svgAttributes.js

This file was deleted.

72 changes: 0 additions & 72 deletions packages/core/src/h2x/svgAttributes.test.js

This file was deleted.

1 change: 0 additions & 1 deletion packages/core/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ export { default as removeComments } from './h2x/removeComments'
export { default as removeDimensions } from './h2x/removeDimensions'
export { default as replaceAttrValues } from './h2x/replaceAttrValues'
export { default as stripAttribute } from './h2x/stripAttribute'
export { default as svgAttributes } from './h2x/svgAttributes'
export { default as svgProps } from './h2x/svgProps'
export { default as svgRef } from './h2x/svgRef'
export { default as titleProp } from './h2x/titleProp'
Expand Down
2 changes: 0 additions & 2 deletions packages/core/src/plugins/h2x.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import {
removeDimensions,
replaceAttrValues,
stripAttribute,
svgAttributes,
svgProps,
svgRef,
titleProp,
Expand All @@ -21,7 +20,6 @@ function configToPlugins(config) {
if (!config.dimensions) plugins.push(removeDimensions())
if (config.icon) plugins.push(emSize())
if (config.ref) plugins.push(svgRef())
if (config.svgAttributes) plugins.push(svgAttributes(config.svgAttributes))
if (config.svgProps) plugins.push(svgProps(config.svgProps))
// TODO remove boolean value in the next major release
if (config.expandProps)
Expand Down

0 comments on commit 4e46a5d

Please sign in to comment.