mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-12 12:28:42 +00:00
fix(cli): create empty plugin directory
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import { ok } from 'node:assert';
|
||||
import { open, readFile } from 'node:fs/promises';
|
||||
import { existsSync } from 'node:fs';
|
||||
import { mkdir, open, readFile } from 'node:fs/promises';
|
||||
import path from 'node:path';
|
||||
import { parseArgs } from 'node:util';
|
||||
|
||||
@@ -95,14 +96,9 @@ const metadata: Metadata = {
|
||||
assets: new Set(),
|
||||
};
|
||||
|
||||
const coreOutDir = path.resolve(
|
||||
projectRoot,
|
||||
'apps',
|
||||
'core',
|
||||
'public',
|
||||
'plugins',
|
||||
plugin
|
||||
);
|
||||
const outDir = path.resolve(projectRoot, 'apps', 'core', 'public', 'plugins');
|
||||
|
||||
const coreOutDir = path.resolve(outDir, plugin);
|
||||
|
||||
const serverOutDir = path.resolve(
|
||||
projectRoot,
|
||||
@@ -113,7 +109,7 @@ const serverOutDir = path.resolve(
|
||||
plugin
|
||||
);
|
||||
|
||||
const pluginListJsonPath = path.resolve(coreOutDir, '..', 'plugin-list.json');
|
||||
const pluginListJsonPath = path.resolve(outDir, 'plugin-list.json');
|
||||
|
||||
const coreEntry = path.resolve(pluginDir, json.affinePlugin.entry.core);
|
||||
if (json.affinePlugin.entry.server) {
|
||||
@@ -168,7 +164,10 @@ await build({
|
||||
{
|
||||
name: 'generate-list-json',
|
||||
async generateBundle() {
|
||||
const file = await open(pluginListJsonPath, 'as+');
|
||||
if (!existsSync(outDir)) {
|
||||
await mkdir(outDir, { recursive: true });
|
||||
}
|
||||
const file = await open(pluginListJsonPath, 'w+', 0o777);
|
||||
const txt = await file.readFile({
|
||||
encoding: 'utf-8',
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user