-
Notifications
You must be signed in to change notification settings - Fork 101
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1094 from nxhack/dev_21.02
[21.02] node-zigbee2mqtt: NODE_PATH explicitly set & Reduced size
- Loading branch information
Showing
3 changed files
with
119 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,113 @@ | ||
# This is free software, licensed under the GNU General Public License v2. | ||
# See /LICENSE for more information. | ||
# | ||
|
||
include $(TOPDIR)/rules.mk | ||
|
||
PKG_NPM_NAME:=modclean | ||
PKG_NAME:=node-$(PKG_NPM_NAME) | ||
PKG_VERSION:=3.0.0-beta.1 | ||
PKG_RELEASE:=1 | ||
|
||
PKG_SOURCE:=$(PKG_NPM_NAME)-$(PKG_VERSION).tgz | ||
PKG_SOURCE_URL:=https://registry.npmjs.org/$(PKG_NPM_NAME)/-/ | ||
PKG_HASH:=88532b71a73c214f6d4841b13cf83f6cc03de81c181c37316b29e4e57701970d | ||
|
||
PKG_MAINTAINER:=Hirokazu MORIKAWA <[email protected]> | ||
PKG_LICENSE:=MIT | ||
PKG_LICENSE_FILES:=LICENSE | ||
|
||
HOST_BUILD_DEPENDS:=node/host | ||
HOST_BUILD_PARALLEL:=1 | ||
|
||
PKG_BUILD_DEPENDS:=node/host | ||
PKG_BUILD_PARALLEL:=1 | ||
PKG_USE_MIPS16:=0 | ||
|
||
include $(INCLUDE_DIR)/host-build.mk | ||
include $(INCLUDE_DIR)/package.mk | ||
|
||
define Package/node-modclean | ||
SUBMENU:=Node.js | ||
SECTION:=lang | ||
CATEGORY:=Languages | ||
TITLE:=Remove unwanted files and directories from your node_modules folder | ||
URL:=https://www.npmjs.org/package/modclean | ||
DEPENDS:=+node | ||
endef | ||
|
||
define Package/node-modclean/description | ||
Remove unwanted files and directories from your node_modules folder | ||
endef | ||
|
||
TAR_OPTIONS+= --strip-components 1 | ||
TAR_CMD=$(HOST_TAR) -C $(1) $(TAR_OPTIONS) | ||
|
||
NODEJS_CPU:=$(subst powerpc,ppc,$(subst aarch64,arm64,$(subst x86_64,x64,$(subst i386,ia32,$(ARCH))))) | ||
TMPNPM:=$(shell mktemp -u XXXXXXXXXX) | ||
HOSTTMPNPM:=$(shell mktemp -u XXXXXXXXXX) | ||
|
||
TARGET_CFLAGS+=$(FPIC) | ||
TARGET_CPPFLAGS+=$(FPIC) | ||
|
||
define Build/Compile | ||
cd $(PKG_BUILD_DIR); \ | ||
$(MAKE_VARS) \ | ||
$(MAKE_FLAGS) \ | ||
npm_config_nodedir=$(STAGING_DIR)/usr/ \ | ||
npm_config_cache=$(TMP_DIR)/npm-cache-$(TMPNPM) \ | ||
npm_config_tmp=$(TMP_DIR)/npm-tmp-$(TMPNPM) \ | ||
npm install --production --global-style --no-save --omit=dev --no-package-lock | ||
rm -rf $(TMP_DIR)/npm-tmp-$(TMPNPM) | ||
rm -rf $(TMP_DIR)/npm-cache-$(TMPNPM) | ||
rm -f $(PKG_BUILD_DIR)/node_modules/.package-lock.json | ||
find $(PKG_BUILD_DIR)/node_modules -type d -empty -print0 | xargs -0 rmdir || true | ||
endef | ||
|
||
define Package/node-modclean/install | ||
$(INSTALL_DIR) $(1)/usr/lib/node/$(PKG_NPM_NAME) | ||
$(CP) $(PKG_BUILD_DIR)/{package.json,LICENSE} \ | ||
$(1)/usr/lib/node/$(PKG_NPM_NAME)/ | ||
$(CP) $(PKG_BUILD_DIR)/{*.md,*.js} \ | ||
$(1)/usr/lib/node/$(PKG_NPM_NAME)/ | ||
$(CP) $(PKG_BUILD_DIR)/{node_modules,bin,lib} \ | ||
$(1)/usr/lib/node/$(PKG_NPM_NAME)/ | ||
$(INSTALL_DIR) $(1)/usr/bin | ||
$(LN) ../lib/node/$(PKG_NPM_NAME)/bin/modclean.js $(1)/usr/bin/modclean | ||
$(INSTALL_DIR) $(1)/usr/lib/node_modules | ||
$(LN) ../node/$(PKG_NPM_NAME) $(1)/usr/lib/node_modules/$(PKG_NPM_NAME) | ||
endef | ||
|
||
define Package/node-modclean/postrm | ||
#!/bin/sh | ||
rm /usr/lib/node_modules/modclean || true | ||
rm -rf /usr/lib/node/modclean || true | ||
endef | ||
|
||
define Host/Compile | ||
cd $(HOST_BUILD_DIR); \ | ||
$(HOST_MAKE_VARS) \ | ||
npm_config_nodedir=$(STAGING_DIR)/usr/ \ | ||
npm_config_cache=$(TMP_DIR)/npm-cache-$(HOSTTMPNPM) \ | ||
npm_config_tmp=$(TMP_DIR)/npm-tmp-$(HOSTTMPNPM) \ | ||
npm install --production --global-style --no-save --omit=dev --no-package-lock | ||
rm -rf $(TMP_DIR)/npm-tmp-$(HOSTTMPNPM) | ||
rm -rf $(TMP_DIR)/npm-cache-$(HOSTTMPNPM) | ||
rm -f $(HOST_BUILD_DIR)/node_modules/.package-lock.json | ||
find $(HOST_BUILD_DIR)/node_modules -type d -empty -print0 | xargs -0 rmdir || true | ||
endef | ||
|
||
define Host/Install | ||
$(INSTALL_DIR) $(1)/lib/node_modules/$(PKG_NPM_NAME) | ||
$(CP) $(HOST_BUILD_DIR)/{package.json,LICENSE} \ | ||
$(1)/lib/node_modules/$(PKG_NPM_NAME)/ | ||
$(CP) $(HOST_BUILD_DIR)/{*.md,*.js} \ | ||
$(1)/lib/node_modules/$(PKG_NPM_NAME)/ | ||
$(CP) $(HOST_BUILD_DIR)/{node_modules,bin,lib} \ | ||
$(1)/lib/node_modules/$(PKG_NPM_NAME)/ | ||
$(INSTALL_DIR) $(1)/bin | ||
$(LN) ../lib/node_modules/$(PKG_NPM_NAME)/bin/modclean.js $(1)/bin/modclean | ||
endef | ||
|
||
$(eval $(call HostBuild)) | ||
$(eval $(call BuildPackage,node-modclean)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,7 +7,7 @@ include $(TOPDIR)/rules.mk | |
PKG_NPM_NAME:=zigbee2mqtt | ||
PKG_NAME:=node-$(PKG_NPM_NAME) | ||
PKG_VERSION:=1.22.1 | ||
PKG_RELEASE:=1 | ||
PKG_RELEASE:=2 | ||
|
||
PKG_SOURCE:=$(PKG_NPM_NAME)-$(PKG_VERSION).tgz | ||
PKG_SOURCE_URL:=https://registry.npmjs.org/$(PKG_NPM_NAME)/-/ | ||
|
@@ -17,7 +17,7 @@ PKG_MAINTAINER:=Hirokazu MORIKAWA <[email protected]> | |
PKG_LICENSE:=GPL-3.0 | ||
PKG_LICENSE_FILES:=LICENSE | ||
|
||
PKG_BUILD_DEPENDS:=node/host | ||
PKG_BUILD_DEPENDS:=node/host node-modclean/host | ||
PKG_BUILD_PARALLEL:=1 | ||
PKG_USE_MIPS16:=0 | ||
|
||
|
@@ -58,9 +58,12 @@ define Build/Compile | |
rm -f $(PKG_BUILD_DIR)/node_modules/zigbee2mqtt-frontend/dist/report.html | ||
rm -f $(PKG_BUILD_DIR)/node_modules/zigbee2mqtt-frontend/dist/*.map | ||
rm -f $(PKG_BUILD_DIR)/node_modules/zigbee2mqtt-frontend/dist/*/*.map | ||
#rm -rf $(PKG_BUILD_DIR)/node_modules/zigbee-herdsman-converters/node_modules/zigbee-herdsman | ||
rm -rf $(PKG_BUILD_DIR)/node_modules/moment/min | ||
rm -rf $(PKG_BUILD_DIR)/node_modules/moment/src | ||
rm -rf $(PKG_BUILD_DIR)/node_modules/moment/locale | ||
modclean --no-progress -r --patterns="default:safe" --additional-patterns="*.d.ts" \ | ||
--path $(PKG_BUILD_DIR) --ignore="examples,example*" | ||
rm -rf $(TMP_DIR)/npm-tmp-$(TMPNPM) | ||
rm -rf $(TMP_DIR)/npm-cache-$(TMPNPM) | ||
rm -f $(PKG_BUILD_DIR)/node_modules/.package-lock.json | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters