ruff icon indicating copy to clipboard operation
ruff copied to clipboard

Upload WASM packages for each release

Open charliermarsh opened this issue 2 years ago • 1 comments

charliermarsh avatar Dec 26 '22 19:12 charliermarsh

I was interested in uploading the wasm to npm and could contribute a PR to add this.

What would the desired npm package name be? @astral-sh/ruff?

mattrunyon avatar May 16 '24 00:05 mattrunyon

Charlie created a new astral-sh organisation.

I would call it @astral-sh/ruff-api just to give us the option to publish the ruff binary to NPM in the future (we don't plan on doing this but you can never know).

What's important to me is that we very clearly mark the package as experimental. I suspect significant API changes to the linter API with the work of red-knot (multifile analysis).

@mattrunyon I suspect you need me to initialize an empty package to get started?

MichaReiser avatar May 27 '24 15:05 MichaReiser

I don't think an empty package needs to be created.

The main question would be how does this get handled w/ your organization's versioning/changelog tool. It looks like the package version is not available to the Rust workspaces, but is updated in just the published files (I think via some internal tool?). Without knowing how to tell that tool to update the cargo file version field for ruff_wasm, it could just be a step in the CI job that replaces the version (e.g. with sed) before running wasm-pack. The cargo version is used in the generated package.json.

mattrunyon avatar May 28 '24 16:05 mattrunyon

We use rooster for our release process and it can bump the version number for you.

All you need to do is to list the ruff_wasm/Cargo.toml in the version_files section

https://github.com/astral-sh/ruff/blob/49a5a9ccc2b6b8f69bb64f87d3a915aff47eb02a/pyproject.toml#L107-L113

MichaReiser avatar May 29 '24 08:05 MichaReiser

I'm really interested in this. While working on ViperIDE for MicroPython ( https://viper-ide.org ) I integrated the mpy-cross compiler using WebAssembly and it does report syntax errors. But it's not nearly as cool as ruff :) Being able to install ruff as an NPM package would simplify things a lot.

I'm using CodeMirror 6 editor and bundling it with Rollup.

vshymanskyy avatar Jul 12 '24 11:07 vshymanskyy

Just some feedback. It was really easy to integrate ruff, the Workspace API is simple and clear, bundling with Rollup works like a charm. Kudos to the ruff team!

If anyone needs a CodeMirror 6 linter, see https://github.com/vshymanskyy/ViperIDE/blob/main/src/editor.js#L203

image

vshymanskyy avatar Jul 13 '24 17:07 vshymanskyy

The first version of the packages are up!

  • Node.js: https://www.npmjs.com/package/@astral-sh/ruff-wasm-nodejs
  • Bundler: https://www.npmjs.com/package/@astral-sh/ruff-wasm-bundler
  • Web: https://www.npmjs.com/package/@astral-sh/ruff-wasm-web

dhruvmanila avatar Jul 18 '24 18:07 dhruvmanila

Awesome, thank you

vshymanskyy avatar Jul 18 '24 20:07 vshymanskyy