Skip to content

Commit

Permalink
uninstall unused packages (#83)
Browse files Browse the repository at this point in the history
* uninstall unused packages

* include depcheck script
  • Loading branch information
abernier authored Oct 6, 2024
1 parent cfe9fc4 commit eec9029
Show file tree
Hide file tree
Showing 82 changed files with 826 additions and 689 deletions.
78 changes: 78 additions & 0 deletions bin/depcheck.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
//
// Check for unused dependencies in all workspaces.
//
// https://bolt.new/~/sb1-9sqsva
//

import fs from "fs";
import path from "path";
import { fileURLToPath } from "url";
import depcheck from "depcheck";

const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);

const workspacesDir = path.join(__dirname, "..", "demos");

const options = {
ignorePatterns: ["dist", "build"],
ignoreMatches: ["@types/*", "tslib"],
};

async function checkWorkspace(workspacePath) {
const results = await depcheck(workspacePath, options);

console.log(`\nChecking ${path.basename(workspacePath)}:`);

if (results.dependencies.length > 0) {
console.log("Unused dependencies:");
results.dependencies.forEach((dep) => console.log(` - ${dep}`));
} else {
console.log("No unused dependencies found.");
}

if (results.devDependencies.length > 0) {
console.log("Unused devDependencies:");
results.devDependencies.forEach((dep) => console.log(` - ${dep}`));
} else {
console.log("No unused devDependencies found.");
}

return {
dependencies: results.dependencies,
devDependencies: results.devDependencies,
};
}

async function checkAllWorkspaces() {
const workspaces = fs.readdirSync(workspacesDir);
const workspaceUnusedDeps = {};

for (const workspace of workspaces) {
const workspacePath = path.join(workspacesDir, workspace);
if (fs.statSync(workspacePath).isDirectory()) {
const { dependencies, devDependencies } =
await checkWorkspace(workspacePath);
const unusedDeps = [...dependencies, ...devDependencies];
if (unusedDeps.length > 0) {
workspaceUnusedDeps[workspace] = unusedDeps;
}
}
}

console.log("\n--- Commands to Remove Unused Dependencies ---");
let hasUnusedDeps = false;
for (const [workspace, deps] of Object.entries(workspaceUnusedDeps)) {
if (deps.length > 0) {
hasUnusedDeps = true;
const uninstallCommand = `npm uninstall ${deps.join(" ")} -w demos/${workspace}`;
console.log(`\n$ ${uninstallCommand}`);
}
}

if (!hasUnusedDeps) {
console.log("\nNo unused dependencies found across all workspaces.");
}
}

