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

Specify additional sources when creating a package #858

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

nandorsoma
Copy link
Contributor

When publishing a package, files are taken from the package root. However, additional sources, like build-generated files (e.g., .jar), may need inclusion. For instance, when publishing a UDF, metadata is stored in the root, while the UDF itself is compiled into a .jar in the target folder. Instead of using a separate script to assemble the package before publishing, it is more robust to include additional sources directly in the package.json. See an example DataSQRL/sqrl-functions#1.

@nandorsoma nandorsoma linked an issue Oct 10, 2024 that may be closed by this pull request
@mbroecheler
Copy link
Contributor

The problem you are trying to solve is having to copy-paste the jar file into the root directory before publishing, correct?
I wonder if we could solve this with an additional argument --source to the publish command that effectively does the same thing.
The downside of this solution is that you have to specify the source when you run the command.
The upside of this solution is that we don't have to include build specific information into the package manifest which should ideally only include information on what is in the package and not how the package was assembled.
WDYT @nandorsoma ?

@nandorsoma
Copy link
Contributor Author

nandorsoma commented Oct 10, 2024

The problem you are trying to solve is having to copy-paste the jar file into the root directory before publishing, correct? I wonder if we could solve this with an additional argument --source to the publish command that effectively does the same thing. The downside of this solution is that you have to specify the source when you run the command. The upside of this solution is that we don't have to include build specific information into the package manifest which should ideally only include information on what is in the package and not how the package was assembled. WDYT @nandorsoma ?

Thanks for the review, @mbroecheler!

That’s definitely an option. I personally feel that listing the sources fits within the scope of “what’s in the package.” However, I don’t have a strong preference and would be open to that approach.

What concerns me more is that the current method combines the root and the additional sources from the manifest, which feels like a patchwork solution. What do you think about using --source but making it exclusive? So, only specified files/folders would be added, and if you want the root directory plus another file, you’d specify--source "." "./target/udf.jar". If you don’t specify --source, the current behavior wouldn’t change, so the package would be made from the root folder. This could address the issue raised here.

@mbroecheler
Copy link
Contributor

How about a -s --sources option that is a list of paths which defaults to the current path (.). Then it's backwards compatible to how it currently works and you can make it work how you want by specifying different sources.

This seems the most user friendly approach since - in most cases - you just want to publish what is in the current directory. WDYT?

Copy link
Contributor

@henneberger henneberger left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See @mbroecheler comments in main conversation

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.

Specify additional sources when creating a package
3 participants