@seed-design/cli 0.0.0-alpha-20241113031935 → 0.0.0-alpha-20250210081704

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.
@@ -1,256 +0,0 @@
1
- import type { CAC } from "cac";
2
- import fs from "node:fs";
3
-
4
- export const checkDeprecatedIconFilesCommand = (cli: CAC) => {
5
- cli
6
- .command("check-deprecated-icon-files [path]", "Check deprecated icon files")
7
- .action(async (path) => {
8
- const files = fs.readdirSync(path, { recursive: true });
9
-
10
- const deprecatedIconFileNames = deprecatedIconNames.flatMap((name) => {
11
- const nameTrimmed = name.replace("icon_", "");
12
-
13
- return [
14
- // icon_arrow_downward
15
- name,
16
- // arrow_downward
17
- nameTrimmed,
18
- // icon-arrow-downward
19
- name.replace(/_/g, "-"),
20
- // iconarrowdownward
21
- name.replace(/_/g, ""),
22
- // iconarrowdownwardthin
23
- `${name.replace(/_/g, "")}thin`,
24
- // iconarrowdownwardregular
25
- `${name.replace(/_/g, "")}regular`,
26
- // iconarrowdownwardfill
27
- `${name.replace(/_/g, "")}fill`,
28
- // arrow-downward
29
- nameTrimmed.replace(/_/g, "-"),
30
- // arrowdownward
31
- nameTrimmed.replace(/_/g, ""),
32
- // arrowdownwardthin
33
- `${nameTrimmed.replace(/_/g, "")}thin`,
34
- // arrowdownwardregular
35
- `${nameTrimmed.replace(/_/g, "")}regular`,
36
- // arrowdownwardfill
37
- `${nameTrimmed.replace(/_/g, "")}fill`,
38
- ];
39
- });
40
-
41
- for (const file of files) {
42
- if (typeof file !== "string") continue;
43
- if (file.includes("node_modules/")) continue;
44
-
45
- const fileNameLowered = file.split("/").pop().split(".")[0].toLowerCase();
46
- if (extensionsToCheck.every((ext) => file.endsWith(ext) === false)) continue;
47
-
48
- if (deprecatedIconFileNames.includes(fileNameLowered)) {
49
- console.log(`Possible deprecated icon file found: ${file}`);
50
- }
51
- }
52
- });
53
- };
54
-
55
- const extensionsToCheck = [".tsx", ".jsx", ".svg", ".png"];
56
-
57
- const deprecatedIconNames = [
58
- "icon_add",
59
- "icon_add_circle",
60
- "icon_aeb",
61
- "icon_ai",
62
- "icon_android_share",
63
- "icon_arrow",
64
- "icon_arrow_downward",
65
- "icon_arrow_drop_down",
66
- "icon_arrow_drop_up",
67
- "icon_arrow_upward",
68
- "icon_article",
69
- "icon_backward",
70
- "icon_bill",
71
- "icon_bold",
72
- "icon_bookmark",
73
- "icon_bookmark_list",
74
- "icon_calendar",
75
- "icon_call",
76
- "icon_call_declined",
77
- "icon_camera",
78
- "icon_car",
79
- "icon_car_around_view",
80
- "icon_car_blind_spot",
81
- "icon_car_cruise_control",
82
- "icon_car_epb",
83
- "icon_car_heated_seat",
84
- "icon_car_heated_steering_wheel",
85
- "icon_car_ldws",
86
- "icon_car_leather_seat",
87
- "icon_car_navigation",
88
- "icon_car_power_trunk",
89
- "icon_car_rear_camera",
90
- "icon_car_rear_sensor",
91
- "icon_car_smart_key",
92
- "icon_car_ventilation_seat",
93
- "icon_cart",
94
- "icon_certification",
95
- "icon_challenge",
96
- "icon_chart",
97
- "icon_chat_bubble_check",
98
- "icon_chatting",
99
- "icon_chatting_send",
100
- "icon_check",
101
- "icon_check_flower",
102
- "icon_chevron_left",
103
- "icon_chevron_right",
104
- "icon_click",
105
- "icon_clock",
106
- "icon_close",
107
- "icon_cobuying",
108
- "icon_community",
109
- "icon_condo",
110
- "icon_confirmation",
111
- "icon_confirmation_pay",
112
- "icon_confirmation_profile",
113
- "icon_contents",
114
- "icon_convert",
115
- "icon_copy",
116
- "icon_coupon",
117
- "icon_coupon_download_done",
118
- "icon_coupon_used",
119
- "icon_delete_keyboard",
120
- "icon_delivery",
121
- "icon_direction",
122
- "icon_download",
123
- "icon_edit",
124
- "icon_emoticon",
125
- "icon_emoticon_bad",
126
- "icon_expand",
127
- "icon_expand_less",
128
- "icon_expand_more",
129
- "icon_file",
130
- "icon_filter02",
131
- "icon_forward",
132
- "icon_gender",
133
- "icon_global",
134
- "icon_gps",
135
- "icon_gps_enable",
136
- "icon_gps_enable2",
137
- "icon_groupchat_king",
138
- "icon_handle",
139
- "icon_hashtag",
140
- "icon_headphone",
141
- "icon_heart",
142
- "icon_help",
143
- "icon_helpcenter",
144
- "icon_helper",
145
- "icon_home",
146
- "icon_house",
147
- "icon_housekeeping_book",
148
- "icon_import",
149
- "icon_info",
150
- "icon_interest",
151
- "icon_interest_list",
152
- "icon_invite",
153
- "icon_invite_friend",
154
- "icon_ios_share",
155
- "icon_jobs",
156
- "icon_keyboard_hiding",
157
- "icon_keyword",
158
- "icon_laptop",
159
- "icon_leaf",
160
- "icon_list",
161
- "icon_list_card",
162
- "icon_list_check",
163
- "icon_list_select",
164
- "icon_list_thumbnail",
165
- "icon_location",
166
- "icon_lock",
167
- "icon_loudspeaker",
168
- "icon_map",
169
- "icon_market",
170
- "icon_market_check",
171
- "icon_market_write",
172
- "icon_mention",
173
- "icon_menu",
174
- "icon_mic",
175
- "icon_mic_off",
176
- "icon_mission",
177
- "icon_mobile",
178
- "icon_money_send",
179
- "icon_money_won",
180
- "icon_moon",
181
- "icon_more_horiz",
182
- "icon_more_vert",
183
- "icon_my",
184
- "icon_my_profile",
185
- "icon_near_me",
186
- "icon_newtopic",
187
- "icon_note",
188
- "icon_notification",
189
- "icon_notification_fall",
190
- "icon_notification_off",
191
- "icon_order",
192
- "icon_pause",
193
- "icon_payment",
194
- "icon_percent",
195
- "icon_photo",
196
- "icon_photo_edit",
197
- "icon_photo_edit_crop",
198
- "icon_photo_edit_draw",
199
- "icon_photo_edit_rotate",
200
- "icon_photo_several",
201
- "icon_play",
202
- "icon_poll",
203
- "icon_price_won",
204
- "icon_product",
205
- "icon_profile",
206
- "icon_profile_badge",
207
- "icon_prohibition",
208
- "icon_pushpin",
209
- "icon_question_check",
210
- "icon_redo",
211
- "icon_refund",
212
- "icon_remove_circle",
213
- "icon_reply",
214
- "icon_reply_mission",
215
- "icon_reply_re",
216
- "icon_report",
217
- "icon_reservation",
218
- "icon_restaurant",
219
- "icon_retry",
220
- "icon_review_star",
221
- "icon_scanner",
222
- "icon_search",
223
- "icon_search_doc",
224
- "icon_sell",
225
- "icon_setting",
226
- "icon_signout",
227
- "icon_sort",
228
- "icon_story",
229
- "icon_story_article",
230
- "icon_subtract_circle",
231
- "icon_subtraction",
232
- "icon_suggest",
233
- "icon_sun",
234
- "icon_talkingdown",
235
- "icon_talkingup",
236
- "icon_text",
237
- "icon_thumb_down",
238
- "icon_thumb_up",
239
- "icon_toolbox",
240
- "icon_translate",
241
- "icon_trash",
242
- "icon_undo",
243
- "icon_user_group",
244
- "icon_video",
245
- "icon_view_count",
246
- "icon_view_count_off",
247
- "icon_volume_off",
248
- "icon_volume_on",
249
- "icon_vote",
250
- "icon_voucher",
251
- "icon_walk",
252
- "icon_warning",
253
- "icon_write",
254
- "icon_write_frequent_use",
255
- "icon_write_story",
256
- ];
@@ -1,62 +0,0 @@
1
- import { describe, expect, test } from "vitest";
2
- import { addRelativeComponents } from "../utils/add-relative-components";
3
- import type { RegistryComponent } from "@/src/schema";
4
-
5
- const config: RegistryComponent = [
6
- {
7
- name: "a",
8
- files: ["a.tsx"],
9
- },
10
- {
11
- name: "b",
12
- innerDependencies: ["a"],
13
- files: ["b.tsx"],
14
- },
15
- {
16
- name: "c",
17
- innerDependencies: ["b"],
18
- files: ["c.tsx"],
19
- },
20
- {
21
- name: "d",
22
- innerDependencies: ["a", "b"],
23
- files: ["d.tsx"],
24
- },
25
- {
26
- name: "e",
27
- innerDependencies: ["d"],
28
- files: ["d.tsx"],
29
- },
30
- ];
31
-
32
- describe("addRelativeComponents", () => {
33
- test("4 deps test", () => {
34
- const userSelects = ["e"];
35
- const result = addRelativeComponents(userSelects, config);
36
- expect(result).toEqual(expect.arrayContaining(["a", "b", "d", "e"]));
37
- });
38
-
39
- test("3 deps test", () => {
40
- const userSelects = ["d"];
41
- const result = addRelativeComponents(userSelects, config);
42
- expect(result).toEqual(expect.arrayContaining(["a", "b", "d"]));
43
- });
44
-
45
- test("3 deps test", () => {
46
- const userSelects = ["c"];
47
- const result = addRelativeComponents(userSelects, config);
48
- expect(result).toEqual(expect.arrayContaining(["a", "b", "c"]));
49
- });
50
-
51
- test("2 deps test", () => {
52
- const userSelects = ["b"];
53
- const result = addRelativeComponents(userSelects, config);
54
- expect(result).toEqual(expect.arrayContaining(["a", "b"]));
55
- });
56
-
57
- test("1 deps test", () => {
58
- const userSelects = ["a"];
59
- const result = addRelativeComponents(userSelects, config);
60
- expect(result).toEqual(expect.arrayContaining(["a"]));
61
- });
62
- });
@@ -1,29 +0,0 @@
1
- import type { RegistryUIMachineGenerated } from "@/src/schema";
2
-
3
- export function addRelativeComponents(
4
- userSelects: string[],
5
- registryIndex: RegistryUIMachineGenerated,
6
- ) {
7
- const selectedComponents = new Set<string>();
8
-
9
- function addSeedDependencies(componentName: string) {
10
- if (selectedComponents.has(componentName)) return;
11
-
12
- selectedComponents.add(componentName);
13
-
14
- const component = registryIndex.find((c) => c.name === componentName);
15
- if (!component) return;
16
-
17
- if (component.innerDependencies) {
18
- for (const dep of component.innerDependencies) {
19
- addSeedDependencies(dep);
20
- }
21
- }
22
- }
23
-
24
- for (const componentName of userSelects) {
25
- addSeedDependencies(componentName);
26
- }
27
-
28
- return Array.from(selectedComponents);
29
- }