@contentful/experience-design-system-cli 2.37.1-dev-build-7a8cecce.0 → 2.37.1-dev-build-fa22c640.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
@@ -33,27 +33,27 @@ var init_package_root = __esm({
33
33
  });
34
34
 
35
35
  // packages/experience-design-system-cli/src/legacy/legacy-cli-path.ts
36
- import { existsSync as existsSync2 } from "node:fs";
37
- import { join as join2 } from "node:path";
36
+ import { existsSync as existsSync3 } from "node:fs";
37
+ import { join as join3 } from "node:path";
38
38
  function findLegacyCliPath() {
39
- const root = findPackageRoot(import.meta.url, PACKAGE_NAME);
39
+ const root = findPackageRoot(import.meta.url, PACKAGE_NAME2);
40
40
  const candidates = [
41
- join2(root, "legacy", "bin", "cli.js"),
42
- join2(root, "..", "experience-design-system-cli-legacy", "bin", "cli.js")
41
+ join3(root, "legacy", "bin", "cli.js"),
42
+ join3(root, "..", "experience-design-system-cli-legacy", "bin", "cli.js")
43
43
  ];
44
- const found = candidates.find((candidate) => existsSync2(candidate));
44
+ const found = candidates.find((candidate) => existsSync3(candidate));
45
45
  if (!found) {
46
46
  throw new Error(`Legacy CLI not found. Looked in:
47
47
  ${candidates.join("\n")}`);
48
48
  }
49
49
  return found;
50
50
  }
51
- var PACKAGE_NAME;
51
+ var PACKAGE_NAME2;
52
52
  var init_legacy_cli_path = __esm({
53
53
  "packages/experience-design-system-cli/src/legacy/legacy-cli-path.ts"() {
54
54
  "use strict";
55
55
  init_package_root();
56
- PACKAGE_NAME = "@contentful/experience-design-system-cli";
56
+ PACKAGE_NAME2 = "@contentful/experience-design-system-cli";
57
57
  }
58
58
  });
59
59
 
@@ -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
  });
@@ -565,7 +565,7 @@ var init_steps = __esm({
565
565
  });
566
566
 
567
567
  // packages/experience-design-system-cli/src/tui/import/spawn-v1-import.ts
