Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use hardcoding. #7792

Merged
merged 1 commit into from Mar 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
37 changes: 1 addition & 36 deletions docs/pages/repo/docs/getting-started/from-example.mdx
Expand Up @@ -3,47 +3,12 @@ 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' />
<ExamplesArea filter="all" />

For even more examples and starters, see the [Turborepo examples directory on GitHub](https://github.com/vercel/turbo/tree/main/examples).
41 changes: 5 additions & 36 deletions docs/pages/repo/docs/index.mdx
Expand Up @@ -3,45 +3,14 @@ title: Turborepo Quickstart
description: Create your first monorepo or add Turborepo to an existing project.
---

import { readdirSync, lstatSync, readFileSync } from 'fs';
import path from 'path';
import { QuickStartArea, LearnMoreArea, MonoreposArea } from "../../../components/QuickStart";
import {
QuickStartArea,
LearnMoreArea,
MonoreposArea,
} from "../../../components/QuickStart";
import { ExamplesArea } from "../../../components/ExamplesArea";
import { FullTurboCTA } from "../../../components/FullTurboCTA";

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 Quickstart

Turborepo is an intelligent **build system optimized for JavaScript and TypeScript codebases**.
Expand Down