Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace find-pkg and friends with empathic or fd-package-json #158

Open
43081j opened this issue Feb 3, 2025 · 3 comments
Open

Replace find-pkg and friends with empathic or fd-package-json #158

43081j opened this issue Feb 3, 2025 · 3 comments
Labels
umbrella issue This issue contains a list of dependents of a package and tracks the progress in each

Comments

@43081j
Copy link
Collaborator

43081j commented Feb 3, 2025

Packages such as these:

and more, can all be replaced by empathic:

https://github.com/lukeed/empathic

this is much faster and usually smaller to install

empathic is ESM only. if that blocks us, we can use fd-package-json to find the closest package.json. but there is no obvious replacement for the generic case. you could use walk-up-path but would need more inline logic

with require(esm) being in all LTS of node now, we may be able to use empathic still if the projects have a high enough engine requirement

@43081j 43081j added the umbrella issue This issue contains a list of dependents of a package and tracks the progress in each label Feb 3, 2025
@talentlessguy
Copy link

find-pkg

# Downloads Traffic Version Package
1 4.50M 12.33 GB ^0.1.2 cwd
2 3.32M 9.08 GB 2.0.0 @module-federation/managers
3 3.31M 9.08 GB 2.0.0 @module-federation/manifest
4 2.95M 8.10 GB 2.0.0 @module-federation/third-party-dts-extractor
5 131.97k 361.60 MB ^2.0.0 load-pkg

find-file-up's only major dependent is find-pkg

find-up-simple

# Downloads Traffic Version Package
1 192.34M 500.84 GB ^1.0.0 pkg-dir
2 101.35M 263.91 GB ^1.0.0 read-pkg-up
3 8.02M 20.87 GB ^1.0.0 pkg-conf
4 5.50M 14.32 GB ^1.0.0 preferred-pm
5 3.19M 8.31 GB ^1.0.0 read-package-up
6 2.03M 5.29 GB ^1.0.0 cspell-gitignore
7 291.64k 759.43 MB ^1.0.0 package-config
8 289.38k 753.55 MB ^1.0.0 xo
9 130.27k 339.23 MB ^1.0.0 package-up
10 342 890.57 KB ^1.0.0 @flowr/eslint-config

find-up

# Downloads Traffic Version Package
1 148.02M 574.78 GB ^5.0.0 eslint
2 78.84M 306.14 GB ^4.1.0 @istanbuljs/load-nyc-config
3 29.83M 115.82 GB ^5.0.0 mocha
4 27.40M 106.40 GB ^6.2.0 pkg-up
5 14.34M 55.70 GB ^5.0.0 react-dev-utils
6 12.78M 49.62 GB ^4.1.0 nyc
7 11.38M 44.19 GB ^7.0.0 @commitlint/top-level
8 8.21M 31.90 GB ^5.0.0 @sentry/bundler-plugin-core
9 8.07M 31.34 GB ^5.0.0 @react-native-community/cli-tools
10 7.67M 29.78 GB ^5.0.0 @storybook/preset-react-webpack
11 6.95M 27.00 GB ^5.0.0 c8
12 6.49M 25.19 GB ^5.0.0 @storybook/cli
13 6.47M 25.13 GB ^5.0.0 @react-native-community/cli
14 5.03M 19.52 GB ^5.0.0 @storybook/react-vite
15 4.94M 19.19 GB ^4.1.0 @storybook/semver
16 3.69M 14.32 GB ^5.0.0 @storybook/nextjs
17 3.63M 14.11 GB ^5.0.0 expo-modules-autolinking
18 3.44M 13.37 GB ^5.0.0 @expo/package-manager
19 3.35M 13.03 GB ^5.0.0 pretty-quick
20 3.33M 12.93 GB ^5.0.0 @storybook/builder-webpack4
21 3.26M 12.65 GB ^5.0.0 @storybook/manager-webpack4
22 2.64M 10.25 GB ^5.0.0 @expo/xcpretty
23 2.49M 9.67 GB ^5.0.0 @expo/fingerprint
24 2.29M 8.88 GB ^5.0.0 @vanilla-extract/integration
25 2.08M 8.09 GB ^5.0.0 @storybook/manager-webpack5
26 1.85M 7.17 GB ^3.0.0 dotgitignore
27 1.77M 6.89 GB ^5.0.0 eslint-plugin-compat
28 1.60M 6.22 GB ^5.0.0 jest-expo
29 1.41M 5.46 GB ^5.0.0 standard-version
30 1.27M 4.93 GB ^5.0.0 @pnpm/find-workspace-dir
31 923.39k 3.59 GB ^5.0.0 @storybook/angular
32 841.06k 3.27 GB ^5.0.0 hardhat blocked by CommonJS
33 820.03k 3.18 GB ^6.0.0 @netlify/zip-it-and-ship-it
34 793.62k 3.08 GB ^5.0.0 prettier-eslint-cli
35 745.83k 2.90 GB ^5.0.0 detox
36 685.30k 2.66 GB ^5.0.0 @embroider/macros
37 657.53k 2.55 GB 6.3.0 @cypress/webpack-dev-server
38 617.81k 2.40 GB ^3.0.0 libnpmconfig
39 605.84k 2.35 GB ^2.1.0 magicli
40 594.29k 2.31 GB 5.0.0 renovate
41 591.82k 2.30 GB ^2.1.0 codeowners
42 583.62k 2.27 GB 5.0.0 orval
43 572.74k 2.22 GB ^6.0.0 @netlify/config
44 526.16k 2.04 GB ^5.0.0 ember-cli
45 501.70k 1.95 GB 5.0.0 @lerna/legacy-package-management
46 500.23k 1.94 GB ^5.0.0 @linaria/utils
47 487.45k 1.89 GB ^7.0.0 @eslint/config-inspector
48 486.24k 1.89 GB ^5.0.0 @electron-forge/core
49 481.10k 1.87 GB ^5.0.0 @electron-forge/core-utils
50 461.08k 1.79 GB ^5.0.0 ember-compatibility-helpers

pkg-dir

# Downloads Traffic Version Package
1 109.10M 219.72 GB ^7.0.0 find-cache-dir
2 86.81M 174.84 GB ^4.2.0 import-local
3 5.32M 10.72 GB <6 >=5 find-yarn-workspace-root2
4 2.91M 5.87 GB ^7.0.0 @pulumi/pulumi
5 1.96M 3.94 GB 5.0.0 @appium/support
6 1.46M 2.93 GB ^5.0.0 node-stdlib-browser
7 1.21M 2.44 GB 5.0.0 @appium/docutils
8 958.06k 1.93 GB ^5.0.0 npm-check
9 737.03k 1.48 GB ^3.0.0 hard-source-webpack-plugin
10 723.76k 1.46 GB ^4.2.0 yarn-or-npm

@rubiesonthesky
Copy link

Changing from find-up to find-up-simple halves the size of used library. Of course, if it's only used for finding package.json then changing to fd-package-json or similar could be better.

@talentlessguy
Copy link

Also to note, Node.js is shipping findPackageJSON soon

nodejs/node#55412

would be useful for packages targeting node 20.x and higher

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
umbrella issue This issue contains a list of dependents of a package and tracks the progress in each
Projects
None yet
Development

No branches or pull requests

3 participants