Skip to content

Commit

Permalink
feat: working resume export again
Browse files Browse the repository at this point in the history
  • Loading branch information
vitormv committed Aug 4, 2023
1 parent 839a857 commit 1478228
Show file tree
Hide file tree
Showing 5 changed files with 455 additions and 27 deletions.
5 changes: 2 additions & 3 deletions cli/export-pdf-resume.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-disable max-len */
import path from 'path';
import puppeteer from 'puppeteer';
import tasuku from 'tasuku';
Expand Down Expand Up @@ -26,7 +25,7 @@ async function exportResumeAsPdf(task) {
path: targetPdfPath,
displayHeaderFooter: true,
margin: { top: '12mm', right: 0, bottom: '12mm', left: 0 },
headerTemplate: ' ', // <--- empty spaces are needed! XD
headerTemplate: ' ', // <--- empty spaces are needed! ¯\_(ツ)_/¯
footerTemplate: `
<div style="width: 100%; font-style: italic; font-size: 9px; padding: 0; color: #bbb; font-family: 'Lora', serif; position: relative;">
<div style="position: absolute; right: 9mm; bottom: 5px;">
Expand All @@ -48,7 +47,7 @@ const mainFn = async () => {
await exportResumeAsPdf(task);
});

tasuku(`All done! PDF exported to "/${targetPdfPath}"`, () => {});
tasuku(`All done! PDF exported to "${targetPdfPath}"`, () => {});
};

mainFn();
3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,8 @@
"@fortawesome/free-brands-svg-icons": "^5.15.4",
"@fortawesome/free-solid-svg-icons": "^5.15.4",
"@fortawesome/react-fontawesome": "^0.1.17",
"clsx": "^1.1.1",
"express": "^4.18.2",
"next": "^13.4.12",
"normalize.css": "^8.0.1",
"puppeteer": "^14.1.0",
"react": "^18.1.0",
"react-dom": "^18.1.0",
Expand Down
Binary file modified public/vitor-mello-resume.pdf
Binary file not shown.
33 changes: 33 additions & 0 deletions static.server.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import path from 'path';
import express from 'express';

const PORT = 8092;

// This is the server that runs on "yarn serve".
// It works by serving the statically generated .html files on /out.
// Of course, before starting this server you should export the project with "yarn export"
const mainApp = express();

const rootPath = path.resolve(path.join(__dirname, 'out'));

const staticConfig = {
extensions: ['html'], // when requesting "/aaa/bbb", also look for "/aaa/bbb.html"
redirect: true,
index: 'index.html',
};

// serve the actual generated static files
mainApp.use(express.static(path.join(rootPath), staticConfig));

// redirects "/something/that/doesnt_exist" -> "404.html"
mainApp.all('*', (req, res) => {
res.status(404).sendFile(path.join(rootPath, '404.html'));
});

console.log(`Server listening on http://localhost:${PORT}/`);

const server = mainApp.listen(PORT);

server.on('connection', (socket) => {
socket.setNoDelay(true);
});
Loading

0 comments on commit 1478228

Please sign in to comment.