#!/usr/bin/make -f

include /usr/share/cdbs/1/rules/debhelper.mk

# Ходим за нодой 0.10 туда, где она лежит
PATH:=$(shell echo $$PATH):$(shell dpkg -L nodejs-10 | grep '\/bin\/node$$' | xargs dirname)

make::
	$(MAKE) node_modules
	ls -la node_modules
	ENV=production NODE_ENV=production $(MAKE) build
	#NODE_ENV=production npm prune
	npm prune --production && npm install --production
	ls -la node_modules

install/$(DEB_SOURCE_PACKAGE)::make
	dh_install -p$(DEB_SOURCE_PACKAGE)
	dh_nodeubic --no-start -p$(DEB_SOURCE_PACKAGE)
	dh_environment -p$(DEB_SOURCE_PACKAGE) --fail-missing
