Skip to content

Commit

Permalink
chore(examples): mark core supported examples (#9707)
Browse files Browse the repository at this point in the history
### Description

The community has been contributing more and more examples as Turborepo
usage has grown. This is _so exciting_ for those of us on the core team,
but we've had a hard time maintaining so many examples. It's a lot of
work to keep up with the breadth of tools that work great with
Turborepo, and the JavaScript ecosystem moves fast.

Because of this, we've come up with a strategy so that we can set
expectations correctly with the community. We're picking out ~5 examples
that we're committing to maintaining as shining representatives of
JavaScript monorepo greatness, leaving the rest to be maintained by the
community.

We will communicate this directly in `create-turbo` invocations, leaving
a note for users when they pick out a community-supported example.
 
### Testing Instructions
Should not show a `Note` log: `devcreateturbo --example
https://github.com/vercel/turborepo/tree/shew-0f97e/examples/basic`
Should show a `Note` log: `devcreateturbo --example
https://github.com/vercel/turborepo/tree/shew-0f97e/examples/with-docker`
  • Loading branch information
anthonyshew authored Jan 17, 2025
1 parent 8082821 commit cbdeecd
Show file tree
Hide file tree
Showing 30 changed files with 68 additions and 27 deletions.
2 changes: 1 addition & 1 deletion examples/basic/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Turborepo starter

This is an official starter Turborepo.
This Turborepo starter is maintained by the Turborepo core team.

## Using this example

Expand Down
3 changes: 3 additions & 0 deletions examples/basic/meta.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"maintainedByCoreTeam": true
}
2 changes: 2 additions & 0 deletions examples/design-system/README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Turborepo Design System Starter

This is a community-maintained example. If you experience a problem, please submit a pull request with a fix. GitHub Issues will be closed.

This guide explains how to use a React design system starter powered by:

- 🏎 [Turborepo](https://turbo.build/repo) — High-performance build system for Monorepos
Expand Down
2 changes: 1 addition & 1 deletion examples/kitchen-sink/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Turborepo kitchen sink starter

This is an official starter Turborepo with multiple meta-frameworks all working in harmony and sharing packages.
This Turborepo starter is maintained by the Turborepo core team.

This example also shows how to use [Workspace Configurations](https://turbo.build/repo/docs/core-concepts/monorepos/configuring-workspaces).

Expand Down
3 changes: 2 additions & 1 deletion examples/kitchen-sink/meta.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@
"name": "Kitchen Sink",
"description": "Want to see a more in-depth example? Includes multiple frameworks, both frontend and backend.",
"template": "https://vercel.com/templates/remix/turborepo-kitchensink",
"featured": true
"featured": true,
"maintainedByCoreTeam": true
}
2 changes: 1 addition & 1 deletion examples/non-monorepo/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Turborepo non-monorepo starter

This is an official starter Turborepo.
This Turborepo starter is maintained by the Turborepo core team.

## Using this example

Expand Down
3 changes: 2 additions & 1 deletion examples/non-monorepo/meta.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"name": "Non-Monorepo",
"description": "Example of using Turborepo in a single project without workspaces"
"description": "Example of using Turborepo in a single project without workspaces",
"maintainedByCoreTeam": true
}
2 changes: 1 addition & 1 deletion examples/with-angular/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Turborepo starter

This is an official starter Turborepo.
This is a community-maintained example. If you experience a problem, please submit a pull request with a fix. GitHub Issues will be closed.

## Using this example

Expand Down
2 changes: 1 addition & 1 deletion examples/with-berry/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Turborepo starter with berry (yarn v2+)

This is an official starter Turborepo.
This is a community-maintained example. If you experience a problem, please submit a pull request with a fix. GitHub Issues will be closed.

## Using this example

Expand Down
2 changes: 1 addition & 1 deletion examples/with-changesets/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Turborepo Design System starter with Changesets

