Skip to content

feat: optimize development experience in GitHub Codespaces #19

@glaucia86

Description

@glaucia86

The repository already has a configured devcontainer, but we can further enhance the experience by ensuring that users can start the project even faster and with a more streamlined setup inside GitHub Codespaces.


Proposed Improvements:

1️⃣ Automate Project Initialization

  • Currently, users must manually run npm start after Codespaces loads.
  • We can automate this process so that the project starts as soon as Codespaces is ready.

Suggested update to postCreateCommand:

"postCreateCommand": "npm install -g ollamazure tsx; npm ci; cd videos/demos && npm ci && cd ../.. && npm start"

✅ Impact: The project starts automatically when opening Codespaces, reducing manual steps.


2️⃣ Improve Instructions in README

  • Update the README steps to clearly indicate that the project automatically installs dependencies and starts running.
  • Highlight the Codespaces button for better visibility.

Suggested README update:

## 🚀 Quick Start with GitHub Codespaces  
Click the button below to start coding instantly:  

[![Open in GitHub Codespaces](https://img.shields.io/badge/Open%20in-GitHub%20Codespaces-blue?logo=github)](https://codespaces.new/microsoft/generative-ai-with-javascript)  

Once the Codespaces environment loads, the project will **automatically install dependencies and start running**. No need to run extra commands!  

Impact: Improves onboarding experience and reduces manual steps.


3️⃣ Improve Performance by Pre-Installing Dependencies

Installing dependencies inside Codespaces can slow down the first-time setup. Instead of relying on fresh npm install runs, we can pre-install dependencies inside a Dockerfile to speed up initialization.

📌 Suggested changes:

  1. Modify .devcontainer/devcontainer.json to use a Dockerfile:
{
  "build": {
    "dockerfile": "Dockerfile"
  }
}
  1. Create a Dockerfile in .devcontainer/ with:
FROM mcr.microsoft.com/devcontainers/javascript-node:20-bullseye
WORKDIR /workspace
COPY package.json package-lock.json ./
RUN npm ci
COPY . .

Impact: Dependencies are pre-installed during the container build, reducing the setup time when launching Codespaces.


Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions