mirror of
https://github.com/JannisX11/blockbench.git
synced 2025-04-06 17:31:09 +08:00
Add local serving and launch configurations
This commit is contained in:
parent
56d6cbfa52
commit
6cd7dc7ce8
31
.vscode/launch.json
vendored
Normal file
31
.vscode/launch.json
vendored
Normal file
@ -0,0 +1,31 @@
|
||||
{
|
||||
"version": "0.2.0",
|
||||
"configurations": [
|
||||
{
|
||||
"type": "node",
|
||||
"request": "launch",
|
||||
"name": "Electron Dev",
|
||||
"runtimeExecutable": "npm",
|
||||
"runtimeArgs": [
|
||||
"run",
|
||||
"dev"
|
||||
],
|
||||
"skipFiles": [
|
||||
"<node_internals>/**"
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "node",
|
||||
"request": "launch",
|
||||
"name": "Local Server",
|
||||
"runtimeExecutable": "npm",
|
||||
"runtimeArgs": [
|
||||
"run",
|
||||
"serve"
|
||||
],
|
||||
"skipFiles": [
|
||||
"<node_internals>/**"
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
14
.vscode/settings.json
vendored
14
.vscode/settings.json
vendored
@ -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
|
||||
}
|
||||
|
20
build.js
20
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);
|
||||
}
|
||||
|
@ -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",
|
||||
|
@ -1,7 +1,6 @@
|
||||
{
|
||||
"include": [
|
||||
"js/**/*",
|
||||
"types/**/*"
|
||||
"js/**/*"
|
||||
],
|
||||
"compilerOptions": {
|
||||
"target": "ES6",
|
||||
|
1
types/blockbench-types.d.ts
vendored
1
types/blockbench-types.d.ts
vendored
@ -1 +0,0 @@
|
||||
/// <reference types="blockbench-types" />
|
Loading…
x
Reference in New Issue
Block a user