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

feat: codegen for molecule #635

Merged
merged 5 commits into from
Feb 28, 2024
Merged

feat: codegen for molecule #635

merged 5 commits into from
Feb 28, 2024

Conversation

homura
Copy link
Collaborator

@homura homura commented Feb 22, 2024

Description

Fixes #630

This PR introduces a cli lumos-molecule-codegen to generate code from molecule schemas.

Currently, there are some limitations of this codegen, such as

Type of change

Please delete options that are not relevant.

  • New feature (non-breaking change which adds functionality)

How Has This Been Tested?

  • unit test
  • manually test via example

Copy link

vercel bot commented Feb 22, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
lumos-website ✅ Ready (Inspect) Visit Preview Feb 27, 2024 3:09am

@homura homura changed the title feat: export layout def to ensure tsc can infer types feat: codegen for molecule Feb 22, 2024
Copy link

codecov bot commented Feb 22, 2024

Codecov Report

Attention: Patch coverage is 96.89441% with 10 lines in your changes are missing coverage. Please review.

Project coverage is 84.17%. Comparing base (ad483d9) to head (2142ad6).
Report is 1 commits behind head on develop.

Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff             @@
##           develop     #635      +/-   ##
===========================================
- Coverage    87.06%   84.17%   -2.89%     
===========================================
  Files          118      120       +2     
  Lines        24049    24356     +307     
  Branches      2442     2341     -101     
===========================================
- Hits         20938    20502     -436     
- Misses        3068     3813     +745     
+ Partials        43       41       -2     
Files Coverage Δ
packages/codec/src/molecule/index.ts 100.00% <100.00%> (ø)
packages/codec/src/molecule/layout.ts 99.55% <100.00%> (+0.02%) ⬆️
packages/codec/src/number/uint.ts 100.00% <100.00%> (ø)
packages/molecule/src/circularIterator.ts 100.00% <100.00%> (ø)
packages/molecule/src/codegen.ts 95.95% <95.95%> (ø)

... and 9 files with indirect coverage changes


Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update ad483d9...2142ad6. Read the comment docs.

@homura homura requested a review from Keith-CY February 22, 2024 13:01
@homura homura marked this pull request as ready for review February 22, 2024 13:02
@homura
Copy link
Collaborator Author

homura commented Feb 23, 2024

The first version of the codegen doesn't support the import statement of Molecule yet. To deal with the cases of importing other schemas, the codegen CLI also needs to

  1. resolve all import schema items
  2. remove the intersection with prepend
  3. append them to the prepend

Copy link
Contributor

@PainterPuppets PainterPuppets left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Amazing work!

It seems that cli can only read schemaFile from config file, it would be better if it supports setting by args.

@homura
Copy link
Collaborator Author

homura commented Feb 28, 2024

It seems that cli can only read schemaFile from config file, it would be better if it supports setting by args.

Exactly, we can make the CLI easier to use later

@homura homura merged commit 3f37c5b into develop Feb 28, 2024
8 of 9 checks passed
@homura homura deleted the molecule-codegen branch February 28, 2024 11:12
@github-actions github-actions bot mentioned this pull request Feb 28, 2024
@github-actions github-actions bot mentioned this pull request Mar 12, 2024
@homura homura mentioned this pull request Mar 12, 2024
3 tasks
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 this pull request may close these issues.

Public the child package @ckb-lumos/parser to work with custom molecule structures without manual binding
2 participants