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
13 changes: 13 additions & 0 deletions scripting/TemplateWorkspace/.vscode/preview.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/bin/sh

# Change VS Browser Column to "Three" and URL for 2nd Browser
SETTINGSFILE="./.vscode/settings.json"
if [ -f "$SETTINGSFILE" ]; then
sed -i.bak \
-e 's/"Two"/"Three"/g' \
-e 's|"vs-browser\.url": ".*"|"vs-browser.url": "https://www.example.com"|' \
"$SETTINGSFILE"
rm -f "${SETTINGSFILE}.bak"
else
echo "File not found: $SETTINGSFILE"
fi
1 change: 1 addition & 0 deletions scripting/TemplateWorkspace/.vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"vcr.yml": true,
},
"vs-browser.url": "<URL>",
"vs-browser.columnToShowIn": "Two",
"vs-browser.reload.onSave": false,
"workbench.startupEditor": "none"
}
26 changes: 19 additions & 7 deletions scripting/TemplateWorkspace/.vscode/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,15 @@
"version": "2.0.0",
"tasks": [
{
"label": "OpenBrowser",
"label": "OpenContentView",
"command": "${input:openBrowser}",
"presentation": {
"reveal": "never",
"close": true
}
},
{
"label": "OpenPreviewView",
"command": "${input:openBrowser}",
"presentation": {
"reveal": "never",
Expand All @@ -26,6 +34,15 @@
"close": true
}
},
{
"label": "ConfigurePreview",
"type": "shell",
"command": "chmod +x ./.vscode/preview.sh; ./.vscode/preview.sh",
"presentation": {
"reveal": "never",
"close": true
}
},
{
"label": "CleanUp",
"type": "shell",
Expand All @@ -37,12 +54,7 @@
},
{
"label": "Run",
"dependsOn": [
"ExportEnv",
"OpenBrowser",
"OpenTerminal",
"CleanUp"
],
"dependsOn": <TASKS>,
"dependsOrder": "sequence",
"runOptions": {
"runOn": "folderOpen"
Expand Down
19 changes: 18 additions & 1 deletion scripting/createWorkspace.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ fi
SLUG=$(jq -r '.slug' "$CONFIG_FILE")
VERSION=$(jq -r '.version' "$CONFIG_FILE")
FILES=$(jq -r '.files[]' "$CONFIG_FILE")
PANELS=$(jq -r '.panels[]' "$CONFIG_FILE")

# Create files from the "files" array
for FILE in $FILES; do
Expand Down Expand Up @@ -50,4 +51,20 @@ if [ -f "$OFOS_FILE" ]; then
echo "Updated $OFOS_FILE with files: $FILES_ARRAY"
else
echo "$OFOS_FILE not found."
fi
fi

# Update tasks.json using a temporary file
if echo "${PANELS[@]}" | grep -q "browser"; then
TASKS='["ExportEnv", "OpenContentView", "OpenTerminal", "ConfigurePreview", "OpenPreviewView", "CleanUp"]'
else
TASKS='["ExportEnv", "OpenContentView", "OpenTerminal", "CleanUp"]'
fi

TASKS_FILE=".vscode/tasks.json"
if [ -f "$TASKS_FILE" ]; then
TEMP_FILE=$(mktemp)
sed "s|<TASKS>|$TASKS|" "$TASKS_FILE" > "$TEMP_FILE" && mv "$TEMP_FILE" "$TASKS_FILE"
echo "Updated $TASKS_FILE with tasks: $TASKS"
else
echo "$TASKS_FILE not found."
fi
3 changes: 1 addition & 2 deletions tutorials/messages_api-sms/tutorial-config.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@
"send-sms.js"
],
"panels": [
"terminal",
"browser"
],
"version": "0.2"
"version": "0.3"
}