Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: support bun #150

Merged
merged 10 commits into from
Jan 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,6 @@ setup.sh
*.bak
*.traineddata
/credentials_api
/.env*
/.env*
/bun.lockb
*.tsbuildinfo
49 changes: 49 additions & 0 deletions docs/app/(docs)/whats-new-in-v8/page.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
---
title: "What's new in v8.0? - SudoBot"
short_name: "What's new in v8.0?"
---

import sudobot8 from '@/images/sudobot-v8.png';

# Introducing SudoBot v8.0!

<ImageWithSkeleton
src={sudobot8.src}
alt="SudoBot 8 Branding"
width={sudobot8.width}
height={sudobot8.height}
blurDataURL={sudobot8.blurDataURL}
style={{ width: '100%' }}
placeholder="blur"
/>

Wishing a happy new year to everyone out there! We've released version 8.0 of SudoBot, as always, packed with a bunch of new features, fixes and improvements! If you have any questions or suggestions, feel free to let us know!

## Changes

### Features

* Now Fully Supporting [Bun](https://bun.sh)! During performance tests, SudoBot's performance was 25% better when using Bun instead of Node.js
* Authentication and Loading Environment Variables using a Credential Server
* URL Filtering by Crawling **[Experimental]**
* Embed Text Filter
* Image Text Filtering

### Improvements and Refactorings

* Refactored all the decorators to support TypeScript 5 Decorators as well as the old experimental decorators, to support bun
* Refactored the HTTP Server class

### Fixes

* Minor performance fixes

## Updating

To update your instance, simply download the [latest release](https://github.com/onesoft-sudo/sudobot/releases/latest), or run the `-update` command.
You can also use [Git](https://git-scm.com) to update your instance, by running this command:

```bash
git pull origin main
```
However, this will update your instance to the latest **unstable** version.
30 changes: 30 additions & 0 deletions docs/components/MDX/ImageWithSkeleton.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
"use client";

import { ComponentProps, FC, useState } from "react";
import Image from "next/image";
import styles from "@/styles/ImageWithSkeleton.module.css";

type ImageWithSkeletonProps = ComponentProps<typeof Image>;

const ImageWithSkeleton: FC<ImageWithSkeletonProps> = ({ ...imageProps }) => {
const [isLoaded, setIsLoaded] = useState(false);
const { onLoad, ...finalImageProps } = imageProps;

return (
<div className="relative">
<Image
onLoad={() => {
setIsLoaded(true);
}}
{...finalImageProps}
/>
{!isLoaded && (
<div
className={`absolute top-0 left-0 h-[100%] w-[100%] ${styles.skeleton}`}
></div>
)}
</div>
);
};

export default ImageWithSkeleton;
Binary file added docs/images/sudobot-v8.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
11 changes: 11 additions & 0 deletions docs/mdx-components.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,18 @@
import { Skeleton } from "@mui/material";
import type { MDXComponents } from "mdx/types";
import Image from "next/image";
import { ComponentProps } from "react";
import ImageWithSkeleton from "./components/MDX/ImageWithSkeleton";

export function useMDXComponents(components: MDXComponents): MDXComponents {
return {
...components,
Image: (props: ComponentProps<typeof Image>) => <Image {...props} />,
ImageWithSkeleton: (
props: ComponentProps<typeof ImageWithSkeleton>,
) => <ImageWithSkeleton {...props} />,
Skeleton: (props: ComponentProps<typeof Skeleton>) => (
<Skeleton {...props} />
),
};
}
15 changes: 15 additions & 0 deletions docs/styles/ImageWithSkeleton.module.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
.skeleton {
animation: skeleton 2.5s linear infinite;
border-radius: 5px;
}

@keyframes skeleton {
100%,
0% {
background: #000;
}

50% {
background: #333;
}
}
11 changes: 7 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
"email": "[email protected]"
},
"dependencies": {
"@prisma/client": "^5.7.1",
"@prisma/client": "^5.8.1",
"@types/uuid": "^9.0.2",
"ascii-table3": "^0.8.2",
"async-mutex": "^0.4.0",
Expand All @@ -47,6 +47,7 @@
"dotenv": "^16.3.1",
"express": "^4.18.2",
"express-rate-limit": "^6.9.0",
"figlet": "^1.7.0",
"googleapis": "^126.0.1",
"json5": "^2.2.3",
"jsonwebtoken": "^9.0.1",
Expand All @@ -65,24 +66,26 @@
"@commitlint/cli": "^17.6.6",
"@commitlint/config-conventional": "^17.6.6",
"@types/bcrypt": "^5.0.0",
"@types/bun": "^1.0.4",
"@types/cors": "^2.8.13",
"@types/dot-object": "^2.1.2",
"@types/express": "^4.17.17",
"@types/figlet": "^1.5.8",
"@types/jsonwebtoken": "^9.0.2",
"@types/module-alias": "^2.0.2",
"@types/node": "^20.4.0",
"@types/semver": "^7.5.4",
"husky": "^8.0.3",
"prisma": "^5.7.1",
"prisma": "^5.8.1",
"ts-node": "^10.9.1",
"typescript": "^5.2.2",
"zod-to-json-schema": "^3.21.4"
},
"scripts": {
"start": "node build/index.js",
"start:bun": "bun build/bun.js",
"prepare": "husky install",
"dev": "ts-node src/index.ts",
"dev:watch": "nodemon src/index.ts",
"dev": "bun run src/bun.ts",
"lint": "eslint src/ --ext .ts",
"lint:fix": "eslint src/ --ext .ts --fix",
"build": "tsc",
Expand Down
4 changes: 3 additions & 1 deletion scripts/deploy-commands.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,9 @@ function makeContextMenuCommandBuilder(command) {
intents: []
});

await client.loadCommands();
await client.boot({
events: false
});

for (const [name, command] of client.commands) {
if (name.includes("__") || client.commands.get(name)?.name !== name) continue;
Expand Down
Loading
Loading