Bläddra i källkod

porting makefile to package.json and updating readme

Signed-off-by: Logan Ballard <loganballard@gmail.com>
Logan Ballard 3 år sedan
förälder
incheckning
a3ba4c4f5a
3 ändrade filer med 14 tillägg och 20 borttagningar
  1. 0 13
      ui/Makefile
  2. 11 7
      ui/README.md
  3. 3 0
      ui/package.json

+ 0 - 13
ui/Makefile

@@ -1,13 +0,0 @@
-BASE_URL := "/model"
-
-.PHONY: build
-build:
-	BASE_URL=${BASE_URL} npx parcel build src/index.html
-
-.PHONY: serve
-serve:
-	BASE_URL=${BASE_URL} npx parcel serve src/index.html
-
-.PHONY: clean
-clean:
-	rm -rf dist/*

+ 11 - 7
ui/README.md

@@ -23,22 +23,26 @@ kubectl port-forward --namespace opencost service/opencost 9090
 
 ## Running Locally
 
-The UI can be run locally using the `make` command.
+The UI can be run locally using the `npm run` command.
 
 ```sh
-$ make serve
-BASE_URL="/model" npx parcel serve src/index.html
+$ npm run serve
+> kubecost-ui-open@0.0.1 serve
+> BASE_URL=${BASE_URL:=/model} npx parcel serve src/index.html
+
 Server running at http://localhost:1234
-✨ Built in 1.04s
+✨ Built in 76ms
 ```
 
 And can have a custom URL backend prefix.
 
 ```sh
-$ make serve BASE_URL=test
-BASE_URL=test npx parcel serve src/index.html
+$ BASE_URL=test npm run serve
+> kubecost-ui-open@0.0.1 serve
+> BASE_URL=${BASE_URL:=/model} npx parcel serve src/index.html
+
 Server running at http://localhost:1234
-✨ Built in 746ms
+✨ Built in 804ms
 ```
 
 In addition, similar behavior can be replicated with the docker container:

+ 3 - 0
ui/package.json

@@ -3,6 +3,9 @@
   "version": "0.0.1",
   "description": "Open source UI for Kubecost",
   "scripts": {
+    "build": "BASE_URL=${BASE_URL:=/model} npx parcel build src/index.html && echo \"built with BASE_URL $BASE_URL\"",
+    "serve": "BASE_URL=${BASE_URL:=/model} npx parcel serve src/index.html",
+    "clean": "rm -rf dist/*",
     "test": "echo \"Error: no test specified\" && exit 1",
     "preinstall": "npx npm-force-resolutions"
   },