1
mirror of https://github.com/thepeacockproject/Peacock synced 2025-04-09 10:22:06 +02:00

chore: Cherry-pick a bunch of dependency updates and test fixes from

Signed-off-by: Reece Dunham <me@rdil.rocks>
This commit is contained in:
Reece Dunham 2023-11-22 17:49:01 -05:00
parent 7fb174fbff
commit 2d83a4c872
No known key found for this signature in database
GPG Key ID: F087CB485320F19F
12 changed files with 579 additions and 1648 deletions

@ -62,11 +62,9 @@ task:
- yarn config set npmAuthToken $NPM_AUTH_TOKEN - yarn config set npmAuthToken $NPM_AUTH_TOKEN
- yarn typedefs npm publish - yarn typedefs npm publish
- only_if: $CIRRUS_TAG == '' - only_if: $CIRRUS_TAG == ''
name: Linting name: Tests
Lint_script: Lint_script:
- yarn lint - yarn lint
- yarn prettier:check - yarn prettier:check
- only_if: $CIRRUS_TAG == ''
name: Tests
Test_script: Test_script:
- yarn test - yarn test:main

@ -10,3 +10,6 @@ max_line_length = 80
[*.xml] [*.xml]
insert_final_newline = false insert_final_newline = false
indent_size = 2 indent_size = 2
[*.yml]
indent_size = 2

893
.yarn/releases/yarn-4.0.0-rc.53.cjs generated vendored

File diff suppressed because one or more lines are too long

@ -13,5 +13,3 @@ nodeLinker: node-modules
plugins: plugins:
- path: .yarn/plugins/@yarnpkg/plugin-outdated.cjs - path: .yarn/plugins/@yarnpkg/plugin-outdated.cjs
spec: "https://mskelton.dev/yarn-outdated/v2" spec: "https://mskelton.dev/yarn-outdated/v2"
yarnPath: .yarn/releases/yarn-4.0.0-rc.53.cjs

