Replace contextSchema with parameters, add built-in context builder#131
Draft
nick-pape wants to merge 3 commits intoSharePoint:mainfrom
Draft
Replace contextSchema with parameters, add built-in context builder#131nick-pape wants to merge 3 commits intoSharePoint:mainfrom
nick-pape wants to merge 3 commits intoSharePoint:mainfrom
Conversation
…lder and --param CLI flag Move all ~15 derived template variables (name variants, UUIDs, etc.) into a shared buildBuiltInContext() function in the API package so they are always injected automatically. Templates no longer need to redeclare them. Replace contextSchema with a new parameters field for custom-only params that supports required/default. Add --param key=value CLI flag for passing custom parameters. Remove lodash and uuid dependencies from the CLI (string transforms are now inline in the API; UUIDs use Node crypto.randomUUID). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…eter-refactor # Conflicts: # api/spfx-template-api/src/templating/test/SPFxTemplate.test.ts # common/config/rush/repo-state.json # templates/AGENTS.md
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Refactors the template parameter system to separate built-in context variables from custom template parameters:
buildBuiltInContext()in API package — All ~15 derived template variables (name variants, UUIDs, etc.) are now computed in a shared function and automatically injected into every template. Templates no longer need to redeclare them incontextSchema.contextSchema→parameters— Replaced with a new field for custom-only params, supportingrequired(default true) anddefaultvalues. Zod validation rejects collisions with built-in names.--param key=valueCLI flag — Repeatable flag for passing custom template parameters, with early validation against the template's parameter definitions.lodashanduuidfrom CLI — String transforms implemented inline in the API package (~40 lines); UUIDs use Node's built-incrypto.randomUUID().template.jsonfiles — RemovedcontextSchemaentirely since all current templates only use built-in variables.How was this tested?
rush build— all 21 projects compile (0 errors, 0 lint warnings)cd api/spfx-template-api && heft test— 148 unit tests pass (including 19 new tests forbuildBuiltInContext)cd tests/spfx-template-test && heft test— all 18 E2E template scaffolding tests pass--paramflagType of change
🤖 Generated with Claude Code