Merge branch 'release'

This commit is contained in:
Xu Chang 2024-11-27 19:25:02 +08:00
commit c448abf5be
7 changed files with 21 additions and 45 deletions

View File

@ -211,9 +211,9 @@ module.exports = function (webpackEnv) {
'configuration',
'compiler.js'
);
const projectConfiguration =
fs.existsSync(compilerConfigurationFile) &&
require(compilerConfigurationFile).webpack;
const projectConfiguration = fs.existsSync(compilerConfigurationFile) && require(compilerConfigurationFile).webpack;
const splitChunks = projectConfiguration && projectConfiguration.splitChunks;
const externals = projectConfiguration && projectConfiguration.externals;
const getOakInclude = () => {
const result = [/oak-frontend-base/, /oak-general-business/];
@ -340,12 +340,6 @@ module.exports = function (webpackEnv) {
splitChunks: {
chunks: 'async',
cacheGroups: {
'@wangeditor/basic-modules': {
name: 'wangeditor_basic_modules',
test: /@wangeditor\/basic-modules/,
priority: 30,
reuseExistingChunk: true,
},
icon_park: {
name: 'icon_park',
test: /@icon-park\/react/,
@ -376,6 +370,7 @@ module.exports = function (webpackEnv) {
priority: 10,
reuseExistingChunk: true,
},
...((splitChunks && splitChunks.cacheGroups) || {})
},
},
},
@ -1018,13 +1013,12 @@ module.exports = function (webpackEnv) {
performance: false,
// 在非开发模式下排除相关模块以使用CDN加载
externals: !isEnvDevelopment ? {
echarts: 'echarts',
lodash: '_',
react: 'React',
'react-dom': 'ReactDOM',
'@wangeditor/editor': 'wangEditor',
'@fingerprintjs/fingerprintjs': 'FingerprintJS',
'bn.js': 'BN',
...(externals || {})
} : {},
};
};

View File

@ -31,7 +31,7 @@ function enhanceErrorMessages(methodName, log) {
const currentNodeVersion = process.versions.node;
const semver = currentNodeVersion.split('.');
const major = semver[0];
const minNodeVersion = 14;
const minNodeVersion = 16;
if (Number(major) < minNodeVersion) {
console.error('You are running Node ' +
currentNodeVersion +

View File

@ -41,7 +41,7 @@ async function startup(path, connector, omitWatchers, omitTimers, routine) {
const httpServer = (0, http_1.createServer)(koa.callback());
const socketOption = {
path: connector.getSocketPath(),
cors: process.env.NODE_ENV === 'development'
cors: ['development', 'staging'].includes(process.env.NODE_ENV)
? {
origin: '*',
allowedHeaders: corsHeaders.concat(connector.getCorsHeader()),
@ -96,9 +96,9 @@ async function startup(path, connector, omitWatchers, omitTimers, routine) {
return;
}
});
koa.use((0, koa_body_1.default)({
koa.use((0, koa_body_1.default)(Object.assign({
multipart: true,
}));
}, serverConfiguration.koaBody)));
const router = new koa_router_1.default();
// 如果是开发环境允许options
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]) => {
router[method](url, async (ctx) => {
const { req, request, params } = ctx;
const { body, headers } = request;
const { body, headers, files } = request;
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;
return;
}

View File

@ -1,6 +1,6 @@
{
"name": "@xuchangzju/oak-cli",
"version": "4.0.14",
"version": "4.0.15",
"description": "client for oak framework",
"main": "lib/index.js",
"scripts": {
@ -99,9 +99,9 @@
"lodash": "^4.17.21",
"mini-css-extract-plugin": "^2.5.3",
"node-watch": "^0.7.4",
"oak-backend-base": "^4.1.9",
"oak-domain": "^5.1.9",
"oak-frontend-base": "^5.3.18",
"oak-backend-base": "^4.1.10",
"oak-domain": "^5.1.10",
"oak-frontend-base": "^5.3.19",
"parse-asn1": "5.1.6",
"postcss": "^8.4.4",
"postcss-flexbugs-fixes": "^5.0.2",

View File

@ -30,7 +30,7 @@ function enhanceErrorMessages(methodName: string, log: Function) {
const currentNodeVersion = process.versions.node;
const semver = currentNodeVersion.split('.');
const major = semver[0];
const minNodeVersion = 14;
const minNodeVersion = 16;
if (Number(major) < minNodeVersion) {
console.error(

View File

@ -59,8 +59,7 @@ export async function startup<ED extends EntityDict & BaseEntityDict, FrontCxt e
const httpServer = createServer(koa.callback());
const socketOption: Partial<ServerOptions> = {
path: connector.getSocketPath(),
cors:
process.env.NODE_ENV === 'development'
cors: ['development', 'staging'].includes(process.env.NODE_ENV!)
? {
origin: '*',
allowedHeaders: corsHeaders.concat(connector.getCorsHeader()),
@ -136,9 +135,9 @@ export async function startup<ED extends EntityDict & BaseEntityDict, FrontCxt e
}
});
koa.use(
KoaBody({
KoaBody(Object.assign({
multipart: true,
})
}, serverConfiguration.koaBody))
);
const router = new KoaRouter();
@ -269,9 +268,9 @@ export async function startup<ED extends EntityDict & BaseEntityDict, FrontCxt e
endpoints.forEach(([name, method, url, fn]) => {
router[method](url, async (ctx) => {
const { req, request, params } = ctx;
const { body, headers } = request;
const { body, headers, files } = request;
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;
return;
} catch (err) {

View File

@ -44,13 +44,6 @@
<script>
window.ReactDOM || document.write('<script src="//unpkg.com/react-dom@18.2.0/umd/react-dom.production.min.js"><\/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>
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>
window._ || document.write('<script src="//unpkg.com/lodash@4.17.21/lodash.js"><\/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>
window.FingerprintJS || document.write('<script src="//cdn.jsdelivr.net/npm/@fingerprintjs/fingerprintjs@3.3.6/dist/fp.min.js"><\/script>')