Skip to content

Commit febd04d

Browse files
authored
melos: init at 6.2.0 (#334461)
1 parent c8ce709 commit febd04d

File tree

3 files changed

+841
-0
lines changed

3 files changed

+841
-0
lines changed
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
diff --git a/bin/melos.dart b/bin/melos.dart
2+
index 0db7013..218276f 100644
3+
--- a/bin/melos.dart
4+
+++ b/bin/melos.dart
5+
@@ -1,11 +1,37 @@
6+
+import 'dart:io';
7+
import 'package:cli_launcher/cli_launcher.dart';
8+
import 'package:melos/src/command_runner.dart';
9+
10+
-Future<void> main(List<String> arguments) async => launchExecutable(
11+
- arguments,
12+
- LaunchConfig(
13+
+Future<void> main(List<String> arguments) async {
14+
+ final melosYamlPath = findMelosYaml();
15+
+
16+
+ if (melosYamlPath == null) {
17+
+ print('Error: melos.yaml not found in the project.');
18+
+ // Handle the error as needed
19+
+ return;
20+
+ }
21+
+
22+
+ melosEntryPoint(
23+
+ arguments,
24+
+ LaunchContext(
25+
+ directory: Directory.current,
26+
+ localInstallation: ExecutableInstallation(
27+
name: ExecutableName('melos'),
28+
- launchFromSelf: false,
29+
- entrypoint: melosEntryPoint,
30+
+ isSelf: false,
31+
+ packageRoot: melosYamlPath,
32+
),
33+
- );
34+
+ ),
35+
+ );
36+
+}
37+
+
38+
+Directory? findMelosYaml() {
39+
+ var directory = Directory.current;
40+
+ while (directory.path != directory.parent.path) {
41+
+ final melosYamlPath = '${directory.path}/melos.yaml';
42+
+ if (File(melosYamlPath).existsSync()) {
43+
+ return directory;
44+
+ }
45+
+ directory = directory.parent;
46+
+ }
47+
+ return null;
48+
+}

pkgs/by-name/me/melos/package.nix

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
{
2+
lib,
3+
fetchFromGitHub,
4+
buildDartApplication,
5+
}:
6+
let
7+
pname = "melos";
8+
version = "6.2.0";
9+
src = fetchFromGitHub {
10+
owner = "invertase";
11+
repo = "melos";
12+
rev = "melos-v${version}";
13+
hash = "sha256-00K/LwrwjvO4LnXM2PDooQMJ6sXcJy9FBErtEwoMZlM=";
14+
};
15+
in
16+
buildDartApplication {
17+
inherit pname version src;
18+
19+
sourceRoot = "${src.name}/packages/melos";
20+
21+
patches = [
22+
# This patch (created a melos 6.1.0) modify the method melos use to find path to the root of the projects.
23+
# It is needed because when melos is in the nixstore, it break it and fail to find the projects root with melos.yaml
24+
./add-generic-main.patch
25+
];
26+
27+
pubspecLock = lib.importJSON ./pubspec.lock.json;
28+
29+
# hard code the path to the melos templates
30+
preBuild = ''
31+
substituteInPlace lib/src/common/utils.dart --replace-fail "final melosPackageFileUri = await Isolate.resolvePackageUri(melosPackageUri);" "return \"$out\";"
32+
substituteInPlace lib/src/common/utils.dart --replace-fail "return p.normalize('\''${melosPackageFileUri!.toFilePath()}/../..');" " "
33+
mkdir -p $out
34+
cp -r templates $out/
35+
'';
36+
37+
meta = {
38+
homepage = "https://github.com/invertase/melos";
39+
description = "A tool for managing Dart projects with multiple packages. With IntelliJ and Vscode IDE support. Supports automated versioning, changelogs & publishing via Conventional Commits. ";
40+
mainProgram = "melos";
41+
license = lib.licenses.asl20;
42+
maintainers = [ lib.maintainers.eymeric ];
43+
};
44+
}

0 commit comments

Comments
 (0)