INFRA: Update everything except React (#312)

This commit is contained in:
David Walker 2023-01-07 23:36:55 -08:00 committed by GitHub
parent 54e8875dd0
commit 0c2d402f0b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
23 changed files with 5610 additions and 8083 deletions

@ -17,7 +17,7 @@ module.exports = {
ecmaFeatures: {
experimentalObjectRestSpread: true,
},
project: ["./tsconfig.json", "./test/tsconfig.json", "./tools/tsconfig.json", "./test/cypress/tsconfig.json"],
project: ["./tsconfig.json", "./test/tsconfig.json", "./tools/tsconfig.json"],
},
plugins: ["@typescript-eslint"],
extends: ["plugin:@typescript-eslint/recommended"],

@ -1,14 +0,0 @@
{
"baseUrl": "http://localhost:8000",
"trashAssetsBeforeRuns": true,
"videoUploadOnPasses": false,
"viewportWidth": 1980,
"viewportHeight": 1080,
"fixturesFolder": "test/cypress/fixtures",
"integrationFolder": "test/cypress/integration",
"pluginsFile": "test/cypress/plugins/index.js",
"supportFile": "test/cypress/support/index.js",
"screenshotsFolder": ".cypress/screenshots",
"videosFolder": ".cypress/videos",
"downloadsFolder": ".cypress/downloads"
}

@ -9,7 +9,7 @@
"version": "1.6.4",
"dependencies": {
"electron-config": "^2.0.0",
"electron-log": "^4.4.4",
"electron-log": "^4.4.8",
"lodash": "^4.17.21"
}
},
@ -49,9 +49,9 @@
}
},
"node_modules/electron-log": {
"version": "4.4.4",
"resolved": "https://registry.npmjs.org/electron-log/-/electron-log-4.4.4.tgz",
"integrity": "sha512-jcNtrVmKXG+CHchLo/jnjjQ9K4/ORguWD23H2nqApTwisQ4Qo3IRQtLiorubajX0Uxg76Xm/Yt+eNfQMoHVr5w=="
"version": "4.4.8",
"resolved": "https://registry.npmjs.org/electron-log/-/electron-log-4.4.8.tgz",
"integrity": "sha512-QQ4GvrXO+HkgqqEOYbi+DHL7hj5JM+nHi/j+qrN9zeeXVKy8ZABgbu4CnG+BBqDZ2+tbeq9tUC4DZfIWFU5AZA=="
},
"node_modules/env-paths": {
"version": "1.0.0",
@ -224,9 +224,9 @@
}
},
"electron-log": {
"version": "4.4.4",
"resolved": "https://registry.npmjs.org/electron-log/-/electron-log-4.4.4.tgz",
"integrity": "sha512-jcNtrVmKXG+CHchLo/jnjjQ9K4/ORguWD23H2nqApTwisQ4Qo3IRQtLiorubajX0Uxg76Xm/Yt+eNfQMoHVr5w=="
"version": "4.4.8",
"resolved": "https://registry.npmjs.org/electron-log/-/electron-log-4.4.8.tgz",
"integrity": "sha512-QQ4GvrXO+HkgqqEOYbi+DHL7hj5JM+nHi/j+qrN9zeeXVKy8ZABgbu4CnG+BBqDZ2+tbeq9tUC4DZfIWFU5AZA=="
},
"env-paths": {
"version": "1.0.0",

@ -25,7 +25,7 @@
},
"dependencies": {
"electron-config": "^2.0.0",
"electron-log": "^4.4.4",
"electron-log": "^4.4.8",
"lodash": "^4.17.21"
}
}

