-
Notifications
You must be signed in to change notification settings - Fork 189
Add Flags to force login scratch To Configure Scratch Org
#760
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Conversation
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
Enable fine-grained control over scratch org features during creation by adding three new flags to the `login scratch` command: --feature: Specify individual features to enable (repeatable). Valid values are PersonAccounts, ContactsToMultipleAccounts, and FinancialServicesUser. Uses enumflag for validation with case-insensitive matching and automatic display of valid options in help text. --product: Specify product shortcuts that expand to multiple features (repeatable). Currently supports "fsc" (Financial Services Cloud) which enables PersonAccounts, ContactsToMultipleAccounts, and FinancialServicesUser. --quantity: Override default quantities for features that require them using key=value syntax (e.g., FinancialServicesUser=5). Features requiring quantities automatically receive a default of 10, enabling a streamlined UX where users can simply specify `--product fsc` without explicit quantities. Implementation details: - Added enumflag/v2 dependency for type-safe flag validation - Created ScratchFeature and ScratchProduct enum types with ID mappings - Updated expandProductsToFeatures() to handle product expansion, feature deduplication, and automatic quantity assignment - Modified ForceScratchCreateLoginAndSave() and related functions in lib/auth.go and lib/scratch.go to accept and process feature parameters - Added comprehensive unit tests covering all feature/product/quantity combinations Example usage: force login scratch --product fsc force login scratch --feature PersonAccounts --feature FinancialServicesUser force login scratch --product fsc --quantity FinancialServicesUser=20
Add StateAndCountryPicklist as a new scratch org feature option, enabling State and Country Picklists for standard address fields in scratch orgs. Reorganize help text to provide better discoverability of available features and products. Move the growing list of valid feature and product values from inline flag descriptions to the command's Long description, where each option can be documented with a descriptive explanation. Changes: - Add StateAndCountryPicklist to ScratchFeature enum and ID mapping - Update flag descriptions to reference "see command help for available features/products" - Add Long description to scratchCmd with: - Complete list of available features with explanations - Complete list of available products with explanations - Usage examples demonstrating common scenarios - Add unit tests for StateAndCountryPicklist feature: - Test standalone usage of StateAndCountryPicklist - Test mixed features including StateAndCountryPicklist The new help format scales better as more features are added, keeping flag descriptions concise while providing comprehensive documentation via --help. The enumflag validation still shows all valid values in error messages when invalid options are provided. Example output: force login scratch --feature StateAndCountryPicklist force login scratch --feature PersonAccounts --feature StateAndCountryPicklist
Enable specification of scratch org edition during creation by adding a new --edition flag to the `login scratch` command. Supports all standard and partner Salesforce editions with case-insensitive validation and automatic display of valid options. Available editions (in UpperCamelCase format): - Developer (default), Enterprise, Group, Professional - PartnerDeveloper, PartnerEnterprise, PartnerGroup, PartnerProfessional Implementation details: - Created ScratchEdition enum type with all 8 edition options - Used enumflag for type-safe validation and automatic help text generation - Updated scratch org creation chain: - Modified scratchLogin() to accept edition parameter - Updated ForceScratchCreateLoginAndSave() signature in lib/auth.go - Added CreateScratchOrgWithUserFeaturesAndEdition() in lib/scratch.go - Maintained backward compatibility by defaulting to "Developer" edition - Enhanced help documentation: - Added "Available Editions" section with descriptions - Included edition usage in examples - Kept flag description concise by referencing command help - Added unit test to verify all edition IDs are properly defined - Validation automatically shows all valid values in error messages The edition parameter is passed through to the ScratchOrgInfo object creation, allowing users to create scratch orgs with appropriate license and feature sets for their testing needs. Example usage: force login scratch --edition Enterprise --product fsc force login scratch --edition PartnerProfessional force login scratch --edition group # case-insensitive
Enable configuration of scratch org settings through a new --setting flag that deploys settings metadata after org creation. Unlike features which are passed during org creation, settings must be deployed as metadata to the scratch org after it has been created and logged into. Available settings: - enableEnhancedNotes: Enables Enhanced Notes and Tasks on Enhanced Notes
Add Communities as a scratch org feature and networksEnabled as a deployable setting. Also add communities product shortcut that enables both the Communities feature and networksEnabled setting in one command.
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.
Update
force login scratchwith new flags for features, products, editions, and settings to configure the scratch org.New flags:
--feature- Enable individual scratch org features (PersonAccounts,ContactsToMultipleAccounts,FinancialServicesUser,StateAndCountryPicklist,Communities)--product- Product shortcuts that enable multiple features/settings at once (fsc,communities)--edition- Specify scratch org edition (Developer,Enterprise,Group,Professional, and Partner variants)--quantity- Override default quantity for features likeFinancialServicesUser--setting- Deploy settings after org creation (enableEnhancedNotes,enableQuote,networksEnabled)Products:
fsc- Financial Services Cloud (enablesPersonAccounts,ContactsToMultipleAccounts,FinancialServicesUser)communities- Experience Cloud (enablesCommunitiesfeature andnetworksEnabledsetting)