diff options
author | silverwind <me@silverwind.io> | 2019-06-19 04:59:47 +0200 |
---|---|---|
committer | techknowlogick <techknowlogick@gitea.io> | 2019-06-18 22:59:47 -0400 |
commit | a71cabbd537d2ca3f937e8fb986315ccc6701270 (patch) | |
tree | 7e25cbd146d70b5c07083097edb0c7dda53aa9c2 /Makefile | |
parent | 33ad5548002156f7fb7779870571600c0a181c85 (diff) | |
download | gitea-a71cabbd537d2ca3f937e8fb986315ccc6701270.tar.gz gitea-a71cabbd537d2ca3f937e8fb986315ccc6701270.zip |
add 'npm' and 'npm-update' make targets and lockfile (#7246)
* add 'npm' and 'npm-update' make targets and lockfile
- `make npm` installs and updates node_modules, triggered automatically
on `make css` and `make js` as it completes reasonably fast and
ensures consistent modules.
- `make npm-update` updates all dependencies to their latest version,
regenerates `node_modules` from scratch and updates
`package-lock.json`. It uses npm modules `updates` written by yours
truly to find the latest version of each dependency.
* add suggested make dependencies
* remove package-lock.json during npm-update
* regenerate package-lock.json
Diffstat (limited to 'Makefile')
-rw-r--r-- | Makefile | 33 |
1 files changed, 18 insertions, 15 deletions
@@ -366,29 +366,32 @@ release-compress: fi cd $(DIST)/release/; for file in `find . -type f -name "*"`; do echo "compressing $${file}" && gxz -k -9 $${file}; done; -.PHONY: js -js: - @if ([ ! -d "$(PWD)/node_modules" ]); then \ - echo "node_modules directory is absent, please run 'npm install' first"; \ +npm-check: + @hash npm > /dev/null 2>&1; if [ $$? -ne 0 ]; then \ + echo "Please install Node.js 8.x or greater with npm"; \ exit 1; \ fi; @hash npx > /dev/null 2>&1; if [ $$? -ne 0 ]; then \ - echo "Please install npm version 5.2+"; \ + echo "Please install Node.js 8.x or greater with npm"; \ exit 1; \ fi; + +.PHONY: npm +npm: npm-check + npm install --no-save + +.PHONY: npm-update +npm-update: npm-check + npx updates -cu + rm -rf node_modules package-lock.json + npm install --package-lock + +.PHONY: js +js: npm npx eslint public/js .PHONY: css -css: - @if ([ ! -d "$(PWD)/node_modules" ]); then \ - echo "node_modules directory is absent, please run 'npm install' first"; \ - exit 1; \ - fi; - @hash npx > /dev/null 2>&1; if [ $$? -ne 0 ]; then \ - echo "Please install npm version 5.2+"; \ - exit 1; \ - fi; - +css: npm npx lesshint public/less/ npx lessc --clean-css="--s0 -b" public/less/index.less public/css/index.css $(foreach file, $(filter-out public/less/themes/_base.less, $(wildcard public/less/themes/*)),npx lessc --clean-css="--s0 -b" public/less/themes/$(notdir $(file)) > public/css/theme-$(notdir $(call strip-suffix,$(file))).css;) |