@contentful/experience-design-system-cli 2.37.1-dev-build-6ca65704.0 → 2.37.1-dev-build-33443a39.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 +18 -33
- package/dist/index.js +104 -72
- package/dist/package.json +4 -2
- package/dist/src/commands/forwarded.d.ts +2 -0
- package/dist/src/commands/import.d.ts +2 -0
- package/dist/src/commands/watch.d.ts +5 -0
- package/dist/src/tui/import/steps/01-welcome/controls.d.ts +2 -2
- package/dist/src/tui/import/steps/01-welcome/logic.d.ts +1 -3
- package/dist/src/tui/import/steps/02-token-input/controls.d.ts +3 -6
- package/dist/src/tui/import/steps/02-token-input/logic.d.ts +1 -4
- package/dist/src/tui/import/steps/02-token-input/screen.d.ts +1 -2
- package/dist/src/tui/import/steps/02-token-input/validate-path.d.ts +1 -1
- package/legacy/package.json +4 -2
- package/package.json +5 -3
package/dist/app.js
CHANGED
|
@@ -255,9 +255,8 @@ import TextInput from "ink-text-input";
|
|
|
255
255
|
import { useInput as useInput3 } from "ink";
|
|
256
256
|
|
|
257
257
|
// packages/experience-design-system-cli/src/tui/import/steps/01-welcome/logic.ts
|
|
258
|
-
function shouldQuit(
|
|
259
|
-
|
|
260
|
-
return value === "" && input === "q" && !key.ctrl && !key.meta;
|
|
258
|
+
function shouldQuit(key) {
|
|
259
|
+
return key.escape;
|
|
261
260
|
}
|
|
262
261
|
function toProjectPath(value) {
|
|
263
262
|
const projectPath = value.trim();
|
|
@@ -267,11 +266,11 @@ function toProjectPath(value) {
|
|
|
267
266
|
// packages/experience-design-system-cli/src/tui/import/steps/01-welcome/controls.ts
|
|
268
267
|
var WELCOME_CONTROLS = [
|
|
269
268
|
{ keys: "Enter", label: "Continue" },
|
|
270
|
-
{ keys: "Esc
|
|
269
|
+
{ keys: "Esc", label: "Back to menu" }
|
|
271
270
|
];
|
|
272
|
-
function useWelcomeControls(
|
|
273
|
-
useInput3((
|
|
274
|
-
if (shouldQuit(
|
|
271
|
+
function useWelcomeControls(onQuit) {
|
|
272
|
+
useInput3((_input, key) => {
|
|
273
|
+
if (shouldQuit(key)) onQuit();
|
|
275
274
|
});
|
|
276
275
|
}
|
|
277
276
|
|
|
@@ -287,7 +286,7 @@ var OVERVIEW = [
|
|
|
287
286
|
];
|
|
288
287
|
function WelcomeScreen({ onContinue, onQuit, initialPath = "" }) {
|
|
289
288
|
const [projectPath, setProjectPath] = useState3(initialPath);
|
|
290
|
-
useWelcomeControls(
|
|
289
|
+
useWelcomeControls(onQuit);
|
|
291
290
|
const submit = (value) => {
|
|
292
291
|
const path = toProjectPath(value);
|
|
293
292
|
if (path) onContinue(path);
|
|
@@ -329,14 +328,8 @@ import TextInput2 from "ink-text-input";
|
|
|
329
328
|
import { useInput as useInput4 } from "ink";
|
|
330
329
|
|
|
331
330
|
// packages/experience-design-system-cli/src/tui/import/steps/02-token-input/logic.ts
|
|
332
|
-
function
|
|
333
|
-
return
|
|
334
|
-
}
|
|
335
|
-
function shouldGoBack(value, input, key) {
|
|
336
|
-
return key.escape || isPlainKeyOnEmptyField(value, input, key, "q");
|
|
337
|
-
}
|
|
338
|
-
function shouldSkip(value, input, key) {
|
|
339
|
-
return isPlainKeyOnEmptyField(value, input, key, "s");
|
|
331
|
+
function shouldGoBack(key) {
|
|
332
|
+
return key.escape;
|
|
340
333
|
}
|
|
341
334
|
function toTokenPath(value) {
|
|
342
335
|
const tokenPath = value.trim();
|
|
@@ -345,14 +338,12 @@ function toTokenPath(value) {
|
|
|
345
338
|
|
|
346
339
|
// packages/experience-design-system-cli/src/tui/import/steps/02-token-input/controls.ts
|
|
347
340
|
var TOKEN_INPUT_CONTROLS = [
|
|
348
|
-
{ keys: "Enter", label: "Continue
|
|
349
|
-
{ keys: "
|
|
350
|
-
{ keys: "Esc/q", label: "Back" }
|
|
341
|
+
{ keys: "Enter", label: "Continue" },
|
|
342
|
+
{ keys: "Esc", label: "Back" }
|
|
351
343
|
];
|
|
352
|
-
function useTokenInputControls(
|
|
353
|
-
useInput4((
|
|
354
|
-
if (shouldGoBack(
|
|
355
|
-
else if (shouldSkip(tokenPath, input, key)) onSkip();
|
|
344
|
+
function useTokenInputControls(onBack) {
|
|
345
|
+
useInput4((_input, key) => {
|
|
346
|
+
if (shouldGoBack(key)) onBack();
|
|
356
347
|
});
|
|
357
348
|
}
|
|
358
349
|
|
|
@@ -390,15 +381,10 @@ function validateTokenPath(rawPath) {
|
|
|
390
381
|
|
|
391
382
|
// packages/experience-design-system-cli/src/tui/import/steps/02-token-input/screen.tsx
|
|
392
383
|
import { jsx as jsx5, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
393
|
-
function TokenInputScreen({
|
|
394
|
-
onConfirm,
|
|
395
|
-
onSkip,
|
|
396
|
-
onBack,
|
|
397
|
-
initialPath = ""
|
|
398
|
-
}) {
|
|
384
|
+
function TokenInputScreen({ onConfirm, onBack, initialPath = "" }) {
|
|
399
385
|
const [tokenPath, setTokenPath] = useState4(initialPath);
|
|
400
386
|
const [failure, setFailure] = useState4(null);
|
|
401
|
-
useTokenInputControls(
|
|
387
|
+
useTokenInputControls(onBack);
|
|
402
388
|
const change = (value) => {
|
|
403
389
|
setTokenPath(value);
|
|
404
390
|
setFailure(null);
|
|
@@ -406,7 +392,7 @@ function TokenInputScreen({
|
|
|
406
392
|
const submit = (value) => {
|
|
407
393
|
const rawPath = toTokenPath(value);
|
|
408
394
|
if (!rawPath) {
|
|
409
|
-
|
|
395
|
+
setFailure({ error: "Enter the path to your token file." });
|
|
410
396
|
return;
|
|
411
397
|
}
|
|
412
398
|
const check = validateTokenPath(rawPath);
|
|
@@ -427,7 +413,7 @@ function TokenInputScreen({
|
|
|
427
413
|
"\u2717 ",
|
|
428
414
|
failure.error
|
|
429
415
|
] }),
|
|
430
|
-
/* @__PURE__ */ jsxs4(Text5, { dimColor: true, children: [
|
|
416
|
+
failure.resolvedPath && /* @__PURE__ */ jsxs4(Text5, { dimColor: true, children: [
|
|
431
417
|
" Resolved to: ",
|
|
432
418
|
failure.resolvedPath
|
|
433
419
|
] })
|
|
@@ -1272,7 +1258,6 @@ function App({ onLaunchImport, importExitCode }) {
|
|
|
1272
1258
|
{
|
|
1273
1259
|
initialPath: importDefaults.tokenFile,
|
|
1274
1260
|
onConfirm: (tokens) => onLaunchImport?.({ project: projectPath, tokens }),
|
|
1275
|
-
onSkip: () => onLaunchImport?.({ project: projectPath }),
|
|
1276
1261
|
onBack: () => setProjectPath(void 0)
|
|
1277
1262
|
}
|
|
1278
1263
|
);
|
package/dist/index.js
CHANGED
|
@@ -99,11 +99,11 @@ var init_home_theme = __esm({
|
|
|
99
99
|
|
|
100
100
|
// packages/experience-design-system-cli/src/tui/upgrade/version.ts
|
|
101
101
|
import { readFileSync as readFileSync2 } from "node:fs";
|
|
102
|
-
import { join as
|
|
102
|
+
import { join as join4 } from "node:path";
|
|
103
103
|
import semver from "semver";
|
|
104
104
|
function readPackageVersion() {
|
|
105
|
-
const root = findPackageRoot(import.meta.url,
|
|
106
|
-
const pkg2 = JSON.parse(readFileSync2(
|
|
105
|
+
const root = findPackageRoot(import.meta.url, PACKAGE_NAME3);
|
|
106
|
+
const pkg2 = JSON.parse(readFileSync2(join4(root, "package.json"), "utf8"));
|
|
107
107
|
return pkg2.version ?? "unknown";
|
|
108
108
|
}
|
|
109
109
|
function parseVersionTag(tag) {
|
|
@@ -128,12 +128,12 @@ async function checkForUpgrade() {
|
|
|
128
128
|
return { status: "error" };
|
|
129
129
|
}
|
|
130
130
|
}
|
|
131
|
-
var
|
|
131
|
+
var PACKAGE_NAME3, TAGS_URL;
|
|
132
132
|
var init_version = __esm({
|
|
133
133
|
"packages/experience-design-system-cli/src/tui/upgrade/version.ts"() {
|
|
134
134
|
"use strict";
|
|
135
135
|
init_package_root();
|
|
136
|
-
|
|
136
|
+
PACKAGE_NAME3 = "@contentful/experience-design-system-cli";
|
|
137
137
|
TAGS_URL = "https://api.github.com/repos/contentful/experience-design-system-sdk-public/tags?per_page=10";
|
|
138
138
|
}
|
|
139
139
|
});
|
|
@@ -321,9 +321,8 @@ var init_PageContainer = __esm({
|
|
|
321
321
|
});
|
|
322
322
|
|
|
323
323
|
// packages/experience-design-system-cli/src/tui/import/steps/01-welcome/logic.ts
|
|
324
|
-
function shouldQuit(
|
|
325
|
-
|
|
326
|
-
return value === "" && input === "q" && !key.ctrl && !key.meta;
|
|
324
|
+
function shouldQuit(key) {
|
|
325
|
+
return key.escape;
|
|
327
326
|
}
|
|
328
327
|
function toProjectPath(value) {
|
|
329
328
|
const projectPath = value.trim();
|
|
@@ -337,9 +336,9 @@ var init_logic = __esm({
|
|
|
337
336
|
|
|
338
337
|
// packages/experience-design-system-cli/src/tui/import/steps/01-welcome/controls.ts
|
|
339
338
|
import { useInput as useInput3 } from "ink";
|
|
340
|
-
function useWelcomeControls(
|
|
341
|
-
useInput3((
|
|
342
|
-
if (shouldQuit(
|
|
339
|
+
function useWelcomeControls(onQuit) {
|
|
340
|
+
useInput3((_input, key) => {
|
|
341
|
+
if (shouldQuit(key)) onQuit();
|
|
343
342
|
});
|
|
344
343
|
}
|
|
345
344
|
var WELCOME_CONTROLS;
|
|
@@ -349,7 +348,7 @@ var init_controls = __esm({
|
|
|
349
348
|
init_logic();
|
|
350
349
|
WELCOME_CONTROLS = [
|
|
351
350
|
{ keys: "Enter", label: "Continue" },
|
|
352
|
-
{ keys: "Esc
|
|
351
|
+
{ keys: "Esc", label: "Back to menu" }
|
|
353
352
|
];
|
|
354
353
|
}
|
|
355
354
|
});
|
|
@@ -361,7 +360,7 @@ import TextInput from "ink-text-input";
|
|
|
361
360
|
import { jsx as jsx4, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
362
361
|
function WelcomeScreen({ onContinue, onQuit, initialPath = "" }) {
|
|
363
362
|
const [projectPath, setProjectPath] = useState3(initialPath);
|
|
364
|
-
useWelcomeControls(
|
|
363
|
+
useWelcomeControls(onQuit);
|
|
365
364
|
const submit = (value) => {
|
|
366
365
|
const path = toProjectPath(value);
|
|
367
366
|
if (path) onContinue(path);
|
|
@@ -412,14 +411,8 @@ var init_screen = __esm({
|
|
|
412
411
|
});
|
|
413
412
|
|
|
414
413
|
// packages/experience-design-system-cli/src/tui/import/steps/02-token-input/logic.ts
|
|
415
|
-
function
|
|
416
|
-
return
|
|
417
|
-
}
|
|
418
|
-
function shouldGoBack(value, input, key) {
|
|
419
|
-
return key.escape || isPlainKeyOnEmptyField(value, input, key, "q");
|
|
420
|
-
}
|
|
421
|
-
function shouldSkip(value, input, key) {
|
|
422
|
-
return isPlainKeyOnEmptyField(value, input, key, "s");
|
|
414
|
+
function shouldGoBack(key) {
|
|
415
|
+
return key.escape;
|
|
423
416
|
}
|
|
424
417
|
function toTokenPath(value) {
|
|
425
418
|
const tokenPath = value.trim();
|
|
@@ -433,10 +426,9 @@ var init_logic2 = __esm({
|
|
|
433
426
|
|
|
434
427
|
// packages/experience-design-system-cli/src/tui/import/steps/02-token-input/controls.ts
|
|
435
428
|
import { useInput as useInput4 } from "ink";
|
|
436
|
-
function useTokenInputControls(
|
|
437
|
-
useInput4((
|
|
438
|
-
if (shouldGoBack(
|
|
439
|
-
else if (shouldSkip(tokenPath, input, key)) onSkip();
|
|
429
|
+
function useTokenInputControls(onBack) {
|
|
430
|
+
useInput4((_input, key) => {
|
|
431
|
+
if (shouldGoBack(key)) onBack();
|
|
440
432
|
});
|
|
441
433
|
}
|
|
442
434
|
var TOKEN_INPUT_CONTROLS;
|
|
@@ -445,9 +437,8 @@ var init_controls2 = __esm({
|
|
|
445
437
|
"use strict";
|
|
446
438
|
init_logic2();
|
|
447
439
|
TOKEN_INPUT_CONTROLS = [
|
|
448
|
-
{ keys: "Enter", label: "Continue
|
|
449
|
-
{ keys: "
|
|
450
|
-
{ keys: "Esc/q", label: "Back" }
|
|
440
|
+
{ keys: "Enter", label: "Continue" },
|
|
441
|
+
{ keys: "Esc", label: "Back" }
|
|
451
442
|
];
|
|
452
443
|
}
|
|
453
444
|
});
|
|
@@ -494,15 +485,10 @@ import { useState as useState4 } from "react";
|
|
|
494
485
|
import { Box as Box4, Text as Text5 } from "ink";
|
|
495
486
|
import TextInput2 from "ink-text-input";
|
|
496
487
|
import { jsx as jsx5, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
497
|
-
function TokenInputScreen({
|
|
498
|
-
onConfirm,
|
|
499
|
-
onSkip,
|
|
500
|
-
onBack,
|
|
501
|
-
initialPath = ""
|
|
502
|
-
}) {
|
|
488
|
+
function TokenInputScreen({ onConfirm, onBack, initialPath = "" }) {
|
|
503
489
|
const [tokenPath, setTokenPath] = useState4(initialPath);
|
|
504
490
|
const [failure, setFailure] = useState4(null);
|
|
505
|
-
useTokenInputControls(
|
|
491
|
+
useTokenInputControls(onBack);
|
|
506
492
|
const change = (value) => {
|
|
507
493
|
setTokenPath(value);
|
|
508
494
|
setFailure(null);
|
|
@@ -510,7 +496,7 @@ function TokenInputScreen({
|
|
|
510
496
|
const submit = (value) => {
|
|
511
497
|
const rawPath = toTokenPath(value);
|
|
512
498
|
if (!rawPath) {
|
|
513
|
-
|
|
499
|
+
setFailure({ error: "Enter the path to your token file." });
|
|
514
500
|
return;
|
|
515
501
|
}
|
|
516
502
|
const check = validateTokenPath(rawPath);
|
|
@@ -531,7 +517,7 @@ function TokenInputScreen({
|
|
|
531
517
|
"\u2717 ",
|
|
532
518
|
failure.error
|
|
533
519
|
] }),
|
|
534
|
-
/* @__PURE__ */ jsxs4(Text5, { dimColor: true, children: [
|
|
520
|
+
failure.resolvedPath && /* @__PURE__ */ jsxs4(Text5, { dimColor: true, children: [
|
|
535
521
|
" Resolved to: ",
|
|
536
522
|
failure.resolvedPath
|
|
537
523
|
] })
|
|
@@ -565,7 +551,7 @@ var init_steps = __esm({
|
|
|
565
551
|
});
|
|
566
552
|
|
|
567
553
|
// packages/experience-design-system-cli/src/tui/import/spawn-v1-import.ts
|
|
568
|
-
import { spawn as
|
|
554
|
+
import { spawn as spawn3 } from "node:child_process";
|
|
569
555
|
function buildArgs(options) {
|
|
570
556
|
const args = ["import"];
|
|
571
557
|
if (options.project) {
|
|
@@ -580,7 +566,7 @@ async function spawnV1Import(options = {}) {
|
|
|
580
566
|
const cliPath = findLegacyCliPath();
|
|
581
567
|
const args = buildArgs(options);
|
|
582
568
|
return new Promise((resolvePromise) => {
|
|
583
|
-
const child =
|
|
569
|
+
const child = spawn3("node", [cliPath, ...args], {
|
|
584
570
|
stdio: "inherit"
|
|
585
571
|
});
|
|
586
572
|
child.on("close", (code) => {
|
|
@@ -625,9 +611,9 @@ var init_terminal_input = __esm({
|
|
|
625
611
|
import { randomBytes } from "node:crypto";
|
|
626
612
|
import { mkdir, readFile, rename, writeFile } from "node:fs/promises";
|
|
627
613
|
import { homedir as homedir2 } from "node:os";
|
|
628
|
-
import { dirname as dirname2, join as
|
|
614
|
+
import { dirname as dirname2, join as join5 } from "node:path";
|
|
629
615
|
function configRoot() {
|
|
630
|
-
return process.env["EDS_HOME"] ||
|
|
616
|
+
return process.env["EDS_HOME"] || join5(homedir2(), ".contentful", "experience-design-system-cli");
|
|
631
617
|
}
|
|
632
618
|
async function readSettings() {
|
|
633
619
|
try {
|
|
@@ -651,10 +637,10 @@ var configFilePath, runsFilePath, debugSessionsDir, oldConfigDir;
|
|
|
651
637
|
var init_config = __esm({
|
|
652
638
|
"packages/experience-design-system-types/dist/src/config/index.js"() {
|
|
653
639
|
"use strict";
|
|
654
|
-
configFilePath = () =>
|
|
655
|
-
runsFilePath = () =>
|
|
656
|
-
debugSessionsDir = () =>
|
|
657
|
-
oldConfigDir = () =>
|
|
640
|
+
configFilePath = () => join5(configRoot(), "config.json");
|
|
641
|
+
runsFilePath = () => join5(configRoot(), "state", "runs.json");
|
|
642
|
+
debugSessionsDir = () => join5(configRoot(), "debug", "sessions");
|
|
643
|
+
oldConfigDir = () => join5(homedir2(), ".config", "experiences");
|
|
658
644
|
}
|
|
659
645
|
});
|
|
660
646
|
|
|
@@ -679,8 +665,8 @@ var init_debug_mode_store = __esm({
|
|
|
679
665
|
|
|
680
666
|
// packages/experience-design-system-cli/src/tui/debug-store.ts
|
|
681
667
|
import { mkdir as mkdir2, writeFile as writeFile2 } from "node:fs/promises";
|
|
682
|
-
import { existsSync as
|
|
683
|
-
import { join as
|
|
668
|
+
import { existsSync as existsSync4, readdirSync } from "node:fs";
|
|
669
|
+
import { join as join6 } from "node:path";
|
|
684
670
|
function generateRunId() {
|
|
685
671
|
const now = /* @__PURE__ */ new Date();
|
|
686
672
|
const pad = (n) => String(n).padStart(2, "0");
|
|
@@ -696,7 +682,7 @@ function slugify(value) {
|
|
|
696
682
|
function generateSessionId() {
|
|
697
683
|
const today = datePrefix();
|
|
698
684
|
const root = debugSessionsDir();
|
|
699
|
-
const existing =
|
|
685
|
+
const existing = existsSync4(root) ? readdirSync(root) : [];
|
|
700
686
|
const seqPattern = new RegExp(`^${today}-session-(\\d+)$`);
|
|
701
687
|
const maxSeq = existing.reduce((max, entry) => {
|
|
702
688
|
const match = seqPattern.exec(entry);
|
|
@@ -705,7 +691,7 @@ function generateSessionId() {
|
|
|
705
691
|
return `${today}-session-${maxSeq + 1}`;
|
|
706
692
|
}
|
|
707
693
|
function sessionDebugDir() {
|
|
708
|
-
return
|
|
694
|
+
return join6(debugSessionsDir(), SESSION_ID);
|
|
709
695
|
}
|
|
710
696
|
function currentDebugSessionDir() {
|
|
711
697
|
return sessionDebugDir();
|
|
@@ -750,15 +736,15 @@ async function finishDebugRun({
|
|
|
750
736
|
const durationMs = Date.now() - run.startedAt;
|
|
751
737
|
const content = renderMarkdown(run, { outputs: redact(outputs), status, exitMethod, durationMs });
|
|
752
738
|
const flowSegments = run.flow.split("/");
|
|
753
|
-
const dir =
|
|
739
|
+
const dir = join6(sessionDebugDir(), ...flowSegments);
|
|
754
740
|
await mkdir2(dir, { recursive: true });
|
|
755
741
|
const filename = nextAttemptFilename(dir, run.menuOption);
|
|
756
|
-
await writeFile2(
|
|
742
|
+
await writeFile2(join6(dir, filename), content, { mode: 384 });
|
|
757
743
|
}
|
|
758
744
|
function nextAttemptFilename(dir, menuOption) {
|
|
759
745
|
const today = datePrefix();
|
|
760
746
|
const optionSlug = slugify(menuOption);
|
|
761
|
-
const existing =
|
|
747
|
+
const existing = existsSync4(dir) ? readdirSync(dir) : [];
|
|
762
748
|
const attemptPattern = new RegExp(`^${today}-${optionSlug}-attempt-(\\d+)\\.md$`);
|
|
763
749
|
const maxAttempt = existing.reduce((max, entry) => {
|
|
764
750
|
const match = attemptPattern.exec(entry);
|
|
@@ -1485,7 +1471,6 @@ function App({ onLaunchImport, importExitCode }) {
|
|
|
1485
1471
|
{
|
|
1486
1472
|
initialPath: importDefaults.tokenFile,
|
|
1487
1473
|
onConfirm: (tokens) => onLaunchImport?.({ project: projectPath, tokens }),
|
|
1488
|
-
onSkip: () => onLaunchImport?.({ project: projectPath }),
|
|
1489
1474
|
onBack: () => setProjectPath(void 0)
|
|
1490
1475
|
}
|
|
1491
1476
|
);
|
|
@@ -1552,13 +1537,9 @@ var init_app = __esm({
|
|
|
1552
1537
|
|
|
1553
1538
|
// packages/experience-design-system-cli/program.ts
|
|
1554
1539
|
import { readFileSync as readFileSync3 } from "node:fs";
|
|
1540
|
+
import { join as join7 } from "node:path";
|
|
1555
1541
|
import { Command } from "commander";
|
|
1556
1542
|
|
|
1557
|
-
// packages/experience-design-system-cli/src/legacy/forwarded-import-args.ts
|
|
1558
|
-
function forwardedImportArgs(argv) {
|
|
1559
|
-
return argv[0] === "import" ? argv.slice(1) : argv;
|
|
1560
|
-
}
|
|
1561
|
-
|
|
1562
1543
|
// packages/experience-design-system-cli/src/legacy/run-legacy.ts
|
|
1563
1544
|
init_legacy_cli_path();
|
|
1564
1545
|
import { spawn } from "node:child_process";
|
|
@@ -1583,8 +1564,7 @@ function runLegacy(args) {
|
|
|
1583
1564
|
});
|
|
1584
1565
|
}
|
|
1585
1566
|
|
|
1586
|
-
// packages/experience-design-system-cli/
|
|
1587
|
-
var pkg = JSON.parse(readFileSync3(new URL("../package.json", import.meta.url), "utf8"));
|
|
1567
|
+
// packages/experience-design-system-cli/src/commands/forwarded.ts
|
|
1588
1568
|
var FORWARDED_COMMANDS = [
|
|
1589
1569
|
{
|
|
1590
1570
|
name: "apply",
|
|
@@ -1610,13 +1590,65 @@ function registerForwardedCommands(program) {
|
|
|
1610
1590
|
});
|
|
1611
1591
|
}
|
|
1612
1592
|
}
|
|
1613
|
-
|
|
1614
|
-
|
|
1593
|
+
|
|
1594
|
+
// packages/experience-design-system-cli/src/legacy/forwarded-import-args.ts
|
|
1595
|
+
function forwardedImportArgs(argv) {
|
|
1596
|
+
return argv[0] === "import" ? argv.slice(1) : argv;
|
|
1597
|
+
}
|
|
1598
|
+
|
|
1599
|
+
// packages/experience-design-system-cli/src/commands/watch.ts
|
|
1600
|
+
init_package_root();
|
|
1601
|
+
import { spawn as spawn2 } from "node:child_process";
|
|
1602
|
+
import { existsSync as existsSync3 } from "node:fs";
|
|
1603
|
+
import { join as join3 } from "node:path";
|
|
1604
|
+
var PACKAGE_NAME2 = "@contentful/experience-design-system-cli";
|
|
1605
|
+
function extractWatchFlag(args) {
|
|
1606
|
+
const rest = args.filter((arg) => arg !== "--watch");
|
|
1607
|
+
return { watch: rest.length !== args.length, rest };
|
|
1608
|
+
}
|
|
1609
|
+
function runDevWatch(args) {
|
|
1610
|
+
const script = join3(findPackageRoot(import.meta.url, PACKAGE_NAME2), "scripts", "dev.mjs");
|
|
1611
|
+
if (!existsSync3(script)) {
|
|
1612
|
+
process.stderr.write("--watch only works from a checkout of the repo (scripts/dev.mjs is not in the package).\n");
|
|
1613
|
+
return Promise.resolve(1);
|
|
1614
|
+
}
|
|
1615
|
+
return new Promise((resolve2) => {
|
|
1616
|
+
const child = spawn2(process.execPath, [script, ...args], { stdio: "inherit" });
|
|
1617
|
+
process.on("SIGINT", () => void 0);
|
|
1618
|
+
child.on("exit", (code) => resolve2(code ?? 0));
|
|
1619
|
+
child.on("error", (err) => {
|
|
1620
|
+
process.stderr.write(`${err.message}
|
|
1621
|
+
`);
|
|
1622
|
+
resolve2(1);
|
|
1623
|
+
});
|
|
1624
|
+
});
|
|
1625
|
+
}
|
|
1626
|
+
|
|
1627
|
+
// packages/experience-design-system-cli/src/commands/import.ts
|
|
1628
|
+
function registerImportCommand(program, openTui) {
|
|
1615
1629
|
program.command("import", { isDefault: true }).description("Launch the Experiences CLI").allowUnknownOption().allowExcessArguments().helpOption(false).argument("[args...]").action(async () => {
|
|
1616
|
-
const forwarded = forwardedImportArgs(process.argv.slice(2));
|
|
1630
|
+
const { watch, rest: forwarded } = extractWatchFlag(forwardedImportArgs(process.argv.slice(2)));
|
|
1631
|
+
if (watch) {
|
|
1632
|
+
process.exit(await runDevWatch(forwarded));
|
|
1633
|
+
}
|
|
1617
1634
|
if (forwarded.length > 0) {
|
|
1618
1635
|
process.exit(await runLegacy(["import", ...forwarded]));
|
|
1619
1636
|
}
|
|
1637
|
+
await openTui();
|
|
1638
|
+
});
|
|
1639
|
+
}
|
|
1640
|
+
|
|
1641
|
+
// packages/experience-design-system-cli/program.ts
|
|
1642
|
+
init_package_root();
|
|
1643
|
+
var pkg = JSON.parse(
|
|
1644
|
+
readFileSync3(
|
|
1645
|
+
join7(findPackageRoot(import.meta.url, "@contentful/experience-design-system-cli"), "package.json"),
|
|
1646
|
+
"utf8"
|
|
1647
|
+
)
|
|
1648
|
+
);
|
|
1649
|
+
function createProgram() {
|
|
1650
|
+
const program = new Command().name("experiences").description("Contentful Experiences design system import CLI").version(pkg.version, "--version", "Print version number");
|
|
1651
|
+
registerImportCommand(program, async () => {
|
|
1620
1652
|
const { render } = await import("ink");
|
|
1621
1653
|
const { runApp: runApp2 } = await Promise.resolve().then(() => (init_app(), app_exports));
|
|
1622
1654
|
await runApp2(render);
|
|
@@ -1628,10 +1660,10 @@ function createProgram() {
|
|
|
1628
1660
|
// packages/experience-design-system-cli/src/config/migrate.ts
|
|
1629
1661
|
init_config();
|
|
1630
1662
|
init_package_root();
|
|
1631
|
-
import { existsSync as
|
|
1663
|
+
import { existsSync as existsSync5 } from "node:fs";
|
|
1632
1664
|
import { mkdir as mkdir3, readFile as readFile2, rename as rename2, rmdir, unlink } from "node:fs/promises";
|
|
1633
|
-
import { dirname as dirname3, join as
|
|
1634
|
-
var
|
|
1665
|
+
import { dirname as dirname3, join as join8 } from "node:path";
|
|
1666
|
+
var PACKAGE_NAME4 = "@contentful/experience-design-system-cli";
|
|
1635
1667
|
async function readJson(path) {
|
|
1636
1668
|
try {
|
|
1637
1669
|
return JSON.parse(await readFile2(path, "utf8"));
|
|
@@ -1641,10 +1673,10 @@ async function readJson(path) {
|
|
|
1641
1673
|
}
|
|
1642
1674
|
async function migrateOldConfig() {
|
|
1643
1675
|
try {
|
|
1644
|
-
const oldCredentials =
|
|
1645
|
-
const oldRuns =
|
|
1646
|
-
const oldDebugMode =
|
|
1647
|
-
findPackageRoot(import.meta.url,
|
|
1676
|
+
const oldCredentials = join8(oldConfigDir(), "credentials.json");
|
|
1677
|
+
const oldRuns = join8(oldConfigDir(), "runs.json");
|
|
1678
|
+
const oldDebugMode = join8(
|
|
1679
|
+
findPackageRoot(import.meta.url, PACKAGE_NAME4),
|
|
1648
1680
|
".contentful",
|
|
1649
1681
|
"config",
|
|
1650
1682
|
"debug_mode.json"
|
|
@@ -1654,8 +1686,8 @@ async function migrateOldConfig() {
|
|
|
1654
1686
|
if (debugMode) migrated["debugMode"] = debugMode;
|
|
1655
1687
|
Object.assign(migrated, await readJson(oldCredentials));
|
|
1656
1688
|
if (Object.keys(migrated).length > 0) await updateSettings({ ...migrated, ...await readSettings() });
|
|
1657
|
-
if (
|
|
1658
|
-
if (!
|
|
1689
|
+
if (existsSync5(oldRuns)) {
|
|
1690
|
+
if (!existsSync5(runsFilePath())) {
|
|
1659
1691
|
await mkdir3(dirname3(runsFilePath()), { recursive: true });
|
|
1660
1692
|
await rename2(oldRuns, runsFilePath());
|
|
1661
1693
|
} else {
|
package/dist/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@contentful/experience-design-system-cli",
|
|
3
|
-
"version": "2.37.1-dev-build-
|
|
3
|
+
"version": "2.37.1-dev-build-33443a39.0",
|
|
4
4
|
"description": "Contentful Experiences design system import CLI",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -33,7 +33,8 @@
|
|
|
33
33
|
"clean": "nx clean experience-design-system-cli",
|
|
34
34
|
"test": "nx test experience-design-system-cli",
|
|
35
35
|
"lint": "nx lint experience-design-system-cli",
|
|
36
|
-
"lint:fix": "nx lint:fix experience-design-system-cli"
|
|
36
|
+
"lint:fix": "nx lint:fix experience-design-system-cli",
|
|
37
|
+
"dev": "node scripts/dev.mjs"
|
|
37
38
|
},
|
|
38
39
|
"dependencies": {
|
|
39
40
|
"@contentful/experience-design-system-types": "workspace:*",
|
|
@@ -57,6 +58,7 @@
|
|
|
57
58
|
"@types/node": "^24.0.3",
|
|
58
59
|
"@types/react": "^18.3.24",
|
|
59
60
|
"@types/semver": "^7.7.1",
|
|
61
|
+
"esbuild": "0.28.0",
|
|
60
62
|
"eslint": "^9.39.5",
|
|
61
63
|
"eslint-config-prettier": "^10.1.8",
|
|
62
64
|
"eslint-plugin-prettier": "^5.5.6",
|
|
@@ -2,7 +2,7 @@ export declare const WELCOME_CONTROLS: readonly [{
|
|
|
2
2
|
readonly keys: "Enter";
|
|
3
3
|
readonly label: "Continue";
|
|
4
4
|
}, {
|
|
5
|
-
readonly keys: "Esc
|
|
5
|
+
readonly keys: "Esc";
|
|
6
6
|
readonly label: "Back to menu";
|
|
7
7
|
}];
|
|
8
|
-
export declare function useWelcomeControls(
|
|
8
|
+
export declare function useWelcomeControls(onQuit: () => void): void;
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
interface QuitKey {
|
|
2
2
|
escape: boolean;
|
|
3
|
-
ctrl: boolean;
|
|
4
|
-
meta: boolean;
|
|
5
3
|
}
|
|
6
|
-
export declare function shouldQuit(
|
|
4
|
+
export declare function shouldQuit(key: QuitKey): boolean;
|
|
7
5
|
export declare function toProjectPath(value: string): string | null;
|
|
8
6
|
export {};
|
|
@@ -1,11 +1,8 @@
|
|
|
1
1
|
export declare const TOKEN_INPUT_CONTROLS: readonly [{
|
|
2
2
|
readonly keys: "Enter";
|
|
3
|
-
readonly label: "Continue
|
|
3
|
+
readonly label: "Continue";
|
|
4
4
|
}, {
|
|
5
|
-
readonly keys: "
|
|
6
|
-
readonly label: "Skip";
|
|
7
|
-
}, {
|
|
8
|
-
readonly keys: "Esc/q";
|
|
5
|
+
readonly keys: "Esc";
|
|
9
6
|
readonly label: "Back";
|
|
10
7
|
}];
|
|
11
|
-
export declare function useTokenInputControls(
|
|
8
|
+
export declare function useTokenInputControls(onBack: () => void): void;
|
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
interface Key {
|
|
2
2
|
escape: boolean;
|
|
3
|
-
ctrl: boolean;
|
|
4
|
-
meta: boolean;
|
|
5
3
|
}
|
|
6
|
-
export declare function shouldGoBack(
|
|
7
|
-
export declare function shouldSkip(value: string, input: string, key: Key): boolean;
|
|
4
|
+
export declare function shouldGoBack(key: Key): boolean;
|
|
8
5
|
export declare function toTokenPath(value: string): string | null;
|
|
9
6
|
export {};
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
interface TokenInputScreenProps {
|
|
3
3
|
onConfirm: (tokensPath: string) => void;
|
|
4
|
-
onSkip: () => void;
|
|
5
4
|
onBack: () => void;
|
|
6
5
|
initialPath?: string;
|
|
7
6
|
}
|
|
8
|
-
export declare function TokenInputScreen({ onConfirm,
|
|
7
|
+
export declare function TokenInputScreen({ onConfirm, onBack, initialPath }: TokenInputScreenProps): React.ReactElement;
|
|
9
8
|
export {};
|
package/legacy/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@contentful/experience-design-system-cli",
|
|
3
|
-
"version": "2.37.1-dev-build-
|
|
3
|
+
"version": "2.37.1-dev-build-33443a39.0",
|
|
4
4
|
"description": "Contentful Experiences design system import CLI",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -33,7 +33,8 @@
|
|
|
33
33
|
"clean": "nx clean experience-design-system-cli",
|
|
34
34
|
"test": "nx test experience-design-system-cli",
|
|
35
35
|
"lint": "nx lint experience-design-system-cli",
|
|
36
|
-
"lint:fix": "nx lint:fix experience-design-system-cli"
|
|
36
|
+
"lint:fix": "nx lint:fix experience-design-system-cli",
|
|
37
|
+
"dev": "node scripts/dev.mjs"
|
|
37
38
|
},
|
|
38
39
|
"dependencies": {
|
|
39
40
|
"@contentful/experience-design-system-types": "workspace:*",
|
|
@@ -57,6 +58,7 @@
|
|
|
57
58
|
"@types/node": "^24.0.3",
|
|
58
59
|
"@types/react": "^18.3.24",
|
|
59
60
|
"@types/semver": "^7.7.1",
|
|
61
|
+
"esbuild": "0.28.0",
|
|
60
62
|
"eslint": "^9.39.5",
|
|
61
63
|
"eslint-config-prettier": "^10.1.8",
|
|
62
64
|
"eslint-plugin-prettier": "^5.5.6",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@contentful/experience-design-system-cli",
|
|
3
|
-
"version": "2.37.1-dev-build-
|
|
3
|
+
"version": "2.37.1-dev-build-33443a39.0",
|
|
4
4
|
"description": "Contentful Experiences design system import CLI",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -42,13 +42,14 @@
|
|
|
42
42
|
"svelte": "^5.56.4",
|
|
43
43
|
"ts-morph": "^27.0.2",
|
|
44
44
|
"typescript": "^5.9.3",
|
|
45
|
-
"@contentful/experience-design-system-types": "2.37.1-dev-build-
|
|
45
|
+
"@contentful/experience-design-system-types": "2.37.1-dev-build-33443a39.0"
|
|
46
46
|
},
|
|
47
47
|
"devDependencies": {
|
|
48
48
|
"@tsconfig/node24": "^24.0.4",
|
|
49
49
|
"@types/node": "^24.0.3",
|
|
50
50
|
"@types/react": "^18.3.24",
|
|
51
51
|
"@types/semver": "^7.7.1",
|
|
52
|
+
"esbuild": "0.28.0",
|
|
52
53
|
"eslint": "^9.39.5",
|
|
53
54
|
"eslint-config-prettier": "^10.1.8",
|
|
54
55
|
"eslint-plugin-prettier": "^5.5.6",
|
|
@@ -73,6 +74,7 @@
|
|
|
73
74
|
"clean": "nx clean experience-design-system-cli",
|
|
74
75
|
"test": "nx test experience-design-system-cli",
|
|
75
76
|
"lint": "nx lint experience-design-system-cli",
|
|
76
|
-
"lint:fix": "nx lint:fix experience-design-system-cli"
|
|
77
|
+
"lint:fix": "nx lint:fix experience-design-system-cli",
|
|
78
|
+
"dev": "node scripts/dev.mjs"
|
|
77
79
|
}
|
|
78
80
|
}
|