Commit 30374c50 authored by 邓晓峰's avatar 邓晓峰

fix: pretter layout/basiclayout.js format code style

parent b21e1ce6
Pipeline #21276 skipped with stages
This diff is collapsed.
......@@ -10,12 +10,12 @@ export default {
activeRule: genActiveRule('/civbase/civweb4'),
props: {},
},
// {
// name: 'civweb5',
// entry: `//${window.location.hostname}:3008/civbase/civweb5`,
// container: '#micro-container',
// activeRule: genActiveRule('/civbase/civweb5'),
// },
{
name: 'civweb5',
entry: `//${window.location.hostname}:3002/civbase/civweb5`,
container: '#micro-container',
activeRule: genActiveRule('/civbase/civweb5'),
},
],
prod: [
{
......
module.exports = {
dev: {
'/CityInterface': {
// target: 'http://192.168.10.151:8055',
target: 'http://192.168.10.151:8055',
// target: 'https://panda-water.cn',
// target: 'http://192.168.19.102:8055',
target: 'https://panda-water.com',
// target: 'https://panda-water.com',
// target: 'http://192.168.10.150:8050',
// target: 'http://192.168.19.103:8112',
// target: 'http://192.168.12.8:8098',
......@@ -19,10 +19,11 @@ module.exports = {
},
},
'/cityinterface': {
target: 'http://192.168.10.151:8055',
// target: 'http://192.168.10.150:8050',
// target: 'https://panda-water.cn',
// target: 'http://192.168.19.102:8055',
target: 'https://panda-water.com',
// target: 'https://panda-water.com',
// target: 'http://192.168.12.8:8098',
// target: 'http://192.168.10.20:8888',
changeOrigin: true,
......@@ -48,6 +49,6 @@ module.exports = {
pathRewrite: {
'/Publish': '/Publish',
},
}
},
},
};
......@@ -9,17 +9,22 @@ const webpackConfig = require('./webpack.prod.babel')
const argv = require('../../server/argv');
const spinner = ora('building for production...');
// const Diff = require('diff');
/* eslint-disable */
spinner.start()
// rm(argv.releasepath ? path.resolve(argv.releasepath, pkg.name.toLocaleLowerCase()): `./${pkg.name.toLocaleLowerCase()}`, err => {
// if (err) throw err
// })
webpack(webpackConfig, function (err, stats) {
rm(
process.env.npm_config_releasepath
? path.resolve(
process.env.npm_config_releasepath,
pkg.name.toLocaleLowerCase(),
)
: `./${pkg.name.toLocaleLowerCase()}`,
err => {
if (err) throw err
// eslint-disable-next-line no-shadow
webpack(webpackConfig, function (err, stats) {
spinner.stop()
if (err) throw err
process.stdout.write(stats.toString({
process.stdout.write(`${stats.toString({
colors: true,
color: true,
progress: true,
......@@ -27,7 +32,7 @@ webpack(webpackConfig, function (err, stats) {
children: false,
chunks: true,
chunkModules: true
}) + '\n\n')
}) }\n\n`)
if (stats.hasErrors()) {
console.log(chalk.red(' Build failed with errors.\n'))
......@@ -35,8 +40,11 @@ webpack(webpackConfig, function (err, stats) {
}
console.log(chalk.cyan(' Build complete.\n'))
console.log(chalk.yellow(
console.log(
chalk.yellow(
' Tip: built files are meant to be served over an HTTP server.\n' +
' Opening index.html over file:// won\'t work.\n'
))
})
})
"use strict";
var rm = require('rimraf');
var path = require('path');
var webpack = require('webpack');
var chalk = require('chalk');
var ora = require('ora');
var pkg = require('../../package.json');
var webpackConfig = require('./webpack.prod.babel');
var argv = require('../../server/argv');
var spinner = ora('building for production...'); // const Diff = require('diff');
spinner.start(); // rm(argv.releasepath ? path.resolve(argv.releasepath, pkg.name.toLocaleLowerCase()): `./${pkg.name.toLocaleLowerCase()}`, err => {
// if (err) throw err
// })
webpack(webpackConfig, function (err, stats) {
spinner.stop();
if (err) throw err;
process.stdout.write(stats.toString({
colors: true,
color: true,
progress: true,
modules: false,
children: false,
chunks: true,
chunkModules: true
}) + '\n\n');
if (stats.hasErrors()) {
console.log(chalk.red(' Build failed with errors.\n'));
process.exit(1);
}
console.log(chalk.cyan(' Build complete.\n'));
console.log(chalk.yellow(' Tip: built files are meant to be served over an HTTP server.\n' + ' Opening index.html over file:// won\'t work.\n'));
});
\ No newline at end of file
"use strict";
// Important modules this config uses
var path = require('path');
var HtmlWebpackPlugin = require('html-webpack-plugin');
var WebpackPwaManifest = require('webpack-pwa-manifest');
var OfflinePlugin = require('offline-plugin');
var _require = require('webpack'),
HashedModuleIdsPlugin = _require.HashedModuleIdsPlugin;
var TerserPlugin = require('terser-webpack-plugin');
var CompressionPlugin = require('compression-webpack-plugin');
var _require2 = require('webpack-manifest-plugin'),
WebpackManifestPlugin = _require2.WebpackManifestPlugin;
module.exports = require('./webpack.base.babel')({
mode: 'production',
// In production, we skip all hot-reloading stuff
entry: [require.resolve('react-app-polyfill/ie11'), path.join(process.cwd(), 'src/app.js')],
// Utilize long-term caching by adding content hashes (not compilation hashes) to compiled assets
output: {
filename: '[name].js',
chunkFilename: '[name].chunk.js'
},
optimization: {
minimize: true,
minimizer: [new TerserPlugin({
terserOptions: {
warnings: false,
compress: {
comparisons: false
},
parse: {},
mangle: true,
output: {
comments: false,
ascii_only: true
}
},
parallel: true,
cache: true,
sourceMap: true
})],
nodeEnv: 'production',
sideEffects: true,
concatenateModules: true,
runtimeChunk: 'single',
splitChunks: {
chunks: 'all',
maxInitialRequests: 10,
minSize: 0,
cacheGroups: {
vendor: {
test: /[\\/]node_modules[\\/]/,
name: function name(module) {
var packageName = module.context.match(/[\\/]node_modules[\\/](.*?)([\\/]|$)/)[1];
return "npm.".concat(packageName.replace('@', ''));
}
}
}
}
},
plugins: [// Minify and optimize the index.html
new HtmlWebpackPlugin({
template: 'src/index.html',
minify: {
removeComments: true,
collapseWhitespace: true,
removeRedundantAttributes: true,
useShortDoctype: true,
removeEmptyAttributes: true,
removeStyleLinkTypeAttributes: true,
keepClosingSlash: true,
minifyJS: true,
minifyCSS: true,
minifyURLs: true
},
inject: true
}), // Put it in the end to capture all the HtmlWebpackPlugin's
// assets manipulations and do leak its manipulations to HtmlWebpackPlugin
// new OfflinePlugin({
// relativePaths: false,
// publicPath: '/',
// appShell: '/',
// // No need to cache .htaccess. See http://mxs.is/googmp,
// // this is applied before any match in `caches` section
// excludes: ['.htaccess'],
// caches: {
// main: [':rest:'],
// // All chunks marked as `additional`, loaded after main section
// // and do not prevent SW to install. Change to `optional` if
// // do not want them to be preloaded at all (cached only when first loaded)
// additional: ['*.chunk.js'],
// },
// // Removes warning for about `additional` section usage
// safeToUseOptionalCaches: true,
// }),
new CompressionPlugin({
algorithm: 'gzip',
test: /\.js$|\.css$|\.html$/,
threshold: 10240,
minRatio: 0.8
}), // new WebpackPwaManifest({
// name: '运维管理平台',
// short_name: '运维管理平台',
// description: '运维管理平台',
// background_color: '#fafafa',
// theme_color: '#b1624d',
// inject: true,
// ios: true,
// icons: [
// {
// src: path.resolve('src/images/icon-512x512.png'),
// sizes: [72, 96, 128, 144, 192, 384, 512],
// },
// {
// src: path.resolve('src/images/icon-512x512.png'),
// sizes: [120, 152, 167, 180],
// ios: true,
// },
// ],
// }),
new HashedModuleIdsPlugin({
hashFunction: 'sha256',
hashDigest: 'hex',
hashDigestLength: 20
}), new WebpackManifestPlugin({
publicPath: '/civbase/',
map: function map(file) {
file.name = file.name.replace(/(\.[a-f0-9]{32})(\..*)$/, '$2');
return file;
}
})],
performance: {
assetFilter: function assetFilter(assetFilename) {
return !/(\.map$)|(^(main\.|favicon\.))/.test(assetFilename);
}
}
});
\ No newline at end of file
......@@ -10,9 +10,11 @@ module.exports = options => ({
entry: options.entry,
output: Object.assign(
{
path: argv.releasepath
? path.resolve(argv.releasepath, pkg.name.toLocaleLowerCase())
: path.resolve(process.cwd(), pkg.name.toLocaleLowerCase()),
path: process.env.npm_config_releasepath
? path.resolve(
process.env.npm_config_releasepath,
pkg.name.toLocaleLowerCase(),
) : path.resolve(process.cwd(), pkg.name.toLocaleLowerCase()),
publicPath: `/${pkg.name.toLocaleLowerCase()}`,
},
options.output,
......@@ -106,7 +108,7 @@ module.exports = options => ({
options: {
// Inline files smaller than 10 kB
limit: 10 * 1024,
name: '[name].[ext]',
// name: '[name].[ext]',
noquotes: true,
},
},
......@@ -172,13 +174,12 @@ module.exports = options => ({
}),
new webpack.DefinePlugin({
'process.env.ASSET_PATH': JSON.stringify(ASSET_PATH),
}),
new CopyPlugin([
{
from: path.resolve(process.cwd(), 'theme'),
to: path.resolve(
argv.releasepath || process.cwd(),
process.env.npm_config_releasepath || process.cwd(),
`${pkg.name.toLocaleLowerCase()}/theme`,
),
},
......
......@@ -18,8 +18,8 @@ module.exports = require('./webpack.base.babel')({
// Utilize long-term caching by adding content hashes (not compilation hashes) to compiled assets
output: {
filename: '[name].js',
chunkFilename: '[name].chunk.js',
filename: '[name].[chunkhash].js',
chunkFilename: '[name].[chunkhash].chunk.js',
},
optimization: {
......
......@@ -19,7 +19,7 @@
"npmcheckversion": "node ./internals/scripts/npmcheckversion.js",
"preinstall": "npm run npmcheckversion",
"prebuild": "npm run build:clean",
"build": "cross-env NODE_ENV=production webpack --config internals/webpack/webpack.prod.babel.js --color -p --progress --hide-modules --display-optimization-bailout",
"build": "cross-env NODE_ENV=production node internals/webpack/build.js",
"build:clean": "rimraf ./build",
"start": "cross-env NODE_ENV=development node server --port=$port",
"start:tunnel": "cross-env NODE_ENV=development ENABLE_TUNNEL=true node server",
......@@ -41,10 +41,11 @@
"lint:eslint": "eslint --ignore-path .gitignore --ignore-pattern internals/scripts",
"lint:eslint:fix": "eslint --ignore-path .gitignore --ignore-pattern internals/scripts --fix",
"lint:fix": "eslint --fix --cache --ext .js,.jsx,.ts,.tsx --format=pretty ./src",
"lint:js": "npm run lint:eslint -- . ",
"lint:js": "eslint --cache --ext .js,.jsx,.ts,.tsx --format=pretty ./src ",
"lint:prettier": "prettier -c ./src/**/*.js",
"lint:staged": "lint-staged",
"pretest": "npm run test:clean && npm run lint",
"prettier": "prettier -c --write \"src/**/*\"",
"prettier": "prettier --write ./src/**/*.js",
"test:clean": "rimraf ./coverage",
"test": "cross-env NODE_ENV=test jest --coverage",
"test:watch": "cross-env NODE_ENV=test jest --watchAll",
......@@ -219,7 +220,7 @@
"postcss-safe-parser": "4.0.2",
"pre-commit": "1.2.2",
"prettier": "1.17.0",
"qiankun": "^2.2.4-1",
"qiankun": "^2.2.4",
"qs": "^6.9.0",
"react": "^16.8.6",
"react-app-polyfill": "0.2.2",
......
......@@ -4,7 +4,6 @@ import { applyMiddleware, compose, createStore } from 'redux';
import { createLogger } from 'redux-logger';
import createSagaMiddleware from 'redux-saga';
import thunk from 'redux-thunk';
import createReducer from './reducers';
const logger = createLogger({
......
......@@ -3,7 +3,7 @@
/* eslint-disable no-underscore-dangle */
/* globals workbox */
workbox.core.setCacheNameDetails({
prefix: 'antd-pro',
prefix: 'panda',
suffix: 'v1',
});
// Control all opened tabs ASAP
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment