mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-11-07 08:34:29 +01:00
remove only chunks older then 2 days, to allow UI to still load them and not require a reload / F5
This commit is contained in:
parent
281e71ef71
commit
5c19e0c699
@ -11,14 +11,21 @@
|
||||
|
||||
import path from 'path';
|
||||
import babel from '@babel/core';
|
||||
import { readFileSync, readdirSync, statSync } from "fs";
|
||||
import rimraf from 'rimraf';
|
||||
import { readFileSync, readdirSync, statSync, unlinkSync } from "fs";
|
||||
//import rimraf from 'rimraf';
|
||||
import { minify } from 'terser';
|
||||
import resolve from '@rollup/plugin-node-resolve';
|
||||
|
||||
// Best practice: use this
|
||||
//rimraf.sync('./dist/');
|
||||
rimraf.sync('./chunks/');
|
||||
//rimraf.sync('./chunks/');
|
||||
|
||||
// remove only chunks older then 2 days, to allow UI to still load them and not require a reload / F5
|
||||
const rm_older = Date.now() - 48*3600000;
|
||||
readdirSync('./chunks').forEach(name => {
|
||||
const stat = statSync('./chunks/'+name);
|
||||
if (stat.atimeMs < rm_older) unlinkSync('./chunks/'+name);
|
||||
});
|
||||
|
||||
// Turn on minification
|
||||
const do_minify = true;
|
||||
|
Loading…
Reference in New Issue
Block a user