Skip to content
Snippets Groups Projects
Commit 8b4c6c8f authored by Reiter, Christoph's avatar Reiter, Christoph :snake:
Browse files

Allow passing in a full npm package name instead of just the suffix

It's not very discoverable re which applications exist. The easiest
way is to point to npm for a list of packages.

To avoid confusion re naming just allow passing in a full npm package name
instead of just the suffix.
parent d595b4d2
No related branches found
No related tags found
No related merge requests found
...@@ -21,7 +21,9 @@ install_app () { ...@@ -21,7 +21,9 @@ install_app () {
# Remove trailing slash from path # Remove trailing slash from path
path=${path%/} path=${path%/}
echo "Installing app: '$1' in directory '$destDir' with path prefix '$path'..."; packageName="@dbp-topics/${$1##@dbp-topics/}"
echo "Installing app: '$packageName' in directory '$destDir' with path prefix '$path'...";
# Do a basic check if a path was entered # Do a basic check if a path was entered
if [[ $destDir != "." && $destDir != ".." ]]; then if [[ $destDir != "." && $destDir != ".." ]]; then
...@@ -29,8 +31,8 @@ install_app () { ...@@ -29,8 +31,8 @@ install_app () {
fi fi
npm init -y || exit 2; npm init -y || exit 2;
npm install @dbp-topics/$1 || exit 2; npm install "$packageName" || exit 2;
cp -R node_modules/@dbp-topics/$1/app-template public || exit 2; cp -R node_modules/"$packageName"/app-template public || exit 2;
cd public || exit 2; cd public || exit 2;
sed -i 's|="/|="'"$path"'/|g' index.html sed -i 's|="/|="'"$path"'/|g' index.html
sed -i "s|from '/|from '$path/|g" index.html sed -i "s|from '/|from '$path/|g" index.html
...@@ -39,17 +41,18 @@ install_app () { ...@@ -39,17 +41,18 @@ install_app () {
sed -i 's| /| '"$path"'/|g' .htaccess sed -i 's| /| '"$path"'/|g' .htaccess
sed -i 's|="/|="'"$path"'/|g' browserconfig.xml sed -i 's|="/|="'"$path"'/|g' browserconfig.xml
sed -i 's|"path": "/|"path": "'"$path"'/|g' topic.metadata.json sed -i 's|"path": "/|"path": "'"$path"'/|g' topic.metadata.json
ln -s ../node_modules/@dbp-topics/$1/dist app || exit 2; ln -s ../node_modules/"$packageName"/dist app || exit 2;
echo echo
echo "The application '$1' was installed in directory '$destDir'." echo "The application '$packageName' was installed in directory '$destDir'."
echo "Your webroot is '$destDir/public'." echo "Your webroot is '$destDir/public'."
} }
update_app () { update_app () {
echo "Updating app: '$1'..."; packageName="@dbp-topics/${$1##@dbp-topics/}"
npm update @dbp-topics/$1 || exit 3; echo "Updating app: '$packageName'...";
npm update "$packageName" || exit 3;
echo echo
echo "The application '$1' was updated." echo "The application '$packageName' was updated."
} }
case $1 in case $1 in
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment