From 71f996941774bf115c38ccdb677950dabb8a781a Mon Sep 17 00:00:00 2001 From: Alex Gyoshev Date: Thu, 1 Jun 2017 09:38:30 +0300 Subject: [PATCH] chore: use parameters when embedding dependencies, validate build --- build/embed-dependencies.sh | 18 ++++++++++++------ package.json | 2 +- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/build/embed-dependencies.sh b/build/embed-dependencies.sh index 11f451a..cb12db7 100755 --- a/build/embed-dependencies.sh +++ b/build/embed-dependencies.sh @@ -1,13 +1,19 @@ #!/usr/bin/bash +# Usage: embed-dependnecies.sh [module-name]... + mkdir -p modules -mkdir -p modules/bootstrap -mkdir -p modules/@progress/kendo-theme-default -# copy dependencies from node_modules/ to modules/ subdir -rsync -avc --delete --include "**.scss" node_modules/bootstrap/ modules/bootstrap/ -rsync -avc --delete --include "**.scss" node_modules/@progress/kendo-theme-default/ modules/@progress/kendo-theme-default/ +for module in "$@" +do + # copy dependencies from node_modules/ to modules/ subdir + echo "Copy $module dependency" + mkdir -p modules/$module + rsync -avc --delete --include "**.scss" node_modules/$module/ modules/$module/ +done -# replace references to modules +# replace references to modules with relative paths find ./scss/ -maxdepth 1 -type f -name "*.scss" -exec sed -i 's#\(@import\s\+\)\(''\|\"\)~\(.*\);#\1\2../modules/\3;#' "{}" \; find ./scss/ -maxdepth 2 -type f -name "*.scss" -exec sed -i 's#\(@import\s\+\)\(''\|\"\)~\(.*\);#\1\2../../modules/\3;#' "{}" \; +find ./scss/ -maxdepth 3 -type f -name "*.scss" -exec sed -i 's#\(@import\s\+\)\(''\|\"\)~\(.*\);#\1\2../../../modules/\3;#' "{}" \; + diff --git a/package.json b/package.json index 4214b7c..4ed9dc7 100644 --- a/package.json +++ b/package.json @@ -39,7 +39,7 @@ "build": "webpack --optimize-minimize --bail", "watch": "webpack --watch", "test": "npm run lint && npm run build && npm run api-check", - "prepublishOnly": "build/embed-dependencies.sh", + "prepublishOnly": "./build/embed-dependencies.sh bootstrap '@progress/kendo-theme-default' && npm run build", "semantic-release": "semantic-release pre && semantic-prerelease publish && semantic-release post" }, "config": {