Skip to content

Commit

Permalink
removed wrongly commited changes to branch
Browse files Browse the repository at this point in the history
  • Loading branch information
alessio-cialini committed May 13, 2024
1 parent 001e775 commit 05fec20
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 77 deletions.
3 changes: 0 additions & 3 deletions node/.bashrc

This file was deleted.

8 changes: 0 additions & 8 deletions node/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,9 @@
"test:coverage": "jest --coverage"
},
"dependencies": {
"@babel/register": "^7.23.7",
"adm-zip": "^0.5.10",
"applicationinsights": "^1.7.4",
"axios": "^1.5.0",
"babel-node": "^0.0.1-security",
"bitgener": "^1.2.12",
"chromium": "^3.0.3",
"express": "^4.18.2",
Expand All @@ -24,15 +22,9 @@
"nodemon": "^3.0.1",
"puppeteer": "^22.0.0",
"qrcode-svg": "^1.1.0",
"react": "^18.3.1",
"react-dom": "^18.3.1",
"uuid": "^9.0.1"
},
"devDependencies": {
"@babel/cli": "^7.24.5",
"@babel/core": "^7.24.5",
"@babel/preset-env": "^7.24.5",
"@babel/preset-react": "^7.24.1",
"@types/jest": "^24.0.15",
"@types/semver": "^7.3.10",
"jest": "^29.6.4"
Expand Down
28 changes: 6 additions & 22 deletions node/pdf-generate/handlers.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,6 @@ let handlebars = require("handlebars");
const packageJson = require("../package.json");
var AdmZip = require("adm-zip");
const fse = require('fs-extra');
const { renderToString } = require('react-dom/server');
const React = require("react");
require('@babel/register')({
presets: ['@babel/preset-env', '@babel/preset-react'],
})


const info = async function (req, res, next) {

Expand Down Expand Up @@ -92,22 +86,12 @@ const generatePdf = async function (req, res, next) {
try {

const jsonData = JSON.parse(data);
if (renderMode === 'handlebar') {
let templateFile = readFileSync(path.join(workingDir, "template.html")).toString();
let template = handlebars.compile(templateFile);
jsonData.tempPath = workingDir;
let html = template(jsonData);
fs.writeFileSync(path.join(workingDir, "compiledTemplate.html"), html);

} else {
const h = React.createElement;
//let template = require(path.join(workingDir, "template.js"));
let template = require("./react/test.js");
let html = renderToString(h(template, {
data: jsonData
}));
fs.writeFileSync(path.join(workingDir, "compiledTemplate.html"), html);
}
let templateFile = readFileSync(path.join(workingDir, "template.html")).toString();
let template = handlebars.compile(templateFile);
jsonData.tempPath = workingDir;
let html = template(jsonData);
fs.writeFileSync(path.join(workingDir, "compiledTemplate.html"), html);

} catch (err) {
console.log(err)
res.status(500);
Expand Down
44 changes: 0 additions & 44 deletions node/pdf-generate/react/test.js

This file was deleted.

0 comments on commit 05fec20

Please sign in to comment.