mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2024-11-27 01:53:48 +01:00
Merge branch 'dev' into import-autoreload
This commit is contained in:
commit
69fbfe87c0
14
.dockerignore
Normal file
14
.dockerignore
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
node_modules/
|
||||||
|
|
||||||
|
.git
|
||||||
|
.gitattributes
|
||||||
|
.gitignore
|
||||||
|
.editorconfig
|
||||||
|
|
||||||
|
.dockerignore
|
||||||
|
Dockerfile
|
||||||
|
docker-compose.yml
|
||||||
|
|
||||||
|
*.md
|
||||||
|
Quotes.txt
|
||||||
|
netscript_tests/
|
35
Dockerfile
Normal file
35
Dockerfile
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
FROM node:15.14.0 AS base
|
||||||
|
|
||||||
|
WORKDIR /app
|
||||||
|
|
||||||
|
# Scripts used in the npm preinstall hook
|
||||||
|
COPY scripts/engines-check.js scripts/semver.js scripts/
|
||||||
|
|
||||||
|
# Adding our dependencies and install before adding the rest of the files
|
||||||
|
# This prevents reinstallation of npm packages for every subsequent code modification
|
||||||
|
ENV npm_config_update_notifier=false
|
||||||
|
COPY package.json package-lock.json ./
|
||||||
|
RUN npm ci --loglevel=error --no-audit --no-fund && npm rebuild node-sass
|
||||||
|
|
||||||
|
# Adding all the remaining source files
|
||||||
|
COPY . .
|
||||||
|
|
||||||
|
# We need more than the default 512MB otherwise webpack will throw 'heap out of memory' exceptions
|
||||||
|
# https://nodejs.org/api/cli.html#cli_max_old_space_size_size_in_megabytes
|
||||||
|
ENV NODE_OPTIONS=--max-old-space-size=1536
|
||||||
|
|
||||||
|
FROM base AS dev
|
||||||
|
# This is the main development build using the file watcher if you mount volumes
|
||||||
|
USER node
|
||||||
|
EXPOSE 8000
|
||||||
|
CMD npm run start:container
|
||||||
|
|
||||||
|
FROM base AS prod-dist
|
||||||
|
# We'll simply build the production dist files here to later reuse in a simple webserver
|
||||||
|
RUN npm run build
|
||||||
|
|
||||||
|
FROM nginx:1.20.0-alpine AS prod
|
||||||
|
WORKDIR /usr/share/nginx/html
|
||||||
|
COPY --from=prod-dist /app/dist ./dist
|
||||||
|
COPY --from=prod-dist /app/index.html /app/favicon.ico /app/license.txt ./
|
||||||
|
EXPOSE 80
|
15
docker-compose.yml
Normal file
15
docker-compose.yml
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
version: "3.4"
|
||||||
|
services:
|
||||||
|
web:
|
||||||
|
image: bitburner:dev
|
||||||
|
build:
|
||||||
|
context: .
|
||||||
|
dockerfile: Dockerfile
|
||||||
|
target: dev
|
||||||
|
ports:
|
||||||
|
- "8000:8000"
|
||||||
|
volumes:
|
||||||
|
- ./src:/app/src
|
||||||
|
- ./css:/app/css
|
||||||
|
- ./utils:/app/utils
|
||||||
|
- ./test:/app/test
|
@ -113,6 +113,7 @@
|
|||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"start:dev": "webpack-dev-server --progress --env.devServer --mode development",
|
"start:dev": "webpack-dev-server --progress --env.devServer --mode development",
|
||||||
|
"start:container": "webpack-dev-server --progress --env.devServer --mode development --env.runInContainer",
|
||||||
"build": "webpack --mode production",
|
"build": "webpack --mode production",
|
||||||
"build:dev": "webpack --mode development",
|
"build:dev": "webpack --mode development",
|
||||||
"build:test": "webpack --config webpack.config-test.js",
|
"build:test": "webpack --config webpack.config-test.js",
|
||||||
@ -121,6 +122,7 @@
|
|||||||
"lint:style": "stylelint --fix ./css/*",
|
"lint:style": "stylelint --fix ./css/*",
|
||||||
"preinstall": "node ./scripts/engines-check.js",
|
"preinstall": "node ./scripts/engines-check.js",
|
||||||
"test": "mochapack --webpack-config webpack.config-test.js -r jsdom-global/register ./test/index.js",
|
"test": "mochapack --webpack-config webpack.config-test.js -r jsdom-global/register ./test/index.js",
|
||||||
|
"test:container": "mochapack --webpack-config webpack.config-test.js --slow 2000 --timeout 10000 -r jsdom-global/register ./test/index.js",
|
||||||
"watch": "webpack --watch --mode production",
|
"watch": "webpack --watch --mode production",
|
||||||
"watch:dev": "webpack --watch --mode development"
|
"watch:dev": "webpack --watch --mode development"
|
||||||
},
|
},
|
||||||
|
33
src/Alias.ts
33
src/Alias.ts
@ -51,14 +51,14 @@ function addAlias(name: string, value: string): void {
|
|||||||
if (name in GlobalAliases) {
|
if (name in GlobalAliases) {
|
||||||
delete GlobalAliases[name];
|
delete GlobalAliases[name];
|
||||||
}
|
}
|
||||||
Aliases[name] = value;
|
Aliases[name] = value.trim();
|
||||||
}
|
}
|
||||||
|
|
||||||
function addGlobalAlias(name: string, value: string): void {
|
function addGlobalAlias(name: string, value: string): void {
|
||||||
if (name in Aliases){
|
if (name in Aliases){
|
||||||
delete Aliases[name];
|
delete Aliases[name];
|
||||||
}
|
}
|
||||||
GlobalAliases[name] = value;
|
GlobalAliases[name] = value.trim();
|
||||||
}
|
}
|
||||||
|
|
||||||
function getAlias(name: string): string | null {
|
function getAlias(name: string): string | null {
|
||||||
@ -97,22 +97,29 @@ export function removeAlias(name: string): boolean {
|
|||||||
export function substituteAliases(origCommand: string): string {
|
export function substituteAliases(origCommand: string): string {
|
||||||
const commandArray = origCommand.split(" ");
|
const commandArray = origCommand.split(" ");
|
||||||
if (commandArray.length > 0){
|
if (commandArray.length > 0){
|
||||||
// For the unalias command, dont substite
|
// For the alias and unalias commands, dont substite
|
||||||
if (commandArray[0] === "unalias") { return commandArray.join(" "); }
|
if (commandArray[0] === "unalias" || commandArray[0] === "alias") { return commandArray.join(" "); }
|
||||||
|
|
||||||
const alias = getAlias(commandArray[0]);
|
let somethingSubstituted = true;
|
||||||
|
let depth = 0;
|
||||||
|
|
||||||
|
while(somethingSubstituted && depth < 10){
|
||||||
|
depth++;
|
||||||
|
somethingSubstituted = false
|
||||||
|
const alias = getAlias(commandArray[0])?.split(" ");
|
||||||
if (alias != null) {
|
if (alias != null) {
|
||||||
commandArray[0] = alias;
|
somethingSubstituted = true
|
||||||
} else {
|
commandArray.splice(0, 1, ...alias);
|
||||||
const alias = getGlobalAlias(commandArray[0]);
|
//commandArray[0] = alias;
|
||||||
if (alias != null) {
|
|
||||||
commandArray[0] = alias;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
for (let i = 0; i < commandArray.length; ++i) {
|
for (let i = 0; i < commandArray.length; ++i) {
|
||||||
const alias = getGlobalAlias(commandArray[i]);
|
const alias = getGlobalAlias(commandArray[i])?.split(" ");
|
||||||
if (alias != null) {
|
if (alias != null) {
|
||||||
commandArray[i] = alias;
|
somethingSubstituted = true
|
||||||
|
commandArray.splice(i, 1, ...alias);
|
||||||
|
i += alias.length - 1;
|
||||||
|
//commandArray[i] = alias;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
import { IMap } from "./types";
|
import { IMap } from "./types";
|
||||||
|
|
||||||
export const CONSTANTS: IMap<any> = {
|
export const CONSTANTS: IMap<any> = {
|
||||||
Version: "0.51.8",
|
Version: "0.51.9",
|
||||||
|
|
||||||
/** Max level for any skill, assuming no multipliers. Determined by max numerical value in javascript for experience
|
/** Max level for any skill, assuming no multipliers. Determined by max numerical value in javascript for experience
|
||||||
* and the skill level formula in Player.js. Note that all this means it that when experience hits MAX_INT, then
|
* and the skill level formula in Player.js. Note that all this means it that when experience hits MAX_INT, then
|
||||||
@ -228,60 +228,19 @@ export const CONSTANTS: IMap<any> = {
|
|||||||
|
|
||||||
LatestUpdate:
|
LatestUpdate:
|
||||||
`
|
`
|
||||||
v0.51.8 - 2021-05-07 It was there all along (hydroflame)
|
v0.51.9 - 2021-05-07 untitled yet
|
||||||
-------
|
-------
|
||||||
|
|
||||||
Servers
|
Offline
|
||||||
|
|
||||||
* Update n00dles metadata
|
* Offline money gain has been reworked (it is more generous)
|
||||||
|
* If you're not working anywhere and go offline the game will work for you
|
||||||
|
at all your factions evenly.
|
||||||
|
|
||||||
Netscript
|
Export
|
||||||
|
* Exporting now gives +1 favor to all joined factions every 24h.
|
||||||
* 'hashGainRate' use the correct 'usedRam' and 'maxRam'
|
|
||||||
* Fix 'setActionAutolevel' logging.
|
|
||||||
* Fix 'setActionLevel' not working at all.
|
|
||||||
* Add 'installBackdoor' singularity function.
|
|
||||||
|
|
||||||
Hacknet
|
|
||||||
|
|
||||||
* Fix Hacknet Servers total production always displaying 0
|
|
||||||
|
|
||||||
Documentation
|
|
||||||
|
|
||||||
* Updated guide to no longer recommend BN12.
|
|
||||||
* Fix documentation for maxNumNodes (@ModdedGamers)
|
|
||||||
* Fix typo in 'sourcefiles.rst'
|
|
||||||
* Fix typo in 'recommendedbitnodeorder.rst'
|
|
||||||
* Fix 'getServer' documentation missing 'server' argument.
|
|
||||||
* Fix missing ram cost in 'getData.rst'
|
|
||||||
* Fix basic formulas examples.
|
|
||||||
* Fix typo in BN11 description.
|
|
||||||
* Fix formatting issue in Bladeburner (@Pimgd)
|
|
||||||
|
|
||||||
Misc.
|
Misc.
|
||||||
|
* ls now correctly lists all files.
|
||||||
* Fix negative money being displayed in full.
|
|
||||||
* Fix Hacking Missions not working.
|
|
||||||
* Fix Corporation tree not rendering.
|
|
||||||
* Fix script being needlessly recompiled. This should save real ram (not game ram)
|
|
||||||
* w0r1d_d43m0n can be backdoored
|
|
||||||
* Coding Contracts title is click-to-copy (@Rodeth)
|
|
||||||
* Covenant memory upgrade works better.
|
|
||||||
* Fix Neuroflux not being correctly calculated when entering BN with SF12.
|
|
||||||
* Delete Active Script now delete all active scripts, not just home.
|
|
||||||
* Now you can 'cd' in directories that only contain '.txt' files.
|
|
||||||
* Fix 'analyze' always saying players had root access
|
|
||||||
* Passive faction rep no longer builds for special factions.
|
|
||||||
* Donation option no longer appears for special factions.
|
|
||||||
* Rephrased some milestones.
|
|
||||||
* donation textbox now accepts money in the format '1b' and the like (@Dawe)
|
|
||||||
* Fix being able to join hated factions simultaneously. (@Dawe)
|
|
||||||
* 'ls' now displays files in multiple column. (Helps players with many files)
|
|
||||||
* Bladeburner multiplers now appear under Character>Stats and
|
|
||||||
Character>Augmentation when they are relevant.
|
|
||||||
* Fix missing functions syntax highlight in codemirror.
|
|
||||||
* Fix infiltration number formatting.
|
|
||||||
* script income transfers to parent on death. This helps keep track of
|
|
||||||
income for scripts that spawn short lived scripts.
|
|
||||||
`,
|
`,
|
||||||
}
|
}
|
@ -625,7 +625,12 @@ let Terminal = {
|
|||||||
Terminal.commandHistoryIndex = Terminal.commandHistory.length;
|
Terminal.commandHistoryIndex = Terminal.commandHistory.length;
|
||||||
|
|
||||||
// Split commands and execute sequentially
|
// Split commands and execute sequentially
|
||||||
commands = commands.split(";");
|
commands = commands
|
||||||
|
.match(/(?:'[^']*'|"[^"]*"|[^;"])*/g)
|
||||||
|
.map(substituteAliases)
|
||||||
|
.map(c => c.match(/(?:'[^']*'|"[^"]*"|[^;"])*/g))
|
||||||
|
.flat();
|
||||||
|
console.log(commands);
|
||||||
for (let i = 0; i < commands.length; i++) {
|
for (let i = 0; i < commands.length; i++) {
|
||||||
if(commands[i].match(/^\s*$/)) { continue; } // Don't run commands that only have whitespace
|
if(commands[i].match(/^\s*$/)) { continue; } // Don't run commands that only have whitespace
|
||||||
Terminal.executeCommand(commands[i].trim());
|
Terminal.executeCommand(commands[i].trim());
|
||||||
@ -727,9 +732,6 @@ let Terminal = {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Process any aliases
|
|
||||||
command = substituteAliases(command);
|
|
||||||
|
|
||||||
// Allow usage of ./
|
// Allow usage of ./
|
||||||
if (command.startsWith("./")) {
|
if (command.startsWith("./")) {
|
||||||
command = "run " + command.slice(2);
|
command = "run " + command.slice(2);
|
||||||
@ -873,7 +875,7 @@ let Terminal = {
|
|||||||
if (commandArray.length === 3) {
|
if (commandArray.length === 3) {
|
||||||
if (commandArray[1] === "-g") {
|
if (commandArray[1] === "-g") {
|
||||||
if (parseAliasDeclaration(commandArray[2], true)) {
|
if (parseAliasDeclaration(commandArray[2], true)) {
|
||||||
post(`Set global alias ${commandArray[1]}`);
|
post(`Set global alias ${commandArray[2]}`);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -5,6 +5,7 @@ var HtmlWebpackPlugin = require('html-webpack-plugin');
|
|||||||
|
|
||||||
module.exports = (env, argv) => {
|
module.exports = (env, argv) => {
|
||||||
const isDevServer = (env || {}).devServer === true;
|
const isDevServer = (env || {}).devServer === true;
|
||||||
|
const runInContainer = (env || {}).runInContainer === true;
|
||||||
const isDevelopment = argv.mode === 'development';
|
const isDevelopment = argv.mode === 'development';
|
||||||
const outputDirectory = isDevServer ? "dist-dev" : "dist";
|
const outputDirectory = isDevServer ? "dist-dev" : "dist";
|
||||||
const entries = {};
|
const entries = {};
|
||||||
@ -22,6 +23,22 @@ module.exports = (env, argv) => {
|
|||||||
entrypoints: true,
|
entrypoints: true,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const devServerSettings = {
|
||||||
|
port: 8000,
|
||||||
|
publicPath: `/`,
|
||||||
|
stats: statsConfig,
|
||||||
|
};
|
||||||
|
|
||||||
|
// By default, the webpack-dev-server is not exposed outside of localhost.
|
||||||
|
// When running in a container we need it accessible externally.
|
||||||
|
if (runInContainer) {
|
||||||
|
devServerSettings.disableHostCheck = true;
|
||||||
|
devServerSettings.host = '0.0.0.0';
|
||||||
|
devServerSettings.watchOptions = {
|
||||||
|
poll: true,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
plugins: [
|
plugins: [
|
||||||
new webpack.DefinePlugin({
|
new webpack.DefinePlugin({
|
||||||
@ -131,11 +148,7 @@ module.exports = (env, argv) => {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
devServer: {
|
devServer: devServerSettings,
|
||||||
port: 8000,
|
|
||||||
publicPath: `/`,
|
|
||||||
stats: statsConfig,
|
|
||||||
},
|
|
||||||
resolve: {
|
resolve: {
|
||||||
extensions: [
|
extensions: [
|
||||||
".tsx",
|
".tsx",
|
||||||
|
Loading…
Reference in New Issue
Block a user