Make getTranscripts cross-platform (remove Unix find dependency)#6
Open
jkarthid wants to merge 1 commit into
Open
Make getTranscripts cross-platform (remove Unix find dependency)#6jkarthid wants to merge 1 commit into
jkarthid wants to merge 1 commit into
Conversation
format.js discovered transcripts via `find **/*.md`, which fails on Windows (find is a text-search tool there) and relied on sh glob semantics. Replace it with a pure-Node fs.readdir walk that collects transcripts one directory deep, skipping hidden/node_modules/scripts folders. Also add assertions to the previously empty getTranscripts test.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What & why
npm run formatis currently broken on Windows.scripts/format.jsdiscovered transcripts by shelling out to a Unix file finder:On Windows,
findis a text-search utility (not a file finder), so it fails immediately:It also implicitly depended on
shglob semantics (where**collapses to*, matching only*/*.md— one directory deep), which is fragile and shell-dependent.Changes
findsubprocess with a pure-Nodefs.readdirwalk ingetTranscripts(). It reads each top-level podcast directory and collects its.mdfiles, skipping hidden /node_modules/scriptsfolders.util+child_processimports; addpath.getTranscriptstest (it had a// TODOand zero assertions) with checks that it returns a non-empty list of one-level-deep.mdpaths.Behavior
Faithful to the original "one directory deep" matching, so root files like
README.mdare still never touched. Verified locally:getTranscripts()returns 2005 transcripts, all.md, none at the repo root.Testing
npm run format:test→ 15/15 tests pass (including the new assertions). The fix makesnpm run formatrunnable on Windows, macOS, and Linux without relying on any external command.