yonaskolb / Mint

A package manager that installs and runs executable Swift packages
MIT License
2.3k stars 123 forks source link

Enable locking versions in `Mintfile.lock` or sth similar #263

Open bartlomiejswierad-vodeno opened 1 year ago

bartlomiejswierad-vodeno commented 1 year ago

Hi!

I have a feature request to be able to lock versions of mint packages in some file we could add to repository of a project. Currently, we tried using locking versions prepared for use in Mintfile but it does not work as expected.

Mintfile example:

realm/SwiftLint@0.52.0

Current state:

  1. after using mint bootstrap which installs the specified versions of packages
  2. running mint run swiftlint tries to use the newest version of the package instead of the one specified in the Mintfile.

Expected:

  1. mint bootstrap installs the version specified in a lock-file (or creates one if it doesn't exist yet).
  2. mint run swiftlint runs the version specified in the lock-file.
  3. We can update the locked version by calling something like mint update.
yonaskolb commented 1 year ago

The Mintfile does not auto update so essentially IS a lockfile. The issue you're running into is that mint run swiftlint is not using your mintfile for some reason. What is the Mintfile path relative to the command you run?

bartlomiejswierad-vodeno commented 1 year ago

You're right. After providing Mintfile path expicitly, it all works now. What I'm still missing are features like update or outdated to release full potential of it.

r-dent commented 1 year ago

IMHO mint run swiftlint should fail when no Mintfile could be found.

Otherwise e.g. build scripts run successfully even though the wrong (latest) version of a tool was installed, because that's the fallback.

stefanomondino commented 1 year ago

Just adding my 2cents on this... Other softwares like bundler (Gemfile) are exploring the folder structure backwards until they find their "base file". I only recently (see issue with sourcery above) found out that you have to provide Mintfile explicitly when you are running mint from a subfolder of your project.

Felt a little bit counter-intuitive to me, but I don't know if there are reasons behind this choice. it would be great if Mint could find its Mintfile "automatically".