@getcoherent/cli 0.5.0 → 0.5.2
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 +48 -47
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -2435,7 +2435,7 @@ import {
|
|
|
2435
2435
|
PageManager as PageManager3,
|
|
2436
2436
|
CLI_VERSION as CLI_VERSION2,
|
|
2437
2437
|
getTemplateForPageType as getTemplateForPageType2,
|
|
2438
|
-
loadManifest as
|
|
2438
|
+
loadManifest as loadManifest7,
|
|
2439
2439
|
saveManifest as saveManifest2
|
|
2440
2440
|
} from "@getcoherent/core";
|
|
2441
2441
|
|
|
@@ -5890,7 +5890,7 @@ import { dirname as dirname6 } from "path";
|
|
|
5890
5890
|
import chalk11 from "chalk";
|
|
5891
5891
|
import {
|
|
5892
5892
|
getTemplateForPageType,
|
|
5893
|
-
loadManifest as
|
|
5893
|
+
loadManifest as loadManifest5,
|
|
5894
5894
|
saveManifest,
|
|
5895
5895
|
updateUsedIn,
|
|
5896
5896
|
findSharedComponentByIdOrName,
|
|
@@ -6677,14 +6677,14 @@ function formatIssues(issues) {
|
|
|
6677
6677
|
// src/commands/chat/code-generator.ts
|
|
6678
6678
|
import { resolve as resolve6 } from "path";
|
|
6679
6679
|
import { existsSync as existsSync14 } from "fs";
|
|
6680
|
-
import { mkdir as mkdir2 } from "fs/promises";
|
|
6680
|
+
import { mkdir as mkdir2, readFile as readFile5 } from "fs/promises";
|
|
6681
6681
|
import { dirname as dirname5 } from "path";
|
|
6682
6682
|
import {
|
|
6683
6683
|
ComponentGenerator as ComponentGenerator2,
|
|
6684
6684
|
PageGenerator,
|
|
6685
6685
|
TailwindConfigGenerator
|
|
6686
6686
|
} from "@getcoherent/core";
|
|
6687
|
-
import { integrateSharedLayoutIntoRootLayout as integrateSharedLayoutIntoRootLayout2,
|
|
6687
|
+
import { integrateSharedLayoutIntoRootLayout as integrateSharedLayoutIntoRootLayout2, generateSharedComponent as generateSharedComponent2 } from "@getcoherent/core";
|
|
6688
6688
|
import chalk9 from "chalk";
|
|
6689
6689
|
async function validateAndFixGeneratedCode(projectRoot, code, options = {}) {
|
|
6690
6690
|
const fixes = [];
|
|
@@ -6755,13 +6755,6 @@ async function regenerateLayout(config2, projectRoot) {
|
|
|
6755
6755
|
const layout = config2.pages[0]?.layout || "centered";
|
|
6756
6756
|
const appType = config2.settings.appType || "multi-page";
|
|
6757
6757
|
const generator = new PageGenerator(config2);
|
|
6758
|
-
let manifest = null;
|
|
6759
|
-
try {
|
|
6760
|
-
manifest = await loadManifest5(projectRoot);
|
|
6761
|
-
} catch {
|
|
6762
|
-
}
|
|
6763
|
-
const hasSharedHeader = manifest?.shared.some((c) => c.type === "layout" && /header|nav/i.test(c.name)) ?? false;
|
|
6764
|
-
const hasSharedFooter = manifest?.shared.some((c) => c.type === "layout" && /footer/i.test(c.name)) ?? false;
|
|
6765
6758
|
const code = await generator.generateLayout(layout, appType, { skipNav: true });
|
|
6766
6759
|
const layoutPath = resolve6(projectRoot, "app", "layout.tsx");
|
|
6767
6760
|
await writeFile(layoutPath, code);
|
|
@@ -6778,7 +6771,15 @@ async function regenerateLayout(config2, projectRoot) {
|
|
|
6778
6771
|
overwrite: true
|
|
6779
6772
|
});
|
|
6780
6773
|
}
|
|
6781
|
-
|
|
6774
|
+
let shouldOverwriteFooter = false;
|
|
6775
|
+
try {
|
|
6776
|
+
const footerPath = resolve6(projectRoot, "components", "shared", "footer.tsx");
|
|
6777
|
+
const existing = await readFile5(footerPath, "utf-8");
|
|
6778
|
+
shouldOverwriteFooter = existing.includes("Coherent Design Method");
|
|
6779
|
+
} catch {
|
|
6780
|
+
shouldOverwriteFooter = true;
|
|
6781
|
+
}
|
|
6782
|
+
if (shouldOverwriteFooter) {
|
|
6782
6783
|
const footerCode = generator.generateSharedFooterCode();
|
|
6783
6784
|
await generateSharedComponent2(projectRoot, {
|
|
6784
6785
|
name: "Footer",
|
|
@@ -7338,7 +7339,7 @@ async function applyModification(request, dsm, cm, pm, projectRoot, aiProvider,
|
|
|
7338
7339
|
fixes.forEach((f) => console.log(chalk11.dim(` ${f}`)));
|
|
7339
7340
|
}
|
|
7340
7341
|
await writeFile(pageFilePath, fixedCode);
|
|
7341
|
-
const manifest = await
|
|
7342
|
+
const manifest = await loadManifest5(projectRoot);
|
|
7342
7343
|
const usedIn = manifest.shared.find((e) => e.id === resolved.id)?.usedIn ?? [];
|
|
7343
7344
|
const routePath = route.replace(/^\//, "");
|
|
7344
7345
|
const filePathRel = routePath ? `app/${routePath}/page.tsx` : "app/page.tsx";
|
|
@@ -7443,7 +7444,7 @@ async function applyModification(request, dsm, cm, pm, projectRoot, aiProvider,
|
|
|
7443
7444
|
await writeFile(fullPath, fixedCode);
|
|
7444
7445
|
usedInFiles.push(relPath);
|
|
7445
7446
|
}
|
|
7446
|
-
const manifest = await
|
|
7447
|
+
const manifest = await loadManifest5(projectRoot);
|
|
7447
7448
|
const nextManifest = updateUsedIn(manifest, created.id, usedInFiles);
|
|
7448
7449
|
await saveManifest(projectRoot, nextManifest);
|
|
7449
7450
|
printPromoteAndLinkReport({
|
|
@@ -7627,7 +7628,7 @@ async function applyModification(request, dsm, cm, pm, projectRoot, aiProvider,
|
|
|
7627
7628
|
cm.updateConfig(cfg);
|
|
7628
7629
|
pm.updateConfig(cfg);
|
|
7629
7630
|
}
|
|
7630
|
-
const manifestForAudit = await
|
|
7631
|
+
const manifestForAudit = await loadManifest5(projectRoot);
|
|
7631
7632
|
await warnInlineDuplicates(projectRoot, page.name || page.id || route.slice(1), codeToWrite, manifestForAudit);
|
|
7632
7633
|
const relFilePath = routeToRelPath(route, isAuth);
|
|
7633
7634
|
printPostGenerationReport({
|
|
@@ -7806,7 +7807,7 @@ ${pagesCtx}`
|
|
|
7806
7807
|
cm.updateConfig(cfg);
|
|
7807
7808
|
pm.updateConfig(cfg);
|
|
7808
7809
|
}
|
|
7809
|
-
const manifestForAudit = await
|
|
7810
|
+
const manifestForAudit = await loadManifest5(projectRoot);
|
|
7810
7811
|
await warnInlineDuplicates(
|
|
7811
7812
|
projectRoot,
|
|
7812
7813
|
pageDef.name || pageDef.id || route.slice(1),
|
|
@@ -7843,7 +7844,7 @@ ${pagesCtx}`
|
|
|
7843
7844
|
fixes.forEach((f) => console.log(chalk11.dim(` ${f}`)));
|
|
7844
7845
|
}
|
|
7845
7846
|
const relFilePath = routeToRelPath(route, isAuth);
|
|
7846
|
-
const manifest = await
|
|
7847
|
+
const manifest = await loadManifest5(projectRoot);
|
|
7847
7848
|
printPostGenerationReport({
|
|
7848
7849
|
action: "updated",
|
|
7849
7850
|
pageTitle: pageDef.name || pageDef.id || "Page",
|
|
@@ -7892,7 +7893,7 @@ ${pagesCtx}`
|
|
|
7892
7893
|
import chalk12 from "chalk";
|
|
7893
7894
|
import { resolve as resolve8 } from "path";
|
|
7894
7895
|
import { existsSync as existsSync15, readFileSync as readFileSync9, writeFileSync as writeFileSync8, mkdirSync as mkdirSync5 } from "fs";
|
|
7895
|
-
import { DesignSystemManager as DesignSystemManager6, ComponentManager as ComponentManager3, loadManifest as
|
|
7896
|
+
import { DesignSystemManager as DesignSystemManager6, ComponentManager as ComponentManager3, loadManifest as loadManifest6 } from "@getcoherent/core";
|
|
7896
7897
|
var DEBUG3 = process.env.COHERENT_DEBUG === "1";
|
|
7897
7898
|
async function interactiveChat(options, chatCommandFn) {
|
|
7898
7899
|
const { createInterface } = await import("readline");
|
|
@@ -7962,7 +7963,7 @@ async function interactiveChat(options, chatCommandFn) {
|
|
|
7962
7963
|
return;
|
|
7963
7964
|
}
|
|
7964
7965
|
if (lower === "components" || lower === "list components" || lower.includes("what components")) {
|
|
7965
|
-
const manifest = await
|
|
7966
|
+
const manifest = await loadManifest6(projectRoot);
|
|
7966
7967
|
if (manifest.shared.length === 0) {
|
|
7967
7968
|
console.log(chalk12.gray("\n No shared components yet.\n"));
|
|
7968
7969
|
} else {
|
|
@@ -7996,7 +7997,7 @@ async function interactiveChat(options, chatCommandFn) {
|
|
|
7996
7997
|
}
|
|
7997
7998
|
if (lower === "status") {
|
|
7998
7999
|
const currentConfig = dsm.getConfig();
|
|
7999
|
-
const manifest = await
|
|
8000
|
+
const manifest = await loadManifest6(projectRoot);
|
|
8000
8001
|
console.log(chalk12.bold(`
|
|
8001
8002
|
${currentConfig.name || "Coherent Project"}`));
|
|
8002
8003
|
console.log(
|
|
@@ -8178,7 +8179,7 @@ async function chatCommand(message, options) {
|
|
|
8178
8179
|
}
|
|
8179
8180
|
}
|
|
8180
8181
|
spinner.start("Parsing your request...");
|
|
8181
|
-
let manifest = await
|
|
8182
|
+
let manifest = await loadManifest7(project.root);
|
|
8182
8183
|
const validShared = manifest.shared.filter((s) => {
|
|
8183
8184
|
const fp = resolve9(project.root, s.file);
|
|
8184
8185
|
return existsSync16(fp);
|
|
@@ -8749,7 +8750,7 @@ import { DesignSystemManager as DesignSystemManager8, ComponentGenerator as Comp
|
|
|
8749
8750
|
// src/utils/file-watcher.ts
|
|
8750
8751
|
import { readFileSync as readFileSync12, writeFileSync as writeFileSync9, existsSync as existsSync18 } from "fs";
|
|
8751
8752
|
import { relative as relative3, join as join10 } from "path";
|
|
8752
|
-
import { loadManifest as
|
|
8753
|
+
import { loadManifest as loadManifest8, saveManifest as saveManifest3 } from "@getcoherent/core";
|
|
8753
8754
|
|
|
8754
8755
|
// src/utils/component-integrity.ts
|
|
8755
8756
|
import { existsSync as existsSync17, readFileSync as readFileSync11, readdirSync as readdirSync2 } from "fs";
|
|
@@ -9103,7 +9104,7 @@ async function handleFileChange(projectRoot, filePath) {
|
|
|
9103
9104
|
if (config2.warnSharedReuse) {
|
|
9104
9105
|
let manifest;
|
|
9105
9106
|
try {
|
|
9106
|
-
manifest = await
|
|
9107
|
+
manifest = await loadManifest8(projectRoot);
|
|
9107
9108
|
} catch {
|
|
9108
9109
|
manifest = { shared: [], nextId: 1 };
|
|
9109
9110
|
}
|
|
@@ -9122,7 +9123,7 @@ async function handleFileDelete(projectRoot, filePath) {
|
|
|
9122
9123
|
if (!relativePath.startsWith("components/") || relativePath.startsWith("components/ui/")) return;
|
|
9123
9124
|
try {
|
|
9124
9125
|
const chalk32 = (await import("chalk")).default;
|
|
9125
|
-
const manifest = await
|
|
9126
|
+
const manifest = await loadManifest8(projectRoot);
|
|
9126
9127
|
const orphaned = manifest.shared.find((s) => s.file === relativePath);
|
|
9127
9128
|
if (orphaned) {
|
|
9128
9129
|
const cleaned = {
|
|
@@ -9143,7 +9144,7 @@ async function detectNewComponent(projectRoot, filePath) {
|
|
|
9143
9144
|
if (!relativePath.endsWith(".tsx") && !relativePath.endsWith(".jsx")) return;
|
|
9144
9145
|
try {
|
|
9145
9146
|
const chalk32 = (await import("chalk")).default;
|
|
9146
|
-
const manifest = await
|
|
9147
|
+
const manifest = await loadManifest8(projectRoot);
|
|
9147
9148
|
const alreadyRegistered = manifest.shared.some((s) => s.file === relativePath);
|
|
9148
9149
|
if (alreadyRegistered) return;
|
|
9149
9150
|
const code = readFileSync12(filePath, "utf-8");
|
|
@@ -9615,7 +9616,7 @@ import ora4 from "ora";
|
|
|
9615
9616
|
import { spawn as spawn2 } from "child_process";
|
|
9616
9617
|
import { existsSync as existsSync20, rmSync as rmSync4, readdirSync as readdirSync3 } from "fs";
|
|
9617
9618
|
import { resolve as resolve11, join as join12, dirname as dirname7 } from "path";
|
|
9618
|
-
import { readdir as readdir3, readFile as
|
|
9619
|
+
import { readdir as readdir3, readFile as readFile6, writeFile as writeFile4, mkdir as mkdir4, copyFile as copyFile2 } from "fs/promises";
|
|
9619
9620
|
var COPY_EXCLUDE = /* @__PURE__ */ new Set([
|
|
9620
9621
|
"node_modules",
|
|
9621
9622
|
".next",
|
|
@@ -9659,7 +9660,7 @@ async function patchNextConfigForExport(outRoot) {
|
|
|
9659
9660
|
for (const name of ["next.config.ts", "next.config.mjs", "next.config.js"]) {
|
|
9660
9661
|
const p = join12(outRoot, name);
|
|
9661
9662
|
if (!existsSync20(p)) continue;
|
|
9662
|
-
let content = await
|
|
9663
|
+
let content = await readFile6(p, "utf-8");
|
|
9663
9664
|
if (content.includes("ignoreDuringBuilds")) return;
|
|
9664
9665
|
content = content.replace(
|
|
9665
9666
|
/(const\s+nextConfig\s*(?::\s*\w+)?\s*=\s*\{)/,
|
|
@@ -9702,7 +9703,7 @@ async function ensureReadmeDeploySection(outRoot) {
|
|
|
9702
9703
|
const readmePath = join12(outRoot, "README.md");
|
|
9703
9704
|
if (!existsSync20(readmePath)) return;
|
|
9704
9705
|
try {
|
|
9705
|
-
let content = await
|
|
9706
|
+
let content = await readFile6(readmePath, "utf-8");
|
|
9706
9707
|
if (/##\s+Deploy\b/m.test(content)) return;
|
|
9707
9708
|
content = content.trimEnd() + DEPLOY_SECTION + "\n";
|
|
9708
9709
|
await writeFile4(readmePath, content);
|
|
@@ -9755,7 +9756,7 @@ async function collectImportedPackages2(dir, extensions) {
|
|
|
9755
9756
|
if (!e.isFile()) continue;
|
|
9756
9757
|
const ext = e.name.replace(/^.*\./, "");
|
|
9757
9758
|
if (!extensions.has(ext)) continue;
|
|
9758
|
-
const content = await
|
|
9759
|
+
const content = await readFile6(full, "utf-8").catch(() => "");
|
|
9759
9760
|
let m;
|
|
9760
9761
|
IMPORT_FROM_REGEX2.lastIndex = 0;
|
|
9761
9762
|
while ((m = IMPORT_FROM_REGEX2.exec(content)) !== null) {
|
|
@@ -9774,7 +9775,7 @@ async function findMissingDepsInExport(outRoot) {
|
|
|
9774
9775
|
if (!existsSync20(pkgPath)) return [];
|
|
9775
9776
|
let pkg;
|
|
9776
9777
|
try {
|
|
9777
|
-
pkg = JSON.parse(await
|
|
9778
|
+
pkg = JSON.parse(await readFile6(pkgPath, "utf-8"));
|
|
9778
9779
|
} catch {
|
|
9779
9780
|
return [];
|
|
9780
9781
|
}
|
|
@@ -9804,14 +9805,14 @@ async function stripCoherentArtifacts(outputDir) {
|
|
|
9804
9805
|
}
|
|
9805
9806
|
const layoutPath = join12(outputDir, "app", "layout.tsx");
|
|
9806
9807
|
if (existsSync20(layoutPath)) {
|
|
9807
|
-
let layout = await
|
|
9808
|
+
let layout = await readFile6(layoutPath, "utf-8");
|
|
9808
9809
|
layout = layout.replace(/import\s*\{?\s*AppNav\s*\}?\s*from\s*['"][^'"]+['"]\s*\n?/g, "");
|
|
9809
9810
|
layout = layout.replace(/\s*<AppNav\s*\/?\s*>\s*/g, "\n");
|
|
9810
9811
|
await writeFile4(layoutPath, layout, "utf-8");
|
|
9811
9812
|
}
|
|
9812
9813
|
const sharedHeaderPath = join12(outputDir, "components", "shared", "header.tsx");
|
|
9813
9814
|
if (existsSync20(sharedHeaderPath)) {
|
|
9814
|
-
let header = await
|
|
9815
|
+
let header = await readFile6(sharedHeaderPath, "utf-8");
|
|
9815
9816
|
header = header.replace(/<Link\s[^>]*href="\/design-system"[^>]*>[\s\S]*?<\/Link>/g, "");
|
|
9816
9817
|
header = header.replace(/\n\s*<>\s*\n/, "\n");
|
|
9817
9818
|
header = header.replace(/\n\s*<\/>\s*\n/, "\n");
|
|
@@ -9819,7 +9820,7 @@ async function stripCoherentArtifacts(outputDir) {
|
|
|
9819
9820
|
}
|
|
9820
9821
|
const guardPath = join12(outputDir, "app", "ShowWhenNotAuthRoute.tsx");
|
|
9821
9822
|
if (existsSync20(guardPath)) {
|
|
9822
|
-
let guard = await
|
|
9823
|
+
let guard = await readFile6(guardPath, "utf-8");
|
|
9823
9824
|
guard = guard.replace(/['"],?\s*'\/design-system['"],?\s*/g, "");
|
|
9824
9825
|
const pathsMatch = guard.match(/HIDDEN_PATHS\s*=\s*\[([^\]]*)\]/);
|
|
9825
9826
|
const remaining = pathsMatch ? pathsMatch[1].replace(/['"]/g, "").split(",").map((s) => s.trim()).filter(Boolean) : [];
|
|
@@ -9827,7 +9828,7 @@ async function stripCoherentArtifacts(outputDir) {
|
|
|
9827
9828
|
rmSync4(guardPath, { force: true });
|
|
9828
9829
|
removed.push("app/ShowWhenNotAuthRoute.tsx");
|
|
9829
9830
|
if (existsSync20(layoutPath)) {
|
|
9830
|
-
let layout = await
|
|
9831
|
+
let layout = await readFile6(layoutPath, "utf-8");
|
|
9831
9832
|
layout = layout.replace(/import\s+\w+\s+from\s*['"]\.\/ShowWhenNotAuthRoute['"]\s*\n?/g, "");
|
|
9832
9833
|
layout = layout.replace(/\s*<ShowWhenNotAuthRoute>\s*\n?/g, "\n");
|
|
9833
9834
|
layout = layout.replace(/\s*<\/ShowWhenNotAuthRoute>\s*\n?/g, "\n");
|
|
@@ -10060,7 +10061,7 @@ import {
|
|
|
10060
10061
|
ComponentManager as ComponentManager5,
|
|
10061
10062
|
PageManager as PageManager4,
|
|
10062
10063
|
ComponentGenerator as ComponentGenerator4,
|
|
10063
|
-
loadManifest as
|
|
10064
|
+
loadManifest as loadManifest9,
|
|
10064
10065
|
saveManifest as saveManifest4
|
|
10065
10066
|
} from "@getcoherent/core";
|
|
10066
10067
|
function extractComponentIdsFromCode2(code) {
|
|
@@ -10267,7 +10268,7 @@ async function fixCommand(opts = {}) {
|
|
|
10267
10268
|
fileIssues.push({ path: relativePath, report });
|
|
10268
10269
|
}
|
|
10269
10270
|
try {
|
|
10270
|
-
let manifest = await
|
|
10271
|
+
let manifest = await loadManifest9(project.root);
|
|
10271
10272
|
let manifestModified = false;
|
|
10272
10273
|
const { manifest: cleaned, removed: orphaned } = removeOrphanedEntries(project.root, manifest);
|
|
10273
10274
|
if (orphaned.length > 0) {
|
|
@@ -10367,7 +10368,7 @@ async function fixCommand(opts = {}) {
|
|
|
10367
10368
|
import chalk19 from "chalk";
|
|
10368
10369
|
import { resolve as resolve13 } from "path";
|
|
10369
10370
|
import { readdirSync as readdirSync5, readFileSync as readFileSync15, statSync as statSync2, existsSync as existsSync22 } from "fs";
|
|
10370
|
-
import { loadManifest as
|
|
10371
|
+
import { loadManifest as loadManifest10 } from "@getcoherent/core";
|
|
10371
10372
|
var EXCLUDED_DIRS = /* @__PURE__ */ new Set(["node_modules", "design-system"]);
|
|
10372
10373
|
function findTsxFiles(dir) {
|
|
10373
10374
|
const results = [];
|
|
@@ -10494,7 +10495,7 @@ async function checkCommand(opts = {}) {
|
|
|
10494
10495
|
\u{1F517} Internal Links`) + chalk19.dim(` \u2014 all ${result.links.total} links resolve \u2713`));
|
|
10495
10496
|
}
|
|
10496
10497
|
try {
|
|
10497
|
-
const manifest = await
|
|
10498
|
+
const manifest = await loadManifest10(project.root);
|
|
10498
10499
|
if (manifest.shared.length > 0) {
|
|
10499
10500
|
for (const entry of manifest.shared) {
|
|
10500
10501
|
const fullPath = resolve13(project.root, entry.file);
|
|
@@ -10510,7 +10511,7 @@ async function checkCommand(opts = {}) {
|
|
|
10510
10511
|
}
|
|
10511
10512
|
if (!skipShared) {
|
|
10512
10513
|
try {
|
|
10513
|
-
const manifest = await
|
|
10514
|
+
const manifest = await loadManifest10(projectRoot);
|
|
10514
10515
|
if (!opts.json && manifest.shared.length > 0) {
|
|
10515
10516
|
console.log(chalk19.cyan(`
|
|
10516
10517
|
\u{1F9E9} Shared Components`) + chalk19.dim(` (${manifest.shared.length} registered)
|
|
@@ -10692,7 +10693,7 @@ import chalk25 from "chalk";
|
|
|
10692
10693
|
import {
|
|
10693
10694
|
DesignSystemManager as DesignSystemManager12,
|
|
10694
10695
|
ComponentManager as ComponentManager6,
|
|
10695
|
-
loadManifest as
|
|
10696
|
+
loadManifest as loadManifest11,
|
|
10696
10697
|
generateSharedComponent as generateSharedComponent4,
|
|
10697
10698
|
integrateSharedLayoutIntoRootLayout as integrateSharedLayoutIntoRootLayout3
|
|
10698
10699
|
} from "@getcoherent/core";
|
|
@@ -10733,7 +10734,7 @@ function createComponentsCommand() {
|
|
|
10733
10734
|
await dsm.load();
|
|
10734
10735
|
const config2 = dsm.getConfig();
|
|
10735
10736
|
const cm = new ComponentManager6(config2);
|
|
10736
|
-
const manifest = await
|
|
10737
|
+
const manifest = await loadManifest11(project.root);
|
|
10737
10738
|
if (opts.json) {
|
|
10738
10739
|
const installed2 = cm.getAllComponents();
|
|
10739
10740
|
console.log(JSON.stringify({ shared: manifest.shared, ui: installed2 }, null, 2));
|
|
@@ -10785,7 +10786,7 @@ function createComponentsCommand() {
|
|
|
10785
10786
|
sharedCmd.option("--json", "Machine-readable JSON output").option("--verbose", "Show file paths and usage details").action(async (opts) => {
|
|
10786
10787
|
const project = findConfig();
|
|
10787
10788
|
if (!project) exitNotCoherent();
|
|
10788
|
-
const manifest = await
|
|
10789
|
+
const manifest = await loadManifest11(project.root);
|
|
10789
10790
|
if (opts.json) {
|
|
10790
10791
|
console.log(JSON.stringify(manifest, null, 2));
|
|
10791
10792
|
return;
|
|
@@ -11487,9 +11488,9 @@ import chalk30 from "chalk";
|
|
|
11487
11488
|
import ora9 from "ora";
|
|
11488
11489
|
import { existsSync as existsSync26, readFileSync as readFileSync17 } from "fs";
|
|
11489
11490
|
import { join as join17, relative as relative4, dirname as dirname10 } from "path";
|
|
11490
|
-
import { readdir as readdir4, readFile as
|
|
11491
|
+
import { readdir as readdir4, readFile as readFile7 } from "fs/promises";
|
|
11491
11492
|
import { DesignSystemManager as DesignSystemManager16 } from "@getcoherent/core";
|
|
11492
|
-
import { loadManifest as
|
|
11493
|
+
import { loadManifest as loadManifest12, saveManifest as saveManifest5, findSharedComponent } from "@getcoherent/core";
|
|
11493
11494
|
function extractTokensFromProject(projectRoot) {
|
|
11494
11495
|
const lightColors = {};
|
|
11495
11496
|
const darkColors = {};
|
|
@@ -11551,7 +11552,7 @@ async function detectCustomComponents(projectRoot, allPageCode) {
|
|
|
11551
11552
|
await walkForTsx(componentsDir, files, ["ui"]);
|
|
11552
11553
|
const fileResults = await Promise.all(
|
|
11553
11554
|
files.map(async (filePath) => {
|
|
11554
|
-
const code = await
|
|
11555
|
+
const code = await readFile7(filePath, "utf-8");
|
|
11555
11556
|
const relFile = relative4(projectRoot, filePath);
|
|
11556
11557
|
const exportedNames = extractExportedComponentNames2(code);
|
|
11557
11558
|
return exportedNames.map((name) => ({
|
|
@@ -11653,7 +11654,7 @@ async function discoverPages(appDir) {
|
|
|
11653
11654
|
if (entry.name.startsWith(".")) continue;
|
|
11654
11655
|
await walk(full);
|
|
11655
11656
|
} else if (entry.name === "page.tsx" || entry.name === "page.jsx") {
|
|
11656
|
-
const code = await
|
|
11657
|
+
const code = await readFile7(full, "utf-8");
|
|
11657
11658
|
const routeDir = dirname10(relative4(appDir, full));
|
|
11658
11659
|
let route = routeDir === "." ? "/" : "/" + routeDir;
|
|
11659
11660
|
route = route.replace(/\/\([^)]+\)/g, "");
|
|
@@ -11769,7 +11770,7 @@ async function syncCommand(options = {}) {
|
|
|
11769
11770
|
let reconcileResult = null;
|
|
11770
11771
|
if (doComponents) {
|
|
11771
11772
|
spinner.start("Reconciling shared components...");
|
|
11772
|
-
const manifest = await
|
|
11773
|
+
const manifest = await loadManifest12(project.root);
|
|
11773
11774
|
const { manifest: reconciledManifest, result: rr } = reconcileComponents(project.root, manifest);
|
|
11774
11775
|
reconcileResult = rr;
|
|
11775
11776
|
if (!dryRun) {
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"publishConfig": {
|
|
4
4
|
"access": "public"
|
|
5
5
|
},
|
|
6
|
-
"version": "0.5.
|
|
6
|
+
"version": "0.5.2",
|
|
7
7
|
"description": "CLI interface for Coherent Design Method",
|
|
8
8
|
"type": "module",
|
|
9
9
|
"main": "./dist/index.js",
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
"ora": "^7.0.1",
|
|
44
44
|
"prompts": "^2.4.2",
|
|
45
45
|
"zod": "^3.22.4",
|
|
46
|
-
"@getcoherent/core": "0.5.
|
|
46
|
+
"@getcoherent/core": "0.5.2"
|
|
47
47
|
},
|
|
48
48
|
"devDependencies": {
|
|
49
49
|
"@types/node": "^20.11.0",
|