Skip to content

Commit 53d6641

Browse files
Merge pull request #155 from ashleygwilliams/readme-redo
doc(readme): clean up readme and move some stuff to docs dir
2 parents 0cab05d + 0cb28e7 commit 53d6641

File tree

2 files changed

+81
-46
lines changed

2 files changed

+81
-46
lines changed

README.md

+37-46
Original file line numberDiff line numberDiff line change
@@ -1,56 +1,39 @@
11
# 📦✨ wasm-pack
2-
> pack up the wasm and publish it to npm!
2+
> Your favorite rust -> wasm workflow tool!
33
44
[![Build Status](https://travis-ci.org/ashleygwilliams/wasm-pack.svg?branch=master)](https://travis-ci.org/ashleygwilliams/wasm-pack)
55
[![Build status](https://ci.appveyor.com/api/projects/status/7jjuo5wewu9lyyfi?svg=true)](https://ci.appveyor.com/project/ashleygwilliams/wasm-pack)
66

7-
the goal of this project is to create a portable command line tool
8-
for publishing compiled wasm projects to the npm registry for the consumption
9-
of js devs using the npm CLI, yarn, or any other CLI tool that interfaces
10-
with the npm registry.
7+
This tool seeks to be a one-stop shop for building and working with rust-
8+
generated WebAssembly that you would like to interop with JavaScript, in the
9+
browser or with Node.js. `wasm-pack` helps you build and publish rust-generated
10+
WebAssembly to the npm registry to be used alongside any other javascript
11+
package in workflows that you already use, such as a bundler like
12+
[webpack] or [greenkeeper].
1113

12-
this project is a part of the [rust-wasm] group. you can find more info by
14+
[bundler-support]: https://github.com/rustwasm/team/blob/master/goals/bundler-integration.md#details
15+
[webpack]: https://webpack.js.org/
16+
[greenkeeper]: https://greenkeeper.io/
17+
18+
This project is a part of the [rust-wasm] group. You can find more info by
1319
visiting that repo!
1420

1521
[rust-wasm]: https://github.com/rust-lang-nursery/rust-wasm/
1622

1723
![demo](demo.gif)
1824

19-
## 🔮 prerequisities
20-
21-
this project is written in rust. [get rust] to work on this project.
22-
23-
[get rust]: https://www.rustup.rs/
24-
25-
if you want to publish packages, you'll also need an account on [npm] and have
26-
[node/npm] installed.
25+
## 🔮 Prerequisities
2726

28-
[npm]: https://www.npmjs.com
29-
[node/npm]: https://nodejs.org/
27+
- [Development Environment](docs/prerequisites.md)
28+
- [Installation and Getting Started](docs/setup.md)
3029

31-
## 🏃‍♀️ up and running
30+
## 🎙️ Commands
3231

33-
1. fork and clone this repository
34-
2. install [node/npm]
35-
2. `cd wasm-pack`
36-
3. `cargo run`
32+
- [`init`](docs/init.md): Generate an npm wasm pkg from a rustwasm crate
33+
- [`pack`](docs/pack.md): Create a tarball of your rustwasm pkg
34+
- [`publish`](docs/publish.md): Publish your rustwasm pkg to a registry
3735

38-
## 💃 commands
39-
- `help`: display available commands
40-
- 🐣 `init`: create necessary files for js interop and npm publishing
41-
- optionally pass a path to a dir that contains a `Cargo.toml`, e.g.:
42-
```
43-
wasm-pack init examples/js-hello-world
44-
```
45-
- optionally pass a scope name to generate a `package.json` for a scoped pkg, e.g.:
46-
```
47-
wasm-pack init examples/scopes-hello-world --scope test
48-
```
49-
generates a `package.json` for an npm package called `@test/scopes-hello-world`
50-
- 🍱 `pack`: create a tarball but don't push to the npm registry (see https://docs.npmjs.com/cli/pack)
51-
- 🎆 `publish`: create a tarball and publish to the npm registry (see https://docs.npmjs.com/cli/publish)
52-
53-
### logging
36+
## 📝 Logging
5437

5538
We generate a `wasm-pack.log` file if `wasm-pack` errors on you, and you can
5639
customize the log verbosity using the verbosity flag.
@@ -61,11 +44,18 @@ customize the log verbosity using the verbosity flag.
6144
| -vv | All Debug, Info, Warn, and Errors are logged |
6245
| -vvv | All Trace, Debug, Info, Warn, and Errors are logged |
6346

47+
## 👯 Contributing
48+
49+
Read our [guide] on getting up and running for developing `wasm-pack`, and
50+
check out our [contribution policy].
51+
52+
[guide]: doc/contributing.md
53+
[contribution policy]: CONTRIBUTING.md
6454

65-
## ⚙️ how to use
55+
## ⚡ Quickstart Guide
6656

67-
1. write a crate in Rust.
68-
2. add `wasm-bindgen` to your `Cargo.toml`:
57+
1. Write a crate in Rust.
58+
2. Add `wasm-bindgen` to your `Cargo.toml`:
6959

7060
```toml
7161
[lib]
@@ -74,7 +64,7 @@ customize the log verbosity using the verbosity flag.
7464
[dependencies]
7565
wasm-bindgen = "0.2"
7666
```
77-
3. add this to the top of your `src/lib.rs`:
67+
3. Add this to the top of your `src/lib.rs`:
7868

7969
```rust
8070
#![feature(proc_macro, wasm_import_module, wasm_custom_section)]
@@ -84,7 +74,7 @@ customize the log verbosity using the verbosity flag.
8474
use wasm_bindgen::prelude::*;
8575
```
8676

87-
4. annotate your public functions with `#[wasm_bindgen]`, for example:
77+
4. Annotate your public functions with `#[wasm_bindgen]`, for example:
8878

8979
```rust
9080
#[wasm_bindgen]
@@ -98,10 +88,11 @@ customize the log verbosity using the verbosity flag.
9888
}
9989
```
10090

101-
5. install this tool: `cargo install wasm-pack`
102-
6. run `wasm-pack init`, optionally, pass a path to a dir or a scope (see above for details)
103-
7. this tool generates files in a `pkg` dir
104-
8. to publish to npm, run `wasm-pack publish` (making sure you are logged in with npm)
91+
5. Install this tool: `cargo install wasm-pack`
92+
6. Run `wasm-pack init`, optionally, pass a path to a dir or a scope (see above for details)
93+
7. This tool generates files in a `pkg` dir
94+
8. To publish to npm, run `wasm-pack publish`. You may need to login to the
95+
registry you want to publish to. You can login using `wasm-pack login`.`
10596

10697
[rust-wasm/36]: https://github.com/rust-lang-nursery/rust-wasm/issues/36
10798
[wasm-bindgen]: https://github.com/alexcrichton/wasm-bindgen

docs/contributing.md

+44
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
# Contributing
2+
3+
## Prerequisites
4+
5+
The technical prerequisites for contributing to this project are the same as for
6+
using it. You can find them documented [here][1].
7+
8+
You'll also want to check out the contributing [guidelines].
9+
10+
[1]: docs/prerequisites.md
11+
[guidelines]: CONTRIBUTING.md
12+
13+
## 🏃‍♀️ Up and Running
14+
15+
1. fork and clone this repository
16+
2. install [node/npm]
17+
2. `cd wasm-pack`
18+
3. `cargo run`. To test command line arguments you can run `cargo run -- <args>`.
19+
20+
## Documentation
21+
22+
Documentation lives in the [`/docs`](docs) directory. Each command has it's own page.
23+
Additionally there are extra pages explaining the prerequisites, setup, and how to
24+
contribute (which you are reading now!).
25+
26+
## Tests
27+
28+
Tests live in the [`/tests`](tests) directory. To run the tests you can run:
29+
30+
```
31+
cargo test
32+
```
33+
34+
You can also manually test the CLI tool by running:
35+
36+
```
37+
cargo run -- <args>
38+
```
39+
40+
...for example:
41+
42+
```
43+
cargo run -- init /tests/fixtures/js-hello-world --scope=ag_dubs
44+
```

0 commit comments

Comments
 (0)