-
Notifications
You must be signed in to change notification settings - Fork 35
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
CIP-25 build script #160
CIP-25 build script #160
Conversation
CIP-25 was used as an experiment to try out the new split crate architecture. The build scripts were adapted to work for this new format. The old build scripts are moved to `/scripts/legacy/`. This should allow us to have per wasm target npm crates as well. If this works out, we'll adapt the other WASM crates to use this build structure too.
cip25-wasm/package.json
Outdated
"rust:check-warnings": "(RUSTFLAGS=\"-D warnings\" cargo +stable build)", | ||
"rust:test": "cargo test", | ||
"js:prepublish": "npm run rust:test && rimraf ./publish && cp -r ./pkg ./publish && cp README.md publish/ && cp LICENSE publish/", | ||
"js:test-publish": "npm run rust:build-nodejs && npm run js:prepublish && node ../scripts/publish-helper cip25 cip25_wasm -nodejs && cd publish", |
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.
We can remove this one. I just had it here to test out the publishing scripts since I had never used them and wasn't sure if running npm publish
would do anything I didn't want to happen.
"license": "MIT", | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/dcSpark/cardano-multiplatform-lib.git" |
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.
Will having multiple npm packages all linking to this repo be fine?
The extent of testing I've done with this has been to run the scripts and make sure that the JSON definitions are properly inserted into the resulting |
scripts/publish-helper.js
Outdated
oldPkg.files = [ | ||
'cardano_multiplatform_lib.asm.js', | ||
...oldPkg.files.filter(file => file !== 'cardano_multiplatform_lib_bg.wasm') | ||
`cardano_multiplatform_lib_${pkgModName}.asm.js`, |
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.
this can be a constant probably?
looks good, not sure what's the best way to test publishing part, other things work fine |
|
"rust:build-nodejs": "rimraf ./pkg; wasm-pack build --target=nodejs; npm run js:ts-json-gen; wasm-pack pack", | ||
"rust:build-browser": "rimraf ./pkg; wasm-pack build --target=browser; npm run js:ts-json-gen; wasm-pack pack", | ||
"rust:build-web": "rimraf ./pkg; wasm-pack build --target=web; npm run js:ts-json-gen; wasm-pack pack", | ||
"rust:publish": "cargo publish", |
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.
Do we really want to publish the WASM repo? Or are we instead trying to publish the non-WASM crate?
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.
I thought we wanted to publish the WASM crates to NPM and the rust ones to crates.io? I just copied what we had in the old build script but with a per-crate (or at least per end-user crate) approach. I don't know how the actual process works after that though since it was always done by someone else which is why I asked if there was a problem with having multiple packages referring to one repo.
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.
yeah, the other publish commands are correct. I was referring specifically to cargo publish
, since I assume what we want to publish to crates.io is not the WASM crate, but rather the non-WASM crate. I could be wrong on this though
CIP-25 was used as an experiment to try out the new split crate architecture. The build scripts were adapted to work for this new format. The old build scripts are moved to
/scripts/legacy/
. This should allow us to have per wasm target npm crates as well. If this works out, we'll adapt the other WASM crates to use this build structure too.