From 1c9df5e5a97bc4e81aeb7124dec7c36aeda4dfee Mon Sep 17 00:00:00 2001 From: Ethan Gardner Date: Thu, 19 Dec 2024 13:29:24 -0500 Subject: [PATCH] Add command to recursively clean node_modules directory (#416) * add command to recursively delete node modules * add script to recursively remove dist directories * update readme with new clean commands --- README.md | 10 ++++++++++ package.json | 2 ++ 2 files changed, 12 insertions(+) diff --git a/README.md b/README.md index 0c7a06a6..44fc8058 100644 --- a/README.md +++ b/README.md @@ -56,6 +56,16 @@ To run tests in watch mode (except the `infra` tests, which use Jest): pnpm vitest ``` +If you start having unexplained build errors, the following commands are useful to clean up and start fresh. + +```bash +pnpm clean:dist # removes previously built files recursively +pnpm clean:modules # removes node_module directories recursively + +# ... run more commands like pnpm install and pnpm build after you have run these +``` + + To start developing with hot reloading, use: ```bash diff --git a/package.json b/package.json index 6e595757..5b7e7916 100644 --- a/package.json +++ b/package.json @@ -9,6 +9,8 @@ "scripts": { "build": "turbo run build --filter=!@atj/infra-cdktf", "clean": "turbo run clean", + "clean:modules": "find $(git rev-parse --show-toplevel) -name 'node_modules' -type d -prune -exec rm -rf '{}' +", + "clean:dist": "find $(git rev-parse --show-toplevel) -name 'dist' -type d -prune -exec rm -rf '{}' +", "dev": "turbo run dev --concurrency 20", "format": "prettier --write \"packages/*/src/**/*.{js,jsx,ts,tsx,scss,css}\"", "lint": "turbo run lint",