feat: improve build profile DevEx — a la carte collection picker, copy buttons, contributing guide link#7588
feat: improve build profile DevEx — a la carte collection picker, copy buttons, contributing guide link#7588
Conversation
- Add `make site-content` target for the content profile (blog/news/events/resources
included; members/integrations skipped) — previously only discoverable via an echo hint
- Add `make site-custom` target backed by a new `none` profile that starts with zero
preset exclusions, so BUILD_COLLECTIONS_EXCLUDE fully controls what is skipped
- Add `make profiles` target that lists all profiles with their excluded collections
and documents the BUILD_COLLECTIONS_EXCLUDE escape hatch
- Add `make cache-clean` to clear Gatsby cache without triggering a full production
rebuild (the existing `make clean` does both, which surprised contributors)
- Add `develop:content` and `develop:custom` npm scripts to support the new targets
- Fix `site-analyze` missing ## help comment and .PHONY entry
- Improve `site-fast` description from "Alternate method" to something accurate
- Update lite-placeholder.js with three contributor-facing improvements:
* Copy-to-clipboard button on every suggested make command
* A la carte collection picker — checkboxes generate the exact make command
needed; the current route's collection is pre-checked for convenience
* Link to the contributing guide's Environment Variables section
- Pass `collection` name through gatsby-node.js litePlaceholderPages context so
the template can pre-select the relevant checkbox
- Add `none` profile to build-collections.js as the foundation for a la carte builds
- Fix lint-staged silently failing on files in ESLint-ignored directories (add
--no-warn-ignored to suppress the spurious warning that tripped --max-warnings=0)
Signed-off-by: Lee Calcote <lee.calcote@layer5.io>
There was a problem hiding this comment.
Pull request overview
This PR improves developer experience around build profiles/targets and enhances the lite-mode placeholder UX to help contributors quickly re-enable disabled collections.
Changes:
- Adds new build profiles and ergonomics:
site-content,site-custom,profiles, andcache-clean; improves Makefile help text and fixessite-analyzevisibility. - Adds npm scripts for
contentandcustomlite development modes. - Upgrades the lite placeholder page with copy-to-clipboard buttons, an à la carte collection picker, and a link to contributing docs.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
| src/utils/build-collections.js | Adds a none lite profile to enable fully à la carte exclusion via BUILD_COLLECTIONS_EXCLUDE. |
| src/templates/lite-placeholder.js | Adds copy buttons, collection picker, and contributing guide link to the lite-mode placeholder page. |
| package.json | Adds develop:content, develop:custom, and start:content scripts for new profiles. |
| gatsby-node.js | Passes enabledBy and collection into placeholder context to drive UI defaults. |
| Makefile | Introduces new targets (site-content, site-custom, profiles, cache-clean) and improves help output. |
| .lintstagedrc.js | Prevents --max-warnings=0 failures caused by ESLint “ignored file” warnings during lint-staged runs. |
- Guard navigator.clipboard with isSecureContext + optional chaining before writing; eliminates throws in non-secure or unsupported contexts - Store setTimeout id in useRef and clear in useEffect cleanup to avoid state-update-on-unmounted-component React warning on rapid unmount - Add type="button" to prevent unintended form submission - Add aria-live polite status span so screen readers announce copy success - Remove duplicate <SEO> from component body; keep only the Head export (Gatsby 5 manages head state via the exported Head — dual rendering produced duplicate meta tags) - Replace index-based isContentProfile check with Set membership test to guard against future collection renames or insertions Signed-off-by: Lee Calcote <lee.calcote@layer5.io>
|
/gemini review |
src/templates/lite-placeholder.js
Outdated
| background: copied ? "#00b39f" : "transparent", | ||
| border: "1px solid #00b39f", | ||
| borderRadius: "4px", | ||
| color: copied ? "#fff" : "#00b39f", |
There was a problem hiding this comment.
The same brand color literal (#00b39f) is duplicated across multiple inline style objects, which makes future theme/color updates error-prone. Consider extracting a shared constant (or using an existing theme token) and reusing it in the style objects to keep the styling consistent and easier to change.
There was a problem hiding this comment.
Fixed — extracted a BRAND_COLOR constant and replaced all inline occurrences.
src/templates/lite-placeholder.js
Outdated
| All build profiles and environment variables are documented in the{" "} | ||
| <a | ||
| href="https://github.com/layer5io/layer5/blob/master/CONTRIBUTING.md#environment-variables" | ||
| style={{ color: "#00b39f" }} |
There was a problem hiding this comment.
The same brand color literal (#00b39f) is duplicated across multiple inline style objects, which makes future theme/color updates error-prone. Consider extracting a shared constant (or using an existing theme token) and reusing it in the style objects to keep the styling consistent and easier to change.
There was a problem hiding this comment.
Fixed — same BRAND_COLOR constant covers this occurrence as well.
…lder Signed-off-by: Yi Nuo <218099172+yi-nuo426@users.noreply.github.com>
banana-three-join
left a comment
There was a problem hiding this comment.
LGTM and really cool feature! :]
Siddhi-sahu
left a comment
There was a problem hiding this comment.
Everything looks solid👍
just to confirm - For site-custom , is there validation for invalid collection names in BUILD_COLLECTIONS_EXCLUDE??? maybe a simple guard would help, what do you think??
|
@yi-nuo426 I tried to build the site using make site, which runs develop:lite, but it doesn’t seem to work as expected. It consumes all my resources, and even after stopping the process, Gatsby keeps running in the background, crashing my laptop.
|
yes same |
@saurabhraghuvanshii is this different than your current experience? |
|
@Siddhi-sahu, @saurabhraghuvanshii, when you run |
yes, same, at least for me. |
Yes. but I noticed same behaviour on master branch so issue is something else. |
|
Already approved — just want to add a note for the community here. This is a genuinely thoughtful developer experience improvement, @yi-nuo426. The à la carte collection picker, copy-to-clipboard buttons on every make command, and the contributing guide link in the placeholder page all address real friction points that come up repeatedly in community onboarding. The Regarding the memory issue raised by @saurabhraghuvanshii and @Siddhi-sahu: confirmed that the behavior they're seeing exists on The Great contribution. |


Summary
This PR improves the developer experience around site build profiles, make targets, and the lite-mode placeholder page that contributors see when visiting a disabled route.
Make targets
make site-content— new target for thecontentprofile (blog/news/events/resources included; members/integrations skipped). Previously the content profile existed in code but had no make target — it was only discoverable via an echo hint inmake site.make site-custom— new target for fully à la carte builds. Uses a newnonebase profile (zero preset exclusions) soBUILD_COLLECTIONS_EXCLUDEis the only thing that controls what is skipped. Example:BUILD_COLLECTIONS_EXCLUDE=members,events make site-custommake profiles— new target that lists all profiles, their excluded collections, and theBUILD_COLLECTIONS_EXCLUDEescape hatch.make cache-clean— new target that clears the Gatsby cache without triggering a full production rebuild. The existingmake cleandoes both, which surprised contributors who just wanted to reset cache.make site-analyze— fixed missing##help comment and.PHONYentry (was invisible tomakehelp output).site-fast— description updated from the useless "Alternate method" to a precise description of what it actually skips.npm scripts
develop:content— mirrorsdevelop:litewithLITE_BUILD_PROFILE=content.develop:custom— usesLITE_BUILD_PROFILE=nonefor the à la carte target.start:content— alias consistent with the existingstart/start:fullpattern.build-collections.js
noneprofile — excludes nothing by default, makingBUILD_COLLECTIONS_EXCLUDEthe sole driver of exclusions formake site-custom.Lite-mode placeholder page
The placeholder shown when a contributor visits a disabled route (e.g.
/blogin core mode) now has three improvements:makecommand.CONTRIBUTING.md#environment-variables) for full profile documentation.Lint-staged fix
Added
--no-warn-ignoredto the ESLint call in.lintstagedrc.js.src/utils/is in ESLint's ignore list, but lint-staged passes files explicitly, causing a warning that tripped--max-warnings=0on every commit touching asrc/utils/file.Test plan
make(no args) — help output listssite-content,site-custom,profiles,cache-clean,site-analyzemake profiles— prints all four profiles with accurate exclusion listsmake site— echo banner mentionssite-contentandsite-fullmake site-content— dev server starts with blog/news/events/resources enabledmake cache-clean— clears.cachewithout starting a buildBUILD_COLLECTIONS_EXCLUDE=members,events make site-custom— only listed collections excluded/blogin core mode — placeholder showsmake site-contentfirst with Copy button;blogpre-checked in picker/community/members— placeholder shows onlymake site-fullmake site-full; none checked →make siteCONTRIBUTING.md#environment-variables