Skip to content

Commit

Permalink
Merge pull request #33
Browse files Browse the repository at this point in the history
* 🏗️ Add system dependency management script

* 🏗️ Add preinstall script
  • Loading branch information
karafra authored Nov 10, 2022
1 parent 68c4bec commit 42cf45a
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 0 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"private": true,
"license": "Apache 2.0",
"scripts": {
"preinstall": "./scripts/install-system-dependencies.sh",
"prebuild": "rimraf dist",
"build": "npm run build:canvas && nest build",
"build:canvas": "cd node_modules/canvas && npm run install && cd ../..",
Expand Down
40 changes: 40 additions & 0 deletions scripts/install-system-dependencies.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
#!/bin/bash

function green(){
echo -e "\x1B[32m $1 \x1B[0m"
if [ ! -z "${2}" ]; then
echo -e "\x1B[32m $($2) \x1B[0m"
fi
}
function install-on-mac-os-x() {
green 'OS X detected'
green 'Installing system dependent packages'

brew install pkg-config cairo pango libpng jpeg giflib librsvg pixman
}

# This method uses apt-get as package manager, might not work on Fedora
function install-on-linux {
green 'Linux distribution detected'
green 'Installing system dependent packages (using apt-get)'

sudo apt-get install build-essential libcairo2-dev libpango1.0-dev libjpeg-dev libgif-dev librsvg2-dev
}

function main() {
case "$OSTYPE" in
darwin*)
install-on-mac-os-x;;
linux*) install-on-linux;;
msys|cygwin)
green 'Windows detected'
green 'No system dependent packages needed'
green 'Installing node dependencies'
return;;
esac

echo System dependent packages installed
echo Installing node dependencies
}

main

0 comments on commit 42cf45a

Please sign in to comment.