Skip to content

Commit

Permalink
Ensure JS snippets from wasm-bindgen are being copied to dist.
Browse files Browse the repository at this point in the history
closes #40
  • Loading branch information
thedodd committed Sep 16, 2020
1 parent 403d5d7 commit bc90765
Show file tree
Hide file tree
Showing 6 changed files with 75 additions and 32 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ on: [push, pull_request]

jobs:
lint:
name: build
name: lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
Expand Down
10 changes: 9 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,20 @@ changelog
This changelog follows the patterns described here: https://keepachangelog.com/en/1.0.0/.

## Unreleased

## 0.4.0
### added
- Added support for layered configuration via `Trunk.toml` & environment variables.
- Added an example `Trunk.toml` to the root of the repository showing all possible config values along with their defaults.

### changed
- README has been updated with details on how the config system works.
- Removed a fair amount of code duplication as part of the configuration feature.
- Trunk now exits with a non-zero code when an error takes place during execution.
- Added full release automation with optimized release binaries for Linux, MacOS & Windows (all x64).

### fixed
- Closed [#37](https://github.com/thedodd/trunk/issues/37): Trunk now exits with a non-zero code when an error takes place during execution.
- Closed [#40](https://github.com/thedodd/trunk/issues/40): Trunk is now copying JS snippets from wasm-bindgen into the dist dir as part of the standard build/watch/serve commands.

## 0.3.1
### fixed
Expand Down
55 changes: 31 additions & 24 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ async-std = { version="1.6.3", features=["attributes", "unstable"] }
cargo_metadata = "0.11.1"
console = "0.12.0"
envy = "0.4.1"
fs_extra = "1.2.0"
futures = "0.3.5"
indicatif = "0.15.0"
nipper = "0.1.8"
Expand Down
9 changes: 5 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,15 +70,15 @@ The contents of your `dist` dir are now ready to be served on the web. But that'

## commands
### build
`trunk build [index.html]` runs a cargo build targeting the wasm32 instruction set, runs `wasm-bindgen` on the built WASM, spawns asset build pipelines for any assets defined in the target `index.html`.
`trunk build` runs a cargo build targeting the wasm32 instruction set, runs `wasm-bindgen` on the built WASM, and spawns asset build pipelines for any assets defined in the target `index.html`.

Trunk leverages Rust's powerful concurrency primitives for maximum build speeds.
Trunk leverages Rust's powerful concurrency primitives for maximum build speeds & throughput.

### watch
`trunk watch [index.html]` does the same thing as `trunk build`, but watches the filesystem for changes, triggering new builds as changes are detected.
`trunk watch` does the same thing as `trunk build`, but also watches the filesystem for changes, triggering new builds as changes are detected.

### serve
`trunk serve [index.html]` does the same thing as `trunk watch`, but also spawns a web server.
`trunk serve` does the same thing as `trunk watch`, but also spawns a web server.

### clean
`trunk clean` cleans up any build artifacts generated from earlier builds.
Expand All @@ -91,6 +91,7 @@ Currently supported assets:
-`css`: Trunk will copy linked css files found in the source HTML without content modification. This content is hashed for cache control.
- In the future, Trunk will resolve local `@imports`, will handle minification (see [trunk#7](https://github.com/thedodd/trunk/issues/3)), and we may even look into a pattern where any CSS found in the source tree will be bundled, which would enable a nice zero-config "component styles" pattern. See [trunk#3](https://github.com/thedodd/trunk/issues/3) for more details.
-`icon`: Trunk will automatically copy referenced icons to the `dist` dir. This content is hashed for cache control.
-`js snippets`: [wasm-bindgen JS snippets](https://rustwasm.github.io/docs/wasm-bindgen/reference/js-snippets.html) are automatically copied to the dist dir, hashed and ready to rock.

### images & other resources
Images and other resource types can be copied into the `dist` dir by adding a link like this to your source HTML: `<link rel="trunk-dist" href="path/to/resource"/>` (note the `rel="trunk-dist"` attribute). This will cause Trunk to find the target resource, and copy it to the `dist` dir unmodified. No hashing will be applied. The link itself will be removed from the HTML.
Expand Down
Loading

0 comments on commit bc90765

Please sign in to comment.