-
Notifications
You must be signed in to change notification settings - Fork 196
Catch orphaned dist files during --check
#1209
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,9 +1,4 @@ | ||
| import { Temporal } from "@js-temporal/polyfill"; | ||
| import { | ||
| BASELINE_LOW_TO_HIGH_DURATION, | ||
| computeBaseline, | ||
| setLogger, | ||
| } from "compute-baseline"; | ||
| import { computeBaseline, setLogger } from "compute-baseline"; | ||
| import { Compat, Feature } from "compute-baseline/browser-compat-data"; | ||
| import assert from "node:assert/strict"; | ||
| import fs from "node:fs"; | ||
|
|
@@ -224,7 +219,15 @@ function main() { | |
| } | ||
| // Start from the source even if dist is given | ||
| if (filePath.endsWith(".dist")) { | ||
| filePath = filePath.substring(0, filePath.length - 5); | ||
| const candidateFilePath = filePath.substring(0, filePath.length - 5); | ||
|
|
||
| // Make sure this isn't an orphan dist file | ||
|
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe I should use a different word here? "Orphan catching" sounds truly Dickensian
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think the terminology is OK, it's not as funny as https://html.spec.whatwg.org/multipage/parsing.html#adoption-agency-algorithm, but still OK. I'll land this and rebase #1210 on top, and I suspect this comment will disappear anyway. |
||
| if (!fs.existsSync(candidateFilePath)) { | ||
| throw new Error( | ||
| `${filePath} has no corresponding ${candidateFilePath}`, | ||
| ); | ||
| } | ||
| filePath = candidateFilePath; | ||
| } | ||
| return [filePath, `${filePath}.dist`]; | ||
| }), | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh oops, my editor removed these unused imports. I can move this to a separate PR, if desired.