fixed build scripts

This commit is contained in:
subnub
2024-12-22 20:41:47 -05:00
parent a22fc6bb6a
commit a0e79e2642
11 changed files with 16 additions and 104 deletions
Vendored
BIN
View File
Binary file not shown.
+2
View File
@@ -22,3 +22,5 @@ package-lock.json
dist/
rds-combined-ca-bundle.pem
docker-variables.env
dist-frontend/
dist-backend/
+1 -1
View File
@@ -16,7 +16,7 @@ import { middlewareErrorHandler } from "../middleware/utils/middleware-utils";
// import requestIp from "request-ip";
const app = express();
const publicPath = path.join(__dirname, "..", "..", "public");
const publicPath = path.join(__dirname, "..", "..", "dist-frontend");
let server: any;
let serverHttps: any;
@@ -1,28 +0,0 @@
import { UserInterface } from "../../../models/user-model";
import env from "../../../enviroment/env";
const addToStoageSize = async (
user: UserInterface,
size: number,
isPersonalFile: boolean
) => {
if (isPersonalFile) {
//console.log("user storage")
user.storageDataPersonal!.storageSize =
+user.storageDataPersonal!.storageSize! + +size;
await user.save();
return;
}
if (
!user.storageData ||
(!user.storageData.storageSize && !user.storageData.storageLimit)
)
user.storageData = { storageSize: 0, storageLimit: 0 };
user.storageData!.storageSize = +user.storageData!.storageSize! + +size;
await user.save();
};
export default addToStoageSize;
@@ -1,4 +1,4 @@
import s3 from "../../../db/s3";
import s3 from "../../../db/connections/s3";
import env from "../../../enviroment/env";
import { UserInterface } from "../../../models/user-model";
@@ -17,7 +17,7 @@ const getPrevIV = (
const stream = s3.getObject(params).createReadStream();
stream.on("data", (data) => {
stream.on("data", (data: any) => {
resolve(data);
});
});
@@ -1,33 +0,0 @@
import User, { UserInterface } from "../../../models/user-model";
import env from "../../../enviroment/env";
const subtractFromStorageSize = async (
userID: string,
size: number,
isPersonalFile: boolean
) => {
const user = (await User.findById(userID)) as UserInterface;
if (isPersonalFile) {
user.storageDataPersonal!.storageSize =
+user.storageDataPersonal!.storageSize! - +size;
if (user.storageDataPersonal!.storageSize < 0)
user.storageDataPersonal!.storageSize = 0;
await user.save();
return;
}
if (
!user.storageData ||
(!user.storageData.storageSize && !user.storageData.storageLimit)
)
user.storageData = { storageSize: 0, storageLimit: 0 };
user.storageData!.storageSize = +user.storageData!.storageSize! - +size;
if (user.storageData?.storageSize! < 0) user.storageData!.storageSize! = 0;
await user.save();
};
export default subtractFromStorageSize;
+2 -4
View File
@@ -12,7 +12,7 @@
// "declarationMap": true, /* Generates a sourcemap for each corresponding '.d.ts' file. */
// "sourceMap": true, /* Generates corresponding '.map' file. */
// "outFile": "./", /* Concatenate and emit output to single file. */
"outDir": "../dist" /* Redirect output structure to the directory. */,
"outDir": "../dist-backend" /* Redirect output structure to the directory. */,
"rootDir": "./" /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */,
// "composite": true, /* Enable project compilation */
// "tsBuildInfoFile": "./", /* Specify file to store incremental compilation information */
@@ -45,9 +45,7 @@
"typeRoots": [
"./node_modules/@types"
] /* List of folders to include type definitions from. */,
"types": [
"node"
] /* Type declaration files to be included in compilation. */,
"types": [] /* Type declaration files to be included in compilation. */,
// "allowSyntheticDefaultImports": true, /* Allow default imports from modules with no default export. This does not affect code emit, just typechecking. */
"esModuleInterop": true /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */,
// "preserveSymlinks": true, /* Do not resolve the real path of symlinks. */
+2 -2
View File
@@ -1,6 +1,6 @@
{
"watch": ["dist/"],
"watch": ["dist-backend/"],
"ignore": ["src", "node_modules"],
"ext": "js,json",
"exec": "node dist/server/server-start.js"
"exec": "node dist-backend/server/server-start.js"
}
+6 -3
View File
@@ -8,9 +8,12 @@
},
"scripts": {
"dev": "concurrently \"vite\" \"tsc -w -p ./backend/tsconfig.json\" \"npm run dev:backend\"",
"dev:backend": "NODE_ENV=development nodemon dist/server/server-start.js",
"vite-build": "vite build",
"lint": "eslint 'src/**/*.{js,jsx,ts,tsx}'"
"dev:backend": "NODE_ENV=development nodemon dist-backend/server/server-start.js",
"build:frontend": "vite build",
"build:backend": "tsc -p ./backend/tsconfig.json",
"build": "npm run build:frontend && npm run build:backend",
"lint": "eslint 'src/**/*.{js,jsx,ts,tsx}'",
"start": "NODE_ENV=production node dist-backend/server/server-start.js"
},
"dependencies": {
"@babel/core": "^7.8.4",
-30
View File
@@ -1,30 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<title>myDrive</title>
<link rel="icon" href="/images/icon.png">
<link rel="shortcut icon" type="image/png" href="/images/icon.png">
<link rel="shortcut icon" sizes="192x192" href="/images/icon.png">
<link rel="apple-touch-icon" href="/images/icon.png">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- <script src="https://kit.fontawesome.com/f982e94d70.js" crossorigin="anonymous"></script> -->
<!-- <link href="https://fonts.googleapis.com/css2?family=Roboto:wght@100;300;400;500;700&display=swap" rel="stylesheet"> -->
<script defer src="/fontawesome/js/all.js"></script>
<link rel="stylesheet" href="/dist/fonts.css">
<link rel="stylesheet" type="text/css" href="/dist/styles.css">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
</head>
<body>
<div id="app"></div>
<!-- <script src="/socket.io/socket.io.js"></script> -->
<script src="/dist/bundle.js"></script>
</body>
</html>
+1 -1
View File
@@ -4,7 +4,7 @@ import react from "@vitejs/plugin-react";
export default defineConfig({
plugins: [react()],
build: {
outDir: "dist",
outDir: "dist-frontend",
},
resolve: {
extensions: [".js", ".jsx", ".ts", ".tsx"], // Include these extensions