Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: install plugins to custom directory #138

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions src/commands/plugins.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import esbuild from 'esbuild';
import { getLang } from '../utilities/getLang.js';
import { resolve } from 'path';
import { require } from '../utilities/require.js';
import { getConfig } from '../utilities/getConfig.js';
interface PluginData {
description: string;
hash: string;
Expand All @@ -26,10 +27,11 @@ export async function plugins() {
if (!e) process.exit(1);

const lang = await getLang();
const config = await getConfig();
for await (const plgData of e) {
const pluginText = await download(plgData.link);
const dir = fromCwd('/src/plugins');
const linkNoExtension = `${process.cwd()}/src/plugins/${plgData.name}`;
const dir = fromCwd(`src/${config.paths.plugins ?? 'plugins'}`);
const linkNoExtension = `${dir}/${plgData.name}`;
if (!fs.existsSync(dir)) {
fs.mkdirSync(dir, { recursive: true });
}
Expand Down
1 change: 1 addition & 0 deletions src/utilities/getConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ export interface sernConfig {
base: string;
commands: string;
events?: string;
plugins?: string;
};
app?: {
customInstallUrl?: string;
Expand Down
Loading