@ -13,15 +13,13 @@
"build-plugins": "node --no-warnings packaging/buildPlugins.mjs", "build-plugins": "node --no-warnings packaging/buildPlugins.mjs",
"typecheck-ws": "tsc", "typecheck-ws": "tsc",
"typecheck": "yarn workspaces foreach -A run typecheck-ws", "typecheck": "yarn workspaces foreach -A run typecheck-ws",
"lint": "eslint --format=pretty .", "lint": "eslint .",
"rebuild-locale": "node resources/rebuildLocale.cjs", "rebuild-locale": "node resources/rebuildLocale.cjs",
"optimize": "terser chunk0.js -o chunk0.js -c --toplevel --timings --ecma 2021 -m --source-map \"content='chunk0.js.map'\"", "optimize": "terser chunk0.js -o chunk0.js -c --toplevel --timings --ecma 2021 -m --source-map \"content='chunk0.js.map'\"",
"webui": "yarn workspace @peacockproject/web-ui", "webui": "yarn workspace @peacockproject/web-ui",
"typedefs": "yarn workspace @peacockproject/core", "typedefs": "yarn workspace @peacockproject/core",
"run-dev": "node packaging/devLoader.mjs", "run-dev": "node packaging/devLoader.mjs",
"extract-challenge-data": "node packaging/extractChallengeData.mjs", "extract-challenge-data": "node packaging/extractChallengeData.mjs"
"test": "vitest --run --config tests/vitest.config.ts",
"test-ui": "vitest --config tests/vitest.config.ts --ui"
}, },
"prettier": { "prettier": {
"semi": false, "semi": false,
@ -37,15 +35,15 @@
}, },
"dependencies": { "dependencies": {
"@peacockproject/statemachine-parser": "^5.9.3", "@peacockproject/statemachine-parser": "^5.9.3",
"@yarnpkg/fslib": "^3.0.0-rc.53", "@yarnpkg/fslib": "^3.0.1",
"@yarnpkg/libzip": "^3.0.0-rc.53", "@yarnpkg/libzip": "^3.0.0",
"atomically": "^2.0.2", "atomically": "^2.0.2",
"axios": "^1.5.1", "axios": "^1.6.0",
"body-parser": "*", "body-parser": "*",
"clipanion": "^3.2.1", "clipanion": "^3.2.1",
"commander": "^11.1.0", "commander": "^11.1.0",
"deepmerge-ts": "^5.1.0", "deepmerge-ts": "^5.1.0",
"esbuild-wasm": "^0.19.4", "esbuild-wasm": "^0.19.5",
"express": "patch:express@npm%3A4.18.2#~/.yarn/patches/express-npm-4.18.2-bb15ff679a.patch", "express": "patch:express@npm%3A4.18.2#~/.yarn/patches/express-npm-4.18.2-bb15ff679a.patch",
"jest-diff": "^29.7.0", "jest-diff": "^29.7.0",
"js-ini": "^1.6.0", "js-ini": "^1.6.0",
@ -53,44 +51,41 @@
"jsonwebtoken": "^9.0.2", "jsonwebtoken": "^9.0.2",
"md5-file": "^5.0.0", "md5-file": "^5.0.0",
"msgpackr": "^1.9.9", "msgpackr": "^1.9.9",
"nanoid": "^5.0.1", "nanoid": "^5.0.3",
"parseurl": "^1.3.3", "parseurl": "^1.3.3",
"picocolors": "patch:picocolors@npm%3A1.0.0#~/.yarn/patches/picocolors-npm-1.0.0-d81e0b1927.patch", "picocolors": "patch:picocolors@npm%3A1.0.0#~/.yarn/patches/picocolors-npm-1.0.0-d81e0b1927.patch",
"progress": "^2.0.3", "progress": "^2.0.3",
"prompts": "^2.4.2", "prompts": "^2.4.2",
"random": "^4.1.0", "random": "^4.1.0",
"send": "0.18.0", "send": "0.18.0",
"serve-static": "^1.15.0" "serve-static": "^1.15.0",
"tapable": "^2.2.1"
}, },
"devDependencies": { "devDependencies": {
"@mixer/parallel-prettier": "^2.0.3", "@mixer/parallel-prettier": "^2.0.3",
"@peacockproject/eslint-plugin": "workspace:*", "@peacockproject/eslint-plugin": "workspace:*",
"@types/body-parser": "1.19.3", "@types/express": "^4.17.20",
"@types/express": "^4.17.19", "@types/jsonwebtoken": "^9.0.4",
"@types/jsonwebtoken": "^9.0.3",
"@types/node": "^20", "@types/node": "^20",
"@types/parseurl": "^1.3.1", "@types/parseurl": "^1.3.2",
"@types/progress": "^2.0.5", "@types/progress": "^2.0.6",
"@types/prompts": "^2.4.6", "@types/prompts": "^2.4.7",
"@types/send": "^0.17.2", "@types/send": "^0.17.3",
"@typescript-eslint/eslint-plugin": "^6.7.5", "@typescript-eslint/eslint-plugin": "^6.10.0",
"@typescript-eslint/parser": "^6.7.5", "@typescript-eslint/parser": "^6.10.0",
"@vitest/ui": "^0.34.6", "esbuild": "^0.19.5",
"esbuild": "^0.19.4",
"esbuild-register": "^3.5.0", "esbuild-register": "^3.5.0",
"eslint": "^8.51.0", "eslint": "^8.53.0",
"eslint-config-prettier": "^9.0.0", "eslint-config-prettier": "^9.0.0",
"eslint-formatter-pretty": "^5.0.0",
"eslint-plugin-promise": "^6.1.1", "eslint-plugin-promise": "^6.1.1",
"eslint-plugin-react-hooks": "^4.6.0", "eslint-plugin-react-hooks": "^4.6.0",
"fast-glob": "^3.3.1", "fast-glob": "^3.3.2",
"json-keys-sort": "^2.1.0", "json-keys-sort": "^2.1.0",
"ms": "^2.1.3", "ms": "^2.1.3",
"prettier": "^2.8.8", "prettier": "^2.8.8",
"rimraf": "^5.0.5", "rimraf": "^5.0.5",
"terser": "^5.21.0", "terser": "^5.21.0",
"typescript": "5.2.2", "typescript": "5.2.2",
"vitest": "^0.34.6",
"winston": "^3.11.0", "winston": "^3.11.0",
"winston-daily-rotate-file": "^4.7.1" "winston-daily-rotate-file": "^4.7.1"
}, },
@ -100,7 +95,8 @@
"workspaces": [ "workspaces": [
"webui", "webui",
"packaging/typedefs", "packaging/typedefs",
"packaging/eslint" "packaging/eslint",
"tests"
], ],
"packageManager": "yarn@4.0.0-rc.53" "packageManager": "yarn@4.0.2"
} }

