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
This commit is contained in:
Ofer Shaal 2022-03-15 17:03:26 -04:00 committed by GitHub
parent 6eb494796e
commit 60fe7bd41e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 15 additions and 5 deletions

4
.gitpod.Dockerfile vendored Normal file
View file

@ -0,0 +1,4 @@
FROM gitpod/workspace-node
# Install latest pnpm
RUN pnpm i -g pnpm

View file

@ -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)