-
Notifications
You must be signed in to change notification settings - Fork 16
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
Publish mosaic chains #75
Conversation
Ready for review 🦑 |
Closing and re-opening to trigger travis |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice 👍
Please see one inline comment.
One question: why version
and description
is removed ?
I think we should also be able to publish mosaic-config for the existing chains.
Addressed all in-line comments.
Please see the PR description. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice 💯
Overall LGTM.
Just a typo change.
@schemar, you should also consider publishing the mosaic configs. All config will be in a For now, you can consider them as empty JSON files. The actuals files will be added as they get available |
Done, ready for review again 🦑 |
Tests are failing. |
Will have a look. It seems another PR that was merged included wrong code so that compilation fails now. I did not work on the failing part. |
Co-Authored-By: Gulshan Vasnani <[email protected]>
Co-Authored-By: Deepesh Kumar Nath <[email protected]>
Ready for review again after rebasing 🦑 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice 🚀
Two questions/feedback:
-
Why do we expose these classes? Who is going to use them? they are more of internal implementation details of mosaic-chains in my opinion.
Directory, Logger, Node, NodeDescription, NodeFactory, Shell
-
How to access files published with mosaic-config directory? I try to publish this package locally using
npm link
but I couldn't access mosaic-config folder files. Am I missing something here? Or we need to expose mosaic-config files from index.ts?
I exposed all classes that were used in the executables, so that a consumer can write their own logic to run mosaic chains. For example,
Yes, you have to expose them in order for them to be available. |
I can see
Here, You == Consumer? |
As the ticket says, the idea is to publish mosaic chains as:
Anyone can use the library to run mosaic chains from within their JavaScript code. E.g. integration tests.
you == package maintainer (us). How would the consumer have access? Whenever a new mosaic config is added, it must be exported from the index file. |
OK, Fine with me. I am not sure if logic written in mosaic command file should be considered for exposing to the consumer.
Another approach can be a small script which read all the files in the mosaic-config directory and expose them in the index. |
It's like any other package that is an executable and a library. For example mocha: I am obviously not able to explain this in a helpful way. Can someone else please try and explain it in their words? /cc @OpenST/maintainers
Yes, that is another approach. |
Moving this to the parking lot for now. |
Why can’t we merge this? 🤔 |
Very good, I like #90 as a follow-up 👍 |
Fixes #54
Packaging
A new script
package.sh
takes care of the packaging process.It compiles the TypeScript into the
./lib
directory as JavaScript.It also copies the
utility_chains
directory. It has to copy the directory so that the relative imports from within the JavaScript files don't break.Testing Packaging
The
./tests
directory has a new scriptpackage.sh
and a new directorypackage
.The
./tests/package.sh
script packages the mosaic chains project and installs the created package into a test project in./tests/package/
.It then accesses mosaic from
node_modules/.bin/mosaic
as well as from within a TypeScript file that imports the mosaic chains package.This asserts that the code is accessible in executable form as well as as library.
package.json
I kept the
version
at0.1.0-alpha.1
. Happy to set anything else.The
bin
,main
, andfiles
entries reference the compiled output inside./lib
.Scripts
package
is a new run script that packages mosaic chainsprepack
ensures that packaging is executed before any run ofnpm pack
ornpm publish
test
has the additionaltest:package
commandtest:package
tests the packaging as described aboveWeb3 Version
Because we depend on
@openst/mosaic.js
, we share web3 as a peer dependency with that package. Therefore, we cannot upgrade to a newer version of web3 as that breaks@openst/mosaic.js
.version
anddescription
ReferencesReferences from within the mosaic chains TypeScript files to the
package.json
file had to be removed. They resulted in apackage.json
file inside./lib
as part of the TypeScript compilation output. This./lib/package.json
was misleading thenpm pack
script and resulted in the wrong files being packaged.Therefore, version and description can no longer be read from
package.json
. I removed it completely so that we won't have values that are out-of-sync in the future.