mirror of
https://github.com/vale981/tridactyl
synced 2025-03-05 09:31:41 -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"
|
||||
},
|
||||
"dependencies": {
|
||||
"@types/css": "0.0.31",
|
||||
"@types/nearley": "^2.11.1",
|
||||
"command-line-args": "^5.1.1",
|
||||
"cleanslate": "^0.10.1",
|
||||
"csp-serdes": "github:cmcaine/csp-serdes",
|
||||
"css": "^3.0.0",
|
||||
"esbuild": "^0.11.18",
|
||||
"fuse.js": "^6.4.6",
|
||||
"jasmine-fail-fast": "^2.0.1",
|
||||
"mark.js": "^8.11.1",
|
||||
"nearley": "^2.20.1",
|
||||
"rambda": "^6.7.0",
|
||||
"rss-parser": "^3.12.0",
|
||||
"semver-compare": "^1.0.0",
|
||||
"stream-browserify": "^3.0.0",
|
||||
"tsdef": "^0.0.14",
|
||||
"typedoc": "^0.19.2",
|
||||
"typedoc-default-themes": "^0.12.10"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/css": "0.0.31",
|
||||
"@types/firefox-webext-browser": "^82.0.0",
|
||||
"@types/jest": "^26.0.23",
|
||||
"@types/node": "^15.0.2",
|
||||
"@types/nearley": "^2.11.1",
|
||||
"@types/selenium-webdriver": "^4.0.12",
|
||||
"@typescript-eslint/eslint-plugin": "^4.22.1",
|
||||
"@typescript-eslint/eslint-plugin-tslint": "^4.22.1",
|
||||
"@typescript-eslint/parser": "^4.22.1",
|
||||
"buffer": "^6.0.3",
|
||||
"cleanslate": "^0.10.1",
|
||||
"copy-webpack-plugin": "^8.1.1",
|
||||
"command-line-args": "^5.1.1",
|
||||
"eslint": "^7.25.0",
|
||||
"eslint-config-prettier": "^8.3.0",
|
||||
"eslint-plugin-import": "^2.22.1",
|
||||
|
@ -46,25 +42,18 @@
|
|||
"eslint-plugin-prefer-arrow": "^1.2.3",
|
||||
"eslint-plugin-sonarjs": "^0.7.0",
|
||||
"geckodriver": "^1.22.3",
|
||||
"jasmine-fail-fast": "^2.0.1",
|
||||
"jest": "^25.5.4",
|
||||
"jest-webextension-mock": "^3.7.9",
|
||||
"marked": "^2.0.3",
|
||||
"nearley": "^2.20.1",
|
||||
"prettier": "^2.2.1",
|
||||
"selenium-webdriver": "^4.0.0-beta.3",
|
||||
"source-map-loader": "^2.0.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-etc": "^1.13.9",
|
||||
"tslint-sonarts": "^1.9.0",
|
||||
"typedoc": "^0.19.2",
|
||||
"typescript": "^3.9.9",
|
||||
"web-ext": "^6.1.0",
|
||||
"webpack": "^5.36.2",
|
||||
"webpack-cli": "^4.6.0"
|
||||
"web-ext": "^6.1.0"
|
||||
},
|
||||
"scripts": {
|
||||
"build": "sh scripts/build.sh",
|
||||
|
|
|
@ -69,17 +69,31 @@ if [ "$QUICK_BUILD" != "1" ]; then
|
|||
scripts/make_tutorial.sh
|
||||
scripts/make_docs.sh
|
||||
|
||||
webpack --stats errors-only --bail
|
||||
tsc --project tsconfig.json --noEmit
|
||||
else
|
||||
|
||||
echo "Warning: dirty rebuild. Skipping docs, metadata and type checking..."
|
||||
mkdir -p buildtemp
|
||||
node scripts/esbuild.js
|
||||
mv buildtemp/* build/
|
||||
rmdir buildtemp
|
||||
|
||||
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
|
||||
if [ "$OLD_NATIVE" = "1" ]; then
|
||||
|
|
|
@ -144,7 +144,6 @@ import * as messaging from "@src/lib/messaging"
|
|||
import state from "@src/state"
|
||||
import * as State from "@src/state"
|
||||
import * as webext from "@src/lib/webext"
|
||||
import Mark from "mark.js"
|
||||
import * as perf from "@src/perf"
|
||||
import * as keyseq from "@src/lib/keyseq"
|
||||
import * as native from "@src/lib/native"
|
||||
|
@ -170,7 +169,6 @@ import * as metadata from "@src/.metadata.generated"
|
|||
hinting_content,
|
||||
itertools,
|
||||
logger,
|
||||
Mark,
|
||||
metadata,
|
||||
keyseq,
|
||||
messaging,
|
||||
|
|
|
@ -1049,7 +1049,7 @@ export function addJump() {
|
|||
// Prevent pending jump from being registered
|
||||
clearTimeout(JUMP_TIMEOUTID)
|
||||
// Schedule the registering of the current jump
|
||||
const localTimeoutID = setTimeout(async () => {
|
||||
const localTimeoutID = window.setTimeout(async () => {
|
||||
// Get config for current page
|
||||
const alljumps = await curJumps()
|
||||
// if this handler was cancelled after the call to curJumps(), bail out
|
||||
|
@ -5080,7 +5080,13 @@ export async function issue() {
|
|||
//#background
|
||||
export async function updatecheck(source: "manual" | "auto_polite" | "auto_impolite" = "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) {
|
||||
return false
|
||||
}
|
||||
|
|
|
@ -6,7 +6,6 @@
|
|||
|
||||
*/
|
||||
|
||||
import Parser from "rss-parser"
|
||||
import SemverCompare from "semver-compare"
|
||||
import * as Config from "@src/lib/config"
|
||||
import * as Logging from "@src/lib/logging"
|
||||
|
@ -21,47 +20,39 @@ interface TriVersionFeedItem {
|
|||
version: string
|
||||
}
|
||||
|
||||
// initialize to beginning of time to cause a check on startup
|
||||
let highestKnownVersion: TriVersionFeedItem
|
||||
|
||||
function secondsSinceLastCheck() {
|
||||
export function secondsSinceLastCheck() {
|
||||
const lastCheck = Config.get("update", "lastchecktime")
|
||||
return (Date.now() - lastCheck) / 1000
|
||||
}
|
||||
|
||||
// Get the latest version, with a bit of a cache. This will return
|
||||
// immediately if we've already recently checked for an update, so it
|
||||
// should be safe to invoke it relatively frequently.
|
||||
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() {
|
||||
// Ask GitHub what the latest version is
|
||||
// Uncached so don't run this often
|
||||
export async function getLatestVersion() {
|
||||
try {
|
||||
// If any monster any makes a novelty tag this will break.
|
||||
// So let's just ignore any errors.
|
||||
const parser = new Parser()
|
||||
const feed = await parser.parseURL(
|
||||
"https://github.com/tridactyl/tridactyl/tags.atom",
|
||||
const feed = new DOMParser().parseFromString(
|
||||
await (
|
||||
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.
|
||||
Config.set("update", "lastchecktime", Date.now())
|
||||
highestKnownVersion = {
|
||||
version: mostRecent.title,
|
||||
releaseDate: new Date(mostRecent.pubDate), // e.g. 2018-12-04T15:24:43.000Z
|
||||
const highestKnownVersion = {
|
||||
version: mostRecent.querySelector("title").textContent,
|
||||
releaseDate: new Date(
|
||||
mostRecent.querySelector("updated").textContent,
|
||||
), // e.g. 2018-12-04T15:24:43.000Z
|
||||
}
|
||||
logger.debug(
|
||||
"Checked for new version of Tridactyl, found ",
|
||||
highestKnownVersion,
|
||||
)
|
||||
|
||||
return highestKnownVersion
|
||||
} catch (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