Pub: Allow specifying a package as "not publishable"

Created on 28 Nov 2018  路  5Comments  路  Source: dart-lang/pub

_From @amirh on November 27, 2018 18:52_

Following some cases of packages being published unintentionally (e.g https://github.com/dart-lang/pub-dartlang-dart/issues/1820 )

It would be nice to have a way to specify in pubspec.yaml that a package should not be published.

@jonasfj suggested adding:

publish_to: none  # do not publish this package while under active development.

This does the job, but it also makes pub publish --dry-run fail (which at least for flutter/plugins we run on presubmit for all plugins).
Ideally I'd want to be able to run the pub publish --dry-run, have it do all the checks it is currently doing but not fail if the packages was explicitly marked unpublishable.

_Copied from original issue: dart-lang/pub-dartlang-dart#1824_

Most helpful comment

Ah ok, I don't think that is the original intended workflow for publish_to: none, but I get why you would use it for that so you have to more explicitly remove that line when you want to publish, to prevent accidental publishing.

I think probably an option to skip that check with --dry-run is the best solution.

All 5 comments

I think this issue belongs to the pub client.

The publish_to: none feature is documented in: https://www.dartlang.org/tools/pub/pubspec#publish_to

It's possible that publish_to: none, should allow dry runs...

I think the default behavior of dry runs should be identical to a real publish, ie: if it passes then a real publish should always succeed.

I could see adding a flag or something for this specific case? I don't really understand the use case though or why you would want to do a dry run for an unpublishable package. Can you explain that further?

We do dry-runs in presubmits to make sure no publishing issues are introduced by new changes.
There might be a period of time during which a package is being worked on but wasn't published to pub yet (e.g that was the case for the google_maps_flutter plugin for about 6 months).

Ah ok, I don't think that is the original intended workflow for publish_to: none, but I get why you would use it for that so you have to more explicitly remove that line when you want to publish, to prevent accidental publishing.

I think probably an option to skip that check with --dry-run is the best solution.

Was this page helpful?
0 / 5 - 0 ratings