568
- import { spawn as spawn2 } from "node:child_process";
568
+ import { spawn as spawn3 } from "node:child_process";
569
569
  function buildArgs(options) {
570
570
  const args = ["import"];
571
571
  if (options.project) {
@@ -580,7 +580,7 @@ async function spawnV1Import(options = {}) {
580
580
  const cliPath = findLegacyCliPath();
581
581
  const args = buildArgs(options);
582
582
  return new Promise((resolvePromise) => {
583
- const child = spawn2("node", [cliPath, ...args], {
583
+ const child = spawn3("node", [cliPath, ...args], {
584
584
  stdio: "inherit"
585
585
  });
586
586
  child.on("close", (code) => {
@@ -625,9 +625,9 @@ var init_terminal_input = __esm({
625
625
  import { randomBytes } from "node:crypto";
626
626
  import { mkdir, readFile, rename, writeFile } from "node:fs/promises";
627
627
  import { homedir as homedir2 } from "node:os";
628
- import { dirname as dirname2, join as join4 } from "node:path";
628
+ import { dirname as dirname2, join as join5 } from "node:path";
629
629
  function configRoot() {
630
- return process.env["EDS_HOME"] || join4(homedir2(), ".contentful", "experience-design-system-cli");
630
+ return process.env["EDS_HOME"] || join5(homedir2(), ".contentful", "experience-design-system-cli");
631
631
  }
632
632
  async function readSettings() {
633
633
  try {
@@ -651,10 +651,10 @@ var configFilePath, runsFilePath, debugSessionsDir, oldConfigDir;
651
651
  var init_config = __esm({
652
652
  "packages/experience-design-system-types/dist/src/config/index.js"() {
653
653
  "use strict";
654
- configFilePath = () => join4(configRoot(), "config.json");
655
- runsFilePath = () => join4(configRoot(), "state", "runs.json");
656
- debugSessionsDir = () => join4(configRoot(), "debug", "sessions");
657
- oldConfigDir = () => join4(homedir2(), ".config", "experiences");
654
+ configFilePath = () => join5(configRoot(), "config.json");
655
+ runsFilePath = () => join5(configRoot(), "state", "runs.json");
656
+ debugSessionsDir = () => join5(configRoot(), "debug", "sessions");
657
+ oldConfigDir = () => join5(homedir2(), ".config", "experiences");
658
658
  }
659
659
  });
660
660
 
@@ -679,8 +679,8 @@ var init_debug_mode_store = __esm({
679
679
 
680
680
  // packages/experience-design-system-cli/src/tui/debug-store.ts
681
681
  import { mkdir as mkdir2, writeFile as writeFile2 } from "node:fs/promises";
682
- import { existsSync as existsSync3, readdirSync } from "node:fs";
683
- import { join as join5 } from "node:path";
682
+ import { existsSync as existsSync4, readdirSync } from "node:fs";
683
+ import { join as join6 } from "node:path";
684
684
  function generateRunId() {
685
685
  const now = /* @__PURE__ */ new Date();
686
686
  const pad = (n) => String(n).padStart(2, "0");
@@ -696,7 +696,7 @@ function slugify(value) {
696
696
  function generateSessionId() {
697
697
  const today = datePrefix();
698
698
  const root = debugSessionsDir();
699
- const existing = existsSync3(root) ? readdirSync(root) : [];
699
+ const existing = existsSync4(root) ? readdirSync(root) : [];
700
700
  const seqPattern = new RegExp(`^${today}-session-(\\d+)$`);
701
701
  const maxSeq = existing.reduce((max, entry) => {
702
702
  const match = seqPattern.exec(entry);
@@ -705,7 +705,7 @@ function generateSessionId() {
705
705
  return `${today}-session-${maxSeq + 1}`;
706
706
  }
707
707
  function sessionDebugDir() {
708
- return join5(debugSessionsDir(), SESSION_ID);
708
+ return join6(debugSessionsDir(), SESSION_ID);
709
709
  }
710
710
  function currentDebugSessionDir() {
711
711
  return sessionDebugDir();
@@ -750,15 +750,15 @@ async function finishDebugRun({
750
750
  const durationMs = Date.now() - run.startedAt;
751
751
  const content = renderMarkdown(run, { outputs: redact(outputs), status, exitMethod, durationMs });
752
752
  const flowSegments = run.flow.split("/");
753
- const dir = join5(sessionDebugDir(), ...flowSegments);
753
+ const dir = join6(sessionDebugDir(), ...flowSegments);
754
754
  await mkdir2(dir, { recursive: true });
755
755
  const filename = nextAttemptFilename(dir, run.menuOption);
756
- await writeFile2(join5(dir, filename), content, { mode: 384 });
756
+ await writeFile2(join6(dir, filename), content, { mode: 384 });
757
757
  }
758
758
  function nextAttemptFilename(dir, menuOption) {
759
759
  const today = datePrefix();
760
760
  const optionSlug = slugify(menuOption);
761
- const existing = existsSync3(dir) ? readdirSync(dir) : [];
761
+ const existing = existsSync4(dir) ? readdirSync(dir) : [];
762
762
  const attemptPattern = new RegExp(`^${today}-${optionSlug}-attempt-(\\d+)\\.md$`);
763
763
  const maxAttempt = existing.reduce((max, entry) => {
764
764
  const match = attemptPattern.exec(entry);
@@ -1554,6 +1554,34 @@ var init_app = __esm({
1554
1554
  import { readFileSync as readFileSync3 } from "node:fs";
1555
1555
  import { Command } from "commander";
1556
1556
 
1557
+ // packages/experience-design-system-cli/src/dev/run-watch.ts
1558
+ init_package_root();
1559
+ import { spawn } from "node:child_process";
1560
+ import { existsSync as existsSync2 } from "node:fs";
1561
+ import { join as join2 } from "node:path";
1562
+ var PACKAGE_NAME = "@contentful/experience-design-system-cli";
1563
+ function extractWatchFlag(args) {
1564
+ const rest = args.filter((arg) => arg !== "--watch");
1565
+ return { watch: rest.length !== args.length, rest };
1566
+ }
1567
+ function runDevWatch(args) {
1568
+ const script = join2(findPackageRoot(import.meta.url, PACKAGE_NAME), "scripts", "dev.mjs");
1569
+ if (!existsSync2(script)) {
1570
+ process.stderr.write("--watch only works from a checkout of the repo (scripts/dev.mjs is not in the package).\n");
1571
+ return Promise.resolve(1);
1572
+ }
1573
+ return new Promise((resolve2) => {
1574
+ const child = spawn(process.execPath, [script, ...args], { stdio: "inherit" });
1575
+ process.on("SIGINT", () => void 0);
1576
+ child.on("exit", (code) => resolve2(code ?? 0));
1577
+ child.on("error", (err) => {
1578
+ process.stderr.write(`${err.message}
1579
+ `);
1580
+ resolve2(1);
1581
+ });
1582
+ });
1583
+ }
1584
+
1557
1585
  // packages/experience-design-system-cli/src/legacy/forwarded-import-args.ts
1558
1586
  function forwardedImportArgs(argv) {
1559
1587
  return argv[0] === "import" ? argv.slice(1) : argv;
@@ -1561,7 +1589,7 @@ function forwardedImportArgs(argv) {
1561
1589
 
1562
1590
  // packages/experience-design-system-cli/src/legacy/run-legacy.ts
1563
1591
  init_legacy_cli_path();
1564
- import { spawn } from "node:child_process";
1592
+ import { spawn as spawn2 } from "node:child_process";
1565
1593
  function runLegacy(args) {
1566
1594
  return new Promise((resolvePromise) => {
1567
1595
  let cliPath;
@@ -1573,7 +1601,7 @@ function runLegacy(args) {
1573
1601
  resolvePromise(1);
1574
1602
  return;
1575
1603
  }
1576
- const child = spawn("node", [cliPath, ...args], { stdio: "inherit" });
1604
+ const child = spawn2("node", [cliPath, ...args], { stdio: "inherit" });
1577
1605
  child.on("close", (code) => resolvePromise(code ?? 1));
1578
1606
  child.on("error", (err) => {
1579
1607
  process.stderr.write(`${err.message}
@@ -1613,7 +1641,10 @@ function registerForwardedCommands(program) {
1613
1641
  function createProgram() {
1614
1642
  const program = new Command().name("experiences").description("Contentful Experiences design system import CLI").version(pkg.version, "--version", "Print version number");
1615
1643
  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));
1644
+ const { watch, rest: forwarded } = extractWatchFlag(forwardedImportArgs(process.argv.slice(2)));
1645
+ if (watch) {
1646
+ process.exit(await runDevWatch(forwarded));
1647
+ }
1617
1648
  if (forwarded.length > 0) {
1618
1649
  process.exit(await runLegacy(["import", ...forwarded]));
1619
1650
  }
@@ -1628,10 +1659,10 @@ function createProgram() {
1628
1659
  // packages/experience-design-system-cli/src/config/migrate.ts
1629
1660
  init_config();
1630
1661
  init_package_root();
1631
- import { existsSync as existsSync4 } from "node:fs";
1662
+ import { existsSync as existsSync5 } from "node:fs";
1632
1663
  import { mkdir as mkdir3, readFile as readFile2, rename as rename2, rmdir, unlink } from "node:fs/promises";
1633
- import { dirname as dirname3, join as join6 } from "node:path";
1634
- var PACKAGE_NAME3 = "@contentful/experience-design-system-cli";
1664
+ import { dirname as dirname3, join as join7 } from "node:path";
1665
+ var PACKAGE_NAME4 = "@contentful/experience-design-system-cli";
1635
1666
  async function readJson(path) {
1636
1667
  try {
1637
1668
  return JSON.parse(await readFile2(path, "utf8"));
@@ -1641,10 +1672,10 @@ async function readJson(path) {
1641
1672
  }
1642
1673
  async function migrateOldConfig() {
1643
1674
  try {
1644
- const oldCredentials = join6(oldConfigDir(), "credentials.json");
1645
- const oldRuns = join6(oldConfigDir(), "runs.json");
1646
- const oldDebugMode = join6(
1647
- findPackageRoot(import.meta.url, PACKAGE_NAME3),
1675
+ const oldCredentials = join7(oldConfigDir(), "credentials.json");
1676
+ const oldRuns = join7(oldConfigDir(), "runs.json");
1677
+ const oldDebugMode = join7(
1678
+ findPackageRoot(import.meta.url, PACKAGE_NAME4),
1648
1679
  ".contentful",
1649
1680
  "config",
1650
1681
  "debug_mode.json"
@@ -1654,8 +1685,8 @@ async function migrateOldConfig() {
1654
1685
  if (debugMode) migrated["debugMode"] = debugMode;
1655
1686
  Object.assign(migrated, await readJson(oldCredentials));
1656
1687
  if (Object.keys(migrated).length > 0) await updateSettings({ ...migrated, ...await readSettings() });
1657
- if (existsSync4(oldRuns)) {
1658
- if (!existsSync4(runsFilePath())) {
1688
+ if (existsSync5(oldRuns)) {
1689
+ if (!existsSync5(runsFilePath())) {
1659
1690
  await mkdir3(dirname3(runsFilePath()), { recursive: true });
1660
1691
  await rename2(oldRuns, runsFilePath());
1661
1692
  } 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-7a8cecce.0",
3
+ "version": "2.37.1-dev-build-fa22c640.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,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-7a8cecce.0",
3
+ "version": "2.37.1-dev-build-fa22c640.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-7a8cecce.0",
3
+ "version": "2.37.1-dev-build-fa22c640.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-7a8cecce.0"
45
+ "@contentful/experience-design-system-types": "2.37.1-dev-build-fa22c640.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
  }