@epig/create-app
Advanced tools
Comparing version 1.4.0 to 1.5.0
@@ -193,7 +193,7 @@ const chalk = require('chalk'); | ||
case 'admin': | ||
allDependencies = ['react', 'react-dom', '@babel/polyfill', 'antd', 'classnames', '@epig/admin-tools']; | ||
allDependencies = ['react', 'react-dom', 'antd', 'classnames', '@epig/admin-tools']; | ||
buildInDependencies = buildInDependencies.concat(['src/models']); | ||
break; | ||
case 'luna': | ||
allDependencies = ['react', 'react-dom', '@babel/polyfill', 'antd', 'classnames', '@epig/luna', 'react-document-title', 'react-router', 'react-router-dom']; | ||
allDependencies = ['react', 'react-dom', 'antd', 'classnames', '@epig/luna', 'react-document-title', 'react-router', 'react-router-dom']; | ||
buildInDependencies = buildInDependencies.concat(['src/models']); | ||
@@ -200,0 +200,0 @@ break; |
{ | ||
"name": "@epig/create-app", | ||
"version": "1.4.0", | ||
"version": "1.5.0", | ||
"description": "create react app", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
const path = require('path'); | ||
const config = { | ||
outputPath: 'dist/static', | ||
plugins: [ | ||
['epig-plugin-admin', {}], | ||
['epig-plugin-html', { inject: true, template: path.resolve('./public/index.html') }], | ||
['epig-plugin-copy-server', { output: 'dist' }], | ||
['epig-plugin-html', {}], | ||
['epig-plugin-copy-server', {}], | ||
], | ||
chainWebpack: (config, { webpack }) => { | ||
config.optimization.splitChunks({ | ||
cacheGroups: { | ||
['vendor']: { | ||
test: /[\\/]node_modules[\\/](?!@epig\/admin-tools)/, | ||
name: 'vendor', | ||
chunks: 'all', | ||
}, | ||
// // 抽离antd && rc-* | ||
antd: { | ||
test: /(antd|rc-)/, | ||
name: 'antd', | ||
chunks: 'all', | ||
enforce: true, | ||
priority: 2, | ||
}, | ||
wangEditor: { | ||
test: /wangEditor/, | ||
name: 'wangEditor', | ||
chunks: 'async', | ||
priority: 3, | ||
enforce: true, | ||
}, | ||
commons: { | ||
name: 'commons', | ||
chunks: 'async', | ||
minChunks: 2, | ||
enforce: true, | ||
priority: 1, | ||
}, | ||
}, | ||
}); | ||
}, | ||
}; | ||
module.exports = config; |
@@ -15,5 +15,5 @@ { | ||
"express": "^4.14.0", | ||
"express-http-proxy": "^0.10.1", | ||
"request": "^2.79.0" | ||
"express-static-gzip": "^1.1.3", | ||
"http-proxy-middleware": "^0.19.1" | ||
} | ||
} | ||
} |
'use strict'; | ||
var bodyParser = require('body-parser'); | ||
var request = require('request'); | ||
@@ -10,16 +9,16 @@ const API_SERVER = process.env.API_SERVER ? process.env.API_SERVER : '127.0.0.1:8000'; | ||
const TIMEOUT = 60000; | ||
var express = require('express'), | ||
proxy = require('express-http-proxy'), | ||
path = require('path'), | ||
app = express(); | ||
var express = require('express'), | ||
proxy = require('http-proxy-middleware'), | ||
expressStaticGzip = require('express-static-gzip'), | ||
path = require('path'), | ||
app = express(); | ||
function getClientIp(req) { | ||
var headers = req.headers; | ||
var ip = headers['x-real-ip'] || headers['x-forwarded-for'] || req.connection.remoteAddress; | ||
return ip; | ||
var headers = req.headers; | ||
var ip = headers['x-real-ip'] || headers['x-forwarded-for'] || req.connection.remoteAddress; | ||
return ip; | ||
} | ||
app.use(express.static(path.join(__dirname, 'static'))); | ||
app.use(expressStaticGzip(path.join(__dirname, 'static'))); | ||
app.use(bodyParser.urlencoded({ extended: false, limit: '100mb' })); | ||
app.use(bodyParser.json({ limit: '100mb' })); | ||
app.use('*', (req, res, next) => { | ||
@@ -31,8 +30,11 @@ req.body = JSON.stringify(req.body); | ||
}); | ||
app.use('/api', proxy(API_SERVER, { | ||
timeout: TIMEOUT, | ||
https: HTTPS, | ||
forwardPath: function(req, res) { | ||
return API_PATH + require('url').parse(req.url).path; | ||
} | ||
let apiServer = API_SERVER; | ||
if (apiServer.indexOf('http') < 0) { | ||
apiServer = `${HTTPS ? 'https' : 'http'}://${apiServer}`; | ||
} | ||
app.use('/api', proxy({ | ||
target: apiServer, | ||
timeout: TIMEOUT, | ||
changeOrigin: true, | ||
pathRewrite: { [`^/api`]: API_PATH }, | ||
})); | ||
@@ -45,3 +47,3 @@ app.get('*', function response(req, res) { | ||
let date = new Date(); | ||
var meta = '[' + date.toISOString() +']' + req.url + '\n'; | ||
var meta = '[' + date.toISOString() + ']' + req.url + '\n'; | ||
console.log(meta + err.stack + '\n'); | ||
@@ -51,4 +53,4 @@ next(); | ||
var server = app.listen(process.env.PORT||8000, '0.0.0.0', function () { | ||
console.log('app listening on port ', process.env.PORT||8000); | ||
var server = app.listen(process.env.PORT || 8000, '0.0.0.0', function () { | ||
console.log('app listening on port ', process.env.PORT || 8000); | ||
}); | ||
@@ -55,0 +57,0 @@ |
@@ -6,3 +6,3 @@ { | ||
"target": "es5", | ||
"jsx": "react", | ||
"jsx": "preserve", | ||
"moduleResolution": "node", | ||
@@ -9,0 +9,0 @@ "plugins": [{ "name": "tslint-language-service" }], |
const path = require('path'); | ||
const config = { | ||
outputPath: 'dist/static', | ||
gzip: true, | ||
plugins: [ | ||
['epig-plugin-html', { inject: true, template: path.resolve('./public/index.html') }], | ||
['epig-plugin-copy-server', { output: 'dist' }], | ||
], | ||
chainWebpack: (config, { webpack }) => { | ||
config.resolve.modules.add('styles'); | ||
config.optimization.splitChunks({ | ||
['epig-plugin-html', {}], | ||
['epig-plugin-copy-server', {}], | ||
['epig-plugin-split-chunks', { | ||
cacheGroups: { | ||
@@ -21,6 +18,6 @@ commons: { | ||
}, | ||
}); | ||
}, | ||
}] | ||
], | ||
}; | ||
module.exports = config; |
@@ -14,4 +14,5 @@ { | ||
"ejs": "^2.6.1", | ||
"express": "^4.16.4" | ||
"express": "^4.16.4", | ||
"express-static-gzip": "^1.1.3" | ||
} | ||
} | ||
} |
'use strict'; | ||
const express = require('express'); | ||
const express = require('express'); | ||
const expressStaticGzip = require('express-static-gzip'); | ||
const ejs = require('ejs'); | ||
@@ -12,3 +13,3 @@ const path = require('path'); | ||
app.use(express.static(path.join(__dirname, 'static'), { | ||
app.use(expressStaticGzip(path.join(__dirname, 'static'), { | ||
index: false, | ||
@@ -21,4 +22,4 @@ })); | ||
var server = app.listen(process.env.PORT||8000, '0.0.0.0', function () { | ||
console.log('app listening on port ', process.env.PORT||8000); | ||
var server = app.listen(process.env.PORT || 8000, '0.0.0.0', function () { | ||
console.log('app listening on port ', process.env.PORT || 8000); | ||
}); |
@@ -11,3 +11,3 @@ { | ||
], | ||
"jsx": "react", | ||
"jsx": "preserve", | ||
"allowSyntheticDefaultImports": true, | ||
@@ -14,0 +14,0 @@ "plugins": [{ "name": "tslint-language-service" }], |
const path = require('path'); | ||
const config = { | ||
outputPath: 'dist/static', | ||
gzip: true, | ||
plugins: [ | ||
['epig-plugin-html', { inject: true, template: path.resolve('./public/index.html') }], | ||
['epig-plugin-copy-server', { output: 'dist' }], | ||
], | ||
chainWebpack: (config, { webpack }) => { | ||
config.resolve.modules.add('styles'); | ||
config.optimization.splitChunks({ | ||
['epig-plugin-html', {}], | ||
['epig-plugin-copy-server', {}], | ||
['epig-plugin-split-chunks', { | ||
cacheGroups: { | ||
@@ -26,6 +23,6 @@ ['vendor']: { | ||
}, | ||
}); | ||
}, | ||
}] | ||
], | ||
}; | ||
module.exports = config; |
@@ -14,4 +14,5 @@ { | ||
"ejs": "^2.6.1", | ||
"express": "^4.16.4" | ||
"express": "^4.16.4", | ||
"express-static-gzip": "^1.1.3" | ||
} | ||
} | ||
} |
'use strict'; | ||
const express = require('express'); | ||
const express = require('express'); | ||
const expressStaticGzip = require('express-static-gzip'); | ||
const ejs = require('ejs'); | ||
@@ -12,3 +13,3 @@ const path = require('path'); | ||
app.use(express.static(path.join(__dirname, 'static'), { | ||
app.use(expressStaticGzip(path.join(__dirname, 'static'), { | ||
index: false, | ||
@@ -21,4 +22,4 @@ })); | ||
var server = app.listen(process.env.PORT||8000, '0.0.0.0', function () { | ||
console.log('app listening on port ', process.env.PORT||8000); | ||
var server = app.listen(process.env.PORT || 8000, '0.0.0.0', function () { | ||
console.log('app listening on port ', process.env.PORT || 8000); | ||
}); |
@@ -11,3 +11,3 @@ { | ||
], | ||
"jsx": "react", | ||
"jsx": "preserve", | ||
"allowSyntheticDefaultImports": true, | ||
@@ -14,0 +14,0 @@ "plugins": [{ "name": "tslint-language-service" }], |
const path = require('path'); | ||
const config = { | ||
outputPath: 'dist/static', | ||
plugins: [ | ||
['epig-plugin-hd'], | ||
['epig-plugin-html', { inject: true, template: path.resolve('./public/index.html') }], | ||
['epig-plugin-copy-server', { output: 'dist' }], | ||
], | ||
chainWebpack: (config, { webpack }) => { | ||
config.resolve.modules.add('styles'); | ||
config.optimization.splitChunks({ | ||
['epig-plugin-html', {}], | ||
['epig-plugin-hd', {}], | ||
['epig-plugin-split-chunks', { | ||
cacheGroups: { | ||
@@ -22,6 +17,6 @@ commons: { | ||
}, | ||
}); | ||
}, | ||
}] | ||
], | ||
}; | ||
module.exports = config; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
53854
69
1521
2