@contentful/experience-design-system-cli 2.35.1-dev-build-3ab9e99e.0 → 2.36.1-dev-build-29bacd34.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/dist/app.js +190 -231
- package/dist/index.js +201 -249
- package/dist/package.json +1 -1
- package/dist/src/tui/debug-store.d.ts +0 -1
- package/legacy/dist/src/import/tui/steps/WizardPreviewStep.d.ts +1 -2
- package/legacy/dist/src/index.js +166 -598
- package/legacy/package.json +1 -1
- package/package.json +2 -2
- package/legacy/dist/src/apply/dangling-token-defaults.d.ts +0 -17
- package/legacy/dist/src/helpers/fetch-existing-token-ids.d.ts +0 -11
- package/legacy/dist/src/lib/push-debug-log.d.ts +0 -29
package/legacy/dist/src/index.js
CHANGED
|
@@ -1213,8 +1213,8 @@ function makeSessionTimestamp() {
|
|
|
1213
1213
|
const override = process.env["EDSI_DEBUG_TS"];
|
|
1214
1214
|
if (override) return override;
|
|
1215
1215
|
const now = /* @__PURE__ */ new Date();
|
|
1216
|
-
const
|
|
1217
|
-
return `${now.getUTCFullYear()}${
|
|
1216
|
+
const pad = (n, w = 2) => n.toString().padStart(w, "0");
|
|
1217
|
+
return `${now.getUTCFullYear()}${pad(now.getUTCMonth() + 1)}${pad(now.getUTCDate())}T${pad(now.getUTCHours())}${pad(now.getUTCMinutes())}${pad(now.getUTCSeconds())}Z`;
|
|
1218
1218
|
}
|
|
1219
1219
|
function initDebugLogger(opts) {
|
|
1220
1220
|
if (singleton) return singleton;
|
|
@@ -2011,8 +2011,8 @@ function deleteRawTokensForSession(db, sessionId2) {
|
|
|
2011
2011
|
}
|
|
2012
2012
|
function createRawTokenGroups(db, sessionId2, groups) {
|
|
2013
2013
|
const insertGroup = db.prepare(`INSERT INTO raw_token_groups (session_id, path, description) VALUES (?, ?, ?)`);
|
|
2014
|
-
for (const
|
|
2015
|
-
insertGroup.run(sessionId2,
|
|
2014
|
+
for (const group of groups) {
|
|
2015
|
+
insertGroup.run(sessionId2, group.path, group.$description ?? null);
|
|
2016
2016
|
}
|
|
2017
2017
|
}
|
|
2018
2018
|
function createRawTokens(db, sessionId2, tokens) {
|
|
@@ -6891,24 +6891,24 @@ function parseEdsiError(rawInput) {
|
|
|
6891
6891
|
}
|
|
6892
6892
|
}
|
|
6893
6893
|
const cleaned = stripLambdaLogPrefix(body);
|
|
6894
|
-
const
|
|
6895
|
-
const bindingFromJson = typeof
|
|
6894
|
+
const json = parseJsonBody(cleaned) ?? parseJsonBody(body);
|
|
6895
|
+
const bindingFromJson = typeof json?.message === "string" ? parseBindingDiagnostics(json.message) : null;
|
|
6896
6896
|
if (bindingFromJson) {
|
|
6897
6897
|
return {
|
|
6898
|
-
code: bindingFromJson.code ??
|
|
6898
|
+
code: bindingFromJson.code ?? json?.code ?? null,
|
|
6899
6899
|
message: bindingFromJson.message ?? cleaned,
|
|
6900
6900
|
cycle: null,
|
|
6901
6901
|
raw: false,
|
|
6902
6902
|
...bindingFromJson.diagnostics ? { diagnostics: bindingFromJson.diagnostics } : {}
|
|
6903
6903
|
};
|
|
6904
6904
|
}
|
|
6905
|
-
if (
|
|
6905
|
+
if (json && (json.code || json.message || json.cycle)) {
|
|
6906
6906
|
return {
|
|
6907
|
-
code:
|
|
6908
|
-
message:
|
|
6909
|
-
cycle:
|
|
6907
|
+
code: json.code ?? null,
|
|
6908
|
+
message: json.message ?? (cleaned || prefix),
|
|
6909
|
+
cycle: json.cycle ?? null,
|
|
6910
6910
|
raw: false,
|
|
6911
|
-
...
|
|
6911
|
+
...json.diagnostics ? { diagnostics: json.diagnostics } : {}
|
|
6912
6912
|
};
|
|
6913
6913
|
}
|
|
6914
6914
|
const binding = parseBindingDiagnostics(cleaned);
|
|
@@ -8448,8 +8448,8 @@ async function resolveSession(sessionFlag, command) {
|
|
|
8448
8448
|
}
|
|
8449
8449
|
function rebuildDTCGTree(groups, tokens) {
|
|
8450
8450
|
const root = {};
|
|
8451
|
-
for (const
|
|
8452
|
-
const segments =
|
|
8451
|
+
for (const group of groups) {
|
|
8452
|
+
const segments = group.path.split(".");
|
|
8453
8453
|
let node = root;
|
|
8454
8454
|
for (const seg of segments) {
|
|
8455
8455
|
if (typeof node[seg] !== "object" || node[seg] === null) {
|
|
@@ -8457,8 +8457,8 @@ function rebuildDTCGTree(groups, tokens) {
|
|
|
8457
8457
|
}
|
|
8458
8458
|
node = node[seg];
|
|
8459
8459
|
}
|
|
8460
|
-
if (
|
|
8461
|
-
node["$description"] =
|
|
8460
|
+
if (group.$description) {
|
|
8461
|
+
node["$description"] = group.$description;
|
|
8462
8462
|
}
|
|
8463
8463
|
}
|
|
8464
8464
|
for (const token of tokens) {
|
|
@@ -9201,214 +9201,6 @@ var init_run_teaser = __esm({
|
|
|
9201
9201
|
}
|
|
9202
9202
|
});
|
|
9203
9203
|
|
|
9204
|
-
// packages/experience-design-system-cli-legacy/src/lib/push-debug-log.ts
|
|
9205
|
-
import { existsSync as existsSync3, mkdirSync as mkdirSync3, readdirSync, writeFileSync } from "node:fs";
|
|
9206
|
-
import { join as join10 } from "node:path";
|
|
9207
|
-
function scrub(key, value) {
|
|
9208
|
-
if (/^cma_?token$/i.test(key)) {
|
|
9209
|
-
return typeof value === "string" && value ? `[present, ${value.length} chars]` : "[not set]";
|
|
9210
|
-
}
|
|
9211
|
-
if (typeof value === "string" && SECRET_VALUE.test(value)) return "[redacted]";
|
|
9212
|
-
return value;
|
|
9213
|
-
}
|
|
9214
|
-
function json(value) {
|
|
9215
|
-
const text = JSON.stringify(value, scrub, 2) ?? "null";
|
|
9216
|
-
return text.length > MAX_BLOCK_CHARS ? `${text.slice(0, MAX_BLOCK_CHARS)}
|
|
9217
|
-
\u2026 truncated, ${text.length - MAX_BLOCK_CHARS} more characters` : text;
|
|
9218
|
-
}
|
|
9219
|
-
function pad(n, width = 2) {
|
|
9220
|
-
return String(n).padStart(width, "0");
|
|
9221
|
-
}
|
|
9222
|
-
function datePrefix(now) {
|
|
9223
|
-
return `${pad(now.getMonth() + 1)}-${pad(now.getDate())}-${now.getFullYear()}`;
|
|
9224
|
-
}
|
|
9225
|
-
function clock(now) {
|
|
9226
|
-
return `${pad(now.getHours())}:${pad(now.getMinutes())}:${pad(now.getSeconds())}.${pad(now.getMilliseconds(), 3)}`;
|
|
9227
|
-
}
|
|
9228
|
-
function nextFilename(dir, now) {
|
|
9229
|
-
const today = datePrefix(now);
|
|
9230
|
-
const pattern = new RegExp(`^${today}-push-attempt-(\\d+)\\.md$`);
|
|
9231
|
-
const existing = existsSync3(dir) ? readdirSync(dir) : [];
|
|
9232
|
-
const max = existing.reduce((acc, entry) => {
|
|
9233
|
-
const match2 = pattern.exec(entry);
|
|
9234
|
-
return match2 ? Math.max(acc, Number(match2[1])) : acc;
|
|
9235
|
-
}, 0);
|
|
9236
|
-
return `${today}-push-attempt-${max + 1}.md`;
|
|
9237
|
-
}
|
|
9238
|
-
function entityName(entry) {
|
|
9239
|
-
if (typeof entry === "string") return entry;
|
|
9240
|
-
if (entry && typeof entry === "object") {
|
|
9241
|
-
const record = entry;
|
|
9242
|
-
for (const field of ["key", "name", "$name", "id"]) {
|
|
9243
|
-
if (typeof record[field] === "string") return record[field];
|
|
9244
|
-
}
|
|
9245
|
-
const current = record["current"];
|
|
9246
|
-
if (current && typeof current === "object" && typeof current["name"] === "string") {
|
|
9247
|
-
return current["name"];
|
|
9248
|
-
}
|
|
9249
|
-
}
|
|
9250
|
-
return "unknown";
|
|
9251
|
-
}
|
|
9252
|
-
function group(diff) {
|
|
9253
|
-
return {
|
|
9254
|
-
new: diff.new.map(entityName),
|
|
9255
|
-
changed: diff.changed.map((entry) => {
|
|
9256
|
-
const breaking = entry && typeof entry === "object" && entry.changeClassification?.classification === "breaking";
|
|
9257
|
-
return breaking ? `${entityName(entry)} (breaking)` : entityName(entry);
|
|
9258
|
-
}),
|
|
9259
|
-
unchanged: diff.unchanged,
|
|
9260
|
-
removed: diff.removed.map(entityName)
|
|
9261
|
-
};
|
|
9262
|
-
}
|
|
9263
|
-
function summarizePreview(preview) {
|
|
9264
|
-
return { components: group(preview.components), tokens: group(preview.tokens) };
|
|
9265
|
-
}
|
|
9266
|
-
function summarizeCdf(cdf) {
|
|
9267
|
-
return Object.entries(cdf).filter(([key]) => !key.startsWith("$") && key !== "allowDeletions").map(([key, value]) => {
|
|
9268
|
-
const entry = value ?? {};
|
|
9269
|
-
const properties = entry["$properties"];
|
|
9270
|
-
const slots = entry["$slots"];
|
|
9271
|
-
return {
|
|
9272
|
-
name: key,
|
|
9273
|
-
type: entry["$type"],
|
|
9274
|
-
properties: properties && typeof properties === "object" ? Object.keys(properties) : [],
|
|
9275
|
-
slots: slots && typeof slots === "object" ? Object.keys(slots) : []
|
|
9276
|
-
};
|
|
9277
|
-
});
|
|
9278
|
-
}
|
|
9279
|
-
function renderEvents(events) {
|
|
9280
|
-
if (events.length === 0) return "_Nothing recorded yet._";
|
|
9281
|
-
return events.map((event, index) => {
|
|
9282
|
-
const note = event.note ? ` \u2014 ${event.note}` : "";
|
|
9283
|
-
const request2 = event.requestId ? ` _(request ${event.requestId})_` : "";
|
|
9284
|
-
return `${index + 1}. \`${clock(event.at)}\` (+${event.sinceStartMs}ms) **${event.title}**${note}${request2}`;
|
|
9285
|
-
}).join("\n");
|
|
9286
|
-
}
|
|
9287
|
-
function renderDetails(events) {
|
|
9288
|
-
const withData = events.map((event, index) => ({ event, index })).filter(({ event }) => event.data && Object.keys(event.data).length > 0);
|
|
9289
|
-
if (withData.length === 0) return "";
|
|
9290
|
-
return withData.map(
|
|
9291
|
-
({ event, index }) => `<details>
|
|
9292
|
-
<summary>${index + 1}. ${event.title}</summary>
|
|
9293
|
-
|
|
9294
|
-
\`\`\`json
|
|
9295
|
-
${json(event.data)}
|
|
9296
|
-
\`\`\`
|
|
9297
|
-
|
|
9298
|
-
</details>`
|
|
9299
|
-
).join("\n\n");
|
|
9300
|
-
}
|
|
9301
|
-
function render2(runId, inputs, events, startedAt, result, durationMs) {
|
|
9302
|
-
const requestIds = [...new Set(events.map((event) => event.requestId).filter(Boolean))];
|
|
9303
|
-
const text = (field) => String(inputs[field] ?? "\u2014");
|
|
9304
|
-
const details = renderDetails(events);
|
|
9305
|
-
return `# Push to Contentful \u2014 debug log
|
|
9306
|
-
|
|
9307
|
-
## Summary
|
|
9308
|
-
|
|
9309
|
-
| | |
|
|
9310
|
-
|---|---|
|
|
9311
|
-
| **Result** | ${OUTCOME_LABEL[result.outcome]} |
|
|
9312
|
-
| **What happened** | ${result.summary} |
|
|
9313
|
-
| **Space / environment** | \`${text("space_id")}\` / \`${text("environment_id")}\` |
|
|
9314
|
-
| **Host** | ${text("host")} |
|
|
9315
|
-
| **Started** | ${startedAt.toISOString()} |
|
|
9316
|
-
| **Duration** | ${durationMs}ms |
|
|
9317
|
-
| **Request IDs** | ${requestIds.length > 0 ? requestIds.map((id) => `\`${id}\``).join(", ") : "\u2014"} |
|
|
9318
|
-
| **CLI / runtime** | ${cliVersion()} \xB7 ${process.platform} \xB7 Node ${process.version} |
|
|
9319
|
-
| **Run ID** | ${runId} |
|
|
9320
|
-
|
|
9321
|
-
## Timeline
|
|
9322
|
-
|
|
9323
|
-
${renderEvents(events)}
|
|
9324
|
-
|
|
9325
|
-
## Inputs
|
|
9326
|
-
|
|
9327
|
-
\`\`\`json
|
|
9328
|
-
${json(inputs)}
|
|
9329
|
-
\`\`\`
|
|
9330
|
-
|
|
9331
|
-
## Result
|
|
9332
|
-
|
|
9333
|
-
\`\`\`json
|
|
9334
|
-
${json({ outcome: result.outcome, summary: result.summary, ...result.details ?? {} })}
|
|
9335
|
-
\`\`\`
|
|
9336
|
-
${details ? `
|
|
9337
|
-
## Details
|
|
9338
|
-
|
|
9339
|
-
${details}
|
|
9340
|
-
` : ""}`;
|
|
9341
|
-
}
|
|
9342
|
-
function startPushDebugRun(inputs) {
|
|
9343
|
-
const sessionDir = process.env[DEBUG_SESSION_DIR_ENV];
|
|
9344
|
-
if (!sessionDir) return NOOP_RUN;
|
|
9345
|
-
const startedAt = /* @__PURE__ */ new Date();
|
|
9346
|
-
const runId = `${startedAt.getFullYear()}${pad(startedAt.getMonth() + 1)}${pad(startedAt.getDate())}-${pad(startedAt.getHours())}${pad(startedAt.getMinutes())}${pad(startedAt.getSeconds())}`;
|
|
9347
|
-
const events = [];
|
|
9348
|
-
let result = {
|
|
9349
|
-
outcome: "in-progress",
|
|
9350
|
-
summary: "The push started but no final result was recorded."
|
|
9351
|
-
};
|
|
9352
|
-
let finished = false;
|
|
9353
|
-
let path;
|
|
9354
|
-
const flush = () => {
|
|
9355
|
-
try {
|
|
9356
|
-
if (!path) {
|
|
9357
|
-
const dir = join10(sessionDir, "import");
|
|
9358
|
-
mkdirSync3(dir, { recursive: true });
|
|
9359
|
-
path = join10(dir, nextFilename(dir, startedAt));
|
|
9360
|
-
}
|
|
9361
|
-
writeFileSync(path, render2(runId, inputs, events, startedAt, result, Date.now() - startedAt.getTime()), {
|
|
9362
|
-
mode: 384
|
|
9363
|
-
});
|
|
9364
|
-
} catch {
|
|
9365
|
-
}
|
|
9366
|
-
};
|
|
9367
|
-
flush();
|
|
9368
|
-
return {
|
|
9369
|
-
event(title, options = {}) {
|
|
9370
|
-
if (finished) return;
|
|
9371
|
-
const at = /* @__PURE__ */ new Date();
|
|
9372
|
-
events.push({ at, sinceStartMs: at.getTime() - startedAt.getTime(), title, ...options });
|
|
9373
|
-
flush();
|
|
9374
|
-
},
|
|
9375
|
-
finish(final) {
|
|
9376
|
-
if (finished) return;
|
|
9377
|
-
finished = true;
|
|
9378
|
-
result = final;
|
|
9379
|
-
const at = /* @__PURE__ */ new Date();
|
|
9380
|
-
events.push({
|
|
9381
|
-
at,
|
|
9382
|
-
sinceStartMs: at.getTime() - startedAt.getTime(),
|
|
9383
|
-
title: OUTCOME_LABEL[final.outcome].replace(/^\S+\s/, ""),
|
|
9384
|
-
note: final.summary
|
|
9385
|
-
});
|
|
9386
|
-
flush();
|
|
9387
|
-
}
|
|
9388
|
-
};
|
|
9389
|
-
}
|
|
9390
|
-
var DEBUG_SESSION_DIR_ENV, NOOP_RUN, OUTCOME_LABEL, MAX_BLOCK_CHARS, SECRET_VALUE;
|
|
9391
|
-
var init_push_debug_log = __esm({
|
|
9392
|
-
"packages/experience-design-system-cli-legacy/src/lib/push-debug-log.ts"() {
|
|
9393
|
-
"use strict";
|
|
9394
|
-
init_client();
|
|
9395
|
-
DEBUG_SESSION_DIR_ENV = "EDS_DEBUG_SESSION_DIR";
|
|
9396
|
-
NOOP_RUN = { event: () => void 0, finish: () => void 0 };
|
|
9397
|
-
OUTCOME_LABEL = {
|
|
9398
|
-
"in-progress": "\u23F3 In progress (the process ended before the push finished)",
|
|
9399
|
-
pushed: "\u2705 Pushed",
|
|
9400
|
-
partial: "\u26A0\uFE0F Partly pushed (some items failed)",
|
|
9401
|
-
failed: "\u274C Push failed",
|
|
9402
|
-
"preview-failed": "\u274C Preview failed (nothing was sent to apply)",
|
|
9403
|
-
"nothing-to-push": "\u2139\uFE0F Nothing to push (the server says the space already matches)",
|
|
9404
|
-
skipped: "\u23ED\uFE0F Skipped",
|
|
9405
|
-
superseded: "\u21A9\uFE0F Superseded by a newer attempt"
|
|
9406
|
-
};
|
|
9407
|
-
MAX_BLOCK_CHARS = 1e5;
|
|
9408
|
-
SECRET_VALUE = /CFPAT-[A-Za-z0-9_-]{20,}|^Bearer\s+\S+/;
|
|
9409
|
-
}
|
|
9410
|
-
});
|
|
9411
|
-
|
|
9412
9204
|
// packages/experience-design-system-cli-legacy/src/tui/use-blinking-cursor.ts
|
|
9413
9205
|
import { useEffect as useEffect2, useState as useState3 } from "react";
|
|
9414
9206
|
function useBlinkingCursor() {
|
|
@@ -9428,8 +9220,8 @@ var init_use_blinking_cursor = __esm({
|
|
|
9428
9220
|
// packages/experience-design-system-cli-legacy/src/runs/path-prompt.tsx
|
|
9429
9221
|
import { useState as useState4 } from "react";
|
|
9430
9222
|
import { Box as Box6, Text as Text7 } from "ink";
|
|
9431
|
-
import { readdirSync
|
|
9432
|
-
import { dirname as dirname5, basename as basename2, join as
|
|
9223
|
+
import { readdirSync } from "node:fs";
|
|
9224
|
+
import { dirname as dirname5, basename as basename2, join as join10 } from "node:path";
|
|
9433
9225
|
import { jsx as jsx9, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
9434
9226
|
function autocomplete(partial) {
|
|
9435
9227
|
if (!partial) return null;
|
|
@@ -9438,19 +9230,19 @@ function autocomplete(partial) {
|
|
|
9438
9230
|
const base = basename2(normalized);
|
|
9439
9231
|
let entries;
|
|
9440
9232
|
try {
|
|
9441
|
-
entries =
|
|
9233
|
+
entries = readdirSync(dir);
|
|
9442
9234
|
} catch {
|
|
9443
9235
|
return null;
|
|
9444
9236
|
}
|
|
9445
9237
|
const matches = entries.filter((e) => e.startsWith(base));
|
|
9446
9238
|
if (matches.length === 0) return null;
|
|
9447
|
-
if (matches.length === 1) return
|
|
9239
|
+
if (matches.length === 1) return join10(dir, matches[0]);
|
|
9448
9240
|
let prefix = matches[0];
|
|
9449
9241
|
for (const m of matches) {
|
|
9450
9242
|
while (!m.startsWith(prefix)) prefix = prefix.slice(0, -1);
|
|
9451
9243
|
if (!prefix) break;
|
|
9452
9244
|
}
|
|
9453
|
-
return prefix.length > base.length ?
|
|
9245
|
+
return prefix.length > base.length ? join10(dir, prefix) : null;
|
|
9454
9246
|
}
|
|
9455
9247
|
function PathPrompt({
|
|
9456
9248
|
defaultPath,
|
|
@@ -9515,12 +9307,12 @@ var init_path_prompt = __esm({
|
|
|
9515
9307
|
|
|
9516
9308
|
// packages/experience-design-system-cli-legacy/src/runs/save-path-resolver.ts
|
|
9517
9309
|
import { access as access4 } from "node:fs/promises";
|
|
9518
|
-
import { join as
|
|
9310
|
+
import { join as join11 } from "node:path";
|
|
9519
9311
|
async function listConflictingFiles(path) {
|
|
9520
9312
|
const conflicts = [];
|
|
9521
9313
|
for (const name of SAVE_FILES) {
|
|
9522
9314
|
try {
|
|
9523
|
-
await access4(
|
|
9315
|
+
await access4(join11(path, name));
|
|
9524
9316
|
conflicts.push(name);
|
|
9525
9317
|
} catch {
|
|
9526
9318
|
}
|
|
@@ -9540,7 +9332,7 @@ function buildTimestampedSubdir(base, now = /* @__PURE__ */ new Date()) {
|
|
|
9540
9332
|
const hh = pad2(now.getHours());
|
|
9541
9333
|
const mm = pad2(now.getMinutes());
|
|
9542
9334
|
const ss = pad2(now.getSeconds());
|
|
9543
|
-
return
|
|
9335
|
+
return join11(base, `dsi-${y}${m}${d}-${hh}${mm}${ss}`);
|
|
9544
9336
|
}
|
|
9545
9337
|
var SAVE_FILES;
|
|
9546
9338
|
var init_save_path_resolver = __esm({
|
|
@@ -9552,7 +9344,7 @@ var init_save_path_resolver = __esm({
|
|
|
9552
9344
|
|
|
9553
9345
|
// packages/experience-design-system-cli-legacy/src/runs/store.ts
|
|
9554
9346
|
import { readFile as readFile12, writeFile as writeFile4, mkdir as mkdir4, rename } from "node:fs/promises";
|
|
9555
|
-
import { join as
|
|
9347
|
+
import { join as join12 } from "node:path";
|
|
9556
9348
|
import { homedir as homedir6 } from "node:os";
|
|
9557
9349
|
import { randomBytes as randomBytes2 } from "node:crypto";
|
|
9558
9350
|
function encodeBase32(bytes, length) {
|
|
@@ -9648,8 +9440,8 @@ var init_store = __esm({
|
|
|
9648
9440
|
RUNS_FILE_VERSION = 3;
|
|
9649
9441
|
RUNS_FILE_CAP = 200;
|
|
9650
9442
|
READABLE_VERSIONS = /* @__PURE__ */ new Set([1, 2, 3]);
|
|
9651
|
-
RUNS_DIR =
|
|
9652
|
-
RUNS_PATH =
|
|
9443
|
+
RUNS_DIR = join12(homedir6(), ".config", "experiences");
|
|
9444
|
+
RUNS_PATH = join12(RUNS_DIR, "runs.json");
|
|
9653
9445
|
CROCKFORD = "0123456789ABCDEFGHJKMNPQRSTVWXYZ";
|
|
9654
9446
|
}
|
|
9655
9447
|
});
|
|
@@ -9806,7 +9598,7 @@ var init_WelcomeStep = __esm({
|
|
|
9806
9598
|
import { useState as useState6, useEffect as useEffect3 } from "react";
|
|
9807
9599
|
import { Box as Box9, Text as Text10 } from "ink";
|
|
9808
9600
|
import { promises as fs } from "node:fs";
|
|
9809
|
-
import { join as
|
|
9601
|
+
import { join as join13 } from "node:path";
|
|
9810
9602
|
import { jsx as jsx12, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
9811
9603
|
async function countFiles(dir) {
|
|
9812
9604
|
const counts = {
|
|
@@ -9830,7 +9622,7 @@ async function countFiles(dir) {
|
|
|
9830
9622
|
await Promise.all(
|
|
9831
9623
|
entries.map(async (entry) => {
|
|
9832
9624
|
if (IGNORE_DIRS.has(entry)) return;
|
|
9833
|
-
const full =
|
|
9625
|
+
const full = join13(current, entry);
|
|
9834
9626
|
let stat7;
|
|
9835
9627
|
try {
|
|
9836
9628
|
stat7 = await fs.stat(full);
|
|
@@ -10906,7 +10698,6 @@ function WizardPreviewStep({
|
|
|
10906
10698
|
environmentId,
|
|
10907
10699
|
stepNumber,
|
|
10908
10700
|
totalSteps,
|
|
10909
|
-
droppedTokenDefaults = [],
|
|
10910
10701
|
onConfirm,
|
|
10911
10702
|
onEdit,
|
|
10912
10703
|
onQuit
|
|
@@ -10999,13 +10790,6 @@ function WizardPreviewStep({
|
|
|
10999
10790
|
}
|
|
11000
10791
|
)
|
|
11001
10792
|
] }) : /* @__PURE__ */ jsx19(Text17, { dimColor: true, children: "Nothing to push \u2014 everything is already up to date." }),
|
|
11002
|
-
droppedTokenDefaults.length > 0 && /* @__PURE__ */ jsxs16(Box16, { flexDirection: "column", children: [
|
|
11003
|
-
/* @__PURE__ */ jsx19(Text17, { color: PALETTE.warning, bold: true, children: "\u26A0 Some token defaults will be left out so the push can succeed:" }),
|
|
11004
|
-
droppedTokenDefaults.map((line) => /* @__PURE__ */ jsxs16(Text17, { color: PALETTE.warning, wrap: "truncate-end", children: [
|
|
11005
|
-
" ",
|
|
11006
|
-
line
|
|
11007
|
-
] }, line))
|
|
11008
|
-
] }),
|
|
11009
10793
|
breakingWithImpact && /* @__PURE__ */ jsx19(Box16, { marginTop: 1, children: /* @__PURE__ */ jsx19(Text17, { color: PALETTE.error, bold: true, children: "\u26A0 Breaking changes will affect downstream entities. Press Enter to acknowledge and apply." }) }),
|
|
11010
10794
|
/* @__PURE__ */ jsx19(SpaceEnvironment, { spaceId, environmentId }),
|
|
11011
10795
|
/* @__PURE__ */ jsxs16(Box16, { gap: 3, marginTop: 1, children: [
|
|
@@ -11057,7 +10841,7 @@ function DoneStep({
|
|
|
11057
10841
|
});
|
|
11058
10842
|
const totalFailed = componentTypes.failed + designTokens.failed;
|
|
11059
10843
|
const totalPushed = componentTypes.created + componentTypes.updated + componentTypes.removed + designTokens.created + designTokens.updated + designTokens.removed;
|
|
11060
|
-
const success = totalFailed === 0
|
|
10844
|
+
const success = totalFailed === 0;
|
|
11061
10845
|
function EntityRows({ entity, label }) {
|
|
11062
10846
|
return /* @__PURE__ */ jsxs17(Fragment5, { children: [
|
|
11063
10847
|
entity.created > 0 && /* @__PURE__ */ jsxs17(Box17, { gap: 1, children: [
|
|
@@ -11103,7 +10887,7 @@ function DoneStep({
|
|
|
11103
10887
|
] });
|
|
11104
10888
|
}
|
|
11105
10889
|
return /* @__PURE__ */ jsxs17(Box17, { flexDirection: "column", gap: 1, paddingX: 2, paddingY: 1, children: [
|
|
11106
|
-
success ? /* @__PURE__ */ jsx20(Text18, { bold: true, color: PALETTE.success, children: "Done!" }) : /* @__PURE__ */ jsx20(Text18, { bold: true, color: PALETTE.
|
|
10890
|
+
success ? /* @__PURE__ */ jsx20(Text18, { bold: true, color: PALETTE.success, children: "Done!" }) : /* @__PURE__ */ jsx20(Text18, { bold: true, color: PALETTE.warning, children: "\u26A0 Finished with errors" }),
|
|
11107
10891
|
totalPushed === 0 && totalFailed === 0 && !summary ? /* @__PURE__ */ jsx20(Box17, { marginTop: 1, children: /* @__PURE__ */ jsx20(Text18, { dimColor: true, children: "Nothing was pushed \u2014 everything was already up to date." }) }) : /* @__PURE__ */ jsxs17(Box17, { flexDirection: "column", gap: 0, marginTop: 1, children: [
|
|
11108
10892
|
/* @__PURE__ */ jsx20(EntityRows, { entity: componentTypes, label: "Component Type" }),
|
|
11109
10893
|
/* @__PURE__ */ jsx20(EntityRows, { entity: designTokens, label: "Design Token" }),
|
|
@@ -11523,8 +11307,8 @@ var init_types = __esm({
|
|
|
11523
11307
|
});
|
|
11524
11308
|
|
|
11525
11309
|
// packages/experience-design-system-extraction/dist/src/extract/tsx-shared.js
|
|
11526
|
-
import { existsSync as
|
|
11527
|
-
import { dirname as dirname6, join as
|
|
11310
|
+
import { existsSync as existsSync3, readFileSync as readFileSync5 } from "node:fs";
|
|
11311
|
+
import { dirname as dirname6, join as join14, resolve as resolve12 } from "node:path";
|
|
11528
11312
|
import { Node, Project, SyntaxKind } from "ts-morph";
|
|
11529
11313
|
import ts from "typescript";
|
|
11530
11314
|
function createTsxProject(filePaths) {
|
|
@@ -11723,8 +11507,8 @@ function findNearestTsConfigPath(filePath) {
|
|
|
11723
11507
|
let currentDir = dirname6(filePath);
|
|
11724
11508
|
while (true) {
|
|
11725
11509
|
for (const candidateName of ["tsconfig.json", "jsconfig.json"]) {
|
|
11726
|
-
const candidatePath =
|
|
11727
|
-
if (
|
|
11510
|
+
const candidatePath = join14(currentDir, candidateName);
|
|
11511
|
+
if (existsSync3(candidatePath)) {
|
|
11728
11512
|
nearestTsConfigPathCache.set(filePath, candidatePath);
|
|
11729
11513
|
return candidatePath;
|
|
11730
11514
|
}
|
|
@@ -11780,12 +11564,12 @@ function resolveImportSourcePath(basePath) {
|
|
|
11780
11564
|
`${basePath}.tsx`,
|
|
11781
11565
|
`${basePath}.js`,
|
|
11782
11566
|
`${basePath}.jsx`,
|
|
11783
|
-
|
|
11784
|
-
|
|
11785
|
-
|
|
11786
|
-
|
|
11567
|
+
join14(basePath, "index.ts"),
|
|
11568
|
+
join14(basePath, "index.tsx"),
|
|
11569
|
+
join14(basePath, "index.js"),
|
|
11570
|
+
join14(basePath, "index.jsx")
|
|
11787
11571
|
];
|
|
11788
|
-
return candidates.find((candidatePath) =>
|
|
11572
|
+
return candidates.find((candidatePath) => existsSync3(candidatePath));
|
|
11789
11573
|
}
|
|
11790
11574
|
function findProjectSourceFileByImportPath(project, resolvedPath) {
|
|
11791
11575
|
const candidatePaths = [
|
|
@@ -11794,10 +11578,10 @@ function findProjectSourceFileByImportPath(project, resolvedPath) {
|
|
|
11794
11578
|
`${resolvedPath}.tsx`,
|
|
11795
11579
|
`${resolvedPath}.js`,
|
|
11796
11580
|
`${resolvedPath}.jsx`,
|
|
11797
|
-
|
|
11798
|
-
|
|
11799
|
-
|
|
11800
|
-
|
|
11581
|
+
join14(resolvedPath, "index.ts"),
|
|
11582
|
+
join14(resolvedPath, "index.tsx"),
|
|
11583
|
+
join14(resolvedPath, "index.js"),
|
|
11584
|
+
join14(resolvedPath, "index.jsx")
|
|
11801
11585
|
];
|
|
11802
11586
|
for (const candidatePath of candidatePaths) {
|
|
11803
11587
|
const sourceFile = project.getSourceFile(candidatePath);
|
|
@@ -11818,10 +11602,10 @@ function findWorkspacePackageEntrySourceFile(originSourceFile, moduleSpecifier)
|
|
|
11818
11602
|
if (!packageRootDir)
|
|
11819
11603
|
return void 0;
|
|
11820
11604
|
const preferredEntryPaths = [
|
|
11821
|
-
|
|
11822
|
-
|
|
11823
|
-
|
|
11824
|
-
|
|
11605
|
+
join14(packageRootDir, "src/index.ts"),
|
|
11606
|
+
join14(packageRootDir, "src/index.tsx"),
|
|
11607
|
+
join14(packageRootDir, "index.ts"),
|
|
11608
|
+
join14(packageRootDir, "index.tsx")
|
|
11825
11609
|
];
|
|
11826
11610
|
for (const entryPath of preferredEntryPaths) {
|
|
11827
11611
|
const entrySourceFile = project.getSourceFile(entryPath);
|
|
@@ -11829,7 +11613,7 @@ function findWorkspacePackageEntrySourceFile(originSourceFile, moduleSpecifier)
|
|
|
11829
11613
|
return entrySourceFile;
|
|
11830
11614
|
}
|
|
11831
11615
|
}
|
|
11832
|
-
return candidateSourceFiles.find((sourceFile) => sourceFile.getDirectoryPath() ===
|
|
11616
|
+
return candidateSourceFiles.find((sourceFile) => sourceFile.getDirectoryPath() === join14(packageRootDir, "src"));
|
|
11833
11617
|
}
|
|
11834
11618
|
function getWorkspacePackageManifestForSourceFile(sourceFile) {
|
|
11835
11619
|
const packageRootDir = findNearestPackageRootDir(sourceFile.getFilePath());
|
|
@@ -11838,7 +11622,7 @@ function getWorkspacePackageManifestForSourceFile(sourceFile) {
|
|
|
11838
11622
|
if (workspacePackageManifestCache.has(packageRootDir)) {
|
|
11839
11623
|
return workspacePackageManifestCache.get(packageRootDir) ?? void 0;
|
|
11840
11624
|
}
|
|
11841
|
-
const packageJsonPath =
|
|
11625
|
+
const packageJsonPath = join14(packageRootDir, "package.json");
|
|
11842
11626
|
try {
|
|
11843
11627
|
const packageJson = JSON.parse(readFileSync5(packageJsonPath, "utf8"));
|
|
11844
11628
|
const manifest = typeof packageJson.name === "string" ? { name: packageJson.name, rootDir: packageRootDir } : null;
|
|
@@ -11855,7 +11639,7 @@ function findNearestPackageRootDir(filePath) {
|
|
|
11855
11639
|
}
|
|
11856
11640
|
let currentDir = dirname6(filePath);
|
|
11857
11641
|
while (true) {
|
|
11858
|
-
if (
|
|
11642
|
+
if (existsSync3(join14(currentDir, "package.json"))) {
|
|
11859
11643
|
packageRootByFilePathCache.set(filePath, currentDir);
|
|
11860
11644
|
return currentDir;
|
|
11861
11645
|
}
|
|
@@ -14917,8 +14701,8 @@ var init_vue_tsx = __esm({
|
|
|
14917
14701
|
});
|
|
14918
14702
|
|
|
14919
14703
|
// packages/experience-design-system-extraction/dist/src/extract/resolve-local-module.js
|
|
14920
|
-
import { existsSync as
|
|
14921
|
-
import { dirname as dirname7, join as
|
|
14704
|
+
import { existsSync as existsSync4, statSync as statSync2 } from "node:fs";
|
|
14705
|
+
import { dirname as dirname7, join as join15, resolve as resolve13 } from "node:path";
|
|
14922
14706
|
function resolveLocalModule(importingFilePath, specifier, options = {}) {
|
|
14923
14707
|
const basePath = resolve13(dirname7(importingFilePath), specifier);
|
|
14924
14708
|
const candidates = [
|
|
@@ -14927,18 +14711,18 @@ function resolveLocalModule(importingFilePath, specifier, options = {}) {
|
|
|
14927
14711
|
`${basePath}.ts`,
|
|
14928
14712
|
`${basePath}.mjs`,
|
|
14929
14713
|
`${basePath}.cjs`,
|
|
14930
|
-
|
|
14931
|
-
|
|
14932
|
-
|
|
14933
|
-
|
|
14714
|
+
join15(basePath, "index.js"),
|
|
14715
|
+
join15(basePath, "index.ts"),
|
|
14716
|
+
join15(basePath, "index.mjs"),
|
|
14717
|
+
join15(basePath, "index.cjs")
|
|
14934
14718
|
];
|
|
14935
14719
|
for (const candidate of candidates) {
|
|
14936
|
-
if (
|
|
14720
|
+
if (existsSync4(candidate) && statSync2(candidate).isFile())
|
|
14937
14721
|
return candidate;
|
|
14938
14722
|
}
|
|
14939
14723
|
if (options.allowJavaScriptExtensionFallback && basePath.endsWith(".js")) {
|
|
14940
14724
|
const tsPath = `${basePath.slice(0, -".js".length)}.ts`;
|
|
14941
|
-
if (
|
|
14725
|
+
if (existsSync4(tsPath) && statSync2(tsPath).isFile())
|
|
14942
14726
|
return tsPath;
|
|
14943
14727
|
}
|
|
14944
14728
|
return null;
|
|
@@ -14969,9 +14753,9 @@ var init_resolve_type_property = __esm({
|
|
|
14969
14753
|
|
|
14970
14754
|
// packages/experience-design-system-extraction/dist/src/extract/vue.js
|
|
14971
14755
|
import os from "node:os";
|
|
14972
|
-
import { basename as basename3, dirname as dirname8, resolve as resolve14, join as
|
|
14756
|
+
import { basename as basename3, dirname as dirname8, resolve as resolve14, join as join16 } from "node:path";
|
|
14973
14757
|
import { readFile as readFile15 } from "node:fs/promises";
|
|
14974
|
-
import { existsSync as
|
|
14758
|
+
import { existsSync as existsSync5, readFileSync as readFileSync6, readdirSync as readdirSync2, statSync as statSync3 } from "node:fs";
|
|
14975
14759
|
import { parse as parseSFC } from "@vue/compiler-sfc";
|
|
14976
14760
|
import { Project as Project3, Node as Node6 } from "ts-morph";
|
|
14977
14761
|
async function extractVueComponents(filePaths, onProgress) {
|
|
@@ -15184,11 +14968,11 @@ function findWorkspaceRoot(startDir) {
|
|
|
15184
14968
|
return workspaceRootCache.get(startDir);
|
|
15185
14969
|
let dir = startDir;
|
|
15186
14970
|
while (true) {
|
|
15187
|
-
const pkgJsonPath =
|
|
15188
|
-
if (
|
|
14971
|
+
const pkgJsonPath = join16(dir, "package.json");
|
|
14972
|
+
if (existsSync5(pkgJsonPath)) {
|
|
15189
14973
|
try {
|
|
15190
14974
|
const pkg4 = JSON.parse(readFileSync6(pkgJsonPath, "utf8"));
|
|
15191
|
-
if (pkg4.workspaces ||
|
|
14975
|
+
if (pkg4.workspaces || existsSync5(join16(dir, "pnpm-workspace.yaml"))) {
|
|
15192
14976
|
workspaceRootCache.set(startDir, dir);
|
|
15193
14977
|
return dir;
|
|
15194
14978
|
}
|
|
@@ -15208,8 +14992,8 @@ function getWorkspacePackageDirs(workspaceRoot) {
|
|
|
15208
14992
|
return workspacePackageDirsCache.get(workspaceRoot);
|
|
15209
14993
|
}
|
|
15210
14994
|
const packageMap = /* @__PURE__ */ new Map();
|
|
15211
|
-
const packagesDir =
|
|
15212
|
-
if (!
|
|
14995
|
+
const packagesDir = join16(workspaceRoot, "packages");
|
|
14996
|
+
if (!existsSync5(packagesDir)) {
|
|
15213
14997
|
workspacePackageDirsCache.set(workspaceRoot, packageMap);
|
|
15214
14998
|
return packageMap;
|
|
15215
14999
|
}
|
|
@@ -15218,12 +15002,12 @@ function getWorkspacePackageDirs(workspaceRoot) {
|
|
|
15218
15002
|
return;
|
|
15219
15003
|
let entries;
|
|
15220
15004
|
try {
|
|
15221
|
-
entries =
|
|
15005
|
+
entries = readdirSync2(dir);
|
|
15222
15006
|
} catch {
|
|
15223
15007
|
return;
|
|
15224
15008
|
}
|
|
15225
|
-
const pkgJsonPath =
|
|
15226
|
-
if (
|
|
15009
|
+
const pkgJsonPath = join16(dir, "package.json");
|
|
15010
|
+
if (existsSync5(pkgJsonPath)) {
|
|
15227
15011
|
try {
|
|
15228
15012
|
const pkg4 = JSON.parse(readFileSync6(pkgJsonPath, "utf8"));
|
|
15229
15013
|
if (typeof pkg4.name === "string") {
|
|
@@ -15235,7 +15019,7 @@ function getWorkspacePackageDirs(workspaceRoot) {
|
|
|
15235
15019
|
for (const entry of entries) {
|
|
15236
15020
|
if (entry === "node_modules" || entry === ".git" || entry.startsWith("."))
|
|
15237
15021
|
continue;
|
|
15238
|
-
const entryPath =
|
|
15022
|
+
const entryPath = join16(dir, entry);
|
|
15239
15023
|
try {
|
|
15240
15024
|
const stat7 = statSync3(entryPath);
|
|
15241
15025
|
if (stat7.isDirectory()) {
|
|
@@ -15275,28 +15059,28 @@ function resolveWorkspaceVueImport(specifier, importingFilePath) {
|
|
|
15275
15059
|
const packageDir = packageDirs.get(packageName);
|
|
15276
15060
|
if (!packageDir)
|
|
15277
15061
|
return null;
|
|
15278
|
-
const pkgJsonPath =
|
|
15062
|
+
const pkgJsonPath = join16(packageDir, "package.json");
|
|
15279
15063
|
try {
|
|
15280
15064
|
const pkg4 = JSON.parse(readFileSync6(pkgJsonPath, "utf8"));
|
|
15281
15065
|
if (pkg4.exports && subpath !== ".") {
|
|
15282
15066
|
const exportValue = pkg4.exports[subpath];
|
|
15283
15067
|
if (typeof exportValue === "string" && exportValue.endsWith(".vue")) {
|
|
15284
15068
|
const resolved = resolve14(packageDir, exportValue);
|
|
15285
|
-
if (
|
|
15069
|
+
if (existsSync5(resolved))
|
|
15286
15070
|
return resolved;
|
|
15287
15071
|
}
|
|
15288
15072
|
}
|
|
15289
15073
|
if (subpath !== ".") {
|
|
15290
15074
|
const subDir = resolve14(packageDir, subpath.replace(/^\.\//, ""));
|
|
15291
|
-
for (const base of [
|
|
15292
|
-
const subPkgPath =
|
|
15293
|
-
if (
|
|
15075
|
+
for (const base of [join16(packageDir, "src", subpath.replace(/^\.\//, "")), subDir]) {
|
|
15076
|
+
const subPkgPath = join16(base, "package.json");
|
|
15077
|
+
if (existsSync5(subPkgPath)) {
|
|
15294
15078
|
try {
|
|
15295
15079
|
const subPkg = JSON.parse(readFileSync6(subPkgPath, "utf8"));
|
|
15296
15080
|
const main = subPkg.main || subPkg.module;
|
|
15297
15081
|
if (typeof main === "string" && main.endsWith(".vue")) {
|
|
15298
15082
|
const resolved = resolve14(base, main);
|
|
15299
|
-
if (
|
|
15083
|
+
if (existsSync5(resolved))
|
|
15300
15084
|
return resolved;
|
|
15301
15085
|
}
|
|
15302
15086
|
} catch {
|
|
@@ -15308,7 +15092,7 @@ function resolveWorkspaceVueImport(specifier, importingFilePath) {
|
|
|
15308
15092
|
const main = pkg4.main || pkg4.module;
|
|
15309
15093
|
if (typeof main === "string" && main.endsWith(".vue")) {
|
|
15310
15094
|
const resolved = resolve14(packageDir, main);
|
|
15311
|
-
if (
|
|
15095
|
+
if (existsSync5(resolved))
|
|
15312
15096
|
return resolved;
|
|
15313
15097
|
}
|
|
15314
15098
|
}
|
|
@@ -15750,7 +15534,7 @@ var init_astro = __esm({
|
|
|
15750
15534
|
});
|
|
15751
15535
|
|
|
15752
15536
|
// packages/experience-design-system-extraction/dist/src/extract/web-components.js
|
|
15753
|
-
import { basename as basename5, dirname as dirname9, join as
|
|
15537
|
+
import { basename as basename5, dirname as dirname9, join as join17, resolve as resolve15 } from "node:path";
|
|
15754
15538
|
import { Project as Project5, Node as Node8, SyntaxKind as SyntaxKind6 } from "ts-morph";
|
|
15755
15539
|
function normalizeComponentName(input) {
|
|
15756
15540
|
return input.replace(/[^a-zA-Z0-9]/g, "").toLowerCase();
|
|
@@ -16403,14 +16187,14 @@ function resolveImportSourcePath2(fromFilePath, specifier) {
|
|
|
16403
16187
|
if (!specifier.startsWith(spectrumPrefix)) {
|
|
16404
16188
|
return null;
|
|
16405
16189
|
}
|
|
16406
|
-
const packagesMarker = `${
|
|
16190
|
+
const packagesMarker = `${join17("2nd-gen", "packages")}${fromFilePath.includes("\\") ? "\\" : "/"}`;
|
|
16407
16191
|
const markerIndex = fromFilePath.lastIndexOf(packagesMarker);
|
|
16408
16192
|
if (markerIndex === -1) {
|
|
16409
16193
|
return null;
|
|
16410
16194
|
}
|
|
16411
16195
|
const packagesRoot = fromFilePath.slice(0, markerIndex + packagesMarker.length - 1);
|
|
16412
16196
|
const componentPath = specifier.slice(spectrumPrefix.length);
|
|
16413
|
-
return
|
|
16197
|
+
return join17(packagesRoot, "core", "components", componentPath, "index.ts");
|
|
16414
16198
|
}
|
|
16415
16199
|
function getImportedBaseClass(classDecl, project, visitedFiles) {
|
|
16416
16200
|
const extendsClause = classDecl.getHeritageClauses().find((clause) => clause.getToken() === SyntaxKind6.ExtendsKeyword);
|
|
@@ -16677,8 +16461,8 @@ var init_scoring = __esm({
|
|
|
16677
16461
|
|
|
16678
16462
|
// packages/experience-design-system-extraction/dist/src/extract/svelte.js
|
|
16679
16463
|
import os3 from "node:os";
|
|
16680
|
-
import { basename as basename6, dirname as dirname10, resolve as resolve16, join as
|
|
16681
|
-
import { existsSync as
|
|
16464
|
+
import { basename as basename6, dirname as dirname10, resolve as resolve16, join as join18 } from "node:path";
|
|
16465
|
+
import { existsSync as existsSync6, readFileSync as readFileSync7 } from "node:fs";
|
|
16682
16466
|
import { createRequire } from "node:module";
|
|
16683
16467
|
import { parse as parseSvelte } from "svelte/compiler";
|
|
16684
16468
|
import { Project as Project6, Node as Node9, ScriptTarget, ModuleKind, ts as ts2 } from "ts-morph";
|
|
@@ -16811,8 +16595,8 @@ async function maybeRunResolveUnreachableRetry(components, warnings, retryContex
|
|
|
16811
16595
|
function findNearestTsconfig(startDir) {
|
|
16812
16596
|
let dir = startDir;
|
|
16813
16597
|
for (let i = 0; i < 16; i++) {
|
|
16814
|
-
const candidate =
|
|
16815
|
-
if (
|
|
16598
|
+
const candidate = join18(dir, "tsconfig.json");
|
|
16599
|
+
if (existsSync6(candidate))
|
|
16816
16600
|
return candidate;
|
|
16817
16601
|
const parent = dirname10(dir);
|
|
16818
16602
|
if (!parent || parent === dir)
|
|
@@ -16947,29 +16731,29 @@ function locateDtsForSpecifier(req, specifier, parentFile) {
|
|
|
16947
16731
|
const seedDir = resolvedJs ? dirname10(resolvedJs) : dirname10(parentFile);
|
|
16948
16732
|
const pkgRoot = findPackageRootForSpecifier(seedDir, specifier);
|
|
16949
16733
|
if (pkgRoot) {
|
|
16950
|
-
const pkgJsonPath =
|
|
16951
|
-
if (
|
|
16734
|
+
const pkgJsonPath = join18(pkgRoot, "package.json");
|
|
16735
|
+
if (existsSync6(pkgJsonPath)) {
|
|
16952
16736
|
try {
|
|
16953
16737
|
const pkgRaw = readFileSync7(pkgJsonPath, "utf-8");
|
|
16954
16738
|
const pkg4 = JSON.parse(pkgRaw);
|
|
16955
16739
|
const typesField = pkg4.types ?? pkg4.typings;
|
|
16956
16740
|
if (typeof typesField === "string") {
|
|
16957
16741
|
const candidate = resolve16(pkgRoot, typesField);
|
|
16958
|
-
if (
|
|
16742
|
+
if (existsSync6(candidate))
|
|
16959
16743
|
return candidate;
|
|
16960
16744
|
}
|
|
16961
16745
|
const exportsTypes = extractTypesFromExports(pkg4.exports);
|
|
16962
16746
|
if (exportsTypes) {
|
|
16963
16747
|
const candidate = resolve16(pkgRoot, exportsTypes);
|
|
16964
|
-
if (
|
|
16748
|
+
if (existsSync6(candidate))
|
|
16965
16749
|
return candidate;
|
|
16966
16750
|
}
|
|
16967
16751
|
} catch {
|
|
16968
16752
|
}
|
|
16969
16753
|
}
|
|
16970
16754
|
for (const entry of ["index.d.ts", "index.d.mts"]) {
|
|
16971
|
-
const candidate =
|
|
16972
|
-
if (
|
|
16755
|
+
const candidate = join18(pkgRoot, entry);
|
|
16756
|
+
if (existsSync6(candidate))
|
|
16973
16757
|
return candidate;
|
|
16974
16758
|
}
|
|
16975
16759
|
}
|
|
@@ -16977,7 +16761,7 @@ function locateDtsForSpecifier(req, specifier, parentFile) {
|
|
|
16977
16761
|
const noExt = resolvedJs.replace(/\.(m?js|cjs)$/, "");
|
|
16978
16762
|
for (const ext of [".d.ts", ".d.mts"]) {
|
|
16979
16763
|
const candidate = `${noExt}${ext}`;
|
|
16980
|
-
if (
|
|
16764
|
+
if (existsSync6(candidate))
|
|
16981
16765
|
return candidate;
|
|
16982
16766
|
}
|
|
16983
16767
|
}
|
|
@@ -16986,9 +16770,9 @@ function locateDtsForSpecifier(req, specifier, parentFile) {
|
|
|
16986
16770
|
function findPackageRootForSpecifier(seedDir, specifier) {
|
|
16987
16771
|
let dir = seedDir;
|
|
16988
16772
|
for (let i = 0; i < 32; i++) {
|
|
16989
|
-
if (
|
|
16773
|
+
if (existsSync6(join18(dir, "package.json"))) {
|
|
16990
16774
|
try {
|
|
16991
|
-
const pkgRaw = readFileSync7(
|
|
16775
|
+
const pkgRaw = readFileSync7(join18(dir, "package.json"), "utf-8");
|
|
16992
16776
|
const pkg4 = JSON.parse(pkgRaw);
|
|
16993
16777
|
if (pkg4.name === specifier)
|
|
16994
16778
|
return dir;
|
|
@@ -19001,88 +18785,6 @@ var init_spawn_generate = __esm({
|
|
|
19001
18785
|
}
|
|
19002
18786
|
});
|
|
19003
18787
|
|
|
19004
|
-
// packages/experience-design-system-cli-legacy/src/apply/dangling-token-defaults.ts
|
|
19005
|
-
import { parseCDFComponents as parseCDFComponents3 } from "@contentful/experience-design-system-types";
|
|
19006
|
-
function isRecord(value) {
|
|
19007
|
-
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
19008
|
-
}
|
|
19009
|
-
function dropDanglingTokenDefaults(cdf, existingTokenIds) {
|
|
19010
|
-
const known = new Set(existingTokenIds);
|
|
19011
|
-
for (const { path } of parseCDFComponents3(cdf).tokens) known.add(path);
|
|
19012
|
-
const copy = structuredClone(cdf);
|
|
19013
|
-
const dropped = [];
|
|
19014
|
-
const walk = (node, prefix) => {
|
|
19015
|
-
for (const [key, value] of Object.entries(node)) {
|
|
19016
|
-
if (key.startsWith("$") || !isRecord(value)) continue;
|
|
19017
|
-
const path = prefix ? `${prefix}.${key}` : key;
|
|
19018
|
-
const properties = value["$properties"];
|
|
19019
|
-
if (value["$type"] === "component" && isRecord(properties)) {
|
|
19020
|
-
for (const [name, property] of Object.entries(properties)) {
|
|
19021
|
-
if (!isRecord(property) || property["$type"] !== "token") continue;
|
|
19022
|
-
const reference = property["$default"];
|
|
19023
|
-
if (typeof reference === "string" && reference !== "" && !known.has(reference)) {
|
|
19024
|
-
delete property["$default"];
|
|
19025
|
-
dropped.push({ component: path, property: name, token: reference });
|
|
19026
|
-
}
|
|
19027
|
-
}
|
|
19028
|
-
} else {
|
|
19029
|
-
walk(value, path);
|
|
19030
|
-
}
|
|
19031
|
-
}
|
|
19032
|
-
};
|
|
19033
|
-
walk(copy, "");
|
|
19034
|
-
return { cdf: copy, dropped };
|
|
19035
|
-
}
|
|
19036
|
-
function describeDroppedTokenDefaults(dropped) {
|
|
19037
|
-
return dropped.map(
|
|
19038
|
-
({ component, property, token }) => `${component}.${property}: default "${token}" left out \u2014 that design token does not exist in this environment`
|
|
19039
|
-
);
|
|
19040
|
-
}
|
|
19041
|
-
var init_dangling_token_defaults = __esm({
|
|
19042
|
-
"packages/experience-design-system-cli-legacy/src/apply/dangling-token-defaults.ts"() {
|
|
19043
|
-
"use strict";
|
|
19044
|
-
}
|
|
19045
|
-
});
|
|
19046
|
-
|
|
19047
|
-
// packages/experience-design-system-cli-legacy/src/helpers/build-contentful-management-client.ts
|
|
19048
|
-
import { createClient as createClient2 } from "contentful-management";
|
|
19049
|
-
function buildContentfulManagementClient(opts) {
|
|
19050
|
-
return createClient2(
|
|
19051
|
-
{
|
|
19052
|
-
accessToken: opts.cmaToken,
|
|
19053
|
-
...opts.host ? { host: toConfiguredHost(opts.host) } : {}
|
|
19054
|
-
},
|
|
19055
|
-
{ type: "plain" }
|
|
19056
|
-
);
|
|
19057
|
-
}
|
|
19058
|
-
var init_build_contentful_management_client = __esm({
|
|
19059
|
-
"packages/experience-design-system-cli-legacy/src/helpers/build-contentful-management-client.ts"() {
|
|
19060
|
-
"use strict";
|
|
19061
|
-
init_host_utils();
|
|
19062
|
-
}
|
|
19063
|
-
});
|
|
19064
|
-
|
|
19065
|
-
// packages/experience-design-system-cli-legacy/src/helpers/fetch-existing-token-ids.ts
|
|
19066
|
-
import { fetchAll } from "contentful-management";
|
|
19067
|
-
async function fetchExistingTokenIds(params) {
|
|
19068
|
-
const client2 = buildContentfulManagementClient({
|
|
19069
|
-
cmaToken: params.cmaToken,
|
|
19070
|
-
...params.host ? { host: params.host } : {}
|
|
19071
|
-
});
|
|
19072
|
-
const tokens = await fetchAll(client2.designToken.getMany, {
|
|
19073
|
-
spaceId: params.spaceId,
|
|
19074
|
-
environmentId: params.environmentId,
|
|
19075
|
-
query: { cursor: true, limit: 1e3 }
|
|
19076
|
-
});
|
|
19077
|
-
return new Set(tokens.map((token) => token.sys.id));
|
|
19078
|
-
}
|
|
19079
|
-
var init_fetch_existing_token_ids = __esm({
|
|
19080
|
-
"packages/experience-design-system-cli-legacy/src/helpers/fetch-existing-token-ids.ts"() {
|
|
19081
|
-
"use strict";
|
|
19082
|
-
init_build_contentful_management_client();
|
|
19083
|
-
}
|
|
19084
|
-
});
|
|
19085
|
-
|
|
19086
18788
|
// packages/experience-design-system-cli-legacy/src/analyze/composite-closure.ts
|
|
19087
18789
|
function edgesFrom(component, known) {
|
|
19088
18790
|
if (!component) return [];
|
|
@@ -20424,17 +20126,17 @@ function buildCycleUnits(slotCycles) {
|
|
|
20424
20126
|
const groups = /* @__PURE__ */ new Map();
|
|
20425
20127
|
for (const node of parent.keys()) {
|
|
20426
20128
|
const root = find(node);
|
|
20427
|
-
let
|
|
20428
|
-
if (!
|
|
20429
|
-
|
|
20430
|
-
groups.set(root,
|
|
20129
|
+
let group = groups.get(root);
|
|
20130
|
+
if (!group) {
|
|
20131
|
+
group = /* @__PURE__ */ new Set();
|
|
20132
|
+
groups.set(root, group);
|
|
20431
20133
|
}
|
|
20432
|
-
|
|
20134
|
+
group.add(node);
|
|
20433
20135
|
}
|
|
20434
20136
|
const out = /* @__PURE__ */ new Map();
|
|
20435
|
-
for (const
|
|
20436
|
-
for (const node of
|
|
20437
|
-
out.set(node,
|
|
20137
|
+
for (const group of groups.values()) {
|
|
20138
|
+
for (const node of group) {
|
|
20139
|
+
out.set(node, group);
|
|
20438
20140
|
}
|
|
20439
20141
|
}
|
|
20440
20142
|
return out;
|
|
@@ -21928,10 +21630,10 @@ function swapValues(values, firstIndex, secondIndex) {
|
|
|
21928
21630
|
[next[firstIndex], next[secondIndex]] = [next[secondIndex], next[firstIndex]];
|
|
21929
21631
|
return next;
|
|
21930
21632
|
}
|
|
21931
|
-
function parseToState(
|
|
21633
|
+
function parseToState(json) {
|
|
21932
21634
|
let parsed;
|
|
21933
21635
|
try {
|
|
21934
|
-
parsed = JSON.parse(
|
|
21636
|
+
parsed = JSON.parse(json);
|
|
21935
21637
|
} catch (e) {
|
|
21936
21638
|
return {
|
|
21937
21639
|
state: { componentDescription: "", props: [], slots: [] },
|
|
@@ -22784,11 +22486,11 @@ function FieldEditor({
|
|
|
22784
22486
|
setEditorState(next);
|
|
22785
22487
|
onChange(serializeState(next, value));
|
|
22786
22488
|
};
|
|
22787
|
-
const canonicalize = React14.useCallback((
|
|
22489
|
+
const canonicalize = React14.useCallback((json) => {
|
|
22788
22490
|
try {
|
|
22789
|
-
return JSON.stringify(JSON.parse(
|
|
22491
|
+
return JSON.stringify(JSON.parse(json));
|
|
22790
22492
|
} catch {
|
|
22791
|
-
return `__unparseable__:${
|
|
22493
|
+
return `__unparseable__:${json}`;
|
|
22792
22494
|
}
|
|
22793
22495
|
}, []);
|
|
22794
22496
|
const initialStateRef = React14.useRef(initialState);
|
|
@@ -23362,14 +23064,14 @@ function FieldEditor({
|
|
|
23362
23064
|
})();
|
|
23363
23065
|
const rows = [];
|
|
23364
23066
|
rows.push({ kind: "component-description" });
|
|
23365
|
-
for (const
|
|
23366
|
-
if (
|
|
23067
|
+
for (const group of propGroups.filter((candidate) => candidate.kind !== "hidden")) {
|
|
23068
|
+
if (group.indexes.length === 0) continue;
|
|
23367
23069
|
rows.push({
|
|
23368
23070
|
kind: "header",
|
|
23369
|
-
label: `${
|
|
23370
|
-
section:
|
|
23071
|
+
label: `${group.label} (${group.indexes.length}) `,
|
|
23072
|
+
section: group.kind
|
|
23371
23073
|
});
|
|
23372
|
-
|
|
23074
|
+
group.indexes.forEach((idx) => rows.push({ kind: "prop", idx }));
|
|
23373
23075
|
}
|
|
23374
23076
|
if (slots.length > 0) {
|
|
23375
23077
|
rows.push({
|
|
@@ -23379,7 +23081,7 @@ function FieldEditor({
|
|
|
23379
23081
|
});
|
|
23380
23082
|
slots.forEach((_, i) => rows.push({ kind: "slot", idx: i }));
|
|
23381
23083
|
}
|
|
23382
|
-
const hiddenGroup = propGroups.find((
|
|
23084
|
+
const hiddenGroup = propGroups.find((group) => group.kind === "hidden");
|
|
23383
23085
|
if (hiddenGroup && hiddenGroup.indexes.length > 0) {
|
|
23384
23086
|
rows.push({
|
|
23385
23087
|
kind: "header",
|
|
@@ -27121,8 +26823,26 @@ var init_runScopeGate = __esm({
|
|
|
27121
26823
|
}
|
|
27122
26824
|
});
|
|
27123
26825
|
|
|
26826
|
+
// packages/experience-design-system-cli-legacy/src/helpers/build-contentful-management-client.ts
|
|
26827
|
+
import { createClient as createClient2 } from "contentful-management";
|
|
26828
|
+
function buildContentfulManagementClient(opts) {
|
|
26829
|
+
return createClient2(
|
|
26830
|
+
{
|
|
26831
|
+
accessToken: opts.cmaToken,
|
|
26832
|
+
...opts.host ? { host: toConfiguredHost(opts.host) } : {}
|
|
26833
|
+
},
|
|
26834
|
+
{ type: "plain" }
|
|
26835
|
+
);
|
|
26836
|
+
}
|
|
26837
|
+
var init_build_contentful_management_client = __esm({
|
|
26838
|
+
"packages/experience-design-system-cli-legacy/src/helpers/build-contentful-management-client.ts"() {
|
|
26839
|
+
"use strict";
|
|
26840
|
+
init_host_utils();
|
|
26841
|
+
}
|
|
26842
|
+
});
|
|
26843
|
+
|
|
27124
26844
|
// packages/experience-design-system-cli-legacy/src/helpers/fetch-existing-contentful-entities.ts
|
|
27125
|
-
import { fetchAll
|
|
26845
|
+
import { fetchAll } from "contentful-management";
|
|
27126
26846
|
async function fetchExistingContentfulEntitiesFromContentful(client2, params) {
|
|
27127
26847
|
const componentScope = {
|
|
27128
26848
|
spaceId: params.spaceId,
|
|
@@ -27134,8 +26854,8 @@ async function fetchExistingContentfulEntitiesFromContentful(client2, params) {
|
|
|
27134
26854
|
environmentId: params.environmentId,
|
|
27135
26855
|
query: { cursor: true, limit: 1e3 }
|
|
27136
26856
|
};
|
|
27137
|
-
const components = await
|
|
27138
|
-
const tokens = await
|
|
26857
|
+
const components = await fetchAll(client2.component.getMany, componentScope);
|
|
26858
|
+
const tokens = await fetchAll(client2.designToken.getMany, tokenScope);
|
|
27139
26859
|
return { components, tokens };
|
|
27140
26860
|
}
|
|
27141
26861
|
var init_fetch_existing_contentful_entities = __esm({
|
|
@@ -27146,7 +26866,7 @@ var init_fetch_existing_contentful_entities = __esm({
|
|
|
27146
26866
|
|
|
27147
26867
|
// packages/experience-design-system-cli-legacy/src/helpers/fetch-and-persist-existing-contentful-entities.ts
|
|
27148
26868
|
import { writeFile as writeFile5 } from "node:fs/promises";
|
|
27149
|
-
import { join as
|
|
26869
|
+
import { join as join19 } from "node:path";
|
|
27150
26870
|
async function fetchAndPersistExistingContentfulEntities(params) {
|
|
27151
26871
|
const t0 = Date.now();
|
|
27152
26872
|
try {
|
|
@@ -27158,7 +26878,7 @@ async function fetchAndPersistExistingContentfulEntities(params) {
|
|
|
27158
26878
|
spaceId: params.spaceId,
|
|
27159
26879
|
environmentId: params.environmentId
|
|
27160
26880
|
});
|
|
27161
|
-
const path =
|
|
26881
|
+
const path = join19(params.outDir, ".existing-entities.json");
|
|
27162
26882
|
await writeFile5(path, JSON.stringify(entities, null, 2), "utf8");
|
|
27163
26883
|
return { ok: true, path, durationMs: Date.now() - t0, entities };
|
|
27164
26884
|
} catch (error) {
|
|
@@ -27335,8 +27055,8 @@ __export(WizardApp_exports, {
|
|
|
27335
27055
|
});
|
|
27336
27056
|
import { useEffect as useEffect15, useRef as useRef10, useState as useState23 } from "react";
|
|
27337
27057
|
import { Box as Box42, Text as Text46 } from "ink";
|
|
27338
|
-
import { join as
|
|
27339
|
-
import { appendFileSync as appendFileSync2, writeFileSync
|
|
27058
|
+
import { join as join20, resolve as resolve17 } from "node:path";
|
|
27059
|
+
import { appendFileSync as appendFileSync2, writeFileSync } from "node:fs";
|
|
27340
27060
|
import { access as access7, stat as stat5, writeFile as writeFile6 } from "node:fs/promises";
|
|
27341
27061
|
import { tmpdir } from "node:os";
|
|
27342
27062
|
import { execFile as execFile2, spawn as spawn3 } from "node:child_process";
|
|
@@ -27476,7 +27196,7 @@ function WizardApp({
|
|
|
27476
27196
|
const logInit = useRef10(false);
|
|
27477
27197
|
const initialAgentAuthRef = useRef10(initialAgentAuth ?? null);
|
|
27478
27198
|
if (!logInit.current) {
|
|
27479
|
-
|
|
27199
|
+
writeFileSync(WIZARD_LOG, `--- experiences import session ${(/* @__PURE__ */ new Date()).toISOString()} ---
|
|
27480
27200
|
`);
|
|
27481
27201
|
logInit.current = true;
|
|
27482
27202
|
}
|
|
@@ -27485,7 +27205,6 @@ function WizardApp({
|
|
|
27485
27205
|
tokensPath: ""
|
|
27486
27206
|
});
|
|
27487
27207
|
const allowEmptyDeleteAllRef = useRef10(false);
|
|
27488
|
-
const pushDebugRef = useRef10(null);
|
|
27489
27208
|
const generateChildRef = useRef10(null);
|
|
27490
27209
|
const generationCachePreflightRef = useRef10(null);
|
|
27491
27210
|
const selectionToReviewStartedAtRef = useRef10(null);
|
|
@@ -27504,7 +27223,7 @@ function WizardApp({
|
|
|
27504
27223
|
const rawTokensEntryReady = !!initialRawTokensPath;
|
|
27505
27224
|
const effectiveNoCache = resolveNoCacheForGenerate({ cliNoCache: noCache });
|
|
27506
27225
|
const initialStepResolved = rawTokensEntryReady ? initialProjectPath ? "path-validation" : "credentials" : initialProjectPath ? "token-input" : "welcome";
|
|
27507
|
-
const initialOutDir = initialProjectPath ?
|
|
27226
|
+
const initialOutDir = initialProjectPath ? join20(resolve17(initialProjectPath), ".contentful") : "";
|
|
27508
27227
|
const [state, setState] = useState23({
|
|
27509
27228
|
step: initialStepResolved,
|
|
27510
27229
|
agent: initialAgent ?? "claude",
|
|
@@ -27560,7 +27279,6 @@ function WizardApp({
|
|
|
27560
27279
|
existingEntitiesStatus: "idle",
|
|
27561
27280
|
lastRunId: null,
|
|
27562
27281
|
finalizeErrorBanner: null,
|
|
27563
|
-
droppedTokenDefaults: [],
|
|
27564
27282
|
finalReviewPassed: false
|
|
27565
27283
|
});
|
|
27566
27284
|
useEffect15(() => {
|
|
@@ -27703,7 +27421,7 @@ If you are using AWS Bedrock, run:
|
|
|
27703
27421
|
}
|
|
27704
27422
|
const sessionMatch = /^session=(.+)$/m.exec(result.stdout);
|
|
27705
27423
|
const tokenSessionId = sessionMatch ? sessionMatch[1].trim() : null;
|
|
27706
|
-
const tokensPath =
|
|
27424
|
+
const tokensPath = join20(outDir, "tokens.json");
|
|
27707
27425
|
const printArgs = ["print", "tokens", "--out", tokensPath];
|
|
27708
27426
|
if (tokenSessionId) printArgs.push("--session", tokenSessionId);
|
|
27709
27427
|
const r = await runCli(printArgs);
|
|
@@ -27725,7 +27443,7 @@ If you are using AWS Bedrock, run:
|
|
|
27725
27443
|
tokenGenerationStatus: "complete",
|
|
27726
27444
|
skipComponents: true,
|
|
27727
27445
|
acceptedCount: 0,
|
|
27728
|
-
outDir: state.outDir ||
|
|
27446
|
+
outDir: state.outDir || join20(process.cwd(), ".contentful")
|
|
27729
27447
|
});
|
|
27730
27448
|
update({ step: "credentials" });
|
|
27731
27449
|
return true;
|
|
@@ -27866,7 +27584,7 @@ If you are using AWS Bedrock, run:
|
|
|
27866
27584
|
return promise;
|
|
27867
27585
|
};
|
|
27868
27586
|
const runExtract = async (projectPath, showProgress = true) => {
|
|
27869
|
-
const outDir =
|
|
27587
|
+
const outDir = join20(resolve17(projectPath), ".contentful");
|
|
27870
27588
|
const existingEntitiesExpected = !state.credentialsSkipped && Boolean(state.spaceId && state.environmentId && state.cmaToken && projectPath);
|
|
27871
27589
|
update({
|
|
27872
27590
|
...showProgress ? { step: "extracting" } : {},
|
|
@@ -28541,30 +28259,12 @@ Make sure this path contains TypeScript/React/Vue component files (.tsx, .ts, .v
|
|
|
28541
28259
|
void runSaveAndPush();
|
|
28542
28260
|
};
|
|
28543
28261
|
const runPreview = async (extractSessionId, tokensPath, spaceId, environmentId, cmaToken, host2) => {
|
|
28544
|
-
const resolvedHost = resolveWizardHost(host2);
|
|
28545
|
-
pushDebugRef.current?.finish({
|
|
28546
|
-
outcome: "superseded",
|
|
28547
|
-
summary: "A new push attempt started before this one finished."
|
|
28548
|
-
});
|
|
28549
|
-
const pushDebug = startPushDebugRun({
|
|
28550
|
-
space_id: spaceId,
|
|
28551
|
-
environment_id: environmentId,
|
|
28552
|
-
host: resolvedHost,
|
|
28553
|
-
cma_token: cmaToken,
|
|
28554
|
-
extract_session_id: extractSessionId,
|
|
28555
|
-
tokens_file: tokensPath || null,
|
|
28556
|
-
delete_everything_not_listed: allowEmptyDeleteAllRef.current
|
|
28557
|
-
});
|
|
28558
|
-
pushDebugRef.current = pushDebug;
|
|
28559
28262
|
if (shouldBypassPreview(state)) {
|
|
28560
|
-
pushDebug.finish({
|
|
28561
|
-
outcome: "skipped",
|
|
28562
|
-
summary: "Credentials were skipped, so nothing is previewed or pushed. Files were saved only."
|
|
28563
|
-
});
|
|
28564
28263
|
update(buildSkippedPreviewTransition());
|
|
28565
28264
|
return;
|
|
28566
28265
|
}
|
|
28567
28266
|
update({ step: "previewing" });
|
|
28267
|
+
const resolvedHost = resolveWizardHost(host2);
|
|
28568
28268
|
try {
|
|
28569
28269
|
const client2 = new ImportApiClient({
|
|
28570
28270
|
cmaToken,
|
|
@@ -28572,7 +28272,6 @@ Make sure this path contains TypeScript/React/Vue component files (.tsx, .ts, .v
|
|
|
28572
28272
|
environmentId,
|
|
28573
28273
|
host: resolvedHost
|
|
28574
28274
|
});
|
|
28575
|
-
pushDebug.event("Preview started", { note: `POST ${resolvedHost}/\u2026/design_systems/imports/preview` });
|
|
28576
28275
|
let components = [];
|
|
28577
28276
|
if (extractSessionId) {
|
|
28578
28277
|
const db = openPipelineDb();
|
|
@@ -28588,16 +28287,7 @@ Make sure this path contains TypeScript/React/Vue component files (.tsx, .ts, .v
|
|
|
28588
28287
|
tokens = await readTokensFromPath("tokens", tokensPath);
|
|
28589
28288
|
}
|
|
28590
28289
|
let cdf = buildCDF3(components, toCDFTokens(tokens), { deleteAll: allowEmptyDeleteAllRef.current });
|
|
28591
|
-
pushDebug.event("Built the CDF to send", {
|
|
28592
|
-
note: `${summarizeCdf(cdf).length} entries`,
|
|
28593
|
-
data: { entries: summarizeCdf(cdf), tokens_loaded: tokens.length }
|
|
28594
|
-
});
|
|
28595
28290
|
let preview = await client2.previewImport(cdf);
|
|
28596
|
-
pushDebug.event("Server previewed the CDF", {
|
|
28597
|
-
note: "what the server would create, change, leave alone or remove",
|
|
28598
|
-
data: summarizePreview(preview),
|
|
28599
|
-
requestId: client2.getLastRequestId()
|
|
28600
|
-
});
|
|
28601
28291
|
if (extractSessionId) {
|
|
28602
28292
|
let needsRepreview = false;
|
|
28603
28293
|
const db = openPipelineDb();
|
|
@@ -28617,27 +28307,15 @@ Make sure this path contains TypeScript/React/Vue component files (.tsx, .ts, .v
|
|
|
28617
28307
|
if (seededDefaults > 0) needsRepreview = true;
|
|
28618
28308
|
}
|
|
28619
28309
|
if (needsRepreview) {
|
|
28620
|
-
pushDebug.event("Re-previewing", {
|
|
28621
|
-
note: "the server listed components as removed or changed that exist locally, so defaults were filled in"
|
|
28622
|
-
});
|
|
28623
28310
|
components = loadCDFComponents(db, extractSessionId);
|
|
28624
28311
|
cdf = buildCDF3(components, toCDFTokens(tokens), { deleteAll: allowEmptyDeleteAllRef.current });
|
|
28625
28312
|
preview = await client2.previewImport(cdf);
|
|
28626
|
-
pushDebug.event("Server previewed the updated CDF", {
|
|
28627
|
-
data: summarizePreview(preview),
|
|
28628
|
-
requestId: client2.getLastRequestId()
|
|
28629
|
-
});
|
|
28630
28313
|
}
|
|
28631
28314
|
} finally {
|
|
28632
28315
|
db.close();
|
|
28633
28316
|
}
|
|
28634
28317
|
}
|
|
28635
28318
|
if (isEmptyPreview(preview)) {
|
|
28636
|
-
pushDebug.finish({
|
|
28637
|
-
outcome: "nothing-to-push",
|
|
28638
|
-
summary: "The server says every component and token in the CDF already matches what is in this space, so no apply request was sent. If the space looks empty, check that this is the space and environment you are viewing.",
|
|
28639
|
-
details: { preview: summarizePreview(preview), request_id: client2.getLastRequestId() }
|
|
28640
|
-
});
|
|
28641
28319
|
update({
|
|
28642
28320
|
step: "done",
|
|
28643
28321
|
serverPreview: preview,
|
|
@@ -28649,44 +28327,14 @@ Make sure this path contains TypeScript/React/Vue component files (.tsx, .ts, .v
|
|
|
28649
28327
|
});
|
|
28650
28328
|
return;
|
|
28651
28329
|
}
|
|
28652
|
-
let cdfToPush = cdf;
|
|
28653
|
-
let droppedTokenDefaults = [];
|
|
28654
|
-
try {
|
|
28655
|
-
const existingTokenIds = await fetchExistingTokenIds({
|
|
28656
|
-
spaceId,
|
|
28657
|
-
environmentId,
|
|
28658
|
-
cmaToken,
|
|
28659
|
-
...host2 ? { host: host2 } : {}
|
|
28660
|
-
});
|
|
28661
|
-
const checked = dropDanglingTokenDefaults(cdf, existingTokenIds);
|
|
28662
|
-
cdfToPush = checked.cdf;
|
|
28663
|
-
droppedTokenDefaults = describeDroppedTokenDefaults(checked.dropped);
|
|
28664
|
-
pushDebug.event("Checked token references", {
|
|
28665
|
-
note: checked.dropped.length === 0 ? `every token default exists (${existingTokenIds.size} tokens in this environment)` : `${checked.dropped.length} default(s) point at a token that does not exist and will be left out`,
|
|
28666
|
-
data: { tokens_in_environment: existingTokenIds.size, dropped: checked.dropped }
|
|
28667
|
-
});
|
|
28668
|
-
} catch (tokenCheckError) {
|
|
28669
|
-
pushDebug.event("Could not check token references", {
|
|
28670
|
-
note: tokenCheckError instanceof Error ? tokenCheckError.message : String(tokenCheckError)
|
|
28671
|
-
});
|
|
28672
|
-
}
|
|
28673
|
-
pushDebug.event("Waiting for confirmation", {
|
|
28674
|
-
note: "the preview shows changes, so the wizard asks before pushing"
|
|
28675
|
-
});
|
|
28676
28330
|
update({
|
|
28677
28331
|
step: "preview-gate",
|
|
28678
28332
|
serverPreview: preview,
|
|
28679
|
-
cdf
|
|
28680
|
-
droppedTokenDefaults,
|
|
28333
|
+
cdf,
|
|
28681
28334
|
finalizeErrorBanner: null,
|
|
28682
28335
|
...clearedValidationErrorState()
|
|
28683
28336
|
});
|
|
28684
28337
|
} catch (e) {
|
|
28685
|
-
pushDebug.finish({
|
|
28686
|
-
outcome: "preview-failed",
|
|
28687
|
-
summary: e instanceof ApiError ? `The preview request was rejected with HTTP ${e.status}.` : `The preview failed before the server answered: ${e instanceof Error ? e.message : String(e)}`,
|
|
28688
|
-
details: e instanceof ApiError ? { status: e.status, body: (e.body ?? "").slice(0, 4e3) } : { error: e instanceof Error ? e.message : String(e) }
|
|
28689
|
-
});
|
|
28690
28338
|
if (e instanceof ApiError) {
|
|
28691
28339
|
if (e.status === 401 || e.status === 403) {
|
|
28692
28340
|
let bodyMsg = "";
|
|
@@ -28749,18 +28397,7 @@ If using a custom host configuration, make sure the space exists on that host.`
|
|
|
28749
28397
|
}
|
|
28750
28398
|
};
|
|
28751
28399
|
const runPush = async (cdf, spaceId, environmentId, cmaToken, host2, acknowledgeBreakingChanges, preview) => {
|
|
28752
|
-
const pushDebug = pushDebugRef.current ?? startPushDebugRun({
|
|
28753
|
-
space_id: spaceId,
|
|
28754
|
-
environment_id: environmentId,
|
|
28755
|
-
host: resolveWizardHost(host2),
|
|
28756
|
-
cma_token: cmaToken
|
|
28757
|
-
});
|
|
28758
|
-
pushDebugRef.current = pushDebug;
|
|
28759
28400
|
if (shouldRefusePush(state)) {
|
|
28760
|
-
pushDebug.finish({
|
|
28761
|
-
outcome: "skipped",
|
|
28762
|
-
summary: "Credentials were skipped, so the push was refused. Files were saved only."
|
|
28763
|
-
});
|
|
28764
28401
|
update(buildSkippedPushTransition());
|
|
28765
28402
|
return;
|
|
28766
28403
|
}
|
|
@@ -28768,11 +28405,6 @@ If using a custom host configuration, make sure the space exists on that host.`
|
|
|
28768
28405
|
const hasComponentChanges = preview.components.new.length > 0 || preview.components.changed.length > 0 || preview.components.removed.length > 0;
|
|
28769
28406
|
const hasTokenChanges = preview.tokens.new.length > 0 || preview.tokens.changed.length > 0 || preview.tokens.removed.length > 0;
|
|
28770
28407
|
if (!hasComponentChanges && !hasTokenChanges) {
|
|
28771
|
-
pushDebug.finish({
|
|
28772
|
-
outcome: "nothing-to-push",
|
|
28773
|
-
summary: "The preview had no new, changed or removed items, so no apply request was sent.",
|
|
28774
|
-
details: { preview: summarizePreview(preview) }
|
|
28775
|
-
});
|
|
28776
28408
|
update({
|
|
28777
28409
|
step: "done",
|
|
28778
28410
|
pushResult: {
|
|
@@ -28785,11 +28417,6 @@ If using a custom host configuration, make sure the space exists on that host.`
|
|
|
28785
28417
|
}
|
|
28786
28418
|
const cycles = detectSlotCycles(extractComponents(cdf));
|
|
28787
28419
|
if (cycles.length > 0) {
|
|
28788
|
-
pushDebug.finish({
|
|
28789
|
-
outcome: "failed",
|
|
28790
|
-
summary: "The push was blocked locally because components slot each other in a cycle.",
|
|
28791
|
-
details: { cycles: formatSlotCycleReport(cycles) }
|
|
28792
|
-
});
|
|
28793
28420
|
update({
|
|
28794
28421
|
step: "error",
|
|
28795
28422
|
errorStep: "apply",
|
|
@@ -28800,11 +28427,6 @@ If using a custom host configuration, make sure the space exists on that host.`
|
|
|
28800
28427
|
}
|
|
28801
28428
|
const unresolvedSlotReferences = validateSlotReferences2(extractComponents(cdf));
|
|
28802
28429
|
if (unresolvedSlotReferences.length > 0) {
|
|
28803
|
-
pushDebug.finish({
|
|
28804
|
-
outcome: "failed",
|
|
28805
|
-
summary: "The push was blocked locally because a slot refers to a component that is not in the CDF.",
|
|
28806
|
-
details: { unresolved: formatUnresolvedSlotReferences(unresolvedSlotReferences) }
|
|
28807
|
-
});
|
|
28808
28430
|
update({
|
|
28809
28431
|
step: "error",
|
|
28810
28432
|
errorStep: "apply",
|
|
@@ -28814,14 +28436,6 @@ If using a custom host configuration, make sure the space exists on that host.`
|
|
|
28814
28436
|
return;
|
|
28815
28437
|
}
|
|
28816
28438
|
update({ step: "pushing", pushProgress: null, errorAllowBreakingChangeAcknowledgment: false });
|
|
28817
|
-
pushDebug.event("Apply started", {
|
|
28818
|
-
note: `POST ${resolveWizardHost(host2)}/\u2026/design_systems/imports/apply`,
|
|
28819
|
-
data: {
|
|
28820
|
-
acknowledge_breaking_changes: acknowledgeBreakingChanges,
|
|
28821
|
-
sending: summarizeCdf(cdf),
|
|
28822
|
-
expected: preview ? summarizePreview(preview) : null
|
|
28823
|
-
}
|
|
28824
|
-
});
|
|
28825
28439
|
try {
|
|
28826
28440
|
const resolvedHost = resolveWizardHost(host2);
|
|
28827
28441
|
const client2 = new ImportApiClient({
|
|
@@ -28831,11 +28445,6 @@ If using a custom host configuration, make sure the space exists on that host.`
|
|
|
28831
28445
|
host: resolvedHost
|
|
28832
28446
|
});
|
|
28833
28447
|
let operation = await client2.applyImport(cdf, { acknowledgeBreakingChanges });
|
|
28834
|
-
pushDebug.event("Server accepted the apply request", {
|
|
28835
|
-
note: `operation ${operation.sys.id} is ${operation.sys.status}`,
|
|
28836
|
-
data: { operation_id: operation.sys.id, status: operation.sys.status, summary: operation.summary },
|
|
28837
|
-
requestId: client2.getLastRequestId()
|
|
28838
|
-
});
|
|
28839
28448
|
try {
|
|
28840
28449
|
logStep({
|
|
28841
28450
|
applyResponse: {
|
|
@@ -28852,15 +28461,9 @@ If using a custom host configuration, make sure the space exists on that host.`
|
|
|
28852
28461
|
pushProgress: { kind: "queued", operationId: operation.sys.id }
|
|
28853
28462
|
});
|
|
28854
28463
|
let pollCount = 0;
|
|
28855
|
-
let lastPolledStatus = "";
|
|
28856
28464
|
operation = await client2.pollOperation(operation.sys.id, {
|
|
28857
28465
|
onProgress: (op) => {
|
|
28858
28466
|
pollCount++;
|
|
28859
|
-
const polled = `${op.sys.status} ${op.summary ? `${op.summary.total - op.summary.pending}/${op.summary.total}` : ""}`;
|
|
28860
|
-
if (polled !== lastPolledStatus) {
|
|
28861
|
-
lastPolledStatus = polled;
|
|
28862
|
-
pushDebug.event("Operation status changed", { note: polled.trim(), requestId: client2.getLastRequestId() });
|
|
28863
|
-
}
|
|
28864
28467
|
const s = op.summary;
|
|
28865
28468
|
if (s) {
|
|
28866
28469
|
const done = s.total - s.pending;
|
|
@@ -28965,29 +28568,6 @@ If using a custom host configuration, make sure the space exists on that host.`
|
|
|
28965
28568
|
);
|
|
28966
28569
|
}
|
|
28967
28570
|
}
|
|
28968
|
-
const failedItems = items.filter((item) => item.status === "failed");
|
|
28969
|
-
const pushedCount = items.filter((item) => item.status === "succeeded").length;
|
|
28970
|
-
pushDebug.finish({
|
|
28971
|
-
outcome: pushSucceeded ? "pushed" : pushedCount > 0 ? "partial" : "failed",
|
|
28972
|
-
summary: pushSucceeded ? items.length > 0 ? `The server reports ${pushedCount} of ${items.length} items applied.` : `The operation finished as ${operation.sys.status}, but the server returned no per-item results, so the counts come from the preview.` : `The operation finished as ${operation.sys.status}; ${failedItems.length} item(s) failed.`,
|
|
28973
|
-
details: {
|
|
28974
|
-
operation_id: operation.sys.id,
|
|
28975
|
-
operation_status: operation.sys.status,
|
|
28976
|
-
server_summary: operation.summary,
|
|
28977
|
-
items: items.map((item) => ({
|
|
28978
|
-
type: item.entityType,
|
|
28979
|
-
id: item.id,
|
|
28980
|
-
action: item.action,
|
|
28981
|
-
status: item.status,
|
|
28982
|
-
...item.error ? { error: formatEdsiError(item.error) } : {}
|
|
28983
|
-
})),
|
|
28984
|
-
shown_to_user: {
|
|
28985
|
-
component_types: pushResult.componentTypes,
|
|
28986
|
-
design_tokens: pushResult.designTokens
|
|
28987
|
-
},
|
|
28988
|
-
request_id: client2.getLastRequestId()
|
|
28989
|
-
}
|
|
28990
|
-
});
|
|
28991
28571
|
update({ step: "done", pushResult });
|
|
28992
28572
|
} catch (e) {
|
|
28993
28573
|
let msg;
|
|
@@ -28998,14 +28578,6 @@ If using a custom host configuration, make sure the space exists on that host.`
|
|
|
28998
28578
|
} else {
|
|
28999
28579
|
msg = "Push failed";
|
|
29000
28580
|
}
|
|
29001
|
-
pushDebug.finish({
|
|
29002
|
-
outcome: "failed",
|
|
29003
|
-
summary: e instanceof ApiError ? `The apply request failed with HTTP ${e.status}.` : `The apply request failed before the server answered: ${msg}`,
|
|
29004
|
-
details: {
|
|
29005
|
-
message: msg,
|
|
29006
|
-
...e instanceof ApiError ? { status: e.status, body: (e.body ?? "").slice(0, 4e3) } : {}
|
|
29007
|
-
}
|
|
29008
|
-
});
|
|
29009
28581
|
update({
|
|
29010
28582
|
step: "error",
|
|
29011
28583
|
errorStep: "apply",
|
|
@@ -29017,7 +28589,7 @@ If using a custom host configuration, make sure the space exists on that host.`
|
|
|
29017
28589
|
};
|
|
29018
28590
|
const runPrintFiles = async (extractSessionId, outDir, opts = {}) => {
|
|
29019
28591
|
update({ step: "printing" });
|
|
29020
|
-
const componentsPath =
|
|
28592
|
+
const componentsPath = join20(outDir, "components.json");
|
|
29021
28593
|
try {
|
|
29022
28594
|
const db = openPipelineDb();
|
|
29023
28595
|
let components = [];
|
|
@@ -29120,7 +28692,7 @@ If using a custom host configuration, make sure the space exists on that host.`
|
|
|
29120
28692
|
if (tokenReuseChecked.current) return;
|
|
29121
28693
|
tokenReuseChecked.current = true;
|
|
29122
28694
|
const tokenNextStep = state.projectPath ? "path-validation" : "credentials";
|
|
29123
|
-
const existingTokensPath =
|
|
28695
|
+
const existingTokensPath = join20(state.outDir, "tokens.json");
|
|
29124
28696
|
if (effectiveNoCache) {
|
|
29125
28697
|
tokenGenerationPromiseRef.current = runAgentAuthCheck(tokenNextStep).then(
|
|
29126
28698
|
(ok2) => ok2 ? runGenerateTokens(state.rawTokensPath, state.outDir) : false
|
|
@@ -29171,7 +28743,7 @@ If using a custom host configuration, make sure the space exists on that host.`
|
|
|
29171
28743
|
{
|
|
29172
28744
|
onContinue: (path) => {
|
|
29173
28745
|
const projectPath = normalizePath(path);
|
|
29174
|
-
const outDir =
|
|
28746
|
+
const outDir = join20(projectPath, ".contentful");
|
|
29175
28747
|
update({ step: "token-input", projectPath, outDir });
|
|
29176
28748
|
},
|
|
29177
28749
|
onQuit: () => process.exit(0)
|
|
@@ -29533,7 +29105,6 @@ If using a custom host configuration, make sure the space exists on that host.`
|
|
|
29533
29105
|
environmentId: state.environmentId,
|
|
29534
29106
|
stepNumber: totalSteps,
|
|
29535
29107
|
totalSteps,
|
|
29536
|
-
droppedTokenDefaults: state.droppedTokenDefaults,
|
|
29537
29108
|
onConfirm: (acknowledge) => {
|
|
29538
29109
|
void runPush(
|
|
29539
29110
|
state.cdf,
|
|
@@ -29670,7 +29241,6 @@ var init_WizardApp = __esm({
|
|
|
29670
29241
|
init_theme();
|
|
29671
29242
|
init_run_teaser();
|
|
29672
29243
|
init_debug_logger();
|
|
29673
|
-
init_push_debug_log();
|
|
29674
29244
|
init_credentials_store();
|
|
29675
29245
|
init_path_prompt();
|
|
29676
29246
|
init_save_path_resolver();
|
|
@@ -29699,8 +29269,6 @@ var init_WizardApp = __esm({
|
|
|
29699
29269
|
init_wizard_generate_progress();
|
|
29700
29270
|
init_spawn_generate();
|
|
29701
29271
|
init_tokens();
|
|
29702
|
-
init_dangling_token_defaults();
|
|
29703
|
-
init_fetch_existing_token_ids();
|
|
29704
29272
|
init_preview_utils();
|
|
29705
29273
|
init_db();
|
|
29706
29274
|
init_ScopeGateStep();
|
|
@@ -29717,7 +29285,7 @@ var init_WizardApp = __esm({
|
|
|
29717
29285
|
init_use_terminal_size();
|
|
29718
29286
|
init_render_with_goodbye();
|
|
29719
29287
|
SAVE_CONFIRMATION_DELAY_MS = 1e3;
|
|
29720
|
-
WIZARD_LOG =
|
|
29288
|
+
WIZARD_LOG = join20(tmpdir(), "experiences-import-wizard.log");
|
|
29721
29289
|
}
|
|
29722
29290
|
});
|
|
29723
29291
|
|
|
@@ -29897,7 +29465,7 @@ var init_shell = __esm({
|
|
|
29897
29465
|
});
|
|
29898
29466
|
|
|
29899
29467
|
// packages/experience-design-system-cli-legacy/src/setup/lib/checks.ts
|
|
29900
|
-
import { join as
|
|
29468
|
+
import { join as join21 } from "node:path";
|
|
29901
29469
|
function checkNodeVersion(nodeVersion = process.versions.node) {
|
|
29902
29470
|
const major = Number.parseInt(nodeVersion.split(".")[0], 10);
|
|
29903
29471
|
return {
|
|
@@ -29911,7 +29479,7 @@ async function detectNodeVersionManagers(homeDir, deps = {
|
|
|
29911
29479
|
binaryExists,
|
|
29912
29480
|
pathExists: pathExists3
|
|
29913
29481
|
}) {
|
|
29914
|
-
const nvmScript =
|
|
29482
|
+
const nvmScript = join21(homeDir, ".nvm", "nvm.sh");
|
|
29915
29483
|
return {
|
|
29916
29484
|
nvm: await deps.binaryExists("nvm") || await deps.pathExists(nvmScript),
|
|
29917
29485
|
fnm: await deps.binaryExists("fnm"),
|
|
@@ -29990,7 +29558,7 @@ var init_report = __esm({
|
|
|
29990
29558
|
|
|
29991
29559
|
// packages/experience-design-system-cli-legacy/src/doctor/checks.ts
|
|
29992
29560
|
import { homedir as homedir7 } from "node:os";
|
|
29993
|
-
import { join as
|
|
29561
|
+
import { join as join22 } from "node:path";
|
|
29994
29562
|
async function reportNode() {
|
|
29995
29563
|
section("Checking Node.js version");
|
|
29996
29564
|
const check = checkNodeVersion();
|
|
@@ -30041,12 +29609,12 @@ async function reportPnpm(pkgRoot) {
|
|
|
30041
29609
|
}
|
|
30042
29610
|
async function reportDependencies(pkgRoot) {
|
|
30043
29611
|
section("Checking dependencies (pnpm install)");
|
|
30044
|
-
if (!await pathExists3(
|
|
29612
|
+
if (!await pathExists3(join22(pkgRoot, "node_modules"))) {
|
|
30045
29613
|
info("node_modules not found \u2014 running pnpm install...");
|
|
30046
29614
|
} else {
|
|
30047
29615
|
info("Running pnpm install to ensure dependencies are up to date...");
|
|
30048
29616
|
}
|
|
30049
|
-
const check = await installDependencies(
|
|
29617
|
+
const check = await installDependencies(join22(pkgRoot, "..", ".."));
|
|
30050
29618
|
if (!check.passed) {
|
|
30051
29619
|
fail("pnpm install failed");
|
|
30052
29620
|
info("");
|
|
@@ -30063,7 +29631,7 @@ async function reportDependencies(pkgRoot) {
|
|
|
30063
29631
|
async function reportBuild(pkgRoot) {
|
|
30064
29632
|
section("Building CLI");
|
|
30065
29633
|
info("Running pnpm build...");
|
|
30066
|
-
const check = await buildCli(
|
|
29634
|
+
const check = await buildCli(join22(pkgRoot, "..", ".."));
|
|
30067
29635
|
if (!check.passed) {
|
|
30068
29636
|
fail("Build failed");
|
|
30069
29637
|
info("");
|
|
@@ -31278,9 +30846,9 @@ var init_SetupScreen = __esm({
|
|
|
31278
30846
|
|
|
31279
30847
|
// packages/experience-design-system-cli-legacy/src/setup/command.ts
|
|
31280
30848
|
import { readFileSync as readFileSync8 } from "node:fs";
|
|
31281
|
-
import { join as
|
|
30849
|
+
import { join as join23 } from "node:path";
|
|
31282
30850
|
function getCliVersion() {
|
|
31283
|
-
const pkg4 = JSON.parse(readFileSync8(
|
|
30851
|
+
const pkg4 = JSON.parse(readFileSync8(join23(findPkgRoot(), "package.json"), "utf8"));
|
|
31284
30852
|
return pkg4.version;
|
|
31285
30853
|
}
|
|
31286
30854
|
async function runSetup(opts) {
|
|
@@ -31292,7 +30860,7 @@ async function runSetup(opts) {
|
|
|
31292
30860
|
const { renderWithGoodbye: renderWithGoodbye2 } = await Promise.resolve().then(() => (init_render_with_goodbye(), render_with_goodbye_exports));
|
|
31293
30861
|
const { createElement: createElement6 } = await import("react");
|
|
31294
30862
|
const { SetupScreen: SetupScreen2 } = await Promise.resolve().then(() => (init_SetupScreen(), SetupScreen_exports));
|
|
31295
|
-
const repoRoot =
|
|
30863
|
+
const repoRoot = join23(findPkgRoot(), "..", "..");
|
|
31296
30864
|
const completion = { outcome: null };
|
|
31297
30865
|
let unmountInk = null;
|
|
31298
30866
|
const { waitUntilExit, unmount } = renderWithGoodbye2(
|
|
@@ -31493,15 +31061,15 @@ var init_apply_mapping = __esm({
|
|
|
31493
31061
|
});
|
|
31494
31062
|
|
|
31495
31063
|
// packages/experience-design-system-cli-legacy/src/analyze/composition/prompt-loader.ts
|
|
31496
|
-
import { existsSync as
|
|
31497
|
-
import { dirname as dirname11, join as
|
|
31064
|
+
import { existsSync as existsSync7, readFileSync as readFileSync9 } from "node:fs";
|
|
31065
|
+
import { dirname as dirname11, join as join24, resolve as resolve18 } from "node:path";
|
|
31498
31066
|
import { fileURLToPath as fileURLToPath3 } from "node:url";
|
|
31499
31067
|
function resolvePromptPath(fileName) {
|
|
31500
31068
|
const thisDir = dirname11(fileURLToPath3(import.meta.url));
|
|
31501
31069
|
let dir = thisDir;
|
|
31502
31070
|
for (; ; ) {
|
|
31503
|
-
const candidate =
|
|
31504
|
-
if (
|
|
31071
|
+
const candidate = join24(dir, "prompts");
|
|
31072
|
+
if (existsSync7(candidate)) return join24(candidate, fileName);
|
|
31505
31073
|
const parent = resolve18(dir, "..");
|
|
31506
31074
|
if (parent === dir) {
|
|
31507
31075
|
throw new Error(
|
|
@@ -31769,7 +31337,7 @@ var init_manifest_doc_evidence = __esm({
|
|
|
31769
31337
|
|
|
31770
31338
|
// packages/experience-design-system-cli-legacy/src/analyze/extract-command.ts
|
|
31771
31339
|
import { mkdir as mkdir6, readdir as readdir3, readFile as readFile18, stat as stat6 } from "node:fs/promises";
|
|
31772
|
-
import { isAbsolute as isAbsolute2, join as
|
|
31340
|
+
import { isAbsolute as isAbsolute2, join as join25, relative as relative2, resolve as resolve19 } from "node:path";
|
|
31773
31341
|
function resolveExtractNoCache(opts) {
|
|
31774
31342
|
return opts.noCache === true || opts.cache === false;
|
|
31775
31343
|
}
|
|
@@ -31807,7 +31375,7 @@ async function collectSourceFiles(directory, onProgress) {
|
|
|
31807
31375
|
const entries = await readdir3(currentDirectory, { withFileTypes: true });
|
|
31808
31376
|
const subdirs = [];
|
|
31809
31377
|
for (const entry of entries) {
|
|
31810
|
-
const fullPath =
|
|
31378
|
+
const fullPath = join25(currentDirectory, entry.name);
|
|
31811
31379
|
if (entry.isDirectory()) {
|
|
31812
31380
|
if (!IGNORED_DIRECTORY_NAMES.has(entry.name)) {
|
|
31813
31381
|
subdirs.push(fullPath);
|
|
@@ -31891,7 +31459,7 @@ function registerInternalExtractCommand(program) {
|
|
|
31891
31459
|
}
|
|
31892
31460
|
}
|
|
31893
31461
|
const projectRoot = resolve19(opts.project);
|
|
31894
|
-
const outDir =
|
|
31462
|
+
const outDir = join25(projectRoot, ".contentful");
|
|
31895
31463
|
let sourceDirectory;
|
|
31896
31464
|
if (opts.dir !== void 0) {
|
|
31897
31465
|
sourceDirectory = resolveFromProjectRoot(projectRoot, opts.dir);
|
|
@@ -32296,7 +31864,7 @@ __export(program_exports, {
|
|
|
32296
31864
|
});
|
|
32297
31865
|
import { spawn as spawn5 } from "node:child_process";
|
|
32298
31866
|
import { fileURLToPath as fileURLToPath4 } from "node:url";
|
|
32299
|
-
import { dirname as dirname13, join as
|
|
31867
|
+
import { dirname as dirname13, join as join26, resolve as resolve20 } from "node:path";
|
|
32300
31868
|
import { readFileSync as readFileSync10 } from "node:fs";
|
|
32301
31869
|
import { Command } from "commander";
|
|
32302
31870
|
async function runBuild(opts) {
|
|
@@ -32396,7 +31964,7 @@ var init_program = __esm({
|
|
|
32396
31964
|
init_analytics();
|
|
32397
31965
|
init_credentials_store();
|
|
32398
31966
|
init_cli_path();
|
|
32399
|
-
pkg3 = JSON.parse(readFileSync10(
|
|
31967
|
+
pkg3 = JSON.parse(readFileSync10(join26(findPkgRoot(), "package.json"), "utf8"));
|
|
32400
31968
|
}
|
|
32401
31969
|
});
|
|
32402
31970
|
|