未验证 提交 d9180ea1 编写于 作者: P Peter Pan 提交者: GitHub

Update build environment & publish npm package (#581)

* build: optimize wasm files

* build: use bionic instead of trusty

* build: build wasm first

* build: fix path overwritten

* build: disable rustup changing path

* build: fix typo

* build: test path

* build: re-export path when build

* build: update build scripts

* build: frozen lock file when building

* build: fix syntax error

* v2.0.0-beta.9

* v2.0.0-beta.11

* build: publish npm package
上级 e9a6f297
......@@ -57,7 +57,7 @@ jobs:
- if [[ "$JOB" == "build_doc" ]]; then ./scripts/deploy_docs_on_travis.sh; fi;
- language: node_js
dist: trusty
dist: bionic
node_js: 12
cache:
- npm
......@@ -69,14 +69,11 @@ jobs:
before_install:
- cd frontend
install:
- curl https://sh.rustup.rs -sSf | sh -s -- --default-toolchain nightly -y
- source $HOME/.cargo/env
- curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh
- yarn
- ./scripts/install.sh
script:
- yarn lint
- yarn test
- ./scripts/build.sh
- yarn build
notifications:
email:
......
......@@ -25,3 +25,6 @@
npm-debug.log*
yarn-debug.log*
yarn-error.log*
# output
/output/
dist
out
wasm
output
......@@ -4,10 +4,10 @@
<br />
<p align="center">
<a href="https://www.npmjs.com/package/visualdl"><img src="https://img.shields.io/npm/v/visualdl?style=flat-square" alt="NPM Version" /></a>
<a href="https://travis-ci.org/PaddlePaddle/VisualDL"><img src="https://img.shields.io/travis/PaddlePaddle/VisualDL?style=flat-square" alt="Build Status" /></a>
<a href="https://github.com/PaddlePaddle/VisualDL"><img src="https://img.shields.io/github/languages/top/PaddlePaddle/VisualDL?style=flat-square" alt="GitHub top language" /></a>
<a href="https://github.com/prettier/prettier"><img src="https://img.shields.io/badge/code_style-prettier-ff69b4.svg?style=flat-square" alt="code style: prettier" /></a>
<a href="https://github.com/PaddlePaddle/VisualDL"><img src="https://img.shields.io/github/languages/code-size/PaddlePaddle/VisualDL?style=flat-square" alt="GitHub code size in bytes" /></a>
<a href="https://github.com/PaddlePaddle/VisualDL/blob/develop/LICENSE"><img src="https://img.shields.io/github/license/PaddlePaddle/VisualDL?style=flat-square" alt="License" /></a>
<a href="https://github.com/PaddlePaddle/VisualDL/issues"><img src="https://img.shields.io/github/issues/PaddlePaddle/VisualDL?style=flat-square" alt="GitHub issues" /></a>
<a href="https://github.com/PaddlePaddle/VisualDL/graphs/contributors"><img src="https://img.shields.io/github/contributors/PaddlePaddle/VisualDL?style=flat-square" alt="GitHub Contributors" /></a>
......
......@@ -4,10 +4,10 @@
<br />
<p align="center">
<a href="https://www.npmjs.com/package/visualdl"><img src="https://img.shields.io/npm/v/visualdl?style=flat-square" alt="NPM Version" /></a>
<a href="https://travis-ci.org/PaddlePaddle/VisualDL"><img src="https://img.shields.io/travis/PaddlePaddle/VisualDL?style=flat-square" alt="Build Status" /></a>
<a href="https://github.com/PaddlePaddle/VisualDL"><img src="https://img.shields.io/github/languages/top/PaddlePaddle/VisualDL?style=flat-square" alt="GitHub top language" /></a>
<a href="https://github.com/prettier/prettier"><img src="https://img.shields.io/badge/code_style-prettier-ff69b4.svg?style=flat-square" alt="code style: prettier" /></a>
<a href="https://github.com/PaddlePaddle/VisualDL"><img src="https://img.shields.io/github/languages/code-size/PaddlePaddle/VisualDL?style=flat-square" alt="GitHub code size in bytes" /></a>
<a href="https://github.com/PaddlePaddle/VisualDL/blob/develop/LICENSE"><img src="https://img.shields.io/github/license/PaddlePaddle/VisualDL?style=flat-square" alt="License" /></a>
<a href="https://github.com/PaddlePaddle/VisualDL/issues"><img src="https://img.shields.io/github/issues/PaddlePaddle/VisualDL?style=flat-square" alt="GitHub issues" /></a>
<a href="https://github.com/PaddlePaddle/VisualDL/graphs/contributors"><img src="https://img.shields.io/github/contributors/PaddlePaddle/VisualDL?style=flat-square" alt="GitHub Contributors" /></a>
......
#!/usr/bin/env node
/* eslint-disable @typescript-eslint/no-var-requires */
/* eslint-disable no-console */
const argv = require('yargs')
.usage('Usage: $0 <command> [options]')
.command('start', 'Start VisualDL server')
.command('stop', 'Stop VisualDL server')
.example('$0 start --host 192.168.0.2 --port 3000', 'Start VisualDL server at http://192.168.0.2:3000')
.alias('p', 'port')
.nargs('p', 1)
.nargs('port', 1)
.describe('p', 'Port of server')
.nargs('host', 1)
.describe('host', 'Host of server')
.nargs('proxy', 1)
.describe('proxy', 'Backend proxy address')
.boolean('open')
.describe('open', 'Open browser when server is ready')
.help('h')
.alias('h', 'help')
.epilog('Visit https://github.com/PaddlePaddle/VisualDL for more infomation.').argv;
const command = argv._[0];
const exit = () => {
console.log('Command not found, use -h or --help for help');
process.exit(1);
};
const exitIfError = (err, exitCode = 1, spinner) => {
if (!err) {
return;
}
if (spinner) {
spinner.fail('Error!');
}
console.error(err);
process.exit(exitCode);
};
if (!command) {
exit();
}
const banner = `
█████ █████ ███ ████ ██████████ █████
░░███ ░░███ ░░░ ░░███ ░░███░░░░███ ░░███
░███ ░███ ████ █████ █████ ████ ██████ ░███ ░███ ░░███ ░███
░███ ░███ ░░███ ███░░ ░░███ ░███ ░░░░░███ ░███ ░███ ░███ ░███
░░███ ███ ░███ ░░█████ ░███ ░███ ███████ ░███ ░███ ░███ ░███
░░░█████░ ░███ ░░░░███ ░███ ░███ ███░░███ ░███ ░███ ███ ░███ █
░░███ █████ ██████ ░░████████░░████████ █████ ██████████ ███████████
░░░ ░░░░░ ░░░░░░ ░░░░░░░░ ░░░░░░░░ ░░░░░ ░░░░░░░░░░ ░░░░░░░░░░░
`;
const pm2 = require('pm2');
pm2.connect(err => {
exitIfError(err, 2);
pm2.list((err, list) => {
exitIfError(err, 2);
const appRoot = require('app-root-path');
const ecosystem = require(appRoot + '/ecosystem.config');
const app = ecosystem.apps[0];
const host = argv.host || 'localhost';
const port = Number.parseInt(argv.port, 10) || 8999;
const url = `http://${host}:${port}`;
const ora = require('ora');
if (command === 'start') {
if (list.find(item => item.name === app.name)) {
exitIfError('VisualDL server is already running', 1);
}
const spinner = ora('Starting VisualDL server...').start();
pm2.start(
{
...app,
env: {
NODE_ENV: 'production',
HOST: host,
PORT: port,
PROXY: argv.proxy
}
},
err => {
pm2.disconnect();
exitIfError(err, 2, spinner);
spinner.succeed('Starting VisualDL server... Done');
console.log(banner);
console.log(`> VisualDL server is running at ${url}`);
if (argv.open) {
console.log(' Opening your browser for you...');
const open = require('open');
open(url);
}
}
);
} else if (command === 'stop') {
if (!list.find(item => item.name === app.name)) {
exitIfError('VisualDL server is not running', 1);
}
const spinner = ora('Stopping VisualDL server...').start();
pm2.delete(app.name, err => {
exitIfError(err, 2);
const end = err => {
pm2.disconnect();
exitIfError(err, 2);
spinner.succeed('Stopping VisualDL server... Done');
console.log('> VisualDL server stopped');
console.log(' See you next time');
process.exit(0);
};
pm2.list((err, newList) => {
exitIfError(err, 2);
if (!newList.length) {
pm2.killDaemon(end);
} else {
end();
}
});
});
} else {
exit();
}
});
});
......@@ -12,7 +12,7 @@ const height = rem(600);
const divideWasm = () =>
// eslint-disable-next-line @typescript-eslint/ban-ts-ignore
// @ts-ignore
import('~/wasm/pkg').then(({divide}) => (params: DivideParams) =>
import('~/wasm/dist').then(({divide}) => (params: DivideParams) =>
(divide(params.points, params.labels, !!params.visibility, params.keyword ?? '') as unknown) as [
Point[],
Point[]
......
......@@ -27,13 +27,13 @@ const height = em(320);
const smoothWasm = () =>
// eslint-disable-next-line @typescript-eslint/ban-ts-ignore
// @ts-ignore
import('~/wasm/pkg').then(({transform}) => (params: TransformParams) =>
import('~/wasm/dist').then(({transform}) => (params: TransformParams) =>
(transform(params.datasets, params.smoothing) as unknown) as Dataset[]
);
const rangeWasm = () =>
// eslint-disable-next-line @typescript-eslint/ban-ts-ignore
// @ts-ignore
import('~/wasm/pkg').then(({range}) => (params: RangeParams) =>
import('~/wasm/dist').then(({range}) => (params: RangeParams) =>
(range(params.datasets, params.outlier) as unknown) as Range
);
......
/* eslint-disable @typescript-eslint/no-var-requires */
const {resolve} = require('app-root-path');
module.exports = {
apps: [
{
name: 'visualdl',
script: 'dist/server/index.js',
cwd: resolve('/'),
args: '',
instances: 'max',
autorestart: true,
watch: false,
exec_mode: 'cluster', // eslint-disable-line @typescript-eslint/camelcase
max_memory_restart: '2G', // eslint-disable-line @typescript-eslint/camelcase
wait_ready: true, // eslint-disable-line @typescript-eslint/camelcase
env: {
...process.env,
NODE_ENV: 'production'
}
}
]
};
module.exports = require(__dirname + '/dist/server/index.js');
......@@ -69,7 +69,9 @@ module.exports = {
const WasmPackPlugin = require('@wasm-tool/wasm-pack-plugin');
config.plugins.push(
new WasmPackPlugin({
crateDirectory: path.resolve(__dirname, 'wasm')
crateDirectory: path.resolve(__dirname, 'wasm'),
outDir: 'dist',
outName: 'index'
})
);
} else {
......
{
"name": "visual-dl",
"version": "2.0.0-beta",
"name": "visualdl",
"version": "2.0.0-beta.11",
"title": "VisualDL",
"description": "A platform to visualize the deep learning process and result.",
"keywords": [
......@@ -28,15 +28,31 @@
"dev:wasm": "cross-env NODE_ENV=development WITH_WASM=1 nodemon --watch server --ext ts --exec \"ts-node --project server/tsconfig.json\" server/index.ts",
"build:next": "next build",
"build:server": "tsc --project server/tsconfig.json",
"build:wasm": "wasm-pack build wasm",
"build:wasm": "wasm-pack build --release --out-dir dist --out-name index wasm",
"build": "./scripts/build.sh",
"export": "yarn build:next && next export",
"export": "next export",
"start": "NODE_ENV=production node dist/server/index.js",
"lint": "tsc -p tsconfig.json --noEmit && tsc -p server/tsconfig.json --noEmit && eslint --ext .tsx,.jsx.ts,.js --ignore-path .gitignore .",
"format": "prettier --write \"**/*.ts\" \"**/*.tsx\" \"**/*.js\" \"**/*.jsx\"",
"test": "echo \"Error: no test specified\" && exit 0"
"test": "echo \"Error: no test specified\" && exit 0",
"prepublishOnly": "yarn lint && yarn test && ./scripts/prepare.sh",
"preversion": "yarn lint",
"version": "yarn format"
},
"main": "index.js",
"bin": "cli.js",
"files": [
"dist",
"out",
"public",
"wasm/dist",
"types",
"index.js",
"cli.js",
"ecosystem.config.js"
],
"dependencies": {
"app-root-path": "3.0.0",
"dagre-d3": "0.6.4",
"detect-node": "2.0.4",
"echarts": "4.6.0",
......@@ -54,7 +70,10 @@
"moment": "2.24.0",
"next": "9.2.2",
"nprogress": "0.2.0",
"open": "7.0.3",
"ora": "4.0.3",
"path-match": "1.2.4",
"pm2": "4.2.3",
"polished": "3.4.4",
"prop-types": "15.7.2",
"query-string": "6.11.1",
......@@ -109,6 +128,9 @@
"worker-plugin": "3.2.0",
"yarn": "1.22.1"
},
"optionalDependencies": {
"wasm-pack": "0.9.1"
},
"engines": {
"node": ">=10",
"npm": ">=6"
......
......@@ -2,23 +2,48 @@
set -e
if [ -f "$HOME/.cargo/env" ]; then
source $HOME/.cargo/env
fi
WORKING_PATH=`pwd`
DIST_DIR='dist'
DIST_PATH="$WORKING_PATH/$DIST_DIR"
SERVER_DIR="dist"
SERVER_DIR_PATH="$WORKING_PATH/$SERVER_DIR"
CLIENT_DIR="out"
CLIENT_DIR_PATH="$WORKING_PATH/$CLIENT_DIR"
OUTPUT="output"
OUTPUT_PATH="$WORKING_PATH/$OUTPUT"
# generate dist
rm -rf $DIST_PATH
mkdir -p $DIST_PATH
rm -rf $SERVER_DIR_PATH
mkdir -p $SERVER_DIR_PATH
rm -rf $CLIENT_DIR_PATH
mkdir -p $CLIENT_DIR_PATH
# generate output
rm -rf $OUTPUT_PATH
mkdir -p $OUTPUT_PATH
yarn
# export
# WARNING: export FIRST!!! dist files will be deleted by next after export
yarn export
# next build
yarn build:next
# server build
yarn build:server
# move static files
cp next.config.js $DIST_PATH
cp package.json $DIST_PATH
cp next.config.js $SERVER_DIR_PATH
cp package.json $SERVER_DIR_PATH
# package server files
(cd $SERVER_DIR_PATH && tar zcf $OUTPUT_PATH/server.tar.gz .)
# export
# WARNING: export LAST!!! dist files will be deleted by next after export
yarn export
# package client files
(cd $CLIENT_DIR_PATH && tar zcf $OUTPUT_PATH/client.tar.gz .)
# clean
rm -rf $SERVER_DIR_PATH
rm -rf $CLIENT_DIR_PATH
#!/bin/bash
set -e
# rust toolchain
# https://rustup.rs/
curl https://sh.rustup.rs -sSf | sh -s -- --no-modify-path --default-toolchain nightly -y
source $HOME/.cargo/env
# wasm-pack
# https://rustwasm.github.io/wasm-pack/installer/
curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh
# yarn install
yarn install --frozen-lockfile
#!/bin/bash
set -e
if [ -f "$HOME/.cargo/env" ]; then
source $HOME/.cargo/env
fi
WORKING_PATH=`pwd`
SERVER_DIR="dist"
SERVER_DIR_PATH="$WORKING_PATH/$SERVER_DIR"
# generate dist
rm -rf $SERVER_DIR_PATH
mkdir -p $SERVER_DIR_PATH
# next build
yarn build:next
# server build
yarn build:server
# move static files
cp next.config.js $SERVER_DIR_PATH
cp package.json $SERVER_DIR_PATH
#!/usr/bin/env node
/* eslint-disable no-console */
import path from 'path';
import express from 'express';
import next from 'next';
import {setConfig} from 'next/config';
import {argv} from 'yargs';
import {nextI18NextMiddleware} from '../utils/i18next/middlewares';
import nextI18next from '../utils/i18n';
import config from '../next.config';
......@@ -11,17 +14,17 @@ const isDev = process.env.NODE_ENV !== 'production';
setConfig(config);
const host = (argv.host as string) || process.env.HOST || 'localhost';
const port: string | number = Number.parseInt(argv.port as string, 10) || process.env.PORT || 8999;
const proxy = (argv.proxy as string) || process.env.PROXY;
const delay = Number.parseInt(argv.delay as string, 10);
const host = process.env.HOST || 'localhost';
const port: string | number = Number.parseInt(process.env.PORT, 10) || 8999;
const proxy = process.env.PROXY;
const delay = Number.parseInt(process.env.DELAY, 10);
const server = express();
const app = next({dev: isDev, conf: config});
const handle = app.getRequestHandler();
(async () => {
await app.prepare();
const server = express();
if (proxy) {
const {createProxyMiddleware} = await import('http-proxy-middleware');
......@@ -44,6 +47,18 @@ const handle = app.getRequestHandler();
server.get('*', (req, res) => handle(req, res));
server.listen(port);
console.log(`> Ready on http://${host}:${port}`); // eslint-disable-line no-console
const s = server.listen(port, host, () => {
process.send?.('ready');
console.log(`> Ready on http://${host}:${port}`);
process.on('SIGINT', () => {
s.close((err: Error) => {
if (err) {
throw err;
}
process.exit(0);
});
});
});
})();
export {server, app};
......@@ -24,9 +24,94 @@ dependencies = [
[[package]]
name = "futures"
version = "0.1.29"
version = "0.3.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1b980f2816d6ee8673b6517b52cb0e808a180efc92e5c19d02cdda79066703ef"
checksum = "5c329ae8753502fb44ae4fc2b622fa2a94652c41e795143765ba0927f92ab780"
dependencies = [
"futures-channel",
"futures-core",
"futures-executor",
"futures-io",
"futures-sink",
"futures-task",
"futures-util",
]
[[package]]
name = "futures-channel"
version = "0.3.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f0c77d04ce8edd9cb903932b608268b3fffec4163dc053b3b402bf47eac1f1a8"
dependencies = [
"futures-core",
"futures-sink",
]
[[package]]
name = "futures-core"
version = "0.3.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f25592f769825e89b92358db00d26f965761e094951ac44d3663ef25b7ac464a"
[[package]]
name = "futures-executor"
version = "0.3.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f674f3e1bcb15b37284a90cedf55afdba482ab061c407a9c0ebbd0f3109741ba"
dependencies = [
"futures-core",
"futures-task",
"futures-util",
]
[[package]]
name = "futures-io"
version = "0.3.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a638959aa96152c7a4cddf50fcb1e3fede0583b27157c26e67d6f99904090dc6"
[[package]]
name = "futures-macro"
version = "0.3.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9a5081aa3de1f7542a794a397cde100ed903b0630152d0973479018fd85423a7"
dependencies = [
"proc-macro-hack",
"proc-macro2",
"quote",
"syn",
]
[[package]]
name = "futures-sink"
version = "0.3.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3466821b4bc114d95b087b850a724c6f83115e929bc88f1fa98a3304a944c8a6"
[[package]]
name = "futures-task"
version = "0.3.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7b0a34e53cf6cdcd0178aa573aed466b646eb3db769570841fda0c7ede375a27"
[[package]]
name = "futures-util"
version = "0.3.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "22766cf25d64306bedf0384da004d05c9974ab104fcc4528f1236181c18004c5"
dependencies = [
"futures-channel",
"futures-core",
"futures-io",
"futures-macro",
"futures-sink",
"futures-task",
"memchr",
"pin-utils",
"proc-macro-hack",
"proc-macro-nested",
"slab",
]
[[package]]
name = "itoa"
......@@ -59,30 +144,41 @@ dependencies = [
]
[[package]]
name = "proc-macro2"
version = "0.4.30"
name = "memchr"
version = "2.3.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cf3d2011ab5c909338f7887f4fc896d35932e29146c12c8d01da6b22a80ba759"
dependencies = [
"unicode-xid 0.1.0",
]
checksum = "3728d817d99e5ac407411fa471ff9800a778d88a24685968b36824eaf4bee400"
[[package]]
name = "proc-macro2"
version = "1.0.9"
name = "pin-utils"
version = "0.1.0-alpha.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6c09721c6781493a2a492a96b5a5bf19b65917fe6728884e7c44dd0c60ca3435"
checksum = "5894c618ce612a3fa23881b152b608bafb8c56cfc22f434a3ba3120b40f7b587"
[[package]]
name = "proc-macro-hack"
version = "0.5.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ecd45702f76d6d3c75a80564378ae228a85f0b59d2f3ed43c91b4a69eb2ebfc5"
dependencies = [
"unicode-xid 0.2.0",
"proc-macro2",
"quote",
"syn",
]
[[package]]
name = "quote"
version = "0.6.13"
name = "proc-macro-nested"
version = "0.1.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6ce23b6b870e8f94f81fb0a363d65d86675884b34a09043c81e5562f11c1f8e1"
checksum = "369a6ed065f249a159e06c45752c780bda2fb53c995718f9e484d08daa9eb42e"
[[package]]
name = "proc-macro2"
version = "1.0.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6c09721c6781493a2a492a96b5a5bf19b65917fe6728884e7c44dd0c60ca3435"
dependencies = [
"proc-macro2 0.4.30",
"unicode-xid",
]
[[package]]
......@@ -91,7 +187,7 @@ version = "1.0.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2bdc6c187c65bca4260c9011c9e3132efe4909da44726bad24cf7572ae338d7f"
dependencies = [
"proc-macro2 1.0.9",
"proc-macro2",
]
[[package]]
......@@ -118,8 +214,8 @@ version = "1.0.104"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "128f9e303a5a29922045a830221b8f78ec74a5f544944f3d5984f8ec3895ef64"
dependencies = [
"proc-macro2 1.0.9",
"quote 1.0.3",
"proc-macro2",
"quote",
"syn",
]
......@@ -134,23 +230,23 @@ dependencies = [
"serde",
]
[[package]]
name = "slab"
version = "0.4.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c111b5bd5695e56cffe5129854aa230b39c93a305372fdbb2668ca2394eea9f8"
[[package]]
name = "syn"
version = "1.0.16"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "123bd9499cfb380418d509322d7a6d52e5315f064fe4b3ad18a53d6b92c07859"
dependencies = [
"proc-macro2 1.0.9",
"quote 1.0.3",
"unicode-xid 0.2.0",
"proc-macro2",
"quote",
"unicode-xid",
]
[[package]]
name = "unicode-xid"
version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fc72304796d0818e357ead4e000d19c9c174ab23dc11093ac919054d20a6a7fc"
[[package]]
name = "unicode-xid"
version = "0.2.0"
......@@ -193,20 +289,19 @@ dependencies = [
"bumpalo",
"lazy_static",
"log",
"proc-macro2 1.0.9",
"quote 1.0.3",
"proc-macro2",
"quote",
"syn",
"wasm-bindgen-shared",
]
[[package]]
name = "wasm-bindgen-futures"
version = "0.3.27"
version = "0.4.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "83420b37346c311b9ed822af41ec2e82839bfe99867ec6c54e2da43b7538771c"
checksum = "457414a91863c0ec00090dba537f88ab955d93ca6555862c29b6d860990b8a8a"
dependencies = [
"cfg-if",
"futures",
"js-sys",
"wasm-bindgen",
"web-sys",
......@@ -218,7 +313,7 @@ version = "0.2.59"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0f6fde1d36e75a714b5fe0cffbb78978f222ea6baebb726af13c78869fdb4205"
dependencies = [
"quote 1.0.3",
"quote",
"wasm-bindgen-macro-support",
]
......@@ -228,8 +323,8 @@ version = "0.2.59"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "25bda4168030a6412ea8a047e27238cadf56f0e53516e1e83fec0a8b7c786f6d"
dependencies = [
"proc-macro2 1.0.9",
"quote 1.0.3",
"proc-macro2",
"quote",
"syn",
"wasm-bindgen-backend",
"wasm-bindgen-shared",
......@@ -243,12 +338,11 @@ checksum = "fc9f36ad51f25b0219a3d4d13b90eb44cd075dff8b6280cca015775d7acaddd8"
[[package]]
name = "wasm-bindgen-test"
version = "0.2.50"
version = "0.3.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a2d9693b63a742d481c7f80587e057920e568317b2806988c59cd71618bc26c1"
checksum = "449aeba7035e4a4710cd263bbac33519fa3828bff1c6f642fa8896601e7016ad"
dependencies = [
"console_error_panic_hook",
"futures",
"js-sys",
"scoped-tls",
"wasm-bindgen",
......@@ -258,12 +352,12 @@ dependencies = [
[[package]]
name = "wasm-bindgen-test-macro"
version = "0.2.50"
version = "0.3.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0789dac148a8840bbcf9efe13905463b733fa96543bfbf263790535c11af7ba5"
checksum = "49449f8dcedc192bd0cf11b5711982decdd4dbad1029f92370e2b1215031dd59"
dependencies = [
"proc-macro2 0.4.30",
"quote 0.6.13",
"proc-macro2",
"quote",
]
[[package]]
......
......@@ -25,24 +25,24 @@ lto = true
# default = ["wee_alloc"]
[dependencies]
serde = "^1.0.59"
serde_derive = "^1.0.59"
serde = "1.0.104"
serde_derive = "1.0.104"
# The `wasm-bindgen` crate provides the bare minimum functionality needed
# to interact with JavaScript.
[dependencies.wasm-bindgen]
version = "0.2.45"
version = "0.2.59"
features = ["serde-serialize"]
# `wee_alloc` is a tiny allocator for wasm that is only ~1K in code size
# compared to the default allocator's ~10K. However, it is slower than the default
# allocator, so it's not enabled by default.
# wee_alloc = { version = "0.4.2", optional = true }
# wee_alloc = { version = "0.4.5", optional = true }
# The `web-sys` crate allows you to interact with the various browser APIs,
# like the DOM.
[dependencies.web-sys]
version = "0.3.22"
version = "0.3.36"
features = ["console"]
# The `console_error_panic_hook` crate provides better debugging of panics by
......@@ -50,11 +50,40 @@ features = ["console"]
# all the `std::fmt` and `std::panicking` infrastructure, so it's only enabled
# in debug mode.
[target."cfg(debug_assertions)".dependencies]
console_error_panic_hook = "0.1.5"
console_error_panic_hook = "0.1.6"
# These crates are used for running unit tests.
[dev-dependencies]
wasm-bindgen-test = "0.2.45"
futures = "0.1.27"
js-sys = "0.3.22"
wasm-bindgen-futures = "0.3.22"
wasm-bindgen-test = "0.3.6"
futures = "0.3.4"
js-sys = "0.3.36"
wasm-bindgen-futures = "0.4.9"
[package.metadata.wasm-pack.profile.dev]
# Should `wasm-opt` be used to further optimize the wasm binary generated after
# the Rust compiler has finished? Using `wasm-opt` can often further decrease
# binary size or do clever tricks that haven't made their way into LLVM yet.
#
# Configuration is set to `false` by default for the dev profile, but it can
# be set to an array of strings which are explicit arguments to pass to
# `wasm-opt`. For example `['-Os']` would optimize for size while `['-O4']`
# would execute very expensive optimizations passes
wasm-opt = false
[package.metadata.wasm-pack.profile.dev.wasm-bindgen]
# Should we enable wasm-bindgen's debug assertions in its generated JS glue?
debug-js-glue = true
# Should wasm-bindgen demangle the symbols in the "name" custom section?
demangle-name-section = true
# Should we emit the DWARF debug info custom sections?
dwarf-debug-info = false
# `wasm-opt` is on by default in for the release profile, but it can be
# disabled by setting it to `false`
[package.metadata.wasm-pack.profile.release]
wasm-opt = ['-O']
[package.metadata.wasm-pack.profile.release.wasm-bindgen]
debug-js-glue = false
demangle-name-section = true
dwarf-debug-info = false
......@@ -4,6 +4,8 @@ use wasm_bindgen::prelude::*;
#[macro_use]
extern crate serde_derive;
pub fn main() {}
#[derive(Serialize, Deserialize)]
struct Dataset(f64, i64, f64);
......
此差异已折叠。
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册