-
-
Notifications
You must be signed in to change notification settings - Fork 44
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
54 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
# scripts | ||
|
||
## update-version | ||
|
||
```bash | ||
export TARGET_VERSION=<version> | ||
./scripts/update-version.js | ||
git commit -am "release: v${TARGET_VERSION}" | ||
git tag v${TARGET_VERSION} | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
#!/usr/bin/env node | ||
|
||
const path = require('path') | ||
const fs = require('fs') | ||
const assert = require('assert') | ||
const { execSync } = require('child_process') | ||
const plist = require('plist') | ||
|
||
const targetVersion = process.env.TARGET_VERSION | ||
assert(targetVersion, 'specify TARGET_VERSION envvar') | ||
|
||
// rewrite `docs/manifest.plist` | ||
const manifestPath = path.resolve(__dirname, '../docs/manifest.plist') | ||
console.log(`rewriting '${manifestPath}'`) | ||
const manifest = plist.parse(fs.readFileSync(manifestPath, 'utf8')) | ||
manifest['Extension Updates'][0]['CFBundleVersion'] = targetVersion | ||
manifest['Extension Updates'][0]['CFBundleShortVersionString'] = targetVersion | ||
manifest['Extension Updates'][0][ | ||
'URL' | ||
] = `https://github.com/uetchy/Polyglot/releases/download/v${targetVersion}/Polyglot.safariextz` | ||
fs.writeFileSync(manifestPath, plist.build(manifest)) | ||
|
||
// rewrite `Polyglot.safariextension/Info.plist` | ||
const infoPath = path.resolve( | ||
__dirname, | ||
'../Polyglot.safariextension/Info.plist' | ||
) | ||
console.log(`rewriting '${infoPath}'`) | ||
const info = plist.parse(fs.readFileSync(infoPath, 'utf8')) | ||
info['CFBundleShortVersionString'] = targetVersion | ||
info['CFBundleVersion'] = targetVersion | ||
fs.writeFileSync(infoPath, plist.build(info)) | ||
|
||
// rewrite `package.json` | ||
const packagePath = path.resolve(__dirname, '../package.json') | ||
console.log(`rewriting '${packagePath}'`) | ||
const package = require(packagePath) | ||
package.version = targetVersion | ||
fs.writeFileSync(packagePath, JSON.stringify(package, null, 2)) | ||
|
||
// postprocess | ||
console.log(String(execSync('fixpack'))) | ||
console.log(String(execSync('yarn'))) |