Skip to content

Commit 2797794

Browse files
committedNov 27, 2024
removing/initializing node_modules with make clean and start_dev.sh
1 parent 5114f21 commit 2797794

File tree

2 files changed

+36
-31
lines changed

2 files changed

+36
-31
lines changed
 

‎Makefile

+33-31
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,33 @@
1-
PROJECT_NAME := $(shell cargo read-manifest --manifest-path ./server/Cargo.toml | jq -r ".name")
2-
PROJECT_VER := $(shell cargo read-manifest --manifest-path ./server/Cargo.toml | jq -r ".version")
3-
BIN_DIR := ./bin
4-
STATIC_DIR := ./client/dist
5-
PROJECT_SRCS := $(shell find server/src -type f -iname *.rs) \
6-
$(shell find server/src -type f -iname *.html) \
7-
./server/Cargo.toml \
8-
./server/Cargo.lock
9-
STATIC_SRCS := client/package.json \
10-
client/pnpm-lock.yaml \
11-
client/tailwind.config.js \
12-
client/src/style.css \
13-
$(shell find client/src -type f -iname *.js) \
14-
$(shell find client/static -type f) \
15-
$(shell find server/src -type f -iname *.html)
16-
STATIC_OBJS := $(addprefix $(BIN_DIR)/static/,index.js style.css icon.svg)
17-
DIST_DIR = $(BIN_DIR)/dist
18-
DOCKER_TEMPLATE = ./containers/Dockerfile.template
19-
PACK_TARGETS = x86-64-musl \
20-
x86-64-v3-musl \
21-
x86-64-v4-musl \
22-
aarch64-musl \
23-
aarch64-gnu \
24-
armv6-musleabi \
25-
armv7-musleabi \
26-
riscv64gc-gnu
27-
28-
fn_output_path = $(BIN_DIR)/$(1)/$(PROJECT_NAME)
29-
fn_target_path = server/target/$(1)/$(PROJECT_NAME)
1+
PROJECT_NAME := $(shell cargo read-manifest --manifest-path ./server/Cargo.toml | jq -r ".name")
2+
PROJECT_VER := $(shell cargo read-manifest --manifest-path ./server/Cargo.toml | jq -r ".version")
3+
BIN_DIR := ./bin
4+
STATIC_DIR := ./client/dist
5+
NODE_MODULES_DIR := ./client/node_modules
6+
PROJECT_SRCS := $(shell find server/src -type f -iname *.rs) \
7+
$(shell find server/src -type f -iname *.html) \
8+
./server/Cargo.toml \
9+
./server/Cargo.lock
10+
STATIC_SRCS := client/package.json \
11+
client/pnpm-lock.yaml \
12+
client/tailwind.config.js \
13+
client/src/style.css \
14+
$(shell find client/src -type f -iname *.js) \
15+
$(shell find client/static -type f) \
16+
$(shell find server/src -type f -iname *.html)
17+
STATIC_OBJS := $(addprefix $(BIN_DIR)/static/,index.js style.css icon.svg)
18+
DIST_DIR = $(BIN_DIR)/dist
19+
DOCKER_TEMPLATE = ./containers/Dockerfile.template
20+
PACK_TARGETS = x86-64-musl \
21+
x86-64-v3-musl \
22+
x86-64-v4-musl \
23+
aarch64-musl \
24+
aarch64-gnu \
25+
armv6-musleabi \
26+
armv7-musleabi \
27+
riscv64gc-gnu
28+
29+
fn_output_path = $(BIN_DIR)/$(1)/$(PROJECT_NAME)
30+
fn_target_path = server/target/$(1)/$(PROJECT_NAME)
3031

3132
# RECIPIES:
3233
# ==============================================================================
@@ -235,6 +236,7 @@ generate-dockerfiles:
235236
clean:
236237
@echo "Cleaning artifacts"
237238
@cd server && cargo clean
238-
@test -d $(BIN_DIR) && rm -r $(BIN_DIR)
239-
@test -d $(STATIC_DIR) && rm -r $(STATIC_DIR)
239+
@if [ -d "$(BIN_DIR)" ]; then rm -r "$(BIN_DIR)"; fi;
240+
@if [ -d "$(STATIC_DIR)" ]; then rm -r "$(STATIC_DIR)"; fi;
241+
@if [ -d "$(NODE_MODULES_DIR)" ]; then rm -r "$(NODE_MODULES_DIR)"; fi;
240242
@echo "Clean completed"

‎start_dev.sh

+3
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@ set -e;
33

44
install -D "./client/static/icon.svg" "./client/dist/debug/icon.svg"
55

6+
# Makes sures node_modules folder is initializes.
7+
pnpm install -C ./client/
8+
69
trap 'echo "Shutting down dev server"; exit;' INT KILL ABRT;
710

811
(pnpm run -C ./client dev-js; echo "Esbuild Stopped";) \

0 commit comments

Comments
 (0)
Please sign in to comment.