Skip to content

Commit 91a322b

Browse files
nojafcknitt
andauthored
Detect package name mismatch (#7604)
* Detect package name mismatch * Add test project * Update warning message * Add changelog * Fix rewatch tests * Revert test * Revert snapshots --------- Co-authored-by: Christoph Knittel <[email protected]>
1 parent d2ef907 commit 91a322b

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,10 @@
2020

2121
- Remove uncurried handling from rewatch. https://github.com/rescript-lang/rescript/pull/7625
2222

23+
#### :nail_care: Polish
24+
25+
- Add a warning if the name in package.json does not match the name in rescript.json. https://github.com/rescript-lang/rescript/pull/7604
26+
2327
# 12.0.0-alpha.15
2428

2529
#### :boom: Breaking Change

rewatch/src/build/packages.rs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -427,6 +427,17 @@ fn make_package(config: config::Config, package_path: &Path, is_pinned_dep: bool
427427
};
428428

429429
let package_name = read_package_name(package_path).expect("Could not read package name");
430+
if package_name != config.name {
431+
log::warn!(
432+
"\nPackage name mismatch for {}:\n\
433+
The package.json name is \"{}\", while the rescript.json name is \"{}\"\n\
434+
This inconsistency will cause issues with package resolution.\n",
435+
package_path.to_string_lossy(),
436+
package_name,
437+
config.name,
438+
);
439+
}
440+
430441
Package {
431442
name: package_name,
432443
config: config.to_owned(),

0 commit comments

Comments
 (0)