Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/negrel/hugo-theme-pico.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexandre Negrel <negrel.dev@protonmail.com>2021-01-31 14:08:38 +0300
committerAlexandre Negrel <negrel.dev@protonmail.com>2021-01-31 14:08:38 +0300
commitd61f6d20a5de88ffbb807b0bac8e6b32b1b0c63d (patch)
tree9162b5dd4416bf3fee33f0cf4db7624413c76faa
parentfb41b6a762557b50f7a6270016af8376eb71a251 (diff)
update update.sh
-rwxr-xr-xexampleSite/update.sh40
1 files changed, 30 insertions, 10 deletions
diff --git a/exampleSite/update.sh b/exampleSite/update.sh
index a3ee2e4..c270ce8 100755
--- a/exampleSite/update.sh
+++ b/exampleSite/update.sh
@@ -1,16 +1,36 @@
#!/bin/sh
-echo "Updating node modules : "
-echo "npx npm-check-updates -u && npm install"
-npx npm-check-updates -u && npm install
-
echo "Updating Pico submodule : "
echo "git submodule foreach git pull origin master"
git submodule foreach git pull origin master
-echo "Updating theme resources : "
-npm ls postcss-cli > /dev/null
-if [ $? == 1 ] ; then
- echo "cp -r themes/pico//exampleSite/resources ."
- cp -r themes/pico//exampleSite/resources .
-fi \ No newline at end of file
+# Check npm & npx installation
+no_npm=false;
+if ! npm="$(type -p "npm")" || [ -z $npm ]; then
+ no_npm=true;
+fi
+no_npx=false;
+if ! npx="$(type -p "npx")" || [ -z $npx ]; then
+ no_npw=true;
+fi
+
+# Update node module
+if [ "$no_npx" = false ] && [ "$no_npm" = false ] && [ -f "package.json" ]; then
+ echo "Updating node modules : "
+ echo "npx npm-check-updates -u && npm install"
+ npx npm-check-updates -u && npm install
+fi
+
+
+no_postcss_cli=true;
+if [ "$no_npm" = false ]; then
+ npm ls postcss-cli > /dev/null
+ no_postcss_cli=$?
+fi
+
+
+if [ "$no_postcss_cli" = true ]; then
+ echo "Updating theme resources : "
+ echo "cp -r ./themes/pico/exampleSite/resources ."
+ cp -r ./themes/pico/exampleSite/resources .
+fi