https://github.com/buildless/sample-turbo-nextjs
Sample codebase using Turbo, Next.js, and Buildless
https://github.com/buildless/sample-turbo-nextjs
build-cache buildless next-js nextjs remote-build-cache turbo turborepo vercel
Last synced: 5 months ago
JSON representation
Sample codebase using Turbo, Next.js, and Buildless
- Host: GitHub
- URL: https://github.com/buildless/sample-turbo-nextjs
- Owner: buildless
- Created: 2023-07-03T02:07:05.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2024-07-18T05:07:54.000Z (almost 2 years ago)
- Last Synced: 2024-11-10T12:41:39.290Z (over 1 year ago)
- Topics: build-cache, buildless, next-js, nextjs, remote-build-cache, turbo, turborepo, vercel
- Language: CSS
- Homepage: https://docs.less.build/docs/turborepo
- Size: 350 KB
- Stars: 2
- Watchers: 2
- Forks: 1
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Buildless for TurboRepo
This is a [Buildless](https://less.build)-enhanced [Next.js](https://nextjs.org/) project bootstrapped with [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app), using the TurboRepo support provided by [Buildless](https://less.build) for remote caching.
## Getting Started
After installing dependencies, you can use the `turbo` (`npx turbo`) command to run your tasks, and they will be automatically stored in the remote cache:
```bash
# Link the project to enable remote caching, note that the API endpoint is different than for builds
npx turbo link --api="https://turbo.less.build" --token="$BUILDLESS_API_KEY"
# Run the 'build' script for the first time
npx turbo build --api="https://turbo.less.build/cache/turbo" --token="$BUILDLESS_API_KEY" --team="my-team"
```
If we run the task again, it will be fetched from the local cache:
```bash
# clear the Next.js outputs
rm -fr ./.next
# run the cached task
npx turbo build --api="https://turbo.less.build/cache/turbo" --token="$BUILDLESS_API_KEY" --team="my-team"
> Tasks: 1 successful, 1 total
> Cached: 1 cached, 1 total
> Time: 14ms >>> FULL TURBO
```
To see Buildless in action, delete the local cache and re-run the build:
```bash
# clear the Next.js outputs and the local Turbo cache
rm -fr ./.next
rm -fr ./node_modules/.cache/turbo
# run the cached task, it will be fetched from Buildless!
npx turbo build --api="https://api.less.build/cache/turbo" --token="$BUILDLESS_API_KEY" --team="my-team"
> Tasks: 1 successful, 1 total
> Cached: 1 cached, 1 total
> Time: 63ms >>> FULL TURBO
```