-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathfix-manifest.js
More file actions
27 lines (25 loc) · 894 Bytes
/
fix-manifest.js
File metadata and controls
27 lines (25 loc) · 894 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
const fs = require("fs")
let dir = `${process.cwd()}/dist/_nuxt/`
const purpose = ["any", "maskable"]
fs.readdir(dir, (err, files) => {
if (err) console.log("error: " + err)
else
files.forEach((file) => {
if (file.includes("manifest")) {
console.log(`Manifest File Name: ${file}`)
const manifestPath = `${process.cwd()}/dist/_nuxt/${file}`
let manifest = fs.readFileSync(manifestPath, "utf8")
console.log("BEFORE EDITING")
console.log(manifest)
let manifestObj = JSON.parse(manifest)
manifestObj.icons.forEach((icon) => {
icon.purpose = purpose.join(" ")
})
manifest = JSON.stringify(manifestObj)
fs.writeFileSync(manifestPath, manifest, "utf8")
manifest = fs.readFileSync(manifestPath, "utf8")
console.log("AFTER EDITING")
console.log(manifest)
}
})
})