From 8a42987cbc94722ab24f805925b5922a1af4b217 Mon Sep 17 00:00:00 2001 From: LAPTOP-RI7D261L\Mr Ke <545800322@qq.com> Date: Tue, 04 Feb 2020 12:34:19 +0800 Subject: [PATCH] 修改 --- .command/code/view/content.js | 2 /dev/null | 74 -------------- .command/code/index.js | 2 babelrc | 42 ++++++++ .command/.conf/webpack.test.js | 91 +++++++++-------- package.json | 29 ++++- .command/.gitignore | 2 .command/.conf/webpack.dist.js | 2 .babelrc | 42 ++++++++ .command/.conf/rules.js | 4 10 files changed, 157 insertions(+), 133 deletions(-) diff --git a/.babelrc b/.babelrc new file mode 100644 index 0000000..7841f77 --- /dev/null +++ b/.babelrc @@ -0,0 +1,42 @@ +{ + "presets": [ + [ + "env", + { + "targets": { + "browsers": [ + "last 2 version", + "last 2 years" + ] + } + } + ], + "react", + "stage-0" + ], + "plugins": [ + [ + "import", + [ + { + "libraryName": "antd", + "style": "css" + }, + { + "libraryName": "antd-mobile", + "style": "css" + } + ] + ], + [ + "transform-runtime", + { + "helpers": false, + "polyfill": false, + "regenerator": true, + "moduleName": "babel-runtime" + } + ], + "imext" + ] +} \ No newline at end of file diff --git a/.command/.conf/rules.js b/.command/.conf/rules.js index 8134934..d2a85a7 100644 --- a/.command/.conf/rules.js +++ b/.command/.conf/rules.js @@ -13,10 +13,10 @@ test: /\.less$/i, use: [MiniCssExtractPlugin.loader, 'css-loader', 'less-loader'] }, { - test: /\.(svg|png|jpg|gif)$/i, + test: /\.(svg|png|jpg|gif|mp4|ttf)$/i, loader: 'file-loader', options: { name: '[name].[ext]?[hash]', outputPath: 'static/' } -}];; +}]; diff --git a/.command/.conf/webpack.dist.js b/.command/.conf/webpack.dist.js index 8e028a0..3bbcd41 100644 --- a/.command/.conf/webpack.dist.js +++ b/.command/.conf/webpack.dist.js @@ -15,7 +15,7 @@ test: /\.s[ac]ss$/i, use: [MiniCssExtractPlugin.loader, 'css-loader', 'sass-loader'] }, { - test: /\.(svg|png|jpg|gif)$/i, + test: /\.(svg|png|jpg|gif|ttf)$/i, loader: 'file-loader', options: { name: '[name].[ext]?[hash]', diff --git a/.command/.conf/webpack.test.js b/.command/.conf/webpack.test.js index 556a463..9dc2be5 100644 --- a/.command/.conf/webpack.test.js +++ b/.command/.conf/webpack.test.js @@ -1,37 +1,41 @@ const MiniCssExtractPlugin = require("mini-css-extract-plugin"); -const HtmlWebpackPlugin = require('html-webpack-plugin'); -const CopyWebpackPlugin = require('copy-webpack-plugin'); -const webpack = require('webpack'); -const path = require('path'); -const fs = require('fs'); +const HtmlWebpackPlugin = require("html-webpack-plugin"); +const CopyWebpackPlugin = require("copy-webpack-plugin"); +const webpack = require("webpack"); +const path = require("path"); +const fs = require("fs"); -const rules = [{ - test: /\.(js|jsx)$/i, - loader: 'babel-loader' -}, { - test: /\.css$/i, - use: [MiniCssExtractPlugin.loader, 'css-loader'] -}, { - test: /\.s[ac]ss$/i, - use: [MiniCssExtractPlugin.loader, 'css-loader', 'sass-loader'] -}, { - test: /\.less$/i, - use: [MiniCssExtractPlugin.loader, 'css-loader', 'less-loader'] -}, { - test: /\.(svg|png|jpg|gif)$/i, - loader: 'file-loader', - options: { - name: '[name].[ext]?[hash]', - outputPath: 'static/' +const rules = [ + { + test: /\.(js|jsx)$/i, + loader: "babel-loader" + }, + { + test: /\.css$/i, + use: [MiniCssExtractPlugin.loader, "css-loader"] + }, + { + test: /\.s[ac]ss$/i, + use: [MiniCssExtractPlugin.loader, "css-loader", "sass-loader"] + }, + { + test: /\.less$/i, + use: [MiniCssExtractPlugin.loader, "css-loader", "less-loader"] + }, + { + test: /\.(svg|png|jpg|gif|ttf)$/i, + loader: "file-loader", + options: { + name: "[name].[ext]?[hash]", + outputPath: "static/" + } } -}]; - - +]; const plugins = [ new webpack.HotModuleReplacementPlugin(), new HtmlWebpackPlugin({ - template: './src/conf/index.html', + template: "./src/conf/index.html", minify: true }), new MiniCssExtractPlugin({ @@ -39,24 +43,23 @@ }) ]; -if (fs.existsSync(path.resolve(__dirname, './src/copy'))) { - plugins.push(new CopyWebpackPlugin([{ - to: path.resolve(__dirname, './dist-debug'), - from: './src/copy', - toType: 'dir' - }])); +if (fs.existsSync(path.resolve(__dirname, "./src/copy"))) { + plugins.push( + new CopyWebpackPlugin([ + { + to: path.resolve(__dirname, "./dist-debug"), + from: "./src/copy", + toType: "dir" + } + ]) + ); } - module.exports = { - entry: [ - './src/conf/reset.scss', - './src/index.jsx', - './src/conf/cover.scss' - ], + entry: ["./src/conf/reset.scss", "./src/index.jsx", "./src/conf/cover.scss"], output: { - path: path.resolve(__dirname, './dist-debug'), - filename: 'index.js?[hash]' + path: path.resolve(__dirname, "./dist-debug"), + filename: "index.js?[hash]" }, resolve: { extensions: [".js", ".jsx", ".ts", ".tsx"] @@ -65,10 +68,10 @@ rules }, devServer: { - contentBase: './dist-debug', + contentBase: "./dist-debug", hot: true }, - mode: 'development', - devtool: 'inline-source-map', + mode: "development", + devtool: "inline-source-map", plugins }; diff --git a/.command/.gitignore b/.command/.gitignore index 4b3a501..8b13789 100644 --- a/.command/.gitignore +++ b/.command/.gitignore @@ -1 +1 @@ -!.command/dist + diff --git a/.command/code/index.js b/.command/code/index.js index 95cc337..bda6abc 100644 --- a/.command/code/index.js +++ b/.command/code/index.js @@ -7,7 +7,7 @@ const program = process.argv.slice(2); -if (['component', 'components', 'view', 'views'].includes(path.basename(base))) { +if (['component', 'components', 'comp', 'view', 'views'].includes(path.basename(base))) { require('./view')(base, program[0], program.slice(1)); } else if (path.basename(base) === 'page') { require('./page')(base, program[0], program.slice(1)); diff --git a/.command/code/view/content.js b/.command/code/view/content.js index a1cdc36..8ccaa1e 100644 --- a/.command/code/view/content.js +++ b/.command/code/view/content.js @@ -46,7 +46,7 @@ function indexSass(view, args) { return [ hicode(args), - `@import '../../conf/vars';`, + // `@import '../../conf/vars';`, ``, `.${kebabCase(view)} {`, ` &-main {`, diff --git a/.command/webpack.dist.js b/.command/webpack.dist.js deleted file mode 100644 index e3446e9..0000000 --- a/.command/webpack.dist.js +++ /dev/null @@ -1,95 +0,0 @@ -const MiniCssExtractPlugin = require("mini-css-extract-plugin"); -const CleanWebpackPlugin = require('clean-webpack-plugin'); -const CopyWebpackPlugin = require('copy-webpack-plugin'); -const HtmlWebpackPlugin = require('html-webpack-plugin'); -const webpack = require('webpack'); -const path = require('path'); -const fs = require('fs'); -const rules = [{ - test: /\.(js|jsx)$/i, - loader: 'babel-loader' -}, { - test: /\.css$/i, - use: [MiniCssExtractPlugin.loader, 'css-loader'] -}, { - test: /\.s[ac]ss$/i, - use: [MiniCssExtractPlugin.loader, 'css-loader', 'sass-loader'] -}, { - test: /\.(svg|png|jpg|gif)$/i, - loader: 'file-loader', - options: { - name: '[name].[ext]?[hash]', - outputPath: 'static/' - } -}]; - - -const plugins = [ - new webpack.HotModuleReplacementPlugin(), - new HtmlWebpackPlugin({ - template: path.resolve(__dirname, './Delivery/desktop/src/conf/home.html'), - filename: 'home.html', - chunks: ['home'], - minify: true - }), - new HtmlWebpackPlugin({ - template: path.resolve(__dirname, './Delivery/desktop/src/conf/login.html'), - filename: 'login.html', - chunks: ['login'], - minify: true - }), - new HtmlWebpackPlugin({ - template: path.resolve(__dirname, './Delivery/desktop/src/conf/ems.html'), - filename: 'ems.html', - chunks: ['ems'], - minify: true - }), - new CleanWebpackPlugin(['dist'], { - root: path.resolve(__dirname, './Delivery/desktop') - }), - new MiniCssExtractPlugin({ - filename: "[name].css?[hash]" - }) -]; - -if (fs.existsSync(path.resolve(__dirname, './Delivery/desktop/src/copy'))) { - plugins.push(new CopyWebpackPlugin([{ - to: path.resolve(__dirname, './Delivery/desktop/dist'), - from: './Delivery/desktop/src/copy', - toType: 'dir' - }])); -} - - -module.exports = { - entry: { - home: [ - './Delivery/desktop/src/conf/reset.scss', - './Delivery/desktop/src/home.jsx', - './Delivery/desktop/src/conf/cover.scss' - ], - login: [ - './Delivery/desktop/src/conf/reset.scss', - './Delivery/desktop/src/login.jsx', - './Delivery/desktop/src/conf/cover.scss' - ], - ems: [ - './Delivery/desktop/src/conf/reset.scss', - './Delivery/desktop/src/ems.jsx', - './Delivery/desktop/src/conf/cover.scss' - ] - }, - output: { - path: path.resolve(__dirname, './Delivery/desktop/dist'), - filename: '[name].js?[hash]' - }, - resolve: { - extensions: [".js", ".jsx", ".ts", ".tsx"] - }, - module: { - rules - }, - mode: 'production', - devtool: 'none', - plugins -}; diff --git a/.command/webpack.test.js b/.command/webpack.test.js deleted file mode 100644 index 556a463..0000000 --- a/.command/webpack.test.js +++ /dev/null @@ -1,74 +0,0 @@ -const MiniCssExtractPlugin = require("mini-css-extract-plugin"); -const HtmlWebpackPlugin = require('html-webpack-plugin'); -const CopyWebpackPlugin = require('copy-webpack-plugin'); -const webpack = require('webpack'); -const path = require('path'); -const fs = require('fs'); - -const rules = [{ - test: /\.(js|jsx)$/i, - loader: 'babel-loader' -}, { - test: /\.css$/i, - use: [MiniCssExtractPlugin.loader, 'css-loader'] -}, { - test: /\.s[ac]ss$/i, - use: [MiniCssExtractPlugin.loader, 'css-loader', 'sass-loader'] -}, { - test: /\.less$/i, - use: [MiniCssExtractPlugin.loader, 'css-loader', 'less-loader'] -}, { - test: /\.(svg|png|jpg|gif)$/i, - loader: 'file-loader', - options: { - name: '[name].[ext]?[hash]', - outputPath: 'static/' - } -}]; - - - -const plugins = [ - new webpack.HotModuleReplacementPlugin(), - new HtmlWebpackPlugin({ - template: './src/conf/index.html', - minify: true - }), - new MiniCssExtractPlugin({ - filename: "index.css?[hash]" - }) -]; - -if (fs.existsSync(path.resolve(__dirname, './src/copy'))) { - plugins.push(new CopyWebpackPlugin([{ - to: path.resolve(__dirname, './dist-debug'), - from: './src/copy', - toType: 'dir' - }])); -} - - -module.exports = { - entry: [ - './src/conf/reset.scss', - './src/index.jsx', - './src/conf/cover.scss' - ], - output: { - path: path.resolve(__dirname, './dist-debug'), - filename: 'index.js?[hash]' - }, - resolve: { - extensions: [".js", ".jsx", ".ts", ".tsx"] - }, - module: { - rules - }, - devServer: { - contentBase: './dist-debug', - hot: true - }, - mode: 'development', - devtool: 'inline-source-map', - plugins -}; diff --git a/babelrc b/babelrc new file mode 100644 index 0000000..7841f77 --- /dev/null +++ b/babelrc @@ -0,0 +1,42 @@ +{ + "presets": [ + [ + "env", + { + "targets": { + "browsers": [ + "last 2 version", + "last 2 years" + ] + } + } + ], + "react", + "stage-0" + ], + "plugins": [ + [ + "import", + [ + { + "libraryName": "antd", + "style": "css" + }, + { + "libraryName": "antd-mobile", + "style": "css" + } + ] + ], + [ + "transform-runtime", + { + "helpers": false, + "polyfill": false, + "regenerator": true, + "moduleName": "babel-runtime" + } + ], + "imext" + ] +} \ No newline at end of file diff --git a/package.json b/package.json index 43a3142..e86a36b 100644 --- a/package.json +++ b/package.json @@ -1,5 +1,5 @@ { - "name": "byfy", + "name": "ByfyYfzt", "description": "白云法院前端项目", "scripts": { "code": "node ./.command/code", @@ -21,35 +21,46 @@ "copy-webpack-plugin": "^4.5.1", "cross-env": "^5.1.5", "css-loader": "^0.28.11", + "es6-promise": "^4.2.5", "file-loader": "^1.1.11", "html-webpack-plugin": "^3.2.0", + "isomorphic-fetch": "^2.2.1", "less": "^3.0.4", "less-loader": "^4.1.0", "mini-css-extract-plugin": "^0.4.0", "node-sass": "^4.9.0", + "react-sticky": "^6.0.3", "sass-loader": "^7.0.1", "style-loader": "^0.21.0", "webpack": "^4.8.3", "webpack-cli": "^2.1.3", - "webpack-dev-server": "^3.1.4" + "webpack-dev-server": "3.1.10" }, + "license": "ISC", "dependencies": { - "antd": "^3.5.2", + "antd": "^3.10.8", "antd-mobile": "2.1.6", "babel-polyfill": "^6.26.0", "babel-runtime": "^6.26.0", - "braft-editor": "^2.1.22", + "braft-editor": "^2.3.8", "classnames": "^2.2.5", - "echarts": "^4.1.0", - "hife": "^1.0.10", + "define-properties": "^1.1.3", + "echarts": "^4.2.1", + "extract-text-webpack-plugin": "^3.0.2", + "hife": "1.0.10", + "less-vars-to-js": "^1.3.0", "lodash": "^4.17.10", "moment": "^2.22.1", - "react": "16.3.2", + "react": "^16.3.2", + "react-amap": "^1.2.7", + "react-bmap": "^1.0.74", "react-dom": "^16.3.2", "react-router": "^4.2.0", "react-router-dom": "^4.2.2", - "simditor": "^2.3.19", - "simditor-html": "^1.1.1", + "react-sticky": "^6.0.3", + "reqwest": "^2.0.5", + "styled-components": "^4.1.3", + "swiper": "^4.4.6", "weixin-js-sdk": "^1.3.2" } } -- Gitblit v1.8.0