This is an automated email from the ASF dual-hosted git repository. sushuang pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/incubator-echarts-doc.git
commit 450d777930e44a5af33e73270c591aa6ac995336 Author: SHUANG SU <sushuang0...@gmail.com> AuthorDate: Wed Sep 25 00:43:36 2019 +0800 Fix build scripts --- build.js | 30 ++++++++++++++++++----------- package.json | 5 +++++ public/en/documents/en/api.json | 2 +- public/en/documents/en/option-gl.json | 2 +- public/en/documents/en/option.json | 2 +- public/en/documents/en/tutorial.json | 2 +- server.js | 2 +- watch.js | 36 +++++++++++++++++++++++++++++++---- 8 files changed, 61 insertions(+), 20 deletions(-) diff --git a/build.js b/build.js index 5752f13..8d21c0a 100644 --- a/build.js +++ b/build.js @@ -1,23 +1,23 @@ -var md2json = require('./tool/md2json'); -var fs = require('fs'); -var marked = require('marked'); -var copydir = require('copy-dir'); -// var MarkDownTOCRenderer = require('./tool/MarkDownTOCRenderer'); -var argv = require('yargs').argv; - /** * ------------------------------------------------------------------------ * Usage: * * ```shell - * ./nodule_modules/.bin/gulp release --env asf - * ./nodule_modules/.bin/gulp release --env echartsjs - * ./nodule_modules/.bin/gulp release --env dev # the same as "debug" + * node build.js --env dev + * node build.js --env asf + * node build.js --env echartsjs * # Check `./config` to see the available env * ``` * ------------------------------------------------------------------------ */ +var md2json = require('./tool/md2json'); +var fs = require('fs'); +var marked = require('marked'); +var copydir = require('copy-dir'); +// var MarkDownTOCRenderer = require('./tool/MarkDownTOCRenderer'); +var argv = require('yargs').argv; + function initEnv() { var envType = argv.env; var isDev = argv.dev != null || argv.debug != null || envType === 'debug'; @@ -106,6 +106,11 @@ function run() { 'utf-8' ); + console.log('Please visit:'); + console.log('echarts-doc/public/zh/'); + console.log('echarts-doc/public/en/'); + console.log(); + // var plainMarkDownTpl = fs.readFileSync('tool/plain-md.tpl', 'utf-8'); // var codingStandardMD = fs.readFileSync('en' + '/coding-standard.md', 'utf-8'); // var codingStandardContent = marked(codingStandardMD); @@ -130,7 +135,10 @@ function run() { } function writeSingleSchema(schema, language, docName, format) { - var path = 'public/' + language + '/documents/' + language + '/' + docName + '.json'; + if (language === 'cn') { + language = 'zh'; + } + var path = 'public/documents/' + language + '/' + docName + '.json'; console.log('output: ' + path); fs.writeFileSync( path, diff --git a/package.json b/package.json index 7c9eb75..433e446 100644 --- a/package.json +++ b/package.json @@ -6,6 +6,11 @@ "type": "git", "url": "g...@github.com:ecomfe/echarts-doc.git" }, + "scripts": { + "build": "node build.js --env dev", + "watch": "node watch.js --env dev", + "server": "node server.js" + }, "author": "shenyi", "license": "BSD", "devDependencies": { diff --git a/public/en/documents/en/api.json b/public/en/documents/en/api.json index 3f320fd..45097fa 100644 --- a/public/en/documents/en/api.json +++ b/public/en/documents/en/api.json @@ -1 +1 @@ -{"$schema":"http://echarts.baidu.com/doc/json-schem","option":{"type":"Object","properties":{"echarts":{"type":["Object"],"description":"<p>Global echarts object, which can be accessed after including <code>echarts.js</code> in script tag or through <code>require('echarts')</code> in AMD environment.</p>\n","properties":{"init":{"type":["Function"],"description":"<pre><code class=\"lang-js\">(dom: HTMLDivElement|HTMLCanvasElement, theme?: Object|string, opts?: {\n devicePixelR [...] \ No newline at end of file +{"$schema":"http://echarts.baidu.com/doc/json-schem","option":{"type":"Object","properties":{"echarts":{"type":["Object"],"description":"<p>Global echarts object, which can be accessed after including <code>echarts.js</code> in script tag or through <code>require('echarts')</code> in AMD environment.</p>\n","properties":{"init":{"type":["Function"],"description":"<pre><code class=\"lang-js\">(dom: HTMLDivElement|HTMLCanvasElement, theme?: Object|string, opts?: {\n devicePixelR [...] \ No newline at end of file diff --git a/public/en/documents/en/option-gl.json b/public/en/documents/en/option-gl.json index 17ac83f..3209dac 100644 --- a/public/en/documents/en/option-gl.json +++ b/public/en/documents/en/option-gl.json @@ -1 +1 @@ -{"$schema":"http://echarts.baidu.com/doc/json-schem","option":{"type":"Object","properties":{"globe":{"type":["Object"],"description":"<p>地球组件。组件提供了地球的绘制以及相应的坐标系,开发者可以在上面展示三维的散点图,气泡图,柱状图,飞线图。</p>\n","properties":{"show":{"type":["boolean"],"description":"<p>是否显示地球组件。</p>\n","default":true},"globeRadius":{"type":["number"],"description":"<p>地球的半径。单位相对于三维空间,跟 <a href=\"#globe.viewControl.distance\">viewControl.distance</a> 相关。</p>\n","default":100},"baseTexture":{"type":["string","HTMLImag [...] \ No newline at end of file +{"$schema":"http://echarts.baidu.com/doc/json-schem","option":{"type":"Object","properties":{"globe":{"type":["Object"],"description":"<p>地球组件。组件提供了地球的绘制以及相应的坐标系,开发者可以在上面展示三维的散点图,气泡图,柱状图,飞线图。</p>\n","properties":{"show":{"type":["boolean"],"description":"<p>是否显示地球组件。</p>\n","default":true},"globeRadius":{"type":["number"],"description":"<p>地球的半径。单位相对于三维空间,跟 <a href=\"#globe.viewControl.distance\">viewControl.distance</a> 相关。</p>\n","default":100},"baseTexture":{"type":["string","HTMLImag [...] \ No newline at end of file diff --git a/public/en/documents/en/option.json b/public/en/documents/en/option.json index 568dcd5..8d84ea9 100644 --- a/public/en/documents/en/option.json +++ b/public/en/documents/en/option.json @@ -1 +1 @@ -{"$schema":"http://echarts.baidu.com/doc/json-schem","option":{"type":"Object","properties":{"title":{"type":["Object"],"description":"<p>Title component, including main title and subtitle.</p>\n<p>In ECharts 2.x, a single instance of ECharts could contains one title component at most. However, in ECharts 3, there could be one or more than one title components. It is more useful when multiple diagrams in one instance all need titles.</p>\n<p><strong>Here are some instances of different a [...] \ No newline at end of file +{"$schema":"http://echarts.baidu.com/doc/json-schem","option":{"type":"Object","properties":{"title":{"type":["Object"],"description":"<p>Title component, including main title and subtitle.</p>\n<p>In ECharts 2.x, a single instance of ECharts could contains one title component at most. However, in ECharts 3, there could be one or more than one title components. It is more useful when multiple diagrams in one instance all need titles.</p>\n<p><strong>Here are some instances of different a [...] \ No newline at end of file diff --git a/public/en/documents/en/tutorial.json b/public/en/documents/en/tutorial.json index 8e954c9..7035504 100644 --- a/public/en/documents/en/tutorial.json +++ b/public/en/documents/en/tutorial.json @@ -1 +1 @@ -{"$schema":"http://echarts.baidu.com/doc/json-schem","option":{"type":"Object","properties":{"Get Started with ECharts in 5 minutes":{"type":["*"],"description":"<h2 id=\"installing-echarts\">Installing ECharts</h2>\n<p>First, install ECharts using one of the following methods:</p>\n<ul>\n<li><p>The <a href=\"https://ecomfe.github.io/echarts-doc/public/en/download.html\" target=\"_blank\">official download page</a>, has different builds for most common use cases. If you would like to inc [...] \ No newline at end of file +{"$schema":"http://echarts.baidu.com/doc/json-schem","option":{"type":"Object","properties":{"Get Started with ECharts in 5 minutes":{"type":["*"],"description":"<h2 id=\"installing-echarts\">Installing ECharts</h2>\n<p>First, install ECharts using one of the following methods:</p>\n<ul>\n<li><p>The <a href=\"https://ecomfe.github.io/echarts-doc/public/en/download.html\" target=\"_blank\">official download page</a>, has different builds for most common use cases. If you would like to inc [...] \ No newline at end of file diff --git a/server.js b/server.js index 31fed85..30642d7 100644 --- a/server.js +++ b/server.js @@ -8,4 +8,4 @@ require('http').createServer(function (request, response) { }).resume(); }).listen(3001); -open('http://127.0.0.1:3001/en/index.html'); +open('http://127.0.0.1:3001/en/option.html'); diff --git a/watch.js b/watch.js index 0cf036a..af15209 100644 --- a/watch.js +++ b/watch.js @@ -1,10 +1,39 @@ /** - * @usage - * node watch.js + * ------------------------------------------------------------------------ + * Usage: + * + * ```shell + * node watch.js --env dev + * node watch.js --env asf + * node watch.js --env echartsjs + * # Check `./config` to see the available env + * ``` + * ------------------------------------------------------------------------ */ var path = require('path'); var fs = require('fs'); +var argv = require('yargs').argv; + +function initEnv() { + var envType = argv.env; + var isDev = argv.dev != null || argv.debug != null || envType === 'debug'; + + if (isDev) { + console.warn('============================='); + console.warn('!!! THIS IS IN DEV MODE !!!'); + console.warn('============================='); + envType = 'dev'; + } + + if (!envType) { + throw new Error('--env MUST be specified'); + } + + return envType; +} + +var envType = initEnv(); var docSrcDirCN = path.join(__dirname, '/cn'); var docSrcDirEN = path.join(__dirname, '/en'); @@ -39,14 +68,13 @@ function onChange(event) { timer = setTimeout(function () { execBuild(); // Writing may be not finished yet, and throttle. - console.log('Done.'); }, 1000); } } function execBuild() { require('child_process').exec( - 'node build.js ' + (process.argv[2] || ''), + 'node build.js --env ' + envType, function (error, stdout, stderr) { if (error !== null) { console.log('exec error: ' + error); --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@echarts.apache.org For additional commands, e-mail: commits-h...@echarts.apache.org