mirror of
https://github.com/Einundzwanzig-Podcast/einundzwanzig.space.git
synced 2025-12-13 16:26:50 +00:00
Update dependencies
This commit is contained in:
18
tasks/replace_revs.mjs
Normal file
18
tasks/replace_revs.mjs
Normal file
@@ -0,0 +1,18 @@
|
||||
import { resolve } from 'path'
|
||||
import { replaceInFileSync } from 'replace-in-file'
|
||||
import rev from '../generated/rev.json' with { type: 'json' }
|
||||
|
||||
const { dirname } = import.meta
|
||||
const options = {
|
||||
files: [resolve(dirname, '../dist/**/*.xml'), resolve(dirname, '../dist/**/*.html')],
|
||||
from: Object.keys(rev).map(key => new RegExp(key, 'g')),
|
||||
to: Object.values(rev)
|
||||
}
|
||||
|
||||
try {
|
||||
const results = replaceInFileSync(options)
|
||||
console.log('Replacement results:', results.filter(result => result.hasChanged).length, 'files changed')
|
||||
}
|
||||
catch (error) {
|
||||
console.error('Replacement error occurred:', error)
|
||||
}
|
||||
Reference in New Issue
Block a user