Add local dev workspace script and localhost binding#990
Add local dev workspace script and localhost binding#990lyzhang0113 wants to merge 2 commits intopreviewfrom
Conversation
There was a problem hiding this comment.
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.ps1to automate template cloning/updating, workspace merging, bundler setup, andjekyll serve(with flags like-NoServe,-NoTemplateUpdate,-Port,-BindHost). - Updated
README.mdto document the new PowerShell workflow, flags, and local preview URL. - Updated
.gitignoreto 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.
| New-Item -ItemType Directory -Force -Path $bundlePath, $bundleConfig, $bundleUserHome, $jekyllCache, $siteDir | Out-Null | ||
|
|
There was a problem hiding this comment.
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.
| 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 |
There was a problem hiding this comment.
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" |
There was a problem hiding this comment.
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.
| "/XD", ".git", ".dev", ".vs", "node_modules", "_site" | |
| "/XD", ".git", ".dev", ".vs", "node_modules", "_site", ".bundle", ".jekyll-cache", ".sass-cache", "vendor" |
There was a problem hiding this comment.
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
| 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 | ||
| ``` |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
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.mdhas been updated with clear instructions for using the new script, and a comprehensivescripts/dev.ps1script has been added to handle all setup tasks.Local development workflow improvements:
scripts/dev.ps1that 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).README.mdto 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:
.dev/directory, improving workspace cleanliness and reproducibility. [1] [2].dev/, reducing the risk of polluting the global environment.Quality-of-life improvements:
git,robocopy,bundle) before proceeding.README.md.