carton
carton copied to clipboard
Publish `carton` as npm package
Based on a discussion with one of our users, it would make sense to publish carton
on npm, similarly to how esbuild
or swc
provide binaries on npm. This would allow users primarily relying on npm to integrate carton
and its commands into their npm-based workflow.
A side benefit of this would be that anyone with Node installed would be able to run npx carton dev
with no other install required.
FWIW: wasm-pack provides similar package https://github.com/rustwasm/wasm-pack/tree/master/npm
We need to take into account https://github.com/apple/swift-package-manager/pull/3905. Until that's merged, we'll have to build with --static-swift-stdlib
on Linux. Which we probably should be doing already anyway?
Potential API for the package to be callable from other build tools (suggested by @ephemer)
const carton = require("carton");
carton.build("/package/to/package.swift").then(result => {
console.log(result.wasmPath)
console.log(result.javascriptSource)
});
It now became a SwiftPM Plugin, so don't need to publish it as npm package now.