Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion bin/combined_workflow_files.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ interface Surface {

interface Workflow {
package: string
packageId?: string
surfaces: Surface[]
}

Expand Down Expand Up @@ -66,7 +67,7 @@ Object.entries(surfaces).forEach(([surfaceName, surfaceWorkflows]) => {
fs.writeFileSync(`${surfaceRoot}/index.json`, JSON.stringify(surfaceWorkflows, null, 2))

surfaceWorkflows.forEach((surfaceWorkflow) => {
const normalizedPackage = surfaceWorkflow.package.toLowerCase()
const normalizedPackage = (surfaceWorkflow.packageId || surfaceWorkflow.package).toLowerCase()

const surfacePackageRoot = `${surfaceRoot}/${normalizedPackage}`
if (!fs.existsSync(surfacePackageRoot)) {
Expand Down
13 changes: 8 additions & 5 deletions bin/publish_workflow_ui.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,18 +17,21 @@ do
if [ -f package/workflow-ui.json ]; then
echo "Copying workflow-ui.json for $PACKAGE"

mkdir -p site/$PACKAGE
cp package/workflow-ui.json site/$PACKAGE/workflow-ui.json
PACKAGE_ID=$(cat package/workflow-ui.json | jq -r ".packageId // .package")
Copy link
Contributor Author

@benedfit benedfit Jan 16, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When the workflow-ui.json contains packageId use that as the destination for the files rather than the package name. So /surfaces/site-settings/@netlify/feature-package-pilot would become /surfaces/site-settings/feature-pilot

DEST="site/$PACKAGE_ID"

cat site/$PACKAGE/workflow-ui.json | jq ".surfaces | .[] | .surfaceScripts | .[]?" | while read SCRIPT
mkdir -p $DEST
cp package/workflow-ui.json $DEST/workflow-ui.json

cat $DEST/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
cp package/$SCRIPT $DEST/$SCRIPT
done

ls site/$PACKAGE
ls $DEST
fi


Expand Down