Skip to content

Add local dev workspace script and localhost binding#990

Draft
lyzhang0113 wants to merge 2 commits intopreviewfrom
codex/local-dev-workflow-localhost
Draft

Add local dev workspace script and localhost binding#990
lyzhang0113 wants to merge 2 commits intopreviewfrom
codex/local-dev-workflow-localhost

Conversation

@lyzhang0113
Copy link
Copy Markdown
Collaborator

This pull request introduces a new PowerShell-based local development workflow for the project, replacing the previous manual and Bash-based instructions. The new workflow simplifies setup, automates environment preparation, and provides flexible options for serving and previewing the documentation site. The README.md has been updated with clear instructions for using the new script, and a comprehensive scripts/dev.ps1 script has been added to handle all setup tasks.

Local development workflow improvements:

  • Added a new PowerShell script scripts/dev.ps1 that automates cloning/updating the template repo, merging docs, installing dependencies, and serving the site, with support for various flags (e.g., -NoServe, -NoTemplateUpdate, -Port, -BindHost).
  • Updated README.md to document the new PowerShell-based workflow, replacing the previous Bash/manual steps, and describing available script flags and local workspace structure.

Environment and reproducibility enhancements:

  • The script ensures all local-only files and build artifacts are kept in a dedicated .dev/ directory, improving workspace cleanliness and reproducibility. [1] [2]
  • Bundler and Jekyll are configured to use isolated local paths within .dev/, reducing the risk of polluting the global environment.

Quality-of-life improvements:

  • The script provides clear step-by-step logging, robust error handling, and checks for required commands (git, robocopy, bundle) before proceeding.
  • Local preview URL and usage examples are now clearly documented in the README.md.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a PowerShell-based local development workflow for building and serving the Jekyll documentation site using a merged workspace (docs repo + template repo), with artifacts isolated under .dev/.

Changes:

  • Added scripts/dev.ps1 to automate template cloning/updating, workspace merging, bundler setup, and jekyll serve (with flags like -NoServe, -NoTemplateUpdate, -Port, -BindHost).
  • Updated README.md to document the new PowerShell workflow, flags, and local preview URL.
  • Updated .gitignore to ignore the new .dev/ workspace and common local Jekyll/Bundler caches.

Reviewed changes

Copilot reviewed 2 out of 3 changed files in this pull request and generated 3 comments.

File Description
scripts/dev.ps1 Implements the automated local workspace + serve workflow and isolates Bundler/Jekyll paths under .dev/.
README.md Replaces prior local dev steps with PowerShell script usage and workspace/flag documentation.
.gitignore Ignores .dev/ and common local build/cache directories to keep the repo clean.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +137 to +138
New-Item -ItemType Directory -Force -Path $bundlePath, $bundleConfig, $bundleUserHome, $jekyllCache, $siteDir | Out-Null

Copy link

Copilot AI Mar 26, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

New-Item -Path $bundlePath, ... will likely fail on a fresh run because $bundlePath is .dev/vendor\bundle and the intermediate .dev/vendor directory is not created beforehand. Create the parent directory first (or build $bundlePath from two Join-Path calls and ensure both directories exist) so the script works on a clean checkout.

Suggested change
New-Item -ItemType Directory -Force -Path $bundlePath, $bundleConfig, $bundleUserHome, $jekyllCache, $siteDir | Out-Null
# Ensure parent directories exist before creating the target directories
$bundleRelatedPaths = @($bundlePath, $bundleConfig, $bundleUserHome, $jekyllCache, $siteDir)
$parentPaths = $bundleRelatedPaths |
ForEach-Object { Split-Path -Parent $_ } |
Where-Object { $_ -and -not [string]::IsNullOrWhiteSpace($_) } |
Select-Object -Unique
if ($parentPaths.Count -gt 0) {
New-Item -ItemType Directory -Force -Path $parentPaths | Out-Null
}
New-Item -ItemType Directory -Force -Path $bundleRelatedPaths | Out-Null

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the callout. I am keeping this as-is: in PowerShell, New-Item -ItemType Directory -Force creates intermediate directories, so .dev/vendor is created when creating .dev/vendor/bundle on a clean checkout. Verified locally.

scripts/dev.ps1 Outdated
New-Item -ItemType Directory -Force -Path $docHome | Out-Null
Invoke-Robocopy -Source $repoRoot -Destination $docHome -ExtraArgs @(
"/MIR",
"/XD", ".git", ".dev", ".vs", "node_modules", "_site"
Copy link

Copilot AI Mar 26, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The robocopy mirror from $repoRoot to $docHome doesn’t exclude common local Ruby/Jekyll artifacts (e.g. .bundle, .jekyll-cache, .sass-cache, vendor) that are now gitignored. If those exist in the repo root from a previous workflow, they’ll be copied into .dev/DocHome and can interfere with the isolated .dev setup—consider adding them to the /XD exclude list here.

Suggested change
"/XD", ".git", ".dev", ".vs", "node_modules", "_site"
"/XD", ".git", ".dev", ".vs", "node_modules", "_site", ".bundle", ".jekyll-cache", ".sass-cache", "vendor"

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Applied in commit 8965f9a. I extended the /XD exclude list for the repoRoot -> DocHome mirror to include .bundle, .jekyll-cache, .sass-cache, and vendor so local Ruby/Jekyll artifacts are not copied into .dev/DocHome.

README.md Outdated
Comment on lines 7 to 12
1. Install Ruby, Bundler, and Jekyll.
2. Run the local dev script from this repository root:

```bash
bundle install
```powershell
powershell -ExecutionPolicy Bypass -File .\scripts\dev.ps1
```
Copy link

Copilot AI Mar 26, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The README prerequisites don’t match what scripts/dev.ps1 actually requires: the script explicitly checks for git, robocopy (Windows), and bundle, and it runs bundle exec jekyll (so a global Jekyll install typically isn’t needed). Please update the Local Development steps to mention the required commands/Windows dependency (robocopy) and clarify which Ruby tooling must be installed.

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Applied in commit 8965f9a. I updated README prerequisites to match the script requirements (git, bundle via Ruby+Bundler, robocopy on Windows) and clarified that a global Jekyll install is not required because the script uses bundle exec jekyll.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants