@contentful/experience-design-system-cli 2.37.1-dev-build-fa22c640.0 → 2.37.1-dev-build-84191e41.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 +40 -71
- package/dist/package.json +2 -4
- package/legacy/package.json +2 -4
- package/package.json +3 -5
- package/dist/src/dev/run-watch.d.ts +0 -5
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
|
|
37
|
-
import { join as
|
|
36
|
+
import { existsSync as existsSync2 } from "node:fs";
|
|
37
|
+
import { join as join2 } from "node:path";
|
|
38
38
|
function findLegacyCliPath() {
|
|
39
|
-
const root = findPackageRoot(import.meta.url,
|
|
39
|
+
const root = findPackageRoot(import.meta.url, PACKAGE_NAME);
|
|
40
40
|
const candidates = [
|
|
41
|
-
|
|
42
|
-
|
|
41
|
+
join2(root, "legacy", "bin", "cli.js"),
|
|
42
|
+
join2(root, "..", "experience-design-system-cli-legacy", "bin", "cli.js")
|
|
43
43
|
];
|
|
44
|
-
const found = candidates.find((candidate) =>
|
|
44
|
+
const found = candidates.find((candidate) => existsSync2(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
|
|
51
|
+
var PACKAGE_NAME;
|
|
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
|
-
|
|
56
|
+
PACKAGE_NAME = "@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
|
|
102
|
+
import { join as join3 } 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_NAME2);
|
|
106
|
+
const pkg2 = JSON.parse(readFileSync2(join3(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_NAME2, 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_NAME2 = "@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 spawn2 } 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 = spawn2("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 join4 } from "node:path";
|
|
629
629
|
function configRoot() {
|
|
630
|
-
return process.env["EDS_HOME"] ||
|
|
630
|
+
return process.env["EDS_HOME"] || join4(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 = () => join4(configRoot(), "config.json");
|
|
655
|
+
runsFilePath = () => join4(configRoot(), "state", "runs.json");
|
|
656
|
+
debugSessionsDir = () => join4(configRoot(), "debug", "sessions");
|
|
657
|
+
oldConfigDir = () => join4(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 existsSync3, readdirSync } from "node:fs";
|
|
683
|
+
import { join as join5 } 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 = existsSync3(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 join5(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 = join5(sessionDebugDir(), ...flowSegments);
|
|
754
754
|
await mkdir2(dir, { recursive: true });
|
|
755
755
|
const filename = nextAttemptFilename(dir, run.menuOption);
|
|
756
|
-
await writeFile2(
|
|
756
|
+
await writeFile2(join5(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 = existsSync3(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,34 +1554,6 @@ 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
|
-
|
|
1585
1557
|
// packages/experience-design-system-cli/src/legacy/forwarded-import-args.ts
|
|
1586
1558
|
function forwardedImportArgs(argv) {
|
|
1587
1559
|
return argv[0] === "import" ? argv.slice(1) : argv;
|
|
@@ -1589,7 +1561,7 @@ function forwardedImportArgs(argv) {
|
|
|
1589
1561
|
|
|
1590
1562
|
// packages/experience-design-system-cli/src/legacy/run-legacy.ts
|
|
1591
1563
|
init_legacy_cli_path();
|
|
1592
|
-
import { spawn
|
|
1564
|
+
import { spawn } from "node:child_process";
|
|
1593
1565
|
function runLegacy(args) {
|
|
1594
1566
|
return new Promise((resolvePromise) => {
|
|
1595
1567
|
let cliPath;
|
|
@@ -1601,7 +1573,7 @@ function runLegacy(args) {
|
|
|
1601
1573
|
resolvePromise(1);
|
|
1602
1574
|
return;
|
|
1603
1575
|
}
|
|
1604
|
-
const child =
|
|
1576
|
+
const child = spawn("node", [cliPath, ...args], { stdio: "inherit" });
|
|
1605
1577
|
child.on("close", (code) => resolvePromise(code ?? 1));
|
|
1606
1578
|
child.on("error", (err) => {
|
|
1607
1579
|
process.stderr.write(`${err.message}
|
|
@@ -1641,10 +1613,7 @@ function registerForwardedCommands(program) {
|
|
|
1641
1613
|
function createProgram() {
|
|
1642
1614
|
const program = new Command().name("experiences").description("Contentful Experiences design system import CLI").version(pkg.version, "--version", "Print version number");
|
|
1643
1615
|
program.command("import", { isDefault: true }).description("Launch the Experiences CLI").allowUnknownOption().allowExcessArguments().helpOption(false).argument("[args...]").action(async () => {
|
|
1644
|
-
const
|
|
1645
|
-
if (watch) {
|
|
1646
|
-
process.exit(await runDevWatch(forwarded));
|
|
1647
|
-
}
|
|
1616
|
+
const forwarded = forwardedImportArgs(process.argv.slice(2));
|
|
1648
1617
|
if (forwarded.length > 0) {
|
|
1649
1618
|
process.exit(await runLegacy(["import", ...forwarded]));
|
|
1650
1619
|
}
|
|
@@ -1659,10 +1628,10 @@ function createProgram() {
|
|
|
1659
1628
|
// packages/experience-design-system-cli/src/config/migrate.ts
|
|
1660
1629
|
init_config();
|
|
1661
1630
|
init_package_root();
|
|
1662
|
-
import { existsSync as
|
|
1631
|
+
import { existsSync as existsSync4 } from "node:fs";
|
|
1663
1632
|
import { mkdir as mkdir3, readFile as readFile2, rename as rename2, rmdir, unlink } from "node:fs/promises";
|
|
1664
|
-
import { dirname as dirname3, join as
|
|
1665
|
-
var
|
|
1633
|
+
import { dirname as dirname3, join as join6 } from "node:path";
|
|
1634
|
+
var PACKAGE_NAME3 = "@contentful/experience-design-system-cli";
|
|
1666
1635
|
async function readJson(path) {
|
|
1667
1636
|
try {
|
|
1668
1637
|
return JSON.parse(await readFile2(path, "utf8"));
|
|
@@ -1672,10 +1641,10 @@ async function readJson(path) {
|
|
|
1672
1641
|
}
|
|
1673
1642
|
async function migrateOldConfig() {
|
|
1674
1643
|
try {
|
|
1675
|
-
const oldCredentials =
|
|
1676
|
-
const oldRuns =
|
|
1677
|
-
const oldDebugMode =
|
|
1678
|
-
findPackageRoot(import.meta.url,
|
|
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),
|
|
1679
1648
|
".contentful",
|
|
1680
1649
|
"config",
|
|
1681
1650
|
"debug_mode.json"
|
|
@@ -1685,8 +1654,8 @@ async function migrateOldConfig() {
|
|
|
1685
1654
|
if (debugMode) migrated["debugMode"] = debugMode;
|
|
1686
1655
|
Object.assign(migrated, await readJson(oldCredentials));
|
|
1687
1656
|
if (Object.keys(migrated).length > 0) await updateSettings({ ...migrated, ...await readSettings() });
|
|
1688
|
-
if (
|
|
1689
|
-
if (!
|
|
1657
|
+
if (existsSync4(oldRuns)) {
|
|
1658
|
+
if (!existsSync4(runsFilePath())) {
|
|
1690
1659
|
await mkdir3(dirname3(runsFilePath()), { recursive: true });
|
|
1691
1660
|
await rename2(oldRuns, runsFilePath());
|
|
1692
1661
|
} 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-84191e41.0",
|
|
4
4
|
"description": "Contentful Experiences design system import CLI",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -33,8 +33,7 @@
|
|
|
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"
|
|
37
|
-
"dev": "node scripts/dev.mjs"
|
|
36
|
+
"lint:fix": "nx lint:fix experience-design-system-cli"
|
|
38
37
|
},
|
|
39
38
|
"dependencies": {
|
|
40
39
|
"@contentful/experience-design-system-types": "workspace:*",
|
|
@@ -58,7 +57,6 @@
|
|
|
58
57
|
"@types/node": "^24.0.3",
|
|
59
58
|
"@types/react": "^18.3.24",
|
|
60
59
|
"@types/semver": "^7.7.1",
|
|
61
|
-
"esbuild": "0.28.0",
|
|
62
60
|
"eslint": "^9.39.5",
|
|
63
61
|
"eslint-config-prettier": "^10.1.8",
|
|
64
62
|
"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-84191e41.0",
|
|
4
4
|
"description": "Contentful Experiences design system import CLI",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -33,8 +33,7 @@
|
|
|
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"
|
|
37
|
-
"dev": "node scripts/dev.mjs"
|
|
36
|
+
"lint:fix": "nx lint:fix experience-design-system-cli"
|
|
38
37
|
},
|
|
39
38
|
"dependencies": {
|
|
40
39
|
"@contentful/experience-design-system-types": "workspace:*",
|
|
@@ -58,7 +57,6 @@
|
|
|
58
57
|
"@types/node": "^24.0.3",
|
|
59
58
|
"@types/react": "^18.3.24",
|
|
60
59
|
"@types/semver": "^7.7.1",
|
|
61
|
-
"esbuild": "0.28.0",
|
|
62
60
|
"eslint": "^9.39.5",
|
|
63
61
|
"eslint-config-prettier": "^10.1.8",
|
|
64
62
|
"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-84191e41.0",
|
|
4
4
|
"description": "Contentful Experiences design system import CLI",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -42,14 +42,13 @@
|
|
|
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-84191e41.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",
|
|
53
52
|
"eslint": "^9.39.5",
|
|
54
53
|
"eslint-config-prettier": "^10.1.8",
|
|
55
54
|
"eslint-plugin-prettier": "^5.5.6",
|
|
@@ -74,7 +73,6 @@
|
|
|
74
73
|
"clean": "nx clean experience-design-system-cli",
|
|
75
74
|
"test": "nx test experience-design-system-cli",
|
|
76
75
|
"lint": "nx lint experience-design-system-cli",
|
|
77
|
-
"lint:fix": "nx lint:fix experience-design-system-cli"
|
|
78
|
-
"dev": "node scripts/dev.mjs"
|
|
76
|
+
"lint:fix": "nx lint:fix experience-design-system-cli"
|
|
79
77
|
}
|
|
80
78
|
}
|