mirror of
https://github.com/tridactyl/tridactyl.git
synced 2026-09-10 07:16:33 -04:00
Generate manifest to share min version
This commit is contained in:
parent
a696038929
commit
8d18f541bc
13
browser-targets.json
Normal file
13
browser-targets.json
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
{
|
||||
"firefox": {
|
||||
"minimumVersion": "91.1.0",
|
||||
"manifestVersionPath": [
|
||||
"applications",
|
||||
"gecko",
|
||||
"strict_min_version"
|
||||
]
|
||||
},
|
||||
"chrome": {
|
||||
"minimumVersion": "114"
|
||||
}
|
||||
}
|
||||
|
|
@ -85,7 +85,7 @@ rmdir buildtemp
|
|||
|
||||
# Copy extra static files across
|
||||
|
||||
cp src/manifest.json build/
|
||||
node scripts/generate_manifest.js firefox src/manifest.json build/manifest.json
|
||||
cp -r src/static build
|
||||
cp -r generated/static build
|
||||
cp issue_template.md build/
|
||||
|
|
|
|||
30
scripts/generate_manifest.js
Normal file
30
scripts/generate_manifest.js
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
#!/usr/bin/env node
|
||||
|
||||
const fs = require("fs")
|
||||
const targets = require("../browser-targets.json")
|
||||
|
||||
function generateManifest(template, targetName) {
|
||||
const target = targets[targetName]
|
||||
if (!target || !target.manifestVersionPath) {
|
||||
throw new Error(`No manifest settings for ${targetName}`)
|
||||
}
|
||||
|
||||
const manifest = JSON.parse(JSON.stringify(template))
|
||||
const path = target.manifestVersionPath.slice()
|
||||
const property = path.pop()
|
||||
const parent = path.reduce((value, name) => {
|
||||
if (!value[name]) value[name] = {}
|
||||
return value[name]
|
||||
}, manifest)
|
||||
parent[property] = target.minimumVersion
|
||||
return manifest
|
||||
}
|
||||
|
||||
if (require.main === module) {
|
||||
const [targetName, source, destination] = process.argv.slice(2)
|
||||
const template = JSON.parse(fs.readFileSync(source, "utf8"))
|
||||
const manifest = generateManifest(template, targetName)
|
||||
fs.writeFileSync(destination, JSON.stringify(manifest, null, 4) + "\n")
|
||||
}
|
||||
|
||||
module.exports = generateManifest
|
||||
|
|
@ -139,8 +139,7 @@
|
|||
],
|
||||
"applications": {
|
||||
"gecko": {
|
||||
"id": "tridactyl.vim.betas@cmcaine.co.uk",
|
||||
"strict_min_version": "91.1.0"
|
||||
"id": "tridactyl.vim.betas@cmcaine.co.uk"
|
||||
}
|
||||
},
|
||||
"options_ui": {
|
||||
|
|
@ -161,4 +160,4 @@
|
|||
"omnibox": {
|
||||
"keyword": "tri"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue