Skip to content

TypeScript Conversion! #257

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 46 commits into from
Oct 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
520b654
remove dist
emma-sg Dec 20, 2023
9f89f69
add basic typescript configs
emma-sg Dec 20, 2023
30c2de9
[ts-migrate][.] Init tsconfig.json file
emma-sg Dec 20, 2023
d95a965
[ts-migrate][.] Rename files from JS/JSX to TS/TSX
emma-sg Dec 20, 2023
5e3d006
format everything
emma-sg Dec 20, 2023
8fa7901
update rwp dep to dev-2.0.0
emma-sg Jan 2, 2024
36c284a
improve a few more types
emma-sg Jan 2, 2024
cecd0f7
revert static files accidentally changed
emma-sg Jan 2, 2024
ea0a0e5
move static files out of src
emma-sg Jan 2, 2024
34878b8
add missing globals & move pdf extraction js into static files
emma-sg Jan 2, 2024
f43f003
first pass at suppressing errors
emma-sg Jan 3, 2024
9ff9e31
second pass
emma-sg Jan 3, 2024
bc02f49
smaller fixes and linting tweaks
emma-sg Jan 3, 2024
ff73d9f
remove unneeded ts-expect-errors
emma-sg Jan 3, 2024
4b08a9d
wip
emma-sg Jan 8, 2024
a10e3a9
clean up app.ts
emma-sg Jan 11, 2024
9e47c2b
fix webpack build!
emma-sg Jan 12, 2024
bff5c23
fix remaining issues preventing build
emma-sg Jan 24, 2024
00c43f6
apple eslint rules from rwp & run auto-fixers
emma-sg Jan 25, 2024
0404eac
update rwp dep to dev-2.0.0 branch
emma-sg Feb 7, 2024
4474ba6
Browsertrix Cloud → Browsertrix
Shrinks99 Mar 29, 2024
7605b66
update dependencies
ikreymer Apr 11, 2024
0998388
bump to RWP 2.0.0
ikreymer May 30, 2024
75b25e6
swap to sass from node-sass
emma-sg Jun 18, 2024
c1a8bc6
copy `noImplicitAny` setting from rwp
emma-sg Jun 18, 2024
5e340ad
add `@ts-expect-error`s
emma-sg Jun 18, 2024
a216f7f
fixups
emma-sg Jun 18, 2024
675d20e
re-run ts error suppressor
emma-sg Jun 18, 2024
11afff4
fix unused error ignore
emma-sg Jun 18, 2024
0828940
fix eslint issues
emma-sg Jun 18, 2024
3bbb22e
update rwp
emma-sg Jun 18, 2024
e96e346
update static paths
emma-sg Jun 18, 2024
881089b
use rwp exports from https://github.com/webrecorder/replayweb.page/pu…
emma-sg Jun 18, 2024
c980e93
get electron build working
emma-sg Jun 18, 2024
b92e4c7
fix ruffle downloader to only download latest with a selfhosted version
emma-sg Jun 19, 2024
b636237
update rwp!
emma-sg Jun 19, 2024
97598b1
additional fixes for wabac.js 2.20.0 with typescript!
ikreymer Sep 7, 2024
f4b16df
work
ikreymer Sep 18, 2024
ae395ea
Merge branch 'main' into ts-work
ikreymer Sep 19, 2024
dae7e57
add new rwp icon icon
ikreymer Sep 19, 2024
721090a
rerun prettier
ikreymer Sep 19, 2024
d72ae80
remove RWP /misc endpoint, just use 'replaywebpage', update to latest
ikreymer Sep 19, 2024
fa11c8a
update, various fixes for TS + embed
ikreymer Oct 15, 2024
1a7f291
additional fixes:
ikreymer Oct 17, 2024
7cc86c0
update to awp-sw 0.5.0, wabac 2.20.0, replaywebpage 2.2.0
ikreymer Oct 17, 2024
c3365f9
lint + format pass
ikreymer Oct 17, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .eslintignore
Original file line number Diff line number Diff line change
@@ -1 +1 @@
src/static/*
static/*
130 changes: 98 additions & 32 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,34 +1,100 @@
/* eslint-env node */
/** @type { import("eslint").Linter.Config } */
module.exports = {
"env": {
"browser": true,
"es6": true,
"webextensions": true
},
"extends": "eslint:recommended",
"parserOptions": {
"ecmaVersion": 2018,
"sourceType": "module"
},
"rules": {
"no-restricted-globals": [
2,
"event", "error"
],
"indent": [
"error",
2
],
"linebreak-style": [
"error",
"unix"
],
"quotes": [
"error",
"double"
],
"semi": [
"error",
"always"
]
}
env: {
browser: true,
es6: true,
webextensions: true,
},
extends: [
"eslint:recommended",
"plugin:@typescript-eslint/eslint-recommended",
"plugin:wc/recommended",
"plugin:lit/recommended",
"prettier",
],
plugins: ["@typescript-eslint", "lit"],
parser: "@typescript-eslint/parser",
parserOptions: {
project: ["./tsconfig.eslint.json"],
tsconfigRootDir: __dirname,
},
root: true,
rules: {
/* start stylistic rules */
"@typescript-eslint/adjacent-overload-signatures": "error",
"@typescript-eslint/array-type": "error",
"@typescript-eslint/consistent-type-imports": [
"error",
{
fixStyle: "inline-type-imports",
},
],
"@typescript-eslint/prefer-readonly": "warn",
"@typescript-eslint/class-literal-property-style": ["warn", "getters"],
"@typescript-eslint/consistent-generic-constructors": "error",
"@typescript-eslint/consistent-type-assertions": "error",
"@typescript-eslint/no-confusing-non-null-assertion": "warn",
"@typescript-eslint/no-inferrable-types": "warn",
"@typescript-eslint/non-nullable-type-assertion-style": "warn",
"@typescript-eslint/prefer-for-of": "warn",
// "@typescript-eslint/prefer-nullish-coalescing": "warn",
"@typescript-eslint/prefer-optional-chain": "warn",
"@typescript-eslint/prefer-string-starts-ends-with": "warn",
/* end stylistic rules */

/* start recommended rules */
"no-restricted-globals": [2, "event", "error"],
"@typescript-eslint/no-base-to-string": "warn",
"@typescript-eslint/no-duplicate-enum-values": "error",
"@typescript-eslint/no-duplicate-type-constituents": "warn",
"@typescript-eslint/no-explicit-any": "warn",
"@typescript-eslint/no-extra-non-null-assertion": "error",
// "@typescript-eslint/no-floating-promises": "warn",
"@typescript-eslint/no-for-in-array": "warn",
"no-unused-vars": "off",
"@typescript-eslint/no-unused-vars": [
"warn",
{
argsIgnorePattern: "^_",
varsIgnorePattern: "^_",
destructuredArrayIgnorePattern: "^_",
},
],
"no-implied-eval": "off",
"@typescript-eslint/no-implied-eval": "error",
"no-loss-of-precision": "off",
"@typescript-eslint/no-loss-of-precision": "warn",
"@typescript-eslint/no-misused-new": "error",
"@typescript-eslint/no-misused-promises": [
"error",
{ checksVoidReturn: { arguments: false } },
],
"@typescript-eslint/no-non-null-asserted-nullish-coalescing": "error",
"@typescript-eslint/no-non-null-asserted-optional-chain": "warn",
"@typescript-eslint/no-redundant-type-constituents": "warn",
"@typescript-eslint/no-this-alias": "warn",
"@typescript-eslint/no-unnecessary-type-assertion": "warn",
"@typescript-eslint/no-unnecessary-type-constraint": "warn",
// "@typescript-eslint/no-unsafe-argument": "warn",
// "@typescript-eslint/no-unsafe-assignment": "warn",
// "@typescript-eslint/no-unsafe-call": "warn",
"@typescript-eslint/no-unsafe-declaration-merging": "warn",
"@typescript-eslint/no-unsafe-enum-comparison": "warn",
// "@typescript-eslint/no-unsafe-member-access": "warn",
// "@typescript-eslint/no-unsafe-return": "warn",
"@typescript-eslint/prefer-as-const": "warn",
"require-await": "off",
"@typescript-eslint/require-await": "warn",
"@typescript-eslint/restrict-template-expressions": "warn",
"@typescript-eslint/unbound-method": "off",
},
ignorePatterns: [
"ruffle/**/*",
"build/**/*",
"/sw.js",
"/ui.js",
"dist/**/*",
],
reportUnusedDisableDirectives: true,
};
4 changes: 2 additions & 2 deletions .github/ISSUE_TEMPLATE/bug.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ body:
id: version
attributes:
label: ArchiveWeb.page Version
description: "This can be found on the app home page under \"About\""
description: 'This can be found on the app home page under "About"'
placeholder: "v0.11.3"
validations:
required: true
Expand All @@ -20,7 +20,7 @@ body:
"I was trying to archive a page however..."

