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

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

View File

@ -1,72 +1,70 @@
env:
# don't clone the entire repository history, saves time
CIRRUS_CLONE_DEPTH: 1
# don't clone the entire repository history, saves time
CIRRUS_CLONE_DEPTH: 1
Build_task:
container:
image: node:18-slim
Enable_Corepack_script:
- corepack enable
Yarn_cache:
folder: .yarn/cache
reupload_on_changes: true
Yarn_Populate_script:
- yarn
Install_System_Dependencies_script:
- apt update --yes
- apt install zip jq curl --yes
Build_Modules_script:
- yarn build
Optimize_script:
- yarn optimize
Download_NodeJS_script:
- curl https://nodejs.org/dist/$(cat .nvmrc)/node-$(cat .nvmrc)-win-x64.zip -o node.zip
- unzip node.zip
- mkdir nodedist
- cp node-$(cat .nvmrc)-win-x64/node.exe nodedist/node.exe
- cp node-$(cat .nvmrc)-win-x64/LICENSE nodedist/LICENSE
Assemble_Full_script:
- ./packaging/ciAssemble.sh
Assemble_Linux_script:
- ./packaging/ciAssemble.sh linux
Peacock_Release_artifacts:
path: Peacock-v*.zip
type: application/zip
SourceMap_artifacts:
path: chunk0.js.map
container:
image: node:18-slim
Enable_Corepack_script:
- corepack enable
Yarn_cache:
folder: .yarn/cache
reupload_on_changes: true
Yarn_Populate_script:
- yarn
Install_System_Dependencies_script:
- apt update --yes
- apt install zip jq curl --yes
Build_Modules_script:
- yarn build
Optimize_script:
- yarn optimize
Download_NodeJS_script:
- curl https://nodejs.org/dist/$(cat .nvmrc)/node-$(cat .nvmrc)-win-x64.zip -o node.zip
- unzip node.zip
- mkdir nodedist
- cp node-$(cat .nvmrc)-win-x64/node.exe nodedist/node.exe
- cp node-$(cat .nvmrc)-win-x64/LICENSE nodedist/LICENSE
Assemble_Full_script:
- ./packaging/ciAssemble.sh
Assemble_Linux_script:
- ./packaging/ciAssemble.sh linux
Peacock_Release_artifacts:
path: Peacock-v*.zip
type: application/zip
SourceMap_artifacts:
path: chunk0.js.map
task:
container:
image: node:18-slim
Enable_Corepack_script:
- corepack enable
Yarn_cache:
folder: .yarn/cache
reupload_on_changes: true
Yarn_Populate_script:
- yarn
Type_Check_script:
- yarn typecheck
matrix:
- only_if: $CIRRUS_TAG != ''
name: Types Publish
env:
NPM_AUTH_TOKEN: ENCRYPTED[7e0bc6b5e2d4f27aff6a60acf686376ca26abed3334738847a419e4bd8c245490caeddc81d8ce403745516e11604c094]
Install_System_Dependencies_script:
- apt update --yes
- apt install rsync --yes
Push_Types_script:
- rsync -a --include '*/' --include '*.d.ts' --exclude '*' build/ packaging/typedefs/
- yarn typedefs reversion
- yarn typedefs pack
- yarn config set npmAuthToken $NPM_AUTH_TOKEN
- yarn typedefs npm publish
- only_if: $CIRRUS_TAG == ''
name: Linting
Lint_script:
- yarn lint
- yarn prettier:check
- only_if: $CIRRUS_TAG == ''
name: Tests
Test_script:
- yarn test
container:
image: node:18-slim
Enable_Corepack_script:
- corepack enable
Yarn_cache:
folder: .yarn/cache
reupload_on_changes: true
Yarn_Populate_script:
- yarn
Type_Check_script:
- yarn typecheck
matrix:
- only_if: $CIRRUS_TAG != ''
name: Types Publish
env:
NPM_AUTH_TOKEN: ENCRYPTED[7e0bc6b5e2d4f27aff6a60acf686376ca26abed3334738847a419e4bd8c245490caeddc81d8ce403745516e11604c094]
Install_System_Dependencies_script:
- apt update --yes
- apt install rsync --yes
Push_Types_script:
- rsync -a --include '*/' --include '*.d.ts' --exclude '*' build/ packaging/typedefs/
- yarn typedefs reversion
- yarn typedefs pack
- yarn config set npmAuthToken $NPM_AUTH_TOKEN
- yarn typedefs npm publish
- only_if: $CIRRUS_TAG == ''
name: Tests
Lint_script:
- yarn lint
- yarn prettier:check
Test_script:
- yarn test:main

View File

@ -10,3 +10,6 @@ max_line_length = 80
[*.xml]
insert_final_newline = false
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

View File

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

View File

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

View File

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

View File

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

View File

@ -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 */
import type * as core from "express-serve-static-core"
import { RequestWithJwt } from "../../components/types/types"
import { Mock } from "vitest"
import { Mock, vi, expect } from "vitest"
import { sign } from "jsonwebtoken"
export function asMock<T>(value: T): Mock {

14
tests/package.json Normal file
View 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"
}
}

View File

@ -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 { defineConfig } from "vitest/config"
import { Plugin } from "vite"
@ -37,7 +55,7 @@ function dontLoadJsonPlugin() {
export default defineConfig({
test: {
globals: true,
setupFiles: ["tests/setup/globalDefines.ts"],
setupFiles: ["setup/globalDefines.ts"],
},
plugins: [dontLoadJsonPlugin()],
})

View File

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

1065
yarn.lock

File diff suppressed because it is too large Load Diff