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

chore: use yarn workspaces to disassembly dependencies (#612)

* resolve server rename conflict

* feat: add running toggle stopped color

* feat: revalidate runs and tags when refreshing

* fix: make language optional

* fix: language before open_browser

* fix: scalar chart x axis value overflow

* fix: unnecessary param when cli stop

* build: customize navbar items when build

* chore: use yarn workspaces to disassembly dependencies

* fix: add missing test script

* build: update dependencies

* build: install yarn before build

* build: fix test script error

* build: remove NODE_ENV when build

* build: add wine to build windows app in linux

* build: disable app publish by default

* build: introduce lerna

* build: adapter new frontend

* build: exact version when publish
上级 d7e87995
...@@ -63,14 +63,15 @@ jobs: ...@@ -63,14 +63,15 @@ jobs:
- npm - npm
- yarn - yarn
- cargo - cargo
env:
- PUBLIC_PATH="/app"
- API_URL="/api"
before_install: before_install:
- cd frontend - cd frontend
install: install:
- ./scripts/install.sh - ./scripts/install.sh
before_script:
- source $HOME/.cargo/env
- export PATH="$HOME/.yarn/bin:$HOME/.config/yarn/global/node_modules/.bin:$PATH"
script: script:
- yarn clean
- yarn lint - yarn lint
- yarn test - yarn test
- yarn build - yarn build
......
...@@ -4,35 +4,60 @@ module.exports = { ...@@ -4,35 +4,60 @@ module.exports = {
es6: true, es6: true,
node: true node: true
}, },
extends: [ extends: ['plugin:prettier/recommended'],
'plugin:@typescript-eslint/recommended',
'plugin:react/recommended',
'prettier/@typescript-eslint',
'plugin:prettier/recommended'
],
parser: '@typescript-eslint/parser',
parserOptions: { parserOptions: {
ecmaFeatures: {
jsx: true
},
ecmaVersion: 2018, ecmaVersion: 2018,
sourceType: 'module' sourceType: 'module'
}, },
plugins: ['react-hooks'], ignorePatterns: ['node_modules/', 'dist/', 'output/', '_next'],
settings: {
react: {
version: 'detect'
}
},
ignorePatterns: ['node_modules/', 'dist/', 'out/', '_next', 'wasm/'],
rules: { rules: {
'@typescript-eslint/explicit-function-return-type': 'off',
'@typescript-eslint/no-explicit-any': 'error',
'react/prop-types': 'off',
'react/react-in-jsx-scope': 'off',
'react-hooks/rules-of-hooks': 'error',
'react-hooks/exhaustive-deps': 'warn',
'no-console': 'warn', 'no-console': 'warn',
'sort-imports': 'error' 'sort-imports': 'error'
} },
overrides: [
{
files: ['packages/cli/**/*', 'packages/mock/**/*', 'packages/server/**/*', 'packages/serverless/**/*'],
extends: [
'plugin:@typescript-eslint/recommended',
'prettier/@typescript-eslint',
'plugin:prettier/recommended'
],
parser: '@typescript-eslint/parser',
rules: {
'@typescript-eslint/explicit-function-return-type': 'off',
'@typescript-eslint/no-explicit-any': 'error'
}
},
{
files: ['packages/core/**/*', 'packages/i18n/**/*'],
extends: [
'plugin:@typescript-eslint/recommended',
'plugin:react/recommended',
'prettier/@typescript-eslint',
'plugin:prettier/recommended'
],
parser: '@typescript-eslint/parser',
parserOptions: {
ecmaFeatures: {
jsx: true
},
ecmaVersion: 2018,
sourceType: 'module'
},
plugins: ['react-hooks'],
settings: {
react: {
version: 'detect'
}
},
rules: {
'@typescript-eslint/explicit-function-return-type': 'off',
'@typescript-eslint/no-explicit-any': 'error',
'react/prop-types': 'off',
'react/react-in-jsx-scope': 'off',
'react-hooks/rules-of-hooks': 'error',
'react-hooks/exhaustive-deps': 'warn'
}
}
]
}; };
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files. # See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
# dependencies # dependencies
/node_modules node_modules
/.pnp .pnp
.pnp.js .pnp.js
# testing # testing
/coverage coverage
# next.js # next.js
/.next/ .next
/serverless/
# production # production
/build build
/dist dist
# misc # misc
.DS_Store .DS_Store
...@@ -25,6 +24,7 @@ ...@@ -25,6 +24,7 @@
npm-debug.log* npm-debug.log*
yarn-debug.log* yarn-debug.log*
yarn-error.log* yarn-error.log*
lerna-debug.log*
# output # output
/output/ /output
dist dist
serverless out
wasm wasm
output output
FROM node:12-alpine
# Create app directory
WORKDIR /usr/src/app
ENV NODE_ENV production
ENV PORT 8999
ENV HOST 0.0.0.0
COPY package.json .
COPY yarn.lock .
RUN yarn install --frozen-lockfile
COPY dist dist
COPY public public
COPY ecosystem.config.js ecosystem.config.js
EXPOSE 8999
ENTRYPOINT ["yarn", "start"]
../LICENSE
\ No newline at end of file
{
"packages": [
"packages/*"
],
"version": "2.0.0-beta.32",
"npmClient": "yarn",
"useWorkspaces": true,
"command": {
"version": {
"exact": true
},
"publish": {
"exact": true
}
}
}
const path = require('path');
module.exports = { module.exports = {
'**/*.ts?(x)': () => ['tsc -p tsconfig.json --noEmit', 'tsc -p server/tsconfig.json --noEmit'], '**/*.ts?(x)': async filenames =>
[
...new Set(
filenames.map(
filename => path.relative(path.join(process.cwd(), 'packages'), filename).split(path.sep)[0]
)
)
].map(p => `tsc -p ${path.join(process.cwd(), 'packages', p, 'tsconfig.json')} --noEmit`),
'**/*.(j|t)s?(x)': filenames => `eslint ${filenames.join(' ')}` '**/*.(j|t)s?(x)': filenames => `eslint ${filenames.join(' ')}`
}; };
{ {
"name": "visualdl", "name": "visualdl",
"private": true,
"workspaces": [
"packages/*"
],
"version": "2.0.0-beta.26", "version": "2.0.0-beta.26",
"title": "VisualDL",
"description": "A platform to visualize the deep learning process and result.", "description": "A platform to visualize the deep learning process and result.",
"keywords": [ "keywords": [
"visualdl", "visualdl",
...@@ -24,112 +27,31 @@ ...@@ -24,112 +27,31 @@
"directory": "frontend" "directory": "frontend"
}, },
"scripts": { "scripts": {
"dev": "cross-env NODE_ENV=development nodemon --watch server --ext ts --exec \"ts-node --project server/tsconfig.json\" server/index.ts",
"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 --release --out-dir dist --out-name index wasm",
"build": "./scripts/build.sh", "build": "./scripts/build.sh",
"export": "next export -o serverless", "clean": "rimraf output */dist wasm/target",
"start": "pm2-runtime ecosystem.config.js", "lint": "eslint --ext .tsx,.jsx.ts,.js --ignore-path .gitignore .",
"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\"", "format": "prettier --write \"**/*.ts\" \"**/*.tsx\" \"**/*.js\"",
"test": "echo \"Error: no test specified\" && exit 0", "test": "yarn workspaces run test",
"prepublishOnly": "yarn lint && yarn test && ./scripts/build.sh", "prepublishOnly": "yarn lint && yarn test && yarn build",
"preversion": "yarn lint", "preversion": "yarn lint",
"version": "yarn format && git add -A" "version": "yarn format && git add -A"
}, },
"bin": "cli.js",
"files": [
"dist",
"serverless",
"public",
"wasm/dist",
"types",
"index.js",
"cli.js",
"ecosystem.config.js"
],
"dependencies": {
"bignumber.js": "9.0.0",
"dagre-d3": "0.6.4",
"detect-node": "2.0.4",
"echarts": "4.7.0",
"echarts-gl": "1.1.1",
"express": "4.17.1",
"hoist-non-react-statics": "3.3.2",
"http-proxy-middleware": "1.0.3",
"i18next": "19.3.3",
"i18next-browser-languagedetector": "4.0.2",
"i18next-express-middleware": "1.9.1",
"i18next-node-fs-backend": "2.1.3",
"i18next-xhr-backend": "3.2.2",
"isomorphic-unfetch": "3.0.0",
"lodash": "4.17.15",
"moment": "2.24.0",
"next": "9.3.1",
"nprogress": "0.2.0",
"open": "7.0.3",
"ora": "4.0.3",
"path-match": "1.2.4",
"pm2": "4.2.3",
"polished": "3.5.1",
"prop-types": "15.7.2",
"query-string": "6.11.1",
"react": "16.13.1",
"react-dom": "16.13.1",
"react-hooks-worker": "0.9.0",
"react-i18next": "11.3.4",
"react-input-range": "1.3.0",
"react-is": "16.13.1",
"react-spinners": "0.8.1",
"save-svg-as-png": "1.4.17",
"styled-components": "5.0.1",
"swr": "0.1.18",
"url": "0.11.0",
"yargs": "15.3.1"
},
"devDependencies": { "devDependencies": {
"@babel/core": "7.9.0", "@typescript-eslint/eslint-plugin": "2.27.0",
"@types/d3": "5.7.2", "@typescript-eslint/parser": "2.27.0",
"@types/dagre-d3": "^0.4.39",
"@types/echarts": "4.4.3",
"@types/express": "4.17.3",
"@types/faker": "4.1.10",
"@types/lodash": "4.14.149",
"@types/node": "13.9.3",
"@types/nprogress": "0.2.0",
"@types/react": "16.9.25",
"@types/react-dom": "16.9.5",
"@types/styled-components": "5.0.1",
"@types/webpack": "4.41.8",
"@types/yargs": "15.0.4",
"@typescript-eslint/eslint-plugin": "2.25.0",
"@typescript-eslint/parser": "2.25.0",
"@wasm-tool/wasm-pack-plugin": "1.2.0",
"babel-plugin-emotion": "10.0.29",
"babel-plugin-styled-components": "1.10.7",
"babel-plugin-typescript-to-proptypes": "1.3.2",
"core-js": "3",
"cross-env": "7.0.2",
"eslint": "6.8.0", "eslint": "6.8.0",
"eslint-config-prettier": "6.10.1", "eslint-config-prettier": "6.10.1",
"eslint-plugin-prettier": "3.1.2", "eslint-plugin-prettier": "3.1.2",
"eslint-plugin-react": "7.19.0", "eslint-plugin-react": "7.19.0",
"eslint-plugin-react-hooks": "2.5.1", "eslint-plugin-react-hooks": "3.0.0",
"faker": "4.1.0",
"husky": "4.2.3", "husky": "4.2.3",
"lint-staged": "10.0.9", "lerna": "^3.20.2",
"nodemon": "2.0.2", "lint-staged": "10.1.2",
"prettier": "2.0.2", "prettier": "2.0.4",
"ts-node": "8.8.1", "rimraf": "3.0.2",
"typescript": "3.8.3", "typescript": "3.8.3",
"worker-plugin": "4.0.2",
"yarn": "1.22.4" "yarn": "1.22.4"
}, },
"optionalDependencies": {
"wasm-pack": "0.9.1"
},
"engines": { "engines": {
"node": ">=10", "node": ">=10",
"npm": ">=6" "npm": ">=6"
......
../../../LICENSE
\ No newline at end of file
appId: org.paddlepaddle.visualdl
productName: VisualDL
files:
- 'index.js'
- 'resources/**/*'
directories:
buildResources: ./resources
mac:
category: public.app-category.developer-tools
darkModeSupport: false
hardenedRuntime: true
gatekeeperAssess: false
target:
- zip
win:
target:
- nsis
verifyUpdateCodeSignature: false
linux:
target:
- AppImage
nsis:
perMachine: true
publish: null
/* eslint-disable no-console */
/* eslint-disable @typescript-eslint/no-var-requires */
const path = require('path');
const http = require('http');
const {app, BrowserWindow, screen, nativeImage} = require('electron');
const pm2 = require('pm2');
const host = 'localhost';
async function getPort() {
return new Promise((resolve, reject) => {
const server = http.createServer();
server.listen(0);
server.on('listening', () => {
resolve(server.address().port);
server.close();
});
server.on('error', reject);
});
}
async function createWindow() {
const {width, height} = screen.getPrimaryDisplay().workAreaSize;
const win = new BrowserWindow({
minWidth: 800,
minHeight: 600,
width,
height,
icon: nativeImage.createFromPath(path.join(__dirname, 'resources/icon.png')),
webPreferences: {
devTools: false,
nodeIntegration: true
},
show: false
});
win.once('ready-to-show', () => {
win.show();
});
return win;
}
function startServer({port, host}) {
return new Promise((resolve, reject) => {
pm2.connect(err => {
if (err) {
reject(err);
}
const app = require('@visualdl/server/ecosystem.config').apps[0];
pm2.start(
{
...app,
instances: 1,
env: {
...app.env,
HOST: host,
PORT: port,
BACKEND: 'http://127.0.0.1:8040'
}
},
err => {
pm2.disconnect();
if (err) {
reject(err);
} else {
console.log(`Server listening at http://${host}:${port}`);
resolve();
}
}
);
});
});
}
function stopServer() {
return new Promise((resolve, reject) => {
pm2.connect(err => {
if (err) {
reject(err);
}
pm2.killDaemon(err => {
pm2.disconnect();
if (err) {
reject(err);
} else {
console.log('Server stopped');
resolve();
}
});
});
});
}
app.on('ready', async () => {
let port = 0;
try {
port = await getPort();
await startServer({port, host});
} catch (e) {
console.error(e);
app.exit(1);
return;
}
try {
const win = await createWindow();
win.loadURL(`http://${host}:${port}`);
} catch (e) {
console.error(e);
app.exit(1);
}
});
// app.on('activate', async () => {
// if (BrowserWindow.getAllWindows().length === 0) {
// try {
// await createWindow();
// } catch (e) {
// console.error(e);
// app.exit(1);
// }
// }
// });
// Quit when all windows are closed.
app.on('window-all-closed', () => {
app.quit();
// if (process.platform !== 'darwin') {
// app.quit();
// }
});
app.on('will-quit', async event => {
event.preventDefault();
try {
await stopServer();
app.exit(0);
} catch (e) {
console.error(e);
app.exit(1);
}
});
{
"name": "@visualdl/app",
"version": "2.0.0-beta.32",
"private": true,
"description": "A platform to visualize the deep learning process and result.",
"keywords": [
"visualdl",
"paddlepaddle",
"visualization",
"deep learning"
],
"homepage": "https://github.com/PaddlePaddle/VisualDL",
"bugs": {
"url": "https://github.com/PaddlePaddle/VisualDL/issues"
},
"license": "Apache-2.0",
"author": "PeterPanZH <littlepanzh@gmail.com> (https://github.com/PeterPanZH)",
"contributors": [
"Niandalu <littlepanzh@gmail.com> (https://github.com/Niandalu)"
],
"repository": {
"type": "git",
"url": "https://github.com/PaddlePaddle/VisualDL.git",
"directory": "frontend/app"
},
"scripts": {
"dev": "electron index.js",
"build": "electron-builder -mwl",
"test": "echo \"Error: no test specified\" && exit 0"
},
"dependencies": {
"@visualdl/server": "^2.0.0-beta.32",
"pm2": "4.2.3"
},
"devDependencies": {
"electron": "8.2.1",
"electron-builder": "22.4.1"
},
"engines": {
"node": ">=10",
"npm": ">=6"
},
"publishConfig": {
"access": "public"
},
"husky": {
"hooks": {
"pre-commit": "lint-staged"
}
}
}
<svg height="31" viewBox="0 0 50 31" width="50" xmlns="http://www.w3.org/2000/svg"><g fill="#fff" fill-rule="evenodd" transform="translate(0 .0625)"><path d="m2.446115.0742695c-1.32588958 0-2.40434375 1.0740707-2.40434375 2.39411403s1.07845417 2.39382156 2.40434375 2.39382156 2.40434375-1.07377823 2.40434375-2.39382156-1.07845417-2.39411403-2.40434375-2.39411403" transform="translate(23.010417 .023203)"/><path d="m.23204292 23.3006269h3.46595625c.06922708 0 .13199166-.0401668.16068125-.1029517l10.45446458-22.89241762c.0531687-.1163081-.0322146-.24831243-.1605833-.24831243h-3.4659563c-.0691292 0-.1318937.04026424-.1605833.10295168l-10.45456252 22.89241757c-.05307083.1163081.0323125.2483125.16058334.2483125" transform="translate(24.0875 6.652667)"/><path d="m2.48757292.0742695c-1.32588959 0-2.40434375 1.0740707-2.40434375 2.39411403s1.07845416 2.39382156 2.40434375 2.39382156c1.32588958 0 2.40434375-1.07377823 2.40434375-2.39382156s-1.07845417-2.39411403-2.40434375-2.39411403" transform="translate(43.866667 .023203)"/><path d="m17.4206283.05694515h-3.4659562c-.0691292 0-.1318938.04026424-.1605834.10304917l-4.08253745 8.93954011h-8.13765833c-.1075125 0-.2050375.06278493-.24900209.16047204l-1.31139791 2.91052983c-.04513959.1002219.02849375.2135077.13884583.2135077h8.05922708l-4.87203958 10.6682704c-.05307083.1163081.0323125.2483125.16058333.2483125h3.46595625c.06922709 0 .13199167-.0401668.16058334-.1029517l10.45456253-22.89241762c.0531687-.1163081-.0322146-.24831243-.1605834-.24831243" transform="translate(0 6.652667)"/><path d="m29.3354319 12.1665001c-.3381063-2.99856519-2.8049209-5.35027016-5.8800917-5.45507419-.0279062-.00107241-.0550292.00302226-.0813687.00887179-.0140021-.0049721-.0284938-.00887179-.0441605-.00887179h-2.1002145c-.0522875 0-.0995813.03032005-.121123.07779872l-1.2130895 2.67576877c-.0396563.08754793.0247729.18679491.1211229.18679491h2.1414375c.4538437-.00653197.7861729.02330061 1.1568854.08062598 1.7253896.26693343 2.7979687 1.52672661 2.7732937 3.19686421-.0235 1.5783974-1.3395979 2.8354608-2.9250645 2.8354608h-7.669225c-.1306209 0-.2491.0760439-.3029542.1943018l-1.2729167 2.7896396c-.0615896.1347341.0376.2880892.1863354.2880892h8.9637813c3.7159375 0 6.6818333-3.1934519 6.2673521-6.8702698"/><path d="m50.1567746 12.1665001c-.3381063-2.99856519-2.8049209-5.35027016-5.8801896-5.45507419-.0279063-.00107241-.0549313.00302226-.0813688.00887179-.0139041-.0049721-.0283958-.00887179-.0440625-.00887179h-2.1003125c-.0521895 0-.0995812.03032005-.1211229.07779872l-1.2130896 2.67576877c-.0395583.08754793.024675.18679491.1212209.18679491h2.1413396c.4539416-.00653197.7862708.02330061 1.1569833.08062598 1.7252917.26693343 2.7978708 1.52672661 2.7731958 3.19686421-.0235 1.5783974-1.3395979 2.8354608-2.9250646 2.8354608h-7.669127c-.1306209 0-.2491.0760439-.3030521.1943018l-1.2729167 2.7896396c-.0614916.1347341.0376979.2880892.1863354.2880892h8.9638792c3.7158396 0 6.6817354-3.1934519 6.2673521-6.8702698"/></g></svg>
\ No newline at end of file
../../../LICENSE
\ No newline at end of file
...@@ -2,6 +2,13 @@ ...@@ -2,6 +2,13 @@
/* eslint-disable @typescript-eslint/no-var-requires */ /* eslint-disable @typescript-eslint/no-var-requires */
/* eslint-disable no-console */ /* eslint-disable no-console */
import ora, {Ora} from 'ora';
import ecosystem from '@visualdl/server/ecosystem.config';
import pm2 from 'pm2';
const app = ecosystem.apps[0];
const argv = require('yargs') const argv = require('yargs')
.usage('Usage: $0 <command> [options]') .usage('Usage: $0 <command> [options]')
.command('start', 'Start VisualDL server') .command('start', 'Start VisualDL server')
...@@ -22,7 +29,6 @@ const argv = require('yargs') ...@@ -22,7 +29,6 @@ const argv = require('yargs')
.describe('b', 'Backend API address') .describe('b', 'Backend API address')
.boolean('open') .boolean('open')
.describe('open', 'Open browser when server is ready') .describe('open', 'Open browser when server is ready')
.demandOption(['b'])
.help('h') .help('h')
.alias('h', 'help') .alias('h', 'help')
.epilog('Visit https://github.com/PaddlePaddle/VisualDL for more information.').argv; .epilog('Visit https://github.com/PaddlePaddle/VisualDL for more information.').argv;
...@@ -34,7 +40,7 @@ const exit = () => { ...@@ -34,7 +40,7 @@ const exit = () => {
process.exit(1); process.exit(1);
}; };
const exitIfError = (err, exitCode = 1, spinner) => { const exitIfError = (err?: Error, exitCode = 1, spinner?: Ora) => {
if (!err) { if (!err) {
return; return;
} }
...@@ -64,34 +70,28 @@ const banner = ` ...@@ -64,34 +70,28 @@ const banner = `
`; `;
const pm2 = require('pm2');
pm2.connect(err => { pm2.connect(err => {
exitIfError(err, 2); exitIfError(err, 2);
pm2.list((err, list) => { pm2.list((err, list) => {
exitIfError(err, 2); exitIfError(err, 2);
const ecosystem = require('./ecosystem.config');
const app = ecosystem.apps[0];
const host = argv.host || 'localhost'; const host = argv.host || 'localhost';
const port = Number.parseInt(argv.port, 10) || 8999; const port = Number.parseInt(argv.port, 10) || 8999;
const url = `http://${host}:${port}`; const url = `http://${host}:${port}`;
const ora = require('ora');
if (command === 'start') { if (command === 'start') {
if (list.find(item => item.name === app.name)) { if (list.find(item => item.name === app.name)) {
exitIfError('VisualDL server is already running', 1); exitIfError(new Error('VisualDL server is already running'), 1);
} }
const spinner = ora('Starting VisualDL server...').start(); const spinner = ora('Starting VisualDL server...').start();
pm2.start( pm2.start(
{ {
...app, ...app,
env: { env: {
NODE_ENV: 'production', ...app.env,
HOST: host, HOST: host,
PORT: port, PORT: port + '',
BACKEND: argv.backend BACKEND: argv.backend
} }
}, },
...@@ -110,12 +110,12 @@ pm2.connect(err => { ...@@ -110,12 +110,12 @@ pm2.connect(err => {
); );
} else if (command === 'stop') { } else if (command === 'stop') {
if (!list.find(item => item.name === app.name)) { if (!list.find(item => item.name === app.name)) {
exitIfError('VisualDL server is not running', 1); exitIfError(new Error('VisualDL server is not running'), 1);
} }
const spinner = ora('Stopping VisualDL server...').start(); const spinner = ora('Stopping VisualDL server...').start();
pm2.delete(app.name, err => { pm2.delete(app.name, err => {
exitIfError(err, 2); exitIfError(err, 2);
const end = err => { const end = (err?: Error) => {
pm2.disconnect(); pm2.disconnect();
exitIfError(err, 2); exitIfError(err, 2);
......
{
"name": "@visualdl/cli",
"version": "2.0.0-beta.32",
"description": "A platform to visualize the deep learning process and result.",
"keywords": [
"visualdl",
"paddlepaddle",
"visualization",
"deep learning"
],
"homepage": "https://github.com/PaddlePaddle/VisualDL",
"bugs": {
"url": "https://github.com/PaddlePaddle/VisualDL/issues"
},
"license": "Apache-2.0",
"author": "PeterPanZH <littlepanzh@gmail.com> (https://github.com/PeterPanZH)",
"contributors": [
"Niandalu <littlepanzh@gmail.com> (https://github.com/Niandalu)"
],
"repository": {
"type": "git",
"url": "https://github.com/PaddlePaddle/VisualDL.git",
"directory": "frontend/cli"
},
"scripts": {
"dev": "cross-env NODE_ENV=development ts-node index.ts",
"build": "tsc",
"start": "node index.js",
"test": "echo \"Error: no test specified\" && exit 0"
},
"bin": "dist/index.js",
"types": "dist/index.d.ts",
"files": [
"dist"
],
"dependencies": {
"@visualdl/server": "^2.0.0-beta.32",
"open": "7.0.3",
"ora": "4.0.3",
"pm2": "4.2.3",
"yargs": "15.3.1"
},
"devDependencies": {
"@types/node": "13.11.0",
"@types/yargs": "15.0.4",
"cross-env": "7.0.2",
"ts-node": "8.8.2",
"typescript": "3.8.3"
},
"engines": {
"node": ">=10",
"npm": ">=6"
},
"publishConfig": {
"access": "public"
},
"husky": {
"hooks": {
"pre-commit": "lint-staged"
}
},
"gitHead": "d9641c770d9bc4037b2f1cb644fba198bd11a752"
}
{
"compilerOptions": {
"target": "es5",
"lib": [
"esnext",
"esnext.asynciterable",
"dom"
],
"moduleResolution": "node",
"esModuleInterop": true,
"declaration": true,
"skipLibCheck": true,
"outDir": "dist"
}
}
../../../LICENSE
\ No newline at end of file
/* eslint-disable no-console */
import ora from 'ora';
import path from 'path';
import {spawn} from 'child_process';
import {writeFileSync} from 'fs';
const next = require.resolve('next/dist/bin/next');
export const projectRoot = path.dirname(require.resolve('@visualdl/core'));
export default function (action: string, ...args: string[]): Promise<number> {
return new Promise((resolve, reject) => {
const capitalizedAction = action.replace(/^./, w => w.toUpperCase());
const spinner = ora(`${capitalizedAction} in process...`).start();
const log = path.join(process.cwd(), `${action}.log`);
writeFileSync(log, '', {flag: 'w'});
const p = spawn(next, [action, ...args], {
cwd: projectRoot,
env: {
...process.env,
NODE_ENV: 'production'
}
});
p.stdout.on('data', data => writeFileSync(log, data, {flag: 'a'}));
p.stderr.on('data', data => writeFileSync(log, data, {flag: 'a'}));
p.on('close', code => {
if (code) {
spinner.fail(`${capitalizedAction} failed!`);
console.error(`Please refer to ${log} for more detail.`);
reject(code);
} else {
spinner.succeed(`${capitalizedAction} complete!`);
resolve(code);
}
});
});
}
...@@ -14,7 +14,7 @@ const height = rem(600); ...@@ -14,7 +14,7 @@ const height = rem(600);
const divideWasm = () => const divideWasm = () =>
// eslint-disable-next-line @typescript-eslint/ban-ts-ignore // eslint-disable-next-line @typescript-eslint/ban-ts-ignore
// @ts-ignore // @ts-ignore
import('~/wasm/dist').then(({divide}) => (params: DivideParams) => import('@visualdl/wasm').then(({divide}) => (params: DivideParams) =>
(divide(params.points, params.labels, !!params.visibility, params.keyword ?? '') as unknown) as [ (divide(params.points, params.labels, !!params.visibility, params.keyword ?? '') as unknown) as [
Point[], Point[],
Point[] Point[]
......
...@@ -11,10 +11,18 @@ import { ...@@ -11,10 +11,18 @@ import {
transitionProps transitionProps
} from '~/utils/style'; } from '~/utils/style';
import intersection from 'lodash/intersection';
import styled from 'styled-components'; import styled from 'styled-components';
import {useRouter} from 'next/router'; import {useRouter} from 'next/router';
const navItems = ['scalars', 'samples', 'graphs', 'high-dimensional']; const buildNavItems = process.env.NAV_ITEMS;
const allNavItems = ['scalars', 'samples', 'graphs', 'high-dimensional'];
const navItems = buildNavItems
? intersection(
buildNavItems.split(',').map(item => item.trim()),
allNavItems
)
: allNavItems;
const Nav = styled.nav` const Nav = styled.nav`
background-color: ${navbarBackgroundColor}; background-color: ${navbarBackgroundColor};
......
...@@ -27,15 +27,11 @@ const width = em(430); ...@@ -27,15 +27,11 @@ const width = em(430);
const height = em(320); const height = em(320);
const smoothWasm = () => const smoothWasm = () =>
// eslint-disable-next-line @typescript-eslint/ban-ts-ignore import('@visualdl/wasm').then(({transform}) => (params: TransformParams) =>
// @ts-ignore
import('~/wasm/dist').then(({transform}) => (params: TransformParams) =>
(transform(params.datasets, params.smoothing) as unknown) as Dataset[] (transform(params.datasets, params.smoothing) as unknown) as Dataset[]
); );
const rangeWasm = () => const rangeWasm = () =>
// eslint-disable-next-line @typescript-eslint/ban-ts-ignore import('@visualdl/wasm').then(({range}) => (params: RangeParams) =>
// @ts-ignore
import('~/wasm/dist').then(({range}) => (params: RangeParams) =>
(range(params.datasets, params.outlier) as unknown) as Range (range(params.datasets, params.outlier) as unknown) as Range
); );
......
module.exports = require('./dist');
declare type NextEnv = {
API_URL: string;
DEFAULT_LANGUAGE: string;
LANGUAGES: string[];
LOCALE_PATH: string;
};
declare interface NextConfig {
env: NextEnv;
}
const nextConfig: NextConfig;
export default nextConfig;
export const env: NextEnv;
...@@ -31,6 +31,7 @@ module.exports = { ...@@ -31,6 +31,7 @@ module.exports = {
DEFAULT_LANGUAGE, DEFAULT_LANGUAGE,
LOCALE_PATH, LOCALE_PATH,
LANGUAGES, LANGUAGES,
NAV_ITEMS: process.env.NAV_ITEMS,
PUBLIC_PATH: publicPath, PUBLIC_PATH: publicPath,
API_URL: apiUrl API_URL: apiUrl
}, },
...@@ -44,11 +45,9 @@ module.exports = { ...@@ -44,11 +45,9 @@ module.exports = {
experimental: { experimental: {
basePath: publicPath basePath: publicPath
}, },
webpack: (config, {dev, webpack}) => { webpack: config => {
const WorkerPlugin = require('worker-plugin'); const WorkerPlugin = require('worker-plugin');
config.output.webassemblyModuleFilename = 'static/wasm/[modulehash].wasm';
config.resolve = config.resolve || {}; config.resolve = config.resolve || {};
config.resolve.alias = config.resolve.alias || {}; config.resolve.alias = config.resolve.alias || {};
config.resolve.alias['~'] = path.resolve(__dirname); config.resolve.alias['~'] = path.resolve(__dirname);
...@@ -66,19 +65,6 @@ module.exports = { ...@@ -66,19 +65,6 @@ module.exports = {
}) })
]; ];
if (!dev || !!process.env.WITH_WASM) {
const WasmPackPlugin = require('@wasm-tool/wasm-pack-plugin');
config.plugins.push(
new WasmPackPlugin({
crateDirectory: path.resolve(__dirname, 'wasm'),
outDir: 'dist',
outName: 'index'
})
);
} else {
config.plugins.push(new webpack.IgnorePlugin(/^~\/wasm\//));
}
return config; return config;
} }
}; };
{
"name": "@visualdl/core",
"version": "2.0.0-beta.32",
"title": "VisualDL",
"description": "A platform to visualize the deep learning process and result.",
"keywords": [
"visualdl",
"paddlepaddle",
"visualization",
"deep learning"
],
"homepage": "https://github.com/PaddlePaddle/VisualDL",
"bugs": {
"url": "https://github.com/PaddlePaddle/VisualDL/issues"
},
"license": "Apache-2.0",
"author": "PeterPanZH <littlepanzh@gmail.com> (https://github.com/PeterPanZH)",
"contributors": [
"Niandalu <littlepanzh@gmail.com> (https://github.com/Niandalu)"
],
"repository": {
"type": "git",
"url": "https://github.com/PaddlePaddle/VisualDL.git",
"directory": "frontend/core"
},
"scripts": {
"dev": "next",
"build": "next build",
"export": "next export",
"start": "next start",
"test": "echo \"Error: no test specified\" && exit 0"
},
"dependencies": {
"@visualdl/i18n": "^2.0.0-beta.32",
"@visualdl/wasm": "^2.0.0-beta.32",
"bignumber.js": "9.0.0",
"dagre-d3": "0.6.4",
"echarts": "4.7.0",
"echarts-gl": "1.1.1",
"isomorphic-unfetch": "3.0.0",
"lodash": "4.17.15",
"moment": "2.24.0",
"next": "9.3.4",
"nprogress": "0.2.0",
"polished": "3.5.1",
"prop-types": "15.7.2",
"query-string": "6.12.0",
"react": "16.13.1",
"react-dom": "16.13.1",
"react-hooks-worker": "0.9.0",
"react-input-range": "1.3.0",
"react-is": "16.13.1",
"react-spinners": "0.8.1",
"save-svg-as-png": "1.4.17",
"styled-components": "5.1.0",
"swr": "0.2.0"
},
"devDependencies": {
"@babel/core": "7.9.0",
"@types/d3": "5.7.2",
"@types/dagre-d3": "0.4.39",
"@types/echarts": "4.4.5",
"@types/lodash": "4.14.149",
"@types/node": "13.11.0",
"@types/nprogress": "0.2.0",
"@types/react": "16.9.32",
"@types/react-dom": "16.9.6",
"@types/styled-components": "5.0.1",
"@types/webpack": "4.41.10",
"@visualdl/mock": "^2.0.0-beta.32",
"babel-plugin-emotion": "10.0.33",
"babel-plugin-styled-components": "1.10.7",
"babel-plugin-typescript-to-proptypes": "1.3.2",
"core-js": "3.6.4",
"cross-env": "7.0.2",
"css-loader": "3.5.1",
"ora": "4.0.3",
"typescript": "3.8.3",
"worker-plugin": "4.0.2"
},
"engines": {
"node": ">=10",
"npm": ">=6"
},
"publishConfig": {
"access": "public"
},
"husky": {
"hooks": {
"pre-commit": "lint-staged"
}
},
"gitHead": "d9641c770d9bc4037b2f1cb644fba198bd11a752"
}
import mock from '@visualdl/mock';
const delay = Number.parseInt(process.env.DELAY || '', 10);
export default mock({delay: delay ? () => Math.random() * delay : 0});
...@@ -8,7 +8,7 @@ import AsideDivider from '~/components/AsideDivider'; ...@@ -8,7 +8,7 @@ import AsideDivider from '~/components/AsideDivider';
import ChartPage from '~/components/ChartPage'; import ChartPage from '~/components/ChartPage';
import Checkbox from '~/components/Checkbox'; import Checkbox from '~/components/Checkbox';
import Content from '~/components/Content'; import Content from '~/components/Content';
import Field from '~/components/Field'; // import Field from '~/components/Field';
// import Icon from '~/components/Icon'; // import Icon from '~/components/Icon';
import Preloader from '~/components/Preloader'; import Preloader from '~/components/Preloader';
import RunSelect from '~/components/RunSelect'; import RunSelect from '~/components/RunSelect';
...@@ -16,8 +16,8 @@ import RunningToggle from '~/components/RunningToggle'; ...@@ -16,8 +16,8 @@ import RunningToggle from '~/components/RunningToggle';
import SampleChart from '~/components/SamplesPage/SampleChart'; import SampleChart from '~/components/SamplesPage/SampleChart';
import TagFilter from '~/components/TagFilter'; import TagFilter from '~/components/TagFilter';
import Title from '~/components/Title'; import Title from '~/components/Title';
import {rem} from '~/utils/style'; // import {rem} from '~/utils/style';
import styled from 'styled-components'; // import styled from 'styled-components';
import useTagFilter from '~/hooks/useTagFilter'; import useTagFilter from '~/hooks/useTagFilter';
// const StyledIcon = styled(Icon)` // const StyledIcon = styled(Icon)`
...@@ -33,10 +33,6 @@ import useTagFilter from '~/hooks/useTagFilter'; ...@@ -33,10 +33,6 @@ import useTagFilter from '~/hooks/useTagFilter';
// vertical-align: text-top; // vertical-align: text-top;
// `; // `;
const SubField = styled(Field)`
margin-left: ${rem(26)};
`;
type Item = { type Item = {
run: string; run: string;
label: string; label: string;
...@@ -81,11 +77,9 @@ const Samples: NextI18NextPage = () => { ...@@ -81,11 +77,9 @@ const Samples: NextI18NextPage = () => {
</Checkbox> </Checkbox>
</Field> */} </Field> */}
{showImage && ( {showImage && (
<SubField> <Checkbox value={showActualSize} onChange={setShowActualSize}>
<Checkbox value={showActualSize} onChange={setShowActualSize}> {t('show-actual-size')}
{t('show-actual-size')} </Checkbox>
</Checkbox>
</SubField>
)} )}
{/* <AsideDivider /> {/* <AsideDivider />
<Field> <Field>
......
...@@ -4,7 +4,7 @@ import {ChartDataParams, RangeParams, TooltipData, TransformParams, xAxisMap} fr ...@@ -4,7 +4,7 @@ import {ChartDataParams, RangeParams, TooltipData, TransformParams, xAxisMap} fr
import {formatTime, quantile} from '~/utils'; import {formatTime, quantile} from '~/utils';
import BigNumber from 'bignumber.js'; import BigNumber from 'bignumber.js';
import {I18n} from '~/utils/i18next/types'; import {I18n} from '@visualdl/i18n';
import cloneDeep from 'lodash/cloneDeep'; import cloneDeep from 'lodash/cloneDeep';
import compact from 'lodash/compact'; import compact from 'lodash/compact';
import maxBy from 'lodash/maxBy'; import maxBy from 'lodash/maxBy';
......
{
"compilerOptions": {
"jsx": "preserve",
"target": "es2018",
"module": "esnext",
"moduleResolution": "node",
"lib": [
"esnext",
"esnext.asynciterable",
"dom"
],
"esModuleInterop": true,
"allowJs": true,
"resolveJsonModule": true,
"sourceMap": true,
"strict": true,
"noEmit": true,
"baseUrl": ".",
"paths": {
"~/*": [
"./*"
]
},
"types": [
"@types/node"
],
"skipLibCheck": true,
"forceConsistentCasingInFileNames": true,
"isolatedModules": true
},
"exclude": [
"server",
"node_modules"
],
"include": [
"next-env.d.ts",
"**/*.ts",
"**/*.tsx"
]
}
...@@ -52,8 +52,3 @@ declare module '*.module.sass' { ...@@ -52,8 +52,3 @@ declare module '*.module.sass' {
const classes: {readonly [key: string]: string}; const classes: {readonly [key: string]: string};
export default classes; export default classes;
} }
declare module '*.wasm' {
const wasm: Record<string, Function>;
export default wasm;
}
...@@ -147,7 +147,7 @@ export const yAxis = { ...@@ -147,7 +147,7 @@ export const yAxis = {
axisLabel: { axisLabel: {
fontSize: 12, fontSize: 12,
color: '#666', color: '#666',
formatter: (v: number) => Number.parseFloat(v.toPrecision(5)) formatter: (v: number) => (v < 0.0001 ? v.toExponential(1) : Number.parseFloat(v.toFixed(4)))
}, },
splitLine: { splitLine: {
lineStyle: { lineStyle: {
......
import {NextComponentType, NextPageContext} from 'next'; import {NextComponentType, NextPageContext} from 'next';
import NextI18Next from './i18next'; import NextI18Next from '@visualdl/i18n';
import {env} from '../next.config'; import {env} from '../next.config';
import moment from 'moment'; import moment from 'moment';
...@@ -27,6 +27,10 @@ const nextI18Next = new NextI18Next({ ...@@ -27,6 +27,10 @@ const nextI18Next = new NextI18Next({
}, {} as Record<string, string>) }, {} as Record<string, string>)
}); });
export default nextI18Next;
export const {i18n, appWithTranslation, withTranslation, useTranslation, Router, Link, Trans} = nextI18Next;
// from ~/node_modules/next/types/index.d.ts // from ~/node_modules/next/types/index.d.ts
// https://gitlab.com/kachkaev/website-frontend/-/blob/master/src/i18n.ts#L64-68 // https://gitlab.com/kachkaev/website-frontend/-/blob/master/src/i18n.ts#L64-68
export type NextI18NextPage<P = {}, IP = P> = NextComponentType< export type NextI18NextPage<P = {}, IP = P> = NextComponentType<
...@@ -34,7 +38,3 @@ export type NextI18NextPage<P = {}, IP = P> = NextComponentType< ...@@ -34,7 +38,3 @@ export type NextI18NextPage<P = {}, IP = P> = NextComponentType<
IP & {namespacesRequired: string[]}, IP & {namespacesRequired: string[]},
P & {namespacesRequired: string[]} P & {namespacesRequired: string[]}
>; >;
export default nextI18Next;
export const {i18n, appWithTranslation, withTranslation, useTranslation, Router, Link, Trans} = nextI18Next;
../../../LICENSE
\ No newline at end of file
import {Handler} from 'express';
import NextI18Next from './types';
declare function nextI18NextMiddleware(nexti18next: NextI18Next): Handler[];
export default nextI18NextMiddleware;
module.exports = require('./dist/middlewares/next-i18next-middleware');
{
"name": "@visualdl/i18n",
"version": "2.0.0-beta.32",
"description": "A platform to visualize the deep learning process and result.",
"keywords": [
"visualdl",
"paddlepaddle",
"visualization",
"deep learning"
],
"homepage": "https://github.com/PaddlePaddle/VisualDL",
"bugs": {
"url": "https://github.com/PaddlePaddle/VisualDL/issues"
},
"license": "Apache-2.0",
"author": "PeterPanZH <littlepanzh@gmail.com> (https://github.com/PeterPanZH)",
"contributors": [
"Niandalu <littlepanzh@gmail.com> (https://github.com/Niandalu)"
],
"repository": {
"type": "git",
"url": "https://github.com/PaddlePaddle/VisualDL.git",
"directory": "frontend/i18n"
},
"scripts": {
"build": "tsc",
"test": "echo \"Error: no test specified\" && exit 0"
},
"files": [
"dist",
"types.d.ts",
"middleware.js",
"middleware.d.ts"
],
"main": "dist/index.js",
"types": "types.d.ts",
"dependencies": {
"detect-node": "2.0.4",
"hoist-non-react-statics": "3.3.2",
"i18next": "19.3.4",
"i18next-browser-languagedetector": "4.0.2",
"i18next-express-middleware": "1.9.1",
"i18next-node-fs-backend": "2.1.3",
"i18next-xhr-backend": "3.2.2",
"path-match": "1.2.4",
"prop-types": "15.7.2",
"react-i18next": "11.3.4",
"url": "0.11.0"
},
"devDependencies": {
"@types/express": "4.17.4",
"@types/hoist-non-react-statics": "3.3.1",
"@types/node": "13.11.0",
"@types/react": "16.9.32",
"@types/react-dom": "16.9.6",
"typescript": "3.8.3"
},
"peerDependencies": {
"express": "^4.17.1",
"next": "^9.3.4",
"react": "^16.13.1",
"react-dom": "^16.13.1"
},
"engines": {
"node": ">=10",
"npm": ">=6"
},
"publishConfig": {
"access": "public"
},
"husky": {
"hooks": {
"pre-commit": "lint-staged"
}
},
"gitHead": "d9641c770d9bc4037b2f1cb644fba198bd11a752"
}
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
/* eslint-disable @typescript-eslint/no-explicit-any */ /* eslint-disable @typescript-eslint/no-explicit-any */
import {Config, I18n} from '../types'; import {Config, I18n} from '../../types';
import NextLink, {LinkProps} from 'next/link'; import NextLink, {LinkProps} from 'next/link';
import {lngPathCorrector, subpathIsRequired} from '../utils'; import {lngPathCorrector, subpathIsRequired} from '../utils';
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
import {consoleMessage, isServer} from '../utils'; import {consoleMessage, isServer} from '../utils';
import {Config} from '../types'; import {Config} from '../../types';
import {defaultConfig} from './default-config'; import {defaultConfig} from './default-config';
const deepMergeObjects = ['backend', 'detection']; const deepMergeObjects = ['backend', 'detection'];
...@@ -33,7 +33,8 @@ export const createConfig = (userConfig: Config): Config => { ...@@ -33,7 +33,8 @@ export const createConfig = (userConfig: Config): Config => {
if (isServer()) { if (isServer()) {
const fs = eval("require('fs')"); const fs = eval("require('fs')");
const path = require('path'); // eslint-disable-line @typescript-eslint/no-var-requires const path = require('path'); // eslint-disable-line @typescript-eslint/no-var-requires
const projectRoot = process.cwd();
const projectRoot = combinedConfig.projectRoot || process.cwd();
let serverLocalePath = localePath; let serverLocalePath = localePath;
/* /*
......
import {Config, InitPromise} from './types'; import {Config, InitPromise} from '../types';
import I18nextBrowserLanguageDetector from 'i18next-browser-languagedetector'; import I18nextBrowserLanguageDetector from 'i18next-browser-languagedetector';
import i18n from 'i18next'; import i18n from 'i18next';
......
...@@ -4,7 +4,7 @@ import {I18nextProvider, withSSR} from 'react-i18next'; ...@@ -4,7 +4,7 @@ import {I18nextProvider, withSSR} from 'react-i18next';
import {isServer, lngFromReq, lngPathCorrector, lngsToLoad} from '../utils'; import {isServer, lngFromReq, lngPathCorrector, lngsToLoad} from '../utils';
import {AppContext} from 'next/app'; import {AppContext} from 'next/app';
import {I18n} from '../types'; import {I18n} from '../../types';
import NextI18Next from '../index'; import NextI18Next from '../index';
import {NextPageContext} from 'next'; import {NextPageContext} from 'next';
import {NextStaticProvider} from '../components'; import {NextStaticProvider} from '../components';
......
/* eslint-disable @typescript-eslint/no-explicit-any */ /* eslint-disable @typescript-eslint/no-explicit-any */
import {NextI18NextInternals} from '../types'; import {NextI18NextInternals} from '../../types';
import React from 'react'; import React from 'react';
export const withInternals = (WrappedComponent: any, config: NextI18NextInternals) => { export const withInternals = (WrappedComponent: any, config: NextI18NextInternals) => {
......
...@@ -9,7 +9,7 @@ import { ...@@ -9,7 +9,7 @@ import {
Trans as TransType, Trans as TransType,
UseTranslation, UseTranslation,
WithTranslationHocType WithTranslationHocType
} from './types'; } from '../types';
import {Trans, useTranslation, withTranslation} from 'react-i18next'; import {Trans, useTranslation, withTranslation} from 'react-i18next';
import {appWithTranslation, withInternals} from './hocs'; import {appWithTranslation, withInternals} from './hocs';
......
/* eslint-disable no-console */ /* eslint-disable no-console */
import {Config} from '../types'; import {Config} from '../../types';
import NextI18Next from '../index'; import NextI18Next from '../index';
type MessageType = 'error' | 'info' | 'warn'; type MessageType = 'error' | 'info' | 'warn';
......
import {Config} from '../types'; import {Config} from '../../types';
import {Request} from 'express'; import {Request} from 'express';
export const lngFromReq = (req: Request) => { export const lngFromReq = (req: Request) => {
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
import {format as formatUrl, parse as parseUrl} from 'url'; import {format as formatUrl, parse as parseUrl} from 'url';
import {removeSubpath, subpathFromLng, subpathIsPresent, subpathIsRequired} from './index'; import {removeSubpath, subpathFromLng, subpathIsPresent, subpathIsRequired} from './index';
import {Config} from '../types'; import {Config} from '../../types';
const parseAs = (originalAs: string | undefined, href: any) => { const parseAs = (originalAs: string | undefined, href: any) => {
const asType = typeof originalAs; const asType = typeof originalAs;
......
import {Config} from '../types'; import {Config} from '../../types';
export const subpathFromLng = (config: Config, language: string | null) => { export const subpathFromLng = (config: Config, language: string | null) => {
if (typeof language !== 'string') { if (typeof language !== 'string') {
......
import {Config} from '../types'; import {Config} from '../../types';
export const subpathIsRequired = (config: Config, language: string) => export const subpathIsRequired = (config: Config, language: string) =>
typeof config.localeSubpaths?.[language] === 'string'; typeof config.localeSubpaths?.[language] === 'string';
{
"compilerOptions": {
"jsx": "react",
"target": "es5",
"lib": [
"esnext",
"esnext.asynciterable",
"dom"
],
"moduleResolution": "node",
"esModuleInterop": true,
"skipLibCheck": true,
"allowSyntheticDefaultImports": true,
"outDir": "dist"
},
"include": [
"src/**/*"
]
}
/* eslint-disable @typescript-eslint/no-explicit-any */ /* eslint-disable @typescript-eslint/no-explicit-any */
declare module 'detect-node';
declare module 'path-match';
import * as React from 'react'; import * as React from 'react';
import {TFunction as I18NextTFunction, InitOptions, i18n} from 'i18next'; import {TFunction as I18NextTFunction, InitOptions, i18n} from 'i18next';
...@@ -14,6 +17,7 @@ import {LinkProps} from 'next/link'; ...@@ -14,6 +17,7 @@ import {LinkProps} from 'next/link';
import {SingletonRouter} from 'next/router'; import {SingletonRouter} from 'next/router';
export type InitConfig = { export type InitConfig = {
projectRoot?: string;
browserLanguageDetection?: boolean; browserLanguageDetection?: boolean;
serverLanguageDetection?: boolean; serverLanguageDetection?: boolean;
strictMode?: boolean; strictMode?: boolean;
......
../../../LICENSE
\ No newline at end of file
/* eslint-disable @typescript-eslint/camelcase */
export default { export default {
status: 0, status: 0,
msg: '', msg: '',
......
import path from 'path';
import faker from 'faker';
import {Request, Response} from 'express'; import {Request, Response} from 'express';
import faker from 'faker';
import path from 'path';
const sleep = (time: number) => { const sleep = (time: number) => {
return new Promise(resolve => setTimeout(resolve, time)); return new Promise(resolve => setTimeout(resolve, time));
}; };
export type Options = { export type Options = {
path: string; path?: string;
delay?: number | ((method: string) => number); delay?: number | ((method: string) => number);
}; };
export default (options: Options) => { export default (options: Options) => {
return async (req: Request, res: Response) => { return async (req: Request, res: Response) => {
const method = req.path.replace(/^\//, ''); let method = req.path;
if (!method) {
method = Array.isArray(req.query.method) ? req.query.method.join('/') : req.query.method;
} else {
method = method.replace(/^\//, '');
}
if (!method) { if (!method) {
res.status(404).send({}); res.status(404).send({});
...@@ -21,7 +27,7 @@ export default (options: Options) => { ...@@ -21,7 +27,7 @@ export default (options: Options) => {
} }
try { try {
let {default: mock} = await import(path.resolve(options.path, method)); let {default: mock} = await import(path.resolve(options.path || path.join(__dirname, 'data'), method));
if ('function' === typeof mock) { if ('function' === typeof mock) {
mock = await mock(req, res); mock = await mock(req, res);
......
{
"name": "@visualdl/mock",
"version": "2.0.0-beta.32",
"description": "A platform to visualize the deep learning process and result.",
"keywords": [
"visualdl",
"paddlepaddle",
"visualization",
"deep learning"
],
"homepage": "https://github.com/PaddlePaddle/VisualDL",
"bugs": {
"url": "https://github.com/PaddlePaddle/VisualDL/issues"
},
"license": "Apache-2.0",
"author": "PeterPanZH <littlepanzh@gmail.com> (https://github.com/PeterPanZH)",
"contributors": [
"Niandalu <littlepanzh@gmail.com> (https://github.com/Niandalu)"
],
"repository": {
"type": "git",
"url": "https://github.com/PaddlePaddle/VisualDL.git",
"directory": "frontend/mock"
},
"main": "dist/index.js",
"types": "dist/index.d.ts",
"files": [
"dist"
],
"scripts": {
"build": "tsc",
"test": "echo \"Error: no test specified\" && exit 0"
},
"dependencies": {
"faker": "4.1.0",
"isomorphic-unfetch": "3.0.0"
},
"devDependencies": {
"@types/express": "4.17.4",
"@types/faker": "4.1.11",
"@types/node": "13.11.0",
"typescript": "3.8.3"
},
"peerDependencies": {
"express": "^4.17.1"
},
"engines": {
"node": ">=10",
"npm": ">=6"
},
"publishConfig": {
"access": "public"
},
"husky": {
"hooks": {
"pre-commit": "lint-staged"
}
},
"gitHead": "d9641c770d9bc4037b2f1cb644fba198bd11a752"
}
{
"compilerOptions": {
"target": "es5",
"lib": [
"esnext",
"esnext.asynciterable",
"dom"
],
"moduleResolution": "node",
"esModuleInterop": true,
"declaration": true,
"skipLibCheck": true,
"outDir": "dist"
}
}
../../../LICENSE
\ No newline at end of file
/* eslint-disable no-console */
import builder, {projectRoot} from '@visualdl/core/build';
import {cp, mkdir, rm} from 'shelljs';
import config from './webpack.config';
import path from 'path';
import webpack from 'webpack';
const dist = path.resolve(__dirname, 'dist');
console.log('Building server');
console.log(`Source: ${projectRoot}`);
console.log(`Destination: ${dist}`);
async function start() {
try {
await builder('build');
rm('-rf', dist);
mkdir('-p', dist);
cp(
'-Rf',
['dist', 'pages', 'public', 'next.config.js', 'package.json'].map(file => path.join(projectRoot, file)),
dist
);
} catch (e) {
process.exit(e);
}
console.log('Webpack building...');
const compiler = webpack(config as webpack.Configuration);
compiler.run(err => {
if (err) {
console.error(err);
process.exit(1);
}
});
}
start();
declare type App = {
name: string;
script: string;
cwd: string;
args: string;
instances: number;
autorestart: boolean;
watch: boolean;
exec_mode: string;
max_memory_restart: string;
wait_ready: boolean;
env: {
[key: string]: string;
NODE_ENV: string;
};
};
declare const ecosystem: {
apps: App[];
};
export default ecosystem;
...@@ -5,8 +5,8 @@ module.exports = { ...@@ -5,8 +5,8 @@ module.exports = {
apps: [ apps: [
{ {
name: 'visualdl', name: 'visualdl',
script: 'dist/server/index.js', script: 'index.js',
cwd: __dirname, cwd: require('path').resolve(__dirname, './dist'),
args: '', args: '',
instances: 'max', instances: 'max',
autorestart: true, autorestart: true,
......
#!/usr/bin/env node
/* eslint-disable no-console */ /* eslint-disable no-console */
import config from '../next.config'; import config from '@visualdl/core/next.config';
import express from 'express'; import express from 'express';
import next from 'next'; import next from 'next';
import {nextI18NextMiddleware} from '../utils/i18next/middlewares'; import nextI18Next from '@visualdl/core/utils/i18n';
import nextI18next from '../utils/i18n'; import nextI18NextMiddleware from '@visualdl/i18n/middleware';
import path from 'path';
import {setConfig} from 'next/config'; import {setConfig} from 'next/config';
const isDev = process.env.NODE_ENV !== 'production'; const isDev = process.env.NODE_ENV !== 'production';
...@@ -15,9 +12,9 @@ const isDev = process.env.NODE_ENV !== 'production'; ...@@ -15,9 +12,9 @@ const isDev = process.env.NODE_ENV !== 'production';
setConfig(config); setConfig(config);
const host = process.env.HOST || 'localhost'; const host = process.env.HOST || 'localhost';
const port = Number.parseInt(process.env.PORT, 10) || 8999; const port = Number.parseInt(process.env.PORT || '', 10) || 8999;
const backend = process.env.BACKEND; const backend = process.env.BACKEND;
const delay = Number.parseInt(process.env.DELAY, 10); const delay = Number.parseInt(process.env.DELAY || '', 10);
const server = express(); const server = express();
const app = next({dev: isDev, conf: config}); const app = next({dev: isDev, conf: config});
...@@ -30,15 +27,12 @@ async function start() { ...@@ -30,15 +27,12 @@ async function start() {
const {createProxyMiddleware} = await import('http-proxy-middleware'); const {createProxyMiddleware} = await import('http-proxy-middleware');
server.use(config.env.API_URL, createProxyMiddleware({target: backend, changeOrigin: true})); server.use(config.env.API_URL, createProxyMiddleware({target: backend, changeOrigin: true}));
} else if (isDev) { } else if (isDev) {
const {default: mock} = await import('../utils/mock'); const {default: mock} = await import('@visualdl/mock');
server.use( server.use(config.env.API_URL, mock({delay: delay ? () => Math.random() * delay : 0}));
config.env.API_URL,
mock({path: path.resolve(__dirname, '../mock'), delay: delay ? () => Math.random() * delay : 0})
);
} }
await nextI18next.initPromise; await nextI18Next.initPromise;
server.use(nextI18NextMiddleware(nextI18next)); server.use(nextI18NextMiddleware(nextI18Next));
server.get(/\.wasm/, (_req, res, next) => { server.get(/\.wasm/, (_req, res, next) => {
res.type('application/wasm'); res.type('application/wasm');
...@@ -51,7 +45,7 @@ async function start() { ...@@ -51,7 +45,7 @@ async function start() {
process.send?.('ready'); process.send?.('ready');
console.log(`> Ready on http://${host}:${port}`); console.log(`> Ready on http://${host}:${port}`);
process.on('SIGINT', () => { process.on('SIGINT', () => {
s.close((err: Error) => { s.close((err: Error | undefined) => {
if (err) { if (err) {
throw err; throw err;
} }
......
{
"name": "@visualdl/server",
"version": "2.0.0-beta.32",
"description": "A platform to visualize the deep learning process and result.",
"keywords": [
"visualdl",
"paddlepaddle",
"visualization",
"deep learning"
],
"homepage": "https://github.com/PaddlePaddle/VisualDL",
"bugs": {
"url": "https://github.com/PaddlePaddle/VisualDL/issues"
},
"license": "Apache-2.0",
"author": "PeterPanZH <littlepanzh@gmail.com> (https://github.com/PeterPanZH)",
"contributors": [
"Niandalu <littlepanzh@gmail.com> (https://github.com/Niandalu)"
],
"repository": {
"type": "git",
"url": "https://github.com/PaddlePaddle/VisualDL.git",
"directory": "frontend/server"
},
"scripts": {
"dev": "cross-env NODE_ENV=development nodemon --watch . --ext ts --exec \"ts-node index.ts\"",
"dev:wasm": "cross-env WITH_WASM=1 yarn dev",
"build": "cross-env API_URL=/api ts-node build.ts",
"start": "pm2-runtime ecosystem.config.js",
"test": "echo \"Error: no test specified\" && exit 0"
},
"main": "dist/index.js",
"types": "dist/index.d.ts",
"files": [
"dist",
"ecosystem.config.js",
"ecosystem.config.d.ts"
],
"dependencies": {
"@visualdl/core": "^2.0.0-beta.32",
"@visualdl/i18n": "^2.0.0-beta.32",
"express": "4.17.1",
"http-proxy-middleware": "1.0.3",
"next": "9.3.4",
"pm2": "4.2.3"
},
"devDependencies": {
"@types/express": "4.17.4",
"@types/node": "13.11.0",
"@types/shelljs": "0.8.7",
"@visualdl/mock": "^2.0.0-beta.32",
"cross-env": "7.0.2",
"nodemon": "2.0.2",
"shelljs": "0.8.3",
"ts-loader": "6.2.2",
"ts-node": "8.8.2",
"typescript": "3.8.3",
"webpack": "4.42.1",
"webpack-cli": "3.3.11"
},
"engines": {
"node": ">=10",
"npm": ">=6"
},
"publishConfig": {
"access": "public"
},
"husky": {
"hooks": {
"pre-commit": "lint-staged"
}
},
"gitHead": "d9641c770d9bc4037b2f1cb644fba198bd11a752"
}
{ {
"extend": "../tsconfig.json",
"compilerOptions": { "compilerOptions": {
"jsx": "react",
"module": "commonjs", "module": "commonjs",
"target": "ES2018", "target": "ES2018",
"skipLibCheck": true,
"esModuleInterop": true, "esModuleInterop": true,
"typeRoots": ["../types"], "declaration": true,
"outDir": "../dist" "outDir": "dist"
}, },
"include": [ "files": [
"**/*" "index.ts"
] ]
} }
/* eslint-disable @typescript-eslint/no-var-requires */
const path = require('path');
// TODO: add dev server
module.exports = {
mode: process.env.NODE_ENV === 'development' ? 'development' : 'production',
entry: './index.ts',
output: {
path: path.resolve(__dirname, 'dist'),
filename: 'index.js'
},
target: 'node',
module: {
rules: [
{
test: /\.ts$/,
use: require.resolve('ts-loader')
}
]
},
resolve: {
extensions: ['.wasm', '.ts', '.mjs', '.js', '.json']
},
externals: (context, request, callback) => {
if (/^\./.test(request)) {
return callback();
}
if (/^@visualdl\/core/.test(request)) {
return callback();
}
callback(null, 'commonjs ' + request);
}
};
../../../LICENSE
\ No newline at end of file
/* eslint-disable no-console */
import builder, {projectRoot} from '@visualdl/core/build';
import path from 'path';
import rimraf from 'rimraf';
const dist = path.join(__dirname, 'dist');
console.log('Building serverless');
console.log(`Source: ${projectRoot}`);
console.log(`Destination: ${dist}`);
function clean(): Promise<void> {
return new Promise((resolve, reject) => {
rimraf(dist, err => {
if (err) {
reject(err);
} else {
resolve();
}
});
});
}
async function start() {
try {
await clean();
await builder('build');
await builder('export', '-o', dist);
} catch (e) {
process.exit(e);
}
process.exit(0);
}
start();
{
"name": "@visualdl/serverless",
"version": "2.0.0-beta.32",
"description": "A platform to visualize the deep learning process and result.",
"keywords": [
"visualdl",
"paddlepaddle",
"visualization",
"deep learning"
],
"homepage": "https://github.com/PaddlePaddle/VisualDL",
"bugs": {
"url": "https://github.com/PaddlePaddle/VisualDL/issues"
},
"license": "Apache-2.0",
"author": "PeterPanZH <littlepanzh@gmail.com> (https://github.com/PeterPanZH)",
"contributors": [
"Niandalu <littlepanzh@gmail.com> (https://github.com/Niandalu)"
],
"repository": {
"type": "git",
"url": "https://github.com/PaddlePaddle/VisualDL.git",
"directory": "frontend/serverless"
},
"main": "dist/index.html",
"files": [
"dist"
],
"scripts": {
"build": "cross-env PUBLIC_PATH=/app API_URL=/api ts-node build.ts",
"test": "echo \"Error: no test specified\" && exit 0"
},
"devDependencies": {
"@types/node": "13.11.0",
"@types/rimraf": "3.0.0",
"@visualdl/core": "^2.0.0-beta.32",
"cross-env": "7.0.2",
"rimraf": "3.0.2",
"ts-node": "8.8.2",
"typescript": "3.8.3"
},
"engines": {
"node": ">=10",
"npm": ">=6"
},
"publishConfig": {
"access": "public"
},
"husky": {
"hooks": {
"pre-commit": "lint-staged"
}
},
"gitHead": "d9641c770d9bc4037b2f1cb644fba198bd11a752"
}
{
"compilerOptions": {
"module": "commonjs",
"target": "ES2018",
"skipLibCheck": true,
"esModuleInterop": true
},
"files": [
"build.ts"
]
}
../../../LICENSE
\ No newline at end of file
../../README.md
\ No newline at end of file
{
"name": "@visualdl/wasm",
"version": "2.0.0-beta.32",
"title": "VisualDL",
"description": "A platform to visualize the deep learning process and result.",
"keywords": [
"visualdl",
"paddlepaddle",
"visualization",
"deep learning"
],
"homepage": "https://github.com/PaddlePaddle/VisualDL",
"bugs": {
"url": "https://github.com/PaddlePaddle/VisualDL/issues"
},
"license": "Apache-2.0",
"author": "PeterPanZH <littlepanzh@gmail.com> (https://github.com/PeterPanZH)",
"contributors": [
"Niandalu <littlepanzh@gmail.com> (https://github.com/Niandalu)"
],
"repository": {
"type": "git",
"url": "https://github.com/PaddlePaddle/VisualDL.git",
"directory": "frontend/wasm"
},
"files": [
"dist/index_bg.wasm",
"dist/index.js",
"dist/index.d.ts"
],
"module": "dist/index.js",
"types": "dist/index.d.ts",
"scripts": {
"build": "wasm-pack build --release --out-dir dist --out-name index .",
"test": "echo \"Error: no test specified\" && exit 0"
},
"devDependencies": {
"wasm-pack": "0.9.1"
},
"engines": {
"node": ">=10",
"npm": ">=6"
},
"publishConfig": {
"access": "public"
},
"husky": {
"hooks": {
"pre-commit": "lint-staged"
}
},
"gitHead": "d9641c770d9bc4037b2f1cb644fba198bd11a752"
}
...@@ -2,54 +2,23 @@ ...@@ -2,54 +2,23 @@
set -e set -e
if [ -f "$HOME/.cargo/env" ]; then
source $HOME/.cargo/env
fi
WORKING_PATH=`pwd` WORKING_PATH=`pwd`
SERVER_DIR="dist" SERVER_DIR="packages/server/dist"
SERVER_DIR_PATH="$WORKING_PATH/$SERVER_DIR" SERVER_DIR_PATH="$WORKING_PATH/$SERVER_DIR"
SERVERLESS_DIR="serverless" SERVERLESS_DIR="packages/serverless/dist"
SERVERLESS_DIR_PATH="$WORKING_PATH/$SERVERLESS_DIR" SERVERLESS_DIR_PATH="$WORKING_PATH/$SERVERLESS_DIR"
OUTPUT="output" OUTPUT="output"
OUTPUT_PATH="$WORKING_PATH/$OUTPUT" OUTPUT_PATH="$WORKING_PATH/$OUTPUT"
build_server() { # build
# generate dist npx lerna run build
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
cp -r public $SERVER_DIR_PATH
}
build_serverless() {
build_server
# generate dist
rm -rf $SERVERLESS_DIR_PATH
mkdir -p $SERVERLESS_DIR_PATH
# next export
yarn export
}
# generate output # generate output
rm -rf $OUTPUT_PATH rm -rf $OUTPUT_PATH
mkdir -p $OUTPUT_PATH mkdir -p $OUTPUT_PATH
# package serverless files
PUBLIC_PATH="/app" API_URL="/api" build_serverless
(cd $SERVERLESS_DIR_PATH && tar zcf $OUTPUT_PATH/serverless.tar.gz .)
# package server files # package server files
PUBLIC_PATH="" API_URL="/api" build_server
(cd $SERVER_DIR_PATH && tar zcf $OUTPUT_PATH/server.tar.gz .) (cd $SERVER_DIR_PATH && tar zcf $OUTPUT_PATH/server.tar.gz .)
# package serverless files
(cd $SERVERLESS_DIR_PATH && tar zcf $OUTPUT_PATH/serverless.tar.gz .)
#!/bin/bash
set -e
./scripts/build.sh
docker build -t paddlepaddle/visualdl .
#!/bin/bash #!/bin/bash
set -ex set -e
# rust toolchain # rust toolchain
# https://rustup.rs/ # https://rustup.rs/
...@@ -9,11 +9,34 @@ if ! hash rustup 2>/dev/null; then ...@@ -9,11 +9,34 @@ if ! hash rustup 2>/dev/null; then
source $HOME/.cargo/env source $HOME/.cargo/env
fi fi
# wasm-pack # wasm-pack
# wasm-pack will be installed by npm package
# https://rustwasm.github.io/wasm-pack/installer/ # https://rustwasm.github.io/wasm-pack/installer/
if ! hash wasm-pack 2>/dev/null; then # if ! hash wasm-pack 2>/dev/null; then
curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh # curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh
# fi
# wine
if hash apt 2>/dev/null; then
sudo dpkg --add-architecture i386
wget -nc https://download.opensuse.org/repositories/Emulators:/Wine:/Debian/xUbuntu_18.04/Release.key
sudo apt-key add Release.key
sudo apt-add-repository 'deb https://download.opensuse.org/repositories/Emulators:/Wine:/Debian/xUbuntu_18.04/ ./'
wget -nc https://dl.winehq.org/wine-builds/winehq.key
sudo apt-key add winehq.key
sudo apt-add-repository 'deb https://dl.winehq.org/wine-builds/ubuntu/ bionic main'
sudo apt update
sudo apt install --install-recommends winehq-stable
fi fi
# yarn
curl --compressed -o- -L https://yarnpkg.com/install.sh | bash
export PATH="$HOME/.yarn/bin:$HOME/.config/yarn/global/node_modules/.bin:$PATH"
# yarn install # yarn install
yarn install --frozen-lockfile yarn install --frozen-lockfile
{
"compilerOptions": {
"jsx": "preserve",
"target": "es2018",
"module": "esnext",
"moduleResolution": "node",
"lib": [
"esnext",
"esnext.asynciterable",
"dom"
],
"esModuleInterop": true,
"allowJs": true,
"resolveJsonModule": true,
"sourceMap": true,
"strict": true,
"noEmit": true,
"baseUrl": ".",
"paths": {
"~/*": [
"./*"
]
},
"types": [
"@types/node"
],
"skipLibCheck": true,
"forceConsistentCasingInFileNames": true,
"isolatedModules": true
},
"exclude": [
"server",
"node_modules"
],
"include": [
"next-env.d.ts",
"**/*.ts",
"**/*.tsx"
]
}
declare module 'detect-node';
declare module 'path-match';
因为 它太大了无法显示 source diff 。你可以改为 查看blob
...@@ -18,14 +18,12 @@ function check_duplicated($filename_format) { ...@@ -18,14 +18,12 @@ function check_duplicated($filename_format) {
function build_frontend_from_source() { function build_frontend_from_source() {
cd $FRONTEND_DIR cd $FRONTEND_DIR
$env:PUBLIC_PATH="/app"
$env:API_URL="/api"
# TODO: # TODO:
# ./scripts/build.sh # ./scripts/build.sh
} }
function build_frontend() { function build_frontend() {
$PACKAGE_NAME="visualdl" $PACKAGE_NAME="@visualdl/serverless"
$SRC=npm view $PACKAGE_NAME dist.tarball $SRC=npm view $PACKAGE_NAME dist.tarball
Invoke-WebRequest -Uri "$SRC" -OutFile "$BUILD_DIR/$PACKAGE_NAME.tar.gz" Invoke-WebRequest -Uri "$SRC" -OutFile "$BUILD_DIR/$PACKAGE_NAME.tar.gz"
# Need Windows 10 Insider Build 17063 and later # Need Windows 10 Insider Build 17063 and later
...@@ -33,7 +31,7 @@ function build_frontend() { ...@@ -33,7 +31,7 @@ function build_frontend() {
} }
function build_frontend_fake() { function build_frontend_fake() {
mkdir -p "$BUILD_DIR/package/serverless" mkdir -p "$BUILD_DIR/package/dist"
} }
function build_backend() { function build_backend() {
...@@ -66,8 +64,7 @@ function clean_env() { ...@@ -66,8 +64,7 @@ function clean_env() {
} }
function package() { function package() {
mkdir -p $TOP_DIR/visualdl/server/dist cp -Recurse $BUILD_DIR/package/dist $TOP_DIR/visualdl/server/
cp -Recurse $BUILD_DIR/package/serverless/* $TOP_DIR/visualdl/server/dist
cp $BUILD_DIR/visualdl/logic/Release/core.pyd $TOP_DIR/visualdl cp $BUILD_DIR/visualdl/logic/Release/core.pyd $TOP_DIR/visualdl
cp $BUILD_DIR/visualdl/logic/Release/core.pyd $TOP_DIR/visualdl/python/ cp $BUILD_DIR/visualdl/logic/Release/core.pyd $TOP_DIR/visualdl/python/
} }
......
...@@ -9,7 +9,7 @@ BUILD_DIR=$TOP_DIR/build ...@@ -9,7 +9,7 @@ BUILD_DIR=$TOP_DIR/build
mkdir -p $BUILD_DIR mkdir -p $BUILD_DIR
build_frontend_fake() { build_frontend_fake() {
mkdir -p "$BUILD_DIR/package/serverless" mkdir -p "$BUILD_DIR/package/dist"
} }
build_frontend_from_source() { build_frontend_from_source() {
...@@ -24,7 +24,10 @@ build_frontend_from_source() { ...@@ -24,7 +24,10 @@ build_frontend_from_source() {
} }
build_frontend() { build_frontend() {
local PACKAGE="visualdl" local PACKAGE="@visualdl/serverless"
local NAME=${PACKAGE#*@}
local NAME=${NAME////-}
echo $NAME
local TAG="latest" local TAG="latest"
local TARBALL="${PACKAGE}@${TAG}" local TARBALL="${PACKAGE}@${TAG}"
...@@ -34,7 +37,7 @@ build_frontend() { ...@@ -34,7 +37,7 @@ build_frontend() {
echo "Cannot get version" echo "Cannot get version"
exit 1 exit 1
fi fi
local FILENAME="${PACKAGE}-${VERSION}.tgz" local FILENAME="${NAME}-${VERSION}.tgz"
# get sha1sum # get sha1sum
local SHA1SUM=`npm view ${TARBALL} dist.shasum` local SHA1SUM=`npm view ${TARBALL} dist.shasum`
...@@ -42,7 +45,7 @@ build_frontend() { ...@@ -42,7 +45,7 @@ build_frontend() {
echo "Cannot get sha1sum" echo "Cannot get sha1sum"
exit 1 exit 1
fi fi
rm -f "$BUILD_DIR/${PACKAGE}-*.tgz.sha1" rm -f "$BUILD_DIR/${NAME}-*.tgz.sha1"
echo "${SHA1SUM} ${FILENAME}" > "$BUILD_DIR/${FILENAME}.sha1" echo "${SHA1SUM} ${FILENAME}" > "$BUILD_DIR/${FILENAME}.sha1"
local DOWNLOAD="1" local DOWNLOAD="1"
...@@ -61,7 +64,7 @@ build_frontend() { ...@@ -61,7 +64,7 @@ build_frontend() {
echo "Donwloading npm package, please wait..." echo "Donwloading npm package, please wait..."
# remove cache # remove cache
rm -f "$BUILD_DIR/${PACKAGE}-*.tgz" rm -f "$BUILD_DIR/${NAME}-*.tgz"
# download file # download file
FILENAME=`(cd $BUILD_DIR && npm pack ${TARBALL})` FILENAME=`(cd $BUILD_DIR && npm pack ${TARBALL})`
...@@ -108,8 +111,7 @@ clean_env() { ...@@ -108,8 +111,7 @@ clean_env() {
} }
package() { package() {
mkdir -p $TOP_DIR/visualdl/server/dist cp -rf $BUILD_DIR/package/dist $TOP_DIR/visualdl/server/
cp -rf $BUILD_DIR/package/serverless/* $TOP_DIR/visualdl/server/dist
cp $BUILD_DIR/visualdl/logic/core.so $TOP_DIR/visualdl cp $BUILD_DIR/visualdl/logic/core.so $TOP_DIR/visualdl
cp $BUILD_DIR/visualdl/logic/core.so $TOP_DIR/visualdl/python/ cp $BUILD_DIR/visualdl/logic/core.so $TOP_DIR/visualdl/python/
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册