Skip to content

Commit

Permalink
upgrade ava and remove babel
Browse files Browse the repository at this point in the history
  • Loading branch information
timche committed Jan 17, 2024
1 parent df0b3e8 commit 0071648
Show file tree
Hide file tree
Showing 10 changed files with 12,848 additions and 17,963 deletions.
30,740 changes: 12,826 additions & 17,914 deletions package-lock.json

Large diffs are not rendered by default.

38 changes: 5 additions & 33 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,15 @@
"node": "^20",
"npm": "^10"
},
"type": "module",
"scripts": {
"prepare": "husky install",
"precommit": "lint-staged",
"dev": "tsx scripts/build.ts --dev",
"build:css": "tailwindcss -i ./src/content/globals.css -o ./dist/content.css --minify",
"build:ext": "webpack --mode=production",
"build": "tsx scripts/build.ts",
"test": "cross-env BABEL_ENV=testing ava",
"test": "ava",
"lint": "biome check .",
"release:amo": "web-ext-submit --source-dir dist",
"release:cws": "chrome-webstore-upload upload --source=dist --auto-publish",
Expand Down Expand Up @@ -48,17 +49,7 @@
"@tsconfig/node20": "^20.1.2",
"@types/node": "^20.11.5",
"autoprefixer": "^10.4.16",
"ava": "^0.25.0",
"babel-core": "^6.26.0",
"babel-loader": "^7.1.3",
"babel-plugin-transform-class-properties": "^6.24.1",
"babel-plugin-transform-object-rest-spread": "^6.26.0",
"babel-plugin-transform-react-jsx": "^6.24.1",
"babel-polyfill": "^6.26.0",
"babel-preset-env": "^1.6.1",
"babel-preset-react": "^6.24.1",
"babel-register": "^6.26.0",
"browser-env": "^3.2.5",
"ava": "^6.0.1",
"chokidar": "^3.5.3",
"chrome-webstore-upload-cli": "^2.0.1",
"cross-env": "^5.1.5",
Expand All @@ -84,26 +75,7 @@
},
"ava": {
"require": [
"babel-register",
"babel-polyfill",
"./test/helpers/setup-browser-env.js"
],
"babel": {
"plugins": [
"transform-react-jsx"
]
}
},
"babel": {
"env": {
"testing": {
"presets": [
"env"
],
"plugins": [
"transform-object-rest-spread"
]
}
}
"./test/_setup.js"
]
}
}
6 changes: 3 additions & 3 deletions src/content/helpers/elo.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import isNumber from "lodash/isNumber";
import round from "lodash/round";
import isNumber from "lodash/isNumber.js";
import round from "lodash/round.js";
import mem from "mem";
import { getMatchmakingQueue } from "./faceit-api";
import { getMatchmakingQueue } from "./faceit-api.js";

export function normalizeElo(elo) {
return Number(elo.replace(",", ""));
Expand Down
8 changes: 4 additions & 4 deletions src/content/helpers/faceit-api.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import camelcaseKeys from "camelcase-keys";
import format from "date-fns/format";
import format from "date-fns/format/index.js";
import Cookies from "js-cookie";
import pMemoize from "p-memoize";
import browser from "webextension-polyfill";
import { ACTION_FETCH_FACEIT_API } from "../../shared/constants";
import { isSupportedGame } from "./games";
import { mapAverageStatsMemoized, mapTotalStatsMemoized } from "./stats";
import { ACTION_FETCH_FACEIT_API } from "../../shared/constants.js";
import { isSupportedGame } from "./games.js";
import { mapAverageStatsMemoized, mapTotalStatsMemoized } from "./stats.js";

export const CACHE_TIME = 600000;

Expand Down
2 changes: 1 addition & 1 deletion src/content/helpers/pages.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { getCurrentPath } from "./location";
import { getCurrentPath } from "./location.js";

export const isRoomOverview = (path) =>
/room\/.+-.+-.+-.+$/.test(path || getCurrentPath());
Expand Down
3 changes: 3 additions & 0 deletions test/_setup.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
global.location = new URL("https://www.faceit.com");

global.chrome = null;
2 changes: 1 addition & 1 deletion test/elo.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import test from "ava";
import {
estimateRatingChange,
predictRatingChange,
} from "../src/content/helpers/elo";
} from "../src/content/helpers/elo.js";

test("estimateRatingChange", (t) => {
t.deepEqual(estimateRatingChange(2000, 2000), {
Expand Down
5 changes: 0 additions & 5 deletions test/helpers/setup-browser-env.js

This file was deleted.

2 changes: 1 addition & 1 deletion test/pages.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import test from "ava";
import * as pages from "../src/content/helpers/pages";
import * as pages from "../src/content/helpers/pages.js";

test("isRoomOverview", (t) => {
const path = "en/csgo/room/466ece1d-9f16-4b64-aa2d-826c60bc022f";
Expand Down
5 changes: 4 additions & 1 deletion test/stats.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
import test from "ava";
import { mapAverageStats, mapTotalStats } from "../src/content/helpers/stats";
import {
mapAverageStats,
mapTotalStats,
} from "../src/content/helpers/stats.js";

test("mapTotalStats", (t) => {
const stats = {
Expand Down

0 comments on commit 0071648

Please sign in to comment.