@contentful/experience-design-system-cli 2.37.1-dev-build-0c48abe6.0 → 2.37.1-dev-build-d8840d44.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
|
|
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
|
});
|
|
@@ -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
|
|
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 =
|
|
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
|
|
628
|
+
import { dirname as dirname2, join as join5 } from "node:path";
|
|
629
629
|
function configRoot() {
|
|
630
|
-
return process.env["EDS_HOME"] ||
|
|
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 = () =>
|
|
655
|
-
runsFilePath = () =>
|
|
656
|
-
debugSessionsDir = () =>
|
|
657
|
-
oldConfigDir = () =>
|
|
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
|
|
683
|
-
import { join as
|
|
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 =
|
|
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
|
|
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 =
|
|
753
|
+
const dir = join6(sessionDebugDir(), ...flowSegments);
|
|
754
754
|
await mkdir2(dir, { recursive: true });
|
|
755
755
|
const filename = nextAttemptFilename(dir, run.menuOption);
|
|
756
|
-
await writeFile2(
|
|
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 =
|
|
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);
|
|
@@ -1552,13 +1552,9 @@ var init_app = __esm({
|
|
|
1552
1552
|
|
|
1553
1553
|
// packages/experience-design-system-cli/program.ts
|
|
1554
1554
|
import { readFileSync as readFileSync3 } from "node:fs";
|
|
1555
|
+
import { join as join7 } from "node:path";
|
|
1555
1556
|
import { Command } from "commander";
|
|
1556
1557
|
|
|
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
1558
|
// packages/experience-design-system-cli/src/legacy/run-legacy.ts
|
|
1563
1559
|
init_legacy_cli_path();
|
|
1564
1560
|
import { spawn } from "node:child_process";
|
|
@@ -1583,8 +1579,7 @@ function runLegacy(args) {
|
|
|
1583
1579
|
});
|
|
1584
1580
|
}
|
|
1585
1581
|
|
|
1586
|
-
// packages/experience-design-system-cli/
|
|
1587
|
-
var pkg = JSON.parse(readFileSync3(new URL("../package.json", import.meta.url), "utf8"));
|
|
1582
|
+
// packages/experience-design-system-cli/src/commands/forwarded.ts
|
|
1588
1583
|
var FORWARDED_COMMANDS = [
|
|
1589
1584
|
{
|
|
1590
1585
|
name: "apply",
|
|
@@ -1610,13 +1605,65 @@ function registerForwardedCommands(program) {
|
|
|
1610
1605
|
});
|
|
1611
1606
|
}
|
|
1612
1607
|
}
|
|
1613
|
-
|
|
1614
|
-
|
|
1608
|
+
|
|
1609
|
+
// packages/experience-design-system-cli/src/legacy/forwarded-import-args.ts
|
|
1610
|
+
function forwardedImportArgs(argv) {
|
|
1611
|
+
return argv[0] === "import" ? argv.slice(1) : argv;
|
|
1612
|
+
}
|
|
1613
|
+
|
|
1614
|
+
// packages/experience-design-system-cli/src/commands/watch.ts
|
|
1615
|
+
init_package_root();
|
|
1616
|
+
import { spawn as spawn2 } from "node:child_process";
|
|
1617
|
+
import { existsSync as existsSync3 } from "node:fs";
|
|
1618
|
+
import { join as join3 } from "node:path";
|
|
1619
|
+
var PACKAGE_NAME2 = "@contentful/experience-design-system-cli";
|
|
1620
|
+
function extractWatchFlag(args) {
|
|
1621
|
+
const rest = args.filter((arg) => arg !== "--watch");
|
|
1622
|
+
return { watch: rest.length !== args.length, rest };
|
|
1623
|
+
}
|
|
1624
|
+
function runDevWatch(args) {
|
|
1625
|
+
const script = join3(findPackageRoot(import.meta.url, PACKAGE_NAME2), "scripts", "dev.mjs");
|
|
1626
|
+
if (!existsSync3(script)) {
|
|
1627
|
+
process.stderr.write("--watch only works from a checkout of the repo (scripts/dev.mjs is not in the package).\n");
|
|
1628
|
+
return Promise.resolve(1);
|
|
1629
|
+
}
|
|
1630
|
+
return new Promise((resolve2) => {
|
|
1631
|
+
const child = spawn2(process.execPath, [script, ...args], { stdio: "inherit" });
|
|
1632
|
+
process.on("SIGINT", () => void 0);
|
|
1633
|
+
child.on("exit", (code) => resolve2(code ?? 0));
|
|
1634
|
+
child.on("error", (err) => {
|
|
1635
|
+
process.stderr.write(`${err.message}
|
|
1636
|
+
`);
|
|
1637
|
+
resolve2(1);
|
|
1638
|
+
});
|
|
1639
|
+
});
|
|
1640
|
+
}
|
|
1641
|
+
|
|
1642
|
+
// packages/experience-design-system-cli/src/commands/import.ts
|
|
1643
|
+
function registerImportCommand(program, openTui) {
|
|
1615
1644
|
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));
|
|
1645
|
+
const { watch, rest: forwarded } = extractWatchFlag(forwardedImportArgs(process.argv.slice(2)));
|
|
1646
|
+
if (watch) {
|
|
1647
|
+
process.exit(await runDevWatch(forwarded));
|
|
1648
|
+
}
|
|
1617
1649
|
if (forwarded.length > 0) {
|
|
1618
1650
|
process.exit(await runLegacy(["import", ...forwarded]));
|
|
1619
1651
|
}
|
|
1652
|
+
await openTui();
|
|
1653
|
+
});
|
|
1654
|
+
}
|
|
1655
|
+
|
|
1656
|
+
// packages/experience-design-system-cli/program.ts
|
|
1657
|
+
init_package_root();
|
|
1658
|
+
var pkg = JSON.parse(
|
|
1659
|
+
readFileSync3(
|
|
1660
|
+
join7(findPackageRoot(import.meta.url, "@contentful/experience-design-system-cli"), "package.json"),
|
|
1661
|
+
"utf8"
|
|
1662
|
+
)
|
|
1663
|
+
);
|
|
1664
|
+
function createProgram() {
|
|
1665
|
+
const program = new Command().name("experiences").description("Contentful Experiences design system import CLI").version(pkg.version, "--version", "Print version number");
|
|
1666
|
+
registerImportCommand(program, async () => {
|
|
1620
1667
|
const { render } = await import("ink");
|
|
1621
1668
|
const { runApp: runApp2 } = await Promise.resolve().then(() => (init_app(), app_exports));
|
|
1622
1669
|
await runApp2(render);
|
|
@@ -1628,10 +1675,10 @@ function createProgram() {
|
|
|
1628
1675
|
// packages/experience-design-system-cli/src/config/migrate.ts
|
|
1629
1676
|
init_config();
|
|
1630
1677
|
init_package_root();
|
|
1631
|
-
import { existsSync as
|
|
1678
|
+
import { existsSync as existsSync5 } from "node:fs";
|
|
1632
1679
|
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
|
|
1680
|
+
import { dirname as dirname3, join as join8 } from "node:path";
|
|
1681
|
+
var PACKAGE_NAME4 = "@contentful/experience-design-system-cli";
|
|
1635
1682
|
async function readJson(path) {
|
|
1636
1683
|
try {
|
|
1637
1684
|
return JSON.parse(await readFile2(path, "utf8"));
|
|
@@ -1641,10 +1688,10 @@ async function readJson(path) {
|
|
|
1641
1688
|
}
|
|
1642
1689
|
async function migrateOldConfig() {
|
|
1643
1690
|
try {
|
|
1644
|
-
const oldCredentials =
|
|
1645
|
-
const oldRuns =
|
|
1646
|
-
const oldDebugMode =
|
|
1647
|
-
findPackageRoot(import.meta.url,
|
|
1691
|
+
const oldCredentials = join8(oldConfigDir(), "credentials.json");
|
|
1692
|
+
const oldRuns = join8(oldConfigDir(), "runs.json");
|
|
1693
|
+
const oldDebugMode = join8(
|
|
1694
|
+
findPackageRoot(import.meta.url, PACKAGE_NAME4),
|
|
1648
1695
|
".contentful",
|
|
1649
1696
|
"config",
|
|
1650
1697
|
"debug_mode.json"
|
|
@@ -1654,8 +1701,8 @@ async function migrateOldConfig() {
|
|
|
1654
1701
|
if (debugMode) migrated["debugMode"] = debugMode;
|
|
1655
1702
|
Object.assign(migrated, await readJson(oldCredentials));
|
|
1656
1703
|
if (Object.keys(migrated).length > 0) await updateSettings({ ...migrated, ...await readSettings() });
|
|
1657
|
-
if (
|
|
1658
|
-
if (!
|
|
1704
|
+
if (existsSync5(oldRuns)) {
|
|
1705
|
+
if (!existsSync5(runsFilePath())) {
|
|
1659
1706
|
await mkdir3(dirname3(runsFilePath()), { recursive: true });
|
|
1660
1707
|
await rename2(oldRuns, runsFilePath());
|
|
1661
1708
|
} 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-d8840d44.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/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-d8840d44.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-d8840d44.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-d8840d44.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
|
}
|