mirror of
https://github.com/vale981/tridactyl
synced 2025-03-06 01:51:40 -05:00
Fix #2262: make version number more reliable
This commit is contained in:
parent
3dc1c7b6e1
commit
42a7ac336c
9 changed files with 42 additions and 28 deletions
|
@ -64,8 +64,7 @@ if [ "$1" != "--no-native" ]; then
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
(webpack --display errors-only --bail\
|
webpack --display errors-only --bail
|
||||||
&& scripts/git_version.sh)
|
|
||||||
|
|
||||||
scripts/bodgecss.sh
|
scripts/bodgecss.sh
|
||||||
scripts/authors.sh
|
scripts/authors.sh
|
||||||
|
|
|
@ -1,14 +0,0 @@
|
||||||
#!/usr/bin/env sh
|
|
||||||
|
|
||||||
gitversion=pre$(git rev-list --count HEAD)-$(git rev-parse --short HEAD)
|
|
||||||
if grep -Fq 'tridactyl.vim@cmcaine' ./src/manifest.json ; then
|
|
||||||
gitversion=""
|
|
||||||
fi
|
|
||||||
manversion=$(grep '"version":' ./src/manifest.json | cut -d":" -f2 | tr -d \" | tr -d , | cut -d" " -f2)
|
|
||||||
version=$manversion$gitversion
|
|
||||||
|
|
||||||
sed -i.bak 's/REPLACE_ME_WITH_THE_VERSION_USING_SED/'"$version"'/' ./build/background.js
|
|
||||||
sed -i.bak 's/REPLACE_ME_WITH_THE_VERSION_USING_SED/'"$version"'/' ./build/content.js
|
|
||||||
sed -i.bak 's/REPLACE_ME_WITH_THE_VERSION_USING_SED/'"$version"'/' ./build/static/newtab.html
|
|
||||||
rm ./build/background.js.bak
|
|
||||||
rm ./build/static/newtab.html.bak
|
|
|
@ -20,6 +20,15 @@ async function add_beta(versionstr) {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async function get_hash() {
|
||||||
|
return new Promise((resolve, err) => {
|
||||||
|
exec("git rev-parse --short HEAD", (execerr, stdout, stderr) => {
|
||||||
|
if (execerr) err(execerr)
|
||||||
|
resolve(stdout.trim())
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
function make_update_json(versionstr) {
|
function make_update_json(versionstr) {
|
||||||
return {
|
return {
|
||||||
addons: {
|
addons: {
|
||||||
|
@ -66,6 +75,7 @@ async function main() {
|
||||||
manifest.version,
|
manifest.version,
|
||||||
Number(process.argv[3]),
|
Number(process.argv[3]),
|
||||||
)
|
)
|
||||||
|
manifest.version_name = manifest.version
|
||||||
save_manifest(filename, manifest)
|
save_manifest(filename, manifest)
|
||||||
exec(
|
exec(
|
||||||
`git add ${filename} && git commit -m 'release ${
|
`git add ${filename} && git commit -m 'release ${
|
||||||
|
@ -81,14 +91,19 @@ async function main() {
|
||||||
filename = "./build/manifest.json"
|
filename = "./build/manifest.json"
|
||||||
manifest = require("." + filename)
|
manifest = require("." + filename)
|
||||||
manifest.version = await add_beta(manifest.version)
|
manifest.version = await add_beta(manifest.version)
|
||||||
|
manifest.version_name = manifest.version + "-" + (await get_hash())
|
||||||
manifest.applications.gecko.update_url =
|
manifest.applications.gecko.update_url =
|
||||||
"https://tridactyl.cmcaine.co.uk/betas/updates.json"
|
"https://tridactyl.cmcaine.co.uk/betas/updates.json"
|
||||||
|
|
||||||
|
try {
|
||||||
// Make and write updates.json
|
// Make and write updates.json
|
||||||
save_manifest(
|
save_manifest(
|
||||||
"../../public_html/betas/updates.json",
|
"../../public_html/betas/updates.json",
|
||||||
make_update_json(manifest.version),
|
make_update_json(manifest.version),
|
||||||
)
|
)
|
||||||
|
} catch(e) {
|
||||||
|
console.warn("updates.json wasn't updated: " + e)
|
||||||
|
}
|
||||||
|
|
||||||
// Save manifest.json
|
// Save manifest.json
|
||||||
save_manifest(filename, manifest)
|
save_manifest(filename, manifest)
|
||||||
|
|
|
@ -74,7 +74,7 @@
|
||||||
|
|
||||||
// Shared
|
// Shared
|
||||||
import * as Messaging from "@src/lib/messaging"
|
import * as Messaging from "@src/lib/messaging"
|
||||||
import { browserBg, activeTab, activeTabId, activeTabContainerId, openInNewTab, openInNewWindow, openInTab, queryAndURLwrangler } from "@src/lib/webext"
|
import { getTriVersion, browserBg, activeTab, activeTabId, activeTabContainerId, openInNewTab, openInNewWindow, openInTab, queryAndURLwrangler } from "@src/lib/webext"
|
||||||
import * as Container from "@src/lib/containers"
|
import * as Container from "@src/lib/containers"
|
||||||
import state from "@src/state"
|
import state from "@src/state"
|
||||||
import { contentState, ModeName } from "@src/content/state_content"
|
import { contentState, ModeName } from "@src/content/state_content"
|
||||||
|
@ -117,7 +117,7 @@ export const cmd_params = new Map<string, Map<string, string>>()
|
||||||
const logger = new Logging.Logger("excmds")
|
const logger = new Logging.Logger("excmds")
|
||||||
|
|
||||||
/** @hidden **/
|
/** @hidden **/
|
||||||
const TRI_VERSION = "REPLACE_ME_WITH_THE_VERSION_USING_SED"
|
const TRI_VERSION = getTriVersion()
|
||||||
|
|
||||||
//#content_helper
|
//#content_helper
|
||||||
// {
|
// {
|
||||||
|
|
|
@ -10,10 +10,11 @@ import * as RssParser from "rss-parser"
|
||||||
import * as SemverCompare from "semver-compare"
|
import * as SemverCompare from "semver-compare"
|
||||||
import * as Config from "@src/lib/config"
|
import * as Config from "@src/lib/config"
|
||||||
import * as Logging from "@src/lib/logging"
|
import * as Logging from "@src/lib/logging"
|
||||||
|
import { getTriVersion } from "@src/lib/webext"
|
||||||
|
|
||||||
const logger = new Logging.Logger("updates")
|
const logger = new Logging.Logger("updates")
|
||||||
|
|
||||||
const TRI_VERSION = "REPLACE_ME_WITH_THE_VERSION_USING_SED"
|
const TRI_VERSION = getTriVersion()
|
||||||
|
|
||||||
interface TriVersionFeedItem {
|
interface TriVersionFeedItem {
|
||||||
releaseDate: Date
|
releaseDate: Date
|
||||||
|
|
|
@ -7,6 +7,16 @@ export function inContentScript() {
|
||||||
return getContext() === "content"
|
return getContext() === "content"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function getTriVersion() {
|
||||||
|
const manifest = browser.runtime.getManifest()
|
||||||
|
return manifest.version_name
|
||||||
|
}
|
||||||
|
|
||||||
|
export function getPrettyTriVersion() {
|
||||||
|
const manifest = browser.runtime.getManifest()
|
||||||
|
return manifest.name + " " + getTriVersion()
|
||||||
|
}
|
||||||
|
|
||||||
export function notBackground() {
|
export function notBackground() {
|
||||||
return getContext() !== "background"
|
return getContext() !== "background"
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
import * as Messaging from "@src/lib/messaging"
|
import * as Messaging from "@src/lib/messaging"
|
||||||
import * as config from "@src/lib/config"
|
import * as config from "@src/lib/config"
|
||||||
|
import { getPrettyTriVersion } from "@src/lib/webext"
|
||||||
|
|
||||||
// These functions work with the elements created by tridactyl/scripts/newtab.md.sh
|
// These functions work with the elements created by tridactyl/scripts/newtab.md.sh
|
||||||
function getChangelogDiv() {
|
function getChangelogDiv() {
|
||||||
|
@ -52,3 +53,7 @@ window.addEventListener("load", _ => {
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
document.getElementById(
|
||||||
|
"tridactyl-version-number",
|
||||||
|
).textContent = getPrettyTriVersion()
|
||||||
|
|
|
@ -1,7 +1,3 @@
|
||||||

|
|
||||||
|
|
||||||
# Tridactyl REPLACE_ME_WITH_THE_VERSION_USING_SED
|
|
||||||
|
|
||||||
Tridactyl has to override your new tab page due to WebExtension limitations. You can learn how to change it at the bottom of the page, otherwise please read on for some tips and tricks.
|
Tridactyl has to override your new tab page due to WebExtension limitations. You can learn how to change it at the bottom of the page, otherwise please read on for some tips and tricks.
|
||||||
|
|
||||||
- _Breaking change_: Tridactyl no longer tries to keep its configuration in sync automatically with the Firefox Sync storage. The `storageloc` setting has been removed. If you wish to synchronise your configurations, you can use the new `:firefoxsync{push,pull}` manually.
|
- _Breaking change_: Tridactyl no longer tries to keep its configuration in sync automatically with the Firefox Sync storage. The `storageloc` setting has been removed. If you wish to synchronise your configurations, you can use the new `:firefoxsync{push,pull}` manually.
|
||||||
|
|
|
@ -10,6 +10,8 @@
|
||||||
<link rel="shortcut icon" href="logo/Tridactyl_64px.png">
|
<link rel="shortcut icon" href="logo/Tridactyl_64px.png">
|
||||||
</head>
|
</head>
|
||||||
<body style="opacity: 0; height: 0px; overflow: hidden;">
|
<body style="opacity: 0; height: 0px; overflow: hidden;">
|
||||||
|
<img src="logo/Tridactyl_100px.png" alt="Tridactyl logo">
|
||||||
|
<h1 id="tridactyl-version-number">Tridactyl</h1>
|
||||||
REPLACETHIS
|
REPLACETHIS
|
||||||
</body>
|
</body>
|
||||||
<script src="../content.js"></script>
|
<script src="../content.js"></script>
|
||||||
|
|
Loading…
Add table
Reference in a new issue