diff options
| author | Andrew Dolgov <fox@fakecake.org> | 2026-06-18 14:26:39 +0300 |
|---|---|---|
| committer | Andrew Dolgov <fox@fakecake.org> | 2026-06-18 14:26:39 +0300 |
| commit | aaa40a97005a6323710ad3823532d56b668dd837 (patch) | |
| tree | 414e450fb2de04224554a38ab9ada6f8e11ab1ff | |
| parent | f0b78f6562d109c1f1c76d8bd864ef9a7b1d8852 (diff) | |
| download | the-epube-aaa40a97005a6323710ad3823532d56b668dd837.tar.gz the-epube-aaa40a97005a6323710ad3823532d56b668dd837.tar.xz | |
cleanup old timestamped files on build
| -rw-r--r-- | build.js | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/build.js b/build.js index 3a5f6f8..a2eb419 100644 --- a/build.js +++ b/build.js @@ -1,7 +1,7 @@ #!/usr/bin/env node import * as esbuild from 'esbuild'; -import { copyFileSync, readFileSync } from 'fs'; +import { copyFileSync, readFileSync, unlinkSync } from 'fs'; import { writeFile } from 'fs/promises'; import { globSync } from 'glob'; import less from 'less'; @@ -98,6 +98,12 @@ async function buildApp() { console.log('creating timestamped js files...'); + // remove stale timestamped files from previous builds + const oldVersioned = globSync('dist/*_v[0-9]*'); + for (const f of oldVersioned) { + try { unlinkSync(f); } catch { /* ignore */ } + } + // also create suffixed filenames for our worker to determine proper replica (a pseudo-atomic build) const builtFiles = globSync('dist/**/*.js'); for (const file of builtFiles) { |
