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: bun support 🥟 #907

Merged
merged 4 commits into from
Sep 10, 2023
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
8 changes: 4 additions & 4 deletions .github/workflows/playwright.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,11 @@ jobs:
- name: Install global dependencies
run: npm ci

- name: Remove sharp dependency
run: rm -rf node_modules/sharp
# - name: Remove sharp dependency
# run: rm -rf node_modules/sharp

- name: Install sharp with linux dependencies
run: cd api && SHARP_IGNORE_GLOBAL_LIBVIPS=1 npm install --arch=x64 --platform=linux --libc=glibc sharp
# - name: Install sharp with linux dependencies
# run: cd api && SHARP_IGNORE_GLOBAL_LIBVIPS=1 npm install --arch=x64 --platform=linux --libc=glibc sharp

- name: Build Client
run: npm run frontend
Expand Down
2 changes: 1 addition & 1 deletion api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
"passport-local": "^1.0.0",
"pino": "^8.12.1",
"sanitize": "^2.1.2",
"sharp": "^0.32.1",
"sharp": "^0.32.5",
"zod": "^3.22.2"
},
"devDependencies": {
Expand Down
2 changes: 1 addition & 1 deletion api/server/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const errorController = require('./controllers/ErrorController');
const passport = require('passport');
const configureSocialLogins = require('./socialLogins');

const port = process.env.PORT || 3080;
const port = Number(process.env.PORT) || 3080;
const host = process.env.HOST || 'localhost';
const projectPath = path.join(__dirname, '..', '..', 'client');
const { jwtLogin, passportLogin } = require('../strategies');
Expand Down
4 changes: 4 additions & 0 deletions api/server/middleware/loginLimiter.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ const loginLimiter = rateLimit({
windowMs,
max,
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;
4 changes: 4 additions & 0 deletions api/server/middleware/registerLimiter.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ const registerLimiter = rateLimit({
windowMs,
max,
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;
5 changes: 3 additions & 2 deletions api/strategies/localStrategy.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,10 @@ async function passportLogin(req, email, password, done) {
}

function logError(title, parameters) {
const entries = Object.entries(parameters).map(([name, value]) => ({ name, value }));
DebugControl.log.functionName(title);
if (parameters) {
DebugControl.log.parameters(parameters);
if (entries) {
DebugControl.log.parameters(entries);
}
}

Expand Down
Binary file added bun.lockb
Binary file not shown.
4 changes: 3 additions & 1 deletion client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@
"dev": "cross-env NODE_ENV=development dotenv -e ../.env -- vite",
"preview-prod": "cross-env NODE_ENV=development dotenv -e ../.env -- vite preview",
"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": {
"type": "git",
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 8 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,14 @@
"prepare": "node config/prepare.js",
"lint:fix": "eslint --fix \"{,!(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": {
"type": "git",
Expand Down
4 changes: 3 additions & 1 deletion packages/data-provider/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@
"build:watch": "rollup -c -w",
"test": "jest --coverage --watch",
"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": {
"type": "git",
Expand Down
Loading