Support watching for changing code

Closes #93
This commit is contained in:
bmustiata 2019-01-28 14:22:46 +01:00 committed by Martin Pitt
parent 7b67b091f1
commit 81096b95ca
3 changed files with 14 additions and 0 deletions

View file

@ -66,6 +66,9 @@ dist/po.%.js: po/%.po $(NODE_MODULES_TEST)
$(WEBPACK_TEST): $(NODE_MODULES_TEST) $(shell find src/ -type f) package.json webpack.config.js $(patsubst %,dist/po.%.js,$(LINGUAS)) $(WEBPACK_TEST): $(NODE_MODULES_TEST) $(shell find src/ -type f) package.json webpack.config.js $(patsubst %,dist/po.%.js,$(LINGUAS))
NODE_ENV=$(NODE_ENV) npm run build NODE_ENV=$(NODE_ENV) npm run build
watch:
NODE_ENV=$(NODE_ENV) npm run watch
clean: clean:
rm -rf dist/ rm -rf dist/
[ ! -e cockpit-$(PACKAGE_NAME).spec.in ] || rm -f cockpit-$(PACKAGE_NAME).spec [ ! -e cockpit-$(PACKAGE_NAME).spec.in ] || rm -f cockpit-$(PACKAGE_NAME).spec

View file

@ -33,6 +33,16 @@ ln -s `pwd`/dist ~/.local/share/cockpit/starter-kit
After changing the code and running `make` again, reload the Cockpit page in After changing the code and running `make` again, reload the Cockpit page in
your browser. your browser.
You can also use
[watch mode](https://webpack.js.org/guides/development/#using-watch-mode) to
automatically update the webpack on every code change with
$ npm run watch
or
$ make watch
# Running eslint # Running eslint
Cockpit Starter Kit uses [ESLint](https://eslint.org/) to automatically check Cockpit Starter Kit uses [ESLint](https://eslint.org/) to automatically check

View file

@ -7,6 +7,7 @@
"author": "", "author": "",
"license": "LGPL-2.1", "license": "LGPL-2.1",
"scripts": { "scripts": {
"watch": "webpack --watch",
"build": "webpack", "build": "webpack",
"eslint": "eslint --ext .jsx --ext .es6 src/", "eslint": "eslint --ext .jsx --ext .es6 src/",
"eslint:fix": "eslint --fix --ext .jsx --ext .es6 src/" "eslint:fix": "eslint --fix --ext .jsx --ext .es6 src/"