diff --git a/.gitignore b/.gitignore new file mode 100644 index 000000000..4f5aced78 --- /dev/null +++ b/.gitignore @@ -0,0 +1,18 @@ +.DS_Store +node_modules/ +/dist/ +/static/ +npm-debug.log* +yarn-debug.log* +yarn-error.log* + +# Editor directories and files +.idea +.vscode +*.suo +*.ntvs* +*.njsproj +*.sln +nezha-fronted/src/router/mergeTable.js +nezha-fronted/src/components/page/dashboard/testData.js +nezha-fronted/src/components/common/rightBox/tempRoghtBox.vue diff --git a/nezha-fronted/README.md b/nezha-fronted/README.md index 9faddcd74..0f5e6f863 100644 --- a/nezha-fronted/README.md +++ b/nezha-fronted/README.md @@ -32,5 +32,7 @@ specs 配置对应的测试用例 (https://docs.geedge.net/pages/viewpage.acti #思维导图 https://docs.geedge.net/pages/viewpage.action?pageId=67209306 - +#配置多入口 +dev 正常启动 +dev:html 导出为html diff --git a/nezha-fronted/build/build.js b/nezha-fronted/build/build.js index d09dcb77c..a4cba8649 100644 --- a/nezha-fronted/build/build.js +++ b/nezha-fronted/build/build.js @@ -1,8 +1,7 @@ 'use strict' require('./check-versions')() - -let arg = process.argv.splice(2)[0]; -process.env.NODE_ENV = arg == 'dev' ? 'development' : 'production' +const arg = process.argv.splice(2)[0] +process.env.NODE_ENV = 'production' process.env.BUILD_MODE = arg const ora = require('ora') @@ -12,7 +11,6 @@ const chalk = require('chalk') const webpack = require('webpack') const config = require('../config') const webpackConfig = require('./webpack.prod.conf') - const spinner = ora('building for production...') spinner.start() diff --git a/nezha-fronted/build/webpack.base.conf.js b/nezha-fronted/build/webpack.base.conf.js index 265610633..05a72f998 100644 --- a/nezha-fronted/build/webpack.base.conf.js +++ b/nezha-fronted/build/webpack.base.conf.js @@ -3,15 +3,16 @@ const path = require('path') const utils = require('./utils') const config = require('../config') const vueLoaderConfig = require('./vue-loader.conf') - +const arg = process.env.BUILD_MODE +const devStart = process.env.npm_lifecycle_event function resolve (dir) { return path.join(__dirname, '..', dir) } - -module.exports = { +const baseConfig = { context: path.resolve(__dirname, '../'), entry: { - app: './src/main.js' + app: './src/entrance/app/main.js', + exportHtml: './src/entrance/exportHtml/exportHtml.js' }, output: { path: config.build.assetsRoot, @@ -98,3 +99,48 @@ module.exports = { child_process: 'empty' } } +if (arg === 'html' || devStart === 'dev:html') { + delete baseConfig.entry.app + baseConfig.module.rules.unshift({ + include: [ + resolve('src/entrance/app'), + resolve('src/components/common/alert'), + resolve('src/components/common/bottomBox'), + resolve('src/components/common/detailView'), + resolve('src/components/common/elSelect'), + resolve('src/components/common/filterSearch'), + resolve('src/components/common/globalSearch'), + resolve('src/components/common/honeycomb'), + resolve('src/components/common/myDatePicker'), + resolve('src/components/common/overView'), + resolve('src/components/common/popBox'), + resolve('src/components/common/project'), + resolve('src/components/common/rightBox'), + resolve('src/components/common/table'), + resolve('src/components/common/v-selectpagenew'), + resolve('src/components/page') + ], + loader: 'url-loader', + options: { + limit: 10, + generator: (content, mimetype, encoding, resourcePath) => { + return '' + } + } + }) +} else if (arg === 'app' || devStart === 'dev') { + delete baseConfig.entry.exportHtml + baseConfig.module.rules.unshift({ + include: [ + resolve('src/entrance/exportHtml') + ], + loader: 'url-loader', + options: { + limit: 10, + generator: (content, mimetype, encoding, resourcePath) => { + return '' + } + } + }) +} +module.exports = { ...baseConfig } diff --git a/nezha-fronted/build/webpack.dev.conf.js b/nezha-fronted/build/webpack.dev.conf.js index 3c79326bf..d182f51f0 100644 --- a/nezha-fronted/build/webpack.dev.conf.js +++ b/nezha-fronted/build/webpack.dev.conf.js @@ -12,8 +12,10 @@ const portfinder = require('portfinder') const HOST = process.env.HOST const PORT = process.env.PORT && Number(process.env.PORT) - -const devWebpackConfig = merge(baseWebpackConfig, { +const devStart = process.env.npm_lifecycle_event +const indexHtml = devStart === 'dev' ? 'src/entrance/app/index.html' : 'src/entrance/exportHtml/exportHtml.html' +let devWebpackConfig = '' +devWebpackConfig = merge(baseWebpackConfig, { module: { rules: utils.styleLoaders({ sourceMap: config.dev.cssSourceMap, usePostCSS: true }) }, @@ -25,11 +27,11 @@ const devWebpackConfig = merge(baseWebpackConfig, { clientLogLevel: 'warning', historyApiFallback: { rewrites: [ - { from: /.*/, to: path.posix.join(config.dev.assetsPublicPath, 'index.html') }, - ], + { from: /.*/, to: path.posix.join(config.dev.assetsPublicPath, indexHtml) } + ] }, hot: true, - inline:true, + inline: true, contentBase: false, // since we use CopyWebpackPlugin. compress: true, host: HOST || config.dev.host, @@ -38,12 +40,12 @@ const devWebpackConfig = merge(baseWebpackConfig, { overlay: config.dev.errorOverlay ? { warnings: false, errors: true } : false, - publicPath: "/", - /*publicPath: config.dev.assetsPublicPath,*/ + publicPath: '/', + /* publicPath: config.dev.assetsPublicPath, */ proxy: config.dev.proxyTable, quiet: true, // necessary for FriendlyErrorsPlugin watchOptions: { - poll: config.dev.poll, + poll: config.dev.poll } }, plugins: [ @@ -57,8 +59,9 @@ const devWebpackConfig = merge(baseWebpackConfig, { new HtmlWebpackPlugin({ favicon: path.resolve(__dirname, '../src/assets/img/favicon.ico'), filename: 'index.html', - template: 'index.html', - inject: true + template: indexHtml, + inject: true, + chunks: devStart === 'dev' ? ['app'] : ['exportHtml'] }), // copy custom static assets new CopyWebpackPlugin([ @@ -66,6 +69,11 @@ const devWebpackConfig = merge(baseWebpackConfig, { from: path.resolve(__dirname, '../static'), to: config.dev.assetsSubDirectory, ignore: ['.*'] + }, + { + from: path.resolve(__dirname, '../src/components/chart'), + to: 'components/chart', + ignore: ['.*'] } ]) ] @@ -85,11 +93,11 @@ module.exports = new Promise((resolve, reject) => { // Add FriendlyErrorsPlugin devWebpackConfig.plugins.push(new FriendlyErrorsPlugin({ compilationSuccessInfo: { - messages: [`Your application is running here: http://${devWebpackConfig.devServer.host}:${port}`], + messages: [`Your application is running here: http://${devWebpackConfig.devServer.host}:${port}`] }, onErrors: config.dev.notifyOnErrors - ? utils.createNotifierCallback() - : undefined + ? utils.createNotifierCallback() + : undefined })) resolve(devWebpackConfig) diff --git a/nezha-fronted/build/webpack.prod.conf.js b/nezha-fronted/build/webpack.prod.conf.js index b3d516e39..069db8312 100644 --- a/nezha-fronted/build/webpack.prod.conf.js +++ b/nezha-fronted/build/webpack.prod.conf.js @@ -1,6 +1,6 @@ 'use strict' const path = require('path') - +const arg = process.env.BUILD_MODE const utils = require('./utils') const webpack = require('webpack') const config = require('../config') @@ -10,13 +10,13 @@ const CopyWebpackPlugin = require('copy-webpack-plugin') const HtmlWebpackPlugin = require('html-webpack-plugin') const ExtractTextPlugin = require('extract-text-webpack-plugin') const OptimizeCSSPlugin = require('optimize-css-assets-webpack-plugin') -const ParallelUglifyPlugin = require('webpack-parallel-uglify-plugin') +// const ParallelUglifyPlugin = require('webpack-parallel-uglify-plugin') const fileManagerPlugin = require('filemanager-webpack-plugin') const WebpackZipPlugin = require('webpack-zip-plugin') // const GitRevisionPlugin = require('git-revision-webpack-plugin') const GenerateAssetPlugin = require('generate-asset-webpack-plugin') const WebpackShellPlugin = require('webpack-shell-plugin') - +const HtmlWebpackInlineSourcePlugin = require('html-webpack-inline-source-plugin') const serverConfig = require('../static/config.json')// 引入根目录下的配置文件 // const gitRevisionPlugin = new GitRevisionPlugin(); @@ -32,131 +32,275 @@ const createConfig = function(compilation){ let cfgJson={baseUrl:"http://192.168.40.247:8080/nz-admin"}; return JSON.stringify(cfgJson); } */ -const webpackConfig = merge(baseWebpackConfig, { - module: { - rules: utils.styleLoaders({ - sourceMap: config.build.productionSourceMap, - extract: true, - usePostCSS: true - }) - }, - devtool: config.build.productionSourceMap ? config.build.devtool : false, - output: { - path: config.build.assetsRoot, - filename: utils.assetsPath('js/[name].[chunkhash].js'), - chunkFilename: utils.assetsPath('js/[name].[chunkhash].js') - }, - plugins: [ - /* new GenerateAssetPlugin({ - filename: 'config.json', - fn: (compilation, cb) => { - cb(null, createConfig(compilation)); - }, - extraFiles: [] - }), */ - // http://vuejs.github.io/vue-loader/en/workflow/production.html - new webpack.DefinePlugin({ - 'process.env': env - }), - new ParallelUglifyPlugin({ - cacheDir: '.cache/', - uglifyJS: { - output: { - comments: false +let webpackConfig = {} +if (arg === 'html') { + webpackConfig = merge(baseWebpackConfig, { + module: { + rules: utils.styleLoaders({ + sourceMap: config.build.productionSourceMap, + extract: true, + usePostCSS: true + }) + }, + devtool: config.build.productionSourceMap ? config.build.devtool : false, + output: { + path: config.build.assetsRoot, + filename: utils.assetsPath('js/[name].[chunkhash].js'), + chunkFilename: utils.assetsPath('js/[name].[chunkhash].js') + }, + plugins: [ + /* new GenerateAssetPlugin({ + filename: 'config.json', + fn: (compilation, cb) => { + cb(null, createConfig(compilation)); }, - warnings: false, - compress: { - drop_debugger: true, - drop_console: true + extraFiles: [] + }), */ + // http://vuejs.github.io/vue-loader/en/workflow/production.html + new webpack.DefinePlugin({ + 'process.env': env + }), + // new ParallelUglifyPlugin({ + // cacheDir: '.cache/', + // uglifyJS: { + // output: { + // comments: false + // }, + // warnings: false, + // compress: { + // drop_debugger: true, + // drop_console: true + // } + // } + // }), + // extract css into its own file + new ExtractTextPlugin({ + filename: utils.assetsPath('css/[name].[contenthash].css'), + // Setting the following option to `false` will not extract CSS from codesplit chunks. + // Their CSS will instead be inserted dynamically with style-loader when the codesplit chunk has been loaded by webpack. + // It's currently set to `true` because we are seeing that sourcemaps are included in the codesplit bundle as well when it's `false`, + // increasing file size: https://github.com/vuejs-templates/webpack/issues/1110 + allChunks: true + }), + // Compress extracted CSS. We are using this plugin so that possible + // duplicated CSS from different components can be deduped. + new OptimizeCSSPlugin({ + cssProcessorOptions: config.build.productionSourceMap + ? { safe: true, map: { inline: false } } + : { safe: true } + }), + // generate dist index.html with correct asset hash for caching. + // you can customize output by editing /index.html + // see https://github.com/ampedandwired/html-webpack-plugin + new HtmlWebpackPlugin({ + favicon: path.resolve(__dirname, '../src/assets/img/favicon.ico'), + filename: config.build.index, + template: 'src/entrance/exportHtml/exportHtml.html', + inlineSource: '.(js|css)$', // embed all javascript and css inline + hash: false, + inject: true, + // minify: { + // removeComments: true, + // collapseWhitespace: true, + // removeAttributeQuotes: true + // // more options: + // // https://github.com/kangax/html-minifier#options-quick-reference + // }, + minify: { // 压缩html + collapseWhitespace: true, // 折叠空白区域 + keepClosingSlash: true, // 保持闭合间隙 + removeComments: true, // 移除注释 + removeRedundantAttributes: true, // 删除冗余属性 + removeScriptTypeAttributes: true, // 删除Script脚本类型属性 + removeStyleLinkTypeAttributes: true, // 删除样式链接类型属性 + useShortDoctype: true, // 使用短文档类型 + preserveLineBreaks: true, // 保留换行符 + minifyCSS: true, // 压缩文内css + minifyJS: true // 压缩文内js + }, + // necessary to consistently work with multiple chunks via CommonsChunkPlugin + chunksSortMode: 'dependency', + chunks: ['exportHtml'], + excludeChunks: ['app'] + }), + new HtmlWebpackInlineSourcePlugin(), + new GenerateAssetPlugin({ + filename: 'static/config.json', + fn: (compilation, cb) => { + cb(null, createJson()) } - } - }), - // extract css into its own file - new ExtractTextPlugin({ - filename: utils.assetsPath('css/[name].[contenthash].css'), - // Setting the following option to `false` will not extract CSS from codesplit chunks. - // Their CSS will instead be inserted dynamically with style-loader when the codesplit chunk has been loaded by webpack. - // It's currently set to `true` because we are seeing that sourcemaps are included in the codesplit bundle as well when it's `false`, - // increasing file size: https://github.com/vuejs-templates/webpack/issues/1110 - allChunks: true - }), - // Compress extracted CSS. We are using this plugin so that possible - // duplicated CSS from different components can be deduped. - new OptimizeCSSPlugin({ - cssProcessorOptions: config.build.productionSourceMap - ? { safe: true, map: { inline: false } } - : { safe: true } - }), - // generate dist index.html with correct asset hash for caching. - // you can customize output by editing /index.html - // see https://github.com/ampedandwired/html-webpack-plugin - new HtmlWebpackPlugin({ - favicon: path.resolve(__dirname, '../src/assets/img/favicon.ico'), - filename: config.build.index, - template: 'index.html', - hash: false, - inject: true, - minify: { - removeComments: true, - collapseWhitespace: true, - removeAttributeQuotes: true - // more options: - // https://github.com/kangax/html-minifier#options-quick-reference - }, - // necessary to consistently work with multiple chunks via CommonsChunkPlugin - chunksSortMode: 'dependency' - }), - new GenerateAssetPlugin({ - filename: 'static/config.json', - fn: (compilation, cb) => { - cb(null, createJson()) - } - }), - // keep module.id stable when vendor modules does not change - new webpack.HashedModuleIdsPlugin(), - // enable scope hoisting - new webpack.optimize.ModuleConcatenationPlugin(), - // split vendor js into its own file - new webpack.optimize.CommonsChunkPlugin({ - name: 'vendor', - minChunks (module) { - // any required modules inside node_modules are extracted to vendor - return ( - module.resource && - /\.js$/.test(module.resource) && - module.resource.indexOf( - path.join(__dirname, '../node_modules') - ) === 0 - ) - } - }), - // extract webpack runtime and module manifest to its own file in order to - // prevent vendor hash from being updated whenever app bundle is updated - new webpack.optimize.CommonsChunkPlugin({ - name: 'manifest', - minChunks: Infinity - }), - // This instance extracts shared chunks from code splitted chunks and bundles them - // in a separate chunk, similar to the vendor chunk - // see: https://webpack.js.org/plugins/commons-chunk-plugin/#extra-async-commons-chunk - new webpack.optimize.CommonsChunkPlugin({ - name: 'app', - async: 'vendor-async', - children: true, - minChunks: 3 - }), + }), + // keep module.id stable when vendor modules does not change + new webpack.HashedModuleIdsPlugin(), + // enable scope hoisting + new webpack.optimize.ModuleConcatenationPlugin(), + // split vendor js into its own file + // new webpack.optimize.CommonsChunkPlugin({ + // name: 'vendor', + // minChunks (module) { + // // any required modules inside node_modules are extracted to vendor + // return ( + // module.resource && + // /\.js$/.test(module.resource) && + // module.resource.indexOf( + // path.join(__dirname, '../node_modules') + // ) === 0 + // ) + // } + // }), + // extract webpack runtime and module manifest to its own file in order to + // prevent vendor hash from being updated whenever app bundle is updated + // new webpack.optimize.CommonsChunkPlugin({ + // name: 'manifest', + // minChunks: Infinity + // }), + // This instance extracts shared chunks from code splitted chunks and bundles them + // in a separate chunk, similar to the vendor chunk + // see: https://webpack.js.org/plugins/commons-chunk-plugin/#extra-async-commons-chunk + // new webpack.optimize.CommonsChunkPlugin({ + // name: 'entrance', + // async: 'vendor-async', + // children: true, + // minChunks: 3 + // }), - // copy custom static assets - new CopyWebpackPlugin([ - { - from: path.resolve(__dirname, '../static'), - to: config.build.assetsSubDirectory, - ignore: ['*'] - } - ]) - ] -}) + // copy custom static assets + new CopyWebpackPlugin([ + { + from: path.resolve(__dirname, '../static'), + to: config.build.assetsSubDirectory, + ignore: ['*'] + } + ]) + ] + }) +} else if (arg === 'app') { + webpackConfig = merge(baseWebpackConfig, { + module: { + rules: utils.styleLoaders({ + sourceMap: config.build.productionSourceMap, + extract: true, + usePostCSS: true + }) + }, + devtool: config.build.productionSourceMap ? config.build.devtool : false, + output: { + path: config.build.assetsRoot, + filename: utils.assetsPath('js/[name].[chunkhash].js'), + chunkFilename: utils.assetsPath('js/[name].[chunkhash].js') + }, + plugins: [ + /* new GenerateAssetPlugin({ + filename: 'config.json', + fn: (compilation, cb) => { + cb(null, createConfig(compilation)); + }, + extraFiles: [] + }), */ + // http://vuejs.github.io/vue-loader/en/workflow/production.html + new webpack.DefinePlugin({ + 'process.env': env + }), + // new ParallelUglifyPlugin({ + // cacheDir: '.cache/', + // uglifyJS: { + // output: { + // comments: false + // }, + // warnings: false, + // compress: { + // drop_debugger: true, + // drop_console: true + // } + // } + // }), + // extract css into its own file + new ExtractTextPlugin({ + filename: utils.assetsPath('css/[name].[contenthash].css'), + // Setting the following option to `false` will not extract CSS from codesplit chunks. + // Their CSS will instead be inserted dynamically with style-loader when the codesplit chunk has been loaded by webpack. + // It's currently set to `true` because we are seeing that sourcemaps are included in the codesplit bundle as well when it's `false`, + // increasing file size: https://github.com/vuejs-templates/webpack/issues/1110 + allChunks: true + }), + // Compress extracted CSS. We are using this plugin so that possible + // duplicated CSS from different components can be deduped. + new OptimizeCSSPlugin({ + cssProcessorOptions: config.build.productionSourceMap + ? { safe: true, map: { inline: false } } + : { safe: true } + }), + // generate dist index.html with correct asset hash for caching. + // you can customize output by editing /index.html + // see https://github.com/ampedandwired/html-webpack-plugin + new HtmlWebpackPlugin({ + favicon: path.resolve(__dirname, '../src/assets/img/favicon.ico'), + filename: config.build.index, + template: 'src/entrance/app/index.html', + hash: true, + inject: true, + minify: { + removeComments: true, + collapseWhitespace: true, + removeAttributeQuotes: true + // more options: + // https://github.com/kangax/html-minifier#options-quick-reference + }, + // necessary to consistently work with multiple chunks via CommonsChunkPlugin + chunksSortMode: 'dependency', + excludeChunks: ['exportHtml'] + }), + new GenerateAssetPlugin({ + filename: 'static/config.json', + fn: (compilation, cb) => { + cb(null, createJson()) + } + }), + // keep module.id stable when vendor modules does not change + new webpack.HashedModuleIdsPlugin(), + // enable scope hoisting + new webpack.optimize.ModuleConcatenationPlugin(), + // split vendor js into its own file + new webpack.optimize.CommonsChunkPlugin({ + name: 'vendor', + minChunks (module) { + // any required modules inside node_modules are extracted to vendor + return ( + module.resource && + /\.js$/.test(module.resource) && + module.resource.indexOf( + path.join(__dirname, '../node_modules') + ) === 0 + ) + } + }), + // extract webpack runtime and module manifest to its own file in order to + // prevent vendor hash from being updated whenever app bundle is updated + new webpack.optimize.CommonsChunkPlugin({ + name: 'manifest', + minChunks: Infinity + }), + // This instance extracts shared chunks from code splitted chunks and bundles them + // in a separate chunk, similar to the vendor chunk + // see: https://webpack.js.org/plugins/commons-chunk-plugin/#extra-async-commons-chunk + new webpack.optimize.CommonsChunkPlugin({ + name: 'app', + async: 'vendor-async', + children: true, + minChunks: 3 + }), + // copy custom static assets + new CopyWebpackPlugin([ + { + from: path.resolve(__dirname, '../static'), + to: config.build.assetsSubDirectory, + ignore: ['*'] + } + ]) + ] + }) +} if (process.env.NODE_ENV == 'development') { webpackConfig.plugins.push( new fileManagerPlugin({ @@ -224,7 +368,7 @@ if (process.env.NODE_ENV == 'development') { ] } ] - }), + }) // new WebpackZipPlugin({ // initialFile: './dist', // endPath: './dist', diff --git a/nezha-fronted/config/index.js b/nezha-fronted/config/index.js index 92b754a70..004b3ab0c 100644 --- a/nezha-fronted/config/index.js +++ b/nezha-fronted/config/index.js @@ -20,7 +20,7 @@ module.exports = { }, // Various Dev Server settings // host: '0.0.0.0', // can be overwritten by process.env.HOST - host: 'localhost', // can be overwritten by process.env.HOST + host: '0.0.0.0', // can be overwritten by process.env.HOST port: 80, // can be overwritten by process.env.PORT, if port is in use, a free one will be determined autoOpenBrowser: false, errorOverlay: true, diff --git a/nezha-fronted/package-lock.json b/nezha-fronted/package-lock.json index 858afd2ec..140a0d4bc 100644 --- a/nezha-fronted/package-lock.json +++ b/nezha-fronted/package-lock.json @@ -588,9 +588,9 @@ } }, "@codemirror/fold": { - "version": "0.19.4", - "resolved": "https://registry.npmjs.org/@codemirror/fold/-/fold-0.19.4.tgz", - "integrity": "sha512-0SNSkRSOa6gymD6GauHa3sxiysjPhUC0SRVyTlvL52o0gz9GHdc8kNqNQskm3fBtGGOiSriGwF/kAsajRiGhVw==", + "version": "0.19.3", + "resolved": "https://registry.npmjs.org/@codemirror/fold/-/fold-0.19.3.tgz", + "integrity": "sha512-8hT+Eq2G68mL0yPRvSD2ewhnLQAX6sbUJmtGVKFcj8oAXtfpYCX8LIcfXsuI19Qs7gZkOSpqZvn+KKj8IhZoAw==", "requires": { "@codemirror/gutter": "^0.19.0", "@codemirror/language": "^0.19.0", @@ -2147,9 +2147,9 @@ } }, "is-buffer": { - "version": "2.0.5", - "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-2.0.5.tgz", - "integrity": "sha512-i2R6zNFDwgEHJyQUtJEk0XFi1i0dPFn/oqjK3/vPCcDeJvW5NQ83V8QbicfF1SupOaB0h8ntgBC2YiE7dfyctQ==" + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-2.0.4.tgz", + "integrity": "sha512-Kq1rokWXOPXWuaMAqZiJW4XxsmD9zGx9q4aePabbn3qCRGedtH7Cm+zV8WETitMfu1wdh+Rvd6w5egwSngUX2A==" } } }, @@ -8382,6 +8382,22 @@ "find-index": "^0.1.1" } }, + "global": { + "version": "2.0.7", + "resolved": "https://registry.npmjs.org/global/-/global-2.0.7.tgz", + "integrity": "sha1-1DqcPR7HkV9kXY4OsKxgAQ6eBs0=", + "requires": { + "min-document": "~0.2.2", + "process": "~0.5.1" + }, + "dependencies": { + "process": { + "version": "0.5.2", + "resolved": "https://registry.npmjs.org/process/-/process-0.5.2.tgz", + "integrity": "sha1-FjjYqONML0QKkduVq5rrZ3/Bhc8=" + } + } + }, "globals": { "version": "9.18.0", "resolved": "https://registry.npmjs.org/globals/-/globals-9.18.0.tgz", @@ -8756,6 +8772,16 @@ "integrity": "sha1-ELMKOGCF9Dzt41PMj6fLDe7qZos=", "dev": true }, + "html-webpack-inline-source-plugin": { + "version": "0.0.10", + "resolved": "https://registry.npmjs.org/html-webpack-inline-source-plugin/-/html-webpack-inline-source-plugin-0.0.10.tgz", + "integrity": "sha512-0ZNU57u7283vrXSF5a4VDnVOMWiSwypKIp1z/XfXWoVHLA1r3Xmyxx5+Lz+mnthz/UvxL1OAf41w5UIF68Jngw==", + "requires": { + "escape-string-regexp": "^1.0.5", + "slash": "^1.0.0", + "source-map-url": "^0.4.0" + } + }, "html-webpack-plugin": { "version": "2.30.1", "resolved": "https://registry.npmjs.org/html-webpack-plugin/-/html-webpack-plugin-2.30.1.tgz", @@ -8949,6 +8975,11 @@ "integrity": "sha512-Pgs951kaMm5GXP7MOvxERINe3gsaVjUWFm+UZPSq9xYriQAksyhg0csnS0KXSNRD5NmNdapXEpjxG49+AKh/ug==", "dev": true }, + "immediate": { + "version": "3.0.6", + "resolved": "https://registry.npmjs.org/immediate/-/immediate-3.0.6.tgz", + "integrity": "sha1-nbHb0Pr43m++D13V5Wu2BigN5ps=" + }, "import-cwd": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/import-cwd/-/import-cwd-2.1.0.tgz", @@ -9032,6 +9063,11 @@ "integrity": "sha512-JV/yugV2uzW5iMRSiZAyDtQd+nxtUnjeLt0acNdw98kKLrvuRVyB80tsREOE7yvGVgalhZ6RNXCmEHkUKBKxew==", "dev": true }, + "insert-css": { + "version": "0.0.0", + "resolved": "https://registry.npmjs.org/insert-css/-/insert-css-0.0.0.tgz", + "integrity": "sha1-IwS/pviTq+y4/5yo2cdgXZTPKRE=" + }, "internal-ip": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/internal-ip/-/internal-ip-1.2.0.tgz", @@ -10801,6 +10837,11 @@ "graceful-fs": "^4.1.6" } }, + "jsonify": { + "version": "0.0.0", + "resolved": "https://registry.npmjs.org/jsonify/-/jsonify-0.0.0.tgz", + "integrity": "sha1-LHS27kHZPKUbe1qu6PUDYx0lKnM=" + }, "jspdf": { "version": "2.5.1", "resolved": "https://registry.npmjs.org/jspdf/-/jspdf-2.5.1.tgz", @@ -10848,6 +10889,17 @@ "verror": "1.10.0" } }, + "jszip": { + "version": "3.9.1", + "resolved": "https://registry.npmjs.org/jszip/-/jszip-3.9.1.tgz", + "integrity": "sha512-H9A60xPqJ1CuC4Ka6qxzXZeU8aNmgOeP5IFqwJbQQwtu2EUYxota3LdsiZWplF7Wgd9tkAd0mdu36nceSaPuYw==", + "requires": { + "lie": "~3.3.0", + "pako": "~1.0.2", + "readable-stream": "~2.3.6", + "set-immediate-shim": "~1.0.1" + } + }, "keyv": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/keyv/-/keyv-3.0.0.tgz", @@ -10942,6 +10994,14 @@ "type-check": "~0.4.0" } }, + "lie": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/lie/-/lie-3.3.0.tgz", + "integrity": "sha512-UaiMJzeWRlEujzAuw5LokY1L5ecNQYZKfmyZ9L7wDHb/p5etKaxXhohBcrw0EYby+G/NA52vRSN4N39dxHAIwQ==", + "requires": { + "immediate": "~3.0.5" + } + }, "load-json-file": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-2.0.0.tgz", @@ -11450,6 +11510,14 @@ "resolved": "https://registry.npmjs.org/mimic-response/-/mimic-response-1.0.1.tgz", "integrity": "sha512-j5EctnkH7amfV/q5Hgmoal1g2QHFJRraOtmx0JpIqkxhBhI/lJSl1nMpQ45hVarwNETOoWEimndZ4QK0RHxuxQ==" }, + "min-document": { + "version": "0.2.8", + "resolved": "https://registry.npmjs.org/min-document/-/min-document-0.2.8.tgz", + "integrity": "sha1-82IM9WA2ERVcuUFtCrVXaxbVPeM=", + "requires": { + "tape": "~1.0.2" + } + }, "minimalistic-assert": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/minimalistic-assert/-/minimalistic-assert-1.0.1.tgz", @@ -12430,8 +12498,7 @@ "pako": { "version": "1.0.11", "resolved": "https://registry.npmjs.org/pako/-/pako-1.0.11.tgz", - "integrity": "sha512-4hLB8Py4zZce5s4yd9XzopqwVv/yGNhV1Bl8NTmCq1763HeK2+EwVTv+leGeL13Dnh2wfbqowVPXCIO0z4taYw==", - "dev": true + "integrity": "sha512-4hLB8Py4zZce5s4yd9XzopqwVv/yGNhV1Bl8NTmCq1763HeK2+EwVTv+leGeL13Dnh2wfbqowVPXCIO0z4taYw==" }, "parallel-transform": { "version": "1.2.0", @@ -15030,6 +15097,24 @@ } } }, + "preload": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/preload/-/preload-0.1.0.tgz", + "integrity": "sha1-QAvt7o4p3BVSlV/z3r0EX0BCEwE=", + "requires": { + "inherits": "~2.0.1", + "insert-css": "0.0.0", + "once": "~1.2.0", + "xhr": "~1.2.3" + }, + "dependencies": { + "once": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/once/-/once-1.2.0.tgz", + "integrity": "sha1-3hkFxjavh0qPuoYtmqvd0fkgRhw=" + } + } + }, "prelude-ls": { "version": "1.2.1", "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.2.1.tgz", @@ -16359,6 +16444,11 @@ "resolved": "https://registry.npmjs.org/set-blocking/-/set-blocking-2.0.0.tgz", "integrity": "sha1-BF+XgtARrppoA93TgrJDkrPYkPc=" }, + "set-immediate-shim": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/set-immediate-shim/-/set-immediate-shim-1.0.1.tgz", + "integrity": "sha1-SysbJ+uAip+NzEgaWOXlb1mfP2E=" + }, "set-value": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/set-value/-/set-value-2.0.1.tgz", @@ -16496,8 +16586,7 @@ "slash": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/slash/-/slash-1.0.0.tgz", - "integrity": "sha1-xB8vbDn8FtHNF61LXYlhFK5HDVU=", - "dev": true + "integrity": "sha1-xB8vbDn8FtHNF61LXYlhFK5HDVU=" }, "slice-ansi": { "version": "4.0.0", @@ -16744,8 +16833,7 @@ "source-map-url": { "version": "0.4.0", "resolved": "https://registry.npmjs.org/source-map-url/-/source-map-url-0.4.0.tgz", - "integrity": "sha1-PpNdfd1zYxuXZZlW1VEo6HtQhKM=", - "dev": true + "integrity": "sha1-PpNdfd1zYxuXZZlW1VEo6HtQhKM=" }, "spdx-correct": { "version": "3.1.0", @@ -17383,6 +17471,29 @@ "integrity": "sha512-2wsvQ+4GwBvLPLWsNfLCDYGsW6xb7aeC6utq2Qh0PFwgEy7K7dsma9Jsmb2zSQj7GvYAyUGSntLtsv++GmgL1A==", "dev": true }, + "tape": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/tape/-/tape-1.0.4.tgz", + "integrity": "sha1-4ujlxt0/AP3CpeRRT2L8Ih5Z+cQ=", + "requires": { + "deep-equal": "~0.0.0", + "defined": "~0.0.0", + "jsonify": "~0.0.0", + "through": "~2.3.4" + }, + "dependencies": { + "deep-equal": { + "version": "0.0.0", + "resolved": "https://registry.npmjs.org/deep-equal/-/deep-equal-0.0.0.tgz", + "integrity": "sha1-mWedO70EcVb81FDT0B7rkGhpHoM=" + }, + "defined": { + "version": "0.0.0", + "resolved": "https://registry.npmjs.org/defined/-/defined-0.0.0.tgz", + "integrity": "sha1-817qfXBekzuvE7LwOz+D2SFAOz4=" + } + } + }, "tar": { "version": "2.2.2", "resolved": "https://registry.npmjs.org/tar/-/tar-2.2.2.tgz", @@ -17636,6 +17747,11 @@ "resolved": "https://registry.npmjs.org/throttle-debounce/-/throttle-debounce-1.1.0.tgz", "integrity": "sha512-XH8UiPCQcWNuk2LYePibW/4qL97+ZQ1AN3FNXwZRBNPPowo/NRU5fAlDCSNBJIYCKbioZfuYtMhG4quqoJhVzg==" }, + "through": { + "version": "2.3.8", + "resolved": "https://registry.npmjs.org/through/-/through-2.3.8.tgz", + "integrity": "sha1-DdTJ/6q8NXlgsbckEV1+Doai4fU=" + }, "through2": { "version": "2.0.5", "resolved": "https://registry.npmjs.org/through2/-/through2-2.0.5.tgz", @@ -19441,6 +19557,22 @@ "resolved": "https://registry.npmjs.org/xe-utils/-/xe-utils-2.3.0.tgz", "integrity": "sha512-AGb3oZxoktHHk1i1TD/v6aQyUbJUqMNuBp1zMFuNBCT8HjP7OD+C1X/8m14jzxOC1YeXfoHwwYmGDUMgqZnsFg==" }, + "xhr": { + "version": "1.2.4", + "resolved": "https://registry.npmjs.org/xhr/-/xhr-1.2.4.tgz", + "integrity": "sha1-/MpGT80XIjmobSsePTTRK3EsNIo=", + "requires": { + "global": "~2.0.7", + "once": "~1.1.1" + }, + "dependencies": { + "once": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/once/-/once-1.1.1.tgz", + "integrity": "sha1-nbV0kzzLCMOnYU0VQDLAnqbzOec=" + } + } + }, "xlsx": { "version": "0.15.6", "resolved": "https://registry.npmjs.org/xlsx/-/xlsx-0.15.6.tgz", diff --git a/nezha-fronted/package.json b/nezha-fronted/package.json index 80494db7a..1b34ace32 100644 --- a/nezha-fronted/package.json +++ b/nezha-fronted/package.json @@ -6,8 +6,10 @@ "private": true, "scripts": { "dev": "node --max-old-space-size=10240 ./node_modules/webpack-dev-server/bin/webpack-dev-server.js --inline --progress --config build/webpack.dev.conf.js", + "dev:html": "node --max-old-space-size=10240 ./node_modules/webpack-dev-server/bin/webpack-dev-server.js --inline --progress --config build/webpack.dev.conf.js", "start": "npm run dev", - "build": "node build/build.js", + "build": "node build/build.js app", + "build:html": "node build/build.js html", "lint": "eslint --fix --ext .js,.vue src", "unit": "jest --config test/unit/jest.conf.js --coverage" }, @@ -39,13 +41,16 @@ "echarts": "^5.2.2", "element-ui": "^2.15.3", "file-saver": "^2.0.2", + "html-webpack-inline-source-plugin": "0.0.10", "html2canvas": "^1.4.1", "jspdf": "^2.5.1", + "jszip": "^3.9.1", "leaflet": "^1.7.1", "moment-timezone": "^0.5.33", "mqtt": "4.2.6", "node-sass": "^4.14.1", "pl-table": "^2.5.8", + "preload": "^0.1.0", "qrcodejs2": "0.0.2", "quill": "^1.3.7", "v-selectpage": "^2.1.4", diff --git a/nezha-fronted/src/components/chart/chart.vue b/nezha-fronted/src/components/chart/chart.vue index c1c80f0cd..d64d32633 100644 --- a/nezha-fronted/src/components/chart/chart.vue +++ b/nezha-fronted/src/components/chart/chart.vue @@ -2,7 +2,7 @@