From 18854de6fdda754d36cbab0e7ca24e2201cd9895 Mon Sep 17 00:00:00 2001 From: Harald Bamberger Date: Thu, 30 Oct 2025 15:33:08 +0100 Subject: [PATCH] further cleanup, replace buildtimestamp with buildversion to achive deterministic builds in different runs --- rollup.README.md | 4 ++++ rollup.config.js | 19 ++++++++----------- rollup.fhcbuildconfig.js | 5 +++++ 3 files changed, 17 insertions(+), 11 deletions(-) create mode 100644 rollup.fhcbuildconfig.js diff --git a/rollup.README.md b/rollup.README.md index 6e4c8a446..86e77c538 100644 --- a/rollup.README.md +++ b/rollup.README.md @@ -20,6 +20,10 @@ einmalig: npm run build +mit debug ausgaben: + +DEBUG=true npm run build + als watch bei Änderungen: npm run watch diff --git a/rollup.config.js b/rollup.config.js index 8e58f2d04..06efb3ea4 100644 --- a/rollup.config.js +++ b/rollup.config.js @@ -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 => { diff --git a/rollup.fhcbuildconfig.js b/rollup.fhcbuildconfig.js new file mode 100644 index 000000000..8a9244f81 --- /dev/null +++ b/rollup.fhcbuildconfig.js @@ -0,0 +1,5 @@ +const fhcBuildConfig = { + fhcBuildVersion: '2025102901' +} + +export default fhcBuildConfig;