@seed-design/cli 1.4.0-alpha.0 → 1.5.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/bin/index.mjs +25 -12
- package/package.json +6 -4
- package/src/commands/add-all.ts +39 -6
- package/src/commands/add.ts +39 -6
- package/src/commands/compat.ts +53 -7
- package/src/commands/docs.ts +353 -79
- package/src/commands/init.ts +32 -3
- package/src/index.ts +1 -0
- package/src/tests/analytics.test.ts +95 -0
- package/src/tests/command-telemetry.test.ts +195 -0
- package/src/tests/docs-command.test.ts +150 -0
- package/src/types/shims.d.ts +11 -0
- package/src/utils/analytics.ts +65 -1
- package/src/utils/compatibility.ts +0 -3
- package/src/utils/fetch.ts +92 -0
- package/src/utils/install.ts +1 -1
- package/src/utils/registry-source.ts +38 -0
- package/src/utils/resolve-dependencies.ts +2 -2
package/src/commands/compat.ts
CHANGED
|
@@ -23,7 +23,7 @@ const compatOptionsSchema = z.object({
|
|
|
23
23
|
all: z.boolean(),
|
|
24
24
|
registry: z.string().optional(),
|
|
25
25
|
cwd: z.string(),
|
|
26
|
-
baseUrl: z.string().
|
|
26
|
+
baseUrl: z.string().default(BASE_URL),
|
|
27
27
|
framework: z.enum(["react", "lynx"]).optional(),
|
|
28
28
|
});
|
|
29
29
|
|
|
@@ -126,6 +126,7 @@ export const compatCommand = (cli: CAC) => {
|
|
|
126
126
|
.action(async (itemIds, opts) => {
|
|
127
127
|
const startTime = Date.now();
|
|
128
128
|
const verbose = isVerboseMode(opts);
|
|
129
|
+
const trackCwd = typeof opts?.cwd === "string" ? opts.cwd : process.cwd();
|
|
129
130
|
p.intro("seed-design compat");
|
|
130
131
|
|
|
131
132
|
try {
|
|
@@ -208,6 +209,20 @@ export const compatCommand = (cli: CAC) => {
|
|
|
208
209
|
})();
|
|
209
210
|
|
|
210
211
|
if (!resolvedTargetItemKeys.length) {
|
|
212
|
+
try {
|
|
213
|
+
await analytics.trackCommandOutcome(options.cwd, {
|
|
214
|
+
command: "compat",
|
|
215
|
+
status: "completed",
|
|
216
|
+
result: "empty",
|
|
217
|
+
properties: {
|
|
218
|
+
duration_ms: Date.now() - startTime,
|
|
219
|
+
},
|
|
220
|
+
});
|
|
221
|
+
} catch (telemetryError) {
|
|
222
|
+
if (verbose) {
|
|
223
|
+
console.error("[Telemetry] compat 이벤트 전송에 실패했어요:", telemetryError);
|
|
224
|
+
}
|
|
225
|
+
}
|
|
211
226
|
p.outro("검사할 스니펫이 없어요.");
|
|
212
227
|
process.exit(0);
|
|
213
228
|
}
|
|
@@ -227,8 +242,10 @@ export const compatCommand = (cli: CAC) => {
|
|
|
227
242
|
p.outro(`모든 스니펫이 현재 ${compatPkgNames.join(", ")}와 호환돼요.`);
|
|
228
243
|
|
|
229
244
|
try {
|
|
230
|
-
await analytics.
|
|
231
|
-
|
|
245
|
+
await analytics.trackCommandOutcome(options.cwd, {
|
|
246
|
+
command: "compat",
|
|
247
|
+
status: "completed",
|
|
248
|
+
result: "compatible",
|
|
232
249
|
properties: {
|
|
233
250
|
checked_items_count: compatibilityReport.checkedItemKeys.length,
|
|
234
251
|
incompatible_items_count: 0,
|
|
@@ -237,7 +254,7 @@ export const compatCommand = (cli: CAC) => {
|
|
|
237
254
|
});
|
|
238
255
|
} catch (telemetryError) {
|
|
239
256
|
if (verbose) {
|
|
240
|
-
console.error("[Telemetry] compat
|
|
257
|
+
console.error("[Telemetry] compat 이벤트 전송에 실패했어요:", telemetryError);
|
|
241
258
|
}
|
|
242
259
|
}
|
|
243
260
|
|
|
@@ -254,8 +271,10 @@ export const compatCommand = (cli: CAC) => {
|
|
|
254
271
|
p.outro("호환성 이슈가 있어요.");
|
|
255
272
|
|
|
256
273
|
try {
|
|
257
|
-
await analytics.
|
|
258
|
-
|
|
274
|
+
await analytics.trackCommandOutcome(options.cwd, {
|
|
275
|
+
command: "compat",
|
|
276
|
+
status: "completed",
|
|
277
|
+
result: "incompatible",
|
|
259
278
|
properties: {
|
|
260
279
|
checked_items_count: compatibilityReport.checkedItemKeys.length,
|
|
261
280
|
incompatible_items_count: new Set(
|
|
@@ -267,17 +286,44 @@ export const compatCommand = (cli: CAC) => {
|
|
|
267
286
|
});
|
|
268
287
|
} catch (telemetryError) {
|
|
269
288
|
if (verbose) {
|
|
270
|
-
console.error("[Telemetry] compat
|
|
289
|
+
console.error("[Telemetry] compat 이벤트 전송에 실패했어요:", telemetryError);
|
|
271
290
|
}
|
|
272
291
|
}
|
|
273
292
|
|
|
274
293
|
process.exit(1);
|
|
275
294
|
} catch (error) {
|
|
276
295
|
if (isCliCancelError(error)) {
|
|
296
|
+
try {
|
|
297
|
+
await analytics.trackCommandOutcome(trackCwd, {
|
|
298
|
+
command: "compat",
|
|
299
|
+
status: "cancelled",
|
|
300
|
+
properties: {
|
|
301
|
+
duration_ms: Date.now() - startTime,
|
|
302
|
+
},
|
|
303
|
+
});
|
|
304
|
+
} catch (telemetryError) {
|
|
305
|
+
if (verbose) {
|
|
306
|
+
console.error("[Telemetry] compat 이벤트 전송에 실패했어요:", telemetryError);
|
|
307
|
+
}
|
|
308
|
+
}
|
|
277
309
|
p.outro(highlight(error.message));
|
|
278
310
|
process.exit(0);
|
|
279
311
|
}
|
|
280
312
|
|
|
313
|
+
try {
|
|
314
|
+
await analytics.trackCommandFailure(trackCwd, {
|
|
315
|
+
command: "compat",
|
|
316
|
+
error,
|
|
317
|
+
properties: {
|
|
318
|
+
duration_ms: Date.now() - startTime,
|
|
319
|
+
},
|
|
320
|
+
});
|
|
321
|
+
} catch (telemetryError) {
|
|
322
|
+
if (verbose) {
|
|
323
|
+
console.error("[Telemetry] compat 이벤트 전송에 실패했어요:", telemetryError);
|
|
324
|
+
}
|
|
325
|
+
}
|
|
326
|
+
|
|
281
327
|
handleCliError(error, {
|
|
282
328
|
defaultMessage: "호환성 검사에 실패했어요.",
|
|
283
329
|
defaultHint: "`--verbose` 옵션으로 상세 오류를 확인해보세요.",
|