add package.json config source with numeric priority system#60
Merged
Conversation
- Add "Project Configuration (package.json)" section to configuration.md - Document allowed fields: shortCode, clientId, mrtProject, mrtOrigin, accountManagerHost - Explain security rationale for excluding sensitive fields - Update resolution priority list to include package.json as lowest priority - Document numeric priority system in extending.md - Add priority table showing ranges (< 0, 0, 1-999, 1000) - Add example showing how to set priority on custom ConfigSource
Collaborator
Author
|
bypassing as we want this in for plugin priority |
amit-kumar8-sf
pushed a commit
that referenced
this pull request
Jan 21, 2026
* package json config sourcce * docs: add package.json config source and priority system documentation - Add "Project Configuration (package.json)" section to configuration.md - Document allowed fields: shortCode, clientId, mrtProject, mrtOrigin, accountManagerHost - Explain security rationale for excluding sensitive fields - Update resolution priority list to include package.json as lowest priority - Document numeric priority system in extending.md - Add priority table showing ranges (< 0, 0, 1-999, 1000) - Add example showing how to set priority on custom ConfigSource
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.
Summary
This PR introduces a new
PackageJsonSourceconfiguration source that reads project-level defaults from theb2ckey inpackage.json, along with a numeric priority system for fine-grained control over config source ordering.Features
Package.json Configuration Source
b2ckey inpackage.jsonshortCode- SCAPI short codeclientId- OAuth client ID (for implicit login discovery)mrtProject- MRT project slugmrtOrigin- MRT API origin URLaccountManagerHost- Account Manager hostnameExample
package.json:{ "name": "my-storefront", "b2c": { "shortCode": "abc123", "clientId": "your-client-id", "mrtProject": "my-project" } }Numeric Priority System
Config sources now support numeric priorities for fine-grained ordering:
'before'→ -1'after'→ 10'before'/'after'string values continue to work (mapped to -1 and 10)priorityproperty directlyFiles Changed
Implementation
packages/b2c-tooling-sdk/src/config/types.ts- Addedpriority?: numberto ConfigSourcepackages/b2c-tooling-sdk/src/config/sources/package-json-source.ts- New sourcepackages/b2c-tooling-sdk/src/config/sources/dw-json-source.ts- Added priority = 0packages/b2c-tooling-sdk/src/config/sources/mobify-source.ts- Added priority = 0packages/b2c-tooling-sdk/src/config/resolver.ts- Sort by priority, add PackageJsonSourcepackages/b2c-tooling-sdk/src/cli/hooks.ts- Updated type for numeric prioritypackages/b2c-tooling-sdk/src/cli/base-command.ts- Map string priorities to numericTests
packages/b2c-tooling-sdk/test/config/sources.test.ts- PackageJsonSource testspackages/b2c-tooling-sdk/test/config/resolver.test.ts- Priority sorting testsDocumentation
docs/guide/configuration.md- Added package.json section, updated priority listdocs/guide/extending.md- Added numeric priority documentation