@liner-fe/internal-icon 1.0.44 → 1.0.45
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.ultra.cache.json +1 -1
- package/CHANGELOG.md +6 -0
- package/lib/index.js +21 -2
- package/package.json +1 -1
- package/src/generate-tsx-components.ts +21 -2
package/.ultra.cache.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"files":{"lib":"
|
|
1
|
+
{"files":{"lib":"1777428555904.532","node_modules":"1777428541121.5059","CHANGELOG.md":"4b3a1e3902fa384773aeb7fe040f5d6315838d0d","README.md":"e0a89d4fcf5bddf1f816bfb20a928ddb301b8d2c","figma.json":"59f77fec62cc40cbfa38d3cc1851e37cad331146","package.json":"17a2459a39492e8ee716b484eada4ca0b4f80d6e","src/generate-svg-files.ts":"6e4949b774de5b509eaab4a1a8efa600ee9a17fc","src/generate-tsx-components.ts":"29612d03b5e8b69e7919b03627853d2e0f287ea4","src/index.ts":"9e03c9c45c92fc534262982bce233b91892c05f1","tsconfig.json":"298030567ca332304807fcdbb95d1218c9c0814f","tsup.config.ts":"8460f94f8ebd1d42fb4cc968298195ae5dd67cde"},"deps":{}}
|
package/CHANGELOG.md
CHANGED
package/lib/index.js
CHANGED
|
@@ -52,7 +52,24 @@ var generateSvgFiles = /* @__PURE__ */ __name(() => {
|
|
|
52
52
|
// src/generate-tsx-components.ts
|
|
53
53
|
import fs2 from "fs";
|
|
54
54
|
import path3 from "path";
|
|
55
|
+
import { optimize as optimize2 } from "svgo";
|
|
55
56
|
var generateTsxComponents = /* @__PURE__ */ __name(() => {
|
|
57
|
+
function optimizeSvg(svgString) {
|
|
58
|
+
return optimize2(svgString, {
|
|
59
|
+
multipass: true,
|
|
60
|
+
plugins: [
|
|
61
|
+
{
|
|
62
|
+
name: "preset-default",
|
|
63
|
+
params: {
|
|
64
|
+
overrides: {
|
|
65
|
+
convertColors: false
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
]
|
|
70
|
+
}).data;
|
|
71
|
+
}
|
|
72
|
+
__name(optimizeSvg, "optimizeSvg");
|
|
56
73
|
const FIGMA_DATA_PATH = path3.resolve(__dirname, "../figma.json");
|
|
57
74
|
const OUTPUT_DIR = "./assets";
|
|
58
75
|
const INDEX_FILE_PATH = "./index.tsx";
|
|
@@ -104,7 +121,9 @@ var generateTsxComponents = /* @__PURE__ */ __name(() => {
|
|
|
104
121
|
};
|
|
105
122
|
Object.entries(variants).forEach(([variant, svgString]) => {
|
|
106
123
|
if (svgString && svgString.trim() !== "") {
|
|
107
|
-
variantSvgs[variant] = normalizeSvgAttributes(
|
|
124
|
+
variantSvgs[variant] = normalizeSvgAttributes(
|
|
125
|
+
convertToCurrentColor(optimizeSvg(svgString))
|
|
126
|
+
);
|
|
108
127
|
}
|
|
109
128
|
});
|
|
110
129
|
return variantSvgs;
|
|
@@ -153,7 +172,7 @@ export const Icon${componentName} = forwardRef<SVGSVGElement, IconProps>(
|
|
|
153
172
|
const tsxCode = generateColorTsxComponent(
|
|
154
173
|
componentName,
|
|
155
174
|
// @ts-ignore
|
|
156
|
-
normalizeSvgAttributes(variants.default)
|
|
175
|
+
normalizeSvgAttributes(optimizeSvg(variants.default))
|
|
157
176
|
);
|
|
158
177
|
const filePath = path3.join(iconDir, "index.tsx");
|
|
159
178
|
fs2.writeFileSync(filePath, tsxCode);
|
package/package.json
CHANGED
|
@@ -1,7 +1,24 @@
|
|
|
1
1
|
import fs from 'fs';
|
|
2
2
|
import path from 'path';
|
|
3
|
+
import { optimize } from 'svgo';
|
|
3
4
|
|
|
4
5
|
export const generateTsxComponents = () => {
|
|
6
|
+
function optimizeSvg(svgString: string): string {
|
|
7
|
+
return optimize(svgString, {
|
|
8
|
+
multipass: true,
|
|
9
|
+
plugins: [
|
|
10
|
+
{
|
|
11
|
+
name: 'preset-default',
|
|
12
|
+
params: {
|
|
13
|
+
overrides: {
|
|
14
|
+
convertColors: false,
|
|
15
|
+
},
|
|
16
|
+
},
|
|
17
|
+
},
|
|
18
|
+
],
|
|
19
|
+
}).data;
|
|
20
|
+
}
|
|
21
|
+
|
|
5
22
|
// 상수 정의
|
|
6
23
|
const FIGMA_DATA_PATH = path.resolve(__dirname, '../figma.json');
|
|
7
24
|
const OUTPUT_DIR = './assets';
|
|
@@ -86,7 +103,9 @@ export const generateTsxComponents = () => {
|
|
|
86
103
|
Object.entries(variants).forEach(([variant, svgString]) => {
|
|
87
104
|
if (svgString && svgString.trim() !== '') {
|
|
88
105
|
// @ts-ignore
|
|
89
|
-
variantSvgs[variant] = normalizeSvgAttributes(
|
|
106
|
+
variantSvgs[variant] = normalizeSvgAttributes(
|
|
107
|
+
convertToCurrentColor(optimizeSvg(svgString)),
|
|
108
|
+
);
|
|
90
109
|
}
|
|
91
110
|
});
|
|
92
111
|
|
|
@@ -147,7 +166,7 @@ export const Icon${componentName} = forwardRef<SVGSVGElement, IconProps>(
|
|
|
147
166
|
const tsxCode = generateColorTsxComponent(
|
|
148
167
|
componentName,
|
|
149
168
|
// @ts-ignore
|
|
150
|
-
normalizeSvgAttributes(variants.default),
|
|
169
|
+
normalizeSvgAttributes(optimizeSvg(variants.default)),
|
|
151
170
|
);
|
|
152
171
|
|
|
153
172
|
const filePath = path.join(iconDir, 'index.tsx');
|