Skip to content

Commit

Permalink
✨ feat(packages): Add NodePage for scaffold (#77)
Browse files Browse the repository at this point in the history
  • Loading branch information
enZane authored Jul 31, 2024
1 parent 5a8ae88 commit 307b1d7
Show file tree
Hide file tree
Showing 4 changed files with 67 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/many-baboons-matter.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@octahedroid/create-drupal-decoupled": minor
---

Adds the node page for the Route query, and add base styles to tailwind
18 changes: 17 additions & 1 deletion packages/create-drupal-decoupled/src/helpers/scaffolding.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,19 @@ import fs from 'node:fs'
import path from 'node:path'
import { SupportedFrontend } from 'src/constants'

const SCAFFOLD_FILES_PER_FRONTEND = {
type FilesConfig = {
folderPath: string
fileName: string
}

type ScaffoldFilesPerFrontend = Record<
SupportedFrontend,
{
files: FilesConfig[]
}
>

const SCAFFOLD_FILES_PER_FRONTEND: Readonly<ScaffoldFilesPerFrontend> = {
remix: {
files: [
{
Expand All @@ -17,6 +29,10 @@ const SCAFFOLD_FILES_PER_FRONTEND = {
folderPath: 'app/routes',
fileName: '$.tsx',
},
{
folderPath: 'app',
fileName: 'tailwind.css',
},
],
},
}
Expand Down
28 changes: 28 additions & 0 deletions packages/create-drupal-decoupled/src/templates/remix-graphql/$.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,34 @@ export const loader = async ({ params }: LoaderFunctionArgs) => {
}
}
}
... on NodePage {
title
path
body {
value
}
metatag {
__typename
... on MetaTagLink {
attributes {
rel
href
}
}
... on MetaTagValue {
attributes {
name
content
}
}
... on MetaTagProperty {
attributes {
property
content
}
}
}
}
}
}
... on RouteRedirect {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
@tailwind base;
@tailwind components;
@tailwind utilities;

/**
Overriding the Tailwind CSS reset to have some default browser styles,
feel free to remove or edit it at your convenience
**/

@layer base {
ul {
@apply list-disc;
}
a {
@apply text-blue-600 underline;
}
}

0 comments on commit 307b1d7

Please sign in to comment.