create-nersh 0.3.0 → 0.4.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/README.md CHANGED
@@ -34,7 +34,7 @@ The default scaffold is the catalogue marketing page: header, hero, features, pr
34
34
  | `--skin <id>` | the site's own `skinId`, else `zinc` | Overwrites `site.json`'s `skinId` and picks the `@nertia/theme-<id>` item |
35
35
  | `--site <path>` | the bundled catalogue default | Scaffolds from your own `site.json` or a `.nertia.json` export |
36
36
  | `--registry <url template>` | `https://ner.sh/r/{name}.json` | Where `@nertia` items are fetched from. Point it at a local server to test |
37
- | `--render-package <spec>` | `^0.3.0` | Any npm spec, including a tarball path, for the `@nersh/render` dependency |
37
+ | `--render-package <spec>` | `^0.4.0` | Any npm spec, including a tarball path, for the `@nersh/render` dependency |
38
38
  | `--no-install` | off | Skips `npm install` and the shadcn add. Prints the command to run yourself |
39
39
 
40
40
  Valid skins: `zinc`, `slate`, `stone`, `gray`, `neutral`, `mauve`, `olive`, `mist`, `taupe`, `blue`, `green`, `orange`, `red`, `rose`, `violet`, `amber`, `yellow`, `lime`, `emerald`, `teal`, `cyan`, `sky`, `indigo`, `purple`, `fuchsia`, `pink`.
@@ -82,6 +82,16 @@ Not yet portable (these sections stay hosted-only until the cutover): footer, na
82
82
 
83
83
  Those sections are skipped, not fatal. They stay out of `src/registry.ts` and keep rendering on nertia.ai until they are ported.
84
84
 
85
+ ### Code Embed
86
+
87
+ A site's Code Embed blocks run in the scaffolded project, each in a sealed frame: a sandboxed iframe with no access to the page or its cookies, whose own policy blocks requests (WebRTC aside, as "What it still can" in the [Code Embed guide](https://nertia.ai/docs/guides/code-embed) says). They run because `app/page.tsx` passes `codeEmbed="run"` to `SiteRenderer`. Remove that prop to turn them off; each block then shows its reserved box and fallback picture.
88
+
89
+ The project also sends a `Content-Security-Policy: frame-src` header, set in `next.config.ts`, and writes the same rule as a `<meta http-equiv="Content-Security-Policy">` tag in `app/layout.tsx`, because static hosts and `output: "export"` ignore the header. The rule lets embeds from the listed hosts load, and a sealed frame, which can send itself to another address, can then go only to those hosts. Without this rule, a frame's code can send the frame to any site. That site's page then shows in the block's box, has the network, and can stay there. Whatever a frame loads, it still cannot read your page, its cookies or its storage, and cannot navigate the top window, open popups or submit forms. If you embed from other hosts, add them to both lists.
90
+
91
+ A sealed frame inherits the page's policy, so if you add a page-level `script-src` without `'unsafe-inline'`, or one that moves to nonces, Code Embed frames stop: their code never runs.
92
+
93
+ This is the site author's own code. nertia's off switches do not reach an exported project: what runs here is up to you.
94
+
85
95
  ### Dark mode
86
96
 
87
97
  `@nertia/theme-<skin>` writes its dark values under a `.dark` class, the shadcn convention. Hosted nertia.ai pages switch on `prefers-color-scheme` instead, so a scaffolded project renders light only until something adds `class="dark"` to `<html>` (by hand, or with a library like `next-themes`).
@@ -94,15 +104,15 @@ Those sections are skipped, not fatal. They stay out of `src/registry.ts` and ke
94
104
  my-site/
95
105
  ├── app/
96
106
  │ ├── globals.css # Tailwind v4 entry, tw-animate-css, @source for @nersh/render
97
- │ ├── layout.tsx
98
- │ └── page.tsx # <SiteRenderer site={site} registry={registry} />
107
+ │ ├── layout.tsx # The same frame-src rule as a meta tag, for static hosts
108
+ │ └── page.tsx # <SiteRenderer site={site} registry={registry} codeEmbed="run" />
99
109
  ├── src/
100
110
  │ ├── registry.ts # Generated: section id to component
101
111
  │ └── sections/ # Installed from @nertia. You own these files
102
112
  ├── components.json # shadcn config with the @nertia registry
103
113
  ├── site.json # Layout, skin, and copy for your site
104
114
  ├── package.json # Your name, @nersh/render, the shadcn CLI
