Skip to content

Commit

Permalink
move cache outside node_modules (#1140)
Browse files Browse the repository at this point in the history
  • Loading branch information
juliusmarminge authored Aug 8, 2024
1 parent 19d670b commit dbc2144
Show file tree
Hide file tree
Showing 23 changed files with 24 additions and 40 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ yarn-error.log*
.vercel

# typescript
*.tsbuildinfo
dist/
.cache

# turbo
.turbo
2 changes: 1 addition & 1 deletion apps/auth-proxy/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"type": "module",
"scripts": {
"build": "nitro build",
"clean": "rm -rf .turbo node_modules",
"clean": "git clean -xdf .cache .nitro .output .turbo .vercel node_modules",
"lint": "eslint",
"format": "prettier --check . --ignore-path ../../.gitignore",
"typecheck": "tsc --noEmit"
Expand Down
5 changes: 2 additions & 3 deletions apps/expo/metro.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,7 @@ function withMonorepoPaths(config) {
}

/**
* Move the Metro cache to the `node_modules/.cache/metro` folder.
* This repository configured Turborepo to use this cache location as well.
* Move the Metro cache to the `.cache/metro` folder.
* If you have any environment variables, you can configure Turborepo to invalidate it when needed.
*
* @see https://turbo.build/repo/docs/reference/configuration#env
Expand All @@ -55,7 +54,7 @@ function withMonorepoPaths(config) {
*/
function withTurborepoManagedCache(config) {
config.cacheStores = [
new FileStore({ root: path.join(__dirname, "node_modules/.cache/metro") }),
new FileStore({ root: path.join(__dirname, ".cache/metro") }),
];
return config;
}
2 changes: 1 addition & 1 deletion apps/expo/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"private": true,
"main": "index.ts",
"scripts": {
"clean": "git clean -xdf .expo .turbo node_modules",
"clean": "git clean -xdf .cache .expo .turbo android ios node_modules",
"dev": "expo start",
"dev:android": "expo start --android",
"dev:ios": "expo start --ios",
Expand Down
1 change: 0 additions & 1 deletion apps/expo/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
"~/*": ["./src/*"]
},
"jsx": "react-native",
"tsBuildInfoFile": "node_modules/.cache/tsbuildinfo.json",
"types": ["nativewind/types"],
"checkJs": false
},
Expand Down
2 changes: 1 addition & 1 deletion apps/nextjs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"type": "module",
"scripts": {
"build": "pnpm with-env next build",
"clean": "git clean -xdf .next .turbo node_modules",
"clean": "git clean -xdf .cache .next .turbo node_modules",
"dev": "pnpm with-env next dev",
"format": "prettier --check . --ignore-path ../../.gitignore",
"lint": "eslint",
Expand Down
1 change: 0 additions & 1 deletion apps/nextjs/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
"~/*": ["./src/*"]
},
"plugins": [{ "name": "next" }],
"tsBuildInfoFile": "node_modules/.cache/tsbuildinfo.json",
"module": "esnext"
},
"include": [".", ".next/types/**/*.ts"],
Expand Down
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@
"db:studio": "turbo -F @acme/db studio",
"dev": "turbo watch dev",
"dev:next": "turbo watch dev -F @acme/nextjs...",
"format": "turbo run format --continue -- --cache --cache-location node_modules/.cache/.prettiercache",
"format:fix": "turbo run format --continue -- --write --cache --cache-location node_modules/.cache/.prettiercache",
"lint": "turbo run lint --continue -- --cache --cache-location node_modules/.cache/.eslintcache",
"lint:fix": "turbo run lint --continue -- --fix --cache --cache-location node_modules/.cache/.eslintcache",
"format": "turbo run format --continue -- --cache --cache-location .cache/.prettiercache",
"format:fix": "turbo run format --continue -- --write --cache --cache-location .cache/.prettiercache",
"lint": "turbo run lint --continue -- --cache --cache-location .cache/.eslintcache",
"lint:fix": "turbo run lint --continue -- --fix --cache --cache-location .cache/.eslintcache",
"lint:ws": "pnpm dlx sherif@latest",
"postinstall": "pnpm lint:ws",
"typecheck": "turbo run typecheck",
Expand Down
2 changes: 1 addition & 1 deletion packages/api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"license": "MIT",
"scripts": {
"build": "tsc",
"clean": "rm -rf .turbo dist node_modules",
"clean": "git clean -xdf .cache .turbo dist node_modules",
"dev": "tsc",
"format": "prettier --check . --ignore-path ../../.gitignore",
"lint": "eslint",
Expand Down
4 changes: 0 additions & 4 deletions packages/api/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
{
"extends": "@acme/tsconfig/internal-package.json",
"compilerOptions": {
"outDir": "dist",
"tsBuildInfoFile": "node_modules/.cache/tsbuildinfo.json"
},
"include": ["src"],
"exclude": ["node_modules"]
}
2 changes: 1 addition & 1 deletion packages/auth/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
},
"license": "MIT",
"scripts": {
"clean": "rm -rf .turbo node_modules",
"clean": "git clean -xdf .cache .turbo dist node_modules",
"format": "prettier --check . --ignore-path ../../.gitignore",
"lint": "eslint",
"typecheck": "tsc --noEmit"
Expand Down
2 changes: 1 addition & 1 deletion packages/db/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"scripts": {
"build": "tsc",
"dev": "tsc",
"clean": "rm -rf .turbo dist node_modules",
"clean": "git clean -xdf .cache .turbo dist node_modules",
"format": "prettier --check . --ignore-path ../../.gitignore",
"lint": "eslint",
"push": "pnpm with-env drizzle-kit push",
Expand Down
2 changes: 1 addition & 1 deletion packages/ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"license": "MIT",
"scripts": {
"build": "tsc",
"clean": "rm -rf .turbo dist node_modules",
"clean": "git clean -xdf .cache .turbo dist node_modules",
"dev": "tsc",
"format": "prettier --check . --ignore-path ../../.gitignore",
"lint": "eslint",
Expand Down
2 changes: 1 addition & 1 deletion packages/validators/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"license": "MIT",
"scripts": {
"build": "tsc",
"clean": "rm -rf .turbo dist node_modules",
"clean": "git clean -xdf .cache .turbo dist node_modules",
"dev": "tsc",
"format": "prettier --check . --ignore-path ../../.gitignore",
"lint": "eslint",
Expand Down
2 changes: 1 addition & 1 deletion tooling/eslint/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"./react": "./react.js"
},
"scripts": {
"clean": "rm -rf .turbo node_modules",
"clean": "git clean -xdf .cache .turbo node_modules",
"format": "prettier --check . --ignore-path ../../.gitignore",
"typecheck": "tsc --noEmit"
},
Expand Down
3 changes: 0 additions & 3 deletions tooling/eslint/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
{
"extends": "@acme/tsconfig/base.json",
"compilerOptions": {
"tsBuildInfoFile": "node_modules/.cache/tsbuildinfo.json"
},
"include": ["."],
"exclude": ["node_modules"]
}
2 changes: 1 addition & 1 deletion tooling/prettier/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
".": "./index.js"
},
"scripts": {
"clean": "rm -rf .turbo node_modules",
"clean": "git clean -xdf .cache .turbo node_modules",
"format": "prettier --check . --ignore-path ../../.gitignore",
"typecheck": "tsc --noEmit"
},
Expand Down
3 changes: 0 additions & 3 deletions tooling/prettier/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
{
"extends": "@acme/tsconfig/base.json",
"compilerOptions": {
"tsBuildInfoFile": "node_modules/.cache/tsbuildinfo.json"
},
"include": ["."],
"exclude": ["node_modules"]
}
2 changes: 1 addition & 1 deletion tooling/tailwind/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
},
"license": "MIT",
"scripts": {
"clean": "rm -rf .turbo node_modules",
"clean": "git clean -xdf .cache .turbo node_modules",
"format": "prettier --check . --ignore-path ../../.gitignore",
"lint": "eslint",
"typecheck": "tsc --noEmit"
Expand Down
3 changes: 0 additions & 3 deletions tooling/tailwind/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
{
"extends": "@acme/tsconfig/base.json",
"compilerOptions": {
"tsBuildInfoFile": "node_modules/.cache/tsbuildinfo.json"
},
"include": ["."],
"exclude": ["node_modules"]
}
2 changes: 1 addition & 1 deletion tooling/typescript/base.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
/** Keep TSC performant in monorepos */
"incremental": true,
"disableSourceOfProjectReferenceRedirect": true,
"tsBuildInfoFile": "${configDir}/node_modules/.cache/tsbuildinfo.json",
"tsBuildInfoFile": "${configDir}/.cache/tsbuildinfo.json",

/** Strictness */
"strict": true,
Expand Down
8 changes: 4 additions & 4 deletions turbo.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,23 +7,23 @@
},
"build": {
"dependsOn": ["^build"],
"outputs": ["node_modules/.cache/tsbuildinfo.json", "dist/**"]
"outputs": [".cache/tsbuildinfo.json", "dist/**"]
},
"dev": {
"cache": false,
"persistent": false
},
"format": {
"outputs": ["node_modules/.cache/.prettiercache"],
"outputs": [".cache/.prettiercache"],
"outputLogs": "new-only"
},
"lint": {
"dependsOn": ["^topo", "^build"],
"outputs": ["node_modules/.cache/.eslintcache"]
"outputs": [".cache/.eslintcache"]
},
"typecheck": {
"dependsOn": ["^topo", "^build"],
"outputs": ["node_modules/.cache/tsbuildinfo.json"]
"outputs": [".cache/tsbuildinfo.json"]
},
"clean": {
"cache": false
Expand Down
2 changes: 1 addition & 1 deletion turbo/generators/templates/package.json.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"license": "MIT",
"scripts": {
"build": "tsc",
"clean": "rm -rf .turbo node_modules",
"clean": "git clean -xdf .cache .turbo dist node_modules",
"dev": "tsc",
"format": "prettier --check . --ignore-path ../../.gitignore",
"lint": "eslint",
Expand Down

0 comments on commit dbc2144

Please sign in to comment.