@contentful/experience-design-system-cli 2.37.1-dev-build-0e44d27b.0 → 2.37.1-dev-build-049f8d38.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/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 join3 } from "node:path";
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, PACKAGE_NAME2);
106
- const pkg2 = JSON.parse(readFileSync2(join3(root, "package.json"), "utf8"));
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 PACKAGE_NAME2, TAGS_URL;
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
- PACKAGE_NAME2 = "@contentful/experience-design-system-cli";
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
  });
@@ -551,7 +551,7 @@ var init_steps = __esm({
551
551
  });
552
552
 
553
553
  // packages/experience-design-system-cli/src/tui/import/spawn-v1-import.ts
554
- import { spawn as spawn2 } from "node:child_process";
554
+ import { spawn as spawn3 } from "node:child_process";
555
555
  function buildArgs(options) {
556
556
  const args = ["import"];
557
557
  if (options.project) {
@@ -566,7 +566,7 @@ async function spawnV1Import(options = {}) {
566
566
  const cliPath = findLegacyCliPath();
567
567
  const args = buildArgs(options);
568
568
  return new Promise((resolvePromise) => {
569
- const child = spawn2("node", [cliPath, ...args], {
569
+ const child = spawn3("node", [cliPath, ...args], {
570
570
  stdio: "inherit"
571
571
  });
572
572
  child.on("close", (code) => {
@@ -611,9 +611,9 @@ var init_terminal_input = __esm({
611
611
  import { randomBytes } from "node:crypto";
612
612
  import { mkdir, readFile, rename, writeFile } from "node:fs/promises";
613
613
  import { homedir as homedir2 } from "node:os";
614
- import { dirname as dirname2, join as join4 } from "node:path";
614
+ import { dirname as dirname2, join as join5 } from "node:path";
615
615
  function configRoot() {
616
- return process.env["EDS_HOME"] || join4(homedir2(), ".contentful", "experience-design-system-cli");
616
+ return process.env["EDS_HOME"] || join5(homedir2(), ".contentful", "experience-design-system-cli");
617
617
  }
618
618
  async function readSettings() {
619
619
  try {
@@ -637,10 +637,10 @@ var configFilePath, runsFilePath, debugSessionsDir, oldConfigDir;
637
637
  var init_config = __esm({
638
638
  "packages/experience-design-system-types/dist/src/config/index.js"() {
639
639
  "use strict";
640
- configFilePath = () => join4(configRoot(), "config.json");
641
- runsFilePath = () => join4(configRoot(), "state", "runs.json");
642
- debugSessionsDir = () => join4(configRoot(), "debug", "sessions");
643
- oldConfigDir = () => join4(homedir2(), ".config", "experiences");
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");
644
644
  }
645
645
  });
646
646
 
@@ -665,8 +665,8 @@ var init_debug_mode_store = __esm({
665
665
 
666
666
  // packages/experience-design-system-cli/src/tui/debug-store.ts
667
667
  import { mkdir as mkdir2, writeFile as writeFile2 } from "node:fs/promises";
668
- import { existsSync as existsSync3, readdirSync } from "node:fs";
669
- import { join as join5 } from "node:path";
668
+ import { existsSync as existsSync4, readdirSync } from "node:fs";
669
+ import { join as join6 } from "node:path";
670
670
  function generateRunId() {
671
671
  const now = /* @__PURE__ */ new Date();
672
672
  const pad = (n) => String(n).padStart(2, "0");
@@ -682,7 +682,7 @@ function slugify(value) {
682
682
  function generateSessionId() {
683
683
  const today = datePrefix();
684
684
  const root = debugSessionsDir();
685
- const existing = existsSync3(root) ? readdirSync(root) : [];
685
+ const existing = existsSync4(root) ? readdirSync(root) : [];
686
686
  const seqPattern = new RegExp(`^${today}-session-(\\d+)$`);
687
687
  const maxSeq = existing.reduce((max, entry) => {
688
688
  const match = seqPattern.exec(entry);
@@ -691,7 +691,7 @@ function generateSessionId() {
691
691
  return `${today}-session-${maxSeq + 1}`;
692
692
  }
693
693
  function sessionDebugDir() {
694
- return join5(debugSessionsDir(), SESSION_ID);
694
+ return join6(debugSessionsDir(), SESSION_ID);
695
695
  }
696
696
  function currentDebugSessionDir() {
697
697
  return sessionDebugDir();
@@ -736,15 +736,15 @@ async function finishDebugRun({
736
736
  const durationMs = Date.now() - run.startedAt;
737
737
  const content = renderMarkdown(run, { outputs: redact(outputs), status, exitMethod, durationMs });
738
738
  const flowSegments = run.flow.split("/");
739
- const dir = join5(sessionDebugDir(), ...flowSegments);
739
+ const dir = join6(sessionDebugDir(), ...flowSegments);
740
740
  await mkdir2(dir, { recursive: true });
741
741
  const filename = nextAttemptFilename(dir, run.menuOption);
742
- await writeFile2(join5(dir, filename), content, { mode: 384 });
742
+ await writeFile2(join6(dir, filename), content, { mode: 384 });
743
743
  }
744
744
  function nextAttemptFilename(dir, menuOption) {
745
745
  const today = datePrefix();
746
746
  const optionSlug = slugify(menuOption);
747
- const existing = existsSync3(dir) ? readdirSync(dir) : [];
747
+ const existing = existsSync4(dir) ? readdirSync(dir) : [];
748
748
  const attemptPattern = new RegExp(`^${today}-${optionSlug}-attempt-(\\d+)\\.md$`);
749
749
  const maxAttempt = existing.reduce((max, entry) => {
750
750
  const match = attemptPattern.exec(entry);
@@ -1542,13 +1542,9 @@ var init_app = __esm({
1542
1542
 
1543
1543
  // packages/experience-design-system-cli/program.ts
1544
1544
  import { readFileSync as readFileSync3 } from "node:fs";
1545
+ import { join as join7 } from "node:path";
1545
1546
  import { Command } from "commander";
1546
1547
 
1547
- // packages/experience-design-system-cli/src/legacy/forwarded-import-args.ts
1548
- function forwardedImportArgs(argv) {
1549
- return argv[0] === "import" ? argv.slice(1) : argv;
1550
- }
1551
-
1552
1548
  // packages/experience-design-system-cli/src/legacy/run-legacy.ts
1553
1549
  init_legacy_cli_path();
1554
1550
  import { spawn } from "node:child_process";
@@ -1573,8 +1569,7 @@ function runLegacy(args) {
1573
1569
  });
1574
1570
  }
1575
1571
 
1576
- // packages/experience-design-system-cli/program.ts
1577
- var pkg = JSON.parse(readFileSync3(new URL("../package.json", import.meta.url), "utf8"));
1572
+ // packages/experience-design-system-cli/src/commands/forwarded.ts
1578
1573
  var FORWARDED_COMMANDS = [
1579
1574
  {
1580
1575
  name: "apply",
@@ -1600,13 +1595,65 @@ function registerForwardedCommands(program) {
1600
1595
  });
1601
1596
  }
1602
1597
  }
1603
- function createProgram() {
1604
- const program = new Command().name("experiences").description("Contentful Experiences design system import CLI").version(pkg.version, "--version", "Print version number");
1598
+
1599
+ // packages/experience-design-system-cli/src/legacy/forwarded-import-args.ts
1600
+ function forwardedImportArgs(argv) {
1601
+ return argv[0] === "import" ? argv.slice(1) : argv;
1602
+ }
1603
+
1604
+ // packages/experience-design-system-cli/src/commands/watch.ts
1605
+ init_package_root();
1606
+ import { spawn as spawn2 } from "node:child_process";
1607
+ import { existsSync as existsSync3 } from "node:fs";
1608
+ import { join as join3 } from "node:path";
1609
+ var PACKAGE_NAME2 = "@contentful/experience-design-system-cli";
1610
+ function extractWatchFlag(args) {
1611
+ const rest = args.filter((arg) => arg !== "--watch");
1612
+ return { watch: rest.length !== args.length, rest };
1613
+ }
1614
+ function runDevWatch(args) {
1615
+ const script = join3(findPackageRoot(import.meta.url, PACKAGE_NAME2), "scripts", "dev.mjs");
1616
+ if (!existsSync3(script)) {
1617
+ process.stderr.write("--watch only works from a checkout of the repo (scripts/dev.mjs is not in the package).\n");
1618
+ return Promise.resolve(1);
1619
+ }
1620
+ return new Promise((resolve2) => {
1621
+ const child = spawn2(process.execPath, [script, ...args], { stdio: "inherit" });
1622
+ process.on("SIGINT", () => void 0);
1623
+ child.on("exit", (code) => resolve2(code ?? 0));
1624
+ child.on("error", (err) => {
1625
+ process.stderr.write(`${err.message}
1626
+ `);
1627
+ resolve2(1);
1628
+ });
1629
+ });
1630
+ }
1631
+
1632
+ // packages/experience-design-system-cli/src/commands/import.ts
1633
+ function registerImportCommand(program, openTui) {
1605
1634
  program.command("import", { isDefault: true }).description("Launch the Experiences CLI").allowUnknownOption().allowExcessArguments().helpOption(false).argument("[args...]").action(async () => {
1606
- const forwarded = forwardedImportArgs(process.argv.slice(2));
1635
+ const { watch, rest: forwarded } = extractWatchFlag(forwardedImportArgs(process.argv.slice(2)));
1636
+ if (watch) {
1637
+ process.exit(await runDevWatch(forwarded));
1638
+ }
1607
1639
  if (forwarded.length > 0) {
1608
1640
  process.exit(await runLegacy(["import", ...forwarded]));
1609
1641
  }
1642
+ await openTui();
1643
+ });
1644
+ }
1645
+
1646
+ // packages/experience-design-system-cli/program.ts
1647
+ init_package_root();
1648
+ var pkg = JSON.parse(
1649
+ readFileSync3(
1650
+ join7(findPackageRoot(import.meta.url, "@contentful/experience-design-system-cli"), "package.json"),
1651
+ "utf8"
1652
+ )
1653
+ );
1654
+ function createProgram() {
1655
+ const program = new Command().name("experiences").description("Contentful Experiences design system import CLI").version(pkg.version, "--version", "Print version number");
1656
+ registerImportCommand(program, async () => {
1610
1657
  const { render } = await import("ink");
1611
1658
  const { runApp: runApp2 } = await Promise.resolve().then(() => (init_app(), app_exports));
1612
1659
  await runApp2(render);
@@ -1618,10 +1665,10 @@ function createProgram() {
1618
1665
  // packages/experience-design-system-cli/src/config/migrate.ts
1619
1666
  init_config();
1620
1667
  init_package_root();
1621
- import { existsSync as existsSync4 } from "node:fs";
1668
+ import { existsSync as existsSync5 } from "node:fs";
1622
1669
  import { mkdir as mkdir3, readFile as readFile2, rename as rename2, rmdir, unlink } from "node:fs/promises";
1623
- import { dirname as dirname3, join as join6 } from "node:path";
1624
- var PACKAGE_NAME3 = "@contentful/experience-design-system-cli";
1670
+ import { dirname as dirname3, join as join8 } from "node:path";
1671
+ var PACKAGE_NAME4 = "@contentful/experience-design-system-cli";
1625
1672
  async function readJson(path) {
1626
1673
  try {
1627
1674
  return JSON.parse(await readFile2(path, "utf8"));
@@ -1631,10 +1678,10 @@ async function readJson(path) {
1631
1678
  }
1632
1679
  async function migrateOldConfig() {
1633
1680
  try {
1634
- const oldCredentials = join6(oldConfigDir(), "credentials.json");
1635
- const oldRuns = join6(oldConfigDir(), "runs.json");
1636
- const oldDebugMode = join6(
1637
- findPackageRoot(import.meta.url, PACKAGE_NAME3),
1681
+ const oldCredentials = join8(oldConfigDir(), "credentials.json");
1682
+ const oldRuns = join8(oldConfigDir(), "runs.json");
1683
+ const oldDebugMode = join8(
1684
+ findPackageRoot(import.meta.url, PACKAGE_NAME4),
1638
1685
  ".contentful",
1639
1686
  "config",
1640
1687
  "debug_mode.json"
@@ -1644,8 +1691,8 @@ async function migrateOldConfig() {
1644
1691
  if (debugMode) migrated["debugMode"] = debugMode;
1645
1692
  Object.assign(migrated, await readJson(oldCredentials));
1646
1693
  if (Object.keys(migrated).length > 0) await updateSettings({ ...migrated, ...await readSettings() });
1647
- if (existsSync4(oldRuns)) {
1648
- if (!existsSync4(runsFilePath())) {
1694
+ if (existsSync5(oldRuns)) {
1695
+ if (!existsSync5(runsFilePath())) {
1649
1696
  await mkdir3(dirname3(runsFilePath()), { recursive: true });
1650
1697
  await rename2(oldRuns, runsFilePath());
1651
1698
  } 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-0e44d27b.0",
3
+ "version": "2.37.1-dev-build-049f8d38.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",
@@ -0,0 +1,2 @@
1
+ import type { Command } from 'commander';
2
+ export declare function registerForwardedCommands(program: Command): void;
@@ -0,0 +1,2 @@
1
+ import type { Command } from 'commander';
2
+ export declare function registerImportCommand(program: Command, openTui: () => Promise<void>): void;
@@ -0,0 +1,5 @@
1
+ export declare function extractWatchFlag(args: string[]): {
2
+ watch: boolean;
3
+ rest: string[];
4
+ };
5
+ export declare function runDevWatch(args: string[]): Promise<number>;
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@contentful/experience-design-system-cli",
3
- "version": "2.37.1-dev-build-0e44d27b.0",
3
+ "version": "2.37.1-dev-build-049f8d38.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-0e44d27b.0",
3
+ "version": "2.37.1-dev-build-049f8d38.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-0e44d27b.0"
45
+ "@contentful/experience-design-system-types": "2.37.1-dev-build-049f8d38.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
  }