aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/docs/pages/MODEL/docs/getting-started/from-example.mdx
diff options
context:
space:
mode:
Diffstat (limited to 'docs/pages/MODEL/docs/getting-started/from-example.mdx')
-rw-r--r--docs/pages/MODEL/docs/getting-started/from-example.mdx49
1 files changed, 49 insertions, 0 deletions
diff --git a/docs/pages/MODEL/docs/getting-started/from-example.mdx b/docs/pages/MODEL/docs/getting-started/from-example.mdx
new file mode 100644
index 0000000..6b35768
--- /dev/null
+++ b/docs/pages/MODEL/docs/getting-started/from-example.mdx
@@ -0,0 +1,49 @@
+---
+title: Examples
+description: Start from an example.
+---
+
+import { readdirSync, lstatSync, readFileSync } from 'fs'
+import path from 'path'
+import { ExamplesArea } from "../../../../components/ExamplesArea";
+
+export const getStaticProps = ({ params }) => {
+ // path to examples directory at the monorepo root.
+ const examplesDirectory = path.join(__dirname, '../../../../../../../examples')
+ const examples = [];
+ readdirSync(examplesDirectory).forEach(file => {
+ if (lstatSync(path.join(examplesDirectory, file)).isDirectory()) {
+ try {
+ examples.push({
+ slug: file,
+ ...JSON.parse(readFileSync(path.join(examplesDirectory, file, "meta.json")).toString())
+ }
+ );
+ } catch (err) {
+ console.log(`No meta.json found for ${file}, excluding from docs`);
+ }
+ }
+ });
+ // throw an error if no examples are found
+ if (examples.length === 0) {
+ throw new Error(
+ `No examples found in ${examplesDirectory}! Make sure you have updated the path if moving this file.`
+ )
+ }
+ return {
+ props: {
+ ssg: {
+ examples
+ }
+ },
+ revalidate: 60 * 60 * 24
+ }
+}
+
+# Turborepo Examples
+
+Clone a Turborepo starter repository to get a head start on your monorepo.
+
+<ExamplesArea filter='all' />
+
+For even more examples and starters, see the [Turborepo examples directory on GitHub](https://github.com/retrofor/HydroRoll/tree/main/examples).