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

Publish an ignored file to Pub #2222

Closed
dmdashenkov opened this issue Oct 7, 2019 · 4 comments · Fixed by #2787
Closed

Publish an ignored file to Pub #2222

dmdashenkov opened this issue Oct 7, 2019 · 4 comments · Fixed by #2787
Labels
type-enhancement A request for a change that isn't a bug

Comments

@dmdashenkov
Copy link

I'm trying to publish my first Pub package.

The doc states that the files under .gitignore are not published.

My question is: is there a way to work around the .gitignore and publish the files which are not on Git?

Background: I'm working with code generation and generating Dart from Protobuf. It's not ideal to store generated sources in Git (it looks ugly and distorts the viewers from the real source code which implements some logic).

I can always copy the required files into a separate directory and publish from there instead. However, it'be nice to avoid that.

However, the coupling between Git and Pub seems a bit odd. I'm sure that a reverse situation (when something is on Git and should now be published to Pub) is even more common.

@jonasfj jonasfj added the type-enhancement A request for a change that isn't a bug label Oct 14, 2019
@jonasfj
Copy link
Member

jonasfj commented Oct 14, 2019

There is no workaround at this point. My suggestion would be to check the generated code into source control.

It's ugly, but it also means that you only have to re-generate the files when the input change. It makes it easier for new developers joining your project.

That said, this is something we could solve with a .pubignore file or an ignores section in pubspec.yaml which overrides the behavior of .gitignore. But I have mixed feelings about that.

@dmdashenkov
Copy link
Author

@jonasfj, thanks for the suggestion.

For now, I'll stick to the workaround of copying the required source files into a separate directory and publishing from there. With a little scripting, it's a pretty robust approach.

Though, if this feature is implemented in future, I will most certainly use it.

@natebosch
Copy link
Member

Note that within the Dart team we always track all published files in git. We also tag commits with the version number when we publish. This means that we can visit the git repo and see exactly what is published for a given version without downloading the archiver from pub to see the source files.

@jonasfj
Copy link
Member

jonasfj commented Oct 14, 2019

@natebosch, yeah, I think that's a good answer to this problem.
Probably we could even score packages that match a tag in github higher, though we'd need to solve mono-repo resolution in the process :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type-enhancement A request for a change that isn't a bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants