-
-
Notifications
You must be signed in to change notification settings - Fork 45
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
Implement carton bundle
command
#16
Comments
If Personally I would prefer Just my 2 cents, just tried SwiftWASM and it's good. Saw this wandering throughout repos so sorry for suddenly dropping a comment from nowhere. 😅 |
Yes, this is exactly what we're doing already for
Great point about warning users, this is definitely something I think would be great to implement 👍
Thanks for your feedback, and no problem at all. 🙂 I definitely do want people to feel free leaving their feedback. It's all still at an early stage, but the more feedback we have, the better we can become. All feedback and contributions are very welcome where you have it, that's why all the development is open and I hope is as transparent as possible. |
New `bundle.js` entrypoint is added, which only differs from `dev.js` in the lack of the WebSocket hot reloading bit. `wabt` and `binaryen` Homebrew dependencies are added as required for `wasm-strip` and `wasm-opt` respectively that reduce the resulting bundle binary size. All resulting bundle files except `index.html` are named by their content hashes to enable [cache busting](https://www.keycdn.com/support/what-is-cache-busting). Resolves #16.
This command should invoke
swift build
(reusing the toolchain inference code that's already used bycarton dev
andcarton sdk
) in the directory for the only executable product, or a product specified with the--product
option, similar to howcarton dev
infers a product to build. It should build the app in the release mode withswift build -c release
, possibly passing-Osize
flag toswiftc
if it the release configuration doesn't do this by default already. After that, it should look for the presence ofwasm-strip
andwasm-opt
on the system and apply size optimizations with those if present, otherwise suggesting to install corresponding WABT and binaryen packages (via Homebrew on macOS).We also need a new
bundle.js
JavaScript entrypoint, similar to what we have withdev.js
, but without the WebSocket bits, as the release bundle doesn't need hot reloads. This entrypoint should also by compiled bywebpack
in prod mode for size optimizations. The only question I don't have a clear answer to is, what the final bundle directory should be to whichcarton bundle
writes the output? A few suggestions:.build/bundle/wasm
, means that the generated fails get ignored by Git most probably (since.build
is in.gitignore
most of the time)Bundle
, capitalized for consistency withSources
andTests
CartonBundle
, in caseBundle
is used by other tools, but this one seems a bit verbose to me.I have a slight preference towards the first option as these files are not supposed to be added to the repository in most of the cases, but the problem is that
.build
is not visible in Finder and other file managers by default, so I could see some beginner users not finding the final product on the file system. With directories likeBundle
we'd need users to explicitly opt out of committing the final products to their repository (again, most of the time, unless they don't have.build
in their.gitignore
yet, which would make this point applicable to the.build
option too).The text was updated successfully, but these errors were encountered: