Skip to content

Commit

Permalink
minor bugs fix (#815)
Browse files Browse the repository at this point in the history
* chore: window instead of globalThis to support more browser versions

* fix: chart toolbox icons gap chaos

* style: remove unused title in svgs

* fix: index loading not centered

* fix: get missing echarts loading back

* fix: date & time cannot be formatted to correct locale string (#813)

* chore: drop support of nodejs 12

* docs: update documentation
  • Loading branch information
PeterPanZH authored Sep 18, 2020
1 parent c0281d3 commit 29791b8
Show file tree
Hide file tree
Showing 49 changed files with 155 additions and 206 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ jobs:
matrix:
os: [ubuntu-latest, macos-latest]
python-version: ['3.5']
node-version: ['12']
node-version: ['14']
steps:
- name: Checkout
uses: actions/checkout@v2
Expand Down
7 changes: 5 additions & 2 deletions frontend/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ English | [简体中文](/~https://github.com/PaddlePaddle/VisualDL/blob/develop/f

## Usage

> nodejs ≥ 10 and npm ≥ 6 are required.
> nodejs ≥ 12 and npm ≥ 6 are required.
```bash
npm install -g @visualdl/cli
Expand Down Expand Up @@ -66,6 +66,8 @@ yarn

## Build & Deploy

> nodejs ≥ 14 and npm ≥ 6 are required.
> We only support building on Linux/MacOS now.
Run:
Expand All @@ -78,7 +80,7 @@ You will get `server.tar.gz` and `serverless.tar.gz` in `output` directory.

### Server deployment

> nodejs ≥ 10 and npm ≥ 6 are required.
> nodejs ≥ 12 and npm ≥ 6 are required.
Extract `server.tar.gz` to wherever you want.
`cd` into the directory and run:
Expand Down Expand Up @@ -110,6 +112,7 @@ This project is based on following projects:

- [React](https://reactjs.org/)
- [ECharts](https://echarts.apache.org/)
- [Snowpack]](https://www.snowpack.dev/)
- [wasm-pack](https://rustwasm.github.io/wasm-pack/)
- [Netron](/~https://github.com/lutzroeder/netron)

Expand Down
7 changes: 5 additions & 2 deletions frontend/README_cn.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

## 使用

> 要求 nodejs ≥ 10 并且 npm ≥ 6
> 要求 nodejs ≥ 12 并且 npm ≥ 6
```bash
npm install -g @visualdl/cli
Expand Down Expand Up @@ -66,6 +66,8 @@ yarn

## 编译和部署

> 要求 nodejs ≥ 14 并且 npm ≥ 6
> 目前仅支持 Linux/MacOS 上编译。
运行:
Expand All @@ -78,7 +80,7 @@ yarn build

### Server 部署

> 要求 nodejs ≥ 10 并且 npm ≥ 6
> 要求 nodejs ≥ 12 并且 npm ≥ 6
解压 `server.tar.gz` 到任何地方。
`cd` 到那个文件夹然后运行:
Expand Down Expand Up @@ -110,6 +112,7 @@ VisualDL 支持最新版本的 [Google Chrome](https://www.google.com/chrome/)

- [React](https://reactjs.org/)
- [ECharts](https://echarts.apache.org/)
- [Snowpack]](https://www.snowpack.dev/)
- [wasm-pack](https://rustwasm.github.io/wasm-pack/)
- [Netron](/~https://github.com/lutzroeder/netron)

Expand Down
20 changes: 11 additions & 9 deletions frontend/packages/core/builder/cdn.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
/* eslint-disable no-console */

const path = require('path');
const {promises: fs} = require('fs');
const fs = require('fs/promises');
const {BosClient} = require('@baiducloud/sdk');
const mime = require('mime-types');

const endpoint = process.env.BOS_ENDPOINT || 'http://bj.bcebos.com';
const endpoint = process.env.BOS_ENDPOINT || 'https://bos.bj.baidubce.com';
const ak = process.env.BOS_AK;
const sk = process.env.BOS_SK;

Expand All @@ -33,7 +33,7 @@ async function getFiles(dir) {
const name = path.join(dir, file.name);
result.push({
name,
mime: mime.lookup(name),
mime: mime.contentType(path.extname(name)),
size: (await fs.stat(name)).size
});
} else if (file.isDirectory()) {
Expand All @@ -46,7 +46,7 @@ async function getFiles(dir) {
return result;
}

async function main(directory) {
async function push(directory, options) {
if (!ak || !sk) {
console.error('No AK and SK specified!');
process.exit(1);
Expand All @@ -56,12 +56,14 @@ async function main(directory) {
try {
const stats = await fs.stat(directory);
if (stats.isDirectory()) {
files = (await getFiles(directory)).map(file => ({filename: path.relative(directory, file.name), ...file}));
files = (await getFiles(directory))
.map(file => ({filename: path.relative(directory, file.name), ...file}))
.filter(file => options?.exclude?.includes(file.filename) !== true);
} else if (stats.isFile()) {
files.push({
filename: path.relative(path.basename(directory)),
name: directory,
mime: mime.lookup(directory),
mime: mime.contentType(path.extname(directory)),
size: stats.size
});
} else {
Expand All @@ -76,13 +78,13 @@ async function main(directory) {
(function (f) {
client
.putObjectFromFile(bucket, `assets/${version}/${f.filename}`, f.name, {
'content-length': f.size,
'content-type': `${f.mime}; charset=utf-8`
'Content-Length': f.size,
'Content-Type': `${f.mime}`
})
.then(() => console.log([f.name, f.mime, f.size].join(', ')))
.catch(error => console.error(f, error));
})(file);
}
}

module.exports = main;
module.exports = push;
2 changes: 1 addition & 1 deletion frontend/packages/core/builder/icons.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
/* eslint-disable @typescript-eslint/no-var-requires */

const path = require('path');
const {promises: fs} = require('fs');
const fs = require('fs/promises');
const {default: svgr} = require('@svgr/core');
const babel = require('@babel/core');
const {camelCase} = require('lodash');
Expand Down
2 changes: 1 addition & 1 deletion frontend/packages/core/builder/inject-env.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* eslint-disable @typescript-eslint/no-var-requires */

const path = require('path');
const {promises: fs} = require('fs');
const fs = require('fs/promises');

const ENV_INJECT = 'const env = window.__snowpack_env__ || {}; export default env;';

Expand Down
2 changes: 1 addition & 1 deletion frontend/packages/core/builder/inject-template.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* eslint-disable @typescript-eslint/no-var-requires */

const path = require('path');
const {promises: fs} = require('fs');
const fs = require('fs/promises');
const {minify} = require('html-minifier');

const dist = path.resolve(__dirname, '../dist');
Expand Down
5 changes: 3 additions & 2 deletions frontend/packages/core/builder/post-build.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,9 @@ async function main() {
await injectEnv();

if (process.env.CDN_VERSION) {
// TODO: do not upload index.html & index.tpl.html & __snowpack__/env.local.js
await pushCdn(dist);
await pushCdn(dist, {
exclude: ['index.html', 'index.tpl.html', '__snowpack__/env.local.js']
});
}
}

Expand Down
2 changes: 1 addition & 1 deletion frontend/packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@
"yargs": "16.0.3"
},
"engines": {
"node": ">=12",
"node": ">=14",
"npm": ">=6"
},
"publishConfig": {
Expand Down
4 changes: 1 addition & 3 deletions frontend/packages/core/public/icons/audio.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 1 addition & 3 deletions frontend/packages/core/public/icons/check-mark.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 1 addition & 3 deletions frontend/packages/core/public/icons/chevron-down.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 1 addition & 3 deletions frontend/packages/core/public/icons/close.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 3 additions & 5 deletions frontend/packages/core/public/icons/dimension.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 1 addition & 3 deletions frontend/packages/core/public/icons/download.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 4 additions & 6 deletions frontend/packages/core/public/icons/histogram.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 3 additions & 5 deletions frontend/packages/core/public/icons/image.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 4 additions & 6 deletions frontend/packages/core/public/icons/log-axis.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 29791b8

Please sign in to comment.