Please submit any screenshots/videos that can be used to understand how to reproduce the issue. You can attach images by clicking this area to highlight it and then dragging files into the browser window.

If something wasn't captured in the way you expect please include a link to the archived item if possible.
validations:
required: true
Expand Down
4 changes: 2 additions & 2 deletions .github/ISSUE_TEMPLATE/feature-change.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ body:
label: Requirements
description: |
Intended primarily for use by Webrecorder team, leave blank if unknown.

List the outcomes of the feature being implemented without design or implementation details.
placeholder: |
1. Item metadata should show links to the collections that the item belongs to.
Expand All @@ -43,6 +43,6 @@ body:
placeholder: |
- [ ] Mockups:
- [ ] Design:
- [ ] UI:
- [ ] UI:
validations:
required: false
93 changes: 46 additions & 47 deletions .github/workflows/buildapp.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -48,53 +48,52 @@ jobs:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

run: |
if [ "$GITHUB_REF" == "refs/heads/main" ] || [ -f ./force_release ]; then
export YARN_BUILD_CMD="release"
else
export YARN_BUILD_CMD="dist"
fi
if [ "$GITHUB_REF" == "refs/heads/main" ] || [ -f ./force_release ]; then
export YARN_BUILD_CMD="release"
else
export YARN_BUILD_CMD="dist"
fi

