Merge branch 'dev' of https://gitea.51mars.com/Oak-Team/oak-cli into dev
This commit is contained in:
commit
8c82b16e79
|
|
@ -211,9 +211,9 @@ module.exports = function (webpackEnv) {
|
||||||
'configuration',
|
'configuration',
|
||||||
'compiler.js'
|
'compiler.js'
|
||||||
);
|
);
|
||||||
const projectConfiguration =
|
const projectConfiguration = fs.existsSync(compilerConfigurationFile) && require(compilerConfigurationFile).webpack;
|
||||||
fs.existsSync(compilerConfigurationFile) &&
|
const splitChunks = projectConfiguration && projectConfiguration.splitChunks;
|
||||||
require(compilerConfigurationFile).webpack;
|
const externals = projectConfiguration && projectConfiguration.externals;
|
||||||
|
|
||||||
const getOakInclude = () => {
|
const getOakInclude = () => {
|
||||||
const result = [/oak-frontend-base/, /oak-general-business/];
|
const result = [/oak-frontend-base/, /oak-general-business/];
|
||||||
|
|
@ -340,12 +340,6 @@ module.exports = function (webpackEnv) {
|
||||||
splitChunks: {
|
splitChunks: {
|
||||||
chunks: 'async',
|
chunks: 'async',
|
||||||
cacheGroups: {
|
cacheGroups: {
|
||||||
'@wangeditor/basic-modules': {
|
|
||||||
name: 'wangeditor_basic_modules',
|
|
||||||
test: /@wangeditor\/basic-modules/,
|
|
||||||
priority: 30,
|
|
||||||
reuseExistingChunk: true,
|
|
||||||
},
|
|
||||||
icon_park: {
|
icon_park: {
|
||||||
name: 'icon_park',
|
name: 'icon_park',
|
||||||
test: /@icon-park\/react/,
|
test: /@icon-park\/react/,
|
||||||
|
|
@ -376,6 +370,7 @@ module.exports = function (webpackEnv) {
|
||||||
priority: 10,
|
priority: 10,
|
||||||
reuseExistingChunk: true,
|
reuseExistingChunk: true,
|
||||||
},
|
},
|
||||||
|
...((splitChunks && splitChunks.cacheGroups) || {})
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
@ -1018,13 +1013,12 @@ module.exports = function (webpackEnv) {
|
||||||
performance: false,
|
performance: false,
|
||||||
// 在非开发模式下,排除相关模块,以使用CDN加载
|
// 在非开发模式下,排除相关模块,以使用CDN加载
|
||||||
externals: !isEnvDevelopment ? {
|
externals: !isEnvDevelopment ? {
|
||||||
echarts: 'echarts',
|
|
||||||
lodash: '_',
|
lodash: '_',
|
||||||
react: 'React',
|
react: 'React',
|
||||||
'react-dom': 'ReactDOM',
|
'react-dom': 'ReactDOM',
|
||||||
'@wangeditor/editor': 'wangEditor',
|
|
||||||
'@fingerprintjs/fingerprintjs': 'FingerprintJS',
|
'@fingerprintjs/fingerprintjs': 'FingerprintJS',
|
||||||
'bn.js': 'BN',
|
'bn.js': 'BN',
|
||||||
|
...(externals || {})
|
||||||
} : {},
|
} : {},
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -31,7 +31,7 @@ function enhanceErrorMessages(methodName, log) {
|
||||||
const currentNodeVersion = process.versions.node;
|
const currentNodeVersion = process.versions.node;
|
||||||
const semver = currentNodeVersion.split('.');
|
const semver = currentNodeVersion.split('.');
|
||||||
const major = semver[0];
|
const major = semver[0];
|
||||||
const minNodeVersion = 14;
|
const minNodeVersion = 16;
|
||||||
if (Number(major) < minNodeVersion) {
|
if (Number(major) < minNodeVersion) {
|
||||||
console.error('You are running Node ' +
|
console.error('You are running Node ' +
|
||||||
currentNodeVersion +
|
currentNodeVersion +
|
||||||
|
|
|
||||||
|
|
@ -41,7 +41,7 @@ async function startup(path, connector, omitWatchers, omitTimers, routine) {
|
||||||
const httpServer = (0, http_1.createServer)(koa.callback());
|
const httpServer = (0, http_1.createServer)(koa.callback());
|
||||||
const socketOption = {
|
const socketOption = {
|
||||||
path: connector.getSocketPath(),
|
path: connector.getSocketPath(),
|
||||||
cors: process.env.NODE_ENV === 'development'
|
cors: ['development', 'staging'].includes(process.env.NODE_ENV)
|
||||||
? {
|
? {
|
||||||
origin: '*',
|
origin: '*',
|
||||||
allowedHeaders: corsHeaders.concat(connector.getCorsHeader()),
|
allowedHeaders: corsHeaders.concat(connector.getCorsHeader()),
|
||||||
|
|
@ -96,9 +96,9 @@ async function startup(path, connector, omitWatchers, omitTimers, routine) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
koa.use((0, koa_body_1.default)({
|
koa.use((0, koa_body_1.default)(Object.assign({
|
||||||
multipart: true,
|
multipart: true,
|
||||||
}));
|
}, serverConfiguration.koaBody)));
|
||||||
const router = new koa_router_1.default();
|
const router = new koa_router_1.default();
|
||||||
// 如果是开发环境,允许options
|
// 如果是开发环境,允许options
|
||||||
if (['development', 'staging'].includes(process.env.NODE_ENV)) {
|
if (['development', 'staging'].includes(process.env.NODE_ENV)) {
|
||||||
|
|
@ -201,9 +201,9 @@ async function startup(path, connector, omitWatchers, omitTimers, routine) {
|
||||||
endpoints.forEach(([name, method, url, fn]) => {
|
endpoints.forEach(([name, method, url, fn]) => {
|
||||||
router[method](url, async (ctx) => {
|
router[method](url, async (ctx) => {
|
||||||
const { req, request, params } = ctx;
|
const { req, request, params } = ctx;
|
||||||
const { body, headers } = request;
|
const { body, headers, files } = request;
|
||||||
try {
|
try {
|
||||||
const result = await fn(params, headers, req, body);
|
const result = await fn(params, headers, req, files ? Object.assign({}, body, files) : body);
|
||||||
ctx.response.body = result;
|
ctx.response.body = result;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "@xuchangzju/oak-cli",
|
"name": "@xuchangzju/oak-cli",
|
||||||
"version": "4.0.14",
|
"version": "4.0.16",
|
||||||
"description": "client for oak framework",
|
"description": "client for oak framework",
|
||||||
"main": "lib/index.js",
|
"main": "lib/index.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
|
|
||||||
|
|
@ -30,7 +30,7 @@ function enhanceErrorMessages(methodName: string, log: Function) {
|
||||||
const currentNodeVersion = process.versions.node;
|
const currentNodeVersion = process.versions.node;
|
||||||
const semver = currentNodeVersion.split('.');
|
const semver = currentNodeVersion.split('.');
|
||||||
const major = semver[0];
|
const major = semver[0];
|
||||||
const minNodeVersion = 14;
|
const minNodeVersion = 16;
|
||||||
|
|
||||||
if (Number(major) < minNodeVersion) {
|
if (Number(major) < minNodeVersion) {
|
||||||
console.error(
|
console.error(
|
||||||
|
|
|
||||||
|
|
@ -59,8 +59,7 @@ export async function startup<ED extends EntityDict & BaseEntityDict, FrontCxt e
|
||||||
const httpServer = createServer(koa.callback());
|
const httpServer = createServer(koa.callback());
|
||||||
const socketOption: Partial<ServerOptions> = {
|
const socketOption: Partial<ServerOptions> = {
|
||||||
path: connector.getSocketPath(),
|
path: connector.getSocketPath(),
|
||||||
cors:
|
cors: ['development', 'staging'].includes(process.env.NODE_ENV!)
|
||||||
process.env.NODE_ENV === 'development'
|
|
||||||
? {
|
? {
|
||||||
origin: '*',
|
origin: '*',
|
||||||
allowedHeaders: corsHeaders.concat(connector.getCorsHeader()),
|
allowedHeaders: corsHeaders.concat(connector.getCorsHeader()),
|
||||||
|
|
@ -136,9 +135,9 @@ export async function startup<ED extends EntityDict & BaseEntityDict, FrontCxt e
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
koa.use(
|
koa.use(
|
||||||
KoaBody({
|
KoaBody(Object.assign({
|
||||||
multipart: true,
|
multipart: true,
|
||||||
})
|
}, serverConfiguration.koaBody))
|
||||||
);
|
);
|
||||||
const router = new KoaRouter();
|
const router = new KoaRouter();
|
||||||
|
|
||||||
|
|
@ -269,9 +268,9 @@ export async function startup<ED extends EntityDict & BaseEntityDict, FrontCxt e
|
||||||
endpoints.forEach(([name, method, url, fn]) => {
|
endpoints.forEach(([name, method, url, fn]) => {
|
||||||
router[method](url, async (ctx) => {
|
router[method](url, async (ctx) => {
|
||||||
const { req, request, params } = ctx;
|
const { req, request, params } = ctx;
|
||||||
const { body, headers } = request;
|
const { body, headers, files } = request;
|
||||||
try {
|
try {
|
||||||
const result = await fn(params, headers, req, body);
|
const result = await fn(params, headers, req, files ? Object.assign({}, body, files) : body);
|
||||||
ctx.response.body = result;
|
ctx.response.body = result;
|
||||||
return;
|
return;
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
|
|
|
||||||
|
|
@ -44,13 +44,6 @@
|
||||||
<script>
|
<script>
|
||||||
window.ReactDOM || document.write('<script src="//unpkg.com/react-dom@18.2.0/umd/react-dom.production.min.js"><\/script>')
|
window.ReactDOM || document.write('<script src="//unpkg.com/react-dom@18.2.0/umd/react-dom.production.min.js"><\/script>')
|
||||||
</script>
|
</script>
|
||||||
<script src="//cdn.staticfile.net/echarts/5.4.3/echarts.min.js"></script>
|
|
||||||
<script>
|
|
||||||
window.echarts || document.write('<script src="//lf26-cdn-tos.bytecdntp.com/cdn/expire-1-M/echarts/5.3.0/echarts.min.js"><\/script>')
|
|
||||||
</script>
|
|
||||||
<script>
|
|
||||||
window.echarts || document.write('<script src="//unpkg.com/echarts@5.4.0/dist/echarts.min.js"><\/script>')
|
|
||||||
</script>
|
|
||||||
<script src="//cdn.staticfile.net/lodash.js/4.17.21/lodash.min.js"></script>
|
<script src="//cdn.staticfile.net/lodash.js/4.17.21/lodash.min.js"></script>
|
||||||
<script>
|
<script>
|
||||||
window._ || document.write('<script src="//lf3-cdn-tos.bytecdntp.com/cdn/expire-1-M/lodash.js/4.17.21/lodash.min.js"><\/script>')
|
window._ || document.write('<script src="//lf3-cdn-tos.bytecdntp.com/cdn/expire-1-M/lodash.js/4.17.21/lodash.min.js"><\/script>')
|
||||||
|
|
@ -61,16 +54,6 @@
|
||||||
<script>
|
<script>
|
||||||
window._ || document.write('<script src="//unpkg.com/lodash@4.17.21/lodash.js"><\/script>')
|
window._ || document.write('<script src="//unpkg.com/lodash@4.17.21/lodash.js"><\/script>')
|
||||||
</script>
|
</script>
|
||||||
<!-- <link href="//unpkg.com/@wangeditor/editor@5.1.22/dist/css/style.css" rel="stylesheet">
|
|
||||||
<script src="//unpkg.com/@wangeditor/editor@5.1.22/dist/index.js"></script> -->
|
|
||||||
<link href="//cdn.staticfile.net/wangeditor5/5.1.22/css/style.min.css" rel="stylesheet" />
|
|
||||||
<script src="//cdn.staticfile.net/wangeditor5/5.1.22/index.js"></script>
|
|
||||||
<script>
|
|
||||||
window.wangEditor || document.write('<script src="//cdn.bootcdn.net/ajax/libs/wangeditor5/5.1.22/index.min.js"><\/script>')
|
|
||||||
</script>
|
|
||||||
<script>
|
|
||||||
window.wangEditor || document.write('<script src="//unpkg.com/@wangeditor/editor@5.1.22/dist/index.js"><\/script>')
|
|
||||||
</script>
|
|
||||||
<script src="//unpkg.com/@fingerprintjs/fingerprintjs@3.3.6/dist/fp.min.js"></script>
|
<script src="//unpkg.com/@fingerprintjs/fingerprintjs@3.3.6/dist/fp.min.js"></script>
|
||||||
<script>
|
<script>
|
||||||
window.FingerprintJS || document.write('<script src="//cdn.jsdelivr.net/npm/@fingerprintjs/fingerprintjs@3.3.6/dist/fp.min.js"><\/script>')
|
window.FingerprintJS || document.write('<script src="//cdn.jsdelivr.net/npm/@fingerprintjs/fingerprintjs@3.3.6/dist/fp.min.js"><\/script>')
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue