Compare commits
2 Commits
c72ab0cd3c
...
9ab9ca9639
Author | SHA1 | Date | |
---|---|---|---|
9ab9ca9639 | |||
6aefaa64db |
133
.gitignore
vendored
Normal file
133
.gitignore
vendored
Normal 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
|
3
.gitmodules
vendored
3
.gitmodules
vendored
@ -1,3 +0,0 @@
|
||||
[submodule "typescript-template"]
|
||||
path = typescript-template
|
||||
url = https://github.com/bitburner-official/typescript-template
|
21
LICENSE
Normal file
21
LICENSE
Normal 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
27
README.md
Normal 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
26
build.mjs
Normal 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
BIN
package-lock.json
generated
Normal file
Binary file not shown.
26
package.json
Normal file
26
package.json
Normal 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"
|
||||
}
|
||||
}
|
38
setup.ps1
38
setup.ps1
@ -1,38 +0,0 @@
|
||||
if (-Not ([Security.Principal.WindowsPrincipal] [Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole]'Administrator'))
|
||||
{
|
||||
$CommandLine = "-c cd '$pwd'; & `"" + $MyInvocation.MyCommand.Path + "`""
|
||||
Start-Process powershell -Verb runas -ArgumentList $CommandLine
|
||||
exit
|
||||
}
|
||||
|
||||
# Folder handle for the submodule src folder
|
||||
$srcFolder = "typescript-template\src\"
|
||||
|
||||
# Init git submodules
|
||||
git submodule update --init --recursive
|
||||
# Check if submodule src folder exists
|
||||
if (!(Test-Path $srcFolder))
|
||||
{
|
||||
Write-Host "No submodule src folder found"
|
||||
# Make a link from the src folder to the submodule src folder
|
||||
New-Item -ItemType SymbolicLink -Path $srcFolder -Target src
|
||||
}
|
||||
elseif ((Get-Item $srcFolder).Attributes -match 'ReparsePoint')
|
||||
{
|
||||
Write-Host "Submodule src folder is a soft link"
|
||||
# Remove the soft link
|
||||
Remove-Item $srcFolder -Recurse
|
||||
|
||||
# Make a link from the src folder to the submodule src folder
|
||||
New-Item -ItemType SymbolicLink -Path $srcFolder -Target src
|
||||
}
|
||||
else
|
||||
{
|
||||
Write-Host "Submodule src folder is newly created"
|
||||
# Remove the src folder
|
||||
Remove-Item $srcFolder -Recurse
|
||||
|
||||
# Make a link from the src folder to the submodule src folder
|
||||
New-Item -ItemType SymbolicLink -Path $srcFolder -Target src
|
||||
}
|
||||
# Add Read-Host to see the output
|
@ -1,10 +0,0 @@
|
||||
import ReactNamespace from 'react/index';
|
||||
import ReactDomNamespace from 'react-dom';
|
||||
|
||||
const React = window.React as typeof ReactNamespace;
|
||||
const ReactDOM = window.ReactDOM as typeof ReactDomNamespace;
|
||||
|
||||
export default React;
|
||||
export {
|
||||
ReactDOM
|
||||
}
|
25
tsconfig.json
Normal file
25
tsconfig.json
Normal 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*"
|
||||
]
|
||||
}
|
@ -1 +0,0 @@
|
||||
Subproject commit 4136ab7107b75cf381acb21d1da7aa9e5e5b80fa
|
Loading…
Reference in New Issue
Block a user