This is an automated email from the ASF dual-hosted git repository.

zky pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/incubator-devlake-website.git


The following commit(s) were added to refs/heads/main by this push:
     new f989210a7 Added Gitpod script for single click contributions! (#361)
f989210a7 is described below

commit f989210a7fc44081dc727c224ad424b7d16ce065
Author: PalanikannanM <[email protected]>
AuthorDate: Wed Dec 28 15:36:20 2022 +0530

    Added Gitpod script for single click contributions! (#361)
    
    * gitpod initialized
    
    * improved nvm installation
    
    * configuring gitpod with javascript
    
    * bumped up the version to 16.14.0
    
    * fixed script file name
    
    * documentation for contributing via gitpod added
---
 .gitpod.Dockerfile                 |  7 +++++++
 .gitpod.yml                        | 26 ++++++++++++++++++++++++++
 README.md                          | 14 ++++++++++++++
 gitpod-scripts/startCloudDevEnv.sh | 27 +++++++++++++++++++++++++++
 4 files changed, 74 insertions(+)

diff --git a/.gitpod.Dockerfile b/.gitpod.Dockerfile
new file mode 100644
index 000000000..d36e70742
--- /dev/null
+++ b/.gitpod.Dockerfile
@@ -0,0 +1,7 @@
+FROM gitpod/workspace-full:latest
+
+RUN bash -c 'VERSION="16.14.0" \
+    && source $HOME/.nvm/nvm.sh && nvm install $VERSION \
+    && nvm use $VERSION && nvm alias default $VERSION'
+
+RUN echo "nvm use default &>/dev/null" >> ~/.bashrc.d/51-nvm-fix
diff --git a/.gitpod.yml b/.gitpod.yml
new file mode 100644
index 000000000..b632a6151
--- /dev/null
+++ b/.gitpod.yml
@@ -0,0 +1,26 @@
+tasks:
+  - name: Initialize DevLake Docs 
+    init: |
+      yarn install
+    command: |
+      nvm use v16.14.0 && sh gitpod-scripts/startCloudDevEnv.sh
+
+ports:
+  - port: 3000
+    onOpen: open-preview
+    visibility: public
+    name: devlake-website
+    description: DevLake Docs
+
+github:
+  prebuilds:
+    master: true
+    branches: true
+    pullRequests: true
+    pullRequestsFromForks: true
+    addCheck: true
+    addComment: true
+    addBadge: true
+
+image:
+  file: .gitpod.Dockerfile
diff --git a/README.md b/README.md
index 8adee8421..726f51ef4 100644
--- a/README.md
+++ b/README.md
@@ -6,8 +6,22 @@ This project keeps all sources used for building up DevLake's 
official website w
 
 Please also make sure your node version is 16.14+, version lower than 16.14.x 
is not supported yet.
  
+## 💻 Start contributing from any browser or Chromebook
+
+ Start developing and make changes to the code via a single click without any 
prior setup for free **Anytime-Anywhere**!
+
+ [![Open in 
Gitpod](https://gitpod.io/button/open-in-gitpod.svg)](https://gitpod.io/#https://github.com/apache/incubator-devlake-website)
+
+ Some *Recommendations* while using **Gitpod**:
+
+ - Download the [gitpod browser 
extension](https://www.gitpod.io/docs/configure/user-settings/browser-extension)
 to start working on any branch,issue or PR via a single click in under a 
minute!
+ - To enjoy *BLAZINGLY FAST* startup times while developing on your forked 
branches, consider [enabling prebuilds by installing Gitpod's GitHub 
App](https://www.gitpod.io/docs/configure/projects/prebuilds/#configuring-prebuilds-manually)
+
+ ---
 ## Installation
 
+**_NOTE:_** You can follow the below instructions to setup your developer 
environment in your `local machine` or use the `gitpod` method specified above 
to code without any prior setup ⚡️ as suggested above as well!
+
 1. Run `yarn install` or `yarn` in the root directory to install the 
dependencies.
 2. Run `yarn start` in the root directory to start a local server, you will 
see the website in http://localhost:3000.
 
diff --git a/gitpod-scripts/startCloudDevEnv.sh 
b/gitpod-scripts/startCloudDevEnv.sh
new file mode 100644
index 000000000..7edd6ed52
--- /dev/null
+++ b/gitpod-scripts/startCloudDevEnv.sh
@@ -0,0 +1,27 @@
+#!/bin/sh
+
+ PORT=3000
+ counter=0
+ watchdog=5
+
+ check_and_set_port() {
+     if lsof -Pi :$PORT -sTCP:LISTEN -t >/dev/null && [ "$counter" -lt 
$watchdog ]; then
+         echo "port $PORT already occupied, changing to the next consecutive 
port"
+         PORT=$(PORT+1)
+         counter=$((counter+1))
+         check_and_set_next_port
+     elif [ "$counter" -ge $watchdog ]; then
+         echo "\033[31mUnable to allocate an empty port for NextJS, the last 
tried port was $NEXTJS_PORT\e[0m"
+         echo "Please either change the $PORT to an other random number/unused 
port number"
+         echo "After changes re-run the script"
+         exit 1
+     else
+         printf "🚀 An empty port found for DevLake Docs 🚀 \n"
+     fi
+ }
+
+ check_and_set_port
+
+ export PORT=$PORT
+
+ yarn start 

Reply via email to