mirror of
https://github.com/danny-avila/LibreChat.git
synced 2025-09-22 06:00:56 +02:00
feat: bun support 🥟 (#907)
* feat: bun 🥟
* check if playwright/linux workflow is fixed
* fix: backend issues exposed by bun
* feat: update scripts for bun
This commit is contained in:
parent
a9215ed9ce
commit
75be9a3279
11 changed files with 33 additions and 13 deletions
8
.github/workflows/playwright.yml
vendored
8
.github/workflows/playwright.yml
vendored
|
@ -43,11 +43,11 @@ jobs:
|
||||||
- name: Install global dependencies
|
- name: Install global dependencies
|
||||||
run: npm ci
|
run: npm ci
|
||||||
|
|
||||||
- name: Remove sharp dependency
|
# - name: Remove sharp dependency
|
||||||
run: rm -rf node_modules/sharp
|
# run: rm -rf node_modules/sharp
|
||||||
|
|
||||||
- name: Install sharp with linux dependencies
|
# - name: Install sharp with linux dependencies
|
||||||
run: cd api && SHARP_IGNORE_GLOBAL_LIBVIPS=1 npm install --arch=x64 --platform=linux --libc=glibc sharp
|
# run: cd api && SHARP_IGNORE_GLOBAL_LIBVIPS=1 npm install --arch=x64 --platform=linux --libc=glibc sharp
|
||||||
|
|
||||||
- name: Build Client
|
- name: Build Client
|
||||||
run: npm run frontend
|
run: npm run frontend
|
||||||
|
|
|
@ -63,7 +63,7 @@
|
||||||
"passport-local": "^1.0.0",
|
"passport-local": "^1.0.0",
|
||||||
"pino": "^8.12.1",
|
"pino": "^8.12.1",
|
||||||
"sanitize": "^2.1.2",
|
"sanitize": "^2.1.2",
|
||||||
"sharp": "^0.32.1",
|
"sharp": "^0.32.5",
|
||||||
"zod": "^3.22.2"
|
"zod": "^3.22.2"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
|
|
@ -9,7 +9,7 @@ const errorController = require('./controllers/ErrorController');
|
||||||
const passport = require('passport');
|
const passport = require('passport');
|
||||||
const configureSocialLogins = require('./socialLogins');
|
const configureSocialLogins = require('./socialLogins');
|
||||||
|
|
||||||
const port = process.env.PORT || 3080;
|
const port = Number(process.env.PORT) || 3080;
|
||||||
const host = process.env.HOST || 'localhost';
|
const host = process.env.HOST || 'localhost';
|
||||||
const projectPath = path.join(__dirname, '..', '..', 'client');
|
const projectPath = path.join(__dirname, '..', '..', 'client');
|
||||||
const { jwtLogin, passportLogin } = require('../strategies');
|
const { jwtLogin, passportLogin } = require('../strategies');
|
||||||
|
|
|
@ -7,6 +7,10 @@ const loginLimiter = rateLimit({
|
||||||
windowMs,
|
windowMs,
|
||||||
max,
|
max,
|
||||||
message: `Too many login attempts from this IP, please try again after ${windowInMinutes} minutes.`,
|
message: `Too many login attempts from this IP, please try again after ${windowInMinutes} minutes.`,
|
||||||
|
keyGenerator: function (req) {
|
||||||
|
// Strip out the port number from the IP address
|
||||||
|
return req.ip.replace(/:\d+[^:]*$/, '');
|
||||||
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
module.exports = loginLimiter;
|
module.exports = loginLimiter;
|
||||||
|
|
|
@ -7,6 +7,10 @@ const registerLimiter = rateLimit({
|
||||||
windowMs,
|
windowMs,
|
||||||
max,
|
max,
|
||||||
message: `Too many accounts created from this IP, please try again after ${windowInMinutes} minutes`,
|
message: `Too many accounts created from this IP, please try again after ${windowInMinutes} minutes`,
|
||||||
|
keyGenerator: function (req) {
|
||||||
|
// Strip out the port number from the IP address
|
||||||
|
return req.ip.replace(/:\d+[^:]*$/, '');
|
||||||
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
module.exports = registerLimiter;
|
module.exports = registerLimiter;
|
||||||
|
|
|
@ -50,9 +50,10 @@ async function passportLogin(req, email, password, done) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function logError(title, parameters) {
|
function logError(title, parameters) {
|
||||||
|
const entries = Object.entries(parameters).map(([name, value]) => ({ name, value }));
|
||||||
DebugControl.log.functionName(title);
|
DebugControl.log.functionName(title);
|
||||||
if (parameters) {
|
if (entries) {
|
||||||
DebugControl.log.parameters(parameters);
|
DebugControl.log.parameters(entries);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
BIN
bun.lockb
Executable file
BIN
bun.lockb
Executable file
Binary file not shown.
|
@ -9,7 +9,9 @@
|
||||||
"dev": "cross-env NODE_ENV=development dotenv -e ../.env -- vite",
|
"dev": "cross-env NODE_ENV=development dotenv -e ../.env -- vite",
|
||||||
"preview-prod": "cross-env NODE_ENV=development dotenv -e ../.env -- vite preview",
|
"preview-prod": "cross-env NODE_ENV=development dotenv -e ../.env -- vite preview",
|
||||||
"test": "cross-env NODE_ENV=test jest --watch",
|
"test": "cross-env NODE_ENV=test jest --watch",
|
||||||
"test:ci": "cross-env NODE_ENV=test jest --ci"
|
"test:ci": "cross-env NODE_ENV=test jest --ci",
|
||||||
|
"b:build": "NODE_ENV=production bunx --bun vite build",
|
||||||
|
"b:dev": "NODE_ENV=development bunx --bun vite"
|
||||||
},
|
},
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
|
|
4
package-lock.json
generated
4
package-lock.json
generated
|
@ -90,7 +90,7 @@
|
||||||
"passport-local": "^1.0.0",
|
"passport-local": "^1.0.0",
|
||||||
"pino": "^8.12.1",
|
"pino": "^8.12.1",
|
||||||
"sanitize": "^2.1.2",
|
"sanitize": "^2.1.2",
|
||||||
"sharp": "^0.32.1",
|
"sharp": "^0.32.5",
|
||||||
"zod": "^3.22.2"
|
"zod": "^3.22.2"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
@ -26774,7 +26774,7 @@
|
||||||
},
|
},
|
||||||
"packages/data-provider": {
|
"packages/data-provider": {
|
||||||
"name": "librechat-data-provider",
|
"name": "librechat-data-provider",
|
||||||
"version": "0.1.6",
|
"version": "0.1.7",
|
||||||
"license": "ISC",
|
"license": "ISC",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@tanstack/react-query": "^4.28.0",
|
"@tanstack/react-query": "^4.28.0",
|
||||||
|
|
|
@ -41,7 +41,14 @@
|
||||||
"prepare": "node config/prepare.js",
|
"prepare": "node config/prepare.js",
|
||||||
"lint:fix": "eslint --fix \"{,!(node_modules)/**/}*.{js,jsx,ts,tsx}\"",
|
"lint:fix": "eslint --fix \"{,!(node_modules)/**/}*.{js,jsx,ts,tsx}\"",
|
||||||
"lint": "eslint \"{,!(node_modules)/**/}*.{js,jsx,ts,tsx}\"",
|
"lint": "eslint \"{,!(node_modules)/**/}*.{js,jsx,ts,tsx}\"",
|
||||||
"format": "prettier-eslint --write \"{,!(node_modules)/**/}*.{js,jsx,ts,tsx}\""
|
"format": "prettier-eslint --write \"{,!(node_modules)/**/}*.{js,jsx,ts,tsx}\"",
|
||||||
|
"b:api": "NODE_ENV=production bun run api/server/index.js",
|
||||||
|
"b:api:dev": "NODE_ENV=development bun run --watch api/server/index.js",
|
||||||
|
"b:data-provider": "cd packages/data-provider && bun run b:build",
|
||||||
|
"b:client": "bun run b:data-provider && cd client && bun run b:build",
|
||||||
|
"b:client:dev": "cd client && bun run b:dev",
|
||||||
|
"b:test:client": "cd client && bun run test",
|
||||||
|
"b:test:api": "cd api && bun run test"
|
||||||
},
|
},
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
|
|
|
@ -11,7 +11,9 @@
|
||||||
"build:watch": "rollup -c -w",
|
"build:watch": "rollup -c -w",
|
||||||
"test": "jest --coverage --watch",
|
"test": "jest --coverage --watch",
|
||||||
"test:ci": "jest --coverage --ci",
|
"test:ci": "jest --coverage --ci",
|
||||||
"verify": "npm run test:ci"
|
"verify": "npm run test:ci",
|
||||||
|
"b:clean": "bun run rimraf dist",
|
||||||
|
"b:build": "bun run b:clean && bun run rollup -c --silent --bundleConfigAsCjs"
|
||||||
},
|
},
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue