mirror of
https://github.com/unraid/api.git
synced 2026-03-09 11:40:00 -05:00
feat: postbuild script to add timestamp to web component manifest
This commit is contained in:
15
web/scripts/add-timestamp-webcomponent-manifest.js
Normal file
15
web/scripts/add-timestamp-webcomponent-manifest.js
Normal file
@@ -0,0 +1,15 @@
|
||||
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
||||
const fs = require('fs');
|
||||
|
||||
// Read the JSON file
|
||||
const filePath = '../web/.nuxt/nuxt-custom-elements/dist/unraid-components/manifest.json';
|
||||
const jsonData = JSON.parse(fs.readFileSync(filePath, 'utf-8'));
|
||||
|
||||
// Add timestamp (ts) to the JSON data
|
||||
const timestamp = Math.floor(new Date().getTime() / 1000); // Current timestamp epoch
|
||||
jsonData.ts = timestamp;
|
||||
|
||||
// Write the updated JSON back to the file
|
||||
fs.writeFileSync(filePath, JSON.stringify(jsonData, null, 2));
|
||||
|
||||
console.log(`Timestamp: ${timestamp} added to the web component manifest.`);
|
||||
Reference in New Issue
Block a user