Skip to content

Commit

Permalink
💚 ++
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexV525 committed Nov 7, 2023
1 parent 37e6c6f commit 5d64710
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 29 deletions.
9 changes: 3 additions & 6 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,14 +43,11 @@ jobs:
- name: Check satisfied packages
run: |
dart ./scripts/melos_packages.dart
cat .melos_packages
cat .melos_ignore_packages
MELOS_IGNORE_PACKAGES=$(cat .melos_ignore_packages)
- name: Bootstrap
run: |
ls
export MELOS_PACKAGES=$(cat .melos_packages)
echo $MELOS_PACKAGES
melos bootstrap
echo $MELOS_IGNORE_PACKAGES
melos bootstrap $(eval echo $MELOS_IGNORE_PACKAGES)
- name: Format
run: melos exec $(eval cat .melos_ignore_packages) -- "dart format --set-exit-if-changed ."
- name: Analyze Dart packages
Expand Down
37 changes: 14 additions & 23 deletions scripts/melos_packages.dart
Original file line number Diff line number Diff line change
Expand Up @@ -23,29 +23,20 @@ void main() async {
final current = Version.parse(
RegExp(r'\d*\.\d*\.\d*').firstMatch(Platform.version)!.group(0)!,
);
final satisfiedPackages = packages
.map((package) {
if (package.pubSpec.environment!.sdkConstraint!.allows(current)) {
return package.name;
}
return null;
})
.whereType<String>()
.join(',');
print(satisfiedPackages);
File('$root/.melos_packages').writeAsStringSync(satisfiedPackages);
final ignoresPackages = packages
.map((package) {
if (package.pubSpec.environment!.sdkConstraint!.allows(current)) {
return null;
}
return package.name;
})
.whereType<String>()
.map((e) => '--ignore="$e"')
.join(' ');
print(ignoresPackages);
File('$root/.melos_ignore_packages').writeAsStringSync(ignoresPackages);
final satisfiedPackages = <String>[], ignoredPackages = <String>[];
for (final package in packages) {
if (package.pubSpec.environment!.sdkConstraint!.allows(current)) {
satisfiedPackages.add(package.name);
} else {
ignoredPackages.add(package.name);
}
}
File('$root/.melos_packages').writeAsStringSync(
satisfiedPackages.join(','),
);
File('$root/.melos_ignore_packages').writeAsStringSync(
ignoredPackages.map((e) => '--ignore="$e"').join(' '),
);
}

extension YamlUtils on YamlNode {
Expand Down

0 comments on commit 5d64710

Please sign in to comment.