clean up frontend build config
This commit is contained in:
parent
9dc27a4b9a
commit
44bdad2e50
21 changed files with 36 additions and 18 deletions
4
.gitignore
vendored
4
.gitignore
vendored
|
@ -1,4 +1,4 @@
|
||||||
node_modules/
|
node_modules/
|
||||||
dist/*.js
|
frontend/dist/*.js
|
||||||
src/
|
frontend/.js
|
||||||
underbbs
|
underbbs
|
16
README.md
16
README.md
|
@ -2,7 +2,19 @@
|
||||||
|
|
||||||
underBBS is a platform-agnostic messaging and social media client
|
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
|
## building
|
||||||
|
|
||||||
1. `npm install`
|
requirements are
|
||||||
2. `npx tsc && npx webpack` (or run `./build.sh`, it does this for you)
|
|
||||||
|
- 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
|
13
build.sh
13
build.sh
|
@ -2,11 +2,15 @@
|
||||||
|
|
||||||
case "$1" in
|
case "$1" in
|
||||||
client)
|
client)
|
||||||
if [ ! -e ./src ]; then
|
if [ ! -e ./frontend/.js ]; then
|
||||||
mkdir ./src
|
mkdir ./frontend/.js
|
||||||
fi
|
fi
|
||||||
buildlog=$(mktemp)
|
buildlog=$(mktemp)
|
||||||
|
if [ ! -z $"{PLAN9}" ]; then
|
||||||
npx tsc 2>&1 | nobs | sed -e 's/\.ts\(/\.ts:/g' -e 's/,[0-9]+\)://g' > ${buildlog}
|
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
|
if [ -s ${buildlog} ]; then
|
||||||
cat ${buildlog} | head
|
cat ${buildlog} | head
|
||||||
rm ${buildlog}
|
rm ${buildlog}
|
||||||
|
@ -18,11 +22,8 @@ case "$1" in
|
||||||
go mod tidy
|
go mod tidy
|
||||||
go build
|
go build
|
||||||
;;
|
;;
|
||||||
both)
|
*)
|
||||||
$0 client
|
$0 client
|
||||||
$0 server
|
$0 server
|
||||||
;;
|
;;
|
||||||
*)
|
|
||||||
echo "USAGE: ${0} <client|server|both>"
|
|
||||||
;;
|
|
||||||
esac
|
esac
|
0
dist/index.html → frontend/dist/index.html
vendored
0
dist/index.html → frontend/dist/index.html
vendored
0
dist/style.css → frontend/dist/style.css
vendored
0
dist/style.css → frontend/dist/style.css
vendored
|
@ -41,7 +41,7 @@ func New() *BBSServer {
|
||||||
}
|
}
|
||||||
|
|
||||||
// frontend is here
|
// 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
|
// api
|
||||||
srvr.serveMux.Handle("/api/", http.StripPrefix("/api", srvr.apiMux()))
|
srvr.serveMux.Handle("/api/", http.StripPrefix("/api", srvr.apiMux()))
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
"removeComments": false,
|
"removeComments": false,
|
||||||
"preserveConstEnums": true,
|
"preserveConstEnums": true,
|
||||||
"sourceMap": false,
|
"sourceMap": false,
|
||||||
"outDir": "./src"
|
"outDir": "./frontend/.js"
|
||||||
},
|
},
|
||||||
"include": [ "./ts/*.ts"]
|
"include": [ "./frontend/ts/*.ts"]
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,9 +1,14 @@
|
||||||
const path = require('path');
|
const path = require('path');
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
context: path.resolve(__dirname, 'src'),
|
mode: 'production',
|
||||||
|
context: path.resolve(__dirname, 'frontend', '.js'),
|
||||||
entry: {
|
entry: {
|
||||||
main: './index.js',
|
main: './index.js',
|
||||||
serviceWorker: './serviceWorker.js'
|
serviceWorker: './serviceWorker.js',
|
||||||
|
},
|
||||||
|
output: {
|
||||||
|
filename: '[name].js',
|
||||||
|
path: path.resolve(__dirname, 'frontend', 'dist'),
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in a new issue