Gathering detailed insights and metrics for svg-to-tsx-react-native-cli
Gathering detailed insights and metrics for svg-to-tsx-react-native-cli
Gathering detailed insights and metrics for svg-to-tsx-react-native-cli
Gathering detailed insights and metrics for svg-to-tsx-react-native-cli
A command line utility that takes a svg image file and outputs a fully formatted stateless functional React Native!! component file that can be used to render your image.
npm install svg-to-tsx-react-native-cli
Typescript
Module System
Node Version
NPM Version
JavaScript (64.01%)
TypeScript (35.99%)
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
MIT License
3 Stars
80 Commits
1 Forks
1 Watchers
1 Branches
1 Contributors
Updated on Jan 22, 2022
Latest Version
0.0.12
Package Id
svg-to-tsx-react-native-cli@0.0.12
Unpacked Size
46.74 kB
Size
13.71 kB
File Count
15
NPM Version
6.14.14
Node Version
14.17.5
Cumulative downloads
Total Downloads
Last Day
0%
NaN
Compared to previous day
Last Week
0%
NaN
Compared to previous week
Last Month
0%
NaN
Compared to previous month
Last Year
0%
NaN
Compared to previous year
5
Based on svg-to-react-cli.
A command line utility that takes a svg image file and outputs a fully formatted stateless functional React Native component with height
and width
for props. With flags to toggle formatting and remove style attributes.
npm install -g svg-to-tsx-react-native-cli
svg-to-tsx-react-native src/svg/images/logo Logo --output src/svg/components/
NOTE: image file must be in current working directory. Do not add the extension. If file is image.svg
, then just enter image
as the first argument. ComponentName will be the name of the sfc and filename with .js
appended.
svg-to-tsx-react-native --dir src/svg/images/ --output src/svg/components/
or for all files in directory (will name all components in CamelCase based on image name. If image is image.svg
then new component will be Image
and file will be Image.js
):
Optional Flags:
-d, --directory <path>
- the dirctory from project folder to your svg images (src/svg/images) (optional)
-o, --output <path>
- the output path. Do not include the filename.
--help
- Prints out this readme.
--pre
- Prename with Svg, sample: Logo generate SvgLogo.tsx.
--example
- Prints an example of the i/o of this util.
Takes this:
1<?xml version="1.0" encoding="utf-8"?> 2<!-- Generator: Adobe Illustrator 15.1.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) --> 3<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"> 4<svg 5 version="1.1" 6 id="Layer_1" 7 xmlns="http://www.w3.org/2000/svg" 8 xmlns:xlink="http://www.w3.org/1999/xlink" 9 x="0px" 10 y="0px" 11 width="128px" 12 height="128px" 13 viewBox="0 0 128 128" 14 enable-background="new 0 0 128 128" 15 xml:space="preserve" 16> 17 <g> 18 <circle fill="#E16B5A" cx="64" cy="64" r="64" /> 19 <path fill="#D16354" d="M119.23,96.322c-0..." /> 20 <path fill="#242424" d="M64,104c-9.775,0-..." /> 21 <path fill="#B3B3B3" d="M64,95.5c-12.861,..." /> 22 <g> 23 <path fill="#1A1A1A" d="M86.43,39.278C8..." /> 24 <path fill="#1A1A1A" d="M99,49c0-6.564-..." /> 25 <path fill="#1A1A1A" d="M35.073,39.171c..." /> 26 </g> 27 <path fill="#242424" d="M69,71.5c-1.382,..." /> 28 <path fill="#F5F5F5" d="M76.5,59c-2.756,..." /> 29 <path fill="#242424" d="M76.5,56.5c-1.37..." /> 30 <path fill="#F5F5F5" d="M51.5,59c-2.759,..." /> 31 <path fill="#242424" d="M51.498,56.5C500..." /> 32 <path fill="#242424" d="M74,81.5H54c-1.3..." /> 33 </g> 34</svg>
And creates a new file with this:
1import React from "react"; 2import { 3 Svg, 4 Circle, 5 Ellipse, 6 G, 7 LinearGradient, 8 RadialGradient, 9 Line, 10 Path, 11 Polygon, 12 Polyline, 13 Rect, 14 Symbol, 15 Text, 16 Use, 17 Defs, 18 Stop, 19} from "react-native-svg"; 20 21interface ITestProps extends SvgProps {} 22 23export const Test: React.FC<ITestProps> = () => { 24 return ( 25 <Svg 26 height="128px" 27 id="Layer_1" 28 width="128px" 29 version="1.1" 30 viewBox="0 0 128 128" 31 x="0px" 32 y="0px" 33 xmlSpace="preserve" 34 > 35 <G> 36 <Circle x="64" y="64" fill="#E16B5A" r="64" /> 37 <Path d="M119.23,96.322c-0..." fill="#D16354" /> 38 <Path d="M64,104c-9.775,0-..." fill="#242424" /> 39 <Path d="M64,95.5c-12.861,..." fill="#B3B3B3" /> 40 <G> 41 <Path d="M86.43,39.278C8..." fill="#1A1A1A" /> 42 <Path d="M99,49c0-6.564-..." fill="#1A1A1A" /> 43 <Path d="M35.073,39.171c..." fill="#1A1A1A" /> 44 </G> 45 <Path d="M69,71.5c-1.382,..." fill="#242424" /> 46 <Path d="M76.5,59c-2.756,..." fill="#F5F5F5" /> 47 <Path d="M76.5,56.5c-1.37..." fill="#242424" /> 48 <Path d="M51.5,59c-2.759,..." fill="#F5F5F5" /> 49 <Path d="M51.498,56.5C500..." fill="#242424" /> 50 <Path d="M74,81.5H54c-1.3..." fill="#242424" /> 51 </G> 52 </Svg> 53 ); 54};
The order of precedence of how width/height is set on a generated component is as follows:
No vulnerabilities found.
Reason
no dangerous workflow patterns detected
Reason
no binaries found in the repo
Reason
license file detected
Details
Reason
Found 0/24 approved changesets -- score normalized to 0
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
dependency not pinned by hash detected -- score normalized to 0
Details
Reason
detected GitHub workflow tokens with excessive permissions
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Reason
30 existing vulnerabilities detected
Details
Score
Last Scanned on 2025-07-07
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More