From 7d78d5e0fb544b653a65c478a3b66a820f4de42c Mon Sep 17 00:00:00 2001 From: Owen Buckley Date: Fri, 8 Nov 2024 14:09:51 -0500 Subject: [PATCH 1/6] misc post launch docs feedback --- .../docs/content-as-data/active-frontmatter.md | 2 +- src/pages/docs/content-as-data/index.md | 7 ++++++- src/pages/docs/pages/server-rendering.md | 2 +- src/pages/docs/plugins/index.md | 11 +++++++++++ src/pages/docs/reference/configuration.md | 2 +- src/pages/docs/resources/scripts.md | 18 +++++++++++++++++- src/pages/guides/hosting/aws.md | 2 +- 7 files changed, 38 insertions(+), 6 deletions(-) diff --git a/src/pages/docs/content-as-data/active-frontmatter.md b/src/pages/docs/content-as-data/active-frontmatter.md index c768577..c9e7210 100644 --- a/src/pages/docs/content-as-data/active-frontmatter.md +++ b/src/pages/docs/content-as-data/active-frontmatter.md @@ -56,7 +56,7 @@ Or HTML: ## Data Client -You can also access this content using our data client: +You can also access this content using our [data client](/docs/content-as-data/data-client/): ```js import { getContentByCollection } from "@greenwood/cli/src/data/client.js"; diff --git a/src/pages/docs/content-as-data/index.md b/src/pages/docs/content-as-data/index.md index 6495141..fd06193 100644 --- a/src/pages/docs/content-as-data/index.md +++ b/src/pages/docs/content-as-data/index.md @@ -18,7 +18,12 @@ If you are developing a blog site, like in our [Getting Started](/guides/getting But what happens over time, when that list grows to 10, 50, 100+ posts? Imagine maintaining that list each time, over and over again? Or just remembering to update that list each time you publish a new post? Not only that, but wouldn't it also be great to sort, search, filter, and organize those posts to make them easier for users to navigate and find? -To assist with this, Greenwood provides a set of "content as data" capabilities on the left sidebar you can take advantage of. +To assist with this, Greenwood provides a set of "content as data" capabilities: + +- [Pages Data](/docs/content-as-data/pages-data/) - Learn about the data schema available for your content +- [Data Client](/docs/content-as-data/data-client/) - Utilities for getting your content as data +- [Collections](/docs/content-as-data/collections/) - Frontmatter based configuration for grouping related content +- [Active Frontmatter](/docs/content-as-data/active-frontmatter/) - Interpolate your page's frontmatter in your HTML > First thing though, make sure you've set the [`activeContent`](/docs/reference/configuration/#active-content) flag to `true` in your _greenwood.config.js_. > diff --git a/src/pages/docs/pages/server-rendering.md b/src/pages/docs/pages/server-rendering.md index d2737c9..12afa4c 100644 --- a/src/pages/docs/pages/server-rendering.md +++ b/src/pages/docs/pages/server-rendering.md @@ -244,7 +244,7 @@ export default class PostPage extends HTMLElement { To use custom imports on the server side for prerendering or SSR use cases (ex. CSS, JSON), you will need to invoke Greenwood using **NodeJS** from the CLI and pass it the `--loaders` flag along with the path to Greenwood's provided loader function. ```shell -$ node --loader ./node_modules/@greenwood/cli/src/loader.js ./node_modules/.bin/greenwood +$ node --loader ./node_modules/@greenwood/cli/src/loader.js ./node_modules/@greenwood/cli/src/index.js ``` Then you will be able to run this, or for any custom format you want using a plugin. diff --git a/src/pages/docs/plugins/index.md b/src/pages/docs/plugins/index.md index f8cc489..0ee4511 100644 --- a/src/pages/docs/plugins/index.md +++ b/src/pages/docs/plugins/index.md @@ -1,6 +1,7 @@ --- layout: docs order: 4 +tocHeading: 2 --- @@ -9,6 +10,16 @@ order: 4 > When installing plugins with **npm**, make sure to add the `--legacy-peer-deps` flag, or add an _.npmrc_ file in the root of your project with `legacy-peer-deps=true` set. +## Featured + +- [Lit SSR](/docs/plugins/lit-ssr/) - For Lit users, a custom renderer plugin to support Lit+SSR +- [TypeScript](/docs/plugins/typescript/) - A plugin for transforming files written in TypeScript +- [PostCSS](/docs/plugins/postcss/) - Leverage PostCSS plugins, like [Tailwind](/guides/ecosystem/tailwind/) +- [CSS Modules](/docs/plugins/css-modules/) - Support for [CSS Modules](https://github.com/css-modules/css-modules) ™️ syntax +- [Raw Loader](/docs/plugins/raw/) - Import arbitrary text files as ESM + +## All Plugins + Below is the official list of supported first-party plugins available by the Greenwood team with links to the plugin specific README for full installation and usage documentation.
diff --git a/src/pages/docs/reference/configuration.md b/src/pages/docs/reference/configuration.md index 54bc5f7..cdf8f3d 100644 --- a/src/pages/docs/reference/configuration.md +++ b/src/pages/docs/reference/configuration.md @@ -8,7 +8,7 @@ tocHeading: 2 This section details all the supported configuration options available with **Greenwood**, which you can define in a _greenwood.config.js_ file at root of your project. -The below is a _greenwood.config.js_ file reflecting default values: +Below is a _greenwood.config.js_ file reflecting default values: ```js export default { diff --git a/src/pages/docs/resources/scripts.md b/src/pages/docs/resources/scripts.md index 1f455b3..0bd488a 100644 --- a/src/pages/docs/resources/scripts.md +++ b/src/pages/docs/resources/scripts.md @@ -75,7 +75,7 @@ Below are some examples: // after having installed Lit import { html, LitElement } from "lit"; -export class SimpleGreeting extends LitElement { +class SimpleGreeting extends LitElement { static properties = { name: { type: String }, }; @@ -110,3 +110,19 @@ The rule of thumb is: - If it's a package from npm installed in **dependencies**, you can use bare specifiers and no extension - Otherwise, you will need to use a relative path and the extension + +## Prerendering + +If you are doing [prerendering](/docs/reference/configuration/#prerender) and using Greenwood's default [renderer (WCC)](/docs/reference/appendix/#dom-emulation), make sure that any custom elements you want prerendered have a `default` export for their `class` definition. + +```js +export default class Card extends HTMLElement { + connectedCallback() { + if (!this.shadowRoot) { + // ... + } + } +} + +customElements.define("x-card", Card); +``` diff --git a/src/pages/guides/hosting/aws.md b/src/pages/guides/hosting/aws.md index 3c2881f..ebfd9f9 100644 --- a/src/pages/guides/hosting/aws.md +++ b/src/pages/guides/hosting/aws.md @@ -22,7 +22,7 @@ In this section, we'll share the steps for up S3 and Cloudfront together for sta > Keep an eye out for prompts from AWS to enable IAM rules for your function and make sure to invalidate the Cloudfront distribution between tests, since error pages / responses will get cached. -You should now be able to access your site at _http://.cloudfront.net/_! 🏆 +You should now be able to access your site at _http://{your-dist}.cloudfront.net/_! 🏆 Now at this point, if you have any routes like `/search/`, you'll notice they are not working unless _index.html_ is appended to the path. To enable routing (URL rewriting) for cleaner URLs, follow the _Configure Trigger_ section of [this guide](https://aws.amazon.com/blogs/compute/implementing-default-directory-indexes-in-amazon-s3-backed-amazon-cloudfront-origins-using-lambdaedge/) to attach the Lambda as a [**Lambda@Edge**](https://aws.amazon.com/lambda/edge/) function that will run on every incoming request. From 3c92209b8fadc457e5ddfd659831909968304b43 Mon Sep 17 00:00:00 2001 From: Owen Buckley Date: Fri, 8 Nov 2024 14:17:54 -0500 Subject: [PATCH 2/6] patch toc heading bug --- package-lock.json | 262 ++++++++++++++++++++++++++++ package.json | 4 +- patches/@greenwood+cli+0.30.0.patch | 12 ++ 3 files changed, 277 insertions(+), 1 deletion(-) create mode 100644 patches/@greenwood+cli+0.30.0.patch diff --git a/package-lock.json b/package-lock.json index ff922c9..d1bd763 100644 --- a/package-lock.json +++ b/package-lock.json @@ -44,6 +44,7 @@ "lint-staged": "^15.2.2", "lit": "^3.1.2", "node-html-parser": "^6.1.13", + "patch-package": "^8.0.0", "prettier": "^3.2.5", "rehype-autolink-headings": "^4.0.0", "rehype-slug": "^3.0.0", @@ -5566,6 +5567,12 @@ "dev": true, "license": "0BSD" }, + "node_modules/@yarnpkg/lockfile": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@yarnpkg/lockfile/-/lockfile-1.1.0.tgz", + "integrity": "sha512-GpSwvyXOcOOlV70vbnzjj4fW5xW/FdUF6nQEt1ENy7m4ZCczi1+/buVUPAqmGfqznsORNFzUMjctTIp8a9tuCQ==", + "dev": true + }, "node_modules/accepts": { "version": "1.3.8", "dev": true, @@ -5909,6 +5916,15 @@ "tslib": "^2.4.0" } }, + "node_modules/at-least-node": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/at-least-node/-/at-least-node-1.0.0.tgz", + "integrity": "sha512-+q/t7Ekv1EDY2l6Gda6LLiX14rU9TV20Wa3ofeQmwPFZbOMo9DXrLbOjFaaclkXKWidIaopwAObQDqwWtGUjqg==", + "dev": true, + "engines": { + "node": ">= 4.0.0" + } + }, "node_modules/autolinker": { "version": "0.28.1", "dev": true, @@ -6662,6 +6678,21 @@ "devtools-protocol": "*" } }, + "node_modules/ci-info": { + "version": "3.9.0", + "resolved": "https://registry.npmjs.org/ci-info/-/ci-info-3.9.0.tgz", + "integrity": "sha512-NIxF55hv4nSqQswkAeiOi1r83xy8JldOFDTWiug55KBu9Jnblncd2U6ViHmYgHf01TPZS77NJBhBMKdWj9HQMQ==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/sibiraj-s" + } + ], + "engines": { + "node": ">=8" + } + }, "node_modules/citty": { "version": "0.1.6", "dev": true, @@ -8888,6 +8919,15 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/find-yarn-workspace-root": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/find-yarn-workspace-root/-/find-yarn-workspace-root-2.0.0.tgz", + "integrity": "sha512-1IMnbjt4KzsQfnhnzNd8wUEgXZ44IzZaZmnLYx7D5FZlaHt2gW20Cri8Q+E/t5tIj4+epTBub+2Zxu/vNILzqQ==", + "dev": true, + "dependencies": { + "micromatch": "^4.0.2" + } + }, "node_modules/flat-cache": { "version": "4.0.1", "dev": true, @@ -10890,11 +10930,35 @@ "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==", "dev": true }, + "node_modules/json-stable-stringify": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/json-stable-stringify/-/json-stable-stringify-1.1.1.tgz", + "integrity": "sha512-SU/971Kt5qVQfJpyDveVhQ/vya+5hvrjClFOcr8c0Fq5aODJjMwutrOfCU+eCnVD5gpx1Q3fEqkyom77zH1iIg==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.5", + "isarray": "^2.0.5", + "jsonify": "^0.0.1", + "object-keys": "^1.1.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/json-stable-stringify-without-jsonify": { "version": "1.0.1", "dev": true, "license": "MIT" }, + "node_modules/json-stable-stringify/node_modules/isarray": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-2.0.5.tgz", + "integrity": "sha512-xHjhDr3cNBK0BzdUJSPXZntQUx/mwMS5Rw4A7lPJ90XGAO6ISP/ePDNuo0vhqOZU+UD5JoodwCAAoZQd3FeAKw==", + "dev": true + }, "node_modules/json5": { "version": "2.2.3", "dev": true, @@ -10917,6 +10981,15 @@ "graceful-fs": "^4.1.6" } }, + "node_modules/jsonify": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/jsonify/-/jsonify-0.0.1.tgz", + "integrity": "sha512-2/Ki0GcmuqSrgFyelQq9M05y7PS0mEwuIzrf3f1fPqkVDVRvZrPZtVSMHxdgo8Aq0sxAOb/cr2aqqA3LeWHVPg==", + "dev": true, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/keygrip": { "version": "1.1.0", "dev": true, @@ -10947,6 +11020,15 @@ "node": ">=0.10.0" } }, + "node_modules/klaw-sync": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/klaw-sync/-/klaw-sync-6.0.0.tgz", + "integrity": "sha512-nIeuVSzdCCs6TDPTqI8w1Yre34sSq7AkZ4B3sfOBbI2CgVSB4Du4aLQijFU2+lhAFCwt9+42Hel6lQNIv6AntQ==", + "dev": true, + "dependencies": { + "graceful-fs": "^4.1.11" + } + }, "node_modules/kleur": { "version": "3.0.3", "dev": true, @@ -13717,6 +13799,15 @@ "node": ">=8" } }, + "node_modules/os-tmpdir": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/os-tmpdir/-/os-tmpdir-1.0.2.tgz", + "integrity": "sha512-D2FR03Vir7FIu45XBY20mTb+/ZSWB00sjU9jdQXt83gDrI4Ztz5Fs7/yy74g2N5SVQY4xY1qDr4rNddwYRVX0g==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/p-limit": { "version": "3.1.0", "dev": true, @@ -13866,6 +13957,153 @@ "node": ">= 0.8" } }, + "node_modules/patch-package": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/patch-package/-/patch-package-8.0.0.tgz", + "integrity": "sha512-da8BVIhzjtgScwDJ2TtKsfT5JFWz1hYoBl9rUQ1f38MC2HwnEIkK8VN3dKMKcP7P7bvvgzNDbfNHtx3MsQb5vA==", + "dev": true, + "dependencies": { + "@yarnpkg/lockfile": "^1.1.0", + "chalk": "^4.1.2", + "ci-info": "^3.7.0", + "cross-spawn": "^7.0.3", + "find-yarn-workspace-root": "^2.0.0", + "fs-extra": "^9.0.0", + "json-stable-stringify": "^1.0.2", + "klaw-sync": "^6.0.0", + "minimist": "^1.2.6", + "open": "^7.4.2", + "rimraf": "^2.6.3", + "semver": "^7.5.3", + "slash": "^2.0.0", + "tmp": "^0.0.33", + "yaml": "^2.2.2" + }, + "bin": { + "patch-package": "index.js" + }, + "engines": { + "node": ">=14", + "npm": ">5" + } + }, + "node_modules/patch-package/node_modules/ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "dev": true, + "dependencies": { + "color-convert": "^2.0.1" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/patch-package/node_modules/chalk": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", + "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", + "dev": true, + "dependencies": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/chalk?sponsor=1" + } + }, + "node_modules/patch-package/node_modules/fs-extra": { + "version": "9.1.0", + "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-9.1.0.tgz", + "integrity": "sha512-hcg3ZmepS30/7BSFqRvoo3DOMQu7IjqxO5nCDt+zM9XWjb33Wg7ziNT+Qvqbuc3+gWpzO02JubVyk2G4Zvo1OQ==", + "dev": true, + "dependencies": { + "at-least-node": "^1.0.0", + "graceful-fs": "^4.2.0", + "jsonfile": "^6.0.1", + "universalify": "^2.0.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/patch-package/node_modules/has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/patch-package/node_modules/open": { + "version": "7.4.2", + "resolved": "https://registry.npmjs.org/open/-/open-7.4.2.tgz", + "integrity": "sha512-MVHddDVweXZF3awtlAS+6pgKLlm/JgxZ90+/NBurBoQctVOOB/zDdVjcyPzQ+0laDGbsWgrRkflI65sQeOgT9Q==", + "dev": true, + "dependencies": { + "is-docker": "^2.0.0", + "is-wsl": "^2.1.1" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/patch-package/node_modules/rimraf": { + "version": "2.7.1", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.7.1.tgz", + "integrity": "sha512-uWjbaKIK3T1OSVptzX7Nl6PvQ3qAGtKEtVRjRuazjfL3Bx5eI409VZSqgND+4UNnmzLVdPj9FqFJNPqBZFve4w==", + "deprecated": "Rimraf versions prior to v4 are no longer supported", + "dev": true, + "dependencies": { + "glob": "^7.1.3" + }, + "bin": { + "rimraf": "bin.js" + } + }, + "node_modules/patch-package/node_modules/semver": { + "version": "7.6.3", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.6.3.tgz", + "integrity": "sha512-oVekP1cKtI+CTDvHWYFUcMtsK/00wmAEfyqKfNdARm8u1wNVhSgaX7A8d4UuIlUI5e84iEwOhs7ZPYRmzU9U6A==", + "dev": true, + "bin": { + "semver": "bin/semver.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/patch-package/node_modules/slash": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/slash/-/slash-2.0.0.tgz", + "integrity": "sha512-ZYKh3Wh2z1PpEXWr0MpSBZ0V6mZHAQfYevttO11c51CaWjGTaadiKZ+wVt1PbMlDV5qhMFslpZCemhwOK7C89A==", + "dev": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/patch-package/node_modules/supports-color": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", + "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", + "dev": true, + "dependencies": { + "has-flag": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, "node_modules/path-exists": { "version": "4.0.0", "dev": true, @@ -16622,6 +16860,18 @@ "node": ">=14.0.0" } }, + "node_modules/tmp": { + "version": "0.0.33", + "resolved": "https://registry.npmjs.org/tmp/-/tmp-0.0.33.tgz", + "integrity": "sha512-jRCJlojKnZ3addtTOjdIqoRuPEKBvNXcGYqzO6zWZX8KfKEpnGY5jfggJQ3EjKuu8D4bJRr0y+cYJFmYbImXGw==", + "dev": true, + "dependencies": { + "os-tmpdir": "~1.0.2" + }, + "engines": { + "node": ">=0.6.0" + } + }, "node_modules/to-fast-properties": { "version": "2.0.0", "dev": true, @@ -17663,6 +17913,18 @@ "dev": true, "license": "ISC" }, + "node_modules/yaml": { + "version": "2.6.0", + "resolved": "https://registry.npmjs.org/yaml/-/yaml-2.6.0.tgz", + "integrity": "sha512-a6ae//JvKDEra2kdi1qzCyrJW/WZCgFi8ydDV+eXExl95t+5R+ijnqHJbz9tmMh8FUjx3iv2fCQ4dclAQlO2UQ==", + "dev": true, + "bin": { + "yaml": "bin.mjs" + }, + "engines": { + "node": ">= 14" + } + }, "node_modules/yargs": { "version": "17.7.2", "dev": true, diff --git a/package.json b/package.json index f1c873f..3076b5f 100644 --- a/package.json +++ b/package.json @@ -31,7 +31,8 @@ "lint:links": "npm run build && node ./link-checker.js", "format": "prettier . --write", "format:check": "prettier . --check", - "prepare": "husky install" + "prepare": "husky install", + "postinstall": "patch-package" }, "dependencies": { "geist": "^1.2.0", @@ -69,6 +70,7 @@ "lint-staged": "^15.2.2", "lit": "^3.1.2", "node-html-parser": "^6.1.13", + "patch-package": "^8.0.0", "prettier": "^3.2.5", "rehype-autolink-headings": "^4.0.0", "rehype-slug": "^3.0.0", diff --git a/patches/@greenwood+cli+0.30.0.patch b/patches/@greenwood+cli+0.30.0.patch new file mode 100644 index 0000000..cbf77ea --- /dev/null +++ b/patches/@greenwood+cli+0.30.0.patch @@ -0,0 +1,12 @@ +diff --git a/node_modules/@greenwood/cli/src/lifecycles/graph.js b/node_modules/@greenwood/cli/src/lifecycles/graph.js +index 456b832..d870d26 100644 +--- a/node_modules/@greenwood/cli/src/lifecycles/graph.js ++++ b/node_modules/@greenwood/cli/src/lifecycles/graph.js +@@ -230,7 +230,6 @@ const generateGraph = async (compilation) => { + if (fileContents && customData.tocHeading > 0 && customData.tocHeading <= 6) { + // parse markdown for table of contents and output to json + customData.tableOfContents = toc(fileContents).json; +- customData.tableOfContents.shift(); + + // parse table of contents for only the pages user wants linked + if (customData.tableOfContents.length > 0 && customData.tocHeading > 0) { From bb439fa6d4afcd38030a8a963fbc80af9960dcfa Mon Sep 17 00:00:00 2001 From: Owen Buckley Date: Fri, 8 Nov 2024 14:21:00 -0500 Subject: [PATCH 3/6] formatting --- src/pages/docs/resources/scripts.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pages/docs/resources/scripts.md b/src/pages/docs/resources/scripts.md index 0bd488a..fd95855 100644 --- a/src/pages/docs/resources/scripts.md +++ b/src/pages/docs/resources/scripts.md @@ -113,7 +113,7 @@ The rule of thumb is: ## Prerendering -If you are doing [prerendering](/docs/reference/configuration/#prerender) and using Greenwood's default [renderer (WCC)](/docs/reference/appendix/#dom-emulation), make sure that any custom elements you want prerendered have a `default` export for their `class` definition. +If you have enabled [prerendering](/docs/reference/configuration/#prerender) and using Greenwood's default [renderer (WCC)](/docs/reference/appendix/#dom-emulation), make sure that any custom elements you want prerendered have a `default` export for their `class` definition. ```js export default class Card extends HTMLElement { From 36f41d7d870d18fe588c3111b52b05ddba5fdfd1 Mon Sep 17 00:00:00 2001 From: Owen Buckley Date: Fri, 8 Nov 2024 16:53:03 -0500 Subject: [PATCH 4/6] adopt idiomatic custom imports loader script path --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 3076b5f..0011143 100644 --- a/package.json +++ b/package.json @@ -16,7 +16,7 @@ }, "scripts": { "clean": "rimraf public .greenwood storybook-static", - "build": "node --loader ./node_modules/@greenwood/cli/src/loader.js ./node_modules/.bin/greenwood build", + "build": "node --loader ./node_modules/@greenwood/cli/src/loader.js ./node_modules/@greenwood/cli/src/index.js build", "dev": "greenwood develop", "serve": "npm run clean && npm run build && greenwood serve", "story:dev": "storybook dev -p 6006", From 2aad7fbece7d98aff1cb1717eb8564708fd92a14 Mon Sep 17 00:00:00 2001 From: Owen Buckley Date: Fri, 8 Nov 2024 17:03:20 -0500 Subject: [PATCH 5/6] bump to greenwood v0.30.1 --- package-lock.json | 290 ++-------------------------- package.json | 10 +- patches/@greenwood+cli+0.30.0.patch | 12 -- 3 files changed, 18 insertions(+), 294 deletions(-) delete mode 100644 patches/@greenwood+cli+0.30.0.patch diff --git a/package-lock.json b/package-lock.json index d1bd763..597c7c2 100644 --- a/package-lock.json +++ b/package-lock.json @@ -22,9 +22,9 @@ "@eslint/json": "^0.5.0", "@eslint/markdown": "^6.2.0", "@esm-bundle/chai": "^4.3.4-fix.0", - "@greenwood/cli": "^0.30.0", - "@greenwood/plugin-css-modules": "^0.30.0", - "@greenwood/plugin-import-raw": "^0.30.0", + "@greenwood/cli": "^0.30.1", + "@greenwood/plugin-css-modules": "^0.30.1", + "@greenwood/plugin-import-raw": "^0.30.1", "@ls-lint/ls-lint": "^1.10.0", "@mapbox/rehype-prism": "^0.9.0", "@storybook/addon-essentials": "^8.0.6", @@ -44,7 +44,6 @@ "lint-staged": "^15.2.2", "lit": "^3.1.2", "node-html-parser": "^6.1.13", - "patch-package": "^8.0.0", "prettier": "^3.2.5", "rehype-autolink-headings": "^4.0.0", "rehype-slug": "^3.0.0", @@ -2309,9 +2308,9 @@ "license": "MIT" }, "node_modules/@greenwood/cli": { - "version": "0.30.0", - "resolved": "https://registry.npmjs.org/@greenwood/cli/-/cli-0.30.0.tgz", - "integrity": "sha512-cCHjf5YRTMUbkiRLpetmTp1EnZhrc2z7bDZoVQMit1xoKgnaAY+LGkxonWKCI0dq1jie9cd6ZVmmoVHUaTpHEQ==", + "version": "0.30.1", + "resolved": "https://registry.npmjs.org/@greenwood/cli/-/cli-0.30.1.tgz", + "integrity": "sha512-GW58CowMPn7i8BlM5/DenuViVbTMjIFjIhQhUaqpljlL5koR2gvGwyMteBdL2GuMiaNDwDp63gx0GK5mu1Cbig==", "dev": true, "dependencies": { "@rollup/plugin-commonjs": "^25.0.0", @@ -2375,9 +2374,9 @@ } }, "node_modules/@greenwood/plugin-css-modules": { - "version": "0.30.0", - "resolved": "https://registry.npmjs.org/@greenwood/plugin-css-modules/-/plugin-css-modules-0.30.0.tgz", - "integrity": "sha512-2X32ERVPy00wi9WB/wo220AaFkxjfrQ6SjgZixeIQ2MxV7XMyrJAB8sSboXDkIxOVQgAJ1Y4yD/ogJZLfQ8nkA==", + "version": "0.30.1", + "resolved": "https://registry.npmjs.org/@greenwood/plugin-css-modules/-/plugin-css-modules-0.30.1.tgz", + "integrity": "sha512-wJ9uSlAt7J02vuIP1J2OYEcujDparmD2Tc6MFwHZMcfMvBuFMhC4mTuBZDXhzNdO3Kbc14CG5rbp9IWxlF5Rsg==", "dev": true, "dependencies": { "acorn": "^8.0.1", @@ -2388,7 +2387,7 @@ "sucrase": "^3.35.0" }, "peerDependencies": { - "@greenwood/cli": "^0.4.0" + "@greenwood/cli": "^0.30.0" } }, "node_modules/@greenwood/plugin-css-modules/node_modules/css-tree": { @@ -2420,12 +2419,12 @@ } }, "node_modules/@greenwood/plugin-import-raw": { - "version": "0.30.0", - "resolved": "https://registry.npmjs.org/@greenwood/plugin-import-raw/-/plugin-import-raw-0.30.0.tgz", - "integrity": "sha512-cJUG3REDsoNyk9p49oEXYq/BblzyIp+7Kh2Dhdpd7PmIduoHqJ+m9jT3VIFp6SoryLAxbMqgzEGioZVIXyRs5A==", + "version": "0.30.1", + "resolved": "https://registry.npmjs.org/@greenwood/plugin-import-raw/-/plugin-import-raw-0.30.1.tgz", + "integrity": "sha512-FhdzCj1GmpHcUyactNswU8SE+Q1ckmzyszBjBXR7Jt+E7oejkdWNOjAzgQpA4kWI42UT52oMXUJJDsv4Q6uZ/A==", "dev": true, "peerDependencies": { - "@greenwood/cli": "^0.4.0" + "@greenwood/cli": "^0.30.0" } }, "node_modules/@humanwhocodes/module-importer": { @@ -5567,12 +5566,6 @@ "dev": true, "license": "0BSD" }, - "node_modules/@yarnpkg/lockfile": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/@yarnpkg/lockfile/-/lockfile-1.1.0.tgz", - "integrity": "sha512-GpSwvyXOcOOlV70vbnzjj4fW5xW/FdUF6nQEt1ENy7m4ZCczi1+/buVUPAqmGfqznsORNFzUMjctTIp8a9tuCQ==", - "dev": true - }, "node_modules/accepts": { "version": "1.3.8", "dev": true, @@ -5916,15 +5909,6 @@ "tslib": "^2.4.0" } }, - "node_modules/at-least-node": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/at-least-node/-/at-least-node-1.0.0.tgz", - "integrity": "sha512-+q/t7Ekv1EDY2l6Gda6LLiX14rU9TV20Wa3ofeQmwPFZbOMo9DXrLbOjFaaclkXKWidIaopwAObQDqwWtGUjqg==", - "dev": true, - "engines": { - "node": ">= 4.0.0" - } - }, "node_modules/autolinker": { "version": "0.28.1", "dev": true, @@ -6678,21 +6662,6 @@ "devtools-protocol": "*" } }, - "node_modules/ci-info": { - "version": "3.9.0", - "resolved": "https://registry.npmjs.org/ci-info/-/ci-info-3.9.0.tgz", - "integrity": "sha512-NIxF55hv4nSqQswkAeiOi1r83xy8JldOFDTWiug55KBu9Jnblncd2U6ViHmYgHf01TPZS77NJBhBMKdWj9HQMQ==", - "dev": true, - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/sibiraj-s" - } - ], - "engines": { - "node": ">=8" - } - }, "node_modules/citty": { "version": "0.1.6", "dev": true, @@ -8919,15 +8888,6 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/find-yarn-workspace-root": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/find-yarn-workspace-root/-/find-yarn-workspace-root-2.0.0.tgz", - "integrity": "sha512-1IMnbjt4KzsQfnhnzNd8wUEgXZ44IzZaZmnLYx7D5FZlaHt2gW20Cri8Q+E/t5tIj4+epTBub+2Zxu/vNILzqQ==", - "dev": true, - "dependencies": { - "micromatch": "^4.0.2" - } - }, "node_modules/flat-cache": { "version": "4.0.1", "dev": true, @@ -10930,35 +10890,11 @@ "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==", "dev": true }, - "node_modules/json-stable-stringify": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/json-stable-stringify/-/json-stable-stringify-1.1.1.tgz", - "integrity": "sha512-SU/971Kt5qVQfJpyDveVhQ/vya+5hvrjClFOcr8c0Fq5aODJjMwutrOfCU+eCnVD5gpx1Q3fEqkyom77zH1iIg==", - "dev": true, - "dependencies": { - "call-bind": "^1.0.5", - "isarray": "^2.0.5", - "jsonify": "^0.0.1", - "object-keys": "^1.1.1" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, "node_modules/json-stable-stringify-without-jsonify": { "version": "1.0.1", "dev": true, "license": "MIT" }, - "node_modules/json-stable-stringify/node_modules/isarray": { - "version": "2.0.5", - "resolved": "https://registry.npmjs.org/isarray/-/isarray-2.0.5.tgz", - "integrity": "sha512-xHjhDr3cNBK0BzdUJSPXZntQUx/mwMS5Rw4A7lPJ90XGAO6ISP/ePDNuo0vhqOZU+UD5JoodwCAAoZQd3FeAKw==", - "dev": true - }, "node_modules/json5": { "version": "2.2.3", "dev": true, @@ -10981,15 +10917,6 @@ "graceful-fs": "^4.1.6" } }, - "node_modules/jsonify": { - "version": "0.0.1", - "resolved": "https://registry.npmjs.org/jsonify/-/jsonify-0.0.1.tgz", - "integrity": "sha512-2/Ki0GcmuqSrgFyelQq9M05y7PS0mEwuIzrf3f1fPqkVDVRvZrPZtVSMHxdgo8Aq0sxAOb/cr2aqqA3LeWHVPg==", - "dev": true, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, "node_modules/keygrip": { "version": "1.1.0", "dev": true, @@ -11020,15 +10947,6 @@ "node": ">=0.10.0" } }, - "node_modules/klaw-sync": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/klaw-sync/-/klaw-sync-6.0.0.tgz", - "integrity": "sha512-nIeuVSzdCCs6TDPTqI8w1Yre34sSq7AkZ4B3sfOBbI2CgVSB4Du4aLQijFU2+lhAFCwt9+42Hel6lQNIv6AntQ==", - "dev": true, - "dependencies": { - "graceful-fs": "^4.1.11" - } - }, "node_modules/kleur": { "version": "3.0.3", "dev": true, @@ -13799,15 +13717,6 @@ "node": ">=8" } }, - "node_modules/os-tmpdir": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/os-tmpdir/-/os-tmpdir-1.0.2.tgz", - "integrity": "sha512-D2FR03Vir7FIu45XBY20mTb+/ZSWB00sjU9jdQXt83gDrI4Ztz5Fs7/yy74g2N5SVQY4xY1qDr4rNddwYRVX0g==", - "dev": true, - "engines": { - "node": ">=0.10.0" - } - }, "node_modules/p-limit": { "version": "3.1.0", "dev": true, @@ -13957,153 +13866,6 @@ "node": ">= 0.8" } }, - "node_modules/patch-package": { - "version": "8.0.0", - "resolved": "https://registry.npmjs.org/patch-package/-/patch-package-8.0.0.tgz", - "integrity": "sha512-da8BVIhzjtgScwDJ2TtKsfT5JFWz1hYoBl9rUQ1f38MC2HwnEIkK8VN3dKMKcP7P7bvvgzNDbfNHtx3MsQb5vA==", - "dev": true, - "dependencies": { - "@yarnpkg/lockfile": "^1.1.0", - "chalk": "^4.1.2", - "ci-info": "^3.7.0", - "cross-spawn": "^7.0.3", - "find-yarn-workspace-root": "^2.0.0", - "fs-extra": "^9.0.0", - "json-stable-stringify": "^1.0.2", - "klaw-sync": "^6.0.0", - "minimist": "^1.2.6", - "open": "^7.4.2", - "rimraf": "^2.6.3", - "semver": "^7.5.3", - "slash": "^2.0.0", - "tmp": "^0.0.33", - "yaml": "^2.2.2" - }, - "bin": { - "patch-package": "index.js" - }, - "engines": { - "node": ">=14", - "npm": ">5" - } - }, - "node_modules/patch-package/node_modules/ansi-styles": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", - "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", - "dev": true, - "dependencies": { - "color-convert": "^2.0.1" - }, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/chalk/ansi-styles?sponsor=1" - } - }, - "node_modules/patch-package/node_modules/chalk": { - "version": "4.1.2", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", - "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", - "dev": true, - "dependencies": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/chalk/chalk?sponsor=1" - } - }, - "node_modules/patch-package/node_modules/fs-extra": { - "version": "9.1.0", - "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-9.1.0.tgz", - "integrity": "sha512-hcg3ZmepS30/7BSFqRvoo3DOMQu7IjqxO5nCDt+zM9XWjb33Wg7ziNT+Qvqbuc3+gWpzO02JubVyk2G4Zvo1OQ==", - "dev": true, - "dependencies": { - "at-least-node": "^1.0.0", - "graceful-fs": "^4.2.0", - "jsonfile": "^6.0.1", - "universalify": "^2.0.0" - }, - "engines": { - "node": ">=10" - } - }, - "node_modules/patch-package/node_modules/has-flag": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", - "dev": true, - "engines": { - "node": ">=8" - } - }, - "node_modules/patch-package/node_modules/open": { - "version": "7.4.2", - "resolved": "https://registry.npmjs.org/open/-/open-7.4.2.tgz", - "integrity": "sha512-MVHddDVweXZF3awtlAS+6pgKLlm/JgxZ90+/NBurBoQctVOOB/zDdVjcyPzQ+0laDGbsWgrRkflI65sQeOgT9Q==", - "dev": true, - "dependencies": { - "is-docker": "^2.0.0", - "is-wsl": "^2.1.1" - }, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/patch-package/node_modules/rimraf": { - "version": "2.7.1", - "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.7.1.tgz", - "integrity": "sha512-uWjbaKIK3T1OSVptzX7Nl6PvQ3qAGtKEtVRjRuazjfL3Bx5eI409VZSqgND+4UNnmzLVdPj9FqFJNPqBZFve4w==", - "deprecated": "Rimraf versions prior to v4 are no longer supported", - "dev": true, - "dependencies": { - "glob": "^7.1.3" - }, - "bin": { - "rimraf": "bin.js" - } - }, - "node_modules/patch-package/node_modules/semver": { - "version": "7.6.3", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.6.3.tgz", - "integrity": "sha512-oVekP1cKtI+CTDvHWYFUcMtsK/00wmAEfyqKfNdARm8u1wNVhSgaX7A8d4UuIlUI5e84iEwOhs7ZPYRmzU9U6A==", - "dev": true, - "bin": { - "semver": "bin/semver.js" - }, - "engines": { - "node": ">=10" - } - }, - "node_modules/patch-package/node_modules/slash": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/slash/-/slash-2.0.0.tgz", - "integrity": "sha512-ZYKh3Wh2z1PpEXWr0MpSBZ0V6mZHAQfYevttO11c51CaWjGTaadiKZ+wVt1PbMlDV5qhMFslpZCemhwOK7C89A==", - "dev": true, - "engines": { - "node": ">=6" - } - }, - "node_modules/patch-package/node_modules/supports-color": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", - "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", - "dev": true, - "dependencies": { - "has-flag": "^4.0.0" - }, - "engines": { - "node": ">=8" - } - }, "node_modules/path-exists": { "version": "4.0.0", "dev": true, @@ -16860,18 +16622,6 @@ "node": ">=14.0.0" } }, - "node_modules/tmp": { - "version": "0.0.33", - "resolved": "https://registry.npmjs.org/tmp/-/tmp-0.0.33.tgz", - "integrity": "sha512-jRCJlojKnZ3addtTOjdIqoRuPEKBvNXcGYqzO6zWZX8KfKEpnGY5jfggJQ3EjKuu8D4bJRr0y+cYJFmYbImXGw==", - "dev": true, - "dependencies": { - "os-tmpdir": "~1.0.2" - }, - "engines": { - "node": ">=0.6.0" - } - }, "node_modules/to-fast-properties": { "version": "2.0.0", "dev": true, @@ -17913,18 +17663,6 @@ "dev": true, "license": "ISC" }, - "node_modules/yaml": { - "version": "2.6.0", - "resolved": "https://registry.npmjs.org/yaml/-/yaml-2.6.0.tgz", - "integrity": "sha512-a6ae//JvKDEra2kdi1qzCyrJW/WZCgFi8ydDV+eXExl95t+5R+ijnqHJbz9tmMh8FUjx3iv2fCQ4dclAQlO2UQ==", - "dev": true, - "bin": { - "yaml": "bin.mjs" - }, - "engines": { - "node": ">= 14" - } - }, "node_modules/yargs": { "version": "17.7.2", "dev": true, diff --git a/package.json b/package.json index 0011143..002a871 100644 --- a/package.json +++ b/package.json @@ -31,8 +31,7 @@ "lint:links": "npm run build && node ./link-checker.js", "format": "prettier . --write", "format:check": "prettier . --check", - "prepare": "husky install", - "postinstall": "patch-package" + "prepare": "husky install" }, "dependencies": { "geist": "^1.2.0", @@ -48,9 +47,9 @@ "@eslint/json": "^0.5.0", "@eslint/markdown": "^6.2.0", "@esm-bundle/chai": "^4.3.4-fix.0", - "@greenwood/cli": "^0.30.0", - "@greenwood/plugin-css-modules": "^0.30.0", - "@greenwood/plugin-import-raw": "^0.30.0", + "@greenwood/cli": "^0.30.1", + "@greenwood/plugin-css-modules": "^0.30.1", + "@greenwood/plugin-import-raw": "^0.30.1", "@ls-lint/ls-lint": "^1.10.0", "@mapbox/rehype-prism": "^0.9.0", "@storybook/addon-essentials": "^8.0.6", @@ -70,7 +69,6 @@ "lint-staged": "^15.2.2", "lit": "^3.1.2", "node-html-parser": "^6.1.13", - "patch-package": "^8.0.0", "prettier": "^3.2.5", "rehype-autolink-headings": "^4.0.0", "rehype-slug": "^3.0.0", diff --git a/patches/@greenwood+cli+0.30.0.patch b/patches/@greenwood+cli+0.30.0.patch deleted file mode 100644 index cbf77ea..0000000 --- a/patches/@greenwood+cli+0.30.0.patch +++ /dev/null @@ -1,12 +0,0 @@ -diff --git a/node_modules/@greenwood/cli/src/lifecycles/graph.js b/node_modules/@greenwood/cli/src/lifecycles/graph.js -index 456b832..d870d26 100644 ---- a/node_modules/@greenwood/cli/src/lifecycles/graph.js -+++ b/node_modules/@greenwood/cli/src/lifecycles/graph.js -@@ -230,7 +230,6 @@ const generateGraph = async (compilation) => { - if (fileContents && customData.tocHeading > 0 && customData.tocHeading <= 6) { - // parse markdown for table of contents and output to json - customData.tableOfContents = toc(fileContents).json; -- customData.tableOfContents.shift(); - - // parse table of contents for only the pages user wants linked - if (customData.tableOfContents.length > 0 && customData.tocHeading > 0) { From 1905ffda6817ff021aa58ece637ba0d26fb68bc4 Mon Sep 17 00:00:00 2001 From: Owen Buckley Date: Mon, 11 Nov 2024 17:24:46 -0500 Subject: [PATCH 6/6] pnpm shamefully hoist call out --- src/pages/docs/introduction/setup.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/pages/docs/introduction/setup.md b/src/pages/docs/introduction/setup.md index 1ef355a..28a5849 100644 --- a/src/pages/docs/introduction/setup.md +++ b/src/pages/docs/introduction/setup.md @@ -35,8 +35,13 @@ $ npm i -D @greenwood/cli@latest # yarn $ yarn add @greenwood/cli@latest --save-dev + +# pnpm +$ pnpm add -D @greenwood/cli@latest ``` +> For pnpm, it is currently required to create a _.npmrc_ file at the root of your project with the [**shamefully-hoist**](https://pnpm.io/blog/2020/10/17/node-modules-configuration-options-with-pnpm#the-worst-case---hoisting-to-the-root) flag set to `true`. + ## Commands The CLI supports three commands, that can be easily mapped to npm scripts in your _package.json_. You'll also want to make sure you've set the `type` field to **module**: