diff --git a/.prettierrc b/.prettierrc new file mode 100644 index 0000000..f8fbfb1 --- /dev/null +++ b/.prettierrc @@ -0,0 +1,7 @@ +{ + "semi": true, + "singleQuote": false, + "trailingComma": "es5", + "printWidth": 65, + "tabWidth": 4 +} \ No newline at end of file diff --git a/Makefile b/Makefile index 5e6ad60..11e1842 100644 --- a/Makefile +++ b/Makefile @@ -14,18 +14,28 @@ $(BUILD_DIR)/%.js: $(SRC_DIR)/%.ts ./node_modules mkdir -p $(dir $@) npx swc $< -o $@ -# bundle all the templates into $(BUILD_DIR)/index.html +# bundle all the templates into $(BUILD_DIR)/index.html and minify $(BUILD_DIR)/index.html: export TEMPLATES = $(shell cat $(HTML_SRCS)) $(BUILD_DIR)/index.html: $(HTML_SRCS) $(BUILD_DIR) ./index.template.html cat ./index.template.html | envsubst '$$TEMPLATES' | tr -d '\n' | sed -r 's/\s+/ /g' > $@ -./node_modules: - npm install + +package-lock.json: + npm install --loglevel=http + +./node_modules: package-lock.json + npm ci --loglevel=http serve: all npx serve -s $(BUILD_DIR) -clean: - rm -rf $(BUILD_DIR) ./node_modules +dev: + npx nodemon --watch $(SRC_DIR) --ext ts,html --exec "make clean && make serve" -.PHONY: all clean serve \ No newline at end of file +clean: + rm -rf $(BUILD_DIR) + +nuke: + rm -rf ./node_modules + +.PHONY: all clean nuke serve dev diff --git a/README.md b/README.md index f95cb8a..2ace680 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,7 @@ -# MEDTRACE: Case - Frontend developer +# Web front end -## build and run +## Build and run -From the repo root, run `make` to build the project. From there you can use your own server to serve from the repo root, or run `make serve` to run a development server. `make clean` will remove the dependencies and build directory. \ No newline at end of file +This projectr uses [GNU make](https://www.gnu.org/software/make/) to build and run. From the repo root, run `make` to build the project. From there you can use your own web server to serve from the repo root, or run `make serve` to run a development server. `make clean` will remove the dependencies and build directory. + +Run `make dev` to install all dependencies and run a development server that watches for changes and reloads. (It does not refresh the browser.) diff --git a/heartbeat.webm b/heartbeat.webm deleted file mode 100644 index 798aa98..0000000 Binary files a/heartbeat.webm and /dev/null differ diff --git a/index.template.html b/index.template.html index 2e8aa3a..807bbee 100644 --- a/index.template.html +++ b/index.template.html @@ -5,7 +5,7 @@ -