mirror of
https://github.com/sern-handler/cli
synced 2026-06-06 01:16:53 +00:00
Merge branch 'main' into experimental-serverless-build
This commit is contained in:
2
.github/workflows/auto-deprecate.yml
vendored
2
.github/workflows/auto-deprecate.yml
vendored
@@ -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/'
|
||||
|
||||
2
.github/workflows/continuous-delivery.yml
vendored
2
.github/workflows/continuous-delivery.yml
vendored
@@ -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'
|
||||
|
||||
2
.github/workflows/continuous-integration.yml
vendored
2
.github/workflows/continuous-integration.yml
vendored
@@ -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
|
||||
|
||||
|
||||
2
.github/workflows/publish.yml
vendored
2
.github/workflows/publish.yml
vendored
@@ -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'
|
||||
|
||||
2
.github/workflows/release-please.yml
vendored
2
.github/workflows/release-please.yml
vendored
@@ -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'
|
||||
|
||||
@@ -16,8 +16,10 @@ export async function publish(commandDir: string | undefined, args: Partial<Publ
|
||||
|
||||
commandDir && console.info('Publishing with override path: ', commandDir);
|
||||
|
||||
const dotenvLocation = new URL('../node_modules/dotenv/config.js', rootPath),
|
||||
esmLoader = new URL('../node_modules/@esbuild-kit/esm-loader/dist/index.js', rootPath);
|
||||
const isBunOrPnpm = rootPath.pathname.includes('.bun') || rootPath.pathname.includes('.pnpm');
|
||||
|
||||
const dotenvLocation = new URL(`${isBunOrPnpm ? '../../' : '../'}node_modules/dotenv/config.js`, rootPath),
|
||||
esmLoader = new URL(`${isBunOrPnpm ? '../../' : '../'}node_modules/@esbuild-kit/esm-loader/dist/index.js`, rootPath);
|
||||
|
||||
// We dynamically load the create-publish script in a child process so that we can pass the special
|
||||
// loader flag to require typescript files
|
||||
|
||||
@@ -52,10 +52,6 @@ for await (const absPath of filePaths) {
|
||||
commandModule = commandModule.default;
|
||||
}
|
||||
|
||||
if (typeof config === 'function') {
|
||||
config = config(absPath, commandModule);
|
||||
}
|
||||
|
||||
if ((PUBLISHABLE & commandModule.type) != 0) {
|
||||
// assign defaults
|
||||
const filename = basename(absPath);
|
||||
@@ -65,7 +61,10 @@ for await (const absPath of filePaths) {
|
||||
commandModule.meta = {
|
||||
absPath
|
||||
}
|
||||
|
||||
commandModule.absPath = absPath;
|
||||
if (typeof config === 'function') {
|
||||
config = config(absPath, commandModule);
|
||||
}
|
||||
modules.push({ commandModule, config });
|
||||
}
|
||||
}
|
||||
@@ -129,9 +128,9 @@ const makePublishData = ({ commandModule, config }: Record<string, Record<string
|
||||
integration_types: (config?.integrationTypes ?? ['Guild']).map(
|
||||
(s: string) => {
|
||||
if(s === "Guild") {
|
||||
return 0
|
||||
return "0"
|
||||
} else if (s == "User") {
|
||||
return 1
|
||||
return "1"
|
||||
} else {
|
||||
throw Error("IntegrationType is not one of Guild (0) or User (1)");
|
||||
}
|
||||
@@ -259,7 +258,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
|
||||
|
||||
10
src/rest.ts
10
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 = {
|
||||
|
||||
Reference in New Issue
Block a user