@ -1,10 +1,8 @@
/* eslint-disable @typescript-eslint/no-var-requires */
const { ipcRenderer, contextBridge } = require("electron");
const log = require("electron-log");
contextBridge.exposeInMainWorld("electronBridge", {
send: (channel, data) => {
log.log("Send on channel " + channel);
// whitelist channels
let validChannels = [
"get-save-data-response",
@ -19,7 +17,6 @@ contextBridge.exposeInMainWorld("electronBridge", {
}
},
receive: (channel, func) => {
log.log("Receive on channel " + channel);
let validChannels = [
"get-save-data-request",
"get-save-info-request",

13145
package-lock.json generated

File diff suppressed because it is too large Load Diff

@ -11,83 +11,81 @@
},
"dependencies": {
"@emotion/react": "^11.4.1",
"@emotion/styled": "^11.3.0",
"@material-ui/core": "^4.12.3",
"@emotion/styled": "^11.10.5",
"@material-ui/core": "^4.12.4",
"@monaco-editor/react": "^4.4.6",
"@mui/icons-material": "^5.0.3",
"@mui/material": "^5.0.3",
"@mui/styles": "^5.0.1",
"@mui/icons-material": "^5.11.0",
"@mui/material": "~5.10.15",
"@mui/styles": "^5.11.2",
"@mui/system": "^5.0.3",
"@types/estree": "^1.0.0",
"acorn": "^8.7.1",
"acorn": "^8.8.1",
"acorn-walk": "^8.2.0",
"arg": "^5.0.0",
"arg": "^5.0.2",
"bcryptjs": "^2.4.3",
"better-react-mathjax": "^2.0.2",
"clsx": "^1.1.1",
"date-fns": "^2.25.0",
"escodegen": "^1.11.0",
"file-saver": "^1.3.8",
"jquery": "^3.5.0",
"clsx": "^1.2.1",
"date-fns": "^2.29.3",
"escodegen": "^2.0.0",
"file-saver": "^2.0.5",
"jquery": "^3.6.3",
"js-sha256": "^0.9.0",
"jszip": "^3.7.0",
"jszip": "^3.10.1",
"material-ui-color": "^1.2.0",
"material-ui-popup-state": "^1.5.3",
"monaco-editor": "^0.34.1",
"notistack": "^2.0.2",
"notistack": "^2.0.8",
"numeral": "2.0.6",
"prop-types": "^15.8.0",
"prop-types": "^15.8.1",
"react": "^17.0.2",
"react-beautiful-dnd": "^13.1.0",
"react-beautiful-dnd": "^13.1.1",
"react-dom": "^17.0.2",
"react-draggable": "^4.4.4",
"react-resizable": "^3.0.4",
"sprintf-js": "^1.1.1"
"sprintf-js": "^1.1.2"
},
"description": "A cyberpunk-themed incremental game",
"devDependencies": {
"@babel/core": "^7.3.4",
"@babel/preset-env": "^7.15.0",
"@babel/preset-react": "^7.0.0",
"@babel/preset-typescript": "^7.15.0",
"@babel/core": "^7.20.12",
"@babel/preset-env": "^7.20.2",
"@babel/preset-react": "^7.18.6",
"@babel/preset-typescript": "^7.18.6",
"@microsoft/api-documenter": "^7.13.65",
"@microsoft/api-extractor": "^7.18.17",
"@pmmmwh/react-refresh-webpack-plugin": "^0.5.10",
"@testing-library/cypress": "^8.0.1",
"@types/acorn": "^4.0.6",
"@types/bcryptjs": "^2.4.2",
"@types/escodegen": "^0.0.7",
"@types/file-saver": "^2.0.3",
"@types/jest": "^27.4.1",
"@types/jquery": "^3.5.14",
"@types/lodash": "^4.14.168",
"@types/file-saver": "^2.0.5",
"@types/jest": "^29.2.5",
"@types/jquery": "^3.5.16",
"@types/lodash": "^4.14.191",
"@types/numeral": "^2.0.2",
"@types/react": "^17.0.21",
"@types/react-beautiful-dnd": "^13.1.2",
"@types/react-dom": "^17.0.9",
"@types/react-resizable": "^1.7.3",
"@typescript-eslint/eslint-plugin": "^5.20.0",
"@typescript-eslint/parser": "^5.20.0",
"babel-jest": "^27.0.6",
"babel-loader": "^9.1.0",
"cypress": "^8.3.1",
"@types/react": "^17.0.52",
"@types/react-beautiful-dnd": "^13.1.3",
"@types/react-dom": "^17.0.18",
"@types/react-resizable": "^3.0.3",
"@typescript-eslint/eslint-plugin": "^5.48.0",
"@typescript-eslint/parser": "^5.48.0",
"babel-jest": "^29.3.1",
"babel-loader": "^9.1.2",
"electron": "^22.0.0",
"electron-packager": "^17.1.1",
"eslint": "^8.13.0",
"eslint": "^8.31.0",
"file-loader": "^6.2.0",
"fork-ts-checker-webpack-plugin": "^6.3.3",
"fork-ts-checker-webpack-plugin": "^7.2.14",
"html-webpack-plugin": "^5.5.0",
"http-server": "^13.0.1",
"jest": "^27.1.0",
"jsdom": "^16.5.0",
"http-server": "^14.1.1",
"jest": "^29.3.1",
"jest-environment-jsdom": "^29.3.1",
"jsdom": "^20.0.3",
"lodash": "^4.17.21",
"mini-css-extract-plugin": "^2.7.2",
"prettier": "^2.3.2",
"prettier": "^2.8.1",
"raw-loader": "^4.0.2",
"react-refresh": "^0.14.0",
"source-map": "^0.7.3",
"start-server-and-test": "^1.14.0",
"typescript": "^4.2.4",
"source-map": "^0.7.4",
"start-server-and-test": "^1.15.2",
"typescript": "^4.9.4",
"webpack": "^5.75.0",
"webpack-cli": "^5.0.1",
"webpack-dev-server": "^4.11.1"
@ -101,10 +99,6 @@
"url": "git+https://github.com/danielyxie/bitburner.git"
},
"scripts": {
"cy:test": "start-server-and-test start http://localhost:8000 cy:run",
"cy:dev": "start-server-and-test start:dev http://localhost:8000 cy:open",
"cy:open": "cypress open",
"cy:run": "cypress run",
"doc": "npx api-extractor run && npx api-documenter markdown && rm input/bitburner.api.json && rm -r input",
"format": "prettier --write .",
"format:report": "prettier -c .",

@ -88,7 +88,9 @@ const Exclusive = (props: IExclusiveProps): React.ReactElement => {
Certain <b>gangs</b>
</li>
)}
{Player.canAccessGrafting() && !props.aug.isSpecial && props.aug.name !== AugmentationNames.TheRedPill && (
{Player.canAccessGrafting() &&
!props.aug.isSpecial &&
props.aug.name !== AugmentationNames.TheRedPill && (
<li>
<b>Grafting</b>
</li>

@ -39,8 +39,8 @@ type State = {
export class Blackjack extends React.Component<Record<string, never>, State> {
deck: Deck;
constructor() {
super({});
constructor(props: Record<string, never>) {
super(props);
this.deck = new Deck(DECK_COUNT);

@ -126,8 +126,9 @@ export function Cyberpunk2077Game(props: IMinigameProps): React.ReactElement {
gap: 1,
}}
>
{flatGrid.map((item) => (
{flatGrid.map((item, idx) => (
<Typography
key={idx}
sx={{
fontSize: fontSize,
color: item.color,

@ -41,49 +41,47 @@ export function GenericLocation({ loc }: IProps): React.ReactElement {
* Determine what needs to be rendered for this location based on the locations
* type. Returns an array of React components that should be rendered
*/
function getLocationSpecificContent(): React.ReactNode[] {
const content: React.ReactNode[] = [];
function getLocationSpecificContent(): React.ReactNode {
if (loc.types.includes(LocationType.Company)) {
content.push(<CompanyLocation locName={loc.name} />);
return <CompanyLocation locName={loc.name} />;
}
if (loc.types.includes(LocationType.Gym)) {
content.push(<GymLocation loc={loc} />);
return <GymLocation loc={loc} />;
}
if (loc.types.includes(LocationType.Hospital)) {
content.push(<HospitalLocation />);
return <HospitalLocation />;
}
if (loc.types.includes(LocationType.Slums)) {
content.push(<SlumsLocation />);
return <SlumsLocation />;
}
if (loc.types.includes(LocationType.Special)) {
content.push(<SpecialLocation loc={loc} />);
return <SpecialLocation loc={loc} />;
}
if (loc.types.includes(LocationType.TechVendor)) {
content.push(<TechVendorLocation loc={loc} />);
return <TechVendorLocation loc={loc} />;
}
if (loc.types.includes(LocationType.TravelAgency)) {
content.push(<TravelAgencyRoot />);
return <TravelAgencyRoot />;
}
if (loc.types.includes(LocationType.University)) {
content.push(<UniversityLocation loc={loc} />);
return <UniversityLocation loc={loc} />;
}
if (loc.types.includes(LocationType.Casino)) {
content.push(<CasinoLocation />);
return <CasinoLocation />;
}
return content;
return null;
}
const locContent: React.ReactNode[] = getLocationSpecificContent();
const locContent: React.ReactNode = getLocationSpecificContent();
const serverMeta = serverMetadata.find((s) => s.specialName === loc.name);
const server = GetServer(serverMeta ? serverMeta.hostname : "");

@ -1,6 +1,7 @@
import { ScriptArg } from "./ScriptArg";
export type ScriptIdentifier = //This was previously in INetscriptHelper.ts, may move to its own file or a generic types file.
//This was previously in INetscriptHelper.ts, may move to its own file or a generic types file.
export type ScriptIdentifier =
| number
| {
scriptname: string;

@ -1,72 +0,0 @@
export {};
describe("netscript", () => {
it("Do naviguation", () => {
cy.findByRole("button", { name: "SKIP TUTORIAL" }).click();
cy.findByText("Dev").click();
cy.findByText(/Source-Files/i).click();
cy.findByLabelText(/all-sf-3/i).click();
cy.findByText(/Experience/i).click();
cy.findByText(/Tons of exp/i).click();
cy.findByText(/General/i).click();
cy.findByText(/Hack w0/i).click();
cy.findByText(/SEMPOOL INVALID/i);
cy.findByText(/Many decades/i, { timeout: 15000 });
cy.findByLabelText("enter-bitnode-1").click();
cy.findByText(/Enter BN1.2/i).click();
cy.get("body").type("{esc}");
cy.findByText("Dev").click();
cy.findByText(/Experience/i).click();
cy.findByText(/Tons of exp/i).click();
cy.findByText("Script Editor").click();
cy.findByText(/No Open Files/i);
cy.findByText("Active Scripts").click();
cy.findByText(/Total production since last Augment/i);
cy.findByText("Create Program").click();
cy.findByText(/This page displays/i);
cy.findByText("Stats").click();
cy.findByText(/Current City:/i);
cy.findByText("Factions").click();
cy.findByText(/Lists all/i);
cy.findByText("Augmentations").click();
cy.findByText(/Purchased Augmentations/i);
cy.findByText("Hacknet").click();
cy.findByText(/The Hacknet is a global/i);
cy.findByText("Sleeves").click();
cy.findByText(/Duplicate Sleeves are MK/i);
cy.findByText("City").click();
cy.findByText(/Sector-12/i);
cy.findByLabelText("The Slums").click();
cy.findByText("City").click();
cy.findByLabelText("Powerhouse Gym").click();
cy.findByText("City").click();
cy.findByLabelText("MegaCorp").click();
cy.findByText("Travel").click();
cy.findByText(/Travel Agency/i);
cy.findByText("Stock Market").click();
cy.findByText(/ECorp/i);
cy.findByText("Milestones").click();
cy.findByText(/don't reward you for/i);
cy.findByText("Tutorial").click();
cy.findByText(/Tutorial \/ Documentation/i);
cy.findByText("Options").click();
cy.findByText(/\.script exec time/i);
});
});

@ -1,51 +0,0 @@
export {};
describe("netscript", () => {
it("creates and runs a NetScript 2.0 script", () => {
cy.findByRole("button", { name: "SKIP TUTORIAL" }).click();
cy.findByRole("textbox").type("connect n00dles{enter}");
cy.findByText(/connected to n00dles/i);
cy.findByRole("textbox").type("run NUKE.exe{enter}");
cy.findByText(/gained root access/i);
cy.findByRole("textbox").type("home{enter}");
cy.findByText(/connected to home/i);
cy.findByRole("textbox").type("nano script.js{enter}");
// monaco can take a bit
cy.findByRole("code", { timeout: 15_000 }).type("{ctrl}a{del}").type(`export const main = async (ns) => {{}
while(true) {{}
await ns.hack("n00dles");`);
cy.findByText("RAM: 1.70GB");
cy.findByRole("button", { name: /Save \(Ctrl\/Cmd \+ s\)/i }).click();
cy.findByRole("button", { name: /Close \(Ctrl\/Cmd \+ b\)/i }).click();
cy.findByRole("textbox").type("run script.js{enter}");
cy.findByText(/Running script with 1 thread/);
cy.findByRole("textbox").type("ps{enter}");
cy.findByText(/\(PID - 1\) script.js/);
});
it("errors and shows a dialog box when static RAM !== dynamic RAM", () => {
cy.findByRole("button", { name: "SKIP TUTORIAL" }).click();
cy.findByRole("textbox").type("nano script.js{enter}");
// monaco can take a bit
cy.findByRole("code", { timeout: 15_000 }).type("{ctrl}a{del}").type(`export const main = async (ns) => {{}
const command = "hack";
ns[command]("n00dles");`);
cy.findByText("RAM: 1.60GB");
cy.findByRole("button", { name: /Save \(Ctrl\/Cmd \+ s\)/i }).click();
cy.findByRole("button", { name: /Close \(Ctrl\/Cmd \+ b\)/i }).click();
cy.findByRole("textbox").type("run script.js{enter}");
cy.findByText(/Dynamic RAM usage calculated to be greater than initial RAM usage on fn: hack./i);
});
});

@ -1,95 +0,0 @@
export {};
describe("tutorial", () => {
it("completes the tutorial", () => {
cy.findByText(/dark, dystopian future/);
cy.findByRole("button", { name: "next" }).click();
cy.findByText(/heading to the Stats page/);
cy.findByRole("button", { name: "Stats" }).click();
cy.findByText(/lot of important information/);
cy.findByRole("button", { name: "next" }).click();
cy.findByText(/head to your computer's terminal/);
cy.findByRole("button", { name: "Terminal" }).click();
cy.findByText(/is used to interface/);
cy.findByRole("button", { name: "next" }).click();
cy.findByText(/Let's try it out/i);
cy.findByRole("textbox").type("help{enter}");
cy.findByText(/displays a list of all available/i);
cy.findByRole("textbox").type("ls{enter}");
cy.findByText(/is a basic command that shows files/i);
cy.findByRole("textbox").type("scan{enter}");
cy.findByText(/that's great and all/i);
cy.findByRole("textbox").type("scan-analyze{enter}");
cy.findByText(/shows more detailed information/i);
cy.findByRole("textbox").type("scan-analyze 2{enter}");
cy.findByText(/now you can see information/i);
cy.findByRole("textbox").type("connect n00dles{enter}");
cy.findByText(/currency has become digital/i);
cy.findByRole("textbox").type("analyze{enter}");
cy.findByText(/For this server, the required hacking skill/i);
cy.findByText(/Required number of open ports for NUKE/i);
cy.findByRole("textbox").type("run NUKE.exe{enter}");
cy.findByText(/gained root access to n00dles/i);
cy.findByRole("textbox").type("hack{enter}");
cy.findByText(/now attempting to hack the server/i);
cy.findByRole("button", { name: "next" }).click();
cy.findByRole("textbox", { timeout: 15_000 }).should("not.be.disabled").type("home{enter}");
cy.findByRole("textbox").type("nano n00dles.script{enter}");
// monaco can take a bit
cy.findByRole("code", { timeout: 15_000 }).type("{selectall}{del}").type("while(true) {{}{enter}hack('n00dles');");
cy.findByRole("button", { name: /Save \(Ctrl\/Cmd \+ s\)/i }).click();
cy.findByText(/now we'll run the script/i);
cy.findByRole("textbox").type("free{enter}");
cy.findByText(/We have 8GB of free RAM on this machine/i);
cy.findByRole("textbox").type("run n00dles.script{enter}");
cy.findByText(/Your script is now running/i);
cy.findByRole("button", { name: "Active Scripts" }).click();
cy.findByText(/This page displays information about all of your scripts/i);
cy.findByRole("button", { name: "Terminal" }).click();
cy.findByText(/each active script contains logs/i);
cy.findByRole("textbox").type("tail n00dles.script{enter}");
cy.findByText(/The log for this script won't show much/i);
cy.findByRole("button", { name: "next" }).click();
cy.findByText(/Hacking is not the only way to earn money/i);
cy.findByRole("button", { name: "Hacknet" }).click();
cy.findByText(/Here you can purchase new Hacknet Nodes/i);
cy.findByRole("button", { name: /Purchase Hacknet Node/ }).click();
cy.findByText(/You just purchased a Hacknet Node!/i);
cy.findByRole("button", { name: "City" }).click();
cy.findByText(/This page lists all of the different locations/i);
cy.findByRole("button", { name: "Tutorial" }).click();
cy.findByText(/a lot of different documentation about the game/i);
cy.findByRole("button", { name: "FINISH TUTORIAL" }).click();
cy.findByText(/Tutorial \/ Documentation/i);
});
});

@ -1,21 +0,0 @@
/// <reference types="cypress" />
// ***********************************************************
// This example plugins/index.js can be used to load plugins
//
// You can change the location of this file or turn off loading
// the plugins file with the 'pluginsFile' configuration option.
//
// You can read more here:
// https://on.cypress.io/plugins-guide
// ***********************************************************
// This function is called when a project is opened or re-opened (e.g. due to
// the project's config changing)
/**
* @type {Cypress.PluginConfig}
*/
module.exports = (/*on, config*/) => {
// `on` is used to hook into various events Cypress emits
// `config` is the resolved Cypress config
};

@ -1 +0,0 @@
import "@testing-library/cypress/add-commands";

@ -1,10 +0,0 @@
export {};
beforeEach(() => {
cy.visit("/", {
onBeforeLoad(win: Cypress.AUTWindow) {
win.indexedDB.deleteDatabase("bitburnerSave");
},
});
cy.clearLocalStorage();
});

@ -1,21 +0,0 @@
// ***********************************************************
// This example support/index.js is processed and
// loaded automatically before your test files.
//
// This is a great place to put global configuration and
// behavior that modifies Cypress.
//
// You can change the location of this file or turn off
// automatically serving support files with the
// 'supportFile' configuration option.
//
// You can read more here:
// https://on.cypress.io/configuration
// ***********************************************************
// Import commands.js using ES2015 syntax:
import "./globalHooks";
import "./commands";
// Alternatively you can use CommonJS syntax:
// require('./commands')

@ -1,9 +0,0 @@
{
"extends": "../tsconfig.json",
"compilerOptions": {
"checkJs": true,
"types": ["cypress", "@testing-library/cypress"]
},
"include": ["**/*"],
"exclude": []
}

@ -4,6 +4,5 @@
"allowJs": true,
"types": ["jest"]
},
"include": ["**/*", "../src/**/*.d.ts"],
"exclude": ["cypress/**/*"]
"include": ["**/*", "../src/**/*.d.ts"]
}

@ -10,6 +10,8 @@ mkdir -p .package/dist/ || true
cp index.html .package
cp favicon.ico .package
cp -r electron/* .package
# steam_appid.txt would end up in the resource dir
rm .package/steam_appid.txt
cp -r dist .package
# Install electron sub-dependencies
@ -20,3 +22,5 @@ cd ..
BUILD_PLATFORM="${1:-"all"}"
# And finally build the app.
npm run electron:packager-$BUILD_PLATFORM
echo .build/* | xargs -n 1 cp electron/steam_appid.txt

@ -16,5 +16,5 @@
"strict": true,
"target": "es2019"
},
"include": ["src/**/*"]
"include": ["src/**/*", "electron/**/*", ".eslintrc.js"]
}