Comply with our npm guidelines

Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
This commit is contained in:
John Molakvoæ (skjnldsv) 2019-05-23 10:22:25 +02:00
parent 91adb90c8a
commit b60d0ea2d5
No known key found for this signature in database
GPG key ID: 60C25B8C072916CF
2 changed files with 29 additions and 28 deletions

View file

@ -59,27 +59,33 @@ ifneq ("$(wildcard $(private_key))","") #(,$(wildcard $(private_key)))
endif endif
endif endif
all: install build .PHONY: all
all: dev-setup build-svg-sprite build-js-production
# Fetches the PHP and JS dependencies and compiles the JS. If no composer.json # cleanup and generate a clean developement setup
# is present, the composer step is skipped, if no package.json or js/package.json dev-setup: clean clean-dev npm-init
# is present, the npm step is skipped
.PHONY: build
build:
$(npm) run build
# Sets up the development environment npm-init:
.PHONY: install npm install
install:
$(npm) install npm-update:
$(npm) update npm update
# Runs the development build # Runs the development build
.PHONY: development build-js:
development: npm run dev
$(npm) install
$(npm) update # Runs the production build
$(npm) run dev build-js-production:
npm run build
# Runs the development build and keep watching
watch-js:
npm run watch
# Build the svg sprite
build-svg-sprite:
npm run svg_sprite
# Removes the build directory and the compiled files # Removes the build directory and the compiled files
.PHONY: clean .PHONY: clean
@ -95,18 +101,13 @@ clean:
rm -rf $(build_directory) rm -rf $(build_directory)
# Same as clean but also removes dependencies installed by npm # Same as clean but also removes dependencies installed by npm
.PHONY: distclean .PHONY: clean-dev
distclean: clean clean-dev:
rm -rf node_modules rm -rf node_modules
# Watches the js and scss files
.PHONY: watch
watch:
$(npm) run watch
# Builds the source package for the app store # Builds the source package for the app store
.PHONY: appstore .PHONY: appstore
appstore: clean build appstore: clean build-svg-sprite build-js-production
mkdir -p $(appstore_build_directory) $(appstore_artifact_directory) mkdir -p $(appstore_build_directory) $(appstore_artifact_directory)
rsync -av . $(appstore_build_directory) \ rsync -av . $(appstore_build_directory) \
--exclude=/.git \ --exclude=/.git \

View file

@ -10,9 +10,9 @@
"private": true, "private": true,
"homepage": "https://github.com/nextcloud/tasks", "homepage": "https://github.com/nextcloud/tasks",
"scripts": { "scripts": {
"dev": "npm run svg_sprite && webpack --config webpack.dev.js", "build": "NODE_ENV=production webpack --progress --hide-modules --config webpack.prod.js",
"watch": "webpack --progress --watch --config webpack.dev.js", "dev": "NODE_ENV=development webpack --config webpack.dev.js",
"build": "npm run svg_sprite && webpack --progress --hide-modules --config webpack.prod.js", "watch": "NODE_ENV=development webpack --progress --watch --config webpack.dev.js",
"lint": "eslint --ext .js,.vue src tests", "lint": "eslint --ext .js,.vue src tests",
"lint:fix": "eslint --ext .js,.vue src tests --fix", "lint:fix": "eslint --ext .js,.vue src tests --fix",
"test": "jest --verbose", "test": "jest --verbose",