From da99afc479fc1e3df43d39260b4646070b75c9c4 Mon Sep 17 00:00:00 2001 From: ksky521 Date: Thu, 1 Aug 2019 11:26:49 +0800 Subject: [PATCH] =?UTF-8?q?chore:=20=E7=AE=80=E5=8D=95=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=E4=B8=8B=E6=A0=B7=E5=BC=8F=E4=B9=8B=E7=B1=BB=E7=9A=84=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/nodeppt-js/package.json | 2 +- packages/nodeppt-js/plugins/echarts.js | 2 +- packages/nodeppt-js/plugins/keyboard.js | 8 ++------ packages/nodeppt-js/plugins/speaker-mode.js | 2 +- packages/nodeppt-serve/commands/build.js | 11 ++++++++++- packages/nodeppt-serve/config/base.js | 2 ++ packages/nodeppt/bin/nodeppt | 2 ++ 7 files changed, 19 insertions(+), 10 deletions(-) diff --git a/packages/nodeppt-js/package.json b/packages/nodeppt-js/package.json index 6d8fa36de..bf6987727 100644 --- a/packages/nodeppt-js/package.json +++ b/packages/nodeppt-js/package.json @@ -34,6 +34,6 @@ "animate.css": "^3.7.0", "nodeppt-template-default": "^1.0.1", "username": "^4.1.0", - "webslides": "1.4.2" + "webslides": "1.5.0" } } diff --git a/packages/nodeppt-js/plugins/echarts.js b/packages/nodeppt-js/plugins/echarts.js index 300cb9ba3..bb5ac1506 100644 --- a/packages/nodeppt-js/plugins/echarts.js +++ b/packages/nodeppt-js/plugins/echarts.js @@ -1,6 +1,6 @@ import DOM from 'webslides/src/js/utils/dom'; import {default as Slide, Events as SlideEvents} from 'webslides/src/js/modules/slide'; - +/* global echarts */ export default class Echarts { constructor(wsInstance) { this.ws_ = wsInstance; diff --git a/packages/nodeppt-js/plugins/keyboard.js b/packages/nodeppt-js/plugins/keyboard.js index 464bbd400..ab9d5cf1c 100644 --- a/packages/nodeppt-js/plugins/keyboard.js +++ b/packages/nodeppt-js/plugins/keyboard.js @@ -72,18 +72,14 @@ export default class Keyboard { method = this.ws_.goToSlide; argument = this.ws_.maxSlide_ - 1; break; + case Keys.RIGHT: case Keys.DOWN: method = this.ws_.isVertical ? (this.enable_ ? this.goNext : this.ws_.goNext) : null; break; + case Keys.LEFT: case Keys.UP: method = this.ws_.isVertical ? (this.enable_ ? this.goPrev : this.ws_.goPrev) : null; break; - case Keys.LEFT: - method = !this.ws_.isVertical ? (this.enable_ ? this.goPrev : this.ws_.goPrev) : null; - break; - case Keys.RIGHT: - method = !this.ws_.isVertical ? (this.enable_ ? this.goNext : this.ws_.goNext) : null; - break; case Keys.F: if (!event.metaKey && !event.ctrlKey) { method = this.ws_.fullscreen; diff --git a/packages/nodeppt-js/plugins/speaker-mode.js b/packages/nodeppt-js/plugins/speaker-mode.js index 23687da0b..603b54813 100644 --- a/packages/nodeppt-js/plugins/speaker-mode.js +++ b/packages/nodeppt-js/plugins/speaker-mode.js @@ -61,7 +61,7 @@ export default class SpeakerMode { function parseQuery(url) { let back = {}; - (url || location.search.substring(1)).split('&').forEach(function(v) { + (url || location.search.substring(1)).split('&').forEach(v => { v = v.split('='); back[v[0].toLowerCase()] = v[1]; }); diff --git a/packages/nodeppt-serve/commands/build.js b/packages/nodeppt-serve/commands/build.js index 4aa0887bb..2bbdb40b0 100644 --- a/packages/nodeppt-serve/commands/build.js +++ b/packages/nodeppt-serve/commands/build.js @@ -2,19 +2,28 @@ * @file build 主要内容 */ const {info} = require('nodeppt-shared-utils'); - +const path = require('path'); module.exports = (api, options) => { api.registerCommand('build', {}, async function serve(args) { info('Build ...'); + const context = process.cwd(); + const {dest} = args; + process.env.NODE_ENV = 'production'; const webpack = require('webpack'); // resolve webpack config const webpackConfig = api.resolveWebpackConfig(); webpackConfig.mode = 'production'; + if (!args.map) { delete webpackConfig.devtool; // = null; } webpackConfig.output.publicPath = './'; + + if (dest) { + const targetDir = path.resolve(context, dest || options.outputDir); + webpackConfig.output.path = targetDir; + } return new Promise((resolve, reject) => { webpack(webpackConfig, err => { if (err) { diff --git a/packages/nodeppt-serve/config/base.js b/packages/nodeppt-serve/config/base.js index db51483ab..906d0ee98 100644 --- a/packages/nodeppt-serve/config/base.js +++ b/packages/nodeppt-serve/config/base.js @@ -122,5 +122,7 @@ module.exports = (api, options) => { additionalFormatters: [formatter] } ]); + + webpackConfig.plugin('progress').use(require('webpack/lib/ProgressPlugin')); }); }; diff --git a/packages/nodeppt/bin/nodeppt b/packages/nodeppt/bin/nodeppt index 0bd96e39a..f09baf186 100755 --- a/packages/nodeppt/bin/nodeppt +++ b/packages/nodeppt/bin/nodeppt @@ -24,7 +24,9 @@ program .description('start local sever show slide') .option('-p, --port [port]', 'set server port ', 8080) .option('--https', 'use https ', 8080) + .option('-d, --dest ', 'output directory') .option('-H, --host [host]', 'set host address', '0.0.0.0') + .action((entry, cmd) => { require('nodeppt-serve').serve(entry, cleanArgs(cmd)); })