Skip to content
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

Merged
merged 5 commits into from
Sep 11, 2023

Conversation

FuzzB0t
Copy link
Contributor

@FuzzB0t FuzzB0t commented Sep 7, 2023

No description provided.

@nx-cloud
Copy link

nx-cloud bot commented Sep 7, 2023

☁️ Nx Cloud Report

CI 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 target

Sent with 💌 from NxCloud.

Copy link
Contributor

@dbeal-eth dbeal-eth left a 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?

* 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);
Copy link
Contributor

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?

* 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('@')) {
Copy link
Contributor

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 {
Copy link
Contributor Author

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.

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.

Allow preset references in package string
2 participants