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:
+5
-10
@@ -5,24 +5,19 @@
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
|
||||
const versionFile = path.join(__dirname, 'dental-server', 'version.txt');
|
||||
const packageFile = path.join(__dirname, 'dental-server', 'package.json');
|
||||
const indexFile = path.join(__dirname, 'dental-server', 'public', 'index.html');
|
||||
const versionFile = path.join(__dirname, 'dental-server', 'version.txt');
|
||||
const indexFile = path.join(__dirname, 'dental-server', 'public', 'index.html');
|
||||
|
||||
const current = fs.readFileSync(versionFile, 'utf8').trim();
|
||||
const parts = current.split('.').map(Number);
|
||||
parts[2]++; // bump PATCH
|
||||
const next = parts.join('.');
|
||||
|
||||
// version.txt
|
||||
// version.txt — fonte de verdade do número de versão
|
||||
fs.writeFileSync(versionFile, next + '\n');
|
||||
|
||||
// package.json
|
||||
const pkg = JSON.parse(fs.readFileSync(packageFile, 'utf8'));
|
||||
pkg.version = next;
|
||||
fs.writeFileSync(packageFile, JSON.stringify(pkg, null, 2) + '\n');
|
||||
|
||||
// index.html — substitui qualquer v{X.Y.Z} dentro do <span> da sidebar
|
||||
// index.html — substitui v{X.Y.Z} dentro do <span> da sidebar
|
||||
// (package.json NÃO é alterado para preservar o cache de npm install no Docker)
|
||||
let html = fs.readFileSync(indexFile, 'utf8');
|
||||
html = html.replace(
|
||||
/(RF Dental.*?<span[^>]*>)\s*v[\d.]+\s*(<\/span>)/s,
|
||||
|
||||
Reference in New Issue
Block a user