Skip to content

Commit

Permalink
Re-up create-turbo. (#6439)
Browse files Browse the repository at this point in the history
Anthony's To-Do's:
- [x] Make sure all dependencies are up to date
- [x] Find anything that may be broken in-editor
- [x] Loosen ESLint configuration
- [x] Make sure it deploys for CI
- [x] Check with TypeScript team that we are following current best
practices (post-ship, non-blocking)

### Description

Making sure `create-turbo` is robust and modern.

### Testing Instructions

Try it out with `npx create-turbo@latest -e
https://github.com/vercel/turbo/tree/update-create-turbo/examples/basic`

Things to pay attention to:
- [x] Is tasking correct? Are all tasks successful out-of-the-box? Do I
hit cache when I'm expecting?
- [x] If I add an unused variable in a workspace, do I see a warning in
both my editor and when I run `turbo lint`?
- [x] Does auto-importing work across packages?
- [x] Anything else wonky in your editor?
- [x] Do I get proper hot-reloading in `turbo dev`?
- [x] Anything else that may come up!

---------

Co-authored-by: Turbobot <[email protected]>
  • Loading branch information
anthonyshew and turbobot-temp authored Nov 20, 2023
1 parent 9626b18 commit e340cb0
Show file tree
Hide file tree
Showing 44 changed files with 4,366 additions and 3,426 deletions.
12 changes: 6 additions & 6 deletions examples-tests/pnpm-basic/test.t
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
# run twice and make sure it works
$ pnpm run build lint -- --output-logs=errors-only

\> @ build (.*)/test.t (re)
\> turbo run build "lint" "--output-logs=errors-only" (re)
\> my-turborepo@ build (.*)/test.t (re)
\> turbo build "lint" "--output-logs=errors-only" (re)

\xe2\x80\xa2 Packages in scope: docs, eslint-config-custom, tsconfig, ui, web (esc)
\xe2\x80\xa2 Packages in scope: @repo/eslint-config, @repo/typescript-config, @repo/ui, docs, web (esc)
\xe2\x80\xa2 Running build, lint in 5 packages (esc)
\xe2\x80\xa2 Remote caching disabled (esc)

Expand All @@ -16,10 +16,10 @@

$ pnpm run build lint -- --output-logs=errors-only

\> @ build (.*)/test.t (re)
\> turbo run build "lint" "--output-logs=errors-only" (re)
\> my-turborepo@ build (.*)/test.t (re)
\> turbo build "lint" "--output-logs=errors-only" (re)

\xe2\x80\xa2 Packages in scope: docs, eslint-config-custom, tsconfig, ui, web (esc)
\xe2\x80\xa2 Packages in scope: @repo/eslint-config, @repo/typescript-config, @repo/ui, docs, web (esc)
\xe2\x80\xa2 Running build, lint in 5 packages (esc)
\xe2\x80\xa2 Remote caching disabled (esc)

Expand Down
10 changes: 10 additions & 0 deletions examples/basic/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
// This configuration only applies to the package manager root.
/** @type {import("eslint").Linter.Config} */
module.exports = {
ignorePatterns: ["apps/**", "packages/**"],
extends: ["@repo/eslint-config/library.js"],
parser: "@typescript-eslint/parser",
parserOptions: {
project: true,
},
};
40 changes: 21 additions & 19 deletions examples/basic/.gitignore
Original file line number Diff line number Diff line change
@@ -1,36 +1,38 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

# dependencies
# Dependencies
node_modules
.pnp
.pnp.js

# testing
# Local env files
.env
.env.local
.env.development.local
.env.test.local
.env.production.local

# Testing
coverage

# next.js
# Turbo
.turbo

# Vercel
.vercel

# Build Outputs
.next/
out/
build
dist

# misc
.DS_Store
*.pem

# debug
# Debug
npm-debug.log*
yarn-debug.log*
yarn-error.log*

# local env files
.env
.env.local
.env.development.local
.env.test.local
.env.production.local

# turbo
.turbo

# vercel
.vercel
# Misc
.DS_Store
*.pem
8 changes: 7 additions & 1 deletion examples/basic/apps/docs/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
/** @type {import("eslint").Linter.Config} */
module.exports = {
extends: ["custom/next"],
root: true,
extends: ["@repo/eslint-config/next.js"],
parser: "@typescript-eslint/parser",
parserOptions: {
project: true,
},
};
34 changes: 0 additions & 34 deletions examples/basic/apps/docs/.gitignore

This file was deleted.

5 changes: 3 additions & 2 deletions examples/basic/apps/docs/app/page.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import Image from "next/image";
import { Card } from "ui";
import { Card } from "@repo/ui/card";
import { Code } from "@repo/ui/code";
import styles from "./page.module.css";

function Gradient({
Expand Down Expand Up @@ -55,7 +56,7 @@ export default function Page(): JSX.Element {
<div className={styles.description}>
<p>
examples/basic&nbsp;
<code className={styles.code}>docs</code>
<Code className={styles.code}>docs</Code>
</p>
<div>
<a
Expand Down
4 changes: 2 additions & 2 deletions examples/basic/apps/docs/next.config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/** @type {import('next').NextConfig} */
module.exports = {
reactStrictMode: true,
transpilePackages: ["ui"],
transpilePackages: ["@repo/ui"],
};
16 changes: 9 additions & 7 deletions examples/basic/apps/docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,23 @@
"dev": "next dev --port 3001",
"build": "next build",
"start": "next start",
"lint": "next lint"
"lint": "eslint . --max-warnings 0"
},
"dependencies": {
"next": "^13.4.19",
"@repo/ui": "workspace:*",
"next": "^14.0.2",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"ui": "workspace:*"
"react-dom": "^18.2.0"
},
"devDependencies": {
"@next/eslint-plugin-next": "^13.4.19",
"@next/eslint-plugin-next": "^14.0.2",
"@repo/eslint-config": "workspace:*",
"@repo/typescript-config": "workspace:*",
"@types/eslint": "^8.44.7",
"@types/node": "^17.0.12",
"@types/react": "^18.0.22",
"@types/react-dom": "^18.0.7",
"eslint-config-custom": "workspace:*",
"tsconfig": "workspace:*",
"eslint": "^8.53.0",
"typescript": "^5.2.2"
}
}
16 changes: 13 additions & 3 deletions examples/basic/apps/docs/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,18 @@
{
"extends": "tsconfig/nextjs.json",
"extends": "@repo/typescript-config/nextjs.json",
"compilerOptions": {
"plugins": [{ "name": "next" }]
"plugins": [
{
"name": "next"
}
]
},
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"],
"include": [
"next-env.d.ts",
"next.config.js",
"**/*.ts",
"**/*.tsx",
".next/types/**/*.ts"
],
"exclude": ["node_modules"]
}
8 changes: 7 additions & 1 deletion examples/basic/apps/web/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
/** @type {import("eslint").Linter.Config} */
module.exports = {
extends: ["custom/next"],
root: true,
extends: ["@repo/eslint-config/next.js"],
parser: "@typescript-eslint/parser",
parserOptions: {
project: true,
},
};
5 changes: 3 additions & 2 deletions examples/basic/apps/web/app/page.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import Image from "next/image";
import { Card } from "ui";
import { Card } from "@repo/ui/card";
import { Code } from "@repo/ui/code";
import styles from "./page.module.css";

function Gradient({
Expand Down Expand Up @@ -55,7 +56,7 @@ export default function Page(): JSX.Element {
<div className={styles.description}>
<p>
examples/basic&nbsp;
<code className={styles.code}>web</code>
<Code className={styles.code}>web</Code>
</p>
<div>
<a
Expand Down
4 changes: 2 additions & 2 deletions examples/basic/apps/web/next.config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/** @type {import('next').NextConfig} */
module.exports = {
reactStrictMode: true,
transpilePackages: ["ui"],
transpilePackages: ["@repo/ui"],
};
14 changes: 8 additions & 6 deletions examples/basic/apps/web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,23 @@
"dev": "next dev",
"build": "next build",
"start": "next start",
"lint": "next lint"
"lint": "eslint . --max-warnings 0"
},
"dependencies": {
"next": "^13.4.19",
"next": "^14.0.2",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"ui": "workspace:*"
"@repo/ui": "workspace:*"
},
"devDependencies": {
"@next/eslint-plugin-next": "^13.4.19",
"@repo/eslint-config": "workspace:*",
"@repo/typescript-config": "workspace:*",
"@next/eslint-plugin-next": "^14.0.2",
"@types/eslint": "^8.44.7",
"@types/node": "^17.0.12",
"@types/react": "^18.0.22",
"@types/react-dom": "^18.0.7",
"eslint-config-custom": "workspace:*",
"tsconfig": "workspace:*",
"eslint": "^8.53.0",
"typescript": "^5.2.2"
}
}
16 changes: 13 additions & 3 deletions examples/basic/apps/web/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,18 @@
{
"extends": "tsconfig/nextjs.json",
"extends": "@repo/typescript-config/nextjs.json",
"compilerOptions": {
"plugins": [{ "name": "next" }]
"plugins": [
{
"name": "next"
}
]
},
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"],
"include": [
"next-env.d.ts",
"next.config.js",
"**/*.ts",
"**/*.tsx",
".next/types/**/*.ts"
],
"exclude": ["node_modules"]
}
15 changes: 8 additions & 7 deletions examples/basic/package.json
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
{
"name": "my-turborepo",
"private": true,
"scripts": {
"build": "turbo run build",
"dev": "turbo run dev",
"lint": "turbo run lint",
"build": "turbo build",
"dev": "turbo dev",
"lint": "turbo lint",
"format": "prettier --write \"**/*.{ts,tsx,md}\""
},
"devDependencies": {
"eslint": "^8.48.0",
"prettier": "^3.0.3",
"tsconfig": "workspace:*",
"turbo": "^1.10.16"
"@repo/eslint-config": "workspace:*",
"@repo/typescript-config": "workspace:*",
"prettier": "^3.1.0",
"turbo": "latest"
},
"packageManager": "[email protected]"
}
34 changes: 0 additions & 34 deletions examples/basic/packages/eslint-config-custom/library.js

This file was deleted.

Loading

2 comments on commit e340cb0

@vercel
Copy link

@vercel vercel bot commented on e340cb0 Nov 20, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

examples-basic-web – ./examples/basic/apps/web

examples-basic-web.vercel.sh
turborepo-examples-basic-web.vercel.sh
examples-basic-web-git-main.vercel.sh

@vercel
Copy link

@vercel vercel bot commented on e340cb0 Nov 20, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

examples-nonmonorepo – ./examples/non-monorepo

examples-nonmonorepo-git-main.vercel.sh
examples-nonmonorepo.vercel.sh

Please sign in to comment.