Skip to content

Commit

Permalink
feat: install plugins to custom directory
Browse files Browse the repository at this point in the history
  • Loading branch information
Peter-MJ-Parker committed Jul 9, 2024
1 parent d581142 commit 34dc229
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
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

0 comments on commit 34dc229

Please sign in to comment.