Update NPM packaging, linting, and a bunch of types (#275)

Preparation for
https://github.com/webrecorder/archiveweb.page/issues/198 /
https://github.com/webrecorder/archiveweb.page/pull/199.

## Changes

- Organizes published files more cleanly, using `dist/types` folder as
the target for type declarations and sourcemaps
- Configures type field in `package.json`
- Updates ESLint & its config
  - Sets up type-informed linting rules mirroring browsertrix
- Adds a bunch of other useful eslint and eslint-typescript rules, and
applies auto-fixes to the codebase
- Cleans up a bunch of types throughout the codebase, particularly parts
of the code used by ArchiveWebPage
- Changes `ItemIndex#_deleting` from `private` to `protected` so that a
part of AWP that extends it can do so properly
- Makes a bunch of previously-implied [non-null
assertions](https://www.typescriptlang.org/docs/handbook/2/everyday-types.html#non-null-assertion-operator-postfix-)
explicit
- Updates `URLResource` and `ItemType` types (and renames `Item` →
`ItemType` to disambiguate from the `Item` class)
- Removes `node-sass` and replaces it with `sass-embedded` for much
quicker installs and compilation
This commit is contained in:
Emma Segal-Grossman
2024-02-06 18:50:12 -08:00
committed by GitHub
parent a40471128f
commit a63390f10c
32 changed files with 898 additions and 1550 deletions
+11 -9
View File
@@ -7,6 +7,8 @@
"homepage": "https://replayweb.page/",
"author": "Webrecorder Software",
"license": "AGPL-3.0-or-later",
"main": "ui.js",
"types": "dist/types/index.d.ts",
"dependencies": {
"@fortawesome/fontawesome-free": "^5.15.4",
"@shoelace-style/shoelace": "^2.8.0",
@@ -29,26 +31,27 @@
"stream-browserify": "^3.0.0"
},
"devDependencies": {
"@types/flexsearch": "^0.7.3",
"@typescript-eslint/eslint-plugin": "^6.9.1",
"@typescript-eslint/parser": "^6.9.1",
"@playwright/test": "^1.38.1",
"@types/flexsearch": "^0.7.3",
"@typescript-eslint/eslint-plugin": "^6.12.0",
"@typescript-eslint/parser": "^6.12.0",
"copy-webpack-plugin": "^9.0.1",
"css-loader": "^6.2.0",
"electron": "^25.1.1",
"electron-builder": "^23.0.3",
"electron-notarize": "^1.1.1",
"eslint": "^8.52.0",
"eslint-config-prettier": "^9.0.0",
"eslint-plugin-lit": "^1.9.1",
"eslint": "^8.54.0",
"eslint-config-prettier": "^8.3.0",
"eslint-plugin-lit": "^1.10.1",
"eslint-plugin-wc": "^1.3.2",
"http-server": "^13.0.2",
"husky": "^8.0.0",
"lint-staged": "^14.0.0",
"mini-css-extract-plugin": "^2.3.0",
"node-sass": "^9.0.0",
"playwright": "^1.38.1",
"prettier": "^3.0.1",
"raw-loader": "^4.0.2",
"sass-embedded": "^1.70.0",
"sass-loader": "^13.3.2",
"style-loader": "^3.2.1",
"svg-inline-loader": "^0.8.2",
@@ -62,11 +65,11 @@
},
"files": [
"/assets",
"/dist",
"/src",
"/ruffle",
"sw.js",
"ui.js",
"index.js",
"index.html"
],
"scripts": {
@@ -102,7 +105,6 @@
"dist/*.js",
"dist/prebuilds/${platform}-${arch}/*",
"dist/build/*",
"index.js",
"ui.js",
"sw.js",
"*.html",