From 60fe7bd41e234117036de3564ef41ad2971ed056 Mon Sep 17 00:00:00 2001 From: Ofer Shaal Date: Tue, 15 Mar 2022 17:03:26 -0400 Subject: [PATCH] Gitpod setup improvements (#2789) * install latest pnpm version in docker image * Add astro-build vscode extension in Gitpod setup * automatically open preview when port 3000 is used * run astro build during prebuild * Run starter demo when starting this workspace * and $ASTRO_NEW to run specific example * open index.astro of selected project * Add sleep 1 before running code command * use `gp await-port` instead of sleep --- .gitpod.Dockerfile | 4 ++++ .gitpod.yml | 16 +++++++++++----- 2 files changed, 15 insertions(+), 5 deletions(-) create mode 100644 .gitpod.Dockerfile diff --git a/.gitpod.Dockerfile b/.gitpod.Dockerfile new file mode 100644 index 000000000..965d8684c --- /dev/null +++ b/.gitpod.Dockerfile @@ -0,0 +1,4 @@ +FROM gitpod/workspace-node + +# Install latest pnpm +RUN pnpm i -g pnpm diff --git a/.gitpod.yml b/.gitpod.yml index ad4439968..6d12b9fff 100644 --- a/.gitpod.yml +++ b/.gitpod.yml @@ -1,15 +1,21 @@ --- +image: + file: .gitpod.Dockerfile # Commands to start on workspace startup tasks: - - init: pnpm install - command: pnpm run build + - init: | + pnpm install + pnpm run build + command: | + [[ ! -z "$ASTRO_NEW" ]] && gp await-port 23000 && cd "$GITPOD_REPO_ROOT"/examples/"$ASTRO_NEW" && code src/pages/index.astro && pnpm start vscode: extensions: - # TODO Once astro is on [vsx](https://open-vsx.org/), we should be able to specify it as an extension as well! - # https://www.gitpod.io/docs/vscode-extensions - - https://marketplace.visualstudio.com/_apis/public/gallery/publishers/astro-build/vsextensions/astro-vscode/0.7.13/vspackage + - astro-build.astro-vscode - esbenp.prettier-vscode - dbaeumer.vscode-eslint +ports: + - port: 3000 + onOpen: open-preview github: prebuilds: # enable for the master/default branch (defaults to true)