GithubHelp home page GithubHelp logo

linecode / rust-typescript-template Goto Github PK

View Code? Open in Web Editor NEW

This project forked from shaoruu/rust-typescript-template

0.0 0.0 0.0 470 KB

๐Ÿ“ A template for creating WASM + Typescript + Rust workflow libraries.

Home Page: https://iantheearl.github.io/rust-typescript-template/

License: MIT License

Rust 42.43% TypeScript 33.55% HTML 7.08% JavaScript 16.54% Shell 0.39%

rust-typescript-template's Introduction

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

rust-typescript-template's People

Contributors

shaoruu avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.