Switch from shell to npm scripts for demo using webpack and @wasm-tool/wasm-pack-plugin

Also change travis deploy to use new demo directory.
This commit is contained in:
coolreader18 committed 2018-12-26 23:34:51 -06:00
1 parent c38796bb49
commit 877206dc47
6 files changed
+103 -102

No files matched your search

+80 -77
View File
@@ -1,4 +1,3 @@
language: rust
rust:
@@ -7,85 +6,87 @@ rust:
- nightly
script:
- cargo build --verbose --all
- cargo test --verbose --all
- cargo build --verbose --all
- cargo test --verbose --all
env:
# This is used to only capture the regular nightly test in allow_failures
- REGULAR_TEST=true
# This is used to only capture the regular nightly test in allow_failures
- REGULAR_TEST=true
cache: cargo
matrix:
include:
# To test the snippets, we use Travis' Python environment (because
# installing rust ourselves is a lot easier than installing Python)
- language: python
python: 3.6
cache:
pip: true
# Because we're using the Python Travis environment, we can't use
# the built-in cargo cacher
directories:
- /home/travis/.cargo
- target
env:
- TRAVIS_RUST_VERSION=stable
- REGULAR_TEST=false
script: tests/.travis-runner.sh
- language: python
python: 3.6
cache:
pip: true
# Because we're using the Python Travis environment, we can't use
# the built-in cargo cacher
directories:
- /home/travis/.cargo
- target
env:
- TRAVIS_RUST_VERSION=beta
- REGULAR_TEST=false
script: tests/.travis-runner.sh
- name: rustfmt
language: rust
rust: stable
cache: cargo
before_script:
- rustup component add rustfmt-preview
script:
# Code references the generated python.rs, so put something in
# place to make `cargo fmt` happy. (We use `echo` rather than
# `touch` because rustfmt complains about the empty file touch
# creates.)
- echo > parser/src/python.rs
- cargo fmt --all -- --check
env:
- REGULAR_TEST=false
- name: publish documentation
language: rust
rust: stable
cache: cargo
script:
- cargo doc --no-deps --all
if: branch = release
env:
- REGULAR_TEST=false
- name: WASM online demo
language: rust
rust: nightly
cache: cargo
install:
- nvm install node
- curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh # install wasm-pack
script:
- cd wasm
- bash release.sh
if: branch = release
env:
- REGULAR_TEST=false
allow_failures:
- rust: nightly
env: REGULAR_TEST=true
include:
# To test the snippets, we use Travis' Python environment (because
# installing rust ourselves is a lot easier than installing Python)
- language: python
python: 3.6
cache:
pip: true
# Because we're using the Python Travis environment, we can't use
# the built-in cargo cacher
directories:
- /home/travis/.cargo
- target
env:
- TRAVIS_RUST_VERSION=stable
- REGULAR_TEST=false
script: tests/.travis-runner.sh
- language: python
python: 3.6
cache:
pip: true
# Because we're using the Python Travis environment, we can't use
# the built-in cargo cacher
directories:
- /home/travis/.cargo
- target
env:
- TRAVIS_RUST_VERSION=beta
- REGULAR_TEST=false
script: tests/.travis-runner.sh
- name: rustfmt
language: rust
rust: stable
cache: cargo
before_script:
- rustup component add rustfmt-preview
script:
# Code references the generated python.rs, so put something in
# place to make `cargo fmt` happy. (We use `echo` rather than
# `touch` because rustfmt complains about the empty file touch
# creates.)
- echo > parser/src/python.rs
- cargo fmt --all -- --check
env:
- REGULAR_TEST=false
- name: publish documentation
language: rust
rust: stable
cache: cargo
script:
- cargo doc --no-deps --all
if: branch = release
env:
- REGULAR_TEST=false
- name: WASM online demo
language: rust
rust: nightly
cache: cargo
install:
- nvm install node
# install wasm-pack
- curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh
script:
- cd wasm/demo
- npm install
- npm run dist
if: branch = release
env:
- REGULAR_TEST=false
allow_failures:
- rust: nightly
env: REGULAR_TEST=true
deploy:
- provider: pages
@@ -93,16 +94,18 @@ deploy:
target-branch: master
local-dir: target/doc
skip-cleanup: true
github-token: $WEBSITE_GITHUB_TOKEN # Set in the settings page of your repository, as a secure variable
# Set in the settings page of your repository, as a secure variable
github-token: $WEBSITE_GITHUB_TOKEN
keep-history: true
on:
branch: release
- provider: pages
repo: RustPython/demo
target-branch: master
local-dir: wasm/app/dist
local-dir: wasm/demo/dist
skip-cleanup: true
github-token: $WEBSITE_GITHUB_TOKEN # Set in the settings page of your repository, as a secure variable
# Set in the settings page of your repository, as a secure variable
github-token: $WEBSITE_GITHUB_TOKEN
keep-history: true
on:
branch: release
-11
View File
@@ -1,11 +0,0 @@
#!/bin/sh
set -e
(
cd lib
wasm-pack build --debug
)
(
cd demo
npm install && node_modules/.bin/webpack-dev-server
)
+4 -1
View File
@@ -7,6 +7,7 @@
"codemirror": "^5.42.0"
},
"devDependencies": {
"@wasm-tool/wasm-pack-plugin": "0.2.0",
"webpack": "^4.16.3",
"webpack-cli": "^3.1.0",
"webpack-dev-server": "^3.1.5",
@@ -16,7 +17,9 @@
"css-loader": "^2.0.1"
},
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
"dev": "webpack-dev-server -d",
"build": "webpack",
"dist": "webpack --mode production"
},
"repository": {
"type": "git",
+4
View File
@@ -1,5 +1,6 @@
const HtmlWebpackPlugin = require('html-webpack-plugin');
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
const WasmPackPlugin = require('@wasm-tool/wasm-pack-plugin');
const path = require('path');
module.exports = {
@@ -21,6 +22,9 @@ module.exports = {
}),
new MiniCssExtractPlugin({
filename: 'styles.css'
}),
new WasmPackPlugin({
crateDirectory: path.join(__dirname, '../lib')
})
]
};
+15 -1
View File
@@ -2,6 +2,15 @@
# yarn lockfile v1
"@wasm-tool/wasm-pack-plugin@0.2.0":
version "0.2.0"
resolved "https://registry.yarnpkg.com/@wasm-tool/wasm-pack-plugin/-/wasm-pack-plugin-0.2.0.tgz#d8936ce3483f27c8ff4241c418273434305b8b4d"
integrity sha512-L4xdsFLfO6wtXbjNXeJ0c/ZxvdFCYYimYybcnDOJpPnz3pMr4lXOJkQcm8PKkbjTEgzojwioytUAzH79jzKvkQ==
dependencies:
chalk "^2.4.1"
command-exists "^1.2.7"
watchpack "^1.6.0"
"@webassemblyjs/ast@1.7.11":
version "1.7.11"
resolved "https://registry.yarnpkg.com/@webassemblyjs/ast/-/ast-1.7.11.tgz#b988582cafbb2b095e8b556526f30c90d057cace"
@@ -711,6 +720,11 @@ color-name@1.1.3:
resolved "https://registry.yarnpkg.com/color-name/-/color-name-1.1.3.tgz#a7d0558bd89c42f795dd42328f740831ca53bc25"
integrity sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=
command-exists@^1.2.7:
version "1.2.8"
resolved "https://registry.yarnpkg.com/command-exists/-/command-exists-1.2.8.tgz#715acefdd1223b9c9b37110a149c6392c2852291"
integrity sha512-PM54PkseWbiiD/mMsbvW351/u+dafwTJ0ye2qB60G1aGQP9j3xK2gmMDc+R34L3nDtx4qMCitXT75mkbkGJDLw==
commander@2.17.x, commander@~2.17.1:
version "2.17.1"
resolved "https://registry.yarnpkg.com/commander/-/commander-2.17.1.tgz#bd77ab7de6de94205ceacc72f1716d29f20a77bf"
@@ -4089,7 +4103,7 @@ vm-browserify@0.0.4:
dependencies:
indexof "0.0.1"
watchpack@^1.5.0:
watchpack@^1.5.0, watchpack@^1.6.0:
version "1.6.0"
resolved "https://registry.yarnpkg.com/watchpack/-/watchpack-1.6.0.tgz#4bc12c2ebe8aa277a71f1d3f14d685c7b446cd00"
integrity sha512-i6dHe3EyLjMmDlU1/bGQpEw25XSjkJULPuAVKCbNRefQVq48yXKUpwg538F7AZTf9kyr57zj++pQFltUa5H7yA==
-12
View File
@@ -1,12 +0,0 @@
#!/bin/sh
set -e
(
cd lib
wasm-pack build
)
(
cd demo
npm install && node_modules/.bin/webpack --mode production
)
echo "Output saved to demo/dist"