packaging working, need to fix json import assertion

This commit is contained in:
Felix Kaspar 2024-01-12 18:39:57 +01:00
parent 9c1588d150
commit c07e247a2a
5 changed files with 1629 additions and 1364 deletions

2892
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -2,7 +2,6 @@
"name": "@stirling-pdf/server-node", "name": "@stirling-pdf/server-node",
"version": "0.0.0", "version": "0.0.0",
"description": "", "description": "",
"//": "end pkgroll config",
"type": "module", "type": "module",
"exports": "./dist/index.js", "exports": "./dist/index.js",
"imports": { "imports": {
@ -11,13 +10,15 @@
"optionalDependencies": { "optionalDependencies": {
"canvas": "^2.11.2" "canvas": "^2.11.2"
}, },
"files": [
"/shared-operations/src/wasm/pdfcpu/pdfcpu.wasm"
],
"scripts": { "scripts": {
"build": "pkgroll", "dev": "npx tsx watch src/index.ts",
"build": "npm run prebuild && pkgroll && npm run postbuild",
"start": "node ./dist/index.js", "start": "node ./dist/index.js",
"dev": "npx tsx watch src/index.ts"
"prebuild": "rimraf ./dist",
"postbuild": "npm run copy-locales && npm run copy-pdfcpu",
"copy-locales": "copyfiles -u 3 ../shared-operations/src/locales/**/*.json dist",
"copy-pdfcpu": "copyfiles -u 5 ../shared-operations/src/wasm/pdfcpu/pdfcpu.wasm dist"
}, },
"keywords": [], "keywords": [],
"author": "", "author": "",
@ -38,8 +39,11 @@
"tsconfig-paths": "^4.2.0" "tsconfig-paths": "^4.2.0"
}, },
"devDependencies": { "devDependencies": {
"copyfiles": "^2.4.1",
"pkgroll": "^2.0.1", "pkgroll": "^2.0.1",
"rimraf": "^5.0.5",
"ts-node-dev": "^2.0.0", "ts-node-dev": "^2.0.0",
"typescript": "^5.2.2" "typescript": "^5.2.2"
} }
} }

View File

@ -1,4 +1,4 @@
import "@stirling-pdf/shared-operations/src/locales/i18next.config"; import "@stirling-pdf/shared-operations/src/i18next.config";
import express from "express"; import express from "express";
const app = express(); const app = express();

View File

@ -2,10 +2,10 @@ import i18next from "i18next";
import resourcesToBackend from "i18next-resources-to-backend"; import resourcesToBackend from "i18next-resources-to-backend";
i18next i18next
.use(resourcesToBackend((language, namespace) => import(`./${namespace}/${language}.json`))) .use(resourcesToBackend((language, namespace) => import(`./locales/${namespace}/${language}.json`)))
.init({ .init({
// debug: true, // debug: true,
ns: ["common"], // Preload this namespace, no need to add the others ns: ["common"], // Preload this namespace, no need to add the others, they will load once their module is loaded
defaultNS: "common", defaultNS: "common",
fallbackLng: "en", fallbackLng: "en",
interpolation: { interpolation: {

View File

@ -1,7 +1,8 @@
import { WasmFs } from '@wasmer/wasmfs'; import { WasmFs } from '@wasmer/wasmfs';
import path from "path"; import path from "path";
import { fileURLToPath } from 'url';
let nodeWasmLocation = "../shared-operations/src/wasm/pdfcpu/"; // TODO: Replace with __dirname let nodeWasmLocation = path.dirname(fileURLToPath(import.meta.url));
let fs; let fs;
const wasmfs = new WasmFs(); const wasmfs = new WasmFs();