Skip to content

Commit

Permalink
move non-updateable modules to lib dir (close #87)
Browse files Browse the repository at this point in the history
  • Loading branch information
hobbyquaker committed Nov 5, 2018
1 parent 1117d5a commit c30157d
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 5 deletions.
4 changes: 3 additions & 1 deletion addon_files/redmatic/lib/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
"dependencies": {
"npm": "6.4.1",
"node-red": "0.19.5",
"ain2": "2.0.0"
"ain2": "2.0.0",
"node-red-node-serialport": "0.6.8",
"node-red-node-sqlite": "0.3.5"
}
}
2 changes: 0 additions & 2 deletions addon_files/redmatic/var/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@
"node-red-contrib-combine": "1.6.1",
"node-red-contrib-mqtt-json": "1.0.1",
"node-red-contrib-time-range-switch": "0.6.1",
"node-red-node-serialport": "0.6.8",
"node-red-node-sqlite": "0.3.5",
"redmatic-led": "1.0.0",
"redmatic-webapp": "0.2.1",
"redmatic-homekit": "0.7.2"
Expand Down
26 changes: 25 additions & 1 deletion addon_files/update_script
Original file line number Diff line number Diff line change
Expand Up @@ -67,16 +67,40 @@ if [ ! -f $RED_DIR/var/flows.json ]; then
mv $RED_DIR/var/example-flows.json $RED_DIR/var/flows.json
fi

#
# export lib path for jq usage
#
export LD_LIBRARY_PATH=$RED_DIR/lib

#
# Extend extra nodes package.json
#
if [ -f $RED_DIR/var/package.json.old ]; then
mv $RED_DIR/var/package.json $RED_DIR/var/package.json.new
export LD_LIBRARY_PATH=$RED_DIR/lib
$RED_DIR/bin/jq -s '.[0] * .[1]' $RED_DIR/var/package.json.old $RED_DIR/var/package.json.new > $RED_DIR/var/package.json
rm $RED_DIR/var/package.json.old $RED_DIR/var/package.json.new
fi

#
# Migration <= 1.9.0 to > 1.9.0
# Remove Packages that where moved to lib dir
#
if [ -d $RED_DIR/var/node_modules/node-red-node-sqlite ]; then
rm -r $RED_DIR/var/node_modules/node-red-node-sqlite
cp $RED_DIR/var/package.json $RED_DIR/var/package.json.bak
cat $RED_DIR/var/package.json.bak | $RED_DIR/bin/jq 'del(.dependencies."node-red-node-sqlite")' > $RED_DIR/var/package.json
rm $RED_DIR/var/package.json.bak
fi
if [ -d $RED_DIR/var/node_modules/node-red-node-serialport ]; then
rm -r $RED_DIR/var/node_modules/node-red-node-serialport
cp $RED_DIR/var/package.json $RED_DIR/var/package.json.bak
cat $RED_DIR/var/package.json.bak | $RED_DIR/bin/jq 'del(.dependencies."node-red-node-serialport")' > $RED_DIR/var/package.json
rm $RED_DIR/var/package.json.bak
fi

#
# Remove package-lock
#
if [ -f $RED_DIR/var/package-lock.json ]; then
rm $RED_DIR/var/package-lock.json
fi
Expand Down
2 changes: 1 addition & 1 deletion update.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ cd $BUILD_DIR/addon_files/redmatic/lib
$BUILD_DIR/node_modules/.bin/ncu -u

cd $BUILD_DIR/addon_files/redmatic/var
$BUILD_DIR/node_modules/.bin/ncu -u -x node-red-node-sqlite,node-red-node-serialport
$BUILD_DIR/node_modules/.bin/ncu -u

cd $BUILD_DIR/addon_files/redmatic/www
$BUILD_DIR/node_modules/.bin/ncu -u
Expand Down

0 comments on commit c30157d

Please sign in to comment.