-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: generate font files use `svgtofont` * chore: add ignore package in changeset config
- Loading branch information
1 parent
ba28fa2
commit af4efe8
Showing
178 changed files
with
7,727 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
--- | ||
"@icona/generator": minor | ||
"@icona/types": minor | ||
"@icona/utils": minor | ||
--- | ||
|
||
- (generator) Added `svgtofont` package to generate `font` (eot, ttf, woff, woff2, svg) files from `SVG` files. | ||
- (generator) Added `config.font` method in `generate` function to generate `font` files. | ||
- (generator) Added `generateFont` method |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added
BIN
+9.16 KB
.yarn/cache/is-accessor-descriptor-npm-1.0.1-0a6049222f-8db44c0223.zip
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added
BIN
+7.62 KB
.yarn/cache/parse5-htmlparser2-tree-adapter-npm-7.0.0-38e1b3a974-fc5d01e077.zip
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added
BIN
+3.98 KB
.yarn/cache/posix-character-classes-npm-0.1.1-3e228a6e15-dedb99913c.zip
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added
BIN
+19.7 KB
.yarn/cache/ts-interface-checker-npm-0.1.13-0c7b064494-20c29189c2.zip
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1 @@ | ||
dist | ||
|
||
# for test | ||
svg | ||
react | ||
png | ||
drawable | ||
.icona | ||
icona.js |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
import type { GenerateFontConfig } from "@icona/types"; | ||
import { deleteAllFilesInDir, getProjectRootPath } from "@icona/utils"; | ||
import { resolve } from "path"; | ||
import svgtofont from "svgtofont"; | ||
|
||
interface GenerateFontFunction { | ||
/** | ||
* @description Icona icons data | ||
* @default .icona/icons.json | ||
*/ | ||
config: GenerateFontConfig; | ||
} | ||
|
||
/** | ||
* @description SVG 폴더를 기준으로 폰트 파일들을 생성합니다. | ||
*/ | ||
export const generateFont = ({ config }: GenerateFontFunction) => { | ||
const { genMode, svgToFontOptions } = config; | ||
|
||
const projectPath = getProjectRootPath(); | ||
|
||
const src = resolve(projectPath, svgToFontOptions?.src || "svg"); | ||
const dist = resolve(projectPath, svgToFontOptions?.dist || "font"); | ||
// NOTE: css 옵션을 넣어주지 않으면 error가 throw됨 | ||
const css = svgToFontOptions?.css || false; | ||
|
||
if (genMode === "recreate") { | ||
deleteAllFilesInDir(resolve(projectPath, dist)); | ||
} | ||
|
||
console.log(`\nTTF Generate in \`${dist}\` folder...`); | ||
|
||
const options = { | ||
...svgToFontOptions, | ||
src, | ||
dist, | ||
css, | ||
}; | ||
|
||
svgtofont(options); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
drawable | ||
font | ||
png | ||
react | ||
svg |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# test | ||
|
||
test `@icona/generator` package. | ||
|
||
```bash | ||
yarn generate | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,112 @@ | ||
import { generate } from "@icona/generator"; | ||
|
||
generate({ | ||
config: { | ||
svg: { | ||
active: false, | ||
path: "svg", | ||
svgoConfig: { | ||
js2svg: { | ||
indent: 2, | ||
pretty: true, | ||
}, | ||
plugins: [ | ||
{ | ||
name: "addAttributesToSVGElement", | ||
params: { | ||
attributes: [{ "data-seed-icon": true }], | ||
}, | ||
}, | ||
{ | ||
name: "convertColors", | ||
params: { | ||
currentColor: true, | ||
}, | ||
}, | ||
{ | ||
name: "removeAttrs", | ||
params: { | ||
attrs: ["id"], | ||
}, | ||
}, | ||
], | ||
}, | ||
}, | ||
drawable: { | ||
active: false, | ||
path: "drawable", | ||
svg2vectordrawableConfig: {}, | ||
defaultColor: "@color/gray900", | ||
}, | ||
pdf: { | ||
active: false, | ||
path: "pdf", | ||
pdfKitConfig: { | ||
size: [24, 24], | ||
margin: 0, | ||
layout: "landscape", | ||
}, | ||
svgToPdfOptions: { | ||
assumePt: true, | ||
width: 24, | ||
height: 24, | ||
}, | ||
}, | ||
react: { | ||
active: false, | ||
path: "react", | ||
svgrConfig: { | ||
jsxRuntime: "classic", | ||
plugins: [ | ||
"@svgr/plugin-svgo", | ||
"@svgr/plugin-jsx", | ||
"@svgr/plugin-prettier", | ||
], | ||
prettierConfig: { | ||
tabWidth: 2, | ||
useTabs: false, | ||
singleQuote: true, | ||
semi: true, | ||
}, | ||
svgoConfig: { | ||
plugins: [ | ||
{ | ||
name: "addAttributesToSVGElement", | ||
params: { | ||
attributes: [{ "data-seed-icon": true }], | ||
}, | ||
}, | ||
{ | ||
name: "convertColors", | ||
params: { | ||
currentColor: true, | ||
}, | ||
}, | ||
{ | ||
name: "removeAttrs", | ||
params: { | ||
attrs: ["id"], | ||
}, | ||
}, | ||
], | ||
}, | ||
typescript: true, | ||
dimensions: false, | ||
}, | ||
}, | ||
png: { | ||
active: false, | ||
genMode: "recreate", | ||
path: "png", | ||
}, | ||
font: { | ||
genMode: "recreate", | ||
active: true, | ||
svgToFontOptions: { | ||
src: "svg", | ||
dist: "font", | ||
fontName: "seed-icon", | ||
}, | ||
}, | ||
}, | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
{ | ||
"name": "@icona/generator-test", | ||
"version": "0.0.0", | ||
"private": true, | ||
"type": "module", | ||
"scripts": { | ||
"generate": "node ./icona.js" | ||
}, | ||
"dependencies": { | ||
"@icona/generator": "workspace:^" | ||
}, | ||
"devDependencies": { | ||
"@icona/types": "workspace:^" | ||
}, | ||
"packageManager": "yarn@3.5.1" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.