1
0
mirror of https://github.com/Stirling-Tools/Stirling-PDF.git synced 2024-11-23 15:21:25 +01:00

Updated Dependencies, Makefiles for build process, Docker Images for Front & Backend

This commit is contained in:
Felix Kaspar 2024-08-31 21:55:25 +02:00
parent 734c871666
commit f3697a18e3
13 changed files with 923 additions and 916 deletions

View File

@ -3,10 +3,13 @@ FROM node:22.2.0-alpine
WORKDIR /app
COPY package*.json ./
RUN npm ci --legacy-peer-deps
RUN npm i -g serve
COPY ./dist ./dist
EXPOSE 3000
CMD [ "serve", "-s", "dist" ]
CMD [ "serve", "-s", "dist", "-p", "3000" ]

13
client-tauri/Makefile Normal file
View File

@ -0,0 +1,13 @@
vite-build:
npx tsc
npx vite build
vite-dockerize:
make vite-build
bash -c "cp ../package-lock.json ./"
docker build . -t stirling-pdf:latest
bash -c "rm ./package-lock.json"
docker image prune
tauri-build:
npx tauri build

View File

@ -1,3 +1,11 @@
# Stirling-PDF frontend
Tauri + Vite + React + Typescript
Tauri + Vite + React + Typescript
## Development
Use the package scripts to start developement
## Production
Use the make file to build for the correct platform

View File

@ -5,16 +5,14 @@
"type": "module",
"scripts": {
"vite:dev": "vite",
"vite:build": "tsc && vite build",
"vite:preview-build": "vite preview",
"vite:dockerize-build": "docker build . -t stirling-pdf:latest",
"tauri:dev (currently broken)": "tauri dev",
"tauri:build-debug": "tauri build --debug",
"tauri:build": "tauri build"
"vite:preview-prod": "make vite-build && vite preview",
"tauri:build-debug": "npx tauri build --debug",
"tauri:dev": "tauri dev"
},
"dependencies": {
"@stirling-pdf/shared-operations": "^0.0.0",
"@tauri-apps/api": "^1.5.1",
"@types/semver": "^7.5.8",
"archiver": "^6.0.1",
"i18next": "^23.6.0",
"i18next-browser-languagedetector": "^7.1.0",
@ -22,23 +20,23 @@
"pdfjs-dist": "^4.0.189",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-i18next": "^13.3.1",
"react-i18next": "^15.0.1",
"react-icons": "^4.11.0",
"react-material-symbols": "^4.4.0",
"react-router-bootstrap": "^0.26.2",
"react-router-dom": "^6.18.0",
"vite-plugin-node-polyfills": "^0.21.0",
"vite": "^5.4.2",
"vite-plugin-node-polyfills": "^0.22.0",
"vite-plugin-top-level-await": "^1.3.1"
},
"devDependencies": {
"@tauri-apps/cli": "^1.5.0",
"@types/archiver": "^5.3.4",
"@types/archiver": "^6.0.2",
"@types/react": "^18.2.15",
"@types/react-dom": "^18.2.7",
"@types/react-router-bootstrap": "^0.26.5",
"@vitejs/plugin-react": "^4.0.3",
"@vitejs/plugin-react": "^4.3.1",
"typescript": "^5.0.2",
"vite": "^4.4.4",
"vite-plugin-compile-time": "^0.2.1",
"vite-plugin-dynamic-import": "^1.5.0"
}

View File

