Adding Bundle as another Distribution kind #211
Replies: 2 comments 2 replies
-
|
Thanks for the great proposal! We just had a similar discussion with @stephengoldbaum where we concluded that we should add a new This means that we need a variant of So maybe we need something like this (simplified for readability): type Distribution
= Library PackageName (Dict PackageName Package.Specification) Package.Definition
| Application PackageName (Dict PackageName Package.Definition) Package.DefinitionSo basically the same structure but dependencies would be definitions instead. We could also aggressively tree-shake the dependencies like Elm does so that it only includes the types/values that the application actually uses (transitively). When we build such an Here's a somewhat related discussion for more context: #160 |
Beta Was this translation helpful? Give feedback.
-
|
I would also suggest that we allow the inclusion of the Morphir.SDK in the Application bundle,. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Idea: Adding Bundle to Distribution
Morphir contains a datastructure known as Distribution which is used to model the definitions and dependencies of a Package.
For reference, the current
Elmdefinition ofDistributionlooks like the following:This shows that
Distributioncurrently only has a single case/variant ofLibrary.The library datastructure allows you to specify the following:
While this is great for describing a single library, in an ideal world we would have a complimentary
Distributionformat which describes all the modules used across multiple packages, or put differently, we need to be able to describe not just the specification of dependencies, but the actual full definition of the package dependencies.What we really want is a way to bundle all the modules/packages together in one distribution.
Suggested Idea
Add an additional case of
Distributionknown asBundlethat captures all package definitions in the bundle.This would look something like the following:
Why Add This?
This additional representation, allows us to create the equivalent of a "fatjar" or Javascript bundle (like those produced by webpack or Parcel) which contains all the dependencies of a library in a single "packaged" IR file.
Potential Tooling Support
The
Bundledistribution option will allow us to support combining Morphir libraries and standalone IR files using a bundle CLI command.Imagine a case where we have 2 Morphir IR files:
Given the existence of the
Bundlevariant ofDistributionwe can implement a command such as the one specified below, which would allow you to bundle together two or moreDistributionsinto a singleDistribution.For example:
~/code/my-repo:$ morphir bundle -o dist/morphir-ir.json App/morphir-ir.json My.Company.Commons/morphir-ir.json Shared/morphir-ir.jsonOpen Question
Would it make more sense to make
Bundlemodeled more like a dictionary of dependencies and definition (essentially a dictionary of the library contents), like below (or some variation of this)?Beta Was this translation helpful? Give feedback.
All reactions