105
- ├── next.config.ts
115
+ ├── next.config.ts # The frame-src header for embeds and Code Embed
106
116
  ├── postcss.config.mjs # @tailwindcss/postcss, the Tailwind v4 pipeline
107
117
  └── tsconfig.json # @/* maps to ./src/*, which is where registry files land
108
118
  ```
package/dist/index.mjs CHANGED
@@ -120,7 +120,7 @@ var VALID_SKINS = [
120
120
  "pink"
121
121
  ];
122
122
  var DEFAULT_REGISTRY = "https://ner.sh/r/{name}.json";
123
- var DEFAULT_RENDER_PACKAGE = "^0.3.0";
123
+ var DEFAULT_RENDER_PACKAGE = "^0.4.0";
124
124
  var USAGE = "Usage: create-nersh <project-name> [--skin <id>] [--site <path>] [--registry <url template>] [--render-package <spec>] [--no-install]";
125
125
  function die(msg) {
126
126
  console.error(msg);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-nersh",
3
- "version": "0.3.0",
3
+ "version": "0.4.0",
4
4
  "description": "Scaffold a shadcn project that pulls its sections from the @nertia registry",
5
5
  "license": "MIT",
6
6
  "author": "nersh <ps2pdx@gmail.com>",
@@ -483,11 +483,13 @@
483
483
  "header-band-d1.gradient": "",
484
484
  "header-row-d1.align": "",
485
485
  "header-row-d1.phone": "row",
486
+ "header-row-d1.dividers": "",
486
487
  "header-brand-col-d1.pad": "",
487
488
  "header-brand-col-d1.sticky": "",
488
489
  "header-brand-d1.wordmark": "Your Company",
489
490
  "header-brand-d1.wordmarkAccent": "",
490
491
  "header-brand-d1.logoImage": "",
492
+ "header-brand-d1.lockup": "",
491
493
  "header-brand-d1.tagline": "",
492
494
  "header-brand-d1.href": "#",
493
495
  "header-nav-col-d1.pad": "",
@@ -518,8 +520,10 @@
518
520
  "hero-d2.gradient": "",
519
521
  "hero-body-d2.align": "",
520
522
  "hero-body-d2.phone": "",
523
+ "hero-body-d2.dividers": "",
521
524
  "hero-heading-d2.text": "A headline that says what you do",
522
525
  "hero-heading-d2.level": "h1",
526
+ "hero-heading-d2.size": "",
523
527
  "hero-sub-d2.text": "One sentence on who this is for and why it matters.",
524
528
  "hero-sub-d2.textStyle": "",
525
529
  "hero-cta-d2.label": "Get started",
@@ -549,12 +553,15 @@
549
553
  "features-d3.gradient": "",
550
554
  "features-intro-d3.align": "center",
551
555
  "features-intro-d3.phone": "",
556
+ "features-intro-d3.dividers": "",
552
557
  "features-heading-d3.text": "Features",
553
558
  "features-heading-d3.level": "",
559
+ "features-heading-d3.size": "",
554
560
  "features-sub-d3.text": "One sentence that introduces this section.",
555
561
  "features-sub-d3.textStyle": "",
556
562
  "features-grid-d3.align": "",
557
563
  "features-grid-d3.phone": "",
564
+ "features-grid-d3.dividers": "",
558
565
  "feature-1-d3.title": "Feature one",
559
566
  "feature-1-d3.body": "A sentence about this feature.",
560
567
  "feature-1-d3.href": "",
@@ -595,12 +602,15 @@
595
602
  "pricing-band-d4.gradient": "",
596
603
  "pricing-intro-d4.align": "center",
597
604
  "pricing-intro-d4.phone": "",
605
+ "pricing-intro-d4.dividers": "",
598
606
  "pricing-heading-d4.text": "Pricing",
599
607
  "pricing-heading-d4.level": "h2",
608
+ "pricing-heading-d4.size": "",
600
609
  "pricing-sub-d4.text": "One sentence that introduces this section.",
601
610
  "pricing-sub-d4.textStyle": "",
602
611
  "pricing-row-d4.align": "",
603
612
  "pricing-row-d4.phone": "",
613
+ "pricing-row-d4.dividers": "",
604
614
  "tier-1-col-d4.pad": "",
605
615
  "tier-1-col-d4.sticky": "",
606
616
  "tier-1-card-d4.title": "",
@@ -640,6 +650,7 @@
640
650
  "tier-2-badge-d4.text": "Most popular",
641
651
  "tier-2-badge-d4.href": "",
642
652
  "tier-2-badge-d4.style": "",
653
+ "tier-2-badge-d4.tone": "",
643
654
  "tier-2-badge-d4.placement": "edge",
644
655
  "tier-2-name-d4.text": "Standard",
645
656
  "tier-2-name-d4.textStyle": "eyebrow",
@@ -705,12 +716,15 @@
705
716
  "testimonials-band-d5.gradient": "",
706
717
  "testimonials-intro-d5.align": "center",
707
718
  "testimonials-intro-d5.phone": "",
719
+ "testimonials-intro-d5.dividers": "",
708
720
  "testimonials-heading-d5.text": "What customers say",
709
721
  "testimonials-heading-d5.level": "h2",
722
+ "testimonials-heading-d5.size": "",
710
723
  "testimonials-sub-d5.text": "One sentence that introduces this section.",
711
724
  "testimonials-sub-d5.textStyle": "",
712
725
  "testimonials-grid-d5.align": "",
713
726
  "testimonials-grid-d5.phone": "",
727
+ "testimonials-grid-d5.dividers": "",
714
728
  "quote-1-d5.quote": "A short quote from a customer, in their own words.",
715
729
  "quote-1-d5.author": "Customer name",
716
730
  "quote-1-d5.role": "Role, company",
@@ -745,14 +759,21 @@
745
759
  "faq-band-d6.gradient": "",
746
760
  "faq-intro-d6.align": "center",
747
761
  "faq-intro-d6.phone": "",
762
+ "faq-intro-d6.dividers": "",
748
763
  "faq-heading-d6.text": "Frequently asked questions",
749
764
  "faq-heading-d6.level": "h2",
765
+ "faq-heading-d6.size": "",
750
766
  "faq-sub-d6.text": "One sentence that introduces this section.",
751
767
  "faq-sub-d6.textStyle": "",
752
768
  "faq-list-d6.align": "",
753
769
  "faq-list-d6.phone": "",
770
+ "faq-list-d6.dividers": "",
754
771
  "faq-accordion-d6.items": "[{\"question\":\"A common question?\",\"answer\":\"A short, direct answer.\"},{\"question\":\"A common question?\",\"answer\":\"A short, direct answer.\"},{\"question\":\"A common question?\",\"answer\":\"A short, direct answer.\"},{\"question\":\"A common question?\",\"answer\":\"A short, direct answer.\"},{\"question\":\"A common question?\",\"answer\":\"A short, direct answer.\"}]",
755
772
  "faq-accordion-d6.multiple": "",
773
+ "faq-accordion-d6.numbered": "",
774
+ "faq-accordion-d6.open": "",
775
+ "faq-accordion-d6.openRow": "",
776
+ "faq-accordion-d6.size": "",
756
777
  "lead-band-d7.coverImage": "",
757
778
  "lead-band-d7.coverStyle": "",
758
779
  "lead-band-d7.coverScrim": "",
@@ -772,14 +793,17 @@
772
793
  "lead-band-d7.gradient": "",
773
794
  "lead-intro-d7.align": "center",
774
795
  "lead-intro-d7.phone": "",
796
+ "lead-intro-d7.dividers": "",
775
797
  "lead-intro-col-d7.pad": "",
776
798
  "lead-intro-col-d7.sticky": "",
777
799
  "lead-heading-d7.text": "Get in touch",
778
800
  "lead-heading-d7.level": "h2",
801
+ "lead-heading-d7.size": "",
779
802
  "lead-sub-d7.text": "One sentence on what happens after someone writes in.",
780
803
  "lead-sub-d7.textStyle": "",
781
804
  "lead-row-d7.align": "",
782
805
  "lead-row-d7.phone": "",
806
+ "lead-row-d7.dividers": "",
783
807
  "lead-form-col-d7.pad": "",
784
808
  "lead-form-col-d7.sticky": "",
785
809
  "lead-form-d7.submitLabel": "Send",
@@ -828,11 +852,13 @@
828
852
  "footer-band-d8.gradient": "",
829
853
  "footer-grid-d8.align": "",
830
854
  "footer-grid-d8.phone": "",
855
+ "footer-grid-d8.dividers": "",
831
856
  "footer-brand-col-d8.pad": "",
832
857
  "footer-brand-col-d8.sticky": "",
833
858
  "footer-brand-d8.wordmark": "Your Company",
834
859
  "footer-brand-d8.wordmarkAccent": "",
835
860
  "footer-brand-d8.logoImage": "",
861
+ "footer-brand-d8.lockup": "",
836
862
  "footer-brand-d8.tagline": "A one-line description of what you do.",
837
863
  "footer-brand-d8.href": "#",
838
864
  "footer-links-col-d8.pad": "",
@@ -841,18 +867,24 @@
841
867
  "footer-links-d8.links": "[{\"label\":\"Home\",\"href\":\"#\"},{\"label\":\"About\",\"href\":\"#about\"},{\"label\":\"Services\",\"href\":\"#services\"},{\"label\":\"Contact\",\"href\":\"#contact\"}]",
842
868
  "footer-links-d8.direction": "",
843
869
  "footer-links-d8.icons": "",
870
+ "footer-links-d8.textSize": "",
871
+ "footer-links-d8.underline": "",
844
872
  "footer-contact-col-d8.pad": "",
845
873
  "footer-contact-col-d8.sticky": "",
846
874
  "footer-contact-d8.title": "Contact",
847
875
  "footer-contact-d8.links": "[{\"label\":\"(555) 555-0100\",\"href\":\"tel:+15555550100\"},{\"label\":\"hello@yourcompany.com\",\"href\":\"mailto:hello@yourcompany.com\"}]",
848
876
  "footer-contact-d8.direction": "",
849
877
  "footer-contact-d8.icons": "",
878
+ "footer-contact-d8.textSize": "",
879
+ "footer-contact-d8.underline": "",
850
880
  "footer-hours-d8.text": "City, ST",
851
881
  "footer-hours-d8.textStyle": "note",
852
882
  "footer-social-links-d8.title": "",
853
883
  "footer-social-links-d8.links": "",
854
884
  "footer-social-links-d8.direction": "row",
855
- "footer-social-links-d8.icons": "social"
885
+ "footer-social-links-d8.icons": "social",
886
+ "footer-social-links-d8.textSize": "",
887
+ "footer-social-links-d8.underline": ""
856
888
  },
857
889
  "ds": {}
858
890
  }
@@ -9,6 +9,14 @@ export const metadata: Metadata = {
9
9
  export default function RootLayout({ children }: { children: React.ReactNode }) {
10
10
  return (
11
11
  <html lang="en">
12
+ <head>
13
+ {/* The same rule next.config.ts sends as a header, for static hosts and `output: "export"`, which drop
14
+ headers. Keep the two lists equal. */}
15
+ <meta
16
+ httpEquiv="Content-Security-Policy"
17
+ content="frame-src https://www.youtube.com https://www.youtube-nocookie.com https://player.vimeo.com https://www.loom.com https://fast.wistia.net https://open.spotify.com https://cal.com https://*.cal.com https://calendly.com https://www.google.com https://maps.google.com https://player.twitch.tv https://www.twitch.tv https://player.kick.com https://w.soundcloud.com"
18
+ />
19
+ </head>
12
20
  <body>{children}</body>
13
21
  </html>
14
22
  );
@@ -8,5 +8,5 @@ import siteJson from "../site.json";
8
8
  const site = siteJson as any;
9
9
 
10
10
  export default function Home() {
11
- return <SiteRenderer site={site} registry={registry} />;
11
+ return <SiteRenderer site={site} registry={registry} codeEmbed="run" />;
12
12
  }
@@ -1,5 +1,23 @@
1
1
  import type { NextConfig } from "next";
2
2
 
3
- const nextConfig: NextConfig = {};
3
+ const nextConfig: NextConfig = {
4
+ async headers() {
5
+ return [
6
+ {
7
+ source: "/:path*",
8
+ headers: [
9
+ // Lets embeds from these hosts load and stops a sealed Code Embed frame from sending itself to any other site.
10
+ // Add your own hosts here if you embed from others, and in the meta tag in app/layout.tsx, which carries
11
+ // the same list for hosts that ignore headers.
12
+ {
13
+ key: "Content-Security-Policy",
14
+ value:
15
+ "frame-src https://www.youtube.com https://www.youtube-nocookie.com https://player.vimeo.com https://www.loom.com https://fast.wistia.net https://open.spotify.com https://cal.com https://*.cal.com https://calendly.com https://www.google.com https://maps.google.com https://player.twitch.tv https://www.twitch.tv https://player.kick.com https://w.soundcloud.com",
16
+ },
17
+ ],
18
+ },
19
+ ];
20
+ },
21
+ };
4
22
 
5
23
  export default nextConfig;