maru_design2 0.0.3 → 0.1.0

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "maru_design2",
3
- "version": "0.0.3",
3
+ "version": "0.1.0",
4
4
  "main": "./dist/index.js",
5
5
  "author": "zena-42maru",
6
6
  "license": "MIT",
package/.babelrc.json DELETED
@@ -1,18 +0,0 @@
1
- {
2
- "sourceType": "unambiguous",
3
- "presets": [
4
- [
5
- "@babel/preset-env",
6
- {
7
- "targets": {
8
- "chrome": 100
9
- }
10
- }
11
- ],
12
- [
13
- "@babel/preset-react",
14
- { "runtime": "automatic" }
15
- ],
16
- ["@babel/preset-typescript"]
17
- ],
18
- }
package/.eslintrc.json DELETED
@@ -1,110 +0,0 @@
1
- {
2
- "extends": [
3
- "airbnb",
4
- "plugin:react/recommended",
5
- "plugin:@typescript-eslint/recommended"
6
- ],
7
- "plugins": ["react", "@typescript-eslint", "prettier", "simple-import-sort"],
8
- "rules": {
9
- "no-tabs": [
10
- "error",
11
- {
12
- "allowIndentationTabs": true
13
- }
14
- ],
15
- "no-mixed-spaces-and-tabs": 0,
16
- "simple-import-sort/imports": [
17
- "warn",
18
- {
19
- "groups": [
20
- ["^react", "^(?!src)(?=@?\\w)"],
21
- [
22
- "constants",
23
- "hooks",
24
- "reducers",
25
- "routes",
26
- "store",
27
- "types",
28
- "utils"
29
- ],
30
- [
31
- "views",
32
- "^\\.\\.(?!/?$)",
33
- "^\\.\\./?$",
34
- "^\\./(?=.*/)(?!/?$)",
35
- "^\\.(?!/?$)",
36
- "^\\./?$",
37
- "components"
38
- ],
39
- ["assets", "^.+\\.s?css$"]
40
- ]
41
- }
42
- ],
43
- "import/order": "off",
44
- "import/extensions": [
45
- "off",
46
- {
47
- "ts": "always",
48
- "tsx": "always",
49
- "js": "always",
50
- "jsx": "always"
51
- }
52
- ],
53
- "import/no-unresolved": "off",
54
- "react/jsx-filename-extension": [
55
- "warn",
56
- {
57
- "extensions": [".ts", ".tsx"]
58
- }
59
- ],
60
- "react/destructuring-assignment": 0,
61
- "no-use-before-define": "off",
62
- "@typescript-eslint/no-use-before-define": ["error"],
63
- "import/no-extraneous-dependencies": [
64
- "error",
65
- {
66
- "devDependencies": true,
67
- "optionalDependencies": true,
68
- "peerDependencies": true
69
- }
70
- ],
71
- "linebreak-style": "off",
72
- "object-curly-newline": "off",
73
- "comma-dangle": "off",
74
- "react/prop-types": "off",
75
- "operator-linebreak": "off",
76
- "import/prefer-default-export": "warn",
77
- "no-console": "off",
78
- "implicit-arrow-linebreak": "off",
79
- "react/jsx-curly-newline": "off",
80
- "no-param-reassign": [
81
- "error",
82
- {
83
- "props": false
84
- }
85
- ],
86
- "@typescript-eslint/ban-types": "warn",
87
- "no-nested-ternary": "off",
88
- "indent": "off",
89
- "camelcase": "off",
90
- "no-confusing-arrow": "off",
91
- "function-paren-newline": "off",
92
- "@typescript-eslint/no-empty-function": "warn",
93
- "no-plusplus": "warn",
94
- "react/jsx-wrap-multilines": "off",
95
- "no-restricted-syntax": "off",
96
- "no-await-in-loop": "off",
97
- "react/require-default-props": [
98
- 1,
99
- {
100
- "functions": "ignore"
101
- }
102
- ],
103
- "jsx-a11y/label-has-associated-control": [
104
- 2,
105
- {
106
- "labelAttributes": ["htmlFor"]
107
- }
108
- ]
109
- }
110
- }
@@ -1,19 +0,0 @@
1
- name: "Chromatic"
2
-
3
- on: push
4
-
5
- jobs:
6
- chromatic-release:
7
- runs-on: ubuntu-latest
8
- steps:
9
- - uses: actions/checkout@v2
10
- with:
11
- fetch-depth: 0
12
- - uses: actions/setup-node@v3
13
- with:
14
- node-version: 18
15
- - run: yarn
16
- - uses: chromaui/action@latest
17
- with:
18
- projectToken: ${{ secrets.CHROMATIC_PROJECT_TOKEN }}
19
- token: ${{ secrets.GITHUB_TOKEN }}
package/.prettierrc DELETED
@@ -1,8 +0,0 @@
1
- {
2
- "singleQuote": true,
3
- "semi": true,
4
- "useTabs": false,
5
- "tabWidth": 2,
6
- "trailingComma": "all",
7
- "printWidth": 80
8
- }
@@ -1,29 +0,0 @@
1
- yarn run v1.22.22
2
- $ storybook build --output-dir /var/folders/px/wfswfhnj2_96379m3pn48snm0000gn/T/chromatic--60662-3uZghrajfe3J
3
- @storybook/cli v8.0.6
4
-
5
- info => Cleaning outputDir: ../../../../../var/folders/px/wfswfhnj2_96379m3pn48snm0000gn/T/chromatic--60662-3uZghrajfe3J
6
- info => Loading presets
7
- info => Building manager..
8
- info => Manager built (106 ms)
9
- info => Building preview..
10
- WARN No story files found for the specified pattern: src/**/*.mdx
11
- info Addon-docs: using MDX3
12
- info => Using implicit CSS loaders
13
- info => Using default Webpack5 setup
14
- info Using tsconfig paths for react-docgen
15
- WARN asset size limit: The following asset(s) exceed the recommended size limit (244 KiB).
16
- WARN This can impact web performance.
17
- WARN Assets:
18
- WARN 841.8b90d07c.iframe.bundle.js (1.51 MiB)
19
- WARN 589.80a80dfc.iframe.bundle.js (628 KiB)
20
- WARN entrypoint size limit: The following entrypoint(s) combined asset size exceeds the recommended limit (244 KiB). This can impact web performance.
21
- WARN Entrypoints:
22
- WARN main (1.53 MiB)
23
- WARN runtime~main.fb7a63fd.iframe.bundle.js
24
- WARN 841.8b90d07c.iframe.bundle.js
25
- WARN main.26a48fe5.iframe.bundle.js
26
- WARN
27
- info => Preview built (5.97 s)
28
- info => Output directory: /var/folders/px/wfswfhnj2_96379m3pn48snm0000gn/T/chromatic--60662-3uZghrajfe3J
29
- Done in 8.54s.
@@ -1,224 +0,0 @@
1
- /* eslint-disable @typescript-eslint/no-var-requires */
2
- const fs = require('fs');
3
- const path = require('path');
4
-
5
- const inputDir = './src/assets/icons';
6
- const outputDir = './src/components/atoms/icon';
7
- const svgs = fs.readdirSync(inputDir);
8
-
9
- // 아이콘의 정보들을 모을 객체
10
- const icons = {};
11
- // 아이콘의 이름을 모을 객체
12
- const names = {};
13
-
14
- const toCamelCase = (pascalStr) =>
15
- pascalStr
16
- .split('-')
17
- .map((word) => word.charAt(0).toUpperCase() + word.slice(1).toLowerCase())
18
- .join('');
19
-
20
- const readFile = (filePath, fileName, fileExtension) =>
21
- new Promise((resolve, reject) => {
22
- fs.readFile(filePath, 'utf8', (err, data) => {
23
- if (err) {
24
- reject(err);
25
- return;
26
- }
27
-
28
- console.log('---------- parsing start ----------');
29
-
30
- console.log('((data))', data);
31
-
32
- // svg args 추출
33
- const svgStartRegex = /<svg/g;
34
- const svgEndRegex = />/;
35
- const svgArgs = data.split(svgStartRegex)[1].split(svgEndRegex)[0];
36
-
37
- console.log('**svgArgs', svgArgs);
38
-
39
- // width 추출
40
- const widthRegex = /width=".{1,9}"/g;
41
- const width = svgArgs.match(widthRegex)?.[0]?.split('"')?.[1];
42
- console.log('*width', width);
43
-
44
- // height 추출
45
- const heightRegex = /height=".{1,9}"/g;
46
- const height = svgArgs.match(heightRegex)?.[0]?.split('"')?.[1];
47
- console.log('*height', height);
48
-
49
- // viewBox 추출
50
- const viewBoxRegex = /viewBox="[0-9\s-.]*"/;
51
- const viewBox = svgArgs.match(viewBoxRegex)?.[0]?.split('"')?.[1];
52
- console.log('*viewBox', viewBox);
53
-
54
- // svgFill 추출
55
- const fillRegex = /fill=".{1,9}"/g;
56
- const svgFill = svgArgs.match(fillRegex)?.[0]?.split('"')?.[1];
57
- console.log('*svgFill', svgFill);
58
-
59
- // path args 추출
60
- const pathStartRegex = /<path/g;
61
- const paths = data
62
- .split(pathStartRegex)
63
- .filter((_, idx) => idx > 0)
64
- .map((pathArgs) => {
65
- // d 추출
66
- const dRegex = /d=".*"/g;
67
- const d = pathArgs.match(dRegex)?.[0]?.split('"')?.[1];
68
- console.log('*d', d);
69
-
70
- // pathFill 추출
71
- const pathFill = pathArgs.match(fillRegex)?.[0]?.split('"')?.[1];
72
- console.log('*pathFill', pathFill);
73
-
74
- // fillRule 추출
75
- const fillRuleRegex = /fill-rule=".{1,9}"/g;
76
- const fillRule = pathArgs.match(fillRuleRegex)?.[0]?.split('"')?.[1];
77
- console.log('*fillRule', fillRule);
78
-
79
- // clipRule 추출
80
- const clipRuleRegex = /clip-rule=".{1,9}"/g;
81
- const clipRule = pathArgs.match(clipRuleRegex)?.[0]?.split('"')?.[1];
82
- console.log('*clipRule', clipRule);
83
-
84
- // stroke 추출
85
- const strokeRegex = /stroke=".{1,9}"/g;
86
- const stroke = pathArgs.match(strokeRegex)?.[0]?.split('"')?.[1];
87
- console.log('*stroke', stroke);
88
-
89
- // strokeWidth 추출
90
- const strokeWidthRegex = /stroke-width=".{1,9}"/g;
91
- const strokeWidth = pathArgs
92
- .match(strokeWidthRegex)?.[0]
93
- ?.split('"')?.[1];
94
- console.log('*strokeWidth', strokeWidth);
95
-
96
- // strokeLinecap 추출
97
- const strokeLinecapRegex = /stroke-linecap=".{1,9}"/g;
98
- const strokeLinecap = pathArgs
99
- .match(strokeLinecapRegex)?.[0]
100
- ?.split('"')?.[1];
101
- console.log('*strokeLinecap', strokeLinecap);
102
-
103
- // strokeLinejoin 추출
104
- const strokeLinejoinRegex = /stroke-linejoin=".{1,9}"/g;
105
- const strokeLinejoin = pathArgs
106
- .match(strokeLinejoinRegex)?.[0]
107
- ?.split('"')?.[1];
108
- console.log('*strokeLinejoin', strokeLinejoin);
109
-
110
- return {
111
- d,
112
- fill: pathFill,
113
- fillRule,
114
- clipRule,
115
- stroke,
116
- strokeWidth,
117
- strokeLinecap,
118
- strokeLinejoin,
119
- };
120
- });
121
-
122
- // circle args 추출
123
- const circleStartRegex = /<circle/g;
124
- const circles = data
125
- .split(circleStartRegex)
126
- .filter((_, idx) => idx > 0)
127
- .map((circleArgs) => {
128
- // cx 추출
129
- const cxRegex = /cx=".{1,9}"/g;
130
- const cx = circleArgs.match(cxRegex)?.[0]?.split('"')?.[1];
131
- console.log('*cx', cx);
132
-
133
- // cy 추출
134
- const cyRegex = /cy=".{1,9}"/g;
135
- const cy = circleArgs.match(cyRegex)?.[0]?.split('"')?.[1];
136
- console.log('*cy', cy);
137
-
138
- // r 추출
139
- const rRegex = /r=".{1,9}"/g;
140
- const r = circleArgs.match(rRegex)?.[0]?.split('"')?.[1];
141
- console.log('*r', r);
142
-
143
- // circleFill 추출
144
- const circleFill = circleArgs.match(fillRegex)?.[0]?.split('"')?.[1];
145
- console.log('*circleFill', circleFill);
146
-
147
- return { cx, cy, r, fill: circleFill };
148
- });
149
-
150
- const fileNameWithoutExtension = toCamelCase(
151
- fileName.split(fileExtension)[0],
152
- );
153
- console.log('fileNameWithoutExtension', fileNameWithoutExtension);
154
-
155
- icons[fileNameWithoutExtension] = {
156
- width,
157
- height,
158
- viewBox,
159
- fill: svgFill,
160
- paths,
161
- circles,
162
- };
163
- names[fileNameWithoutExtension] = fileNameWithoutExtension;
164
-
165
- resolve();
166
- });
167
- });
168
-
169
- async function main() {
170
- for (const svg of svgs) {
171
- const extension = path.extname(svg);
172
- if (extension === '.svg' && !svg.includes('NoConvert')) {
173
- await readFile(`${inputDir}/${svg}`, svg, extension);
174
- }
175
- }
176
-
177
- console.log('### icons', icons);
178
- console.log('### names', names);
179
-
180
- fs.writeFileSync(
181
- `${outputDir}/iconmap.ts`,
182
- `/* eslint-disable no-multiple-empty-lines */
183
- /* eslint-disable no-trailing-spaces */
184
- /* eslint-disable eol-last */
185
- /* eslint-disable object-curly-spacing */
186
- /* eslint-disable comma-spacing */
187
- /* eslint-disable key-spacing */
188
- /* eslint-disable quotes */
189
- /* eslint-disable quote-props */
190
- export const iconmap: {
191
- [key: string]: {
192
- width: string;
193
- height: string;
194
- viewBox: string;
195
- fill: string;
196
- paths: {
197
- d: string;
198
- fill?: string;
199
- fillRule?: string;
200
- clipRule?: string;
201
- stroke?: string;
202
- strokeWidth?: string;
203
- strokeLinecap?: string;
204
- strokeLinejoin?: string;
205
- }[];
206
- circles: {
207
- cx: string;
208
- cy: string;
209
- r: string;
210
- fill: string;
211
- }[];
212
- };
213
- } = ${JSON.stringify(icons)};
214
- export const ICONS = ${JSON.stringify(names)} as const;
215
- export type TIcons = (typeof ICONS)[keyof typeof ICONS];
216
- `,
217
- 'utf8',
218
- (error) => {
219
- if (error) throw error;
220
- },
221
- );
222
- }
223
-
224
- main();