@ -4,7 +4,7 @@ version = 3
[[package]]
name = "StirlingPDF"
version = "0.0.1"
version = "2.0.0"
dependencies = [
"serde",
"serde_json",

View File

@ -1,6 +1,6 @@
[package]
name = "StirlingPDF"
# version = "2.0.0"
version = "2.0.0" # needed for dev build?
description = "Selfhosted PDF processing"
authors = ["LaserKaspar, SaudF"]
license = ""

View File

@ -1,7 +1,7 @@
{
"build": {
"beforeDevCommand": "npm run dev",
"beforeBuildCommand": "npm run build",
"beforeDevCommand": "npm run vite:dev",
"beforeBuildCommand": "make vite-build",
"devPath": "http://localhost:1420",
"distDir": "../dist",
"withGlobalTauri": false

1728
package-lock.json generated

File diff suppressed because it is too large Load Diff

19
server-node/Dockerfile Normal file
View File

@ -0,0 +1,19 @@
# Use an existing image as a base
FROM node:22.2.0-alpine
RUN apk add --no-cache git
WORKDIR /app
ENV NODE_ENV production
COPY package*.json ./
RUN npm ci --legacy-peer-deps
COPY ./dist ./dist
RUN apk del git
EXPOSE 8000
CMD [ "node", "./dist/index.js" ]

10
server-node/Makefile Normal file
View File

@ -0,0 +1,10 @@
vite-build:
npx tsc
npx vite build
vite-dockerize:
make vite-build
bash -c "cp ../package-lock.json ./"
docker build . -t stirling-pdf-backend:latest
bash -c "rm ./package-lock.json"
docker image prune

View File

@ -11,19 +11,17 @@
"canvas": "^2.11.2"
},
"scripts": {
"dev": "vite",
"build": "tsc && vite build",
"start": "node ./dist/index.js"
"vite:dev": "vite",
"vite:preview-prod": "make vite-build && node ./dist/index.js"
},
"keywords": [],
"author": "",
"license": "ISC",
"dependencies": {
"@esbuild/win32-x64": "^0.19.10",
"@rollup/plugin-alias": "^5.1.0",
"@rollup/plugin-commonjs": "^25.0.7",
"@rollup/plugin-json": "^6.1.0",
"@types/archiver": "^6.0.1",
"@stirling-tools/joi": "github:stirling-tools/joi",
"@types/express": "^4.17.21",
"@types/multer": "^1.4.10",
"@wasmer/wasmfs": "^0.12.0",
@ -32,6 +30,8 @@
"express": "^4.18.2",
"express-fileupload": "^1.4.2",
"express-session": "^1.18.0",
"i18next": "^23.14.0",
"i18next-resources-to-backend": "^1.2.1",
"joi": "^17.11.0",
"jsqr": "^1.4.0",
"multer": "^1.4.5-lts.1",
@ -39,30 +39,32 @@
"passport-headerapikey": "^1.2.2",
"passport-local": "^1.0.0",
"pdf-lib": "^1.17.1",
"pdfjs-dist": "^4.5.136",
"react-material-symbols": "^4.4.0",
"rollup-plugin-copy": "^3.5.0",
"rollup-plugin-dynamic-import-variables": "^1.1.0",
"sequelize": "^6.37.3",
"sqlite3": "^5.1.7",
"toml": "^3.0.0",
"tsconfig-paths": "^4.2.0",
"vite": "^5.4.2",
"vite-plugin-compile-time": "^0.2.1",
"vite-plugin-dynamic-import": "^1.5.0",
"vite-plugin-node-polyfills": "^0.19.0",
"vite-plugin-node-polyfills": "^0.22.0",
"vite-plugin-top-level-await": "^1.4.1"
},
"devDependencies": {
"@rollup/plugin-dynamic-import-vars": "^2.1.2",
"@rollup/plugin-run": "^3.0.2",
"@rollup/plugin-typescript": "^11.1.6",
"@types/archiver": "^6.0.2",
"@types/express-session": "^1.18.0",
"@types/passport-local": "^1.0.38",
"copyfiles": "^2.4.1",
"pkgroll": "^2.0.1",
"rimraf": "^5.0.5",
"rollup": "^4.9.6",
"ts-node-dev": "^2.0.0",
"typescript": "^5.2.2",
"vite": "^5.2.11",
"typescript": "^5.5.4",
"vite-plugin-node": "^3.1.0"
}
}

View File

@ -66,7 +66,7 @@ else {
}
// viteNode
if (import.meta.env.VITE_PROD) {
if (import.meta.env.PROD) {
app.listen(PORT, () => {
console.log(`http://localhost:${PORT}`);
});

View File

@ -19,8 +19,8 @@ export async function validateOperations(actions: Action[]): Promise<{ valid: bo
return { valid: false, reason: `action.type ${action.type} does not exist` };
}
const schema = await getSchemaByName(action.type);
if(!operator) {
return { valid: false, reason: `action.type ${action.type} does not exist` };
if(!schema) {
return { valid: false, reason: `schema for action.type ${action.type} does not exist` };
}
const validationResult = schema.schema.validate({values: action.values});