diff --git a/packages/core/app/client/.umirc.ts b/packages/core/app/client/.umirc.ts index e3c887a459..1eceaf186f 100644 --- a/packages/core/app/client/.umirc.ts +++ b/packages/core/app/client/.umirc.ts @@ -37,6 +37,7 @@ export default defineConfig({ `, }, ], + cacheDirectoryPath: process.env.APP_CLIENT_CACHE_DIR || `node_modules/.cache`, outputPath: path.resolve(__dirname, '../dist/client'), hash: true, alias: { diff --git a/packages/core/cli/src/commands/dev.js b/packages/core/cli/src/commands/dev.js index 8a805adb60..5eebb59003 100644 --- a/packages/core/cli/src/commands/dev.js +++ b/packages/core/cli/src/commands/dev.js @@ -38,16 +38,16 @@ module.exports = (cli) => { depth: 1, // 只监听第一层目录 }); + await fs.promises.mkdir(path.dirname(process.env.WATCH_FILE), { recursive: true }); + watcher .on('addDir', async (pathname) => { generatePlugins(); - const file = path.resolve(process.cwd(), 'storage/app.watch.ts'); - await fs.promises.writeFile(file, `export const watchId = '${uid()}';`, 'utf-8'); + await fs.promises.writeFile(process.env.WATCH_FILE, `export const watchId = '${uid()}';`, 'utf-8'); }) .on('unlinkDir', async (pathname) => { generatePlugins(); - const file = path.resolve(process.cwd(), 'storage/app.watch.ts'); - await fs.promises.writeFile(file, `export const watchId = '${uid()}';`, 'utf-8'); + await fs.promises.writeFile(process.env.WATCH_FILE, `export const watchId = '${uid()}';`, 'utf-8'); }); promptForTs(); diff --git a/packages/core/cli/src/util.js b/packages/core/cli/src/util.js index 4d58ecb894..bbf2f73d56 100644 --- a/packages/core/cli/src/util.js +++ b/packages/core/cli/src/util.js @@ -350,6 +350,7 @@ exports.initEnv = function initEnv() { LOGGER_BASE_PATH: 'storage/logs', APP_SERVER_BASE_URL: '', APP_PUBLIC_PATH: '/', + WATCH_FILE: resolve(process.cwd(), 'storage/app.watch.ts'), }; if ( diff --git a/packages/core/client/src/locale/zh-CN.json b/packages/core/client/src/locale/zh-CN.json index 812e3cc6d2..1c7f1c6641 100644 --- a/packages/core/client/src/locale/zh-CN.json +++ b/packages/core/client/src/locale/zh-CN.json @@ -1023,5 +1023,6 @@ "When the Label exceeds the width": "字段标题超出宽度时", "Line break": "换行", "Ellipsis": "省略", - "Set block layout": "设置区块布局" + "Set block layout": "设置区块布局", + "Add & Update": "添加 & 更新" } diff --git a/packages/core/client/src/pm/PluginForm/modal/PluginAddModal.tsx b/packages/core/client/src/pm/PluginForm/modal/PluginAddModal.tsx index c78190b725..7e2a7c1f05 100644 --- a/packages/core/client/src/pm/PluginForm/modal/PluginAddModal.tsx +++ b/packages/core/client/src/pm/PluginForm/modal/PluginAddModal.tsx @@ -27,7 +27,7 @@ export const PluginAddModal: FC = ({ onClose, isShow }) => { const [type, setType] = useState<'npm' | 'upload' | 'url'>('npm'); return ( - onClose()} footer={null} destroyOnClose title={t('Add & update')} width={580} open={isShow}> + onClose()} footer={null} destroyOnClose title={t('Add & Update')} width={580} open={isShow}> {/* */}
setType(e.target.value)}> diff --git a/packages/core/server/src/gateway/index.ts b/packages/core/server/src/gateway/index.ts index 7f65e72ded..2f0f323565 100644 --- a/packages/core/server/src/gateway/index.ts +++ b/packages/core/server/src/gateway/index.ts @@ -311,7 +311,7 @@ export class Gateway extends EventEmitter { if (!process.env.IS_DEV_CMD) { return; } - const file = resolve(process.cwd(), 'storage/app.watch.ts'); + const file = process.env.WATCH_FILE; if (!fs.existsSync(file)) { await fs.promises.writeFile(file, `export const watchId = '${uid()}';`, 'utf-8'); } diff --git a/packages/core/server/src/helper.ts b/packages/core/server/src/helper.ts index bb528af0fd..32067f0faa 100644 --- a/packages/core/server/src/helper.ts +++ b/packages/core/server/src/helper.ts @@ -16,7 +16,6 @@ import { randomUUID } from 'crypto'; import fs from 'fs'; import i18next from 'i18next'; import bodyParser from 'koa-bodyparser'; -import { resolve } from 'path'; import { createHistogram, RecordableHistogram } from 'perf_hooks'; import Application, { ApplicationOptions } from './application'; import { dataWrapping } from './middlewares/data-wrapping'; @@ -124,8 +123,7 @@ export const getCommandFullName = (command: Command) => { /* istanbul ignore next -- @preserve */ export const tsxRerunning = async () => { - const file = resolve(process.cwd(), 'storage/app.watch.ts'); - await fs.promises.writeFile(file, `export const watchId = '${uid()}';`, 'utf-8'); + await fs.promises.writeFile(process.env.WATCH_FILE, `export const watchId = '${uid()}';`, 'utf-8'); }; /* istanbul ignore next -- @preserve */ diff --git a/packages/core/server/src/plugin-manager/findPackageNames.ts b/packages/core/server/src/plugin-manager/findPackageNames.ts index bed5a95e91..573d53dd8e 100644 --- a/packages/core/server/src/plugin-manager/findPackageNames.ts +++ b/packages/core/server/src/plugin-manager/findPackageNames.ts @@ -32,6 +32,19 @@ async function trim(packageNames: string[]) { return names; } +const excludes = [ + '@nocobase/plugin-audit-logs', + '@nocobase/plugin-backup-restore', + '@nocobase/plugin-charts', + '@nocobase/plugin-disable-pm-add', + '@nocobase/plugin-mobile-client', + '@nocobase/plugin-mock-collections', + '@nocobase/plugin-multi-app-share-collection', + '@nocobase/plugin-notifications', + '@nocobase/plugin-snapshot-field', + '@nocobase/plugin-workflow-test', +]; + export async function findPackageNames() { const patterns = [ './packages/plugins/*/package.json', @@ -52,23 +65,11 @@ export async function findPackageNames() { return packageJson.name; }), ); - const excludes = [ - '@nocobase/plugin-audit-logs', - '@nocobase/plugin-backup-restore', - '@nocobase/plugin-charts', - '@nocobase/plugin-disable-pm-add', - '@nocobase/plugin-mobile-client', - '@nocobase/plugin-mock-collections', - '@nocobase/plugin-multi-app-share-collection', - '@nocobase/plugin-notifications', - '@nocobase/plugin-snapshot-field', - '@nocobase/plugin-workflow-test', - ]; const nocobasePlugins = await findNocobasePlugins(); const { APPEND_PRESET_BUILT_IN_PLUGINS = '', APPEND_PRESET_LOCAL_PLUGINS = '' } = process.env; return trim( - _.difference(packageNames, excludes) - .filter(Boolean) + packageNames + .filter((pkg) => pkg && !excludes.includes(pkg)) .concat(nocobasePlugins) .concat(splitNames(APPEND_PRESET_BUILT_IN_PLUGINS)) .concat(splitNames(APPEND_PRESET_LOCAL_PLUGINS)), @@ -89,7 +90,7 @@ async function findNocobasePlugins() { try { const packageJson = await getPackageJson(); const pluginNames = Object.keys(packageJson.dependencies).filter((name) => name.startsWith('@nocobase/plugin-')); - return trim(pluginNames); + return trim(pluginNames.filter((pkg) => pkg && !excludes.includes(pkg))); } catch (error) { return []; } diff --git a/storage/.gitignore b/storage/.gitignore index 62d0d471f9..17d5242569 100644 --- a/storage/.gitignore +++ b/storage/.gitignore @@ -7,3 +7,4 @@ app-upgrading /verdaccio/storage libs scripts +.cache \ No newline at end of file