-
Notifications
You must be signed in to change notification settings - Fork 59
Add extensions support for vscode-web #154
Changes from all commits
fa133e8
f9e0ad2
dbc816d
6c0acdf
6ced8aa
cbddd09
939b3ea
9c8cc66
feccf37
8823bf9
cce4b36
f697c5a
1819039
5d81dc9
541c028
0c4d5d5
cd28996
5ed120a
2a8dafe
640ce28
818763a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
@@ -1,21 +1,49 @@ | ||||||||||||||||||||||||||||||||||||||||||||||||||
#!/usr/bin/env sh | ||||||||||||||||||||||||||||||||||||||||||||||||||
#!/usr/bin/env bash | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||
BOLD='\033[0;1m' | ||||||||||||||||||||||||||||||||||||||||||||||||||
EXTENSIONS=("${EXTENSIONS}") | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||
# Create install directory if it doesn't exist | ||||||||||||||||||||||||||||||||||||||||||||||||||
mkdir -p ${INSTALL_DIR} | ||||||||||||||||||||||||||||||||||||||||||||||||||
# Create install prefix | ||||||||||||||||||||||||||||||||||||||||||||||||||
mkdir -p ${INSTALL_PREFIX} | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||
printf "$${BOLD}Installing vscode-cli!\n" | ||||||||||||||||||||||||||||||||||||||||||||||||||
printf "$${BOLD}Installing Microsoft Visual Studio Code Server!\n" | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||
# Download and extract code-cli tarball | ||||||||||||||||||||||||||||||||||||||||||||||||||
output=$(curl -Lk 'https://code.visualstudio.com/sha/download?build=stable&os=cli-alpine-x64' --output vscode_cli.tar.gz && tar -xf vscode_cli.tar.gz -C ${INSTALL_DIR} && rm vscode_cli.tar.gz) | ||||||||||||||||||||||||||||||||||||||||||||||||||
# Download and extract vscode-server | ||||||||||||||||||||||||||||||||||||||||||||||||||
ARCH=$(uname -m) | ||||||||||||||||||||||||||||||||||||||||||||||||||
case "$ARCH" in | ||||||||||||||||||||||||||||||||||||||||||||||||||
x86_64) ARCH="x64" ;; | ||||||||||||||||||||||||||||||||||||||||||||||||||
aarch64) ARCH="arm64" ;; | ||||||||||||||||||||||||||||||||||||||||||||||||||
*) | ||||||||||||||||||||||||||||||||||||||||||||||||||
echo "Unsupported architecture" | ||||||||||||||||||||||||||||||||||||||||||||||||||
exit 1 | ||||||||||||||||||||||||||||||||||||||||||||||||||
;; | ||||||||||||||||||||||||||||||||||||||||||||||||||
esac | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||
HASH=$(curl https://update.code.visualstudio.com/api/commits/stable/server-linux-$ARCH-web | cut -d '"' -f 2) | ||||||||||||||||||||||||||||||||||||||||||||||||||
output=$(curl -sL https://vscode.download.prss.microsoft.com/dbazure/download/stable/$HASH/vscode-server-linux-$ARCH-web.tar.gz | tar -xz -C ${INSTALL_PREFIX} --strip-components 1) | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||
if [ $? -ne 0 ]; then | ||||||||||||||||||||||||||||||||||||||||||||||||||
echo "Failed to install vscode-cli: $output" | ||||||||||||||||||||||||||||||||||||||||||||||||||
echo "Failed to install Microsoft Visual Studio Code Server: $output" | ||||||||||||||||||||||||||||||||||||||||||||||||||
exit 1 | ||||||||||||||||||||||||||||||||||||||||||||||||||
fi | ||||||||||||||||||||||||||||||||||||||||||||||||||
printf "🥳 vscode-cli has been installed.\n\n" | ||||||||||||||||||||||||||||||||||||||||||||||||||
printf "$${BOLD}Microsoft Visual Studio Code Server has been installed.\n" | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||
VSCODE_SERVER="${INSTALL_PREFIX}/bin/code-server" | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||
# Install each extension... | ||||||||||||||||||||||||||||||||||||||||||||||||||
IFS=',' read -r -a EXTENSIONLIST <<< "$${EXTENSIONS}" | ||||||||||||||||||||||||||||||||||||||||||||||||||
for extension in "$${EXTENSIONLIST[@]}"; do | ||||||||||||||||||||||||||||||||||||||||||||||||||
if [ -z "$extension" ]; then | ||||||||||||||||||||||||||||||||||||||||||||||||||
continue | ||||||||||||||||||||||||||||||||||||||||||||||||||
fi | ||||||||||||||||||||||||||||||||||||||||||||||||||
printf "🧩 Installing extension $${CODE}$extension$${RESET}...\n" | ||||||||||||||||||||||||||||||||||||||||||||||||||
output=$($VSCODE_SERVER --install-extension "$extension" --force) | ||||||||||||||||||||||||||||||||||||||||||||||||||
if [ $? -ne 0 ]; then | ||||||||||||||||||||||||||||||||||||||||||||||||||
echo "Failed to install extension: $extension: $output" | ||||||||||||||||||||||||||||||||||||||||||||||||||
exit 1 | ||||||||||||||||||||||||||||||||||||||||||||||||||
fi | ||||||||||||||||||||||||||||||||||||||||||||||||||
Comment on lines
+34
to
+44
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Given: EXTENSIONS="foo,bar,baz" I would suggest the following posix way, so we don't need to rely on bash/arrays.
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This section is borrowed from There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @mafredri, any second thoughts? Otherwise I should also update code-server module. |
||||||||||||||||||||||||||||||||||||||||||||||||||
done | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||
echo "👷 Running ${INSTALL_DIR}/bin/code serve-web --port ${PORT} --without-connection-token --accept-server-license-terms in the background..." | ||||||||||||||||||||||||||||||||||||||||||||||||||
echo "👷 Running ${INSTALL_PREFIX}/bin/code-server serve-local --port ${PORT} --accept-server-license-terms serve-local --without-connection-token --telemetry-level ${TELEMETRY_LEVEL} in the background..." | ||||||||||||||||||||||||||||||||||||||||||||||||||
echo "Check logs at ${LOG_PATH}!" | ||||||||||||||||||||||||||||||||||||||||||||||||||
${INSTALL_DIR}/code serve-web --port ${PORT} --without-connection-token --accept-server-license-terms > ${LOG_PATH} 2>&1 & | ||||||||||||||||||||||||||||||||||||||||||||||||||
"${INSTALL_PREFIX}/bin/code-server" serve-local --port "${PORT}" --accept-server-license-terms serve-local --without-connection-token --telemetry-level "${TELEMETRY_LEVEL}" > "${LOG_PATH}" 2>&1 & |
Uh oh!
There was an error while loading. Please reload this page.