Skip to content

Add .spfx-scaffold.jsonl to .gitignore in all templates, examples, and test fixtures#227

Merged
iclanton merged 1 commit intoSharePoint:mainfrom
iclanton:iclanton/gitignore-scaffold-log
Apr 6, 2026
Merged

Add .spfx-scaffold.jsonl to .gitignore in all templates, examples, and test fixtures#227
iclanton merged 1 commit intoSharePoint:mainfrom
iclanton:iclanton/gitignore-scaffold-log

Conversation

@iclanton
Copy link
Copy Markdown
Contributor

@iclanton iclanton commented Apr 2, 2026

Description

The scaffold log (.spfx-scaffold.jsonl) is now persisted to disk by the CLI after every spfx create run (#221). This PR adds it to .gitignore in every template, example, and test fixture so it doesn't appear as an untracked file in generated projects.

Followed by #229, which uses the scaffold log location and the package.json engines field as the source of truth for the selected package manager.

How was this tested

  • rushx build in tests/spfx-template-test — snapshot updated to reflect that templates now emit a .gitignore file (file count 1→2).

Type of change

  • Bug fix
  • New feature
  • Template change (modifies template files or examples)
  • Docs / CI change only

🤖 Generated with Claude Code

Copilot AI review requested due to automatic review settings April 2, 2026 22:15
Follow-up to SharePoint#221: since scaffold now persists the log to disk, gitignore
it in every template, example, and test fixture so it doesn't appear as
an untracked file in generated projects.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@iclanton iclanton force-pushed the iclanton/gitignore-scaffold-log branch from de0c876 to c5d9586 Compare April 2, 2026 22:18
@iclanton iclanton enabled auto-merge (squash) April 2, 2026 22:19
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

This PR primarily aims to prevent the persisted scaffold log file (.spfx-scaffold.jsonl) from showing up as an untracked file in generated projects, and also includes a broad set of related CLI/API/tooling updates (GitHub auth handling, scaffold logging, template context changes, pipeline action split, and documentation updates).

Changes:

  • Add .spfx-scaffold.jsonl to .gitignore across templates, examples, and test fixtures.
  • Introduce/expand scaffold logging + built-in render context utilities in @microsoft/spfx-template-api, and adjust template manifests/docs accordingly.
  • Add GitHub token passthrough/normalization and split the repo-toolbox “emit vars + tag build” action into two actions; update pipeline YAML and help snapshots.

Reviewed changes

Copilot reviewed 37 out of 37 changed files in this pull request and generated no comments.

Show a summary per file
File Description
tools/repo-toolbox/src/utilities/test/PackageTgzUtilities.test.ts Adjusts test setup (removes a mock call in a specific test).
tools/repo-toolbox/src/utilities/test/GitUtilities.test.ts Updates tests for renamed/changed GitHub auth header helper behavior.
tools/repo-toolbox/src/utilities/test/GitHubClient.test.ts Adds unit tests for GitHub Authorization header normalization.
tools/repo-toolbox/src/utilities/test/snapshots/GitUtilities.test.ts.snap Updates snapshots for renamed GitHub auth header helper.
tools/repo-toolbox/src/utilities/GitUtilities.ts Renames and changes GitHub auth header extraction to return normalized header object.
tools/repo-toolbox/src/utilities/GitHubClient.ts Adds header normalization helper + changes client to accept normalized header object.
tools/repo-toolbox/src/cli/ToolboxCommandLine.ts Splits combined action into emit-github-vars + tag-build.
tools/repo-toolbox/src/cli/test/snapshots/CommandLineHelp.test.ts.snap Updates CLI help output snapshots for repo-toolbox action changes.
tools/repo-toolbox/src/cli/actions/TagBuildAction.ts New action to tag AzDO build and emit BumpSha.
tools/repo-toolbox/src/cli/actions/GitHubTokenActionBase.ts New base class to share --github-token parameter behavior.
tools/repo-toolbox/src/cli/actions/EmitGitHubVarsAndTagBuildAction.ts Removes old combined action.
tools/repo-toolbox/src/cli/actions/EmitGitHubVarsAction.ts New action to emit GitHub vars with token normalization and fallback behavior.
tools/repo-toolbox/src/cli/actions/CreateGitHubReleasesAction.ts Refactors token handling + improves error logging/reporting.
tests/spfx-template-test/test-template/template.json Removes contextSchema from test template manifest.
tests/spfx-template-test/test-template/.gitignore Adds .spfx-scaffold.jsonl ignore entry for fixture template output.
tests/spfx-template-test/src/tests/templates.test.ts Ignores .spfx-scaffold.jsonl in generated project file enumeration.
tests/spfx-template-test/src/tests/snapshots/templates.test.ts.snap Updates snapshot for template file count + emitted .gitignore.
templates/webpart-react/template.json Removes contextSchema from template manifest.
templates/webpart-react/.gitignore Ignores .spfx-scaffold.jsonl in template output.
templates/webpart-noframework/template.json Removes contextSchema from template manifest.
templates/webpart-noframework/.gitignore Ignores .spfx-scaffold.jsonl in template output.
templates/webpart-minimal/template.json Removes contextSchema from template manifest.
templates/webpart-minimal/.gitignore Ignores .spfx-scaffold.jsonl in template output.
templates/library/template.json Removes contextSchema from template manifest.
templates/library/.gitignore Ignores .spfx-scaffold.jsonl in template output.
templates/extension-search-query-modifier/template.json Removes contextSchema from template manifest.
templates/extension-search-query-modifier/.gitignore Ignores .spfx-scaffold.jsonl in template output.
templates/extension-listviewcommandset/template.json Removes contextSchema from template manifest.
templates/extension-listviewcommandset/.gitignore Ignores .spfx-scaffold.jsonl in template output.
templates/extension-formcustomizer-react/template.json Removes contextSchema from template manifest.
templates/extension-formcustomizer-react/.gitignore Ignores .spfx-scaffold.jsonl in template output.
templates/extension-formcustomizer-noframework/template.json Removes contextSchema from template manifest.
templates/extension-formcustomizer-noframework/.gitignore Ignores .spfx-scaffold.jsonl in template output.
templates/extension-fieldcustomizer-react/template.json Removes contextSchema from template manifest.
templates/extension-fieldcustomizer-react/.gitignore Ignores .spfx-scaffold.jsonl in template output.
templates/extension-fieldcustomizer-noframework/template.json Removes contextSchema from template manifest.
templates/extension-fieldcustomizer-noframework/.gitignore Ignores .spfx-scaffold.jsonl in template output.
templates/extension-fieldcustomizer-minimal/template.json Removes contextSchema from template manifest.
templates/extension-fieldcustomizer-minimal/.gitignore Ignores .spfx-scaffold.jsonl in template output.
templates/extension-application-customizer/template.json Removes contextSchema from template manifest.
templates/extension-application-customizer/.gitignore Ignores .spfx-scaffold.jsonl in template output.
templates/AGENTS.md Documents built-in template context variables and agent rules.
templates/ace-search-card/template.json Removes contextSchema from template manifest.
templates/ace-search-card/.gitignore Ignores .spfx-scaffold.jsonl in template output.
templates/ace-generic-primarytext-card/template.json Removes contextSchema from template manifest.
templates/ace-generic-primarytext-card/.gitignore Ignores .spfx-scaffold.jsonl in template output.
templates/ace-generic-image-card/template.json Removes contextSchema from template manifest.
templates/ace-generic-image-card/.gitignore Ignores .spfx-scaffold.jsonl in template output.
templates/ace-generic-card/template.json Removes contextSchema from template manifest.
templates/ace-generic-card/.gitignore Ignores .spfx-scaffold.jsonl in template output.
templates/ace-data-visualization/template.json Removes contextSchema from template manifest.
templates/ace-data-visualization/.gitignore Ignores .spfx-scaffold.jsonl in template output.
examples/webpart-react/.gitignore Ignores .spfx-scaffold.jsonl in example.
examples/webpart-noframework/.gitignore Ignores .spfx-scaffold.jsonl in example.
examples/webpart-minimal/.gitignore Ignores .spfx-scaffold.jsonl in example.
examples/test/.gitignore Adds .spfx-scaffold.jsonl ignore entry.
examples/library/.gitignore Ignores .spfx-scaffold.jsonl in example.
examples/extension-search-query-modifier/.gitignore Ignores .spfx-scaffold.jsonl in example.
examples/extension-listviewcommandset/.gitignore Ignores .spfx-scaffold.jsonl in example.
examples/extension-formcustomizer-react/.gitignore Ignores .spfx-scaffold.jsonl in example.
examples/extension-formcustomizer-noframework/.gitignore Ignores .spfx-scaffold.jsonl in example.
examples/extension-fieldcustomizer-react/.gitignore Ignores .spfx-scaffold.jsonl in example.
examples/extension-fieldcustomizer-noframework/.gitignore Ignores .spfx-scaffold.jsonl in example.
examples/extension-fieldcustomizer-minimal/.gitignore Ignores .spfx-scaffold.jsonl in example.
examples/extension-application-customizer/.gitignore Ignores .spfx-scaffold.jsonl in example.
examples/ace-search-card/.gitignore Ignores .spfx-scaffold.jsonl in example.
examples/ace-generic-primarytext-card/.gitignore Ignores .spfx-scaffold.jsonl in example.
examples/ace-generic-image-card/.gitignore Ignores .spfx-scaffold.jsonl in example.
examples/ace-generic-card/.gitignore Ignores .spfx-scaffold.jsonl in example.
examples/ace-data-visualization/.gitignore Ignores .spfx-scaffold.jsonl in example.
CONTRIBUTING.md Adds link to branching/release strategy doc.
common/docs/template-style-guide.md Updates docs to reflect built-in context source-of-truth.
common/docs/spfx-cli-architecture.md Documents .spfx-scaffold.jsonl behavior and package-manager override logic.
common/docs/branching-and-release-strategy.md Adds new branching/release strategy documentation.
common/config/rush/repo-state.json Updates Rush repo state hash.
common/config/rush/pnpm-lock.yaml Updates lockfile to reflect dependency moves/additions.
common/config/azure-pipelines/spfx-esrp-publish.yaml Switches pipeline to new emit-github-vars action.
common/config/azure-pipelines/bump-versions.yaml Splits pipeline step into emit-github-vars + tag-build and updates output wiring.
common/changes/@microsoft/spfx-cli/scaffold-log_2026-03-27.json Adds change record (type none).
common/changes/@microsoft/spfx-cli/replace-contextschema-with-parameters_2026-04-01.json Adds change record (type none).
common/changes/@microsoft/spfx-cli/ghe-support_2026-03-31.json Adds change record (type none).
common/changes/@microsoft/spfx-cli/fix-crlf-gitattributes_2026-03-30.json Adds change record (type none).
common/changes/@microsoft/spfx-cli/coding-standards-renames_2026-04-01.json Adds change record (type none).
common/changes/@microsoft/spfx-cli/audit-log-package-manager-restriction_2026-04-01.json Adds change record (type none).
CLAUDE.md Adds/expands repository coding standards and contributor guidance.
apps/spfx-cli/src/utilities/github.ts Exposes GITHUB_TOKEN env var constant and refines comment wording.
apps/spfx-cli/src/cli/test/snapshots/CommandLineHelp.test.ts.snap Updates CLI help snapshots to include --github-token.
apps/spfx-cli/src/cli/actions/tests/ListTemplatesAction.test.ts Updates tests for GitHub token passthrough and new PublicGitHubRepositorySource signature.
apps/spfx-cli/src/cli/actions/tests/CreateAction.test.ts Expands mocks/tests for token passthrough + scaffold log package-manager restriction logic.
apps/spfx-cli/src/cli/actions/tests/snapshots/CreateAction.test.ts.snap Adds/updates snapshots for new CreateAction behaviors.
apps/spfx-cli/src/cli/actions/SPFxActionBase.ts Adds shared --github-token parameter and passes token to GitHub template sources.
apps/spfx-cli/README.md Documents --package-manager existing-project behavior + GITHUB_TOKEN usage.
apps/spfx-cli/package.json Removes lodash/uuid dependencies (moved/unused in CLI).
api/spfx-template-api/src/writing/test/SPFxTemplateWriter.test.ts Adds scaffold-log integration tests and snapshots.
api/spfx-template-api/src/writing/test/SPFxTemplateWriter.integration.test.ts Reformats file (line-ending normalization); integration tests remain.
api/spfx-template-api/src/writing/test/snapshots/SPFxTemplateWriter.test.ts.snap Adds snapshots for scaffold-log file-write event recording.
api/spfx-template-api/src/writing/SPFxTemplateWriter.ts Adds optional write options with scaffold log emission of file-write outcomes.
api/spfx-template-api/src/writing/index.ts Exports IWriteOptions alongside SPFxTemplateWriter.
api/spfx-template-api/src/templating/test/SPFxBuiltInContext.test.ts Adds tests for buildBuiltInContext behavior (UUIDs, CI mode, etc.).
api/spfx-template-api/src/templating/SPFxTemplateJsonFile.ts Removes contextSchema field/getter and schema validation for it.
api/spfx-template-api/src/templating/SPFxTemplate.ts Removes contextSchema validation and changes renderAsync typing.
api/spfx-template-api/src/templating/SPFxBuiltInContext.ts Adds built-in context computation + CI-mode deterministic GUID support.
api/spfx-template-api/src/templating/index.ts Exports built-in context helpers/types.
api/spfx-template-api/src/repositories/test/PublicGitHubRepositorySource.test.ts Adds coverage for token support + GHE host parsing/download URL behavior.
api/spfx-template-api/src/repositories/test/snapshots/PublicGitHubRepositorySource.test.ts.snap Updates snapshots for new tests and renamed private helpers.
api/spfx-template-api/src/repositories/PublicGitHubRepositorySource.ts Adds GHE support + optional token Authorization header.
api/spfx-template-api/src/logging/test/SPFxScaffoldLog.test.ts Adds comprehensive tests for scaffold log JSONL persistence and helpers.
api/spfx-template-api/src/logging/SPFxScaffoldLog.ts Adds scaffold log implementation with JSONL serialization/persistence.
api/spfx-template-api/src/logging/SPFxScaffoldEvent.ts Adds discriminated union of scaffold event types.
api/spfx-template-api/src/logging/index.ts Exports scaffold log/event types.
api/spfx-template-api/src/index.ts Re-exports new templating + logging APIs and write options.
api/spfx-template-api/README.md Updates examples/docs for built-in context, GitHub token, and scaffold log usage.
api/spfx-template-api/package.json Adds uuid dependency to support CI-mode deterministic GUIDs.
api/spfx-template-api/etc/spfx-template-api.api.md Updates API Extractor report for new exports and signature changes.
.gitattributes Forces LF (eol=lf) normalization.

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

@iclanton iclanton changed the title Add .spfx-scaffold.jsonl to .gitignore in all templates and examples Add .spfx-scaffold.jsonl to .gitignore in all templates, examples, and test fixtures Apr 3, 2026
iclanton added a commit that referenced this pull request Apr 6, 2026
## Description

Replaces the `lastPackageManager` getter on `SPFxScaffoldLog` with a
cleaner mechanism: the selected package manager is now written directly
into the project's `package.json` `"engines"` field after a successful
install, and read back from there on subsequent `spfx create` runs.

**New in `@microsoft/spfx-template-api`**
(`PackageManagerEnginesHelper`):
- `tryReadPackageManagerFromPackageJsonEnginesAsync` — reads the package
manager from `engines`; throws if multiple known package managers are
found (e.g. both `npm` and `pnpm` are listed, which is a
misconfiguration).
- `writePackageManagerToPackageJsonEnginesAsync` — spawns `pm --version`
asynchronously, parses the major version, and writes `"pnpm": ">=10"`
(or equivalent) into `engines`.
- Exports `VALID_PACKAGE_MANAGERS` (as a `const` tuple) and
`PackageManager` type alias.

**Changes to `CreateAction`**:
- Reads the previous package manager from `package.json` engines instead
of from the scaffold log.
- Calls `writePackageManagerToPackageJsonEnginesAsync` after a
successful install.

**Depends on** #227 (adds `.spfx-scaffold.jsonl` to `.gitignore` in all
templates/examples).

