perf: preserve Docker npm cache - version bumps only touch version.txt, not package.json
continuous-integration/webhook Deploy concluído (VPS4)
continuous-integration/webhook Deploy concluído (VPS4)
This commit is contained in:
@@ -500,8 +500,13 @@ app.get('/login', (req, res) => {
|
||||
// Função utilitária de Cache Buster
|
||||
async function serveHtmlWithCacheBuster(res, filePath) {
|
||||
try {
|
||||
const pkg = require('./package.json');
|
||||
const APP_VERSION = pkg.version || Date.now();
|
||||
// Lê version.txt (não package.json) para não ter cache-miss no Docker a cada deploy
|
||||
let APP_VERSION;
|
||||
try {
|
||||
APP_VERSION = (await fs.readFile(path.join(__dirname, 'version.txt'), 'utf8')).trim();
|
||||
} catch (_) {
|
||||
APP_VERSION = require('./package.json').version || Date.now();
|
||||
}
|
||||
let content = await fs.readFile(filePath, 'utf8');
|
||||
|
||||
// Injeta versão em tags de script e css
|
||||
|
||||
Reference in New Issue
Block a user