mirror of
https://github.com/sern-handler/cli
synced 2026-06-06 09:26:52 +00:00
Compare commits
6 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
667d0c1b89 | ||
|
|
5dbf2a87dc | ||
| a309c085e9 | |||
| f1d7d6c911 | |||
|
|
4ec96dbe17 | ||
|
|
3970cc6911 |
28
.github/workflows/continuous-integration.yml
vendored
28
.github/workflows/continuous-integration.yml
vendored
@@ -11,25 +11,25 @@ on:
|
||||
- main
|
||||
|
||||
jobs:
|
||||
Lint:
|
||||
name: Linting
|
||||
runs-on: ubuntu-latest
|
||||
# Lint:
|
||||
# name: Linting
|
||||
# runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Check out Git repository
|
||||
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3
|
||||
# steps:
|
||||
# - name: Check out Git repository
|
||||
# uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3
|
||||
|
||||
- name: Set up Node.js
|
||||
uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c # v3
|
||||
with:
|
||||
node-version: 17
|
||||
# - name: Set up Node.js
|
||||
# uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c # v3
|
||||
# with:
|
||||
# node-version: 17
|
||||
|
||||
# Prettier must be in `package.json`
|
||||
- name: Install Node.js dependencies
|
||||
run: npm i
|
||||
# - name: Install Node.js dependencies
|
||||
# run: npm i
|
||||
|
||||
- name: Run Prettier
|
||||
run: npm run format
|
||||
# - name: Run Prettier
|
||||
# run: npm run format
|
||||
|
||||
Test:
|
||||
name: Testing
|
||||
|
||||
@@ -2,6 +2,14 @@
|
||||
|
||||
All notable changes to this project will be documented in this file.
|
||||
|
||||
## [1.0.2](https://github.com/sern-handler/cli/compare/v1.0.1...v1.0.2) (2023-11-04)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* better error handling ([5dbf2a8](https://github.com/sern-handler/cli/commit/5dbf2a87dcb0001993fe126d9002bc82c8108e24))
|
||||
* build mkdir errors ([#122](https://github.com/sern-handler/cli/issues/122)) ([f1d7d6c](https://github.com/sern-handler/cli/commit/f1d7d6c911bc54ed3ca3e39eefbc7de6ee33b10d))
|
||||
|
||||
## [1.0.1](https://github.com/sern-handler/cli/compare/v1.0.0...v1.0.1) (2023-10-05)
|
||||
|
||||
|
||||
|
||||
4
package-lock.json
generated
4
package-lock.json
generated
@@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "@sern/cli",
|
||||
"version": "1.0.1",
|
||||
"version": "1.0.2",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "@sern/cli",
|
||||
"version": "1.0.1",
|
||||
"version": "1.0.2",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@esbuild-kit/cjs-loader": "^2.4.2",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@sern/cli",
|
||||
"version": "1.0.1",
|
||||
"version": "1.0.2",
|
||||
"description": "Official CLI for @sern/handler",
|
||||
"exports": "./dist/index.js",
|
||||
"bin": {
|
||||
|
||||
@@ -138,7 +138,7 @@ export async function build(options: Record<string, any>) {
|
||||
|
||||
if (!(await pathExists(genDir))) {
|
||||
console.log('Making .sern/generated dir, does not exist');
|
||||
await mkdir(genDir);
|
||||
await mkdir(genDir, { recursive: true });
|
||||
}
|
||||
|
||||
try {
|
||||
|
||||
@@ -186,6 +186,7 @@ const res = await rest.updateGlobal(globalCommands);
|
||||
|
||||
let globalCommandsResponse: unknown;
|
||||
|
||||
|
||||
if (res.ok) {
|
||||
globalCommands.length && spin.succeed(`All ${cyanBright('Global')} commands published`);
|
||||
globalCommandsResponse = await res.json();
|
||||
@@ -193,21 +194,23 @@ if (res.ok) {
|
||||
spin.fail(`Failed to publish global commands [Code: ${redBright(res.status)}]`);
|
||||
switch(res.status) {
|
||||
case 400 :
|
||||
throw Error("400: Ensure your commands have proper fields and data with left nothing out");
|
||||
throw Error("400: Ensure your commands have proper fields and data with nothing left out");
|
||||
case 404 :
|
||||
throw Error("Forbidden 404. Is you application id and/or token correct?")
|
||||
case 429:
|
||||
throw Error('Chill out homie, too many requests')
|
||||
}
|
||||
console.error(
|
||||
'errors:',
|
||||
await res.json().then((res) => {
|
||||
const errors = Object.values(res.errors);
|
||||
// @ts-ignore
|
||||
return errors.map((err) => err?.name?._errors);
|
||||
})
|
||||
console.error('errors:',
|
||||
await res
|
||||
.json()
|
||||
.then((res) => {
|
||||
const errors = Object.values(res?.errors ?? {});
|
||||
// @ts-ignore
|
||||
return errors.map((err) => err?.name?._errors);
|
||||
})
|
||||
.catch(() => "No errors found (Unparsable json for a request with bad status code). Read the status code.")
|
||||
);
|
||||
console.error(res.statusText);
|
||||
console.error("Status Text ", res.statusText);
|
||||
}
|
||||
|
||||
function associateGuildIdsWithData(data: PublishableModule[]): Map<string, PublishableData[]> {
|
||||
@@ -247,7 +250,7 @@ for (const [guildId, array] of guildCommandMap.entries()) {
|
||||
spin.fail(`[${redBright(guildId)}] Failed to update commands for guild, Reason: ${result.message}`);
|
||||
switch(response.status) {
|
||||
case 400 :
|
||||
throw Error("400: Ensure your commands have proper fields and data and left nothing out");
|
||||
throw Error("400: Ensure your commands have proper fields and data and nothing left out");
|
||||
case 404 :
|
||||
throw Error("Forbidden 404. Is you application id and/or token correct?")
|
||||
case 429:
|
||||
|
||||
@@ -56,7 +56,7 @@ program
|
||||
.option('-f --format [fmt]', 'The module system of your application. `cjs` or `esm`', 'esm')
|
||||
.option('-m --mode [mode]', 'the mode for sern to build in. `production` or `development`', 'development')
|
||||
.option('-W --suppress-warnings', 'suppress experimental warning')
|
||||
.option('-p --project [filePath]', 'build with this sern.build file')
|
||||
.option('-p --project [filePath]', 'build with the provided sern.build file')
|
||||
.option('-e --env', 'path to .env file')
|
||||
.option('--tsconfig [filePath]', 'Use this tsconfig')
|
||||
.action(async (...args) => importDynamic('build.js').then((m) => m.build(...args)));
|
||||
|
||||
Reference in New Issue
Block a user