All Projects → iantheearl → rust-typescript-template

iantheearl / rust-typescript-template

Licence: MIT license
📝 A template for creating WASM + Typescript + Rust workflow libraries.

Programming Languages

rust
11053 projects
typescript
32286 projects
javascript
184084 projects - #8 most used programming language
HTML
75241 projects
shell
77523 projects

Projects that are alternatives of or similar to rust-typescript-template

rust-wasm-on-lambda-edge
Rust/WASM on AWS Lambda@Edge (CloudFront)
Stars: ✭ 12 (-52%)
Mutual labels:  wasm-pack
mine.js
🌏 A voxel engine built with JS/TS/RS. (formerly mc.js) (maybe mine.ts? or even mine.rs?)
Stars: ✭ 282 (+1028%)
Mutual labels:  shaoruu

Create Rust + TypeScript libraries with ease! PR'S WELCOMED!

Inspiration

I wanted to create a WebAssembly/Rust library with additional JS features, but I couldn't find any resources on how to integrate the npm-ready library built by wasm-pack with TypeScript. All the examples online either seemed to use the output of wasm-pack using npm link, or didn't have TypeScript support. So, I created this, a template that allows you to embed wasm-pack all within one single TypeScript-based library. Enjoy!

🏗️ Install

Before development, make sure you have installed:

# clone the repo
git clone --depth 1 --branch master https://github.com/iantheearl/rust-typescript-template.git your-project-name
cd your-project-name

# install dependencies
yarn

# start development
yarn run dev

# run example
yarn run example

# visit http://localhost:8080

After installation, start developing here:

  • ./pkg: Rust source files
  • ./src: TypeScript source files

🖨️ Publish

# build the library to ./dist, including .wasm
yarn build

# push to npm
npm publish --access public

📺 Deployment

# build the example to `./example/build`, and push that folder to the gh-pages branch
yarn deploy

Configure github to deploy branch gh-pages.

📂 Structure

  • ./core: Rust code, the core of your library
  • ./pkg: wasm-pack built npm-ready library
  • ./src: TypeScript source code, where u can import from wasm-pack
  • ./example: A web app that uses your library directly from ./dist
  • ./tests: To test your library

License

MIT © Rust TypeScript Template

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].