Commit 6a7aa227 authored by chenos's avatar chenos
Browse files

feat: improve code

parent 019d182a
main 0.7 0.7.6 Dunqing-feat-select-m2o-next acl-field acl-module api-fields app-manager audit-logs auditlogs block-schema changed-with-associations chore/error-message dev doc/api-database doc/db-repository doc/dev-res-action doc/new-user-manual doc/plugin-workflow doc/relation-repository example/custom-signup-page example/util examples excel-function feat-add-block-title-feature feat-add-default-sort feat-association-field-block feat-association-field-features feat-default-value feat-fix-time-and-collection-pagination feat-fk-input feat-form-validator feat-kanban-add-description feat-m2o-sub-form-mode feat-record-block-initializers-fields-pick feat-relation-field-uischema feat/associate-operate feat/batch-operation feat/cache feat/changed-with-associations feat/collection-inherits feat/collection-templates feat/create-nocobase-app feat/database feat/dev-ci feat/field-unique feat/form-save-tip feat/get-json-schema-with-async-node feat/grap-collection feat/inherit-collection feat/logger feat/plugin-export feat/plugin-file-manager feat/plugin-import feat/plugin-import-2 feat/plugin-manager feat/plugin-manager-0823 feat/plugin-user-groups feat/plugin-users-with-jwt feat/plugin-verification feat/plugin-workflow feat/plugin-workflow-collection-field feat/pm feat/pnpm-support feat/reference-check feat/remove-assoc-fields-after-table-destroy feat/request-logs feat/resize-grid-columns feat/safer-update feat/submodule-graph-collection feat/tree-table-block feat/workflow-request feature/add-slate-component feature/custom_operation feature/insert-field-schema-after fix-acl fix-acl-role fix-acl-target-action-error fix-drag-area fix-formula-bug fix-link-to-default-value fix-multi-app-manager fix-multiple-apps fix-template-menu fix-template-with-fields-only fix-timezone fix/association-deleted fix/attachment-upload fix/block-select-collection-menu fix/bulk-update-db-locked fix/collection-manager fix/collection-manager-0719 fix/collection-manager-del-foreign-key fix/create-inherits fix/custom-assign-value fix/database-find-with-appends fix/database-view-error fix/destroy-fields-by-array fix/docker-ci fix/empty-response fix/export-date fix/export-percent fix/form-item-label-style fix/form-sys-fields-default-edit-mode fix/kanban-image-thumbnail fix/kanban-text-overflow fix/menu-schema fix/menu-url-style fix/merge-include fix/plugin-cm fix/plugin-workflow fix/table-data fix/table-field-overflow is-current-user migrator nocobase-build nocobase-next perf/cache-schema perf/token pre-release refactor/client refactor/database refactor/plugin-workflow refactor/plugin-workflow-ui relationships rollback table-demo tree tree-demo v0.8.0-alpha.13 v0.8.0-alpha.11 v0.8.0-alpha.9 v0.8.0-alpha.8 v0.8.0-alpha.7 v0.8.0-alpha.6 v0.8.0-alpha.5 v0.8.0-alpha.3 v0.8.0-alpha.2 v0.8.0-alpha.1 v0.7.7-alpha.1 v0.7.6-alpha.2 v0.7.5-alpha.1.1666403334 v0.7.5-alpha.1 v0.7.4-alpha.7 v0.7.4-alpha.4 v0.7.4-alpha.1 v0.7.3-alpha.1 v0.7.2-alpha.2 v0.7.2-alpha.1 v0.7.1-alpha.5 v0.7.1-alpha.4 v0.7.0-alpha.82 v0.7.0-alpha.67 v0.7.0-alpha.64 v0.7.0-alpha.60 v0.7.0-alpha.59 v0.7.0-alpha.58 v0.7.0-alpha.57 v0.7.0-alpha.34 v0.7.0-alpha.33 v0.7.0-alpha.30 v0.7.0-alpha.29 v0.7.0-alpha.28 v0.7.0-alpha.24 v0.7.0-alpha.16 v0.7.0-alpha.15 v0.7.0-alpha.6 v0.7.0-alpha.5 v0.7.0-alpha.4 v0.7.0-alpha.3 v0.7.0-alpha.2 v0.7.0-alpha.1 v0.7.0-alpha.0 v0.6.2-alpha.12 v0.6.2-alpha.11 v0.6.2-alpha.10 v0.6.2-alpha.9 v0.6.2-alpha.7 v0.6.2-alpha.6 v0.6.2-alpha.5 v0.6.2-alpha.4 v0.6.2-alpha.3 v0.6.2-alpha.1 v0.6.2-alpha.0 v0.6.1-alpha.0 v0.6.0 v0.6.0-alpha.1
No related merge requests found
Showing with 27 additions and 3 deletions
+27 -3
......@@ -41,7 +41,6 @@ const plugins = [
'@nocobase/plugin-collection-manager',
'@nocobase/plugin-ui-schema-storage',
'@nocobase/plugin-ui-routes-storage',
'@nocobase/plugin-client',
'@nocobase/plugin-file-manager',
'@nocobase/plugin-system-settings',
'@nocobase/plugin-users',
......@@ -53,6 +52,10 @@ for (const plugin of plugins) {
api.plugin(require(plugin).default);
}
api.plugin(require('@nocobase/plugin-client').default, {
dist: resolve(__dirname, '../../app/dist'),
});
if (process.argv.length < 3) {
// @ts-ignore
process.argv.push('start', '--port', process.env.API_PORT || 12302);
......
......@@ -13,6 +13,7 @@ const umiConfig = getUmiConfig();
export default defineConfig({
define: {
'process.env.NOCOBASE_ENV': process.env.NOCOBASE_ENV,
...umiConfig.define,
},
// only proxy when using `umi dev`
......
......@@ -35,6 +35,8 @@ import { I18nextProvider } from 'react-i18next';
import { Link, NavLink } from 'react-router-dom';
import apiClient from './apiClient';
console.log = (...args) => null;
apiClient.axios.interceptors.response.use(
(response) => response,
(error) => {
......
import debug from 'debug';
import './global.less';
debug.log = console.log.bind(console);
export * from './acl';
export * from './antd-config-provider';
......
import { skip } from '@nocobase/acl';
import { Plugin } from '@nocobase/server';
import send from 'koa-send';
import serve from 'koa-static';
import { resolve } from 'path';
export class ClientPlugin extends Plugin {
async beforeLoad() {
......@@ -36,6 +39,23 @@ export class ClientPlugin extends Plugin {
},
},
});
let root = this.options.dist;
if (root && !root.startsWith('/')) {
root = resolve(process.cwd(), root);
}
this.app.middleware.unshift(async (ctx, next) => {
if (process.env.NOCOBASE_ENV === 'production') {
return next();
}
if (!root) {
return next();
}
await serve(root)(ctx, next);
// console.log('koa-send', root, ctx.status);
if (ctx.status == 404) {
return send(ctx, 'index.html', { root });
}
});
}
}
......
Supports Markdown
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