invertase / melos

🌋 A tool for managing Dart projects with multiple packages. With IntelliJ and Vscode IDE support. Supports automated versioning, changelogs & publishing via Conventional Commits.
https://melos.invertase.dev/~melos-latest
Apache License 2.0
1.19k stars 207 forks source link

Melos bootstrap finds somewhere old dart sdk and uses it on bootstrap of specific package #278

Closed bohdan1krokhmaliuk closed 2 years ago

bohdan1krokhmaliuk commented 2 years ago

Is there an existing issue for this?

Version

1.5.2

Description

For some reason, one of the packages that I use can not be bootstrapped. For some reason during pub get on that package melos thinks that I have an old dart SDK version. Unfortunately, this issue happens only with that package and that package doesn't have anything specific that can influence it. (I have other packages that have same sdk constraints and melos can bootstrap it)

mono repo structure

-monorepo
    -plugins
        -package
        -package
        ....
    -packages
        -package
        -package
        ....
        -folder
            -package
            -package
            ...
    -projects
        -package
        -package

pubspec.yaml of that package:

name: country_code
description: Provides list of ISO 3166-1 coutry codes in enum-like class, as well as parsing and user-assigned code elements
version: 1.0.0
publish_to: none

environment:
  sdk: ">=2.12.0 <3.0.0"

dev_dependencies:
  pedantic: ^1.11.0
  test: ^1.17.4

melos.yaml

name: elopage_mobile

ignore:
  - plugins/**/example

packages:
  - plugins/**
  - packages/**
  - projects/**

command:
  version:
    branch: master

P.S. btw ignore in melos.yaml doesn't work as well probably my bad

Steps to reproduce

I cannot give access to a private project to reproduce it unfortunately, however I hope that smd already resolved such issues.

Expected behavior

melos should bootstrap all the packages

Screenshots

execution when melos bootsrap with that specific package repo included inside of the packages

image

execution when melos bootsrap without that specific package repo included inside of the packages

image

flutter/dart/melos version:

image

Additional context and comments

I hope this is stupid error on my side and you already know how to help me. Thanks in advance!

blaugold commented 2 years ago

I think you need one more * at the end of your ignore glob pattern:

ignore:
  - plugins/**/example/*

Regarding the main issue: Is country_code the only pure Dart package in the repository? Melos uses flutter pub get to bootstrap Flutter packages and dart pub get to bootstrap pure Dart packages. If you have an older Dart SDK in your path that shadows the Dart SDK shipped with Flutter that could cause this type of issue.

What do you get when executing which flutter and which dart in the terminal?

bohdan1krokhmaliuk commented 2 years ago

@blaugold thanks ignore worked yes country_code is the only one package which shows this issue. these are commands you asked for

image
blaugold commented 2 years ago

Hm, that looks fine.

There definitely seems to be an older Dart SDK available on your PATH that melos somehow picks up. I'd try to find and uninstall that, if you don't need it.

Can you run which -a dart and melos exec --no-flutter -- which -a dart for me?

bohdan1krokhmaliuk commented 2 years ago

which command

image

melos command

image

yes that outdated version is located in usr/local/bin shall I simply delete it? or there is a proper way to do so?

blaugold commented 2 years ago

If you installed the Dart SDK with a package manager, it would be best to use it to remove the Dart SDK. In case you don't remember, brew uninstall dart might be worth a try. If that does not work, I'd simply delete it.

bohdan1krokhmaliuk commented 2 years ago

@blaugold Thanks!