Skip to content

Commit

Permalink
feat: support spaces in file names (#779)
Browse files Browse the repository at this point in the history
Co-authored-by: Viktor Honti <viktor.honti@airtame.com>
  • Loading branch information
jamonserrano and Viktor Honti authored Sep 28, 2022
1 parent 1dbc3e2 commit 6ee639a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 5 additions & 0 deletions packages/core/src/state.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,11 @@ describe('state', () => {
filePath: 'a&b~c-d_e.svg',
componentName: 'SvgAbcDE',
})
expect(expandState({ filePath: 'Arrow up.svg' })).toEqual({
filePath: 'Arrow up.svg',
componentName: 'SvgArrowUp',
})

})
})
})
2 changes: 1 addition & 1 deletion packages/core/src/state.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export interface State {
}
}

const VALID_CHAR_REGEX = /[^a-zA-Z0-9_-]/g
const VALID_CHAR_REGEX = /[^a-zA-Z0-9 _-]/g

const getComponentName = (filePath?: string): string => {
if (!filePath) return 'SvgComponent'
Expand Down

1 comment on commit 6ee639a

@vercel
Copy link

@vercel vercel bot commented on 6ee639a Sep 28, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

svgr – ./

svgr-git-main-gregberge.vercel.app
svgr-gregberge.vercel.app
api.react-svgr.com

Please # to comment.