From 4588df560c91316ec6015d8176bb4f2ccc77d3df Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=88=E5=98=89=E6=B6=B5?= Date: Tue, 19 Nov 2019 17:39:38 +0800 Subject: [PATCH] feat(cli): generate document title --- packages/vant-cli/package.json | 2 ++ packages/vant-cli/site/desktop/index.html | 2 ++ packages/vant-cli/site/mobile/index.html | 2 ++ .../vant-cli/src/config/webpack.site.dev.ts | 13 +++++++++-- packages/vant-cli/yarn.lock | 22 ++++++++++++++++++- 5 files changed, 38 insertions(+), 3 deletions(-) diff --git a/packages/vant-cli/package.json b/packages/vant-cli/package.json index f9444a48a..8ac9eea49 100644 --- a/packages/vant-cli/package.json +++ b/packages/vant-cli/package.json @@ -22,6 +22,7 @@ "author": "chenjiahan", "license": "MIT", "peerDependencies": { + "vant": "^2.2.13", "vue": "^2.6.10", "vue-template-compiler": "^2.6.10" }, @@ -39,6 +40,7 @@ "@types/webpack": "^4.39.8", "@types/webpack-dev-server": "^3.4.0", "@types/webpack-merge": "^4.1.5", + "vant": "^2.2.13", "vue": "^2.6.10", "vue-template-compiler": "^2.6.10" }, diff --git a/packages/vant-cli/site/desktop/index.html b/packages/vant-cli/site/desktop/index.html index 421344c52..861f2560f 100644 --- a/packages/vant-cli/site/desktop/index.html +++ b/packages/vant-cli/site/desktop/index.html @@ -2,6 +2,8 @@ + <%= htmlWebpackPlugin.options.title %> + diff --git a/packages/vant-cli/site/mobile/index.html b/packages/vant-cli/site/mobile/index.html index 421344c52..861f2560f 100644 --- a/packages/vant-cli/site/mobile/index.html +++ b/packages/vant-cli/site/mobile/index.html @@ -2,6 +2,8 @@ + <%= htmlWebpackPlugin.options.title %> + diff --git a/packages/vant-cli/src/config/webpack.site.dev.ts b/packages/vant-cli/src/config/webpack.site.dev.ts index a62fe2d84..3cc049f33 100644 --- a/packages/vant-cli/src/config/webpack.site.dev.ts +++ b/packages/vant-cli/src/config/webpack.site.dev.ts @@ -1,9 +1,14 @@ import { join } from 'path'; import merge from 'webpack-merge'; -import config from './webpack.base'; +import baseConfig from './webpack.base'; import HtmlWebpackPlugin from 'html-webpack-plugin'; +import { CONFIG_FILE } from '../common/constant'; -module.exports = merge(config, { +// eslint-disable-next-line +const config = require(CONFIG_FILE); +const title = `${config.title} - ${config.description}`; + +module.exports = merge(baseConfig, { entry: { 'site-desktop': join(__dirname, '../../site/desktop/main.js'), 'site-mobile': join(__dirname, '../../site/mobile/main.js') @@ -33,11 +38,15 @@ module.exports = merge(config, { }, plugins: [ new HtmlWebpackPlugin({ + title, + logo: config.logo, chunks: ['chunks', 'site-desktop'], template: join(__dirname, '../../site/desktop/index.html'), filename: 'index.html' }), new HtmlWebpackPlugin({ + title, + logo: config.logo, chunks: ['chunks', 'site-mobile'], template: join(__dirname, '../../site/mobile/index.html'), filename: 'mobile.html' diff --git a/packages/vant-cli/yarn.lock b/packages/vant-cli/yarn.lock index d198c7f4d..6dfecb292 100644 --- a/packages/vant-cli/yarn.lock +++ b/packages/vant-cli/yarn.lock @@ -700,7 +700,7 @@ core-js "^2.6.5" regenerator-runtime "^0.13.2" -"@babel/runtime@^7.6.3": +"@babel/runtime@7.x", "@babel/runtime@^7.6.3": version "7.7.2" resolved "https://registry.npm.taobao.org/@babel/runtime/download/@babel/runtime-7.7.2.tgz?cache=0&sync_timestamp=1573083187206&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2F%40babel%2Fruntime%2Fdownload%2F%40babel%2Fruntime-7.7.2.tgz#111a78002a5c25fc8e3361bedc9529c696b85a6a" integrity sha1-ERp4ACpcJfyOM2G+3JUpxpa4Wmo= @@ -1441,6 +1441,11 @@ eslint-plugin-import "^2.18.2" eslint-plugin-vue "^5.2.3" +"@vant/icons@1.1.15": + version "1.1.15" + resolved "https://registry.npm.taobao.org/@vant/icons/download/@vant/icons-1.1.15.tgz?cache=0&sync_timestamp=1571923117293&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2F%40vant%2Ficons%2Fdownload%2F%40vant%2Ficons-1.1.15.tgz#53c51ace21e9992bfeeb2e1ad9094fbf6506d116" + integrity sha1-U8UaziHpmSv+6y4a2QlPv2UG0RY= + "@vant/markdown-loader@^2.2.0": version "2.2.0" resolved "https://registry.npm.taobao.org/@vant/markdown-loader/download/@vant/markdown-loader-2.2.0.tgz#f685d7f9fb7582919230329c9263cf0c4798281b" @@ -10753,6 +10758,16 @@ validate-npm-package-license@^3.0.1: spdx-correct "^3.0.0" spdx-expression-parse "^3.0.0" +vant@^2.2.13: + version "2.2.13" + resolved "https://registry.npm.taobao.org/vant/download/vant-2.2.13.tgz#394b6c75c919d2924bd025ae1cc797aac0ee76dd" + integrity sha1-OUtsdckZ0pJL0CWuHMeXqsDudt0= + dependencies: + "@babel/runtime" "7.x" + "@vant/icons" "1.1.15" + "@vue/babel-helper-vue-jsx-merge-props" "^1.0.0" + vue-lazyload "1.2.3" + vary@~1.1.2: version "1.1.2" resolved "https://registry.npm.taobao.org/vary/download/vary-1.1.2.tgz#2299f02c6ded30d4a5961b0b9f74524a18f634fc" @@ -10831,6 +10846,11 @@ vue-jest@4.0.0-beta.2: source-map "^0.5.6" ts-jest "^23.10.5" +vue-lazyload@1.2.3: + version "1.2.3" + resolved "https://registry.npm.taobao.org/vue-lazyload/download/vue-lazyload-1.2.3.tgz#901f9ec15c7e6ca78781a2bae4a343686bdedb2c" + integrity sha1-kB+ewVx+bKeHgaK65KNDaGve2yw= + vue-loader@^15.7.2: version "15.7.2" resolved "https://registry.npm.taobao.org/vue-loader/download/vue-loader-15.7.2.tgz#cc89e2716df87f70fe656c9da9d7f8bec06c73d6"