Use different template

Template used: https://github.com/NilsRamstoeck/bb-external-editor/tree/main
This commit is contained in:
Isaac Shoebottom 2023-11-02 14:10:24 -03:00
parent 6aefaa64db
commit 9ab9ca9639
16 changed files with 258 additions and 0 deletions

133
.gitignore vendored Normal file
View File

@ -0,0 +1,133 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
lerna-debug.log*
.pnpm-debug.log*
# Diagnostic reports (https://nodejs.org/api/report.html)
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
# Runtime data
pids
*.pid
*.seed
*.pid.lock
# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov
# Coverage directory used by tools like istanbul
coverage
*.lcov
# nyc test coverage
.nyc_output
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
.grunt
# Bower dependency directory (https://bower.io/)
bower_components
# node-waf configuration
.lock-wscript
# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release
# Dependency directories
node_modules/
jspm_packages/
# Snowpack dependency directory (https://snowpack.dev/)
web_modules/
# TypeScript cache
*.tsbuildinfo
# Optional npm cache directory
.npm
# Optional eslint cache
.eslintcache
# Optional stylelint cache
.stylelintcache
# Microbundle cache
.rpt2_cache/
.rts2_cache_cjs/
.rts2_cache_es/
.rts2_cache_umd/
# Optional REPL history
.node_repl_history
# Output of 'npm pack'
*.tgz
# Yarn Integrity file
.yarn-integrity
# dotenv environment variable files
.env
.env.development.local
.env.test.local
.env.production.local
.env.local
# parcel-bundler cache (https://parceljs.org/)
.cache
.parcel-cache
# Next.js build output
.next
out
# Nuxt.js build / generate output
.nuxt
dist
# Gatsby files
.cache/
# Comment in the public line in if your project uses Gatsby and not Next.js
# https://nextjs.org/blog/next-9-1#public-directory-support
# public
# vuepress build output
.vuepress/dist
# vuepress v2.x temp and cache directory
.temp
.cache
# Docusaurus cache and generated files
.docusaurus
# Serverless directories
.serverless/
# FuseBox cache
.fusebox/
# DynamoDB Local files
.dynamodb/
# TernJS port file
.tern-port
# Stores VSCode versions used for testing VSCode extensions
.vscode-test
# yarn v2
.yarn/cache
.yarn/unplugged
.yarn/build-state.yml
.yarn/install-state.gz
.pnp.*
# Netscript Type Definitions. These are pulled from the game
NetscriptDefinitions.d.ts

21
LICENSE Normal file
View File

@ -0,0 +1,21 @@
MIT License
Copyright (c) 2023 Nils Ramstoeck
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

27
README.md Normal file
View File

@ -0,0 +1,27 @@
# bb-external-editor
This is a template for using any external editor for Bitburner. This Template supports JSX, TS and TSX out of the box.
## How to use
1. If you dont already have it installed, install [NodeJS](https://nodejs.org)
1. Clone this repository
1. navigate to the template (`cd path/to/the/template`) inside your console
1. run `npm install` in your console to install all dependencies
1. run `npm start` in your console to start the RemoteAPI server
1. open Bitburner and navigate to the settings
1. open the tab labeled 'Remote API' and enter the port '12525'
1. press connect
Now any changes made to scripts inside the server folders will automatically be uploaded to Bitburner.
## Using React
The React and ReactDOM instance from the game can simply be imported as ESModules
```js
import React from 'react' //and
import ReactDOM from 'react-dom'
```
For more in-depth details have a look at the [plugin](https://github.com/NilsRamstoeck/esbuild-bitburner-plugin) powering this template!

26
build.mjs Normal file
View File

@ -0,0 +1,26 @@
import { context } from 'esbuild';
import { BitburnerPlugin } from 'esbuild-bitburner-plugin';
const createContext = async () => await context({
entryPoints: [
'servers/**/*.js',
'servers/**/*.jsx',
'servers/**/*.ts',
'servers/**/*.tsx',
],
outbase: "./servers",
outdir: "./dist",
plugins: [
BitburnerPlugin({
port: 12525,
types: 'NetscriptDefinitions.d.ts'
})
],
bundle: true,
format: 'esm',
platform: 'browser',
logLevel: 'info'
});
let ctx = await createContext();
ctx.watch();

BIN
package-lock.json generated Normal file

Binary file not shown.

26
package.json Normal file
View File

@ -0,0 +1,26 @@
{
"name": "bb-external-editor",
"version": "1.0.0",
"description": "template for external editors for the game bitburner",
"main": "index.js",
"scripts": {
"start": "node ./build.mjs"
},
"repository": {
"type": "git",
"url": "git+https://github.com/NilsRamstoeck/bb-external-editor.git"
},
"author": "Nils Ramstöck",
"license": "MIT",
"bugs": {
"url": "https://github.com/NilsRamstoeck/bb-external-editor/issues"
},
"homepage": "https://github.com/NilsRamstoeck/bb-external-editor#readme",
"dependencies": {
"@types/react": "^18.2.25",
"@types/react-dom": "^18.2.10",
"esbuild": "^0.19.4",
"esbuild-bitburner-plugin": "^1.0.1",
"glob": "^10.3.10"
}
}

25
tsconfig.json Normal file
View File

@ -0,0 +1,25 @@
{
"compilerOptions": {
"target": "esnext",
"useDefineForClassFields": true,
"module": "ESNext",
"moduleResolution": "node",
"esModuleInterop": true,
"lib": [
"esnext",
"dom",
"dom.iterable"
],
"baseUrl": "./",
"jsx": "react",
"paths": {
"@/*": [
"src/*"
],
"NetscriptDefinitions" : ["NetscriptDefinitions.d.ts"]
}
},
"include": [
"servers/**/*.ts*"
]
}