Skip to content

Commit 808fadb

Browse files
authored
fix(dart_frog_prod_server): stop assuming directory name is package name when bundling (#1253)
1 parent cde3013 commit 808fadb

File tree

3 files changed

+26
-4
lines changed

3 files changed

+26
-4
lines changed

bricks/dart_frog_prod_server/hooks/lib/src/create_external_packages_folder.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ Future<List<String>> createExternalPackagesFolder({
2929
if (!isExternal) return null;
3030

3131
return _ExternalPathDependency(
32-
name: pathResolver.basename(d.path),
32+
name: p.package(),
3333
path: path.join(projectDirectory.path, d.path),
3434
);
3535
},

bricks/dart_frog_prod_server/hooks/test/pubspec_locks.dart

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ library pubspec_locks;
66
/// * A transitive dependency.
77
/// * A direct main path dependency that is not a child of the project
88
/// directory.
9+
/// * A direct main path dependency that is not a child of the project
10+
/// directory and has a different package name than the directory name.
911
/// * A direct main dependency that is hosted.
1012
/// * A direct dev main dependency that is hosted.
1113
const fooPath = '''
@@ -25,6 +27,13 @@ packages:
2527
relative: true
2628
source: path
2729
version: "0.0.0"
30+
second_foo:
31+
dependency: "direct main"
32+
description:
33+
path: "../../foo2"
34+
relative: true
35+
source: path
36+
version: "0.0.0"
2837
mason:
2938
dependency: "direct main"
3039
description:

bricks/dart_frog_prod_server/hooks/test/src/create_external_packages_folder_test.dart

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,27 @@ void main() {
2525
},
2626
);
2727

28-
final from = path.join(projectDirectory.path, '../../foo');
29-
final to = path.join(
28+
final fooPackageDirectory =
29+
path.join(projectDirectory.path, '../../foo');
30+
final fooPackageDirectoryTarget = path.join(
3031
projectDirectory.path,
3132
'build',
3233
'.dart_frog_path_dependencies',
3334
'foo',
3435
);
35-
expect(copyCalls, ['$from -> $to']);
36+
37+
final secondFooPackageDirectory =
38+
path.join(projectDirectory.path, '../../foo2');
39+
final secondFooPackageDirectoryTarget = path.join(
40+
projectDirectory.path,
41+
'build',
42+
'.dart_frog_path_dependencies',
43+
'second_foo',
44+
);
45+
expect(copyCalls, [
46+
'$fooPackageDirectory -> $fooPackageDirectoryTarget',
47+
'$secondFooPackageDirectory -> $secondFooPackageDirectoryTarget',
48+
]);
3649
},
3750
);
3851

0 commit comments

Comments
 (0)