@ -24,6 +24,7 @@ import jsonfile from "jsonfile"
import fs from "fs" import fs from "fs"
import path from "path" import path from "path"
import { randomUUID } from "crypto" import { randomUUID } from "crypto"
function makeTargetDown(id, codename, parent, sub) { function makeTargetDown(id, codename, parent, sub) {
return { return {
CategoryName: "UI_MENU_PAGE_PROFILE_CHALLENGES_CATEGORY_ELUSIVE", CategoryName: "UI_MENU_PAGE_PROFILE_CHALLENGES_CATEGORY_ELUSIVE",
@ -391,7 +392,7 @@ async function fetchContractCAndPFromIOI(axiosClient, contractId) {
/** /**
* @param {import("axios").AxiosInstance} axiosClient * @param {import("axios").AxiosInstance} axiosClient
* @param {string} locationId * @param {string} contractId
* @returns {Promise<*>} * @returns {Promise<*>}
*/ */
async function fetchContract(axiosClient, contractId) { async function fetchContract(axiosClient, contractId) {
@ -572,7 +573,7 @@ async function extract(locationParent, jwt, apiUrl) {
} }
} }
const uniqueObjects = challengeObjects.filter((object, index) => { challengeObjects = challengeObjects.filter((object, index) => {
const lastIndex = challengeObjects.findIndex( const lastIndex = challengeObjects.findIndex(
(otherObject, otherIndex) => (otherObject, otherIndex) =>
otherIndex < index && otherObject.Id === object.Id, otherIndex < index && otherObject.Id === object.Id,
@ -580,8 +581,6 @@ async function extract(locationParent, jwt, apiUrl) {
return lastIndex === -1 return lastIndex === -1
}) })
challengeObjects = uniqueObjects
console.log(`Compiled ${pc.green(challengeObjects.length)} challenges`) console.log(`Compiled ${pc.green(challengeObjects.length)} challenges`)
return group return group

@ -22,10 +22,10 @@
}, },
"dependencies": { "dependencies": {
"@peacockproject/statemachine-parser": "^5.9.3", "@peacockproject/statemachine-parser": "^5.9.3",
"@types/express": "^4.17.19", "@types/express": "^4.17.20",
"@types/node": "^20.8.6", "@types/node": "^20.8.10",
"atomically": "^2.0.2", "atomically": "^2.0.2",
"axios": "^1.5.1", "axios": "^1.6.0",
"js-ini": "^1.6.0" "js-ini": "^1.6.0"
}, },
"optionalDependencies": { "optionalDependencies": {

@ -1,7 +1,25 @@
/*
* The Peacock Project - a HITMAN server replacement.
* Copyright (C) 2021-2023 The Peacock Project Team
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
/* eslint-disable @typescript-eslint/no-explicit-any */ /* eslint-disable @typescript-eslint/no-explicit-any */
import type * as core from "express-serve-static-core" import type * as core from "express-serve-static-core"
import { RequestWithJwt } from "../../components/types/types" import { RequestWithJwt } from "../../components/types/types"
import { Mock } from "vitest" import { Mock, vi, expect } from "vitest"
import { sign } from "jsonwebtoken" import { sign } from "jsonwebtoken"
export function asMock<T>(value: T): Mock { export function asMock<T>(value: T): Mock {

14
tests/package.json Normal file

@ -0,0 +1,14 @@
{
"name": "@peacockproject/tests",
"type": "module",
"private": true,
"dependencies": {
"@vitest/ui": "^0.34.6",
"vite": "^5.0.0-0",
"vitest": "^0.34.6"
},
"scripts": {
"test:main": "vitest --run --config vitest.config.ts",
"test:ui": "vitest --config vitest.config.ts --ui"
}
}

@ -1,3 +1,21 @@
/*
* The Peacock Project - a HITMAN server replacement.
* Copyright (C) 2021-2023 The Peacock Project Team
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
import path from "path" import path from "path"
import { defineConfig } from "vitest/config" import { defineConfig } from "vitest/config"
import { Plugin } from "vite" import { Plugin } from "vite"
@ -37,7 +55,7 @@ function dontLoadJsonPlugin() {
export default defineConfig({ export default defineConfig({
test: { test: {
globals: true, globals: true,
setupFiles: ["tests/setup/globalDefines.ts"], setupFiles: ["setup/globalDefines.ts"],
}, },
plugins: [dontLoadJsonPlugin()], plugins: [dontLoadJsonPlugin()],
}) })

@ -3,7 +3,7 @@
"version": "1.0.0", "version": "1.0.0",
"private": true, "private": true,
"dependencies": { "dependencies": {
"axios": "^1.5.1", "axios": "^1.6.0",
"clsx": "^2.0.0", "clsx": "^2.0.0",
"immer": "^10.0.3", "immer": "^10.0.3",
"infima": "0.2.0-alpha.38", "infima": "0.2.0-alpha.38",
@ -20,12 +20,11 @@
"typecheck-ws": "tsc" "typecheck-ws": "tsc"
}, },
"devDependencies": { "devDependencies": {
"@types/react": "^18.2.28", "@types/react": "^18.2.36",
"@types/react-dom": "^18.2.13", "@types/react-dom": "^18.2.14",
"@types/url-parse": "^1.4.9", "rollup-plugin-license": "^3.2.0",
"rollup-plugin-license": "^3.1.0",
"typescript": "5.2.2", "typescript": "5.2.2",
"vite": "^4.4.11" "vite": "^5.0.0-0"
}, },
"peerDependencies": { "peerDependencies": {
"rollup": "*" "rollup": "*"

1065
yarn.lock

File diff suppressed because it is too large Load Diff