Skip to content

Commit

Permalink
feat: ephemeral installer
Browse files Browse the repository at this point in the history
Signed-off-by: ashutosh16 <[email protected]>
  • Loading branch information
ashutosh16 committed Oct 4, 2024
1 parent c5fe1e6 commit 8b1bce1
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -75,11 +75,11 @@ install_extension() {
create_extension_js_file_with_vars() {
echo "Generating extension vars js file..."
ext_installed_path=$(find /tmp/extensions/resources -type d -name "extension*-$ext_name*.js" | head -n 1)
ext_js_file_name="${ext_name}_vars"
sanitized_extension_name=$(echo "${ext_name//-/_}" | tr '[:lower:]' '[:upper:]')
ext_js_file_name="${sanitized_extension_name}_vars"
js_file_path="${ext_installed_path}/extension-0-${ext_js_file_name}.js"
js_variable=$(echo "$ext_vars" | jq -r 'to_entries | map("\"" + (.key | ascii_upcase) + "\": \"" + .value + "\"") | join(", ")')
upper_ext_name=$(echo "$ext_name" | tr '[:lower:]' '[:upper:]')
js_vars_wrap="((window) => { const vars = { $js_variable }; window.${upper_ext_name}_VARS = vars; })(window);"
js_vars_wrap="((window) => { const vars = { $js_variable }; window.${sanitized_extension_name}_VARS = vars; })(window);"
if [ -d "$ext_installed_path" ]; then
echo "Exporting extension vars file at $js_file_path"
echo "$js_vars_wrap" > "$js_file_path"
Expand Down

0 comments on commit 8b1bce1

Please sign in to comment.