From e481c2b59bb6d8312c7ac4463c5fa09978751172 Mon Sep 17 00:00:00 2001 From: chenos Date: Sun, 18 Dec 2022 23:27:03 +0800 Subject: [PATCH] fix: process.env.PRESET_NOCOBASE_PLUGINS --- Dockerfile.acr | 2 +- packages/presets/nocobase/src/index.ts | 42 ++++++++++++++------------ 2 files changed, 23 insertions(+), 21 deletions(-) diff --git a/Dockerfile.acr b/Dockerfile.acr index 8e07f56fc..de5c834f4 100644 --- a/Dockerfile.acr +++ b/Dockerfile.acr @@ -34,7 +34,7 @@ RUN cd /app \ && yarn create nocobase-app my-nocobase-app -a \ -e APP_ENV=production \ -e PLUGIN_PACKAGE_PREFIX=@nocobase/plugin-,@nocobase/preset-,@nocobase/plugin-pro- \ - -e PRESET_NOCOBASE_PLUGINS=error-handler,collection-manager,ui-schema-storage,ui-routes-storage,file-manager,system-settings,verification,users,acl,china-region,workflow,client,export,import,sequence-field,audit-logs,graph-collection-manager \ + -e PRESET_NOCOBASE_PLUGINS=graph-collection-manager \ && cd /app/my-nocobase-app \ && yarn install --production \ && yarn add @nocobase/plugin-pro-graph-collection-manager -W diff --git a/packages/presets/nocobase/src/index.ts b/packages/presets/nocobase/src/index.ts index 3f52dec1e..302eaa1e2 100644 --- a/packages/presets/nocobase/src/index.ts +++ b/packages/presets/nocobase/src/index.ts @@ -1,28 +1,30 @@ import { Plugin } from '@nocobase/server'; +import _ from 'lodash'; import path from 'path'; export class PresetNocoBase extends Plugin { getBuiltInPlugins() { - return process.env.PRESET_NOCOBASE_PLUGINS - ? process.env.PRESET_NOCOBASE_PLUGINS.split(',') - : [ - 'error-handler', - 'collection-manager', - 'ui-schema-storage', - 'ui-routes-storage', - 'file-manager', - 'system-settings', - 'sequence-field', - 'verification', - 'users', - 'acl', - 'china-region', - 'workflow', - 'client', - 'export', - 'import', - 'audit-logs', - ]; + const plugins = (process.env.PRESET_NOCOBASE_PLUGINS || '').split(',').filter(Boolean); + return _.uniq( + [ + 'error-handler', + 'collection-manager', + 'ui-schema-storage', + 'ui-routes-storage', + 'file-manager', + 'system-settings', + 'sequence-field', + 'verification', + 'users', + 'acl', + 'china-region', + 'workflow', + 'client', + 'export', + 'import', + 'audit-logs', + ].concat(plugins), + ); } getLocalPlugins() {