checkAllWorkspaces().catch(console.error);
2 changes: 0 additions & 2 deletions demos/backdrop-and-cables/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@
"dependencies": {
"@react-three/drei": "^9.109.5",
"@react-three/fiber": "^8.17.5",
"@react-three/postprocessing": "^2.16.2",
"leva": "^0.9.35",
"react": "^18.3.1",
"react-dom": "^18.3.1",
"three": "^0.165.0"
Expand Down
1 change: 0 additions & 1 deletion demos/basic-ballpit/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
"dependencies": {
"@react-three/cannon": "^6.6.0",
"@react-three/fiber": "^8.17.5",
"@react-three/postprocessing": "^2.16.2",
"nice-color-palettes": "^3.0.0",
"react": "^18.3.1",
"react-dom": "^18.3.1",
Expand Down
3 changes: 0 additions & 3 deletions demos/bestservedbold-christmas-baubles/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,10 @@
"baubles"
],
"dependencies": {
"@react-three/cannon": "^6.6.0",
"@react-three/drei": "^9.109.5",
"@react-three/fiber": "^8.17.5",
"@react-three/postprocessing": "^2.16.2",
"@react-three/rapier": "^1.4.0",
"leva": "^0.9.35",
"maath": "^0.5.3",
"react": "^18.3.1",
"react-dom": "^18.3.1",
"three": "^0.165.0"
Expand Down
2 changes: 0 additions & 2 deletions demos/bezier-curves-and-nodes/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@
"@react-three/drei": "^9.109.5",
"@react-three/fiber": "^8.17.5",
"@use-gesture/react": "^10.3.1",
"leva": "^0.9.35",
"lodash-es": "^4.17.21",
"react": "^18.3.1",
"react-dom": "^18.3.1",
"three": "^0.165.0"
Expand Down
2 changes: 0 additions & 2 deletions demos/bloom-hdr-workflow-gltf/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@
"dependencies": {
"@react-three/drei": "^9.109.5",
"@react-three/fiber": "^8.17.5",
"@splinetool/loader": "^0.9.526",
"@splinetool/r3f-spline": "^1.0.1",
"react": "^18.3.1",
"react-dom": "^18.3.1",
"three": "^0.165.0"
Expand Down
3 changes: 1 addition & 2 deletions demos/bounds-and-makedefault/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@
"@react-three/fiber": "^8.17.5",
"react": "^18.3.1",
"react-dom": "^18.3.1",
"three": "^0.165.0",
"valtio": "^1.13.2"
"three": "^0.165.0"
},
"devDependencies": {
"@types/react": "^18.3.3",
Expand Down
1 change: 0 additions & 1 deletion demos/bruno-simons-20k-challenge/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
"@react-three/fiber": "^8.17.5",
"@react-three/postprocessing": "^2.16.2",
"@react-three/rapier": "^1.4.0",
"leva": "^0.9.35",
"react": "^18.3.1",
"react-dom": "^18.3.1",
"three": "^0.165.0"
Expand Down
1 change: 0 additions & 1 deletion demos/building-dynamic-envmaps/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
"@react-three/drei": "^9.109.5",
"@react-three/fiber": "^8.17.5",
"@react-three/postprocessing": "^2.16.2",
"lamina": "^1.1.23",
"leva": "^0.9.35",
"react": "^18.3.1",
"react-dom": "^18.3.1",
Expand Down
2 changes: 0 additions & 2 deletions demos/building-live-envmaps/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@
"@react-three/drei": "^9.109.5",
"@react-three/fiber": "^8.17.5",
"lamina": "^1.1.23",
"leva": "^0.9.35",
"r3f-perf": "^7.2.1",
"react": "^18.3.1",
"react-dom": "^18.3.1",
"three": "^0.165.0"
Expand Down
1 change: 0 additions & 1 deletion demos/camera-scroll/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
"dependencies": {
"@react-three/drei": "^9.109.5",
"@react-three/fiber": "^8.17.5",
"@react-three/postprocessing": "^2.16.2",
"react": "^18.3.1",
"react-dom": "^18.3.1",
"three": "^0.165.0"
Expand Down
3 changes: 0 additions & 3 deletions demos/cards-with-border-radius/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,9 @@
"homepage": "https://codesandbox.io/s/9s2wd9",
"keywords": [],
"dependencies": {
"@pmndrs/assets": "^1.6.0",
"@pmndrs/branding": "^0.0.8",
"@react-three/drei": "^9.109.5",
"@react-three/fiber": "^8.17.5",
"@react-three/postprocessing": "^2.16.2",
"random-words": "^2.0.1",
"react": "^18.3.1",
"react-dom": "^18.3.1",
"three": "^0.165.0"
Expand Down
1 change: 0 additions & 1 deletion demos/cards/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
"@pmndrs/branding": "^0.0.8",
"@react-three/drei": "^9.109.5",
"@react-three/fiber": "^8.17.5",
"@react-three/postprocessing": "^2.16.2",
"random-words": "^2.0.1",
"react": "^18.3.1",
"react-dom": "^18.3.1",
Expand Down
2 changes: 0 additions & 2 deletions demos/caustics/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@
"dependencies": {
"@react-three/drei": "^9.109.5",
"@react-three/fiber": "^8.17.5",
"@react-three/postprocessing": "^2.16.2",
"leva": "^0.9.35",
"react": "^18.3.1",
"react-dom": "^18.3.1",
"three": "^0.165.0"
Expand Down
2 changes: 0 additions & 2 deletions demos/clones/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@
"@pmndrs/branding": "^0.0.8",
"@react-three/drei": "^9.109.5",
"@react-three/fiber": "^8.17.5",
"@react-three/postprocessing": "^2.16.2",
"lamina": "^1.1.23",
"react": "^18.3.1",
"react-dom": "^18.3.1",
"three": "^0.165.0"
Expand Down
3 changes: 1 addition & 2 deletions demos/clouds/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@
"leva": "^0.9.35",
"react": "^18.3.1",
"react-dom": "^18.3.1",
"three": "^0.165.0",
"uuid": "^9.0.1"
"three": "^0.165.0"
},
"scripts": {
"dev": "vite --host",
Expand Down
1 change: 0 additions & 1 deletion demos/color-grading/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
"grading"
],
"dependencies": {
"@pmndrs/branding": "^0.0.8",
"@react-three/drei": "^9.109.5",
"@react-three/fiber": "^8.17.5",
"react": "^18.3.1",
Expand Down
1 change: 0 additions & 1 deletion demos/confetti/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
"confetti"
],
"dependencies": {
"@react-three/drei": "^9.109.5",
"@react-three/fiber": "^8.17.5",
"@react-three/postprocessing": "^2.16.2",
"leva": "^0.9.35",
Expand Down
1 change: 0 additions & 1 deletion demos/csg-bunny-usegroups/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
"@react-three/csg": "^2.2.0",
"@react-three/drei": "^9.109.5",
"@react-three/fiber": "^8.17.5",
"leva": "^0.9.35",
"react": "^18.3.1",
"react-dom": "^18.3.1",
"three": "^0.165.0"
Expand Down
1 change: 0 additions & 1 deletion demos/csg-house/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
"@react-three/csg": "^3.2.0",
"@react-three/drei": "^9.109.5",
"@react-three/fiber": "^8.17.5",
"@react-three/postprocessing": "^2.16.2",
"react": "^18.3.1",
"react-dom": "^18.3.1",
"three": "^0.165.0"
Expand Down
1 change: 0 additions & 1 deletion demos/dbismut-furniture/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
"@react-spring/three": "^9.7.1",
"@react-three/drei": "^9.109.5",
"@react-three/fiber": "^8.17.5",
"glsl-fxaa": "^3.0.0",
"react": "^18.3.1",
"react-dom": "^18.3.1",
"three": "^0.165.0"
Expand Down
1 change: 0 additions & 1 deletion demos/diamond-refraction/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
"@react-three/fiber": "^8.17.5",
"@react-three/postprocessing": "^2.16.2",
"leva": "^0.9.35",
"r3f-perf": "^7.2.1",
"react": "^18.3.1",
"react-dom": "^18.3.1",
"three": "^0.165.0"
Expand Down
1 change: 0 additions & 1 deletion demos/diamond-ring/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
"@react-three/drei": "^9.109.5",
"@react-three/fiber": "^8.17.5",
"@react-three/postprocessing": "^2.16.2",
"lamina": "^1.1.23",
"react": "^18.3.1",
"react-colorful": "^5.6.1",
"react-dom": "^18.3.1",
Expand Down
1 change: 0 additions & 1 deletion demos/ecctrl-fisheye/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
"@react-three/drei": "^9.109.5",
"@react-three/fiber": "^8.17.5",
"@react-three/rapier": "^1.4.0",
"@use-gesture/core": "^10.3.0",
"ecctrl": "^1.0.88",
"react": "^18.3.1",
"react-dom": "^18.3.1",
Expand Down
1 change: 0 additions & 1 deletion demos/flexbox-yoga-in-webgl/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
"homepage": "https://codesandbox.io/s/7psew",
"private": true,
"dependencies": {
"@react-spring/web": "^9.7.4",
"@react-three/drei": "^9.109.5",
"@react-three/fiber": "^8.17.5",
"@react-three/flex": "^1.0.1",
Expand Down
1 change: 0 additions & 1 deletion demos/floating-laptop/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
"@react-spring/web": "^9.7.4",
"@react-three/drei": "^9.109.5",
"@react-three/fiber": "^8.17.5",
"maath": "^0.5.3",
"react": "^18.3.1",
"react-dom": "^18.3.1",
"three": "^0.165.0"
Expand Down
1 change: 0 additions & 1 deletion demos/frosted-glass/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
],
"dependencies": {
"@pmndrs/branding": "^0.0.8",
"@react-spring/web": "^9.7.4",
"@react-three/drei": "^9.109.5",
"@react-three/fiber": "^8.17.5",
"framer-motion": "^10.18.0",
Expand Down
1 change: 0 additions & 1 deletion demos/gatsby-stars/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
"@pmndrs/branding": "^0.0.8",
"@react-three/drei": "^9.109.5",
"@react-three/fiber": "^8.17.5",
"lamina": "^1.1.23",
"maath": "^0.10.8",
"react": "^18.3.1",
"react-dom": "^18.3.1",
Expand Down
1 change: 0 additions & 1 deletion demos/gltf-animations-tied-to-scroll/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
"homepage": "https://codesandbox.io/s/hg3ejl",
"keywords": [],
"dependencies": {
"@react-spring/three": "^9.7.2",
"@react-three/drei": "^9.109.5",
"@react-three/fiber": "^8.17.5",
"@react-three/postprocessing": "^2.16.2",
Expand Down
1 change: 0 additions & 1 deletion demos/gltf-animations/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
"useanimations"
],
"dependencies": {
"@react-spring/three": "^9.6.1",
"@react-three/drei": "^9.109.5",
"@react-three/fiber": "^8.17.5",
"react": "^18.3.1",
Expand Down
3 changes: 0 additions & 3 deletions demos/gpgpu-curl-noise-dof/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,6 @@
"@react-three/drei": "^9.109.5",
"@react-three/fiber": "^8.17.5",
"babel-plugin-glsl": "^1.0.0",
"babel-plugin-macros": "^3.1.0",
"glsl-curl-noise2": "0.0.4",
"glsl-noise": "^0.0.0",
"leva": "^0.9.35",
"react": "^18.3.1",
"react-dom": "^18.3.1",
Expand Down
1 change: 0 additions & 1 deletion demos/ground-reflections-and-video-textures/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
"@pmndrs/branding": "^0.0.8",
"@react-three/drei": "^9.109.5",
"@react-three/fiber": "^8.17.5",
"postprocessing": "^6.36.0",
"react": "^18.3.1",
"react-dom": "^18.3.1",
"three": "^0.165.0"
Expand Down
2 changes: 0 additions & 2 deletions demos/horizontal-tiles/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,7 @@
"@react-three/fiber": "^8.17.5",
"react": "^18.3.1",
"react-dom": "^18.3.1",
"styled-components": "^5.3.11",
"three": "^0.165.0",
"three-stdlib": "^2.32.2",
"valtio": "^1.13.2"
},
"devDependencies": {
Expand Down
1 change: 0 additions & 1 deletion demos/html-input-fields/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
"@react-three/fiber": "^8.17.5",
"react": "^18.3.1",
"react-dom": "^18.3.1",
"react-use-caret-position": "^1.1.0",
"three": "^0.165.0"
},
"devDependencies": {
Expand Down
1 change: 0 additions & 1 deletion demos/image-gallery/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
"meshreflectormaterial"
],
"dependencies": {
"@pmndrs/branding": "^0.0.8",
"@react-three/drei": "^9.109.5",
"@react-three/fiber": "^8.17.5",
"maath": "^0.6.0",
Expand Down
1 change: 0 additions & 1 deletion demos/infinite-scroll/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
"@react-three/fiber": "^8.17.5",
"react": "^18.3.1",
"react-dom": "^18.3.1",
"styled-components": "^5.3.11",
"three": "^0.165.0"
},
"devDependencies": {
Expand Down
1 change: 0 additions & 1 deletion demos/instanced-vertex-colors/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
"instancing"
],
"dependencies": {
"@react-three/drei": "^9.109.5",
"@react-three/fiber": "^8.17.5",
"@react-three/postprocessing": "^2.16.2",
"nice-color-palettes": "^3.0.0",
Expand Down
1 change: 0 additions & 1 deletion demos/instances/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
"dependencies": {
"@react-three/drei": "^9.109.5",
"@react-three/fiber": "^8.17.5",
"leva": "^0.9.35",
"nice-color-palettes": "^3.0.0",
"react": "^18.3.1",
"react-dom": "^18.3.1",
Expand Down
Loading

0 comments on commit eec9029

Please sign in to comment.