Skip to content

Commit

Permalink
feat: removal of webpack and replacement with bun
Browse files Browse the repository at this point in the history
  • Loading branch information
benpsnyder committed Apr 7, 2024
1 parent b9a295b commit fa2da3d
Show file tree
Hide file tree
Showing 309 changed files with 752 additions and 691 deletions.
3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,5 +38,8 @@
},
"engines": {
"node": "16.x || 17.x || 18.x || 20.x || 21.x"
},
"dependencies": {
"objection": "^3.1.4"
}
}
10 changes: 9 additions & 1 deletion packages/server/biome.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,12 @@
{
"$schema": "https://biomejs.dev/schemas/1.6.0/schema.json",
"extends": ["../../biome.json"]
"extends": ["../../biome.json"],
"linter": {
"enabled": true,
"rules": {
"style": {
"useImportType": "error"
}
}
}
}
16 changes: 16 additions & 0 deletions packages/server/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
// We need this in order to use @Decorators
// DO NOT CHANGE THE LINE SPACING OF THE IMPORTS
// OR THE LINTER WILL REORDER THEM
import 'reflect-metadata';

import { startServer } from './src/server';

// Additional initializations can go here
console.log('Additional initializations or logic before starting the server.');

// Now explicitly start the server
startServer().then(() => {
console.log('Server started successfully.');
}).catch((error) => {
console.error('Failed to start the server:', error);
});
86 changes: 36 additions & 50 deletions packages/server/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"version": "0.10.2",
"description": "",
"license": "ISC",
"type": "commonjs",
"type": "module",
"author": "Ahmed Bouhuolia, <[email protected]>",
"main": "src/server.ts",
"bin": {
Expand All @@ -14,18 +14,13 @@
"clear": "rimraf build",
"format": "biome format --write ./",
"lint": "biome check --apply ./",
"dev": "cross-env NODE_ENV=development webpack --config scripts/webpack.config.js",
"build:resources": "gulp --gulpfile=scripts/gulpfile.js styles styles-rtl",
"build:app": "cross-env NODE_ENV=production webpack --config scripts/webpack.config.js",
"build:commands": "cross-env NODE_ENV=production webpack --config scripts/webpack.cli.js",
"build": "npm-run-all build:*",
"serve": "node ./build/index.js",
"lint:eslint": "eslint --fix ./**/*.ts",
"bun.build": "bun build src/server.ts --target bun --outdir ./build",
"vite.dev": "vite",
"vite.serve": "node ./build/index.js",
"vite.build:app": "vite build --config vite.config.app.js",
"vite.build:commands": "vite build --config vite.config.cli.js"
"dev": "bun run serve",
"build:resources": "gulp --gulpfile=scripts/gulpfile.cjs styles styles-rtl",
"build:app": "cross-env NODE_ENV=production bun build ./index.ts --outdir build/server --target bun",
"build:commands": "cross-env NODE_ENV=production bun build ./src/commands/index.ts --outdir build/commands --target bun",
"build": "run-p build:*",
"serve": "bun run index.ts",
"lint:eslint": "eslint --fix ./**/*.ts"
},
"dependencies": {
"@casl/ability": "^5.4.4",
Expand Down Expand Up @@ -102,8 +97,8 @@
"puppeteer": "^10.4.0",
"qim": "0.0.52",
"ramda": "^0.29.1",
"rate-limiter-flexible": "^2.4.2",
"reflect-metadata": "^0.1.14",
"rate-limiter-flexible": "^5.0.0",
"reflect-metadata": "^0.2.2",
"rtl-detect": "^1.1.2",
"socket.io": "^4.7.5",
"source-map-loader": "^4.0.2",
Expand All @@ -122,56 +117,47 @@
"@types/errorhandler": "^1.5.3",
"@types/express": "^4.17.21",
"@types/express-boom": "^3.0.4",
"@types/lodash": "^4.14.158",
"@types/lodash": "^4.17.0",
"@types/nodemailer": "^6.4.14",
"@types/ramda": "^0.27.64",
"@typescript-eslint/eslint-plugin": "^5.50.0",
"@typescript-eslint/parser": "^5.50.0",
"@types/ramda": "^0.29.12",
"@typescript-eslint/eslint-plugin": "^5.62.0",
"@typescript-eslint/parser": "^5.62.0",
"bun": "^1.1.2",
"bun-types": "^1.1.2",
"chai": "^4.2.0",
"chai-http": "^4.3.0",
"chai": "^4.4.1",
"chai-http": "^4.4.0",
"chai-things": "^0.2.0",
"colorette": "^1.2.0",
"commander": "^5.0.0",
"cross-env": "^5.2.0",
"eslint": "^8.33.0",
"colorette": "^2.0.20",
"commander": "^12.0.0",
"cross-env": "^7.0.3",
"eslint": "^8.57.0",
"eslint-config-airbnb-base": "^15.0.0",
"eslint-config-airbnb-typescript": "^17.0.0",
"eslint-config-airbnb-typescript": "^17.1.0",
"eslint-friendly-formatter": "^4.0.1",
"eslint-import-resolver-typescript": "^3.5.3",
"eslint-import-resolver-webpack": "^0.11.1",
"eslint-import-resolver-typescript": "^3.6.1",
"eslint-loader": "^2.2.1",
"eslint-plugin-import": "^2.27.5",
"eslint-plugin-import": "^2.29.1",
"faker": "^4.1.0",
"getopts": "^2.2.5",
"gulp-postcss": "^9.0.0",
"getopts": "^2.3.0",
"gulp-postcss": "^9.1.0",
"gulp-rename": "^2.0.0",
"knex-factory": "0.0.7",
"merge-stream": "^2.0.0",
"mocha": "^5.2.0",
"npm-run-all": "^4.1.5",
"nyc": "^14.1.1",
"progress-bar-webpack-plugin": "^2.1.0",
"regenerator-runtime": "^0.13.7",
"rimraf": "^3.0.2",
"rtlcss": "^3.3.0",
"run-script-webpack-plugin": "^0.1.1",
"sass": "^1.58.0",
"sinon": "^7.4.2",
"start-server-webpack-plugin": "^2.2.5",
"ts-loader": "^9.4.2",
"ts-node": "^9.0.0",
"tsconfig-paths-webpack-plugin": "^4.0.0",
"typescript": "^3.9.7",
"webpack": "^5.75.0",
"webpack-cli": "^4.10.0",
"webpack-merge": "^5.8.0",
"webpack-node-externals": "^3.0.0",
"webpack-watch-changed": "^1.0.0"
"npm-run-all2": "^6.1.2",
"nyc": "^15.1.0",
"regenerator-runtime": "^0.13.11",
"rimraf": "^5.0.5",
"rtlcss": "^3.5.0",
"sass": "^1.74.1",
"sinon": "^7.5.0",
"ts-loader": "^9.5.1",
"ts-node": "^10.9.2",
"typescript": "^5.4.4"
},
"optionalDependencies": {
"better-sqlite3": "^9.4.5",
"noop2": "^2.0.0",
"oracledb": "^6.4.0",
"pg": "^8.11.5",
"pg-escape": "^0.2.0",
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const rename = require('gulp-rename'); // Renames files E.g. style.css -> style.
const postcss = require('gulp-postcss'); // Transforming styles with JS plugins
const rtlcss = require('rtlcss'); // Convert LTR CSS to RTL.

const config = require('./gulpConfig');
const config = require('./gulpConfig.cjs');

gulp.task('styles', () => {
const builds = config.style.build.map((build) => {
Expand Down
11 changes: 0 additions & 11 deletions packages/server/scripts/webpack.cli.js

This file was deleted.

70 changes: 0 additions & 70 deletions packages/server/scripts/webpack.common.js

This file was deleted.

11 changes: 0 additions & 11 deletions packages/server/scripts/webpack.config.js

This file was deleted.

6 changes: 3 additions & 3 deletions packages/server/server-globals.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// help me export default
// and I want to export rootDir

import path from "node:path";
import path from 'node:path';

const rootDir = `${__dirname}/../../`;

Expand All @@ -10,5 +10,5 @@ export const globals = {
resourcesDir: path.join(rootDir, 'resources'),
localesDir: path.join(rootDir, 'resources', 'locales'),
viewsDir: path.join(rootDir, 'views'),
storageDir: path.join(rootDir, 'storage')
};
storageDir: path.join(rootDir, 'storage'),
};
2 changes: 1 addition & 1 deletion packages/server/src/api/controllers/Account/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import AttachCurrentTenantUser from '@/api/middleware/AttachCurrentTenantUser';
import TenancyMiddleware from '@/api/middleware/TenancyMiddleware';
import JWTAuth from '@/api/middleware/jwtAuth';
import AuthenticatedAccount from '@/services/AuthenticatedAccount';
import { NextFunction, Request, Response, Router } from 'express';
import { type NextFunction, type Request, type Response, Router } from 'express';
import { Inject, Service } from 'typedi';

@Service()
Expand Down
2 changes: 1 addition & 1 deletion packages/server/src/api/controllers/AccountTypes.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import BaseController from '@/api/controllers/BaseController';
import asyncMiddleware from '@/api/middleware/asyncMiddleware';
import AccountsTypesService from '@/services/Accounts/AccountsTypesServices';
import { NextFunction, Request, Response, Router } from 'express';
import { type NextFunction, type Request, type Response, Router } from 'express';
import { Inject, Service } from 'typedi';

@Service()
Expand Down
6 changes: 3 additions & 3 deletions packages/server/src/api/controllers/Accounts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@ import CheckPolicies from '@/api/middleware/CheckPolicies';
import asyncMiddleware from '@/api/middleware/asyncMiddleware';
import { DATATYPES_LENGTH } from '@/data/DataTypes';
import { ServiceError } from '@/exceptions';
import { AbilitySubject, AccountAction, IAccountDTO, IAccountsStructureType } from '@/interfaces';
import { AbilitySubject, AccountAction, type IAccountDTO, IAccountsStructureType } from '@/interfaces';
import { AccountsApplication } from '@/services/Accounts/AccountsApplication';
import DynamicListingService from '@/services/DynamicListing/DynamicListService';
import { NextFunction, Request, Response, Router } from 'express';
import { type NextFunction, type Request, type Response, Router } from 'express';
import { check, param, query } from 'express-validator';
import { MAX_ACCOUNTS_CHART_DEPTH } from '../../services/Accounts/constants';
import { Inject, Service } from 'typedi';
import { MAX_ACCOUNTS_CHART_DEPTH } from '../../services/Accounts/constants';

@Service()
export default class AccountsController extends BaseController {
Expand Down
4 changes: 2 additions & 2 deletions packages/server/src/api/controllers/Authentication.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import { DATATYPES_LENGTH } from '@/data/DataTypes';
import { ServiceError } from '@/exceptions';
import { ILoginDTO, IRegisterDTO } from '@/interfaces';
import AuthenticationApplication from '@/services/Authentication/AuthApplication';
import { Request, Response, Router } from 'express';
import { ValidationChain, check } from 'express-validator';
import { type Request, type Response, Router } from 'express';
import { type ValidationChain, check } from 'express-validator';
import { Inject, Service } from 'typedi';

@Service()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import BaseController from '@/api/controllers/BaseController';
import { PlaidApplication } from '@/services/Banking/Plaid/PlaidApplication';
import { Request, Response, Router } from 'express';
import { type Request, type Response, Router } from 'express';
import { Inject, Service } from 'typedi';

@Service()
Expand Down
4 changes: 2 additions & 2 deletions packages/server/src/api/controllers/Branches/index.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import BaseController from '@/api/controllers/BaseController';
import { FeatureActivationGuard } from '@/api/middleware/FeatureActivationGuard';
import { ServiceError } from '@/exceptions';
import { Features, ICreateBranchDTO, IEditBranchDTO } from '@/interfaces';
import { Features, type ICreateBranchDTO, type IEditBranchDTO } from '@/interfaces';
import { BranchesApplication } from '@/services/Branches/BranchesApplication';
import { NextFunction, Request, Response, Router } from 'express';
import { type NextFunction, type Request, type Response, Router } from 'express';
import { check, param } from 'express-validator';
import { Inject, Service } from 'typedi';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import CheckPolicies from '@/api/middleware/CheckPolicies';
import { ServiceError } from '@/exceptions';
import { NextFunction, Request, Response, Router } from 'express';
import { type NextFunction, type Request, type Response, Router } from 'express';
import { param } from 'express-validator';
import { Inject, Service } from 'typedi';
import BaseController from '../BaseController';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import CheckPolicies from '@/api/middleware/CheckPolicies';
import { ServiceError } from '@/exceptions';
import { AbilitySubject, CashflowAction } from '@/interfaces';
import { CashflowApplication } from '@/services/Cashflow/CashflowApplication';
import { NextFunction, Request, Response, Router } from 'express';
import { type NextFunction, type Request, type Response, Router } from 'express';
import { query } from 'express-validator';
import { Inject, Service } from 'typedi';
import BaseController from '../BaseController';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import CheckPolicies from '@/api/middleware/CheckPolicies';
import { ServiceError } from '@/exceptions';
import { AbilitySubject, CashflowAction } from '@/interfaces';
import { CashflowApplication } from '@/services/Cashflow/CashflowApplication';
import { NextFunction, Request, Response, Router } from 'express';
import { type NextFunction, type Request, type Response, Router } from 'express';
import { param } from 'express-validator';
import { Inject, Service } from 'typedi';
import BaseController from '../BaseController';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import CheckPolicies from '@/api/middleware/CheckPolicies';
import { ServiceError } from '@/exceptions';
import { AbilitySubject, CashflowAction } from '@/interfaces';
import { CashflowApplication } from '@/services/Cashflow/CashflowApplication';
import { NextFunction, Request, Response, Router } from 'express';
import { type NextFunction, type Request, type Response, Router } from 'express';
import { check, param, query } from 'express-validator';
import { Inject, Service } from 'typedi';
import BaseController from '../BaseController';
Expand Down
Loading

0 comments on commit fa2da3d

Please sign in to comment.