File: CONTRIBUTING.md

package info (click to toggle)
node-source-map 0.7.6%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: experimental
  • size: 960 kB
  • sloc: javascript: 7,200; python: 252; sh: 21; makefile: 14
file content (60 lines) | stat: -rw-r--r-- 1,149 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
# Contributing to `source-map-mappings`

## Building

To build the core library for the host target (for use with testing):

```
$ cargo build
```

To build for WebAssembly, ensure that you have the `wasm32-unknown-unknown` target:

```
$ rustup update
$ rustup target add wasm32-unknown-unknown --toolchain nightly
```

Then, cross compile to a `.wasm` file via the WebAssembly API crate:

```
$ cd source-map-mappings-wasm-api/
$ ./build.py -o output.wasm
```

The `build.py` script handles shrinking the size of the resulting `.wasm` file
for you, with `wasm-gc`, `wasm-snip`, and `wasm-opt`.

For more details, run:

```
$ ./build.py --help
```

## Testing

To run all the tests:

```
$ cargo test
```

## Automatic code formatting

We use [`rustfmt`](https://github.com/rust-lang-nursery/rustfmt) to enforce a
consistent code style across the whole code base.

You can install the latest version of `rustfmt` with this command:

```
$ rustup update nightly
$ cargo install -f rustfmt-nightly
```

Ensure that `~/.cargo/bin` is on your path.

Once that is taken care of, you can (re)format all code by running this command:

```
$ cargo fmt
```