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

refactor(core+parser) Move CTO parser/printer out of core into its own package #353

Merged
merged 8 commits into from
Dec 2, 2021

Conversation

jeromesimeon
Copy link
Member

@jeromesimeon jeromesimeon commented Nov 22, 2021

Signed-off-by: jeromesimeon [email protected]

Changes

This PR reorganizes the core Concerto code and API and splits it into three distinct packages:

  1. @accordproject/concerto-util now contains utilities which are fundamentally generic and independent from Concerto itself. Currently those include:
    • TypedStack a general purpose stack data structure
    • Logger logging utility functions, with color support
    • Writer a file writer
    • *Loader classes for resolving URIs into their content with some built-in support for http and git URIs.
  2. @accordproject/concerto-cto now contains support for CTO syntax including the parser, parse errors, and a pretty printer. The parser and pretty printer are base on instance of the concerto metamodel.
  3. @accordproject/concerto-core the core support for building models (from instances of the metamodel) validating models, validating instances of the model, etc

Flags

  • This is a breaking change
  • The parser package still is a dependency for the core package (only used in the model manager)

Main breaking changes

  1. The TypedStack class has been moved from @accordproject/concerto-core to @accordproject/concerto-util
  2. The Writer class has been movedfrom @accordproject/concerto-core to @accordproject/concerto-util
  3. The Logger class has been moved from @accordproject/concerto-core to @accordproject/concerto-util
  4. The *ModelFileLoader classes have been moved from @accordproject/concerto-core to @accordproject/concerto-util and renamed to *FileLoader (no Model)
  5. The parser and ParseException class have been moved from @accordproject/concerto-core to @accordproject/concerto-cto
  6. The metamodel to CTO printer has been moved from @accordproject/concerto-core to @accordproject/concerto-cto
  7. The ModelFile class now takes a metamodel instance (a concerto AST) as input rather than a cto string
  8. The CLI commands concerto import and concerto export have been renamed to concerto parse and concerto print

@jeromesimeon jeromesimeon requested a review from dselman November 22, 2021 14:21
@jeromesimeon jeromesimeon force-pushed the js-parser-package branch 3 times, most recently from 2e6b96e to 88aac16 Compare November 22, 2021 14:54
@jeromesimeon jeromesimeon force-pushed the js-meta-parser branch 2 times, most recently from e84e4e7 to 56060e0 Compare November 22, 2021 17:16
Base automatically changed from js-meta-parser to master November 22, 2021 17:44
@jeromesimeon jeromesimeon force-pushed the js-parser-package branch 9 times, most recently from eb436be to 47d9d37 Compare November 24, 2021 20:49
@jeromesimeon jeromesimeon requested a review from mttrbrts December 1, 2021 14:40
@jeromesimeon jeromesimeon marked this pull request as ready for review December 1, 2021 14:40
@jeromesimeon jeromesimeon changed the title WIP(parser) Move CTO parser/printer out of core into its own package refactor(core+parser) Move CTO parser/printer out of core into its own package Dec 1, 2021
Copy link
Contributor

@dselman dselman left a comment

Choose a reason for hiding this comment

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

Awesome - very clean! Just a couple of minor comments...

packages/concerto-core/lib/introspect/modelfile.js Outdated Show resolved Hide resolved
packages/concerto-core/lib/introspect/modelfile.js Outdated Show resolved Hide resolved
packages/concerto-core/lib/modelmanager.js Show resolved Hide resolved
@jeromesimeon jeromesimeon merged commit c641751 into master Dec 2, 2021
@jeromesimeon jeromesimeon deleted the js-parser-package branch December 2, 2021 20:19
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.

2 participants