if [ "$RUNNER_OS" == "Linux" ]; then
if [ "$PLATFORM" == "linux" ]; then
#mkdir -p plugins-linux;
#pushd plugins-linux;
#wget "https://s3.amazonaws.com/webrecorder-builds/flashplugin/libpepflashplayer.so";
#popd;
if [ "$RUNNER_OS" == "Linux" ]; then
if [ "$PLATFORM" == "linux" ]; then
#mkdir -p plugins-linux;
#pushd plugins-linux;
#wget "https://s3.amazonaws.com/webrecorder-builds/flashplugin/libpepflashplayer.so";
#popd;

docker run --rm \
-e GH_TOKEN=${GH_TOKEN} \
-e YARN_BUILD_CMD=${YARN_BUILD_CMD} \
-v ${PWD}:/project \
-v ~/.cache/electron:/root/.cache/electron \
-v ~/.cache/electron-builder:/root/.cache/electron-builder \
electronuserland/builder:16-wine \
/bin/bash -c "yarn --link-duplicates --pure-lockfile --ignore-engines install && yarn run $YARN_BUILD_CMD --linux --x64"
else
#mkdir -p plugins-win;
#pushd plugins-win;
#wget "https://s3.amazonaws.com/webrecorder-builds/flashplugin/pepflashplayer-x86_64.dll";
#wget "https://s3.amazonaws.com/webrecorder-builds/flashplugin/pepflashplayer-x86.dll";
#popd;
docker run --rm \
-e GH_TOKEN=${GH_TOKEN} \
-e YARN_BUILD_CMD=${YARN_BUILD_CMD} \
-v ${PWD}:/project \
-v ~/.cache/electron:/root/.cache/electron \
-v ~/.cache/electron-builder:/root/.cache/electron-builder \
electronuserland/builder:16-wine \
/bin/bash -c "yarn --link-duplicates --pure-lockfile --ignore-engines install && yarn run $YARN_BUILD_CMD --linux --x64"
else
#mkdir -p plugins-win;
#pushd plugins-win;
#wget "https://s3.amazonaws.com/webrecorder-builds/flashplugin/pepflashplayer-x86_64.dll";
#wget "https://s3.amazonaws.com/webrecorder-builds/flashplugin/pepflashplayer-x86.dll";
#popd;

