diff --git a/web/package.json b/web/package.json index b7161ae42..5b27495c7 100644 --- a/web/package.json +++ b/web/package.json @@ -5,11 +5,12 @@ "dev": "nuxt dev", "lint": "eslint . --ext .vue,.js,.jsx,.cjs,.mjs,.ts,.tsx,.cts,.mts --fix", "type-check": "nuxi typecheck", - "build:dev": "npm run lint && npm run type-check && nuxt build && npm run deploy-wc:dev", - "build:webgui": "npm run lint && npm run type-check && nuxt build && npm run copy-to-webgui-repo", - "build": "npm run type-check && nuxt build", + "build:dev": "npm run lint && npm run type-check && nuxt build && npm run manifest-ts && npm run deploy-wc:dev", + "build:webgui": "npm run lint && npm run type-check && nuxt build && npm run manifest-ts && npm run copy-to-webgui-repo", + "build": "npm run type-check && nuxt build && npm run manifest-ts", "deploy-wc:dev": "./scripts/deploy-dev.sh", "copy-to-webgui-repo": "./scripts/copy-to-webgui-repo.sh", + "manifest-ts": "node ./scripts/add-timestamp-webcomponent-manifest.js", "generate": "nuxt generate", "preview": "nuxt preview", "postinstall": "nuxt prepare", diff --git a/web/scripts/add-timestamp-webcomponent-manifest.js b/web/scripts/add-timestamp-webcomponent-manifest.js new file mode 100644 index 000000000..16a21ce38 --- /dev/null +++ b/web/scripts/add-timestamp-webcomponent-manifest.js @@ -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.`);