further cleanup, replace buildtimestamp with buildversion to achive deterministic builds in different runs

This commit is contained in:
Harald Bamberger
2025-10-30 15:33:08 +01:00
parent 6fc39e9ef5
commit 18854de6fd
3 changed files with 17 additions and 11 deletions
+4
View File
@@ -20,6 +20,10 @@ einmalig:
npm run build
mit debug ausgaben:
DEBUG=true npm run build
als watch bei Änderungen:
npm run watch
+8 -11
View File
@@ -1,25 +1,23 @@
import fhcBuildConfig from './rollup.fhcbuildconfig.js';
import babel from '@rollup/plugin-babel';
import nodeResolve from '@rollup/plugin-node-resolve';
import commonjs from '@rollup/plugin-commonjs';
import vue from "rollup-plugin-vue";
import { globSync } from 'glob';
import path from 'node:path';
import { fileURLToPath } from 'node:url';
import postcss from 'rollup-plugin-postcss';
import replace from '@rollup/plugin-replace';
import alias from '@rollup/plugin-alias';
import { existsSync } from 'node:fs';
import terser from '@rollup/plugin-terser';
import json from '@rollup/plugin-json';
const debug = false;
const debug = (process.env.DEBUG !== undefined) && (process.env.DEBUG === "true");
const buildtimestamp = new Date().toISOString().replace(/[-T:]/g, '').substr(0,14);
const buildversion = fhcBuildConfig.fhcBuildVersion;
const fhcbasepath = import.meta.dirname;
let apps = {};
let curapp = null;
console.log(process.env.DEBUG + ' ' + debug);
function FhcResolver () {
return {
name: 'fhc-resolver', // this name will show up in logs and errors
@@ -45,7 +43,7 @@ function FhcResolver () {
if( source.includes('index.ci.php') ) {
let source_abs = fhcbasepath + '/' + source.replace(/(\.\.\/)+/, '');
let source_rel = path.relative(path.dirname(curapp), source_abs) + '?' + buildtimestamp;
let source_rel = path.relative(path.dirname(curapp), source_abs) + '?' + buildversion;
debug && console.log('SOURCE_ABS:' + source_abs + 'APP: ' + curapp + 'SOURCE_REL: ' + source_rel);
@@ -57,7 +55,7 @@ function FhcResolver () {
if(source_abs.match(/\/FHC-Core-[^\/]+\/public\//)) {
source_abs = fhcbasepath + source_abs.replace(/^.+?\/(FHC-Core-[^\/]+)\/public\//, '/public/extensions/$1/');
}
let source_rel = path.relative(path.dirname(curapp), source_abs) + '?' + buildtimestamp;
let source_rel = path.relative(path.dirname(curapp), source_abs) + '?' + buildversion;
debug && console.log('SOURCE_ABS:' + source_abs + 'APP: ' + curapp + 'SOURCE_REL: ' + source_rel);
@@ -104,12 +102,11 @@ const useplugins = [
preventAssignment: true,
'process.env.NODE_ENV': JSON.stringify( 'production' ),
}),
vue(),
babel({
babelHelpers: 'bundled',
plugins: ['transform-class-properties'],
}),
// terser()
terser()
];
export default globSync('public/**/js/apps/**/*.js', {follow: false, realpath: false}).map(file => {
+5
View File
@@ -0,0 +1,5 @@
const fhcBuildConfig = {
fhcBuildVersion: '2025102901'
}
export default fhcBuildConfig;