update build.mjs
This commit is contained in:
21
build.mjs
21
build.mjs
@@ -2,24 +2,17 @@ import { context } from 'esbuild';
|
|||||||
import { glob } from 'glob';
|
import { glob } from 'glob';
|
||||||
import {BitburnerPlugin} from 'esbuild-bitburner-plugin';
|
import {BitburnerPlugin} from 'esbuild-bitburner-plugin';
|
||||||
|
|
||||||
const WATCH = process.argv.includes('--watch');
|
|
||||||
|
|
||||||
const ctx = await context({
|
const ctx = await context({
|
||||||
entryPoints: await glob('./servers/**/*.{js,jsx,ts,tsx}'),
|
entryPoints: await glob('./servers/**/*.{js,jsx,ts,tsx}'),
|
||||||
bundle: true,
|
|
||||||
plugins: [BitburnerPlugin()],
|
|
||||||
write: false,
|
|
||||||
outbase: "./servers",
|
outbase: "./servers",
|
||||||
minify: !WATCH,
|
outdir: "./dist",
|
||||||
|
plugins: [BitburnerPlugin({
|
||||||
|
port: 12525
|
||||||
|
})],
|
||||||
|
bundle: true,
|
||||||
format: 'esm',
|
format: 'esm',
|
||||||
platform: 'node',
|
platform: 'browser',
|
||||||
define: WATCH ? undefined : {
|
|
||||||
'process.env.NODE_ENV': "'production'",
|
|
||||||
},
|
|
||||||
logLevel: 'info'
|
|
||||||
});
|
});
|
||||||
|
|
||||||
await ctx.rebuild();
|
ctx.watch();
|
||||||
|
|
||||||
if (WATCH) ctx.watch();
|
|
||||||
else ctx.dispose();
|
|
||||||
|
|||||||
@@ -4,8 +4,7 @@
|
|||||||
"description": "template for external editors for the game bitburner",
|
"description": "template for external editors for the game bitburner",
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"watch": "node ./build.mjs --watch",
|
"start": "node ./build.mjs"
|
||||||
"build": "node ./build.mjs"
|
|
||||||
},
|
},
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
|
|||||||
3
servers/home/example2.js
Normal file
3
servers/home/example2.js
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
export async function main(ns){
|
||||||
|
ns.tprint('hello world');
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user