rustwasm / wasm-pack

📦✨ your favorite rust -> wasm workflow tool!
https://rustwasm.github.io/wasm-pack/
Apache License 2.0
6.32k stars 409 forks source link

`wasm-pack fake` so CI tests and the like don't have to do any rust compilation #1337

Open SIGSTACKFAULT opened 1 year ago

SIGSTACKFAULT commented 1 year ago

💡 Feature description

add wasm-pack fake <package name> which generates a fake package to make TypeScript happy, and puts it right in node_modules.
So CI jobs don't have to spend like 5 minutes building rust just to type-check the TypeScript part of the project.

If you want to check against the WASM bindings you can just not use this feature.

I think the name of the module you want should be an argument so that, you don't even need to have the rust code (e.g., if it's in a submodule and you don't want to waste time downloading)

💻 Basic example

I think all that's necessary is to generate:

node_modules/foo/package.json

{
  "name": "foo",
  "types": "foo.d.ts"
}

node_modules/foo/foo.d.ts

declare module "foo";
SIGSTACKFAULT commented 1 year ago

epic issue number