+4
CHANGELOG.md
+4
CHANGELOG.md
···
516
516
when part of a module select.
517
517
([Surya Rose](https://github.com/GearsDatapacks))
518
518
519
+
- Fixed a bug where the check for multiple top-level modules when publishing
520
+
would incorrectly print a warning.
521
+
([Surya Rose](https://github.com/GearsDatapacks))
522
+
519
523
## v1.9.1 - 2025-03-10
520
524
521
525
### Formatter
+8
-1
compiler-cli/src/publish.rs
+8
-1
compiler-cli/src/publish.rs
···
157
157
let mut top_level_module_names = package
158
158
.modules
159
159
.iter()
160
-
.filter_map(|module| module.name.split('/').next())
160
+
.filter_map(|module| {
161
+
// Top-level modules are those that don't contain any path separators
162
+
if module.name.contains('/') {
163
+
None
164
+
} else {
165
+
Some(module.name.clone())
166
+
}
167
+
})
161
168
.collect::<Vec<_>>();
162
169
163
170
// Remove duplicates
+4
test/multi_namespace_not_top_level/.gitignore
+4
test/multi_namespace_not_top_level/.gitignore
+4
test/multi_namespace_not_top_level/gleam.toml
+4
test/multi_namespace_not_top_level/gleam.toml
+3
test/multi_namespace_not_top_level/src/module1/sub.gleam
+3
test/multi_namespace_not_top_level/src/module1/sub.gleam
+3
test/multi_namespace_not_top_level/src/module2/sub.gleam
+3
test/multi_namespace_not_top_level/src/module2/sub.gleam
+26
test/multi_namespace_not_top_level/test.sh
+26
test/multi_namespace_not_top_level/test.sh
···
1
+
#!/bin/sh
2
+
3
+
# https://github.com/gleam-lang/gleam/pull/4445
4
+
5
+
set -eu
6
+
7
+
GLEAM_COMMAND=${GLEAM_COMMAND:-"cargo run --quiet --"}
8
+
9
+
g() {
10
+
echo "Running: $GLEAM_COMMAND $@"
11
+
$GLEAM_COMMAND "$@"
12
+
}
13
+
14
+
echo Resetting the build directory to get to a known state
15
+
rm -fr build
16
+
17
+
echo Running publish should not print the warning
18
+
output=$(yes "n" | g publish)
19
+
if echo "$output" | grep -q "Your package defines multiple top-level modules"; then
20
+
echo "Expected warning to be printed"
21
+
exit 1
22
+
fi
23
+
24
+
echo
25
+
echo Success! 💖
26
+
echo