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

feat: allow bundle to take multiple inputs to take advantage of bash's wildcard #483

Open
wants to merge 11 commits into
base: master
Choose a base branch
from

Conversation

luanpotter
Copy link

@luanpotter luanpotter commented Jul 30, 2022

Status

READY FOR REVIEW

Description

Right now, if you provide more than one file for mason bundle, it will only look at the first file. That is because the implementation is only considering the .first element of the rest array, instead of all.

That means that you can't leverage the wildcard operator in bash; for example:

mason bundle bricks/* -t dart -o lib/templates/bricks/

Will only generate the first bundle:

image

That makes it hard to automate build scripts, as it would require an actual bash script for loop to bundle all files.

Type of Change

  • ✨ New feature (non-breaking change which adds functionality)
  • 🛠️ Bug fix (non-breaking change which fixes an issue)
  • ❌ Breaking change (fix or feature that would cause existing functionality to change)
  • 🧹 Code refactor
  • ✅ Build configuration change
  • 📝 Documentation
  • 🗑️ Chore

@felangel felangel added the enhancement New feature or request label Jul 31, 2022
@luanpotter luanpotter marked this pull request as ready for review February 6, 2023 02:51
@felangel felangel changed the title feat: Allow bundle to take multiple inputs to take advantage of bash's wildcard feat: allow bundle to take multiple inputs to take advantage of bash's wildcard Feb 10, 2023
@luanpotter luanpotter requested review from erickzanardo and wolfenrain and removed request for wolfenrain and erickzanardo February 20, 2023 18:05
@luanpotter luanpotter requested review from wolfenrain and erickzanardo and removed request for wolfenrain and erickzanardo February 20, 2023 18:10
@felangel
Copy link
Owner

@luanpotter I took a closer look at the changes and I'm a bit uncertain about merging these changes because the approach doesn't appear to work well in cases where you want to bundle multiple bricks from different sources. For example, how would you be able to bundle multiple bricks from git urls? I'd love to align on an API that supports bundling from multiple sources (e.g. bundling multiple bricks from git, path, and registry sources). Let me know what you think and thanks again for the PR 👍

@luanpotter
Copy link
Author

hi @felangel, thanks for the response. it does allows for multiple bricks of any source, but only one source at a time. So you can bundle multiple bricks from git url, as long as they are all git.
I thought that was fine because if you do want to bundle from multiple sources you can call the command up to 3 times, since the # of sources is very low cardinality. it is more problematic if you want to bundle say 100s of bricks, but with this you will always be able to group into at most 3 commands (or less). also the main advantage I was seeking was to be able to leverage bash's wildcard operator, that only works for files, so I didn't even consider this being used for other sources.
that being said, I can definitely change to support multiple different sources on the same command, but not sure how that API would look like, do you have any preference?
happy to change this to follow whichever syntax you think fits best :)

@felangel
Copy link
Owner

hi @felangel, thanks for the response. it does allows for multiple bricks of any source, but only one source at a time. So you can bundle multiple bricks from git url, as long as they are all git. I thought that was fine because if you do want to bundle from multiple sources you can call the command up to 3 times, since the # of sources is very low cardinality. it is more problematic if you want to bundle say 100s of bricks, but with this you will always be able to group into at most 3 commands (or less). also the main advantage I was seeking was to be able to leverage bash's wildcard operator, that only works for files, so I didn't even consider this being used for other sources. that being said, I can definitely change to support multiple different sources on the same command, but not sure how that API would look like, do you have any preference? happy to change this to follow whichever syntax you think fits best :)

Thanks for the quick response! How would the current API work with bundling multiple bricks from git?

@luanpotter
Copy link
Author

Sorry for the delay, had a busy end of the week!
Multiple input should work for all input types just the same:

mason bundle --source git url1 url2 ...

if you want, I can add a test case specifically for this case.

however, after looking deeper on how the "git" source works, I think I know what you might have been talking about -- you will need to provide the same git-path for all sources.
is that something that you think should be specified per brick?
or were you thinking of something else?

@felangel
Copy link
Owner

Sorry for the delay, had a busy end of the week! Multiple input should work for all input types just the same:

mason bundle --source git url1 url2 ...

if you want, I can add a test case specifically for this case.

however, after looking deeper on how the "git" source works, I think I know what you might have been talking about -- you will need to provide the same git-path for all sources. is that something that you think should be specified per brick? or were you thinking of something else?

The case I was thinking of is adding multiple git sources from different git-url, git-path, and git-refs. Ideally if we support multiple sources we should truly support any combination of multiple sources and not restrict it to just multiple sources from the same git-path and git-ref. Let me know what you think and thanks again!

@luanpotter
Copy link
Author

What would you think of incorporating all that information into the url?
So something like [https://github.com/felangel]/mason/blob/[master]/[bricks/bio/brick.yaml]
Instead of having to separate that into repo, ref and path
Otherwise not sure how this syntax could look like

alestiago pushed a commit to alestiago/mason that referenced this pull request Jun 9, 2023
…gel#483)

Bumps [@docusaurus/module-type-aliases](https://github.com/facebook/docusaurus/tree/HEAD/packages/docusaurus-module-type-aliases) from 2.2.0 to 2.3.0.
- [Release notes](https://github.com/facebook/docusaurus/releases)
- [Changelog](https://github.com/facebook/docusaurus/blob/main/CHANGELOG.md)
- [Commits](https://github.com/facebook/docusaurus/commits/v2.3.0/packages/docusaurus-module-type-aliases)

---
updated-dependencies:
- dependency-name: "@docusaurus/module-type-aliases"
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants