From 4fdc4dc49deeeea5669d1f43dfcc4565c35913ef Mon Sep 17 00:00:00 2001 From: Ray Schamp Date: Thu, 8 Oct 2015 16:21:39 -0600 Subject: [PATCH 1/3] Make start also watch, and allow stop to kill it --- Makefile | 5 +++-- package.json | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index 5a80e1cde..7ea5be513 100644 --- a/Makefile +++ b/Makefile @@ -29,8 +29,9 @@ watch: wait stop: - pkill -f "node $(WEBPACK) -d --watch" - pkill -f "node $(WATCH) make clean && make static ./static" + -pkill -f "$(WEBPACK) -d --watch" + -pkill -f "$(WATCH) make clean && make static ./static" + -pkill -f "$(NODE) ./server/index.js" start: $(NODE) ./server/index.js diff --git a/package.json b/package.json index 13cef6b42..9ea3ee0d4 100644 --- a/package.json +++ b/package.json @@ -3,10 +3,11 @@ "version": "1.0.0", "description": "Standalone WWW client for Scratch", "scripts": { - "start": "make start", + "start": "make start &", + "poststart": "make watch", "test": "make test", "watch": "make watch", - "stop-watch": "make stop-watch", + "stop": "make stop", "build": "make build", "prestart": "make build" }, From ecbf770ea46a7283a7f1370a068e7dd3c51c649a Mon Sep 17 00:00:00 2001 From: Ray Schamp Date: Fri, 9 Oct 2015 10:52:43 -0600 Subject: [PATCH 2/3] Move watch & start behavior to `npm run dev` --- package.json | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/package.json b/package.json index 9ea3ee0d4..922a257f7 100644 --- a/package.json +++ b/package.json @@ -3,13 +3,13 @@ "version": "1.0.0", "description": "Standalone WWW client for Scratch", "scripts": { - "start": "make start &", - "poststart": "make watch", + "prestart": "make build", + "start": "make start", + "stop": "make stop", "test": "make test", "watch": "make watch", - "stop": "make stop", "build": "make build", - "prestart": "make build" + "dev": "make watch && make start &" }, "repository": { "type": "git", From 1274e0b37bb027042b39fe014b8f833182a0ed5f Mon Sep 17 00:00:00 2001 From: Ray Schamp Date: Fri, 9 Oct 2015 10:57:10 -0600 Subject: [PATCH 3/3] Update README --- README.md | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/README.md b/README.md index 577f8faa8..b3cddd7b0 100644 --- a/README.md +++ b/README.md @@ -16,8 +16,19 @@ During development, you can use `npm run watch` to cause any update you make to npm start ``` +or to start and watch at once +```bash +npm run dev +``` + Once running, open `http://localhost:8333` in your browser. If you wish to have the server reload automatically, you can install either [nodemon](https://github.com/remy/nodemon) or [forever](https://github.com/foreverjs/forever). +### To stop +```bash +# Stops all `start` and `watch` processes +npm stop +``` + #### Configuration `npm start` and `npm run watch` can be configured with the following environment variables