From 64babddd666bd3203f573d458dfa52a78090cbf6 Mon Sep 17 00:00:00 2001 From: Guillaume Lesniak Date: Wed, 13 Apr 2016 17:03:50 +0200 Subject: [PATCH] Add NPM scripts and update gitignore --- .gitignore | 7 +++++++ package.json | 5 ++++- scripts/compile_translations.sh | 14 ++++++++++++++ scripts/extract_translations.sh | 12 ++++++++++++ scripts/link_modules_resources.sh | 24 ++++++++++++++++++++---- 5 files changed, 57 insertions(+), 5 deletions(-) create mode 100755 scripts/compile_translations.sh create mode 100755 scripts/extract_translations.sh diff --git a/.gitignore b/.gitignore index 2d680ad..11e9eef 100644 --- a/.gitignore +++ b/.gitignore @@ -10,3 +10,10 @@ composer.lock vendor/bin migrations *.sublime-* +vendor/ +public/css/ +public/js/ +public/img/ +public/views/ +module/ +node_modules/ diff --git a/package.json b/package.json index 59036fa..3e3c108 100644 --- a/package.json +++ b/package.json @@ -9,5 +9,8 @@ "url": "ssh://gogs@rhea.netlor.fr:2222/monarc/skeleton.git" }, "author": "Netlor", - "license": "Copyright" + "license": "Copyright", + "scripts": { + "postinstall": "./scripts/link_modules_resources.sh" + } } diff --git a/scripts/compile_translations.sh b/scripts/compile_translations.sh new file mode 100755 index 0000000..c84ea1f --- /dev/null +++ b/scripts/compile_translations.sh @@ -0,0 +1,14 @@ +#!/bin/bash + +if [ -d node_modules/ng_backoffice ]; then + pushd node_modules/ng_backoffice + grunt compile_translations + grunt concat +fi + + +if [ -d node_modules/ng_client ]; then + pushd node_modules/ng_client + grunt compile_translations + grunt concat +fi diff --git a/scripts/extract_translations.sh b/scripts/extract_translations.sh new file mode 100755 index 0000000..2f435cd --- /dev/null +++ b/scripts/extract_translations.sh @@ -0,0 +1,12 @@ +#!/bin/bash + +if [ -d node_modules/ng_backoffice ]; then + pushd node_modules/ng_backoffice + grunt extract_translations +fi + + +if [ -d node_modules/ng_client ]; then + pushd node_modules/ng_client + grunt extract_translations +fi diff --git a/scripts/link_modules_resources.sh b/scripts/link_modules_resources.sh index a27689d..71f91d6 100755 --- a/scripts/link_modules_resources.sh +++ b/scripts/link_modules_resources.sh @@ -8,13 +8,29 @@ if [ ! -d public/views ]; then mkdir public/views fi +if [ ! -d public/img ]; then + mkdir public/img +fi + if [ -d node_modules/ng_backoffice ]; then - find node_modules/ng_backoffice/views -name "*.html" -exec ln -s $(realpath {}) public/views/ \; - find node_modules/ng_backoffice/src -name "*.js" -exec ln -s $(realpath {}) public/js/ \; + find node_modules/ng_backoffice/views -name "*.html" -exec ln -s $(realpath {}) public/views/ \; 2>/dev/null + find node_modules/ng_backoffice/src -name "*.js" -exec ln -s $(realpath {}) public/js/ \; 2>/dev/null + find node_modules/ng_backoffice/css -name "*.css" -exec ln -s $(realpath {}) public/css/ \; 2>/dev/null + find node_modules/ng_backoffice/img -name "*" -exec ln -s $(realpath {}) public/img/ \; 2>/dev/null + + pushd node_modules/ng_backoffice + grunt concat + popd fi if [ -d node_modules/ng_client ]; then - find node_modules/ng_client/views -name "*.html" -exec ln -s {} public/views/ \; - find node_modules/ng_client/src -name "*.js" -exec ln -s {} public/js/ \; + find node_modules/ng_client/views -name "*.html" -exec ln -s $(realpath {}) public/views/ \; 2>/dev/null + find node_modules/ng_client/src -name "*.js" -exec ln -s $(realpath {}) public/js/ \; 2>/dev/null + find node_modules/ng_client/css -name "*.css" -exec ln -s $(realpath {}) public/css/ \; 2>/dev/null + find node_modules/ng_client/img -name "*" -exec ln -s $(realpath {}) public/img/ \; 2>/dev/null + + pushd node_modules/ng_backoffice + grunt concat + popd fi