From 44e5dd3845bc3280b6a01c61c5f64fa024dec333 Mon Sep 17 00:00:00 2001
From: Jacob Nguyen <76754747+jacoobes@users.noreply.github.com>
Date: Tue, 19 Mar 2024 12:41:41 -0500
Subject: [PATCH 1/4] the readme was kinda vague (#133)
---
README.md | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/README.md b/README.md
index b821a93..4cdfe3c 100644
--- a/README.md
+++ b/README.md
@@ -3,11 +3,11 @@
# Features
-
-😁 **User Friendly**
-💦 **Simple**
-🌱 **Efficient**
-💪 **Powerful**
+- Manage discord application commands from the command line.
+- Install plugins from the community.
+- Really fast startup times (I think).
+- Deploy with premade docker configurations.
+- Inhouse build tool based on esbuild built for sern applications, nearly **zero** config.
## Installation
From d94d5de520e7fc847ebcd01517b0a44c73d82ed3 Mon Sep 17 00:00:00 2001
From: Jacob Nguyen <76754747+jacoobes@users.noreply.github.com>
Date: Thu, 11 Apr 2024 10:14:52 -0500
Subject: [PATCH 2/4] user install works (#135)
user install work?
---
src/create-publish.mts | 14 ++++++++++++++
src/index.ts | 8 ++++++++
src/utilities/getConfig.ts | 19 +++++++++++++++++--
3 files changed, 39 insertions(+), 2 deletions(-)
diff --git a/src/create-publish.mts b/src/create-publish.mts
index fbb62e5..28e2cb8 100644
--- a/src/create-publish.mts
+++ b/src/create-publish.mts
@@ -144,6 +144,7 @@ const serialize = (permissions: unknown) => {
const makePublishData = ({ commandModule, config }: Record>) => {
const applicationType = intoApplicationType(commandModule.type as number);
+ console.log(config)
return {
data: {
name: commandModule.name as string,
@@ -153,6 +154,19 @@ const makePublishData = ({ commandModule, config }: Record {
+ if(s === "Guild") {
+ return 0
+ } else if (s == "User") {
+ return 1
+ } else {
+ throw Error("IntegrationType is not one of Guild or User");
+ }
+ }),
+ //@ts-ignore
+ contexts: config?.contexts ? config.contexts : undefined
},
config,
};
diff --git a/src/index.ts b/src/index.ts
index 0c58b01..a5d1781 100644
--- a/src/index.ts
+++ b/src/index.ts
@@ -53,6 +53,14 @@ program //
.option('-y, --yes', "Say yes to all prompts")
.option('-e, --env [path]', "Supply a path to a .env")
.action(async (...args) => importDynamic('command-clear.js').then((m) => m.commandClear(...args))));
+program
+ .command('app')
+ .description('manage your discord application')
+ .addCommand(
+ new Command('update')
+ .description("Refresh your discord application.")
+ .option('-W --suppress-warnings', 'suppress experimental warning')
+ .action(async (...args) => importDynamic('app-update.js').then(m => m.appUpdate(...args))))
program
.command('build')
diff --git a/src/utilities/getConfig.ts b/src/utilities/getConfig.ts
index ff44033..fee0886 100644
--- a/src/utilities/getConfig.ts
+++ b/src/utilities/getConfig.ts
@@ -11,7 +11,6 @@ export async function getConfig(): Promise {
return output;
}
-
export interface sernConfig {
language: 'typescript' | 'javascript';
defaultPrefix?: string;
@@ -20,5 +19,21 @@ export interface sernConfig {
commands: string;
events?: string;
};
- buildPath: string;
+ app?: {
+ customInstallUrl?: string;
+ description?: string;
+ roleConnectionsVerificationUrl?: string;
+ installParams?: {
+ type: 'install params object';
+ };
+ integrationTypesConfig?: {
+ type: 'dictionary with keys of application integration types';
+ description: 'In preview. Default scopes and permissions for each supported installation context. Value for each key is an integration type configuration object';
+ };
+ flags?: number;
+ icon?: '?image data';
+ coverImage?: '?image data';
+ interactionsEndpointUrl?: string;
+ tags: string[];
+ }
}
From c90003e41183dbca209f068681433eafe10b9070 Mon Sep 17 00:00:00 2001
From: Jacob Nguyen <76754747+jacoobes@users.noreply.github.com>
Date: Thu, 11 Apr 2024 18:27:34 -0500
Subject: [PATCH 3/4] remove deprecated application id option for publish
---
src/commands/publish.ts | 6 ------
src/create-publish.mts | 7 ++-----
src/index.ts | 1 -
3 files changed, 2 insertions(+), 12 deletions(-)
diff --git a/src/commands/publish.ts b/src/commands/publish.ts
index 3e5616f..c78a377 100644
--- a/src/commands/publish.ts
+++ b/src/commands/publish.ts
@@ -14,8 +14,6 @@ export async function publish(commandDir: string | undefined, args: Partial {
const makePublishData = ({ commandModule, config }: Record>) => {
const applicationType = intoApplicationType(commandModule.type as number);
- console.log(config)
return {
data: {
name: commandModule.name as string,
@@ -174,11 +173,9 @@ const makePublishData = ({ commandModule, config }: Record {
diff --git a/src/index.ts b/src/index.ts
index a5d1781..9bfcc7c 100644
--- a/src/index.ts
+++ b/src/index.ts
@@ -40,7 +40,6 @@ program //
.option('-W --suppress-warnings', 'suppress experimental warning')
.option('-i, --import [scriptPath...]', 'Prerequire a script to load into publisher')
.option('-t, --token [token]')
- .option('--appId [applicationId]')
.argument('[path]', 'path with respect to current working directory that will locate all published files')
.action(async (...args) => importDynamic('publish.js').then((m) => m.publish(...args)))
).addCommand(
From 5fbb15f385f9643cf0730f95b65a0f91f735e960 Mon Sep 17 00:00:00 2001
From: Jacob Nguyen <76754747+jacoobes@users.noreply.github.com>
Date: Thu, 11 Apr 2024 18:29:49 -0500
Subject: [PATCH 4/4] remove plugin
---
src/commands/build.ts | 5 +++--
src/plugins/imageLoader.ts | 39 --------------------------------------
2 files changed, 3 insertions(+), 41 deletions(-)
delete mode 100644 src/plugins/imageLoader.ts
diff --git a/src/commands/build.ts b/src/commands/build.ts
index b7e3534..951f7a5 100644
--- a/src/commands/build.ts
+++ b/src/commands/build.ts
@@ -4,13 +4,14 @@ import { resolve } from 'node:path';
import { glob } from 'glob';
import { configDotenv } from 'dotenv';
import assert from 'node:assert';
-import { imageLoader, validExtensions } from '../plugins/imageLoader';
import defaultEsbuild from '../utilities/defaultEsbuildConfig';
import { require } from '../utilities/require';
import { pathExists, pathExistsSync } from 'find-up';
import { mkdir, writeFile } from 'fs/promises';
import * as Preprocessor from '../utilities/preprocessor';
import { bold, magentaBright } from 'colorette';
+const validExtensions = ['.ts', '.js', '.json', '.png', '.jpg', '.jpeg', '.webp'];
+
type BuildOptions = {
/**
@@ -156,7 +157,7 @@ export async function build(options: Record) {
//https://esbuild.github.io/content-types/#tsconfig-json
await esbuild.build({
entryPoints,
- plugins: [imageLoader, ...(buildConfig.esbuildPlugins ?? [])],
+ plugins: [...(buildConfig.esbuildPlugins ?? [])],
...defaultEsbuild(buildConfig.format!, buildConfig.tsconfig),
define,
dropLabels: [buildConfig.mode === 'production' ? '__DEV__' : '__PROD__', ...buildConfig.dropLabels!],
diff --git a/src/plugins/imageLoader.ts b/src/plugins/imageLoader.ts
deleted file mode 100644
index ec553d1..0000000
--- a/src/plugins/imageLoader.ts
+++ /dev/null
@@ -1,39 +0,0 @@
-import fs from 'fs/promises';
-import path from 'node:path';
-import { require } from '../utilities/require.js';
-import { type Plugin } from 'esbuild';
-import { basename } from 'node:path';
-
-export const validExtensions = ['.ts', '.js', '.json', '.png', '.jpg', '.jpeg', '.webp'];
-
-//https://github.com/evanw/esbuild/issues/1051
-export const imageLoader = {
- name: 'attachment-loader',
- setup: (b) => {
- const filter = new RegExp(`\.${validExtensions.slice(3).join('|')}$`);
- b.onResolve({ filter }, (args) => {
- //if the module is being imported, resolve the path and transform to the js stub
- if (args.importer) {
- const newPath = path
- .format({ ...path.parse(args.path), base: '', ext: '.js' })
- .split(path.sep)
- .join(path.posix.sep);
- return { path: newPath, namespace: 'attachment-loader', external: true };
- }
- // if the file is actually the attachment, resolve the full dir
- return { path: require.resolve(args.path, { paths: [args.resolveDir] }), namespace: 'attachment-loader' };
- });
-
- b.onLoad({ filter: /.*/, namespace: 'attachment-loader' }, async (args) => {
- const base64 = await fs.readFile(args.path).then((s) => s.toString('base64'));
- return {
- contents: `
- var __toBuffer = (base64) => Buffer.from(base64, "base64");
- module.exports = {
- name: '${basename(args.path)}',
- attachment: __toBuffer("${base64}")
- }`,
- };
- });
- },
-} satisfies Plugin;