From fdff6bb59e9c9ae2fa44078add135cf032d65740 Mon Sep 17 00:00:00 2001 From: Ed Stephinson Date: Fri, 18 Nov 2022 16:12:42 +0000 Subject: [PATCH] feat: copy workflow ui scripts from package --- ...orkflow_json.sh => publish_workflow_ui.sh} | 24 ++++++++++++++----- 1 file changed, 18 insertions(+), 6 deletions(-) rename bin/{publish_workflow_json.sh => publish_workflow_ui.sh} (61%) diff --git a/bin/publish_workflow_json.sh b/bin/publish_workflow_ui.sh similarity index 61% rename from bin/publish_workflow_json.sh rename to bin/publish_workflow_ui.sh index f9ab90a4e..6d89b0555 100644 --- a/bin/publish_workflow_json.sh +++ b/bin/publish_workflow_ui.sh @@ -9,14 +9,26 @@ sudo apt-get install jq # Loop through each package, install from npm and copy the workflow-ui.json from root of the package if it exists cat site/plugins.json | jq ".[] | select(.workflow == true) | .package" | while read PACKAGE do - echo "Installing $PACKAGE" - # remove the quotes from the package name PACKAGE=$(echo $PACKAGE | tr -d '"') - npm install $PACKAGE - if [ -f "node_modules/$PACKAGE/workflow-ui.json" ]; then - echo "Copying workflow-ui.json from $PACKAGE" - cp node_modules/$PACKAGE/workflow-ui.json site/$PACKAGE/workflow-ui.json + echo "Downloading workflow-ui for $PACKAGE" + npm pack $PACKAGE + tar -xzf *.tgz + + if [ -f package/workflow-ui.json ]; then + echo "Copying workflow-ui.json for $PACKAGE" + cp package/workflow-ui.json site/$PACKAGE/workflow-ui.json + + cat site/$PACKAGE/workflow-ui.json | jq ".surfaces | .[] | .surfaceScripts | .[]" | while read SCRIPT + do + # strip quotes and leading ./ from script path + SCRIPT=$(echo $SCRIPT | tr -d '"' | sed 's/^\.\///') + echo "Copying $SCRIPT for $PACKAGE" + cp package/$SCRIPT site/$PACKAGE/$SCRIPT + done fi + + + rm -rf ./package done # Add all files to git in the site directory