This is an official React design system starter powered by Turborepo. Versioning and package publishing is handled by [Changesets](https://github.com/changesets/changesets) and fully automated with GitHub Actions.
This is a community-maintained example. If you experience a problem, please submit a pull request with a fix. GitHub Issues will be closed.

## Using this example

Expand Down
2 changes: 1 addition & 1 deletion examples/with-docker/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Turborepo Docker starter

This is an official Docker starter Turborepo.
This is a community-maintained example. If you experience a problem, please submit a pull request with a fix. GitHub Issues will be closed.

## Using this example

Expand Down
2 changes: 1 addition & 1 deletion examples/with-gatsby/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Turborepo Gatsby.js starter

This is an official starter turborepo.
This is a community-maintained example. If you experience a problem, please submit a pull request with a fix. GitHub Issues will be closed.

## Using this example

Expand Down
2 changes: 1 addition & 1 deletion examples/with-nestjs/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Turborepo starter

This is an official starter Turborepo.
This is a community-maintained example. If you experience a problem, please submit a pull request with a fix. GitHub Issues will be closed.

## Using this example

Expand Down
2 changes: 1 addition & 1 deletion examples/with-npm/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Turborepo starter

This is an official starter Turborepo.
This is a community-maintained example. If you experience a problem, please submit a pull request with a fix. GitHub Issues will be closed.

## Using this example

Expand Down
2 changes: 1 addition & 1 deletion examples/with-prisma/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Turborepo starter

This is an official starter turborepo.
This is a community-maintained example. If you experience a problem, please submit a pull request with a fix. GitHub Issues will be closed.

## Using this example

Expand Down
2 changes: 1 addition & 1 deletion examples/with-react-native-web/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Turborepo react-native starter

This is an official starter Turborepo.
This is a community-maintained example. If you experience a problem, please submit a pull request with a fix. GitHub Issues will be closed.

## Using this example

Expand Down
2 changes: 1 addition & 1 deletion examples/with-rollup/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Turborepo starter with Rollup

This is an official starter Turborepo, showing how Turborepo can be used with Rollup for bundling a `ui` package.
This is a community-maintained example. If you experience a problem, please submit a pull request with a fix. GitHub Issues will be closed.

## Using this example

Expand Down
2 changes: 1 addition & 1 deletion examples/with-shell-commands/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Turborepo starter with shell commands

This is an official starter Turborepo meant for debugging, learning, and exploring.
This Turborepo starter is maintained by the Turborepo core team. This template is great for issue reproductions and exploring building task graphs without frameworks.

## Using this example

Expand Down
3 changes: 3 additions & 0 deletions examples/with-shell-commands/meta.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"maintainedByCoreTeam": true
}
2 changes: 1 addition & 1 deletion examples/with-svelte/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Turborepo Svelte starter

This is an official starter Turborepo.
This Turborepo starter is maintained by the Turborepo core team.

## Using this example

Expand Down
3 changes: 2 additions & 1 deletion examples/with-svelte/meta.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,6 @@
"description": "Monorepo with multiple SvelteKit apps sharing a UI Library",
"featured": true,
"template": "https://vercel.com/templates/svelte/turborepo-sveltekit-starter",
"boost": true
"boost": true,
"maintainedByCoreTeam": true
}
2 changes: 1 addition & 1 deletion examples/with-tailwind/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Turborepo Tailwind CSS starter

This is an official starter Turborepo.
This Turborepo starter is maintained by the Turborepo core team.

## Using this example

Expand Down
3 changes: 2 additions & 1 deletion examples/with-tailwind/meta.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"name": "Tailwind CSS",
"description": "Monorepo with multiple Next.js apps sharing a UI Library all using Tailwind CSS with a shared config",
"featured": true
"featured": true,
"maintainedByCoreTeam": true
}
2 changes: 1 addition & 1 deletion examples/with-typeorm/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Turborepo with TypeORM

This is an official starter Turborepo configured with TypeORM to manage the service layer in a monorepo setup.
This is a community-maintained example. If you experience a problem, please submit a pull request with a fix. GitHub Issues will be closed.

## What's inside?

Expand Down
2 changes: 1 addition & 1 deletion examples/with-vite/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# `Turborepo` Vite starter

This is an official starter Turborepo.
This is a community-maintained example. If you experience a problem, please submit a pull request with a fix. GitHub Issues will be closed.

## Using this example