docker run --rm \
-e GH_TOKEN=${GH_TOKEN} \
-e WIN_CSC_LINK=${WIN_CSC_LINK} \
-e WIN_CSC_KEY_PASSWORD=${WIN_CSC_KEY_PASSWORD} \
-e YARN_BUILD_CMD=${YARN_BUILD_CMD} \
-v ${PWD}:/project \
-v ~/.cache/electron:/root/.cache/electron \
-v ~/.cache/electron-builder:/root/.cache/electron-builder \
electronuserland/builder:16-wine \
/bin/bash -c "yarn --link-duplicates --pure-lockfile --ignore-engines install && yarn run $YARN_BUILD_CMD --win --x64 --ia32"
fi
else
#mkdir -p plugins-mac;
#pushd plugins-mac;
#wget "https://s3.amazonaws.com/webrecorder-builds/flashplugin/PepperFlashPlayer.plugin.zip";
#unzip PepperFlashPlayer.plugin.zip;
#rm PepperFlashPlayer.plugin.zip;
#popd;
yarn --link-duplicates --pure-lockfile --ignore-engines install
yarn run $YARN_BUILD_CMD
fi

docker run --rm \
-e GH_TOKEN=${GH_TOKEN} \
-e WIN_CSC_LINK=${WIN_CSC_LINK} \
-e WIN_CSC_KEY_PASSWORD=${WIN_CSC_KEY_PASSWORD} \
-e YARN_BUILD_CMD=${YARN_BUILD_CMD} \
-v ${PWD}:/project \
-v ~/.cache/electron:/root/.cache/electron \
-v ~/.cache/electron-builder:/root/.cache/electron-builder \
electronuserland/builder:16-wine \
/bin/bash -c "yarn --link-duplicates --pure-lockfile --ignore-engines install && yarn run $YARN_BUILD_CMD --win --x64 --ia32"
fi
else
#mkdir -p plugins-mac;
#pushd plugins-mac;
#wget "https://s3.amazonaws.com/webrecorder-builds/flashplugin/PepperFlashPlayer.plugin.zip";
#unzip PepperFlashPlayer.plugin.zip;
#rm PepperFlashPlayer.plugin.zip;
#popd;
yarn --link-duplicates --pure-lockfile --ignore-engines install
yarn run $YARN_BUILD_CMD
fi
4 changes: 2 additions & 2 deletions .github/workflows/buildext.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ jobs:
- name: Install Node.js, NPM and Yarn
uses: actions/setup-node@v3
with:
node-version: '18.x'
cache: 'yarn'
node-version: "18.x"
cache: "yarn"

- name: Yarn Install
run: yarn install --frozen-lockfile
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/npm-release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ jobs:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: '18.x'
registry-url: 'https://registry.npmjs.org'
cache: 'yarn'
node-version: "18.x"
registry-url: "https://registry.npmjs.org"
cache: "yarn"

- name: Yarn Install
run: yarn install --frozen-lockfile
Expand Down
3 changes: 1 addition & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,4 @@
!examples/*.warc
**/node_modules
.DS_Store
!dist/embed/*

dist
2 changes: 2 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
LICENSE.md
static/*
8 changes: 8 additions & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"recommendations": [
"dbaeumer.vscode-eslint",
"esbenp.prettier-vscode",
"runem.lit-plugin",
"streetsidesoftware.code-spell-checker"
]
}
67 changes: 67 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
{
"cSpell.languageSettings": [
{
"languageId": "typescript",
"allowCompoundWords": true,
"dictionaries": ["typescript", "node", "html", "fonts", "css"]
},
{
"languageId": "javascript",
"allowCompoundWords": true,
"dictionaries": ["typescript", "node", "html", "fonts", "css"]
},
{
"languageId": "markdown",
"allowCompoundWords": true,
"dictionaries": ["typescript", "node", "html", "fonts", "css"]
}
],
"cSpell.words": [
"authed",
"autoipfs",
"browsertrix",
"btrix",
"Bulma",
"canonicalization",
"cdxj",
"Collec",
"colls",
"consts",
"electronuserland",
"flexsearch",
"gapi",
"gauth",
"gdrive",
"iframes",
"indexeddb",
"inited",
"ipfs",
"ival",
"kiwix",
"ndjson",
"pmarsceill",
"popd",
"pushd",
"pywb",
"reauth",
"recalc",
"replaybase",
"replayweb.page",
"sesh",
"Strs",
"surt",
"svgs",
"swmanager",
"swonly",
"Unfullscreen",
"unrewriting",
"unsharing",
"wabac",
"WACZ",
"WARC",
"warcio",
"webrecorder",
"wrlogo"
],
"cSpell.ignorePaths": ["node_modules", ".git", "*.lock", "package.json"]
}
Loading
Loading