From 574a582e2930159ac49997d253fd7380b7c5eebe Mon Sep 17 00:00:00 2001 From: Robbie Antenesse Date: Sun, 14 Jun 2020 13:31:03 -0600 Subject: [PATCH] Restart server on change for dev - Add onchange to id changes to server files --- package.json | 6 ++++-- yarn.lock | 35 ++++++++++++++++++++++++++++++++++- 2 files changed, 38 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index d54ae74..c728287 100644 --- a/package.json +++ b/package.json @@ -7,9 +7,10 @@ "author": "Robbie Antenesse ", "license": "MIT", "scripts": { - "dev": "concurrently --kill-others \"npm run watch-js\" \"npm run serve\"", + "dev": "concurrently --kill-others \"npm run watch-app\" \"npm run watch-server\"", "start": "npm run build && cross-env NODE_ENV=production npm run serve", - "watch-js": "parcel watch app/index.html --out-dir public --no-hmr --no-cache", + "watch-app": "parcel watch app/index.html --out-dir public --no-hmr --no-cache", + "watch-server": "onchange -i -k \"server/**/*.js*\" -- npm run serve", "serve": "node server/index.js", "build": "npm run process-images && npm run bundle", "bundle": "parcel build app/index.html --out-dir public --no-source-maps --no-cache", @@ -21,6 +22,7 @@ "choo-devtools": "^3.0.3", "concurrently": "^5.1.0", "faker": "^4.1.0", + "onchange": "^7.0.2", "rimraf": "^3.0.1", "sequelize-erd": "https://github.com/Alamantus/sequelize-erd.git" }, diff --git a/yarn.lock b/yarn.lock index f3d3846..c0fa232 100644 --- a/yarn.lock +++ b/yarn.lock @@ -754,6 +754,16 @@ lodash "^4.17.13" to-fast-properties "^2.0.0" +"@blakeembrey/deque@^1.0.5": + version "1.0.5" + resolved "https://registry.yarnpkg.com/@blakeembrey/deque/-/deque-1.0.5.tgz#f4fa17fc5ee18317ec01a763d355782c7b395eaf" + integrity sha512-6xnwtvp9DY1EINIKdTfvfeAtCYw4OqBZJhtiqkT3ivjnEfa25VQ3TsKvaFfKm8MyGIEfE95qLe+bNEt3nB0Ylg== + +"@blakeembrey/template@^1.0.0": + version "1.0.0" + resolved "https://registry.yarnpkg.com/@blakeembrey/template/-/template-1.0.0.tgz#bf8828bc3ae8004d97904d78f64e3cc2cd216438" + integrity sha512-J6WGZqCLdRMHUkyRG6fBSIFJ0rL60/nsQNh5rQvsYZ5u0PsKw6XQcJcA3DWvd9cN3j/IQx5yB1fexhCafwwUUw== + "@iarna/toml@^2.2.0": version "2.2.3" resolved "https://registry.yarnpkg.com/@iarna/toml/-/toml-2.2.3.tgz#f060bf6eaafae4d56a7dac618980838b0696e2ab" @@ -989,6 +999,11 @@ are-we-there-yet@~1.1.2: delegates "^1.0.0" readable-stream "^2.0.6" +arg@^4.1.3: + version "4.1.3" + resolved "https://registry.yarnpkg.com/arg/-/arg-4.1.3.tgz#269fc7ad5b8e42cb63c896d5666017261c144089" + integrity sha512-58S9QDqG0Xx27YwPSt9fJxivjYl432YCwfDMfZ+71RAqUrZef7LrKQZ3LHLOwCS4FLNBplP533Zx895SeOCHvA== + argparse@^1.0.7: version "1.0.10" resolved "https://registry.yarnpkg.com/argparse/-/argparse-1.0.10.tgz#bcd6791ea5ae09725e17e5ad988134cd40b3d911" @@ -1564,7 +1579,7 @@ cheerio@^1.0.0-rc.3: lodash "^4.15.0" parse5 "^3.0.1" -"chokidar@>=2.0.0 <4.0.0": +"chokidar@>=2.0.0 <4.0.0", chokidar@^3.3.1: version "3.4.0" resolved "https://registry.yarnpkg.com/chokidar/-/chokidar-3.4.0.tgz#b30611423ce376357c765b9b8f904b9fba3c0be8" integrity sha512-aXAaho2VJtisB/1fg1+3nlLJqGOuewTzQpd/Tz0yTg2R0e4IGtshYvtjowyEumcBv2z+y4+kc75Mz7j5xJskcQ== @@ -3502,6 +3517,11 @@ ignore-walk@^3.0.1: dependencies: minimatch "^3.0.4" +ignore@^5.1.4: + version "5.1.8" + resolved "https://registry.yarnpkg.com/ignore/-/ignore-5.1.8.tgz#f150a8b50a34289b33e22f5889abd4d8016f0e57" + integrity sha512-BMpfD7PpiETpBl/A6S498BaIJ6Y/ABT93ETbby2fP00v4EbvPBXWEoaR1UBPKs3iR53pJY7EtZk5KACI57i1Uw== + import-fresh@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/import-fresh/-/import-fresh-2.0.0.tgz#d81355c15612d386c61f9ddd3922d4304822a546" @@ -4956,6 +4976,19 @@ once@^1.3.0, once@^1.3.1, once@^1.4.0: dependencies: wrappy "1" +onchange@^7.0.2: + version "7.0.2" + resolved "https://registry.yarnpkg.com/onchange/-/onchange-7.0.2.tgz#77f98263cc8412210c1a2d89a55cc5eb32ad33ec" + integrity sha512-pyJroR9gZKilbJtdGsuyxhFhwaeYSpYVle9hAORGJ5vQQH8n7QT+qWpncJTMEk9dlIXI9tOMjdJwbPaTSPTKFA== + dependencies: + "@blakeembrey/deque" "^1.0.5" + "@blakeembrey/template" "^1.0.0" + arg "^4.1.3" + chokidar "^3.3.1" + cross-spawn "^7.0.1" + ignore "^5.1.4" + tree-kill "^1.2.2" + onetime@^2.0.0: version "2.0.1" resolved "https://registry.yarnpkg.com/onetime/-/onetime-2.0.1.tgz#067428230fd67443b2794b22bba528b6867962d4"