You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
This repo is archived. You can view files and clone it, but cannot push or open issues/pull-requests.

61 lines
1.3 KiB

const fs = require('fs')
const Zip = require('adm-zip')
const currentVersion = JSON.parse(fs.readFileSync('./src/package.json')).version
const version = process.argv[2]
if (!version) {
// eslint-disable-next-line no-console
console.error(
`No version number specified. Current version is ${currentVersion}.`
)
process.exit(1)
}
;[
'./src/package.json',
'./src/drivers/npm/package.json',
'./src/drivers/webextension/manifest-v2.json',
'./src/drivers/webextension/manifest-v3.json',
].forEach((file) => {
const json = JSON.parse(fs.readFileSync(file))
json.version = version
fs.writeFileSync(file, JSON.stringify(json, null, 2))
})
fs.copyFileSync(
`./src/drivers/webextension/manifest.json`,
'./src/drivers/webextension/manifest.bak.json'
)
fs.copyFileSync(
`./src/drivers/webextension/manifest-v2.json`,
'./src/drivers/webextension/manifest.json'
)
let zip = new Zip()
zip.addLocalFolder('./src/drivers/webextension', '')
zip.writeZip('./build/webextension-v2.zip')
fs.copyFileSync(
`./src/drivers/webextension/manifest-v3.json`,
'./src/drivers/webextension/manifest.json'
)
zip = new Zip()
zip.addLocalFolder('./src/drivers/webextension', '')
zip.writeZip('./build/webextension-v3.zip')
fs.copyFileSync(
`./src/drivers/webextension/manifest.bak.json`,
'./src/drivers/webextension/manifest.json'
)