Skip to content

Publish carton as npm package #336

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

Closed
MaxDesiatov opened this issue May 12, 2022 · 5 comments
Closed

Publish carton as npm package #336

MaxDesiatov opened this issue May 12, 2022 · 5 comments
Labels
continuous integration Continuous integration changes enhancement New feature or request

Comments

@MaxDesiatov
Copy link
Collaborator

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.

@MaxDesiatov MaxDesiatov added enhancement New feature or request continuous integration Continuous integration changes labels May 12, 2022
@j-f1
Copy link
Member

j-f1 commented May 12, 2022

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.

@kateinoigakukun
Copy link
Member

kateinoigakukun commented May 12, 2022

FWIW: wasm-pack provides similar package https://github.com/rustwasm/wasm-pack/tree/master/npm

@MaxDesiatov
Copy link
Collaborator Author

We need to take into account swiftlang/swift-package-manager#3905. Until that's merged, we'll have to build with --static-swift-stdlib on Linux. Which we probably should be doing already anyway?

@MaxDesiatov
Copy link
Collaborator Author

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)
});

MaxDesiatov added a commit that referenced this issue May 31, 2022
In theory, this should allow us to distribute self-contained binaries on Linux. These wouldn't be statically linked completely, but at least they should no longer depend on a separate dynamic library file with Swift stdlib.

Related to #336.
@kateinoigakukun
Copy link
Member

It now became a SwiftPM Plugin, so don't need to publish it as npm package now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
continuous integration Continuous integration changes enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants