From 84d7adc59344210203c0fef23286c3c657c45358 Mon Sep 17 00:00:00 2001 From: ghdtjgus76 Date: Wed, 29 May 2024 01:45:28 +0900 Subject: [PATCH 01/32] =?UTF-8?q?rename:=20scripts=20wow-ui=20=EC=99=B8?= =?UTF-8?q?=EB=B6=80=EB=A1=9C=20=EC=9D=B4=EB=8F=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/{wow-ui/src => }/scripts/generateBuildConfig.ts | 3 ++- packages/wow-ui/package.json | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) rename packages/{wow-ui/src => }/scripts/generateBuildConfig.ts (97%) diff --git a/packages/wow-ui/src/scripts/generateBuildConfig.ts b/packages/scripts/generateBuildConfig.ts similarity index 97% rename from packages/wow-ui/src/scripts/generateBuildConfig.ts rename to packages/scripts/generateBuildConfig.ts index 01528600..ebbf1e39 100644 --- a/packages/wow-ui/src/scripts/generateBuildConfig.ts +++ b/packages/scripts/generateBuildConfig.ts @@ -1,7 +1,8 @@ import { promises as fs } from "fs"; -import packageJSON from "package.json"; import path from "path"; +import packageJSON from "../wow-ui/package.json"; + type ExportItem = | { types: string; diff --git a/packages/wow-ui/package.json b/packages/wow-ui/package.json index daf1ff48..e8580621 100644 --- a/packages/wow-ui/package.json +++ b/packages/wow-ui/package.json @@ -48,7 +48,7 @@ "lint": "eslint . --max-warnings 0", "storybook": "storybook dev -p 6006", "build-storybook": "storybook build", - "generate:build-config": "tsx ./src/scripts/generateBuildConfig.ts && prettier --write ./rollup.config.js ./package.json", + "generate:build-config": "tsx ../scripts/generateBuildConfig.ts && prettier --write ./rollup.config.js ./package.json", "test-storybook": "test-storybook --browsers firefox chromium webkit", "test": "jest" }, From 6edcbd0b027156b2ee6b933b56a451213bf2f1d5 Mon Sep 17 00:00:00 2001 From: ghdtjgus76 Date: Wed, 29 May 2024 01:45:47 +0900 Subject: [PATCH 02/32] =?UTF-8?q?chore:=20eslintcache=20=ED=8C=8C=EC=9D=BC?= =?UTF-8?q?=20=EC=82=AD=EC=A0=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .eslintcache | 1 - 1 file changed, 1 deletion(-) delete mode 100644 .eslintcache diff --git a/.eslintcache b/.eslintcache deleted file mode 100644 index adc3e82c..00000000 --- a/.eslintcache +++ /dev/null @@ -1 +0,0 @@ -[{"/Users/eugene/github/wow-design-system/packages/theme/src/radius.ts":"1","/Users/eugene/github/wow-design-system/packages/wow-tokens/src/radius.ts":"2","/Users/eugene/github/wow-design-system/packages/wow-tokens/src/space.ts":"3","/Users/eugene/github/wow-design-system/packages/wow-tokens/src/stroke.ts":"4","/Users/eugene/github/wow-design-system/packages/wow-tokens/src/index.ts":"5","/Users/eugene/github/wow-design-system/apps/wow-docs/app/page.tsx":"6","/Users/eugene/github/wow-design-system/packages/theme/src/color.ts":"7","/Users/eugene/github/wow-design-system/packages/theme/src/index.ts":"8","/Users/eugene/github/wow-design-system/packages/theme/src/space.ts":"9","/Users/eugene/github/wow-design-system/packages/theme/src/stroke.ts":"10"},{"size":265,"mtime":1716905895550,"results":"11","hashOfConfig":"12"},{"size":138,"mtime":1716308900598,"results":"13","hashOfConfig":"12"},{"size":329,"mtime":1716309048289,"results":"14","hashOfConfig":"12"},{"size":127,"mtime":1716441452591,"results":"15","hashOfConfig":"12"},{"size":199,"mtime":1716309348694,"results":"16","hashOfConfig":"12"},{"size":438,"mtime":1716445270763,"results":"17","hashOfConfig":"12"},{"size":4454,"mtime":1716439721653,"results":"18","hashOfConfig":"12"},{"size":376,"mtime":1716444728791,"results":"19","hashOfConfig":"12"},{"size":395,"mtime":1716905910282,"results":"20","hashOfConfig":"12"},{"size":357,"mtime":1716444790902,"results":"21","hashOfConfig":"12"},{"filePath":"22","messages":"23","suppressedMessages":"24","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},"8oyd96",{"filePath":"25","messages":"26","suppressedMessages":"27","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"28","messages":"29","suppressedMessages":"30","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"31","messages":"32","suppressedMessages":"33","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"34","messages":"35","suppressedMessages":"36","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"37","messages":"38","suppressedMessages":"39","errorCount":0,"fatalErrorCount":0,"warningCount":1,"fixableErrorCount":0,"fixableWarningCount":0,"source":null},{"filePath":"40","messages":"41","suppressedMessages":"42","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"43","messages":"44","suppressedMessages":"45","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"46","messages":"47","suppressedMessages":"48","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"49","messages":"50","suppressedMessages":"51","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},"/Users/eugene/github/wow-design-system/packages/theme/src/radius.ts",[],[],"/Users/eugene/github/wow-design-system/packages/wow-tokens/src/radius.ts",[],[],"/Users/eugene/github/wow-design-system/packages/wow-tokens/src/space.ts",[],[],"/Users/eugene/github/wow-design-system/packages/wow-tokens/src/stroke.ts",[],[],"/Users/eugene/github/wow-design-system/packages/wow-tokens/src/index.ts",[],[],"/Users/eugene/github/wow-design-system/apps/wow-docs/app/page.tsx",["52"],[],"/Users/eugene/github/wow-design-system/packages/theme/src/color.ts",[],[],"/Users/eugene/github/wow-design-system/packages/theme/src/index.ts",[],[],"/Users/eugene/github/wow-design-system/packages/theme/src/space.ts",[],[],"/Users/eugene/github/wow-design-system/packages/theme/src/stroke.ts",[],[],{"ruleId":"53","severity":1,"message":"54","line":1,"column":21,"nodeType":"55","endLine":1,"endColumn":45},"import/no-unresolved","Unable to resolve path to module '@styled-system/css/css'.","Literal"] \ No newline at end of file From 6ab223012532a68afe4fcb7edcd6ce88d2d903b1 Mon Sep 17 00:00:00 2001 From: ghdtjgus76 Date: Wed, 29 May 2024 02:00:43 +0900 Subject: [PATCH 03/32] =?UTF-8?q?refactor:=20=EC=83=81=EC=88=98=EA=B0=92?= =?UTF-8?q?=20=EC=9C=84=EC=B9=98=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/scripts/generateBuildConfig.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/packages/scripts/generateBuildConfig.ts b/packages/scripts/generateBuildConfig.ts index ebbf1e39..55749eb9 100644 --- a/packages/scripts/generateBuildConfig.ts +++ b/packages/scripts/generateBuildConfig.ts @@ -14,8 +14,6 @@ type ExportObject = { [key: string]: ExportItem }; type EntryFileObject = { [key: string]: string }; const COMPONENT_PATH = "./src/components"; -const ROLLUP_CONFIG_PATH = "rollup.config.js"; -const PACKAGEJSON_PATH = "package.json"; const generateExports = (files: string[]) => { const exportsObj: ExportObject = { @@ -37,6 +35,8 @@ const generateExports = (files: string[]) => { }; const applyExportsToPackageJSON = async (exportsObj: ExportObject) => { + const PACKAGEJSON_PATH = "package.json"; + packageJSON.exports = packageJSON.exports || {}; Object.assign(packageJSON.exports, exportsObj); @@ -54,6 +54,8 @@ const generateRollupEntryFiles = (files: string[]) => { }; const applyEntryFilesToRollupConfig = async (entryFileObj: EntryFileObject) => { + const ROLLUP_CONFIG_PATH = "rollup.config.js"; + const dirname = path.resolve(); const rollupConfigPath = path.join(dirname, ROLLUP_CONFIG_PATH); let rollupConfigContent = await fs.readFile(rollupConfigPath, "utf-8"); From db491219cb7a7c2256ff9dacdc61bf66ab907b42 Mon Sep 17 00:00:00 2001 From: ghdtjgus76 Date: Wed, 29 May 2024 02:09:47 +0900 Subject: [PATCH 04/32] =?UTF-8?q?chore:=20tsx=20=EC=9D=98=EC=A1=B4?= =?UTF-8?q?=EC=84=B1=20=EB=A3=A8=ED=8A=B8=EB=A1=9C=20=EC=9D=B4=EB=8F=99?= =?UTF-8?q?=ED=95=B4=EC=84=9C=20=EC=84=A4=EC=B9=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.json | 1 + packages/wow-ui/package.json | 1 - pnpm-lock.yaml | 10 +++++----- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/package.json b/package.json index 148fb3b0..2175d261 100644 --- a/package.json +++ b/package.json @@ -72,6 +72,7 @@ "theme": "workspace:*", "ts-jest": "^29.1.2", "ts-node": "^10.9.2", + "tsx": "^4.11.0", "turbo": "latest", "typescript": "^5.3.3" }, diff --git a/packages/wow-ui/package.json b/packages/wow-ui/package.json index e8580621..07d1f954 100644 --- a/packages/wow-ui/package.json +++ b/packages/wow-ui/package.json @@ -77,7 +77,6 @@ "eslint-plugin-storybook": "^0.6.15", "rollup-plugin-peer-deps-external": "^2.2.4", "storybook": "^7.5.3", - "tsx": "^4.9.3", "typescript": "^5.3.3" }, "peerDependencies": { diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index e0a2829c..6bb338a7 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -168,6 +168,9 @@ importers: ts-node: specifier: ^10.9.2 version: 10.9.2(@types/node@20.11.24)(typescript@5.3.3) + tsx: + specifier: ^4.11.0 + version: 4.11.0 turbo: specifier: latest version: 1.13.3 @@ -318,9 +321,6 @@ importers: storybook: specifier: ^7.5.3 version: 7.6.19 - tsx: - specifier: ^4.9.3 - version: 4.9.3 typescript: specifier: ^5.3.3 version: 5.3.3 @@ -16125,8 +16125,8 @@ packages: typescript: 5.3.3 dev: true - /tsx@4.9.3: - resolution: {integrity: sha512-czVbetlILiyJZI5zGlj2kw9vFiSeyra9liPD4nG+Thh4pKTi0AmMEQ8zdV/L2xbIVKrIqif4sUNrsMAOksx9Zg==} + /tsx@4.11.0: + resolution: {integrity: sha512-vzGGELOgAupsNVssAmZjbUDfdm/pWP4R+Kg8TVdsonxbXk0bEpE1qh0yV6/QxUVXaVlNemgcPajGdJJ82n3stg==} engines: {node: '>=18.0.0'} hasBin: true dependencies: From 6f8a21396eead501aa05c74c0dcaf4d8e5e4ccef Mon Sep 17 00:00:00 2001 From: ghdtjgus76 Date: Wed, 29 May 2024 03:05:12 +0900 Subject: [PATCH 05/32] =?UTF-8?q?feat:=20svg=20=ED=8C=8C=EC=9D=BC=20?= =?UTF-8?q?=EB=A6=AC=EC=95=A1=ED=8A=B8=20=EC=BB=B4=ED=8F=AC=EB=84=8C?= =?UTF-8?q?=ED=8A=B8=20=EB=B0=A9=EC=8B=9D=EC=9C=BC=EB=A1=9C=20=EB=B3=80?= =?UTF-8?q?=ED=99=98=ED=95=98=EB=8A=94=20=EC=8A=A4=ED=81=AC=EB=A6=BD?= =?UTF-8?q?=ED=8A=B8=20=EC=9E=91=EC=84=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../scripts/generateReactComponentFromSvg.ts | 69 +++++++++++++++++++ packages/wow-icons/package.json | 5 +- packages/wow-icons/src/types/Icon.ts | 7 ++ 3 files changed, 80 insertions(+), 1 deletion(-) create mode 100644 packages/scripts/generateReactComponentFromSvg.ts create mode 100644 packages/wow-icons/src/types/Icon.ts diff --git a/packages/scripts/generateReactComponentFromSvg.ts b/packages/scripts/generateReactComponentFromSvg.ts new file mode 100644 index 00000000..00229789 --- /dev/null +++ b/packages/scripts/generateReactComponentFromSvg.ts @@ -0,0 +1,69 @@ +import { promises as fs } from "fs"; +import path from "path"; + +const generateReactComponentFromSvg = async () => { + const SVG_DIR = "../wow-icons/src/svg"; + const COMPONENT_DIR = "../wow-icons/src/react"; + + const svgFiles = (await fs.readdir(SVG_DIR)).filter((file) => + file.endsWith(".svg") + ); + + const components = []; + + for (const file of svgFiles) { + const componentName = path + .basename(file, ".svg") + .replace(/(^\w|-\w)/g, (match) => match.replace("-", "").toUpperCase()); + components.push(componentName); + const svgFilePath = path.resolve(SVG_DIR, file); + const svgContent = (await fs.readFile(svgFilePath)).toString(); + + const componentContent = ` + import { Ref } from 'react'; + import type { IconProps } from "../types/Icon.ts"; + + const ${componentName} = ( + { className, width = 24, height = 24 }: IconProps, + ref: Ref + ) => { + return ( + + ${svgContent.replace(/-(\w)/g, (_, letter) => letter.toUpperCase())} + + ); + }; + + export default ${componentName}; + `; + const componentFilePath = path.resolve( + COMPONENT_DIR, + `${componentName}.tsx` + ); + + await fs.writeFile(componentFilePath, componentContent); + } + + return components; +}; + +const generateEntryFile = async (components: string[]) => { + const ENTRY_FILE_PATH = "../wow-icons/src/react/index.ts"; + const entryFileContent = components + .map( + (component) => + `export { default as ${component} } from "./${component}.tsx";` + ) + .join("\n"); + + await fs.writeFile(ENTRY_FILE_PATH, entryFileContent); +}; + +(async () => { + const components = await generateReactComponentFromSvg(); + generateEntryFile(components); +})(); diff --git a/packages/wow-icons/package.json b/packages/wow-icons/package.json index 746bdc71..05d741af 100644 --- a/packages/wow-icons/package.json +++ b/packages/wow-icons/package.json @@ -26,7 +26,10 @@ } }, "scripts": { - "build": "rm -rf dist && rollup -c --bundleConfigAsCjs && tsc --emitDeclarationOnly" + "build": "rm -rf dist && rollup -c --bundleConfigAsCjs && tsc --emitDeclarationOnly", + "generate:icons": "tsx ../scripts/generateReactComponentFromSvg.ts && pnpm format && pnpm lint", + "lint": "eslint --fix ./src/react/**/*.tsx", + "format": "prettier --write ./src/react/**/*.tsx ./src/react/index.ts" }, "keywords": [], "author": "gdsc-hongik", diff --git a/packages/wow-icons/src/types/Icon.ts b/packages/wow-icons/src/types/Icon.ts new file mode 100644 index 00000000..275cf65b --- /dev/null +++ b/packages/wow-icons/src/types/Icon.ts @@ -0,0 +1,7 @@ +import type { SVGProps } from "react"; + +export interface IconProps extends SVGProps { + className?: string; + width?: number | string; + height?: number | string; +} From 7687ddcef5f392e1d281c712726d4caaa0180f4f Mon Sep 17 00:00:00 2001 From: ghdtjgus76 Date: Wed, 29 May 2024 03:33:33 +0900 Subject: [PATCH 06/32] =?UTF-8?q?feat:=20svg=20=ED=8C=8C=EC=9D=BC=20?= =?UTF-8?q?=EC=82=AD=EC=A0=9C=20=EC=8B=9C=20=EB=B3=80=ED=99=98=EB=90=98?= =?UTF-8?q?=EC=96=B4=20=EC=9E=88=EB=8A=94=20=EC=BB=B4=ED=8F=AC=EB=84=8C?= =?UTF-8?q?=ED=8A=B8=20=ED=8C=8C=EC=9D=BC=EB=8F=84=20=EC=82=AD=EC=A0=9C?= =?UTF-8?q?=EB=90=98=EB=8A=94=20=EB=A1=9C=EC=A7=81=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/scripts/generateReactComponentFromSvg.ts | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/packages/scripts/generateReactComponentFromSvg.ts b/packages/scripts/generateReactComponentFromSvg.ts index 00229789..28da6ea1 100644 --- a/packages/scripts/generateReactComponentFromSvg.ts +++ b/packages/scripts/generateReactComponentFromSvg.ts @@ -8,6 +8,21 @@ const generateReactComponentFromSvg = async () => { const svgFiles = (await fs.readdir(SVG_DIR)).filter((file) => file.endsWith(".svg") ); + const componentFiles = (await fs.readdir(COMPONENT_DIR)).filter((file) => + file.endsWith(".tsx") + ); + const componentFilesToDelete = componentFiles.filter((file) => { + const componentName = path + .basename(file, ".tsx") + .replace(/([a-z])([A-Z])/g, "$1-$2") + .toLowerCase(); + return !svgFiles.includes(`${componentName}.tsx`); + }); + + for (const file of componentFilesToDelete) { + const componentFilePath = path.resolve(COMPONENT_DIR, file); + await fs.unlink(componentFilePath); + } const components = []; From 9cbab74a39cd789abe91de1eb81690d0d4957870 Mon Sep 17 00:00:00 2001 From: ghdtjgus76 Date: Wed, 29 May 2024 11:27:46 +0900 Subject: [PATCH 07/32] =?UTF-8?q?refactor:=20=EC=8A=A4=ED=81=AC=EB=A6=BD?= =?UTF-8?q?=ED=8A=B8=20=EB=A6=AC=ED=8C=A9=ED=86=A0=EB=A7=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .eslintrc.js | 1 + .../scripts/generateReactComponentFromSvg.ts | 118 +++++++++++------- packages/wow-icons/src/UpArrow.tsx | 40 ------ packages/wow-icons/src/react/UpArrow.tsx | 55 ++++++++ packages/wow-icons/src/{ => react}/index.ts | 0 packages/wow-icons/src/svg/up-arrow.svg | 36 ++++++ 6 files changed, 163 insertions(+), 87 deletions(-) delete mode 100644 packages/wow-icons/src/UpArrow.tsx create mode 100644 packages/wow-icons/src/react/UpArrow.tsx rename packages/wow-icons/src/{ => react}/index.ts (100%) create mode 100644 packages/wow-icons/src/svg/up-arrow.svg diff --git a/.eslintrc.js b/.eslintrc.js index f65e8150..d8858f34 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -28,6 +28,7 @@ module.exports = { globals: { React: true, JSX: true, + console: true, }, env: { browser: true, diff --git a/packages/scripts/generateReactComponentFromSvg.ts b/packages/scripts/generateReactComponentFromSvg.ts index 28da6ea1..f5be0ea3 100644 --- a/packages/scripts/generateReactComponentFromSvg.ts +++ b/packages/scripts/generateReactComponentFromSvg.ts @@ -1,66 +1,84 @@ import { promises as fs } from "fs"; import path from "path"; -const generateReactComponentFromSvg = async () => { - const SVG_DIR = "../wow-icons/src/svg"; - const COMPONENT_DIR = "../wow-icons/src/react"; +const SVG_DIR = "../wow-icons/src/svg"; +const COMPONENT_DIR = "../wow-icons/src/react"; - const svgFiles = (await fs.readdir(SVG_DIR)).filter((file) => - file.endsWith(".svg") - ); - const componentFiles = (await fs.readdir(COMPONENT_DIR)).filter((file) => - file.endsWith(".tsx") +type SvgComponentMap = { [key: string]: string }; + +const generateSvgComponentMap = async () => { + const svgFiles = (await fs.readdir(SVG_DIR)).reduce( + (map, svgFile) => { + const componentName = path + .basename(svgFile, ".svg") + .replace(/(^\w|-\w)/g, (match) => match.replace("-", "").toUpperCase()); + map[componentName] = svgFile; + + return map; + }, + {} ); - const componentFilesToDelete = componentFiles.filter((file) => { - const componentName = path - .basename(file, ".tsx") - .replace(/([a-z])([A-Z])/g, "$1-$2") - .toLowerCase(); - return !svgFiles.includes(`${componentName}.tsx`); + + return svgFiles; +}; + +const deleteUnusedComponentFiles = async (svgComponentMap: SvgComponentMap) => { + const componentFiles = await fs.readdir(COMPONENT_DIR); + const componentFilesToDelete = componentFiles.filter((componentFile) => { + const componentName = path.basename(componentFile, ".tsx"); + return !(componentName in svgComponentMap); }); - for (const file of componentFilesToDelete) { - const componentFilePath = path.resolve(COMPONENT_DIR, file); - await fs.unlink(componentFilePath); - } + await Promise.all( + componentFilesToDelete.map((file) => { + const componentFilePath = path.resolve(COMPONENT_DIR, file); + return fs.unlink(componentFilePath); + }) + ); +}; + +const createComponentContent = ( + componentName: string, + svgContent: string +): string => { + return ` + import { Ref } from 'react'; + import type { IconProps } from "../types/Icon.ts"; + + const ${componentName} = ( + { className, width = 24, height = 24 }: IconProps, + ref: Ref + ) => { + return ( + + ${svgContent.replace(/-(\w)/g, (_, letter) => letter.toUpperCase())} + + ); + }; + + export default ${componentName}; + `; +}; +const generateComponentFiles = async (svgComponentMap: SvgComponentMap) => { const components = []; - for (const file of svgFiles) { - const componentName = path - .basename(file, ".svg") - .replace(/(^\w|-\w)/g, (match) => match.replace("-", "").toUpperCase()); - components.push(componentName); - const svgFilePath = path.resolve(SVG_DIR, file); + for (const [componentName, svgFile] of Object.entries(svgComponentMap)) { + const svgFilePath = path.resolve(SVG_DIR, svgFile); const svgContent = (await fs.readFile(svgFilePath)).toString(); - const componentContent = ` - import { Ref } from 'react'; - import type { IconProps } from "../types/Icon.ts"; - - const ${componentName} = ( - { className, width = 24, height = 24 }: IconProps, - ref: Ref - ) => { - return ( - - ${svgContent.replace(/-(\w)/g, (_, letter) => letter.toUpperCase())} - - ); - }; - - export default ${componentName}; - `; + const componentContent = createComponentContent(componentName, svgContent); const componentFilePath = path.resolve( COMPONENT_DIR, `${componentName}.tsx` ); await fs.writeFile(componentFilePath, componentContent); + components.push(componentName); } return components; @@ -79,6 +97,12 @@ const generateEntryFile = async (components: string[]) => { }; (async () => { - const components = await generateReactComponentFromSvg(); - generateEntryFile(components); + try { + const svgComponentMap = await generateSvgComponentMap(); + await deleteUnusedComponentFiles(svgComponentMap); + const components = await generateComponentFiles(svgComponentMap); + await generateEntryFile(components); + } catch (error) { + console.log("Error generating components:", error); + } })(); diff --git a/packages/wow-icons/src/UpArrow.tsx b/packages/wow-icons/src/UpArrow.tsx deleted file mode 100644 index de6fa083..00000000 --- a/packages/wow-icons/src/UpArrow.tsx +++ /dev/null @@ -1,40 +0,0 @@ -const UpArrow = () => ( - - - - - - - - - - - - -); - -export default UpArrow; diff --git a/packages/wow-icons/src/react/UpArrow.tsx b/packages/wow-icons/src/react/UpArrow.tsx new file mode 100644 index 00000000..d343bde7 --- /dev/null +++ b/packages/wow-icons/src/react/UpArrow.tsx @@ -0,0 +1,55 @@ +import type { Ref } from "react"; + +import type { IconProps } from "../types/Icon.ts"; + +const UpArrow = ( + { className, width = 24, height = 24 }: IconProps, + ref: Ref +) => { + return ( + + + + + + + + + + + + + + + ); +}; + +export default UpArrow; diff --git a/packages/wow-icons/src/index.ts b/packages/wow-icons/src/react/index.ts similarity index 100% rename from packages/wow-icons/src/index.ts rename to packages/wow-icons/src/react/index.ts diff --git a/packages/wow-icons/src/svg/up-arrow.svg b/packages/wow-icons/src/svg/up-arrow.svg new file mode 100644 index 00000000..b3221b73 --- /dev/null +++ b/packages/wow-icons/src/svg/up-arrow.svg @@ -0,0 +1,36 @@ + + + + + + + + + + + + From 807ab4a271027e02653b3ca636d19b30c685183a Mon Sep 17 00:00:00 2001 From: ghdtjgus76 Date: Wed, 29 May 2024 11:34:03 +0900 Subject: [PATCH 08/32] =?UTF-8?q?chore:=20wow-icons=20=EB=B9=8C=EB=93=9C?= =?UTF-8?q?=20input=20=EC=84=A4=EC=A0=95=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/wow-icons/rollup.config.js | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/wow-icons/rollup.config.js b/packages/wow-icons/rollup.config.js index 32bedf70..3dafba47 100644 --- a/packages/wow-icons/rollup.config.js +++ b/packages/wow-icons/rollup.config.js @@ -7,6 +7,7 @@ const extensions = [".ts", ".tsx", ".js", ".jsx"]; export default { ...baseConfig, + input: "./src/react/index.ts", plugins: [ ...baseConfig.plugins, babel({ From 6c14c6c1a346ffae906608f3af57d683e12fefe0 Mon Sep 17 00:00:00 2001 From: ghdtjgus76 Date: Wed, 29 May 2024 12:13:57 +0900 Subject: [PATCH 09/32] =?UTF-8?q?chore:=20=EB=B9=8C=EB=93=9C=20=EC=84=A4?= =?UTF-8?q?=EC=A0=95=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/shared-config/rollup.config.js | 2 +- packages/wow-icons/package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/shared-config/rollup.config.js b/packages/shared-config/rollup.config.js index 3ff38c31..90e71521 100644 --- a/packages/shared-config/rollup.config.js +++ b/packages/shared-config/rollup.config.js @@ -20,7 +20,7 @@ const baseConfig = { format: "cjs", }, ], - external: ["react/jsx-runtime"], + external: ["react", "react-dom", "react/jsx-runtime"], plugins: [ peerDepsExternal(), resolve({ extensions }), diff --git a/packages/wow-icons/package.json b/packages/wow-icons/package.json index 05d741af..efe6fcce 100644 --- a/packages/wow-icons/package.json +++ b/packages/wow-icons/package.json @@ -26,7 +26,7 @@ } }, "scripts": { - "build": "rm -rf dist && rollup -c --bundleConfigAsCjs && tsc --emitDeclarationOnly", + "build": "pnpm generate:icons && rm -rf dist && rollup -c --bundleConfigAsCjs && tsc --emitDeclarationOnly", "generate:icons": "tsx ../scripts/generateReactComponentFromSvg.ts && pnpm format && pnpm lint", "lint": "eslint --fix ./src/react/**/*.tsx", "format": "prettier --write ./src/react/**/*.tsx ./src/react/index.ts" From 2ca243f8ee8c3a9ba590519e1471d7feb484166c Mon Sep 17 00:00:00 2001 From: ghdtjgus76 Date: Wed, 29 May 2024 13:35:34 +0900 Subject: [PATCH 10/32] =?UTF-8?q?chore:=20wow-icons=20=EB=B9=8C=EB=93=9C?= =?UTF-8?q?=20=EC=84=A4=EC=A0=95=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/wow-icons/package.json | 2 +- packages/wow-icons/rollup.config.js | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/wow-icons/package.json b/packages/wow-icons/package.json index efe6fcce..e15afc38 100644 --- a/packages/wow-icons/package.json +++ b/packages/wow-icons/package.json @@ -19,7 +19,7 @@ "types": "./dist/index.d.ts", "exports": { ".": { - "types": "./dist/index.d.ts", + "types": "./dist/react/index.d.ts", "require": "./dist/index.cjs", "import": "./dist/index.js", "default": "./dist/index.js" diff --git a/packages/wow-icons/rollup.config.js b/packages/wow-icons/rollup.config.js index 3dafba47..ab1edc1c 100644 --- a/packages/wow-icons/rollup.config.js +++ b/packages/wow-icons/rollup.config.js @@ -2,6 +2,7 @@ import baseConfig from "../shared-config/rollup.config.js"; import babel from "@rollup/plugin-babel"; import svgr from "@svgr/rollup"; import url from "@rollup/plugin-url"; +import typescript from "@rollup/plugin-typescript"; const extensions = [".ts", ".tsx", ".js", ".jsx"]; @@ -17,5 +18,6 @@ export default { }), url(), svgr(), + typescript(), ], }; From 15b5dd0254f662bc7888ef0ee6ba5520676f2e4c Mon Sep 17 00:00:00 2001 From: ghdtjgus76 Date: Wed, 29 May 2024 14:06:39 +0900 Subject: [PATCH 11/32] =?UTF-8?q?chore:=20=EC=8A=A4=ED=81=AC=EB=A6=BD?= =?UTF-8?q?=ED=8A=B8=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../scripts/generateReactComponentFromSvg.ts | 13 +++++++-- packages/wow-icons/src/react/UpArrow.tsx | 27 ++++++++++++------- packages/wow-icons/src/types/Icon.ts | 7 +++-- 3 files changed, 34 insertions(+), 13 deletions(-) diff --git a/packages/scripts/generateReactComponentFromSvg.ts b/packages/scripts/generateReactComponentFromSvg.ts index f5be0ea3..633571d4 100644 --- a/packages/scripts/generateReactComponentFromSvg.ts +++ b/packages/scripts/generateReactComponentFromSvg.ts @@ -41,12 +41,20 @@ const createComponentContent = ( componentName: string, svgContent: string ): string => { + const modifiedSvgContent = svgContent + .replace(/width="(\d+)"/g, `width={width}`) + .replace(/height="(\d+)"/g, `height={height}`) + .replace(/viewBox="(.*?)"/g, `viewBox={viewBox}`) + .replace(/fill="([^"]+)"/g, `fill={fill}`) + .replace(/stroke="([^"]+)"/g, `stroke={stroke}`) + .replace(/-(\w)/g, (_, letter) => letter.toUpperCase()); + return ` import { Ref } from 'react'; import type { IconProps } from "../types/Icon.ts"; const ${componentName} = ( - { className, width = 24, height = 24 }: IconProps, + { className, width = 24, height = 24, viewBox = "0 0 24 24", fill = "#E4E4E5", stroke = "#E4E4E5", ...rest }: IconProps, ref: Ref ) => { return ( @@ -54,8 +62,9 @@ const createComponentContent = ( ref={ref} style={{ display: "inline-flex", width: width, height: height }} className={className} + {...rest} > - ${svgContent.replace(/-(\w)/g, (_, letter) => letter.toUpperCase())} + ${modifiedSvgContent} ); }; diff --git a/packages/wow-icons/src/react/UpArrow.tsx b/packages/wow-icons/src/react/UpArrow.tsx index d343bde7..85949c57 100644 --- a/packages/wow-icons/src/react/UpArrow.tsx +++ b/packages/wow-icons/src/react/UpArrow.tsx @@ -3,7 +3,15 @@ import type { Ref } from "react"; import type { IconProps } from "../types/Icon.ts"; const UpArrow = ( - { className, width = 24, height = 24 }: IconProps, + { + className, + width = 24, + height = 24, + viewBox = "0 0 24 24", + fill = "#E4E4E5", + stroke = "#E4E4E5", + ...rest + }: IconProps, ref: Ref ) => { return ( @@ -11,32 +19,33 @@ const UpArrow = ( className={className} ref={ref} style={{ display: "inline-flex", width: width, height: height }} + {...rest} > - + diff --git a/packages/wow-icons/src/types/Icon.ts b/packages/wow-icons/src/types/Icon.ts index 275cf65b..678bed87 100644 --- a/packages/wow-icons/src/types/Icon.ts +++ b/packages/wow-icons/src/types/Icon.ts @@ -1,7 +1,10 @@ -import type { SVGProps } from "react"; +import type { HTMLAttributes } from "react"; -export interface IconProps extends SVGProps { +export interface IconProps extends HTMLAttributes { className?: string; width?: number | string; height?: number | string; + viewBox?: string; + fill?: string; + stroke?: string; } From 1662cd815cddca3425713a1bc2e41f276c0dfb4e Mon Sep 17 00:00:00 2001 From: ghdtjgus76 Date: Wed, 29 May 2024 14:07:23 +0900 Subject: [PATCH 12/32] =?UTF-8?q?chore:=20wow-ui=20=EB=B9=8C=EB=93=9C=20?= =?UTF-8?q?=EC=8B=9C=20babel=20runtime=20external=EB=A1=9C=20=EC=84=A4?= =?UTF-8?q?=EC=A0=95=ED=95=98=EB=8F=84=EB=A1=9D=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/wow-ui/rollup.config.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/wow-ui/rollup.config.js b/packages/wow-ui/rollup.config.js index 400d5c93..4336675a 100644 --- a/packages/wow-ui/rollup.config.js +++ b/packages/wow-ui/rollup.config.js @@ -37,7 +37,7 @@ export default { entryFileNames: "[name].cjs", }, ], - external: ["react/jsx-runtime"], + external: ["react/jsx-runtime", /@babel\/runtime/], plugins: [ alias({ entries: [ From f173ef7dac9d8c6816fdfe42bc1293b51629ffe0 Mon Sep 17 00:00:00 2001 From: ghdtjgus76 Date: Wed, 29 May 2024 15:36:16 +0900 Subject: [PATCH 13/32] =?UTF-8?q?chore:=20root=EC=97=90=20wowds-tokens=20d?= =?UTF-8?q?ev=20dependency=20=EC=84=A4=EC=B9=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.json | 3 ++- pnpm-lock.yaml | 5 ++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 2175d261..7e45312d 100644 --- a/package.json +++ b/package.json @@ -69,7 +69,8 @@ "rollup-plugin-peer-deps-external": "^2.2.4", "rollup-plugin-preserve-directives": "^0.4.0", "shared-config": "workspace:^", - "theme": "workspace:*", + "theme": "workspace:^", + "wowds-tokens": "workspace:^", "ts-jest": "^29.1.2", "ts-node": "^10.9.2", "tsx": "^4.11.0", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 6bb338a7..0cadbf32 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -160,7 +160,7 @@ importers: specifier: workspace:^ version: link:packages/shared-config theme: - specifier: workspace:* + specifier: workspace:^ version: link:packages/theme ts-jest: specifier: ^29.1.2 @@ -177,6 +177,9 @@ importers: typescript: specifier: ^5.3.3 version: 5.3.3 + wowds-tokens: + specifier: workspace:^ + version: link:packages/wow-tokens apps/wow-docs: dependencies: From feb039612de462b5f3b271853ff4824c69e6c56b Mon Sep 17 00:00:00 2001 From: ghdtjgus76 Date: Wed, 29 May 2024 15:37:05 +0900 Subject: [PATCH 14/32] =?UTF-8?q?rename:=20theme=20=ED=8C=A8=ED=82=A4?= =?UTF-8?q?=EC=A7=80=20=EB=82=B4=EB=B6=80=20=ED=8F=B4=EB=8D=94=EA=B5=AC?= =?UTF-8?q?=EC=A1=B0=20=EC=A0=95=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/theme/src/{ => tokens}/color.ts | 0 packages/theme/src/{ => tokens}/index.ts | 0 packages/theme/src/{ => tokens}/radius.ts | 0 packages/theme/src/{ => tokens}/space.ts | 0 packages/theme/src/{ => tokens}/stroke.ts | 0 packages/theme/src/{ => tokens}/typography.ts | 0 packages/theme/src/types/Color.ts | 99 +++++++++++++++++++ packages/theme/src/types/index.ts | 1 + packages/theme/{ => src}/utils/index.ts | 0 .../{ => src}/utils/remove-unused-css-vars.ts | 0 .../utils/remove-unused-keyframes.ts | 0 11 files changed, 100 insertions(+) rename packages/theme/src/{ => tokens}/color.ts (100%) rename packages/theme/src/{ => tokens}/index.ts (100%) rename packages/theme/src/{ => tokens}/radius.ts (100%) rename packages/theme/src/{ => tokens}/space.ts (100%) rename packages/theme/src/{ => tokens}/stroke.ts (100%) rename packages/theme/src/{ => tokens}/typography.ts (100%) create mode 100644 packages/theme/src/types/Color.ts create mode 100644 packages/theme/src/types/index.ts rename packages/theme/{ => src}/utils/index.ts (100%) rename packages/theme/{ => src}/utils/remove-unused-css-vars.ts (100%) rename packages/theme/{ => src}/utils/remove-unused-keyframes.ts (100%) diff --git a/packages/theme/src/color.ts b/packages/theme/src/tokens/color.ts similarity index 100% rename from packages/theme/src/color.ts rename to packages/theme/src/tokens/color.ts diff --git a/packages/theme/src/index.ts b/packages/theme/src/tokens/index.ts similarity index 100% rename from packages/theme/src/index.ts rename to packages/theme/src/tokens/index.ts diff --git a/packages/theme/src/radius.ts b/packages/theme/src/tokens/radius.ts similarity index 100% rename from packages/theme/src/radius.ts rename to packages/theme/src/tokens/radius.ts diff --git a/packages/theme/src/space.ts b/packages/theme/src/tokens/space.ts similarity index 100% rename from packages/theme/src/space.ts rename to packages/theme/src/tokens/space.ts diff --git a/packages/theme/src/stroke.ts b/packages/theme/src/tokens/stroke.ts similarity index 100% rename from packages/theme/src/stroke.ts rename to packages/theme/src/tokens/stroke.ts diff --git a/packages/theme/src/typography.ts b/packages/theme/src/tokens/typography.ts similarity index 100% rename from packages/theme/src/typography.ts rename to packages/theme/src/tokens/typography.ts diff --git a/packages/theme/src/types/Color.ts b/packages/theme/src/types/Color.ts new file mode 100644 index 00000000..f31a2f88 --- /dev/null +++ b/packages/theme/src/types/Color.ts @@ -0,0 +1,99 @@ +export type ColorToken = + | "red50" + | "red100" + | "red150" + | "red200" + | "red300" + | "red400" + | "red500" + | "red600" + | "red700" + | "red800" + | "red850" + | "red900" + | "red950" + | "blue50" + | "blue100" + | "blue150" + | "blue200" + | "blue300" + | "blue400" + | "blue500" + | "blue600" + | "blue700" + | "blue800" + | "blue850" + | "blue900" + | "blue950" + | "yellow50" + | "yellow100" + | "yellow150" + | "yellow200" + | "yellow300" + | "yellow400" + | "yellow500" + | "yellow600" + | "yellow700" + | "yellow800" + | "yellow850" + | "yellow900" + | "yellow950" + | "green50" + | "green100" + | "green150" + | "green200" + | "green300" + | "green400" + | "green500" + | "green600" + | "green700" + | "green800" + | "green850" + | "green900" + | "green950" + | "mono50" + | "mono100" + | "mono150" + | "mono200" + | "mono300" + | "mono400" + | "mono500" + | "mono600" + | "mono700" + | "mono800" + | "mono850" + | "mono900" + | "mono950" + | "white" + | "black" + | "whiteOpacity20" + | "whiteOpacity40" + | "whiteOpacity60" + | "whiteOpacity80" + | "blackOpacity20" + | "blackOpacity40" + | "blackOpacity60" + | "blackOpacity80" + | "primary" + | "success" + | "error" + | "backgroundNormal" + | "backgroundAlternative" + | "backgroundDimmer" + | "sub" + | "outline" + | "textBlack" + | "textWhite" + | "darkDisabled" + | "lightDisabled" + | "blueHover" + | "monoHover" + | "elevatedHover" + | "bluePressed" + | "blueBackgroundPressed" + | "monoBackgroundPressed" + | "shadowSmall" + | "shadowMedium" + | "blueShadow" + | "discord" + | "github"; diff --git a/packages/theme/src/types/index.ts b/packages/theme/src/types/index.ts new file mode 100644 index 00000000..21460562 --- /dev/null +++ b/packages/theme/src/types/index.ts @@ -0,0 +1 @@ +export * from "./Color.ts"; diff --git a/packages/theme/utils/index.ts b/packages/theme/src/utils/index.ts similarity index 100% rename from packages/theme/utils/index.ts rename to packages/theme/src/utils/index.ts diff --git a/packages/theme/utils/remove-unused-css-vars.ts b/packages/theme/src/utils/remove-unused-css-vars.ts similarity index 100% rename from packages/theme/utils/remove-unused-css-vars.ts rename to packages/theme/src/utils/remove-unused-css-vars.ts diff --git a/packages/theme/utils/remove-unused-keyframes.ts b/packages/theme/src/utils/remove-unused-keyframes.ts similarity index 100% rename from packages/theme/utils/remove-unused-keyframes.ts rename to packages/theme/src/utils/remove-unused-keyframes.ts From 3637b503418b86c5e33f5a67d9e1266bdbca0757 Mon Sep 17 00:00:00 2001 From: ghdtjgus76 Date: Wed, 29 May 2024 15:37:56 +0900 Subject: [PATCH 15/32] =?UTF-8?q?chore:=20theme=20=ED=8C=A8=ED=82=A4?= =?UTF-8?q?=EC=A7=80=20exports=20=EC=86=8D=EC=84=B1=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/theme/package.json | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/packages/theme/package.json b/packages/theme/package.json index f15d57c6..03645cdd 100644 --- a/packages/theme/package.json +++ b/packages/theme/package.json @@ -4,8 +4,9 @@ "private": true, "type": "module", "exports": { - ".": "./src/index.ts", - "./utils": "./utils/index.ts" + ".": "./src/tokens/index.ts", + "./utils": "./src/utils/index.ts", + "./types": "./src/types/index.ts" }, "devDependencies": { "@pandacss/dev": "^0.39.0" From e9c6de716bef69afa8b6296424d20da757429cde Mon Sep 17 00:00:00 2001 From: ghdtjgus76 Date: Wed, 29 May 2024 15:38:11 +0900 Subject: [PATCH 16/32] =?UTF-8?q?chore:=20theme=20=ED=8C=A8=ED=82=A4?= =?UTF-8?q?=EC=A7=80=20tsconfig=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/theme/tsconfig.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/theme/tsconfig.json b/packages/theme/tsconfig.json index 72ee3985..18fbad2e 100644 --- a/packages/theme/tsconfig.json +++ b/packages/theme/tsconfig.json @@ -21,6 +21,6 @@ "allowImportingTsExtensions": true, "jsx": "react-jsx" }, - "include": ["src", "utils"], + "include": ["src"], "exclude": ["node_modules"] } From 5d29bbb391e4e3750b9be61da72e733a27ba43a1 Mon Sep 17 00:00:00 2001 From: ghdtjgus76 Date: Wed, 29 May 2024 15:38:28 +0900 Subject: [PATCH 17/32] =?UTF-8?q?chore:=20=EC=8A=A4=ED=81=AC=EB=A6=BD?= =?UTF-8?q?=ED=8A=B8=20=EC=88=98=EC=A0=95=20=EB=B0=8F=20=EC=A0=81=EC=9A=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../scripts/generateReactComponentFromSvg.ts | 40 +++--- packages/wow-icons/src/react/UpArrow.tsx | 120 +++++++++--------- packages/wow-icons/src/types/Icon.ts | 5 +- 3 files changed, 86 insertions(+), 79 deletions(-) diff --git a/packages/scripts/generateReactComponentFromSvg.ts b/packages/scripts/generateReactComponentFromSvg.ts index 633571d4..263f5c83 100644 --- a/packages/scripts/generateReactComponentFromSvg.ts +++ b/packages/scripts/generateReactComponentFromSvg.ts @@ -45,30 +45,32 @@ const createComponentContent = ( .replace(/width="(\d+)"/g, `width={width}`) .replace(/height="(\d+)"/g, `height={height}`) .replace(/viewBox="(.*?)"/g, `viewBox={viewBox}`) - .replace(/fill="([^"]+)"/g, `fill={fill}`) - .replace(/stroke="([^"]+)"/g, `stroke={stroke}`) + .replace(/fill="([^"]+)"/g, `fill={color[fill]}`) + .replace(/stroke="([^"]+)"/g, `stroke={color[stroke]}`) .replace(/-(\w)/g, (_, letter) => letter.toUpperCase()); return ` - import { Ref } from 'react'; + import { forwardRef } from 'react'; + import { color } from "wowds-tokens"; + import type { IconProps } from "../types/Icon.ts"; - const ${componentName} = ( - { className, width = 24, height = 24, viewBox = "0 0 24 24", fill = "#E4E4E5", stroke = "#E4E4E5", ...rest }: IconProps, - ref: Ref - ) => { - return ( - - ${modifiedSvgContent} - - ); - }; - + const ${componentName} = forwardRef( + ({ className, width = 24, height = 24, viewBox = "0 0 24 24", fill = "white", stroke = "white", ...rest }, ref) => { + return ( + + ${modifiedSvgContent} + + ); + } + ); + + ${componentName}.displayName = '${componentName}'; export default ${componentName}; `; }; diff --git a/packages/wow-icons/src/react/UpArrow.tsx b/packages/wow-icons/src/react/UpArrow.tsx index 85949c57..d11c2c2f 100644 --- a/packages/wow-icons/src/react/UpArrow.tsx +++ b/packages/wow-icons/src/react/UpArrow.tsx @@ -1,64 +1,68 @@ -import type { Ref } from "react"; +import { forwardRef } from "react"; +import { color } from "wowds-tokens"; import type { IconProps } from "../types/Icon.ts"; -const UpArrow = ( - { - className, - width = 24, - height = 24, - viewBox = "0 0 24 24", - fill = "#E4E4E5", - stroke = "#E4E4E5", - ...rest - }: IconProps, - ref: Ref -) => { - return ( - - ( + ( + { + className, + width = 24, + height = 24, + viewBox = "0 0 24 24", + fill = "white", + stroke = "white", + ...rest + }, + ref + ) => { + return ( + - - - - - - - - - - - - - ); -}; + + + + + + + + + + + + + + ); + } +); +UpArrow.displayName = "UpArrow"; export default UpArrow; diff --git a/packages/wow-icons/src/types/Icon.ts b/packages/wow-icons/src/types/Icon.ts index 678bed87..3ceb02c3 100644 --- a/packages/wow-icons/src/types/Icon.ts +++ b/packages/wow-icons/src/types/Icon.ts @@ -1,10 +1,11 @@ import type { HTMLAttributes } from "react"; +import type { ColorToken } from "theme/types"; export interface IconProps extends HTMLAttributes { className?: string; width?: number | string; height?: number | string; viewBox?: string; - fill?: string; - stroke?: string; + fill?: ColorToken; + stroke?: ColorToken; } From 8aa7e42089e875a8762f5f378371ee67e737f1eb Mon Sep 17 00:00:00 2001 From: ghdtjgus76 Date: Wed, 29 May 2024 20:00:10 +0900 Subject: [PATCH 18/32] =?UTF-8?q?chore:=20=EC=8A=A4=ED=81=AC=EB=A6=BD?= =?UTF-8?q?=ED=8A=B8=20=EB=B0=8F=20=EC=95=84=EC=9D=B4=EC=BD=98=20=EC=BD=94?= =?UTF-8?q?=EB=93=9C=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../scripts/generateReactComponentFromSvg.ts | 29 +++---- packages/wow-icons/src/react/UpArrow.tsx | 77 +++++++++---------- packages/wow-icons/src/types/Icon.ts | 2 +- 3 files changed, 54 insertions(+), 54 deletions(-) diff --git a/packages/scripts/generateReactComponentFromSvg.ts b/packages/scripts/generateReactComponentFromSvg.ts index 263f5c83..62c75b0f 100644 --- a/packages/scripts/generateReactComponentFromSvg.ts +++ b/packages/scripts/generateReactComponentFromSvg.ts @@ -39,15 +39,21 @@ const deleteUnusedComponentFiles = async (svgComponentMap: SvgComponentMap) => { const createComponentContent = ( componentName: string, - svgContent: string + svgContent: string, + svgFile: string ): string => { + const iconName = path.basename(svgFile, ".svg"); const modifiedSvgContent = svgContent + .replace(/-(\w)/g, (_, letter) => letter.toUpperCase()) + .replace( + /]*)>/, + `` + ) .replace(/width="(\d+)"/g, `width={width}`) .replace(/height="(\d+)"/g, `height={height}`) .replace(/viewBox="(.*?)"/g, `viewBox={viewBox}`) .replace(/fill="([^"]+)"/g, `fill={color[fill]}`) - .replace(/stroke="([^"]+)"/g, `stroke={color[stroke]}`) - .replace(/-(\w)/g, (_, letter) => letter.toUpperCase()); + .replace(/stroke="([^"]+)"/g, `stroke={color[stroke]}`); return ` import { forwardRef } from 'react'; @@ -55,17 +61,10 @@ const createComponentContent = ( import type { IconProps } from "../types/Icon.ts"; - const ${componentName} = forwardRef( + const ${componentName} = forwardRef( ({ className, width = 24, height = 24, viewBox = "0 0 24 24", fill = "white", stroke = "white", ...rest }, ref) => { return ( - - ${modifiedSvgContent} - + ${modifiedSvgContent} ); } ); @@ -82,7 +81,11 @@ const generateComponentFiles = async (svgComponentMap: SvgComponentMap) => { const svgFilePath = path.resolve(SVG_DIR, svgFile); const svgContent = (await fs.readFile(svgFilePath)).toString(); - const componentContent = createComponentContent(componentName, svgContent); + const componentContent = createComponentContent( + componentName, + svgContent, + svgFile + ); const componentFilePath = path.resolve( COMPONENT_DIR, `${componentName}.tsx` diff --git a/packages/wow-icons/src/react/UpArrow.tsx b/packages/wow-icons/src/react/UpArrow.tsx index d11c2c2f..25b9d7de 100644 --- a/packages/wow-icons/src/react/UpArrow.tsx +++ b/packages/wow-icons/src/react/UpArrow.tsx @@ -3,7 +3,7 @@ import { color } from "wowds-tokens"; import type { IconProps } from "../types/Icon.ts"; -const UpArrow = forwardRef( +const UpArrow = forwardRef( ( { className, @@ -17,49 +17,46 @@ const UpArrow = forwardRef( ref ) => { return ( - - - - - - - - - - - - - - + + + + + + + + + + + ); } ); diff --git a/packages/wow-icons/src/types/Icon.ts b/packages/wow-icons/src/types/Icon.ts index 3ceb02c3..9718bcb1 100644 --- a/packages/wow-icons/src/types/Icon.ts +++ b/packages/wow-icons/src/types/Icon.ts @@ -1,7 +1,7 @@ import type { HTMLAttributes } from "react"; import type { ColorToken } from "theme/types"; -export interface IconProps extends HTMLAttributes { +export interface IconProps extends HTMLAttributes { className?: string; width?: number | string; height?: number | string; From 476fa301c90f2e6b824126e1bfb5073b160978a3 Mon Sep 17 00:00:00 2001 From: ghdtjgus76 Date: Wed, 29 May 2024 20:13:05 +0900 Subject: [PATCH 19/32] =?UTF-8?q?chore:=20root=20tsconfig=EC=97=90=20style?= =?UTF-8?q?d-system=20exclude=ED=95=98=EB=8F=84=EB=A1=9D=20=EC=84=A4?= =?UTF-8?q?=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tsconfig.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tsconfig.json b/tsconfig.json index 0f80cfd6..a8540e83 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -16,5 +16,6 @@ "skipLibCheck": true, "strict": true, "target": "ES2022" - } + }, + "exclude": ["styled-system"] } From e835760f0809a8ac42f64eea70540aaf8b518a98 Mon Sep 17 00:00:00 2001 From: ghdtjgus76 Date: Wed, 29 May 2024 20:24:31 +0900 Subject: [PATCH 20/32] =?UTF-8?q?chore:=20wow-ui=20=EB=B9=8C=EB=93=9C=20?= =?UTF-8?q?=EC=84=A4=EC=A0=95=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/wow-ui/rollup.config.js | 1 - tsconfig.json | 3 +-- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/packages/wow-ui/rollup.config.js b/packages/wow-ui/rollup.config.js index 4336675a..b4fb9ae9 100644 --- a/packages/wow-ui/rollup.config.js +++ b/packages/wow-ui/rollup.config.js @@ -29,7 +29,6 @@ export default { format: "esm", dir: "dist", entryFileNames: "[name].js", - preserveModules: true, }, { format: "cjs", diff --git a/tsconfig.json b/tsconfig.json index a8540e83..0f80cfd6 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -16,6 +16,5 @@ "skipLibCheck": true, "strict": true, "target": "ES2022" - }, - "exclude": ["styled-system"] + } } From d518a60bc204c8d4a23cb29f8ac40eb84cfe6c9e Mon Sep 17 00:00:00 2001 From: ghdtjgus76 Date: Wed, 29 May 2024 23:45:20 +0900 Subject: [PATCH 21/32] =?UTF-8?q?chore:=20wow-ui=20preserveModules=20?= =?UTF-8?q?=EC=84=A4=EC=A0=95=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/wow-ui/rollup.config.js | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/wow-ui/rollup.config.js b/packages/wow-ui/rollup.config.js index b4fb9ae9..4336675a 100644 --- a/packages/wow-ui/rollup.config.js +++ b/packages/wow-ui/rollup.config.js @@ -29,6 +29,7 @@ export default { format: "esm", dir: "dist", entryFileNames: "[name].js", + preserveModules: true, }, { format: "cjs", From 988a436a1704e582562dcb3db6f67e5fbfa0e07c Mon Sep 17 00:00:00 2001 From: ghdtjgus76 Date: Thu, 30 May 2024 00:20:28 +0900 Subject: [PATCH 22/32] =?UTF-8?q?chore:=20=EC=8A=A4=ED=81=AC=EB=A6=BD?= =?UTF-8?q?=ED=8A=B8=20=EB=B0=8F=20=EC=95=84=EC=9D=B4=EC=BD=98=20=EC=88=98?= =?UTF-8?q?=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/scripts/generateReactComponentFromSvg.ts | 11 ++++++----- packages/wow-icons/src/react/UpArrow.tsx | 2 +- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/packages/scripts/generateReactComponentFromSvg.ts b/packages/scripts/generateReactComponentFromSvg.ts index 62c75b0f..27df0ce9 100644 --- a/packages/scripts/generateReactComponentFromSvg.ts +++ b/packages/scripts/generateReactComponentFromSvg.ts @@ -45,15 +45,16 @@ const createComponentContent = ( const iconName = path.basename(svgFile, ".svg"); const modifiedSvgContent = svgContent .replace(/-(\w)/g, (_, letter) => letter.toUpperCase()) - .replace( - /]*)>/, - `` - ) .replace(/width="(\d+)"/g, `width={width}`) .replace(/height="(\d+)"/g, `height={height}`) .replace(/viewBox="(.*?)"/g, `viewBox={viewBox}`) + .replace(/]*)fill="[^"]*"([^>]*)>/, "") .replace(/fill="([^"]+)"/g, `fill={color[fill]}`) - .replace(/stroke="([^"]+)"/g, `stroke={color[stroke]}`); + .replace(/stroke="([^"]+)"/g, `stroke={color[stroke]}`) + .replace( + /]*)>/, + `` + ); return ` import { forwardRef } from 'react'; diff --git a/packages/wow-icons/src/react/UpArrow.tsx b/packages/wow-icons/src/react/UpArrow.tsx index 25b9d7de..6e6ea4e2 100644 --- a/packages/wow-icons/src/react/UpArrow.tsx +++ b/packages/wow-icons/src/react/UpArrow.tsx @@ -20,7 +20,7 @@ const UpArrow = forwardRef( Date: Thu, 30 May 2024 11:00:27 +0900 Subject: [PATCH 23/32] =?UTF-8?q?chore:=20wow-icons=EC=97=90=20=EC=A0=88?= =?UTF-8?q?=EB=8C=80=20=EA=B2=BD=EB=A1=9C=20=EC=84=A4=EC=A0=95=20=EC=A0=81?= =?UTF-8?q?=EC=9A=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/scripts/generateReactComponentFromSvg.ts | 2 +- packages/wow-icons/src/react/UpArrow.tsx | 2 +- packages/wow-icons/tsconfig.json | 6 +++++- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/packages/scripts/generateReactComponentFromSvg.ts b/packages/scripts/generateReactComponentFromSvg.ts index 27df0ce9..9a1e66a9 100644 --- a/packages/scripts/generateReactComponentFromSvg.ts +++ b/packages/scripts/generateReactComponentFromSvg.ts @@ -60,7 +60,7 @@ const createComponentContent = ( import { forwardRef } from 'react'; import { color } from "wowds-tokens"; - import type { IconProps } from "../types/Icon.ts"; + import type { IconProps } from "@/types/Icon.ts"; const ${componentName} = forwardRef( ({ className, width = 24, height = 24, viewBox = "0 0 24 24", fill = "white", stroke = "white", ...rest }, ref) => { diff --git a/packages/wow-icons/src/react/UpArrow.tsx b/packages/wow-icons/src/react/UpArrow.tsx index 6e6ea4e2..3f98fcfb 100644 --- a/packages/wow-icons/src/react/UpArrow.tsx +++ b/packages/wow-icons/src/react/UpArrow.tsx @@ -1,7 +1,7 @@ import { forwardRef } from "react"; import { color } from "wowds-tokens"; -import type { IconProps } from "../types/Icon.ts"; +import type { IconProps } from "@/types/Icon.ts"; const UpArrow = forwardRef( ( diff --git a/packages/wow-icons/tsconfig.json b/packages/wow-icons/tsconfig.json index 55468894..623cf111 100644 --- a/packages/wow-icons/tsconfig.json +++ b/packages/wow-icons/tsconfig.json @@ -17,7 +17,11 @@ "jsx": "react-jsx", "outDir": "dist", "emitDeclarationOnly": true, - "allowImportingTsExtensions": true + "allowImportingTsExtensions": true, + "baseUrl": ".", + "paths": { + "@/*": ["src/*"] + } }, "include": ["src", "svg.d.ts"], "exclude": ["node_modules", "dist"] From 8ea29c14602adc1c52b47f3b94e1041b7a8b0b07 Mon Sep 17 00:00:00 2001 From: ghdtjgus76 Date: Thu, 30 May 2024 11:06:49 +0900 Subject: [PATCH 24/32] =?UTF-8?q?chore:=20=ED=95=A8=EC=88=98=20=EC=9D=B4?= =?UTF-8?q?=EB=A6=84=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/scripts/generateReactComponentFromSvg.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/packages/scripts/generateReactComponentFromSvg.ts b/packages/scripts/generateReactComponentFromSvg.ts index 9a1e66a9..006ae602 100644 --- a/packages/scripts/generateReactComponentFromSvg.ts +++ b/packages/scripts/generateReactComponentFromSvg.ts @@ -99,16 +99,16 @@ const generateComponentFiles = async (svgComponentMap: SvgComponentMap) => { return components; }; -const generateEntryFile = async (components: string[]) => { - const ENTRY_FILE_PATH = "../wow-icons/src/react/index.ts"; - const entryFileContent = components +const generateExportFile = async (components: string[]) => { + const EXPORT_FILE_PATH = "../wow-icons/src/react/index.ts"; + const exportFileContent = components .map( (component) => `export { default as ${component} } from "./${component}.tsx";` ) .join("\n"); - await fs.writeFile(ENTRY_FILE_PATH, entryFileContent); + await fs.writeFile(EXPORT_FILE_PATH, exportFileContent); }; (async () => { @@ -116,7 +116,7 @@ const generateEntryFile = async (components: string[]) => { const svgComponentMap = await generateSvgComponentMap(); await deleteUnusedComponentFiles(svgComponentMap); const components = await generateComponentFiles(svgComponentMap); - await generateEntryFile(components); + await generateExportFile(components); } catch (error) { console.log("Error generating components:", error); } From 1ffb655450ab1e21d46c6a6235a247abbf610dba Mon Sep 17 00:00:00 2001 From: ghdtjgus76 Date: Thu, 30 May 2024 14:21:06 +0900 Subject: [PATCH 25/32] =?UTF-8?q?chore:=20=EC=BB=B4=ED=8F=AC=EB=84=8C?= =?UTF-8?q?=ED=8A=B8=20=EB=94=94=EB=A0=89=ED=86=A0=EB=A6=AC=20=EC=A1=B4?= =?UTF-8?q?=EC=9E=AC=ED=95=98=EC=A7=80=20=EC=95=8A=EB=8A=94=20=EA=B2=BD?= =?UTF-8?q?=EC=9A=B0=20=EC=98=88=EC=99=B8=20=EC=B2=98=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/scripts/generateReactComponentFromSvg.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/packages/scripts/generateReactComponentFromSvg.ts b/packages/scripts/generateReactComponentFromSvg.ts index 006ae602..72153a58 100644 --- a/packages/scripts/generateReactComponentFromSvg.ts +++ b/packages/scripts/generateReactComponentFromSvg.ts @@ -1,4 +1,4 @@ -import { promises as fs } from "fs"; +import { existsSync, promises as fs } from "fs"; import path from "path"; const SVG_DIR = "../wow-icons/src/svg"; @@ -23,6 +23,11 @@ const generateSvgComponentMap = async () => { }; const deleteUnusedComponentFiles = async (svgComponentMap: SvgComponentMap) => { + if (!existsSync(COMPONENT_DIR)) { + fs.mkdir(COMPONENT_DIR); + return; + } + const componentFiles = await fs.readdir(COMPONENT_DIR); const componentFilesToDelete = componentFiles.filter((componentFile) => { const componentName = path.basename(componentFile, ".tsx"); From fc4a5e35cfa697227103257a0b207818fca5ed4d Mon Sep 17 00:00:00 2001 From: ghdtjgus76 Date: Thu, 30 May 2024 22:46:03 +0900 Subject: [PATCH 26/32] =?UTF-8?q?chore:=20wow-icons=20=EB=A1=A4=EC=97=85?= =?UTF-8?q?=20=EC=A0=88=EB=8C=80=20=EA=B2=BD=EB=A1=9C=20=EC=84=A4=EC=A0=95?= =?UTF-8?q?=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/wow-icons/rollup.config.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/packages/wow-icons/rollup.config.js b/packages/wow-icons/rollup.config.js index ab1edc1c..01951be2 100644 --- a/packages/wow-icons/rollup.config.js +++ b/packages/wow-icons/rollup.config.js @@ -3,6 +3,8 @@ import babel from "@rollup/plugin-babel"; import svgr from "@svgr/rollup"; import url from "@rollup/plugin-url"; import typescript from "@rollup/plugin-typescript"; +import alias from "@rollup/plugin-alias"; +import path from "path"; const extensions = [".ts", ".tsx", ".js", ".jsx"]; @@ -19,5 +21,8 @@ export default { url(), svgr(), typescript(), + alias({ + entries: [{ find: "@", replacement: path.join(__dirname, "./src") }], + }), ], }; From 8c1f90d6c448a917ee4022765d036743c21b417a Mon Sep 17 00:00:00 2001 From: ghdtjgus76 Date: Fri, 31 May 2024 00:55:50 +0900 Subject: [PATCH 27/32] =?UTF-8?q?chore:=20=EC=9D=98=EC=A1=B4=EC=84=B1=20?= =?UTF-8?q?=EC=A0=95=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.json | 6 +- pnpm-lock.yaml | 277 +------------------------------------------------ 2 files changed, 6 insertions(+), 277 deletions(-) diff --git a/package.json b/package.json index 7e45312d..0d29aa39 100644 --- a/package.json +++ b/package.json @@ -26,13 +26,13 @@ "@changesets/changelog-git": "^0.2.0", "@changesets/cli": "^2.27.1", "@pandacss/dev": "^0.39.0", + "@rollup/plugin-alias": "^5.1.0", "@rollup/plugin-babel": "^6.0.4", "@rollup/plugin-commonjs": "^25.0.7", "@rollup/plugin-json": "^6.1.0", "@rollup/plugin-node-resolve": "^15.2.3", "@rollup/plugin-terser": "^0.4.4", "@rollup/plugin-url": "^8.0.2", - "@svgr/rollup": "^8.1.0", "@testing-library/jest-dom": "^6.4.5", "@testing-library/react": "^15.0.7", "@testing-library/user-event": "^14.5.2", @@ -70,12 +70,12 @@ "rollup-plugin-preserve-directives": "^0.4.0", "shared-config": "workspace:^", "theme": "workspace:^", - "wowds-tokens": "workspace:^", "ts-jest": "^29.1.2", "ts-node": "^10.9.2", "tsx": "^4.11.0", "turbo": "latest", - "typescript": "^5.3.3" + "typescript": "^5.3.3", + "wowds-tokens": "workspace:^" }, "packageManager": "pnpm@8.9.0", "engines": { diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 0cadbf32..574d2686 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -30,6 +30,9 @@ importers: '@pandacss/dev': specifier: ^0.39.0 version: 0.39.0(typescript@5.3.3) + '@rollup/plugin-alias': + specifier: ^5.1.0 + version: 5.1.0(rollup@4.17.2) '@rollup/plugin-babel': specifier: ^6.0.4 version: 6.0.4(@babel/core@7.24.5)(rollup@4.17.2) @@ -48,9 +51,6 @@ importers: '@rollup/plugin-url': specifier: ^8.0.2 version: 8.0.2(rollup@4.17.2) - '@svgr/rollup': - specifier: ^8.1.0 - version: 8.1.0(rollup@4.17.2)(typescript@5.3.3) '@testing-library/jest-dom': specifier: ^6.4.5 version: 6.4.5(@types/jest@29.5.12)(jest@29.7.0) @@ -255,9 +255,6 @@ importers: '@chromatic-com/storybook': specifier: ^1.3.3 version: 1.3.3(react@18.2.0) - '@rollup/plugin-alias': - specifier: ^5.1.0 - version: 5.1.0(rollup@4.17.2) '@rollup/plugin-typescript': specifier: ^11.1.6 version: 11.1.6(rollup@4.17.2)(typescript@5.3.3) @@ -1394,16 +1391,6 @@ packages: '@babel/helper-plugin-utils': 7.24.5 dev: true - /@babel/plugin-transform-react-constant-elements@7.24.1(@babel/core@7.24.5): - resolution: {integrity: sha512-QXp1U9x0R7tkiGB0FOk8o74jhnap0FlZ5gNkRIWdG3eP+SvMFg118e1zaWewDzgABb106QSKpVsD3Wgd8t6ifA==} - engines: {node: '>=6.9.0'} - peerDependencies: - '@babel/core': ^7.0.0-0 - dependencies: - '@babel/core': 7.24.5 - '@babel/helper-plugin-utils': 7.24.5 - dev: true - /@babel/plugin-transform-react-display-name@7.24.1(@babel/core@7.24.5): resolution: {integrity: sha512-mvoQg2f9p2qlpDQRBC7M3c3XTr0k7cp/0+kFKKO/7Gtu0LSw16eKB+Fabe2bDT/UpsyasTBBkAnbdsLrkD5XMw==} engines: {node: '>=6.9.0'} @@ -5202,165 +5189,6 @@ packages: file-system-cache: 2.3.0 dev: true - /@svgr/babel-plugin-add-jsx-attribute@8.0.0(@babel/core@7.24.5): - resolution: {integrity: sha512-b9MIk7yhdS1pMCZM8VeNfUlSKVRhsHZNMl5O9SfaX0l0t5wjdgu4IDzGB8bpnGBBOjGST3rRFVsaaEtI4W6f7g==} - engines: {node: '>=14'} - peerDependencies: - '@babel/core': ^7.0.0-0 - dependencies: - '@babel/core': 7.24.5 - dev: true - - /@svgr/babel-plugin-remove-jsx-attribute@8.0.0(@babel/core@7.24.5): - resolution: {integrity: sha512-BcCkm/STipKvbCl6b7QFrMh/vx00vIP63k2eM66MfHJzPr6O2U0jYEViXkHJWqXqQYjdeA9cuCl5KWmlwjDvbA==} - engines: {node: '>=14'} - peerDependencies: - '@babel/core': ^7.0.0-0 - dependencies: - '@babel/core': 7.24.5 - dev: true - - /@svgr/babel-plugin-remove-jsx-empty-expression@8.0.0(@babel/core@7.24.5): - resolution: {integrity: sha512-5BcGCBfBxB5+XSDSWnhTThfI9jcO5f0Ai2V24gZpG+wXF14BzwxxdDb4g6trdOux0rhibGs385BeFMSmxtS3uA==} - engines: {node: '>=14'} - peerDependencies: - '@babel/core': ^7.0.0-0 - dependencies: - '@babel/core': 7.24.5 - dev: true - - /@svgr/babel-plugin-replace-jsx-attribute-value@8.0.0(@babel/core@7.24.5): - resolution: {integrity: sha512-KVQ+PtIjb1BuYT3ht8M5KbzWBhdAjjUPdlMtpuw/VjT8coTrItWX6Qafl9+ji831JaJcu6PJNKCV0bp01lBNzQ==} - engines: {node: '>=14'} - peerDependencies: - '@babel/core': ^7.0.0-0 - dependencies: - '@babel/core': 7.24.5 - dev: true - - /@svgr/babel-plugin-svg-dynamic-title@8.0.0(@babel/core@7.24.5): - resolution: {integrity: sha512-omNiKqwjNmOQJ2v6ge4SErBbkooV2aAWwaPFs2vUY7p7GhVkzRkJ00kILXQvRhA6miHnNpXv7MRnnSjdRjK8og==} - engines: {node: '>=14'} - peerDependencies: - '@babel/core': ^7.0.0-0 - dependencies: - '@babel/core': 7.24.5 - dev: true - - /@svgr/babel-plugin-svg-em-dimensions@8.0.0(@babel/core@7.24.5): - resolution: {integrity: sha512-mURHYnu6Iw3UBTbhGwE/vsngtCIbHE43xCRK7kCw4t01xyGqb2Pd+WXekRRoFOBIY29ZoOhUCTEweDMdrjfi9g==} - engines: {node: '>=14'} - peerDependencies: - '@babel/core': ^7.0.0-0 - dependencies: - '@babel/core': 7.24.5 - dev: true - - /@svgr/babel-plugin-transform-react-native-svg@8.1.0(@babel/core@7.24.5): - resolution: {integrity: sha512-Tx8T58CHo+7nwJ+EhUwx3LfdNSG9R2OKfaIXXs5soiy5HtgoAEkDay9LIimLOcG8dJQH1wPZp/cnAv6S9CrR1Q==} - engines: {node: '>=14'} - peerDependencies: - '@babel/core': ^7.0.0-0 - dependencies: - '@babel/core': 7.24.5 - dev: true - - /@svgr/babel-plugin-transform-svg-component@8.0.0(@babel/core@7.24.5): - resolution: {integrity: sha512-DFx8xa3cZXTdb/k3kfPeaixecQLgKh5NVBMwD0AQxOzcZawK4oo1Jh9LbrcACUivsCA7TLG8eeWgrDXjTMhRmw==} - engines: {node: '>=12'} - peerDependencies: - '@babel/core': ^7.0.0-0 - dependencies: - '@babel/core': 7.24.5 - dev: true - - /@svgr/babel-preset@8.1.0(@babel/core@7.24.5): - resolution: {integrity: sha512-7EYDbHE7MxHpv4sxvnVPngw5fuR6pw79SkcrILHJ/iMpuKySNCl5W1qcwPEpU+LgyRXOaAFgH0KhwD18wwg6ug==} - engines: {node: '>=14'} - peerDependencies: - '@babel/core': ^7.0.0-0 - dependencies: - '@babel/core': 7.24.5 - '@svgr/babel-plugin-add-jsx-attribute': 8.0.0(@babel/core@7.24.5) - '@svgr/babel-plugin-remove-jsx-attribute': 8.0.0(@babel/core@7.24.5) - '@svgr/babel-plugin-remove-jsx-empty-expression': 8.0.0(@babel/core@7.24.5) - '@svgr/babel-plugin-replace-jsx-attribute-value': 8.0.0(@babel/core@7.24.5) - '@svgr/babel-plugin-svg-dynamic-title': 8.0.0(@babel/core@7.24.5) - '@svgr/babel-plugin-svg-em-dimensions': 8.0.0(@babel/core@7.24.5) - '@svgr/babel-plugin-transform-react-native-svg': 8.1.0(@babel/core@7.24.5) - '@svgr/babel-plugin-transform-svg-component': 8.0.0(@babel/core@7.24.5) - dev: true - - /@svgr/core@8.1.0(typescript@5.3.3): - resolution: {integrity: sha512-8QqtOQT5ACVlmsvKOJNEaWmRPmcojMOzCz4Hs2BGG/toAp/K38LcsMRyLp349glq5AzJbCEeimEoxaX6v/fLrA==} - engines: {node: '>=14'} - dependencies: - '@babel/core': 7.24.5 - '@svgr/babel-preset': 8.1.0(@babel/core@7.24.5) - camelcase: 6.3.0 - cosmiconfig: 8.3.6(typescript@5.3.3) - snake-case: 3.0.4 - transitivePeerDependencies: - - supports-color - - typescript - dev: true - - /@svgr/hast-util-to-babel-ast@8.0.0: - resolution: {integrity: sha512-EbDKwO9GpfWP4jN9sGdYwPBU0kdomaPIL2Eu4YwmgP+sJeXT+L7bMwJUBnhzfH8Q2qMBqZ4fJwpCyYsAN3mt2Q==} - engines: {node: '>=14'} - dependencies: - '@babel/types': 7.24.5 - entities: 4.5.0 - dev: true - - /@svgr/plugin-jsx@8.1.0(@svgr/core@8.1.0): - resolution: {integrity: sha512-0xiIyBsLlr8quN+WyuxooNW9RJ0Dpr8uOnH/xrCVO8GLUcwHISwj1AG0k+LFzteTkAA0GbX0kj9q6Dk70PTiPA==} - engines: {node: '>=14'} - peerDependencies: - '@svgr/core': '*' - dependencies: - '@babel/core': 7.24.5 - '@svgr/babel-preset': 8.1.0(@babel/core@7.24.5) - '@svgr/core': 8.1.0(typescript@5.3.3) - '@svgr/hast-util-to-babel-ast': 8.0.0 - svg-parser: 2.0.4 - transitivePeerDependencies: - - supports-color - dev: true - - /@svgr/plugin-svgo@8.1.0(@svgr/core@8.1.0)(typescript@5.3.3): - resolution: {integrity: sha512-Ywtl837OGO9pTLIN/onoWLmDQ4zFUycI1g76vuKGEz6evR/ZTJlJuz3G/fIkb6OVBJ2g0o6CGJzaEjfmEo3AHA==} - engines: {node: '>=14'} - peerDependencies: - '@svgr/core': '*' - dependencies: - '@svgr/core': 8.1.0(typescript@5.3.3) - cosmiconfig: 8.3.6(typescript@5.3.3) - deepmerge: 4.3.1 - svgo: 3.2.0 - transitivePeerDependencies: - - typescript - dev: true - - /@svgr/rollup@8.1.0(rollup@4.17.2)(typescript@5.3.3): - resolution: {integrity: sha512-0XR1poYvPQoPpmfDYLEqUGu5ePAQ4pdgN3VFsZBNAeze7qubVpsIY1o1R6PZpKep/DKu33GSm2NhwpCLkMs2Cw==} - engines: {node: '>=14'} - dependencies: - '@babel/core': 7.24.5 - '@babel/plugin-transform-react-constant-elements': 7.24.1(@babel/core@7.24.5) - '@babel/preset-env': 7.24.5(@babel/core@7.24.5) - '@babel/preset-react': 7.24.1(@babel/core@7.24.5) - '@babel/preset-typescript': 7.24.1(@babel/core@7.24.5) - '@rollup/pluginutils': 5.1.0(rollup@4.17.2) - '@svgr/core': 8.1.0(typescript@5.3.3) - '@svgr/plugin-jsx': 8.1.0(@svgr/core@8.1.0) - '@svgr/plugin-svgo': 8.1.0(@svgr/core@8.1.0)(typescript@5.3.3) - transitivePeerDependencies: - - rollup - - supports-color - - typescript - dev: true - /@swc/core-darwin-arm64@1.4.17: resolution: {integrity: sha512-HVl+W4LezoqHBAYg2JCqR+s9ife9yPfgWSj37iIawLWzOmuuJ7jVdIB7Ee2B75bEisSEKyxRlTl6Y1Oq3owBgw==} engines: {node: '>=10'} @@ -5619,11 +5447,6 @@ packages: resolution: {integrity: sha512-C5Mc6rdnsaJDjO3UpGW/CQTHtCKaYlScZTly4JIu97Jxo/odCiH0ITnDXSJPTOrEKk/ycSZ0AOgTmkDtkOsvIA==} dev: true - /@trysound/sax@0.2.0: - resolution: {integrity: sha512-L7z9BgrNEcYyUYtF+HaEfiS5ebkh9jXqbszz7pC0hRBPaatV0XjSD3+eHrpqFemQfgwiFF0QPIarnIihIDn7OA==} - engines: {node: '>=10.13.0'} - dev: true - /@ts-morph/common@0.22.0: resolution: {integrity: sha512-HqNBuV/oIlMKdkLshXd1zKBqNQCsuPEsgQOkfFQ/eUKjRlwndXW1AjN9LVkBEIukm00gGXSRmfkl0Wv5VXLnlw==} dependencies: @@ -7930,11 +7753,6 @@ packages: engines: {node: '>= 6'} dev: true - /commander@7.2.0: - resolution: {integrity: sha512-QrWXB+ZQSVPmIWIhtEO9H+gwHaMGYiF5ChvoJ+K9ZGHG/sVsa6yiesAD1GC/x46sET00Xlwo1u49RVVVzvcSkw==} - engines: {node: '>= 10'} - dev: true - /commander@8.3.0: resolution: {integrity: sha512-OkTL9umf+He2DZkUq8f8J9of7yL6RJKI24dVITBmNfZBmri9zYZQrKkuXiKhyfPSu8tUhnVBB1iKXevvnlR4Ww==} engines: {node: '>= 12'} @@ -8211,32 +8029,6 @@ packages: nth-check: 2.1.1 dev: true - /css-select@5.1.0: - resolution: {integrity: sha512-nwoRF1rvRRnnCqqY7updORDsuqKzqYJ28+oSMaJMMgOauh3fvwHqMS7EZpIPqK8GL+g9mKxF1vP/ZjSeNjEVHg==} - dependencies: - boolbase: 1.0.0 - css-what: 6.1.0 - domhandler: 5.0.3 - domutils: 3.1.0 - nth-check: 2.1.1 - dev: true - - /css-tree@2.2.1: - resolution: {integrity: sha512-OA0mILzGc1kCOCSJerOeqDxDQ4HOh+G8NbOJFOTgOCzpw7fCBubk0fEyxp8AgOL/jvLgYA/uV0cMbe43ElF1JA==} - engines: {node: ^10 || ^12.20.0 || ^14.13.0 || >=15.0.0, npm: '>=7.0.0'} - dependencies: - mdn-data: 2.0.28 - source-map-js: 1.0.2 - dev: true - - /css-tree@2.3.1: - resolution: {integrity: sha512-6Fv1DV/TYw//QF5IzQdqsNDjx/wc8TrMBZsqjL9eW01tWb7R7k/mq+/VXfJCl7SoD5emsJop9cOByJZfs8hYIw==} - engines: {node: ^10 || ^12.20.0 || ^14.13.0 || >=15.0.0} - dependencies: - mdn-data: 2.0.30 - source-map-js: 1.0.2 - dev: true - /css-what@6.1.0: resolution: {integrity: sha512-HTUrgRJ7r4dsZKU6GjmpfRK1O76h97Z8MfS1G0FozR+oF2kG6Vfe8JE6zwrkbxigziPHinCJ+gCPjA9EaBDtRw==} engines: {node: '>= 6'} @@ -8261,13 +8053,6 @@ packages: postcss: 8.4.35 dev: true - /csso@5.0.5: - resolution: {integrity: sha512-0LrrStPOdJj+SPCCrGhzryycLjwcgUSHBtxNA8aIDxf0GLsRh1cKYhB00Gd1lDOS4yGH69+SNn13+TWbVHETFQ==} - engines: {node: ^10 || ^12.20.0 || ^14.13.0 || >=15.0.0, npm: '>=7.0.0'} - dependencies: - css-tree: 2.2.1 - dev: true - /cssom@0.3.8: resolution: {integrity: sha512-b0tGHbfegbhPJpxpiBPU2sCkigAqtM9O121le6bbOlgyV+NyGyCmVfJ6QW9eRjz8CpNfWEOYBIMIGRYkLwsIYg==} dev: true @@ -8720,14 +8505,6 @@ packages: entities: 2.2.0 dev: true - /dom-serializer@2.0.0: - resolution: {integrity: sha512-wIkAryiqt/nV5EQKqQpo3SToSOV9J0DnbJqwK7Wv/Trc92zIAYZ4FlMu+JPFW1DfGFt81ZTCGgDEabffXeLyJg==} - dependencies: - domelementtype: 2.3.0 - domhandler: 5.0.3 - entities: 4.5.0 - dev: true - /domain-browser@4.23.0: resolution: {integrity: sha512-ArzcM/II1wCCujdCNyQjXrAFwS4mrLh4C7DZWlaI8mdh7h3BfKdNd3bKXITfl2PT9FtfQqaGvhi1vPRQPimjGA==} engines: {node: '>=10'} @@ -8762,13 +8539,6 @@ packages: domelementtype: 2.3.0 dev: true - /domhandler@5.0.3: - resolution: {integrity: sha512-cgwlv/1iFQiFnU96XXgROh8xTeetsnJiDsTc7TYCLFd9+/WNkIqPTxiM/8pSd8VIrhXGTf1Ny1q1hquVqDJB5w==} - engines: {node: '>= 4'} - dependencies: - domelementtype: 2.3.0 - dev: true - /domutils@1.7.0: resolution: {integrity: sha512-Lgd2XcJ/NjEw+7tFvfKxOzCYKZsdct5lczQ2ZaQY8Djz7pfAD3Gbp8ySJWtreII/vDlMVmxwa6pHmdxIYgttDg==} dependencies: @@ -8784,14 +8554,6 @@ packages: domhandler: 4.3.1 dev: true - /domutils@3.1.0: - resolution: {integrity: sha512-H78uMmQtI2AhgDJjWeQmHwJJ2bLPD3GMmO7Zja/ZZh84wkm+4ut+IUnUdRa8uCGX88DiVx1j6FRe1XfxEgjEZA==} - dependencies: - dom-serializer: 2.0.0 - domelementtype: 2.3.0 - domhandler: 5.0.3 - dev: true - /dot-case@2.1.1: resolution: {integrity: sha512-HnM6ZlFqcajLsyudHq7LeeLDr2rFAVYtDv/hV5qchQEidSck8j9OPUsXY9KwJv/lHMtYlX4DjRQqwFYa+0r8Ug==} dependencies: @@ -12629,14 +12391,6 @@ packages: resolution: {integrity: sha512-jVU0Nr2B9X3MU4tSK7JP1CMkSvOj7X5l/GboG1tKRw52lLF1x2Ju92Ms9tNetCcbfX3hzlM73zYo2NKkWSfF/A==} dev: true - /mdn-data@2.0.28: - resolution: {integrity: sha512-aylIc7Z9y4yzHYAJNuESG3hfhC+0Ibp/MAMiaOZgNv4pmEdFyfZhhhny4MNiAfWdBQ1RQ2mfDWmM1x8SvGyp8g==} - dev: true - - /mdn-data@2.0.30: - resolution: {integrity: sha512-GaqWWShW4kv/G9IEucWScBx9G1/vsFZZJUO+tD26M8J8z3Kw5RDQjaoZe03YAClgeS/SWPOcb4nkFBTEi5DUEA==} - dev: true - /media-typer@0.3.0: resolution: {integrity: sha512-dq+qelQ9akHpcOl/gUVRTxVIOkAJ1wR3QAvb4RsVjS8oVoFjDGTc679wJYmUmknUF5HwMLOgb5O+a3KxfWapPQ==} engines: {node: '>= 0.6'} @@ -15181,13 +14935,6 @@ packages: no-case: 2.3.2 dev: true - /snake-case@3.0.4: - resolution: {integrity: sha512-LAOh4z89bGQvl9pFfNF8V146i7o7/CqFPbqzYgP+yYzDIDeS9HaNFtXABamRW+AQzEVODcvE79ljJ+8a9YSdMg==} - dependencies: - dot-case: 3.0.4 - tslib: 2.6.2 - dev: true - /socks-proxy-agent@8.0.1: resolution: {integrity: sha512-59EjPbbgg8U3x62hhKOFVAmySQUcfRQ4C7Q/D5sEHnZTQRrQlNKINks44DMR1gwXp0p4LaVIeccX2KHTTcHVqQ==} engines: {node: '>= 14'} @@ -15613,24 +15360,6 @@ packages: engines: {node: '>= 0.4'} dev: true - /svg-parser@2.0.4: - resolution: {integrity: sha512-e4hG1hRwoOdRb37cIMSgzNsxyzKfayW6VOflrwvR+/bzrkyxY/31WkbgnQpgtrNp1SdpJvpUAGTa/ZoiPNDuRQ==} - dev: true - - /svgo@3.2.0: - resolution: {integrity: sha512-4PP6CMW/V7l/GmKRKzsLR8xxjdHTV4IMvhTnpuHwwBazSIlw5W/5SmPjN8Dwyt7lKbSJrRDgp4t9ph0HgChFBQ==} - engines: {node: '>=14.0.0'} - hasBin: true - dependencies: - '@trysound/sax': 0.2.0 - commander: 7.2.0 - css-select: 5.1.0 - css-tree: 2.3.1 - css-what: 6.1.0 - csso: 5.0.5 - picocolors: 1.0.0 - dev: true - /swap-case@1.1.2: resolution: {integrity: sha512-BAmWG6/bx8syfc6qXPprof3Mn5vQgf5dwdUNJhsNqU9WdPt5P+ES/wQ5bxfijy8zwZgZZHslC3iAsxsuQMCzJQ==} dependencies: From c1a56a861b10e342a20e0c1e1b4c43079bca2893 Mon Sep 17 00:00:00 2001 From: ghdtjgus76 Date: Fri, 31 May 2024 00:56:11 +0900 Subject: [PATCH 28/32] =?UTF-8?q?chore:=20=EC=95=84=EC=9D=B4=EC=BD=98=20?= =?UTF-8?q?=ED=83=80=EC=9E=85=20=EC=B6=94=EB=A1=A0=20=EA=B4=80=EB=A0=A8=20?= =?UTF-8?q?=EC=84=A4=EC=A0=95=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/scripts/generateReactComponentFromSvg.ts | 2 +- packages/wow-icons/rollup.config.js | 7 +------ packages/wow-icons/src/react/UpArrow.tsx | 2 +- packages/wow-ui/package.json | 1 - packages/wow-ui/rollup.config.js | 2 -- 5 files changed, 3 insertions(+), 11 deletions(-) diff --git a/packages/scripts/generateReactComponentFromSvg.ts b/packages/scripts/generateReactComponentFromSvg.ts index 72153a58..cdc94df1 100644 --- a/packages/scripts/generateReactComponentFromSvg.ts +++ b/packages/scripts/generateReactComponentFromSvg.ts @@ -65,7 +65,7 @@ const createComponentContent = ( import { forwardRef } from 'react'; import { color } from "wowds-tokens"; - import type { IconProps } from "@/types/Icon.ts"; + import type { IconProps } from "../types/Icon.ts"; const ${componentName} = forwardRef( ({ className, width = 24, height = 24, viewBox = "0 0 24 24", fill = "white", stroke = "white", ...rest }, ref) => { diff --git a/packages/wow-icons/rollup.config.js b/packages/wow-icons/rollup.config.js index 01951be2..e349297f 100644 --- a/packages/wow-icons/rollup.config.js +++ b/packages/wow-icons/rollup.config.js @@ -1,10 +1,9 @@ import baseConfig from "../shared-config/rollup.config.js"; import babel from "@rollup/plugin-babel"; -import svgr from "@svgr/rollup"; import url from "@rollup/plugin-url"; import typescript from "@rollup/plugin-typescript"; -import alias from "@rollup/plugin-alias"; import path from "path"; +import { fileURLToPath } from "url"; const extensions = [".ts", ".tsx", ".js", ".jsx"]; @@ -19,10 +18,6 @@ export default { babelHelpers: "runtime", }), url(), - svgr(), typescript(), - alias({ - entries: [{ find: "@", replacement: path.join(__dirname, "./src") }], - }), ], }; diff --git a/packages/wow-icons/src/react/UpArrow.tsx b/packages/wow-icons/src/react/UpArrow.tsx index 3f98fcfb..6e6ea4e2 100644 --- a/packages/wow-icons/src/react/UpArrow.tsx +++ b/packages/wow-icons/src/react/UpArrow.tsx @@ -1,7 +1,7 @@ import { forwardRef } from "react"; import { color } from "wowds-tokens"; -import type { IconProps } from "@/types/Icon.ts"; +import type { IconProps } from "../types/Icon.ts"; const UpArrow = forwardRef( ( diff --git a/packages/wow-ui/package.json b/packages/wow-ui/package.json index 07d1f954..920f10dd 100644 --- a/packages/wow-ui/package.json +++ b/packages/wow-ui/package.json @@ -54,7 +54,6 @@ }, "devDependencies": { "@chromatic-com/storybook": "^1.3.3", - "@rollup/plugin-alias": "^5.1.0", "@rollup/plugin-typescript": "^11.1.6", "@storybook/addon-a11y": "^7.5.3", "@storybook/addon-essentials": "^7.5.3", diff --git a/packages/wow-ui/rollup.config.js b/packages/wow-ui/rollup.config.js index 4336675a..04df3ac6 100644 --- a/packages/wow-ui/rollup.config.js +++ b/packages/wow-ui/rollup.config.js @@ -1,7 +1,6 @@ import alias from "@rollup/plugin-alias"; import json from "@rollup/plugin-json"; import terser from "@rollup/plugin-terser"; -import svgr from "@svgr/rollup"; import path from "path"; import commonjs from "@rollup/plugin-commonjs"; import resolve from "@rollup/plugin-node-resolve"; @@ -68,7 +67,6 @@ export default { babelHelpers: "runtime", }), url(), - svgr(), terser(), json(), preserveDirectives.default(), From 0704e9b6f56c923e083ecdd4a9e99e99adce5c2d Mon Sep 17 00:00:00 2001 From: ghdtjgus76 Date: Fri, 31 May 2024 01:30:43 +0900 Subject: [PATCH 29/32] =?UTF-8?q?chore:=20stroke/fill=20=ED=8F=AC=ED=95=A8?= =?UTF-8?q?=20=EC=97=AC=EB=B6=80=EC=97=90=20=EB=94=B0=EB=9D=BC=20props=20?= =?UTF-8?q?=EA=B5=AC=EC=84=B1=ED=95=98=EB=8F=84=EB=A1=9D=20=EC=8A=A4?= =?UTF-8?q?=ED=81=AC=EB=A6=BD=ED=8A=B8=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/scripts/generateReactComponentFromSvg.ts | 8 +++++++- packages/wow-icons/src/react/UpArrow.tsx | 2 +- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/packages/scripts/generateReactComponentFromSvg.ts b/packages/scripts/generateReactComponentFromSvg.ts index cdc94df1..1e6a3838 100644 --- a/packages/scripts/generateReactComponentFromSvg.ts +++ b/packages/scripts/generateReactComponentFromSvg.ts @@ -48,6 +48,12 @@ const createComponentContent = ( svgFile: string ): string => { const iconName = path.basename(svgFile, ".svg"); + const hasStroke = svgContent.includes("stroke="); + const fillAttributes = (svgContent.match(/fill="([^"]*)"/g) || []).filter( + (attr) => attr !== 'fill="none"' + ); + const hasFill = fillAttributes.length; + const propsString = `{ className, width = 24, height = 24, viewBox = "0 0 24 24"${hasStroke || hasFill ? ` ${hasStroke ? ', stroke = "white"' : ""}${hasFill ? ', fill = "white"' : ""}` : ""}, ...rest }`; const modifiedSvgContent = svgContent .replace(/-(\w)/g, (_, letter) => letter.toUpperCase()) .replace(/width="(\d+)"/g, `width={width}`) @@ -68,7 +74,7 @@ const createComponentContent = ( import type { IconProps } from "../types/Icon.ts"; const ${componentName} = forwardRef( - ({ className, width = 24, height = 24, viewBox = "0 0 24 24", fill = "white", stroke = "white", ...rest }, ref) => { + (${propsString}, ref) => { return ( ${modifiedSvgContent} ); diff --git a/packages/wow-icons/src/react/UpArrow.tsx b/packages/wow-icons/src/react/UpArrow.tsx index 6e6ea4e2..3a3de5e3 100644 --- a/packages/wow-icons/src/react/UpArrow.tsx +++ b/packages/wow-icons/src/react/UpArrow.tsx @@ -10,8 +10,8 @@ const UpArrow = forwardRef( width = 24, height = 24, viewBox = "0 0 24 24", - fill = "white", stroke = "white", + fill = "white", ...rest }, ref From 7efae93745d65e22f4de7f2ebfe620647baf8500 Mon Sep 17 00:00:00 2001 From: ghdtjgus76 Date: Fri, 31 May 2024 01:41:29 +0900 Subject: [PATCH 30/32] =?UTF-8?q?chore:=20=EC=95=88=20=EC=93=B0=EB=8A=94?= =?UTF-8?q?=20import=EB=AC=B8=20=EC=82=AD=EC=A0=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/wow-icons/rollup.config.js | 2 -- 1 file changed, 2 deletions(-) diff --git a/packages/wow-icons/rollup.config.js b/packages/wow-icons/rollup.config.js index e349297f..a5fd4e57 100644 --- a/packages/wow-icons/rollup.config.js +++ b/packages/wow-icons/rollup.config.js @@ -2,8 +2,6 @@ import baseConfig from "../shared-config/rollup.config.js"; import babel from "@rollup/plugin-babel"; import url from "@rollup/plugin-url"; import typescript from "@rollup/plugin-typescript"; -import path from "path"; -import { fileURLToPath } from "url"; const extensions = [".ts", ".tsx", ".js", ".jsx"]; From 4f29092690be1372cd61a6bf88997af96024d4e3 Mon Sep 17 00:00:00 2001 From: ghdtjgus76 Date: Fri, 31 May 2024 01:41:43 +0900 Subject: [PATCH 31/32] =?UTF-8?q?chore:=20format=20=EC=8A=A4=ED=81=AC?= =?UTF-8?q?=EB=A6=BD=ED=8A=B8=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/wow-icons/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/wow-icons/package.json b/packages/wow-icons/package.json index e15afc38..ec4a9de7 100644 --- a/packages/wow-icons/package.json +++ b/packages/wow-icons/package.json @@ -29,7 +29,7 @@ "build": "pnpm generate:icons && rm -rf dist && rollup -c --bundleConfigAsCjs && tsc --emitDeclarationOnly", "generate:icons": "tsx ../scripts/generateReactComponentFromSvg.ts && pnpm format && pnpm lint", "lint": "eslint --fix ./src/react/**/*.tsx", - "format": "prettier --write ./src/react/**/*.tsx ./src/react/index.ts" + "format": "prettier --write ./src/react/**/*" }, "keywords": [], "author": "gdsc-hongik", From 8d3940286a1fd41b4996853973b0e5475c84ab08 Mon Sep 17 00:00:00 2001 From: ghdtjgus76 Date: Fri, 31 May 2024 01:42:07 +0900 Subject: [PATCH 32/32] =?UTF-8?q?chore:=20=EC=9D=B4=EB=AF=B8=20=EC=83=9D?= =?UTF-8?q?=EC=84=B1=EB=90=9C=20=EC=BB=B4=ED=8F=AC=EB=84=8C=ED=8A=B8?= =?UTF-8?q?=EB=8A=94=20=EB=8B=A4=EC=8B=9C=20=EC=93=B0=EC=A7=80=20=EC=95=8A?= =?UTF-8?q?=EB=8F=84=EB=A1=9D=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../scripts/generateReactComponentFromSvg.ts | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/packages/scripts/generateReactComponentFromSvg.ts b/packages/scripts/generateReactComponentFromSvg.ts index 1e6a3838..0c88b161 100644 --- a/packages/scripts/generateReactComponentFromSvg.ts +++ b/packages/scripts/generateReactComponentFromSvg.ts @@ -87,9 +87,19 @@ const createComponentContent = ( }; const generateComponentFiles = async (svgComponentMap: SvgComponentMap) => { - const components = []; + const components: string[] = []; for (const [componentName, svgFile] of Object.entries(svgComponentMap)) { + const componentFilePath = path.resolve( + COMPONENT_DIR, + `${componentName}.tsx` + ); + + if (existsSync(componentFilePath)) { + components.push(componentName); + continue; + } + const svgFilePath = path.resolve(SVG_DIR, svgFile); const svgContent = (await fs.readFile(svgFilePath)).toString(); @@ -98,10 +108,6 @@ const generateComponentFiles = async (svgComponentMap: SvgComponentMap) => { svgContent, svgFile ); - const componentFilePath = path.resolve( - COMPONENT_DIR, - `${componentName}.tsx` - ); await fs.writeFile(componentFilePath, componentContent); components.push(componentName);