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

Too many packages need to upgrade after lumos upgrading #585

Closed
homura opened this issue Dec 12, 2023 · 1 comment · Fixed by #588
Closed

Too many packages need to upgrade after lumos upgrading #585

homura opened this issue Dec 12, 2023 · 1 comment · Fixed by #588
Milestone

Comments

@homura
Copy link
Collaborator

homura commented Dec 12, 2023

Lumos has more than 15 scoped child packages @ckb-lumos/* in it, although Lumos provides an entry package @ckb-lumos/lumos to integrate them into one, however, it still doesn't meet its target of just importing one entry package, because not all exported modules in child packages are included.

We need to improve the @ckb-lumos/lumos to make the entry package more convenient for developers, so they don't need to import too many @ckb-lumos/*

@homura
Copy link
Collaborator Author

homura commented Dec 14, 2023

In the beginning, the first idea was to change @ckb-lumos/lumos's exports by migrating its export mode via the esmodule way. After a simple survey, I found that developers are more likely to use a default tsconfig.json without modifying its moduleResolution. Therefore, switching to esmodule directly isn't a feasible solution for the problem.

An option to consider is modifying @ckb-lumos/lumos's build script to generate compiled .js files in its root instead of in the lib directory, also exporting modules that are not exported but commonly used. So we can use it like this

import { Uint32, Uint64 } from '@ckb-lumos/lumos/codec/number'
import { option } from '@ckb-lumos/lumos/codec/molecule'

const DynamicNumberCodec = union({
  Uint32,
  Uint64
}, ['Uint32', 'Uint64'])

Wait, the @ckb-lumos/lumos is a bit too long, maybe we can change it to ckb-lumos, which I noticed is currently unregistered on npm. So we can just import lumos like this

import { Uint32, Uint64 } from 'ckb-lumos/codec/number'
import { helpers, utils } from 'ckb-lumos'

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

Successfully merging a pull request may close this issue.

1 participant