Skip to main content

Turborepo

新一代的 monorepo 工具,提供更高效的構建和更智能的緩存策略

You can produce multiple projects in apps within a single repo and share cross-project components.

install lib

Install global lib method

pnpm i {{LIB_NAME}} -w

Only app lib method

pnpm i {{LIB_NAME}} --filter {{APP_NAME}}

packages

This serves as a shared package hub within the apps, typically used to define constants, locales, styles, and types.

packages
|-- {{LIB_NAME}}
|-- package.json
|-- node_modules
|-- index.ts
|-- {{CORE_LIB}}

Below is a sample reference implementation.

index.ts

export { default as HeroBanner } from "./HeroBanner/index.vue";

package.json

{
"name": "@repo/storyblok-ui",
"version": "0.0.1",
"private": true,
"exports": {
".": "./index.ts",
"./HeroBanner": "./HeroBanner/index.vue"
},
"scripts": {
"lint": "eslint . --max-warnings 0",
"check-types": "tsc --noEmit"
},
"devDependencies": {
"@repo/eslint-config": "workspace:*",
"@repo/typescript-config": "workspace:*",
"@turbo/gen": "^2.5.0",
"@types/node": "^22.15.3",
"eslint": "^9.28.0",
"typescript": "5.8.2"
},
"peerDependencies": {
"vue": "^3.3.8"
}
}

turbo.json

https://turborepo.com/docs/reference/configuration