diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 00000000..8da43007 --- /dev/null +++ b/.vscode/launch.json @@ -0,0 +1,31 @@ +{ + "version": "0.2.0", + "configurations": [ + { + "type": "node", + "request": "launch", + "name": "Electron Dev", + "runtimeExecutable": "npm", + "runtimeArgs": [ + "run", + "dev" + ], + "skipFiles": [ + "/**" + ] + }, + { + "type": "node", + "request": "launch", + "name": "Local Server", + "runtimeExecutable": "npm", + "runtimeArgs": [ + "run", + "serve" + ], + "skipFiles": [ + "/**" + ] + } + ] +} \ No newline at end of file diff --git a/.vscode/settings.json b/.vscode/settings.json index 1e3e2cde..c082db11 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,13 +1,5 @@ { - "typescript.tsdk": "node_modules/typescript/lib", - "typescript.tsc.autoDetect": "off", - "json.schemas": [ - { - "fileMatch": [ - "/*electron-builder.json5", - "/*electron-builder.json" - ], - "url": "https://json.schemastore.org/electron-builder" - } - ] + "editor.indentSize": "tabSize", + "editor.tabSize": 4, + "editor.insertSpaces": false } diff --git a/build.js b/build.js index f1cce5ec..2de83f6e 100644 --- a/build.js +++ b/build.js @@ -6,7 +6,8 @@ const pkg = createRequire(import.meta.url)("./package.json"); const options = commandLineArgs([ {name: 'target', type: String}, - {name: 'watch', type: Boolean} + {name: 'watch', type: Boolean}, + {name: 'serve', type: Boolean}, ]) function conditionalImportPlugin(config) { @@ -44,13 +45,20 @@ const config = { sourcemap: true, } -if (options.watch) { - async function watch() { - let ctx = await esbuild.context(config); +if (options.watch || options.serve) { + let ctx = await esbuild.context(config); + if (isApp) { await ctx.watch({}); - console.log('Watching files') + } else { + const host = 'localhost'; + const port = 3000; + await ctx.serve({ + servedir: import.meta.dirname, + host, + port + }); + console.log(`Hosting app at http://${host}:${port}`) } - watch(); } else { await esbuild.build(config); } diff --git a/package.json b/package.json index c191d16d..4d499dac 100644 --- a/package.json +++ b/package.json @@ -116,10 +116,10 @@ }, "scripts": { "dev": "concurrently --raw \"electron .\" \"node ./build.js --target=electron --watch\"", - "dev-web": "node ./build.js --target=web --serve", + "serve": "node ./build.js --target=web --serve", "build-web": "node ./build.js --target=web", "build-electron": "node ./build.js --target=electron", - "build-beta": "npm run build-electron && electron-builder --windows portable", + "build-test-portable": "npm run build-electron && electron-builder --windows portable", "publish-windows": "npm run build-electron && electron-builder -w --publish=onTagOrDraft && node ./scripts/rename_portable.js && electron-builder --windows portable --publish=onTagOrDraft", "pwa": "node ./scripts/generate_pwa.js", "prepublish": "npm run build-web && npm run pwa", diff --git a/tsconfig.json b/tsconfig.json index ac4919ed..e9321030 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,7 +1,6 @@ { "include": [ - "js/**/*", - "types/**/*" + "js/**/*" ], "compilerOptions": { "target": "ES6", diff --git a/types/blockbench-types.d.ts b/types/blockbench-types.d.ts deleted file mode 100644 index 9082a790..00000000 --- a/types/blockbench-types.d.ts +++ /dev/null @@ -1 +0,0 @@ -///