From fc5e974f9b1cf85724f51f50582d054c45c737ae Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Wed, 24 Apr 2024 23:05:00 -0500 Subject: [PATCH 1/4] chore(deps): update actions/setup-node digest to 1a4442c (#124) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- .github/workflows/auto-deprecate.yml | 2 +- .github/workflows/continuous-delivery.yml | 2 +- .github/workflows/continuous-integration.yml | 2 +- .github/workflows/publish.yml | 2 +- .github/workflows/release-please.yml | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/auto-deprecate.yml b/.github/workflows/auto-deprecate.yml index 184b927..c34f71c 100644 --- a/.github/workflows/auto-deprecate.yml +++ b/.github/workflows/auto-deprecate.yml @@ -15,7 +15,7 @@ jobs: uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3 - name: Use Node.js - uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c # v3 + uses: actions/setup-node@1a4442cacd436585916779262731d5b162bc6ec7 # v3 with: node-version: 17 registry-url: 'https://registry.npmjs.org/' diff --git a/.github/workflows/continuous-delivery.yml b/.github/workflows/continuous-delivery.yml index 336ede0..a49371c 100644 --- a/.github/workflows/continuous-delivery.yml +++ b/.github/workflows/continuous-delivery.yml @@ -18,7 +18,7 @@ jobs: uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3 - name: Set up Node.js - uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c # v3 + uses: actions/setup-node@1a4442cacd436585916779262731d5b162bc6ec7 # v3 with: node-version: 17 registry-url: 'https://registry.npmjs.org' diff --git a/.github/workflows/continuous-integration.yml b/.github/workflows/continuous-integration.yml index 0b2fdff..ecb366e 100644 --- a/.github/workflows/continuous-integration.yml +++ b/.github/workflows/continuous-integration.yml @@ -40,7 +40,7 @@ jobs: uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3 - name: Set up Node.js - uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c # v3 + uses: actions/setup-node@1a4442cacd436585916779262731d5b162bc6ec7 # v3 with: node-version: 17 diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 66d7a9b..76611e8 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -17,7 +17,7 @@ jobs: uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3 - name: Set up Node.js - uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c # v3 + uses: actions/setup-node@1a4442cacd436585916779262731d5b162bc6ec7 # v3 with: node-version: 17 registry-url: 'https://registry.npmjs.org' diff --git a/.github/workflows/release-please.yml b/.github/workflows/release-please.yml index b791ba8..cc00b41 100644 --- a/.github/workflows/release-please.yml +++ b/.github/workflows/release-please.yml @@ -14,7 +14,7 @@ jobs: bump-patch-for-minor-pre-major: true - uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3 if: ${{ steps.release.outputs.release_created }} - - uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c # v3 + - uses: actions/setup-node@1a4442cacd436585916779262731d5b162bc6ec7 # v3 with: node-version: 17 registry-url: 'https://registry.npmjs.org' From 41046ebd37f800136ef5ff0595b3d5cd302d429e Mon Sep 17 00:00:00 2001 From: Jacob Nguyen <76754747+jacoobes@users.noreply.github.com> Date: Sun, 26 May 2024 14:03:32 -0500 Subject: [PATCH 2/4] fix config fn unresolved name --- src/create-publish.mts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/create-publish.mts b/src/create-publish.mts index 3593791..c699658 100644 --- a/src/create-publish.mts +++ b/src/create-publish.mts @@ -79,9 +79,7 @@ for await (const absPath of filePaths) { commandModule = commandModule.default; } - if (typeof config === 'function') { - config = config(absPath, commandModule); - } + try { commandModule = commandModule.getInstance(); @@ -96,6 +94,9 @@ for await (const absPath of filePaths) { commandModule.absPath = absPath; modules.push({ commandModule, config }); } + if (typeof config === 'function') { + config = config(absPath, commandModule); + } } const cacheDir = resolve('./.sern'); From fe2e8ff0c0d2afac76024885b508dbbb1f05588e Mon Sep 17 00:00:00 2001 From: Jacob Nguyen <76754747+jacoobes@users.noreply.github.com> Date: Mon, 27 May 2024 11:34:28 -0500 Subject: [PATCH 3/4] fix config fn defai;lt --- src/create-publish.mts | 17 +++++------------ src/rest.ts | 10 +++++----- 2 files changed, 10 insertions(+), 17 deletions(-) diff --git a/src/create-publish.mts b/src/create-publish.mts index c699658..e145914 100644 --- a/src/create-publish.mts +++ b/src/create-publish.mts @@ -79,12 +79,6 @@ for await (const absPath of filePaths) { commandModule = commandModule.default; } - - - try { - commandModule = commandModule.getInstance(); - } catch {} - if ((PUBLISHABLE & commandModule.type) != 0) { // assign defaults const filename = basename(absPath); @@ -92,11 +86,11 @@ for await (const absPath of filePaths) { commandModule.name ??= filenameNoExtension; commandModule.description ??= ''; commandModule.absPath = absPath; + if (typeof config === 'function') { + config = config(absPath, commandModule); + } modules.push({ commandModule, config }); } - if (typeof config === 'function') { - config = config(absPath, commandModule); - } } const cacheDir = resolve('./.sern'); @@ -158,9 +152,9 @@ const makePublishData = ({ commandModule, config }: Record { if(s === "Guild") { - return 0 + return "0" } else if (s == "User") { - return 1 + return "1" } else { throw Error("IntegrationType is not one of Guild or User"); } @@ -287,7 +281,6 @@ const remoteData = { global: globalCommandsResponse, ...Object.fromEntries(guildCommandMapResponse), }; - await writeFile(resolve(cacheDir, 'command-data-remote.json'), JSON.stringify(remoteData, null, 4), 'utf8'); // TODO: add this in a verbose flag diff --git a/src/rest.ts b/src/rest.ts index c7106ff..efddc66 100644 --- a/src/rest.ts +++ b/src/rest.ts @@ -4,12 +4,12 @@ const baseURL = new URL('https://discord.com/api/v10/applications/'); const excludedKeys = new Set(['command', 'absPath']); -const publishablesIntoJson = (ps: PublishableModule[]) => - JSON.stringify( +const publishablesIntoJson = (ps: PublishableModule[]) => { + const s = JSON.stringify( ps.map((module) => module.data), - (key, value) => (excludedKeys.has(key) ? undefined : value), - 4 - ); + (key, value) => (excludedKeys.has(key) ? undefined : value), 4); + return s; +} export const create = async (token: string) => { const headers = { From d581142f082ed888036e58aa33e9d88d84d34c2f Mon Sep 17 00:00:00 2001 From: Duro <47304910+DuroCodes@users.noreply.github.com> Date: Mon, 3 Jun 2024 12:34:58 -0400 Subject: [PATCH 4/4] fix: fix publish command for bun & pnpm (#137) Co-authored-by: Jacob Nguyen <76754747+jacoobes@users.noreply.github.com> --- src/commands/publish.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/commands/publish.ts b/src/commands/publish.ts index c78a377..5d624c8 100644 --- a/src/commands/publish.ts +++ b/src/commands/publish.ts @@ -16,8 +16,10 @@ export async function publish(commandDir: string | undefined, args: Partial