Expand Down
2 changes: 1 addition & 1 deletion examples/with-vue-nuxt/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Turborepo VueJS/NuxtJS starter

This is an official starter Turborepo.
This is a community-maintained example. If you experience a problem, please submit a pull request with a fix. GitHub Issues will be closed.

## Using this example

Expand Down
2 changes: 1 addition & 1 deletion examples/with-yarn/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Turborepo starter

This is an official starter Turborepo.
This is a community-maintained example. If you experience a problem, please submit a pull request with a fix. GitHub Issues will be closed.

## Using this example

Expand Down
18 changes: 17 additions & 1 deletion packages/create-turbo/src/commands/create/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import path from "node:path";
import { bold, red, cyan, green } from "picocolors";
import { bold, red, cyan, green, dim } from "picocolors";
import type { Project } from "@turbo/workspaces";
import {
getWorkspaceDetails,
Expand Down Expand Up @@ -76,6 +76,8 @@ export async function create(
opts.telemetry?.trackArgumentDirectory(Boolean(directory));
trackOptions(opts);

let isMaintainedByCoreTeam = false;

const { packageManager, skipInstall, skipTransforms } = opts;

const [online, availablePackageManagers] = await Promise.all([
Expand Down Expand Up @@ -159,6 +161,10 @@ export async function create(
`feat(create-turbo): apply ${transformResult.name} transform`
);
}

if (transformResult.metaJson?.maintainedByCoreTeam) {
isMaintainedByCoreTeam = true;
}
} catch (err) {
handleErrors(err, opts.telemetry);
}
Expand Down Expand Up @@ -256,6 +262,15 @@ export async function create(
);
}

if (!isMaintainedByCoreTeam) {
logger.log();
logger.log(
dim(
"Note: This is a community-maintained example. If you experience a problem, please submit a pull request with a fix. GitHub Issues will be closed."
)
);
}

// get the package manager details so we display the right commands to the user in log messages
const packageManagerMeta = getPackageManagerMeta(projectPackageManager);
if (packageManagerMeta && hasPackageJson) {
Expand Down Expand Up @@ -285,5 +300,6 @@ export async function create(
});
logger.log("- Run a command twice to hit cache");
}

opts.telemetry?.trackCommandStatus({ command: "create", status: "end" });
}
7 changes: 5 additions & 2 deletions packages/create-turbo/src/transforms/official-starter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import path from "node:path";
import { readJsonSync, writeJsonSync, rmSync, existsSync } from "fs-extra";
import type { PackageJson } from "@turbo/utils";
import { isDefaultExample } from "../utils/isDefaultExample";
import type { TransformInput, TransformResult } from "./types";
import type { TransformInput, TransformResult, MetaJson } from "./types";
import { TransformError } from "./errors";

const meta = {
Expand Down Expand Up @@ -32,8 +32,11 @@ export async function transform(args: TransformInput): TransformResult {
const rootMetaJsonPath = path.join(prompts.root, "meta.json");
const hasPackageJson = existsSync(rootPackageJsonPath);

let metaJson: MetaJson | undefined;

// 1. remove meta file (used for generating the examples page on turbo.build)
try {
metaJson = readJsonSync(rootMetaJsonPath) as MetaJson;
rmSync(rootMetaJsonPath, { force: true });
} catch (_err) {
// do nothing
Expand Down Expand Up @@ -84,5 +87,5 @@ export async function transform(args: TransformInput): TransformResult {
}
}

return { result: "success", ...meta };
return { result: "success", metaJson, ...meta };
}
10 changes: 10 additions & 0 deletions packages/create-turbo/src/transforms/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,20 @@ export interface TransformInput {
opts: CreateCommandOptions;
}

export interface MetaJson {
maintainedByCoreTeam?: string;
name?: string;
description?: string;
featured?: boolean;
boost?: boolean;
template?: boolean;
}

export interface TransformResponse {
// errors should be thrown as instances of TransformError
result: "not-applicable" | "success";
name: string;
metaJson?: MetaJson;
}

export type TransformResult = Promise<TransformResponse>;

0 comments on commit cbdeecd

Please sign in to comment.