clean up frontend build config

This commit is contained in:
Iris Lightshard 2024-07-07 11:07:18 -06:00
parent 9dc27a4b9a
commit 44bdad2e50
Signed by: Iris Lightshard
GPG key ID: 688407174966CAF3
21 changed files with 36 additions and 18 deletions

4
.gitignore vendored
View file

@ -1,4 +1,4 @@
node_modules/
dist/*.js
src/
frontend/dist/*.js
frontend/.js
underbbs

View file

@ -2,7 +2,19 @@
underBBS is a platform-agnostic messaging and social media client
## design
`underbbs` supports multiple simultaneous account logins, mediating them for each user through a gateway server that handles all protocol-specific logic via `adapter`s and streaming content to the user through a single websocket connection with a singular data interface.
each distinct `adapter` connection/configuration is represented in the frontend as a tab, and using the websocket's event-driven javascript interface with web components we can simply either store the data or tell the currently visible adapter that it might need to respond to the new data
adapters receive commands via a quartzgun web API and send data back on their shared websocket connection
## building
1. `npm install`
2. `npx tsc && npx webpack` (or run `./build.sh`, it does this for you)
requirements are
- go 1.22
- any recent nodejs that can do `typescript` and `webpack` 5
run `./build.sh` from the project root. you can supply 'front' or 'server' as an argument to build only one or the other; by default it builds both

View file

@ -2,11 +2,15 @@
case "$1" in
client)
if [ ! -e ./src ]; then
mkdir ./src
if [ ! -e ./frontend/.js ]; then
mkdir ./frontend/.js
fi
buildlog=$(mktemp)
if [ ! -z $"{PLAN9}" ]; then
npx tsc 2>&1 | nobs | sed -e 's/\.ts\(/\.ts:/g' -e 's/,[0-9]+\)://g' > ${buildlog}
else
npx tsc 2>&1 > ${buildlog}
fi
if [ -s ${buildlog} ]; then
cat ${buildlog} | head
rm ${buildlog}
@ -18,11 +22,8 @@ case "$1" in
go mod tidy
go build
;;
both)
*)
$0 client
$0 server
;;
*)
echo "USAGE: ${0} <client|server|both>"
;;
esac

View file

@ -41,7 +41,7 @@ func New() *BBSServer {
}
// frontend is here
srvr.serveMux.Handle("/app/", http.StripPrefix("/app/", renderer.Subtree("./dist")))
srvr.serveMux.Handle("/app/", http.StripPrefix("/app/", renderer.Subtree("./frontend/dist")))
// api
srvr.serveMux.Handle("/api/", http.StripPrefix("/api", srvr.apiMux()))

View file

@ -10,7 +10,7 @@
"removeComments": false,
"preserveConstEnums": true,
"sourceMap": false,
"outDir": "./src"
"outDir": "./frontend/.js"
},
"include": [ "./ts/*.ts"]
"include": [ "./frontend/ts/*.ts"]
}

View file

@ -1,9 +1,14 @@
const path = require('path');
module.exports = {
context: path.resolve(__dirname, 'src'),
mode: 'production',
context: path.resolve(__dirname, 'frontend', '.js'),
entry: {
main: './index.js',
serviceWorker: './serviceWorker.js'
serviceWorker: './serviceWorker.js',
},
output: {
filename: '[name].js',
path: path.resolve(__dirname, 'frontend', 'dist'),
}
}