move to Makefile
This commit is contained in:
30
Justfile
30
Justfile
@ -1,30 +0,0 @@
|
|||||||
run *ARGS: build
|
|
||||||
./target/debug/nuchat {{ARGS}}
|
|
||||||
|
|
||||||
start: build
|
|
||||||
./target/debug/nuchat 2>&1 > target/debug/logs/nuchat.log &
|
|
||||||
|
|
||||||
build: build-cargo build-ui
|
|
||||||
|
|
||||||
build-cargo:
|
|
||||||
@mkdir -p target/debug/logs
|
|
||||||
@mkdir -p dist
|
|
||||||
cargo build
|
|
||||||
|
|
||||||
[working-directory: "ui"]
|
|
||||||
build-ui:
|
|
||||||
npm install
|
|
||||||
npm run build
|
|
||||||
|
|
||||||
test: integration unit
|
|
||||||
|
|
||||||
integration:
|
|
||||||
if [ ! $(curl -sf "localhost:7000/api/healthcheck" ) ]; then just run; fi
|
|
||||||
cargo test --test '*'
|
|
||||||
|
|
||||||
unit:
|
|
||||||
cargo test --lib --bins
|
|
||||||
|
|
||||||
docker *ARGS:
|
|
||||||
docker compose build
|
|
||||||
docker compose up {{ARGS}}
|
|
||||||
25
Makefile
Normal file
25
Makefile
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
dist: ui
|
||||||
|
cd ui && make dist
|
||||||
|
|
||||||
|
target/debug/nuchat: src dist
|
||||||
|
cargo build
|
||||||
|
|
||||||
|
target/release/nuchat: src dist
|
||||||
|
cargo build --release
|
||||||
|
|
||||||
|
.PHONY: build release test docker run start
|
||||||
|
build: target/debug/nuchat
|
||||||
|
|
||||||
|
release: target/release/nuchat
|
||||||
|
|
||||||
|
test: build
|
||||||
|
cargo test
|
||||||
|
|
||||||
|
docker:
|
||||||
|
docker compose build
|
||||||
|
|
||||||
|
run: docker
|
||||||
|
docker compose up
|
||||||
|
|
||||||
|
start:
|
||||||
|
docker compose up -d
|
||||||
6
package-lock.json
generated
Normal file
6
package-lock.json
generated
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
{
|
||||||
|
"name": "nuchat",
|
||||||
|
"lockfileVersion": 3,
|
||||||
|
"requires": true,
|
||||||
|
"packages": {}
|
||||||
|
}
|
||||||
@ -20,9 +20,7 @@ struct Args {
|
|||||||
async fn main() -> Result<(), std::io::Error> {
|
async fn main() -> Result<(), std::io::Error> {
|
||||||
let args = Args::parse();
|
let args = Args::parse();
|
||||||
let str_address = format!("{}:{}", args.host, args.port);
|
let str_address = format!("{}:{}", args.host, args.port);
|
||||||
let address: SocketAddr = str_address
|
let address: SocketAddr = str_address.parse().unwrap(); // _or_else(|_| panic!("could not parse address: {str_address}"));
|
||||||
.parse()
|
|
||||||
.unwrap_or_else(|_| panic!("could not parse address: {str_address}"));
|
|
||||||
let listener = tokio::net::TcpListener::bind(address).await?;
|
let listener = tokio::net::TcpListener::bind(address).await?;
|
||||||
let result = run(listener)?.await;
|
let result = run(listener)?.await;
|
||||||
event!(Level::INFO, "Server stopped");
|
event!(Level::INFO, "Server stopped");
|
||||||
|
|||||||
@ -1,5 +0,0 @@
|
|||||||
install:
|
|
||||||
npm install
|
|
||||||
|
|
||||||
build: install
|
|
||||||
npm run build
|
|
||||||
5
ui/Makefile
Normal file
5
ui/Makefile
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
dist: node_modules
|
||||||
|
npm run build
|
||||||
|
|
||||||
|
node_modules: package.json package-lock.json
|
||||||
|
npm ci
|
||||||
Reference in New Issue
Block a user