Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
"cors": "2.8.5",
"date-fns": "4.1.0",
"dotenv": "17.2.3",
"ejs": "^2.6.1",
"ejs": "5.0.2",
"express": "5.1.0",
"express-rate-limit": "8.2.1",
"express-validator": "7.3.0",
Expand Down Expand Up @@ -89,5 +89,6 @@
"typescript": "5.9.3",
"typescript-eslint": "8.46.3",
"vitest": "4.0.7"
}
},
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JosueModesto a migração do ejs está correta, mas esta mudança do gerenciador de pacotes não. Algum motivo especial para esta migração?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Como eu havia falado na ultima reuniao, eu estava com problema com a versao do yarn, provavelmente em uma inicialização ele deve gerado essa mudança automaticamente. eu tentando fazer ele rodar.

"packageManager": "yarn@4.13.0+sha512.5c20ba010c99815433e5c8453112165e673f1c7948d8d2b267f4b5e52097538658388ebc9f9580656d9b75c5cc996f990f611f99304a2197d4c56d21eea370e7"
}
2 changes: 1 addition & 1 deletion src/controllers/fichas-tombos-controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,7 @@ export default function fichaTomboController(request, response, next) {
};

const caminhoArquivoHtml = path.resolve(__dirname, '../views/ficha-tombo.ejs');
return renderizaArquivoHtml(caminhoArquivoHtml, parametros, response)
return renderizaArquivoHtml(caminhoArquivoHtml, parametros)
.then(html => {
response.status(200).send(html);
});
Expand Down
2 changes: 1 addition & 1 deletion src/controllers/tombos-exportacoes-controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ export default function exportacoes(request, response, next) {
const parametros = { colunas, tombos };

const caminhoArquivoHtml = path.resolve(__dirname, '../views/exportacao-tombos.ejs');
return renderizaArquivoHtml(caminhoArquivoHtml, parametros, response)
return renderizaArquivoHtml(caminhoArquivoHtml, parametros)
.then(html => {
response.status(200).send(html);
});
Expand Down
16 changes: 5 additions & 11 deletions src/helpers/renderiza-arquivo-html.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,9 @@
import { renderFile } from 'ejs';
import { promisify } from 'util';

export default (caminho, parametros) => new Promise((resolve, reject) => {
const renderFileAsync = promisify(renderFile);

function onRenderCompleted(err, html) {
if (err) {
reject(err);
return;
}

resolve(html);
}

renderFile(caminho, parametros, {}, onRenderCompleted);
export default (caminho, parametros) => renderFileAsync(caminho, parametros, {
// Keep whitespace behavior stable across EJS major versions.
rmWhitespace: false,
});
Loading
Loading