fix(plugin-cli): use relative path (#4698)

This commit is contained in:
Alex Yang 2023-10-23 12:14:40 -05:00 committed by GitHub
parent e75a0743f8
commit 493b815b7b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -15,8 +15,6 @@ import vue from '@vitejs/plugin-vue';
import { build, type PluginOption } from 'vite';
import type { z } from 'zod';
const projectRoot = fileURLToPath(new URL('../../..', import.meta.url));
const args = process.argv.splice(2);
const result = parseArgs({
@ -66,10 +64,8 @@ const external = [
/^@vanilla-extract/,
];
const allPluginDir = path.resolve(projectRoot, 'packages/plugins');
const pluginDir = process.cwd();
const getPluginDir = (plugin: string) => path.resolve(allPluginDir, plugin);
const pluginDir = getPluginDir(plugin);
const packageJsonFile = path.resolve(pluginDir, 'package.json');
const json: z.infer<typeof packageJsonInputSchema> = await readFile(
@ -96,6 +92,7 @@ const metadata: Metadata = {
assets: new Set(),
};
const projectRoot = fileURLToPath(new URL('../../..', import.meta.url));
const outDir = path.resolve(
projectRoot,
'packages/frontend/core/public/plugins'