melos icon indicating copy to clipboard operation
melos copied to clipboard

request: Add publish --skip-validation

Open Lukitaduarte opened this issue 9 months ago • 7 comments

Is there an existing feature request for this?

  • [x] I have searched the existing issues.

Command

melos publish --skip-validation

Description

Enable the use of the --skip-validation argument in melos publish.

Reasoning

  • For the same reason of official dart pub publish command.
  • And for private packages that don't want to follow the same level of demand as pub.dev.

Additional context and comments

Today we have more than 50 modules within our project and more than 6 apps. All of them are managed by melos (we are grateful for that). We recently acquired a OnePub plan to help us manage the internal versions of these modules. However, since all our control was done via git, we have a policy of locking the exact version of the packages we use (we do not use ^). The problem is: the OnePub publishing command considers the use of ^ a warning, unlike melos/dart which considers it an error. Therefore, we cannot use the melos publish command due to this restriction, which would be easily circumvented if melos exposed the --skip-validation and --force commands.

Other

  • [x] I'm interested in working on a PR for this.

Lukitaduarte avatar Mar 26 '25 16:03 Lukitaduarte

I think this is actually a bug report...

Run dart pub publish directly: Package has 3 warnings.. Do you want to publish my_package 1.0.2 to https://onepub.dev/api/{API-KEY}/ (y/N)?

Run with melos publish --no-private:

ERROR: Package validation found the following potential issues:
* 1 checked-in file is modified in git.
  
  Usually you want to publish from a clean git state.
  
  Consider committing these files or reverting the changes.
  
  Modified files:
  
  pubspec.yaml
  
  Run `git status` for more information.
  
* It's strongly recommended to include a "homepage" or "repository" field in your pubspec.yaml

ERROR: * Your dependency on "plugin_platform_interface" should allow more than one version. For example:
  
  dependencies:
    plugin_platform_interface: ^2.1.7
  
  Constraints that are too tight will make it difficult for people to use your package
  along with other packages that also depend on "plugin_platform_interface".

Package has 3 warnings.

The server may enforce additional checks.
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

$ melos exec
  â””> dart pub publish --dry-run
     â””> FAILED (in 1 packages)
        â””> my_package (with exit code 65)

Lukitaduarte avatar Mar 26 '25 16:03 Lukitaduarte

I think it's because dart pub publish doesn't detect itself being in an interactive shell since it's running in a subshell, hence it doesn't give the y/n question. So we'd indeed need to expose those flags for it to work.

spydon avatar Mar 26 '25 16:03 spydon

Should I assign you to the issue @Lukitaduarte, since you indicated that you were interested in working on it?

spydon avatar Apr 02 '25 07:04 spydon

Sure! I'll try to take a look later today (Brazilian time!) @spydon

Lukitaduarte avatar Apr 02 '25 12:04 Lukitaduarte

#93 can be related, because if that is solved this would also prompt the y/n question. @Lukitaduarte did you have any time to look into this btw?

spydon avatar Jun 18 '25 07:06 spydon

@Lukitaduarte do you still want to take on this, or should I unassign you from the issue?

spydon avatar Sep 13 '25 08:09 spydon

I'm working on implementing this feature and will submit a PR shortly.

arowolojoshuao avatar Oct 18 '25 12:10 arowolojoshuao