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

Lumos: dependencies or peerDependencies #64

Open
ShookLyngs opened this issue Jan 11, 2024 · 3 comments
Open

Lumos: dependencies or peerDependencies #64

ShookLyngs opened this issue Jan 11, 2024 · 3 comments
Assignees
Labels
blocker Something blocks us

Comments

@ShookLyngs
Copy link
Collaborator

ShookLyngs commented Jan 11, 2024

Lumos is a collection of packages that developers commonly use for developing dapps on CKB. It serves as a foundation for the spore-sdk and plays a significant role in managing cells and witnesses.

However, I sometimes encounter a dilemma. The spore-sdk lists lumos as a dependency in its package.json, but when lumos releases a new version, the spore-sdk doesn't automatically update to the latest version. It lags behind in this regard.

One potential solution is to move lumos from dependencies to peerDependencies. This allows developers to freely choose which version of lumos they want to use. However, this solution has a drawback: unlike dependencies, developers must manually specify and install peerDependencies into their dapp projects (as dependencies or devDependencies).

In conclusion:

  • If specify in dependencies:
    • Pro - Developers don't have to manually manage lumos in most cases
    • Con - When lumos has a breaking update/fix, the spore-sdk must also release a new version
  • If specify in peerDependencies:
    • Pro - Developers can freely choose which version of lumos they want to use
    • Con - Developers must manually specify and install lumos in their dapp projects
@ashuralyk ashuralyk added the blocker Something blocks us label Jan 19, 2024
@homura
Copy link

homura commented Jan 19, 2024

It depends on how users utilize the Spore SDK.

If we only require Spore SDK methods and not other Lumos methods, then installing the Spore SDK is better.

However, if we need other CKB-related methods in most situations when using Spore SDK, then it's more flexible to use peerDependencies with a ranged version. This approach would be beneficial since we only need one Lumos in the build to create a lighter production build.

BTW, Lumos has refactored the entry package @ckb-lumos/lumos from 0.22, and we don't need to import several child packages in most cases. This will make it simpler when Spore SDK chooses the peerDependencies solution

"@ckb-lumos/bi": "^0.22.0-next.3",
"@ckb-lumos/rpc": "^0.22.0-next.3",
"@ckb-lumos/base": "^0.22.0-next.3",
"@ckb-lumos/lumos": "^0.22.0-next.3",
"@ckb-lumos/codec": "^0.22.0-next.3",
"@ckb-lumos/config-manager": "^0.22.0-next.3",
"@ckb-lumos/common-scripts": "^0.22.0-next.3",

@ashuralyk
Copy link
Collaborator

@ShookLyngs this issue gets a potential resolution for a better experience?

@ShookLyngs
Copy link
Collaborator Author

ShookLyngs commented Jan 31, 2024

this issue gets a potential resolution for a better experience?

For now, I suggest we keep the lumos family in the dependencies. Moving them to peerDependencies can potentially introduce other unexpected issues for developers (too many peer dependencies), which is not our intention.

Regarding the improvement resolution, as homura mentioned, if we can reduce the lumos-related dependency count in the spore-sdk, such as only having @ckb-lumos/lumos as a dependency, we can consider moving it to the peerDependencies. This change is unlikely to cause troubles for developers.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
blocker Something blocks us
Projects
None yet
Development

No branches or pull requests

3 participants