-
Notifications
You must be signed in to change notification settings - Fork 26
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
fix(builder): Add preset reference in source/package name #415
Conversation
☁️ Nx Cloud ReportCI is running/has finished running commands for commit 2390750. As they complete they will appear below. Click to see the status, the terminal output, and the build insights. 📂 See all runs for this branch ✅ Successfully ran 1 targetSent with 💌 from NxCloud. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
minor thoughts. maybe time to refactor package name into a real data structure/class that takes in the string and auto splits/validates it for you?
packages/builder/src/steps/import.ts
Outdated
* If a preset reference is found in the package name by default it will take preference over a defined preset. | ||
*/ | ||
if (cfg.source.includes('@')) { | ||
cfg.preset = cfg.source.slice(cfg.source.indexOf('@') + 1); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if a user specsifies both a preset in the source and a preset in the config, its probably an error, one way or the other. shouldn't we warn them about this somehow?
packages/builder/src/steps/import.ts
Outdated
* Checks for preset reference in source name, anything after the '@' references a preset. | ||
* If a preset reference is found in the package name by default it will take preference over a defined preset. | ||
*/ | ||
if (config.source.includes('@')) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
might make sense to turn the package name into a proper data structure at this point, rather than having this splitting/math happening all over the place
/** | ||
* Used to format any reference to a cannon package and split it into it's core parts | ||
*/ | ||
export class PackageReference implements CannonPackageReference { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@dbeal-eth I added this package reference class and added it to provision and import steps for parsing out name, version and preset from package sources.
No description provided.