@getcoherent/core 0.3.5 → 0.3.7

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.d.ts CHANGED
@@ -3580,6 +3580,8 @@ interface GenerateSharedComponentInput {
3580
3580
  description?: string;
3581
3581
  /** Files that will use this component (e.g. ["app/layout.tsx"]). */
3582
3582
  usedIn?: string[];
3583
+ /** If true, overwrite an existing component with the same name instead of creating a uniquely-named copy. */
3584
+ overwrite?: boolean;
3583
3585
  }
3584
3586
  interface GenerateSharedComponentResult {
3585
3587
  id: string;
package/dist/index.js CHANGED
@@ -5826,6 +5826,7 @@ function ThemeToggle() {
5826
5826
 
5827
5827
  export function Header() {
5828
5828
  const pathname = usePathname()
5829
+ if (pathname?.startsWith('/design-system')) return null
5829
5830
  return (
5830
5831
  <>
5831
5832
  <nav className="sticky top-0 z-50 shrink-0 border-b bg-background/95 backdrop-blur supports-[backdrop-filter]:bg-background/60">
@@ -5860,7 +5861,11 @@ export function Header() {
5860
5861
  const appName = this.escapeString(this.config.name);
5861
5862
  return `'use client'
5862
5863
 
5864
+ import { usePathname } from 'next/navigation'
5865
+
5863
5866
  export function Footer() {
5867
+ const pathname = usePathname()
5868
+ if (pathname?.startsWith('/design-system')) return null
5864
5869
  return (
5865
5870
  <footer className="border-t">
5866
5871
  <div className="mx-auto flex h-14 max-w-7xl items-center justify-between px-4 text-sm text-muted-foreground sm:px-6 lg:px-8">
@@ -6256,6 +6261,15 @@ function getDefaultTemplate(componentName, type, name) {
6256
6261
  }
6257
6262
  async function generateSharedComponent(projectRoot, input) {
6258
6263
  const manifest = await loadManifest(projectRoot);
6264
+ const existing = input.overwrite ? manifest.shared.find((e) => e.name === input.name) : void 0;
6265
+ if (existing) {
6266
+ const fullPath2 = join2(projectRoot, existing.file);
6267
+ const componentName2 = existing.name.replace(/[^a-zA-Z0-9]/g, "") || "Block";
6268
+ const code2 = input.code ?? getDefaultTemplate(componentName2, input.type, existing.name);
6269
+ await mkdir2(dirname2(fullPath2), { recursive: true });
6270
+ await writeFile3(fullPath2, code2, "utf-8");
6271
+ return { id: existing.id, name: existing.name, file: existing.file };
6272
+ }
6259
6273
  const uniqueName = resolveUniqueName(manifest, input.name);
6260
6274
  const fileName = toSharedFileName(uniqueName);
6261
6275
  const filePath = `components/shared/${fileName}.tsx`;
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "publishConfig": {
4
4
  "access": "public"
5
5
  },
6
- "version": "0.3.5",
6
+ "version": "0.3.7",
7
7
  "description": "Core design system engine for Coherent",
8
8
  "type": "module",
9
9
  "main": "./dist/index.js",