## How was this tested

- Unit tests added for both new helpers in
`PackageManagerEnginesHelper.test.ts` covering: ENOENT, missing engines,
each supported pm, multiple-pm conflict error, version detection,
engines write, and all warning/skip paths.
- Existing `CreateAction` tests updated to mock the new API functions;
snapshots regenerated.

## Type of change

- [ ] Bug fix
- [x] New feature
- [ ] Template change (modifies template files or examples)
- [ ] Docs / CI change only

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
@iclanton iclanton merged commit 45d5e53 into SharePoint:main Apr 6, 2026
4 checks passed
@iclanton iclanton mentioned this pull request Apr 6, 2026
4 tasks
iclanton added a commit that referenced this pull request Apr 6, 2026
## Description

Replaces the `lastPackageManager` getter on `SPFxScaffoldLog` with a
cleaner mechanism: the selected package manager is now written directly
into the project's `package.json` `"engines"` field after a successful
install, and read back from there on subsequent `spfx create` runs.

**New in `@microsoft/spfx-template-api`**
(`PackageManagerEnginesHelper`):
- `tryReadPackageManagerFromPackageJsonEnginesAsync` — reads the package
manager from `engines`; throws if multiple known package managers are
found (e.g. both `npm` and `pnpm` are listed, which is a
misconfiguration).
- `writePackageManagerToPackageJsonEnginesAsync` — spawns `pm --version`
asynchronously, parses the major version, and writes `"pnpm": ">=10"`
(or equivalent) into `engines`.
- Exports `VALID_PACKAGE_MANAGERS` (as a `const` tuple) and
`PackageManager` type alias.

