chore: use constant instead of function

This commit is contained in:
jacoobes
2023-03-31 12:57:07 -05:00
parent 34bf4d004c
commit 68c096e689
3 changed files with 11 additions and 16 deletions

View File

@@ -1,7 +1,6 @@
import { cyanBright, green, magentaBright } from 'colorette';
export function help() {
return `
export const help = `
___ ___ _ __ _ __
/ __|/ _ \\ '__| '_ \\
\\__ \\ __/ | | | | |
@@ -15,4 +14,3 @@ export function help() {
${green(
`If you have any ideas, suggestions, bug reports, kindly join our support server: https://sern.dev/discord`
)}`;
}

View File

@@ -18,14 +18,14 @@ function dispatchInstall() {
}
export async function plugins(options: PluginOptions) {
console.log(options)
if(options.save) {
dispatchSave()
}
//Download instead based on names given. Must be a full filename ie: (publish.ts)
//Download instead based on names given. Must be a full filename ie: (publish)
if(options.name) {
const pluginSource = await downloa();
}
const e: string[] = (await prompt([await pluginsQ()])).list;
if (!e) process.exit(1);
@@ -41,16 +41,13 @@ export async function plugins(options: PluginOptions) {
);
}
async function downloa(url: string, path: string) {
const format = (res: Response) => res.text()
const data = await fetch(url, { method: 'GET' })
.then(format)
async function downloa(url: string | URL) {
const formatText = (res: Response) => res.text()
return fetch(url, { method: 'GET' })
.then(formatText)
.catch(() => {
throw Error('Download failed! Kindly contact developers')
})
const fullPath = fromCwd(path)
}
async function download(url: string) {
@@ -60,7 +57,7 @@ async function download(url: string) {
if (!data) throw new Error('Download failed! Kindly contact developers');
const dir = `${fromCwd('/src/plugins')}`;
const dir = fromCwd('/src/plugins');
const filedir = `${process.cwd()}/src/plugins/${url.split('/').pop()}`;
if (!fs.existsSync(dir)) {

View File

@@ -12,7 +12,7 @@ const version: string = '[VI]{{inject}}[/VI]';
program
.name('sern')
.description(help())
.description(help)
.version(`sern CLI v${version}`)
.exitOverride(() => process.exit(0));