Skip to content

Commit

Permalink
chore: release v3.2.1-beta.0
Browse files Browse the repository at this point in the history
  • Loading branch information
ecklf committed Jan 10, 2023
1 parent 8f4c003 commit f528994
Show file tree
Hide file tree
Showing 3 changed files with 1,587 additions and 1,087 deletions.
45 changes: 36 additions & 9 deletions bin/build.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import svgr from "@svgr/core";
import { transform } from "@svgr/core";
import { promises as fs } from "fs";
import template from "./template";
/* import template from "./template"; */
import junk from "junk";
import camelcase from "camelcase";

Expand All @@ -22,29 +22,56 @@ const resetSrcDir = async () => {
}
};

const template = (variables: any, { tpl }: any) => {
return tpl`
import * as React from "react";
import Svg, { Path, SvgProps, NumberProp } from "react-native-svg";
interface Props extends SvgProps {
size?: NumberProp;
}
const ${variables.componentName} = ({ size = 24, ...props }: Props) => {
return (
${variables.jsx}
)
};
${variables.exports};
`;
};

const genComponentFromBuffer = async (
componentName: string,
svgBuffer: Buffer
): Promise<string> => {
try {
return await svgr(
return await transform(
svgBuffer,
{
template,
svgo: true,
svgoConfig: { plugins: [{ sortAttrs: true }, { removeXMLNS: true }] },
ref: false,
native: true,
typescript: true,
svgProps: { width: "{size}", height: "{size}" },
svgo: true,
svgoConfig: {
plugins: [
"removeXMLNS",
{
name: "sortAttrs",
params: {
xmlnOrder: "alphabetical",
},
},
],
},
plugins: [
"@svgr/plugin-svgo",
"@svgr/plugin-jsx",
"@svgr/plugin-prettier",
],
},
{
componentName: componentName,
}
{ componentName }
);
} catch (error) {
throw new Error("Failed generating components");
Expand Down
27 changes: 14 additions & 13 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "react-native-heroicons",
"version": "3.2.0",
"version": "3.2.1-beta.0",
"description": "React Native components for heroicons",
"files": [
"solid",
Expand All @@ -11,6 +11,7 @@
"scripts": {
"fetch": "rimraf heroicons/ && git clone https://github.com/tailwindlabs/heroicons/",
"gen": "npm run fetch && ts-node --project bin/tsconfig.json --files bin/build.ts",
"gen:no": "ts-node --project bin/tsconfig.json --files bin/build.ts",
"cleanup": "./cleanup.sh",
"compile": "rimraf solid && rimraf outline && rimraf mini && node compile.js && tsc --emitDeclarationOnly --outDir . && cp solid/*.d.ts solid/esm && cp outline/*.d.ts outline/esm && cp mini/*.d.ts mini/esm",
"build:fetch": "npm run gen && npm run compile && npm run cleanup",
Expand All @@ -33,23 +34,23 @@
"author": "ecklf",
"license": "MIT",
"devDependencies": {
"@svgr/core": "^5.5.0",
"@svgr/plugin-jsx": "^5.5.0",
"@svgr/plugin-prettier": "^5.5.0",
"@svgr/plugin-svgo": "^5.5.0",
"@types/node": "^16.11.26",
"@types/react": "^17.0.42",
"@types/react-native": "^0.66.17",
"@svgr/core": "^6.5.1",
"@svgr/plugin-jsx": "^6.5.1",
"@svgr/plugin-prettier": "^6.5.1",
"@svgr/plugin-svgo": "^6.5.1",
"@types/node": "^18.11.18",
"@types/react": "^18.0.26",
"@types/react-native": "^0.70.8",
"camelcase": "^6.3.0",
"esbuild": "^0.13.15",
"junk": "^3.1.0",
"react": "^17.0.2",
"react-native-svg": "^12.3.0",
"release-it": "^14.14.2",
"react": "^18.2.0",
"react-native-svg": "^13.7.0",
"release-it": "^15.6.0",
"rimraf": "^3.0.2",
"tiny-glob": "^0.2.9",
"ts-node": "^10.7.0",
"typescript": "^4.6.2"
"ts-node": "^10.9.1",
"typescript": "^4.9.4"
},
"peerDependencies": {
"react": ">=16.8",
Expand Down
Loading

0 comments on commit f528994

Please sign in to comment.