mirror of
https://github.com/vale981/tridactyl
synced 2025-03-06 10:01:39 -05:00
commit
b1bfb333b0
7 changed files with 74 additions and 766 deletions
27
package.json
27
package.json
|
@ -12,33 +12,29 @@
|
||||||
"stream": "stream-browserify"
|
"stream": "stream-browserify"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@types/css": "0.0.31",
|
"cleanslate": "^0.10.1",
|
||||||
"@types/nearley": "^2.11.1",
|
|
||||||
"command-line-args": "^5.1.1",
|
|
||||||
"csp-serdes": "github:cmcaine/csp-serdes",
|
"csp-serdes": "github:cmcaine/csp-serdes",
|
||||||
"css": "^3.0.0",
|
"css": "^3.0.0",
|
||||||
"esbuild": "^0.11.18",
|
"esbuild": "^0.11.18",
|
||||||
"fuse.js": "^6.4.6",
|
"fuse.js": "^6.4.6",
|
||||||
"jasmine-fail-fast": "^2.0.1",
|
"nearley": "^2.20.1",
|
||||||
"mark.js": "^8.11.1",
|
|
||||||
"rambda": "^6.7.0",
|
"rambda": "^6.7.0",
|
||||||
"rss-parser": "^3.12.0",
|
|
||||||
"semver-compare": "^1.0.0",
|
"semver-compare": "^1.0.0",
|
||||||
"stream-browserify": "^3.0.0",
|
"stream-browserify": "^3.0.0",
|
||||||
"tsdef": "^0.0.14",
|
"tsdef": "^0.0.14",
|
||||||
|
"typedoc": "^0.19.2",
|
||||||
"typedoc-default-themes": "^0.12.10"
|
"typedoc-default-themes": "^0.12.10"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
"@types/css": "0.0.31",
|
||||||
"@types/firefox-webext-browser": "^82.0.0",
|
"@types/firefox-webext-browser": "^82.0.0",
|
||||||
"@types/jest": "^26.0.23",
|
"@types/jest": "^26.0.23",
|
||||||
"@types/node": "^15.0.2",
|
"@types/nearley": "^2.11.1",
|
||||||
"@types/selenium-webdriver": "^4.0.12",
|
"@types/selenium-webdriver": "^4.0.12",
|
||||||
"@typescript-eslint/eslint-plugin": "^4.22.1",
|
"@typescript-eslint/eslint-plugin": "^4.22.1",
|
||||||
"@typescript-eslint/eslint-plugin-tslint": "^4.22.1",
|
"@typescript-eslint/eslint-plugin-tslint": "^4.22.1",
|
||||||
"@typescript-eslint/parser": "^4.22.1",
|
"@typescript-eslint/parser": "^4.22.1",
|
||||||
"buffer": "^6.0.3",
|
"command-line-args": "^5.1.1",
|
||||||
"cleanslate": "^0.10.1",
|
|
||||||
"copy-webpack-plugin": "^8.1.1",
|
|
||||||
"eslint": "^7.25.0",
|
"eslint": "^7.25.0",
|
||||||
"eslint-config-prettier": "^8.3.0",
|
"eslint-config-prettier": "^8.3.0",
|
||||||
"eslint-plugin-import": "^2.22.1",
|
"eslint-plugin-import": "^2.22.1",
|
||||||
|
@ -46,25 +42,18 @@
|
||||||
"eslint-plugin-prefer-arrow": "^1.2.3",
|
"eslint-plugin-prefer-arrow": "^1.2.3",
|
||||||
"eslint-plugin-sonarjs": "^0.7.0",
|
"eslint-plugin-sonarjs": "^0.7.0",
|
||||||
"geckodriver": "^1.22.3",
|
"geckodriver": "^1.22.3",
|
||||||
|
"jasmine-fail-fast": "^2.0.1",
|
||||||
"jest": "^25.5.4",
|
"jest": "^25.5.4",
|
||||||
"jest-webextension-mock": "^3.7.9",
|
"jest-webextension-mock": "^3.7.9",
|
||||||
"marked": "^2.0.3",
|
"marked": "^2.0.3",
|
||||||
"nearley": "^2.20.1",
|
|
||||||
"prettier": "^2.2.1",
|
"prettier": "^2.2.1",
|
||||||
"selenium-webdriver": "^4.0.0-beta.3",
|
"selenium-webdriver": "^4.0.0-beta.3",
|
||||||
"source-map-loader": "^2.0.1",
|
|
||||||
"ts-jest": "^25.5.1",
|
"ts-jest": "^25.5.1",
|
||||||
"ts-loader": "^9.1.1",
|
|
||||||
"ts-node": "^9.1.1",
|
|
||||||
"tsconfig-paths-webpack-plugin": "^3.5.1",
|
|
||||||
"tslint": "^5.20.1",
|
"tslint": "^5.20.1",
|
||||||
"tslint-etc": "^1.13.9",
|
"tslint-etc": "^1.13.9",
|
||||||
"tslint-sonarts": "^1.9.0",
|
"tslint-sonarts": "^1.9.0",
|
||||||
"typedoc": "^0.19.2",
|
|
||||||
"typescript": "^3.9.9",
|
"typescript": "^3.9.9",
|
||||||
"web-ext": "^6.1.0",
|
"web-ext": "^6.1.0"
|
||||||
"webpack": "^5.36.2",
|
|
||||||
"webpack-cli": "^4.6.0"
|
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "sh scripts/build.sh",
|
"build": "sh scripts/build.sh",
|
||||||
|
|
|
@ -69,17 +69,31 @@ if [ "$QUICK_BUILD" != "1" ]; then
|
||||||
scripts/make_tutorial.sh
|
scripts/make_tutorial.sh
|
||||||
scripts/make_docs.sh
|
scripts/make_docs.sh
|
||||||
|
|
||||||
webpack --stats errors-only --bail
|
tsc --project tsconfig.json --noEmit
|
||||||
else
|
else
|
||||||
|
|
||||||
echo "Warning: dirty rebuild. Skipping docs, metadata and type checking..."
|
echo "Warning: dirty rebuild. Skipping docs, metadata and type checking..."
|
||||||
mkdir -p buildtemp
|
|
||||||
node scripts/esbuild.js
|
|
||||||
mv buildtemp/* build/
|
|
||||||
rmdir buildtemp
|
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Actually build the thing
|
||||||
|
|
||||||
|
mkdir -p buildtemp
|
||||||
|
node scripts/esbuild.js
|
||||||
|
mv buildtemp/* build/
|
||||||
|
rmdir buildtemp
|
||||||
|
|
||||||
|
# Copy extra static files across
|
||||||
|
|
||||||
|
cp src/manifest.json build/
|
||||||
|
cp -r src/static build
|
||||||
|
cp -r generated/static build
|
||||||
|
cp issue_template.md build/
|
||||||
|
|
||||||
|
# Remove large unused files
|
||||||
|
|
||||||
|
rm build/static/logo/Tridactyl.psd
|
||||||
|
rm build/static/logo/Tridactyl_1024px.png
|
||||||
|
|
||||||
# "temporary" fix until we can install new native on CI: install the old native messenger
|
# "temporary" fix until we can install new native on CI: install the old native messenger
|
||||||
if [ "$OLD_NATIVE" = "1" ]; then
|
if [ "$OLD_NATIVE" = "1" ]; then
|
||||||
|
|
|
@ -144,7 +144,6 @@ import * as messaging from "@src/lib/messaging"
|
||||||
import state from "@src/state"
|
import state from "@src/state"
|
||||||
import * as State from "@src/state"
|
import * as State from "@src/state"
|
||||||
import * as webext from "@src/lib/webext"
|
import * as webext from "@src/lib/webext"
|
||||||
import Mark from "mark.js"
|
|
||||||
import * as perf from "@src/perf"
|
import * as perf from "@src/perf"
|
||||||
import * as keyseq from "@src/lib/keyseq"
|
import * as keyseq from "@src/lib/keyseq"
|
||||||
import * as native from "@src/lib/native"
|
import * as native from "@src/lib/native"
|
||||||
|
@ -170,7 +169,6 @@ import * as metadata from "@src/.metadata.generated"
|
||||||
hinting_content,
|
hinting_content,
|
||||||
itertools,
|
itertools,
|
||||||
logger,
|
logger,
|
||||||
Mark,
|
|
||||||
metadata,
|
metadata,
|
||||||
keyseq,
|
keyseq,
|
||||||
messaging,
|
messaging,
|
||||||
|
|
|
@ -1049,7 +1049,7 @@ export function addJump() {
|
||||||
// Prevent pending jump from being registered
|
// Prevent pending jump from being registered
|
||||||
clearTimeout(JUMP_TIMEOUTID)
|
clearTimeout(JUMP_TIMEOUTID)
|
||||||
// Schedule the registering of the current jump
|
// Schedule the registering of the current jump
|
||||||
const localTimeoutID = setTimeout(async () => {
|
const localTimeoutID = window.setTimeout(async () => {
|
||||||
// Get config for current page
|
// Get config for current page
|
||||||
const alljumps = await curJumps()
|
const alljumps = await curJumps()
|
||||||
// if this handler was cancelled after the call to curJumps(), bail out
|
// if this handler was cancelled after the call to curJumps(), bail out
|
||||||
|
@ -5080,7 +5080,13 @@ export async function issue() {
|
||||||
//#background
|
//#background
|
||||||
export async function updatecheck(source: "manual" | "auto_polite" | "auto_impolite" = "manual") {
|
export async function updatecheck(source: "manual" | "auto_polite" | "auto_impolite" = "manual") {
|
||||||
const forceCheck = source == "manual"
|
const forceCheck = source == "manual"
|
||||||
const highestKnownVersion = await Updates.getLatestVersion(forceCheck)
|
|
||||||
|
// Skip check unless it's due or forced
|
||||||
|
if (!(forceCheck || Updates.secondsSinceLastCheck() > config.get("update", "checkintervalsecs"))) {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
const highestKnownVersion = await Updates.getLatestVersion()
|
||||||
if (!highestKnownVersion) {
|
if (!highestKnownVersion) {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,7 +6,6 @@
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import Parser from "rss-parser"
|
|
||||||
import SemverCompare from "semver-compare"
|
import 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"
|
||||||
|
@ -21,47 +20,39 @@ interface TriVersionFeedItem {
|
||||||
version: string
|
version: string
|
||||||
}
|
}
|
||||||
|
|
||||||
// initialize to beginning of time to cause a check on startup
|
export function secondsSinceLastCheck() {
|
||||||
let highestKnownVersion: TriVersionFeedItem
|
|
||||||
|
|
||||||
function secondsSinceLastCheck() {
|
|
||||||
const lastCheck = Config.get("update", "lastchecktime")
|
const lastCheck = Config.get("update", "lastchecktime")
|
||||||
return (Date.now() - lastCheck) / 1000
|
return (Date.now() - lastCheck) / 1000
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get the latest version, with a bit of a cache. This will return
|
// Ask GitHub what the latest version is
|
||||||
// immediately if we've already recently checked for an update, so it
|
// Uncached so don't run this often
|
||||||
// should be safe to invoke it relatively frequently.
|
export async function getLatestVersion() {
|
||||||
export async function getLatestVersion(force_check = false) {
|
|
||||||
const pastUpdateInterval =
|
|
||||||
secondsSinceLastCheck() > Config.get("update", "checkintervalsecs")
|
|
||||||
if (force_check || pastUpdateInterval) {
|
|
||||||
await updateVersion()
|
|
||||||
}
|
|
||||||
|
|
||||||
return highestKnownVersion
|
|
||||||
}
|
|
||||||
|
|
||||||
async function updateVersion() {
|
|
||||||
try {
|
try {
|
||||||
// If any monster any makes a novelty tag this will break.
|
// If any monster any makes a novelty tag this will break.
|
||||||
// So let's just ignore any errors.
|
// So let's just ignore any errors.
|
||||||
const parser = new Parser()
|
const feed = new DOMParser().parseFromString(
|
||||||
const feed = await parser.parseURL(
|
await (
|
||||||
"https://github.com/tridactyl/tridactyl/tags.atom",
|
await fetch("https://github.com/tridactyl/tridactyl/tags.atom")
|
||||||
|
).text(),
|
||||||
|
"application/xml",
|
||||||
)
|
)
|
||||||
const mostRecent = feed.items[0]
|
const mostRecent = feed.querySelectorAll("entry")[0]
|
||||||
|
|
||||||
// Update our last update check timestamp and the version itself.
|
// Update our last update check timestamp and the version itself.
|
||||||
Config.set("update", "lastchecktime", Date.now())
|
Config.set("update", "lastchecktime", Date.now())
|
||||||
highestKnownVersion = {
|
const highestKnownVersion = {
|
||||||
version: mostRecent.title,
|
version: mostRecent.querySelector("title").textContent,
|
||||||
releaseDate: new Date(mostRecent.pubDate), // e.g. 2018-12-04T15:24:43.000Z
|
releaseDate: new Date(
|
||||||
|
mostRecent.querySelector("updated").textContent,
|
||||||
|
), // e.g. 2018-12-04T15:24:43.000Z
|
||||||
}
|
}
|
||||||
logger.debug(
|
logger.debug(
|
||||||
"Checked for new version of Tridactyl, found ",
|
"Checked for new version of Tridactyl, found ",
|
||||||
highestKnownVersion,
|
highestKnownVersion,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
return highestKnownVersion
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
logger.error("Error while checking for updates: ", e)
|
logger.error("Error while checking for updates: ", e)
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,71 +0,0 @@
|
||||||
const TsconfigPathsPlugin = require("tsconfig-paths-webpack-plugin")
|
|
||||||
const CopyWebPackPlugin = require("copy-webpack-plugin")
|
|
||||||
|
|
||||||
const fileExtensions = [".ts", ".tsx", ".js", ".json"]
|
|
||||||
|
|
||||||
module.exports = function(env, argv) {
|
|
||||||
return {
|
|
||||||
|
|
||||||
mode: "development",
|
|
||||||
// mode: "production", // Uncomment me for less helpful error messages
|
|
||||||
|
|
||||||
// Enable sourcemaps for debugging webpack's output.
|
|
||||||
devtool: "source-map",
|
|
||||||
// devtool: "inline-source-map", // Uncomment me for more helpful error messages
|
|
||||||
|
|
||||||
// NB: duplicate these files in scripts/esbuild.js
|
|
||||||
entry: {
|
|
||||||
background: "./src/background.ts",
|
|
||||||
content: "./src/content.ts",
|
|
||||||
commandline_frame: "./src/commandline_frame.ts",
|
|
||||||
help: "./src/help.ts",
|
|
||||||
newtab: "./src/newtab.ts",
|
|
||||||
},
|
|
||||||
output: {
|
|
||||||
filename: "[name].js",
|
|
||||||
path: __dirname + "/build",
|
|
||||||
},
|
|
||||||
|
|
||||||
|
|
||||||
resolve: {
|
|
||||||
// Add '.ts' and '.tsx' as resolvable extensions.
|
|
||||||
extensions: fileExtensions,
|
|
||||||
plugins: [new TsconfigPathsPlugin({extensions: fileExtensions})],
|
|
||||||
// NB: items below also need to be added to the package.json "browser" field
|
|
||||||
// or quick builds won't work
|
|
||||||
fallback: {
|
|
||||||
"url": false,
|
|
||||||
"fs": false,
|
|
||||||
"https": false,
|
|
||||||
"http": false,
|
|
||||||
"path": false,
|
|
||||||
"timers": false,
|
|
||||||
"stream": require.resolve("stream-browserify"),
|
|
||||||
},
|
|
||||||
},
|
|
||||||
|
|
||||||
module: {
|
|
||||||
rules: [
|
|
||||||
{ test: /\.ts?$/, loader: "ts-loader" },
|
|
||||||
|
|
||||||
// All output '.js' files will have any sourcemaps re-processed by 'source-map-loader'.
|
|
||||||
{ enforce: "pre", test: /\.js$/, loader: "source-map-loader" },
|
|
||||||
],
|
|
||||||
},
|
|
||||||
|
|
||||||
plugins: [
|
|
||||||
new CopyWebPackPlugin({patterns: [
|
|
||||||
{ from: "src/manifest.json" },
|
|
||||||
{
|
|
||||||
from: "src/static",
|
|
||||||
to: "static",
|
|
||||||
globOptions: {
|
|
||||||
ignore: ["**/*.psd", "**/*1024px.png"],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{ from: "generated/static", to: "static" },
|
|
||||||
{ from: "issue_template.md" },
|
|
||||||
]}),
|
|
||||||
],
|
|
||||||
}
|
|
||||||
}
|
|
Loading…
Add table
Reference in a new issue