**Changes to `CreateAction`**:
- Reads the previous package manager from `package.json` engines instead
of from the scaffold log.
- Calls `writePackageManagerToPackageJsonEnginesAsync` after a
successful install.

**Depends on** #227 (adds `.spfx-scaffold.jsonl` to `.gitignore` in all
templates/examples).

## How was this tested

- Unit tests added for both new helpers in
`PackageManagerEnginesHelper.test.ts` covering: ENOENT, missing engines,
each supported pm, multiple-pm conflict error, version detection,
engines write, and all warning/skip paths.
- Existing `CreateAction` tests updated to mock the new API functions;
snapshots regenerated.

## Type of change

- [ ] Bug fix
- [x] New feature
- [ ] Template change (modifies template files or examples)
- [ ] Docs / CI change only

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
iclanton added a commit that referenced this pull request Apr 6, 2026
…227)

## Description

Follow-up to #221: since the scaffold now persists the log to disk as
`.spfx-scaffold.jsonl`, this PR gitignores that file in every template,
example, and test fixture so it doesn't appear as an untracked file in
generated projects.

## How was this tested

- `rushx build` in `tests/spfx-template-test` — snapshot updated to
reflect that templates now emit a `.gitignore` file (file count 1→2)

## Type of change

- [ ] Bug fix
- [ ] New feature
- [x] Template change (modifies template files or examples)
- [ ] Docs / CI change only

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
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.

3 participants