Merged
Conversation
- Remove async library dependency, replace with native async/await - Remove mv package, use native fs.promises.rename() - Update commander v2 -> v12 (latest) - Update file-type v3 -> v19 (latest) - Convert all callback-based code to async/await in: - lib/system-font.js - lib/google-font.js - lib/google-font-list.js - lib/request.js - Maintain backward compatibility with callback APIs - Use native Array methods instead of async library - Use fs.promises instead of callback-based fs - Update CLI to use new Commander API BREAKING CHANGES: - Requires Node.js 14+ for fs.promises and recursive mkdir - Commander v12 requires new Command() syntax
feat: modernize codebase with async/await and updated dependencies
- add filesystem cache (24h TTL) for Google font list - support --refresh-cache to force reload - allow batch install/download for multiple families - better error handling during lookup and install/download flows - add helper functions for parsing family lists
- drop async package usage in font list and font handling (native loops) - add explicit refresh message when using --refresh-cache - update README for caching/batch usage - misc gitignore tweak
Feat/cache batch handling
- Add Jest test framework with 127 passing tests - Add test coverage for all library modules: - cache.js (100% coverage) - noop.js (100% coverage) - google-font-list.js (93% coverage) - request.js (93% coverage) - google-font.js - system-font.js - Add jest.config.js with coverage configuration - Add test scripts: test, test:watch, test:coverage
feat: add comprehensive test suite with Jest
- Add tsconfig.json with allowJs/checkJs for type checking without compilation - Add lib/types.d.ts with shared type definitions (FontData, FontResult, etc.) - Add lib/vendor.d.ts for untyped packages (copy-paste-win32fix, node-powershell) - Annotate all lib/*.js files with JSDoc type comments - Annotate cli.js with type annotations - Add typescript and @types/node devDependencies - Add 'typecheck' npm script
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
[WIP] Address feedback on JSDoc type annotations
feat: add JSDoc type annotations and TypeScript type checking
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: tinsever <176929823+tinsever@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: tinsever <176929823+tinsever@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…es only after operation completes Co-authored-by: tinsever <176929823+tinsever@users.noreply.github.com>
Add missing semicolon for code style consistency
[WIP] WIP Address feedback from PR #23 on V3 development changes
[WIP] Address feedback from review on V3 dev PR
Fix/google font cli cleanup
Greptile's behavior is changing!From now on, if a review finishes with no comments, we will not post an additional "statistics" comment to confirm that our review found nothing to comment on. However, you can confirm that we reviewed your changes in the status check section. This feature can be toggled off in your Code Review Settings by deselecting "Create a status check for each PR". |
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.
Greptile Summary
This PR represents a major v3.0.0 release that modernizes the google-font-cli codebase with significant improvements to reliability, maintainability, and user experience.
Key Changes:
AggregateErrorfor partial failures, allowing operations to continue even when some variants fail--refresh-cacheflag and format options (--ttf,--woff2) for better CLI controlQuality Improvements:
DEFAULT_FORMAT)error.causepropertiesConfidence Score: 4/5
lib/google-font.jsfor the error handling flow with AggregateError and variant normalization logicImportant Files Changed
Sequence Diagram
sequenceDiagram participant User participant CLI participant FontList participant Cache participant GoogleFont participant SystemFont participant Request participant GWFH API User->>CLI: gfcli download "Roboto, Open Sans" CLI->>FontList: ensureFontsLoaded(refresh) alt Cache enabled and valid FontList->>Cache: readCache() Cache-->>FontList: cached fonts FontList->>FontList: populate(cached) else Cache miss or expired FontList->>Request: new Request(gwfhFontApiUrl) Request->>GWFH API: GET /api/fonts GWFH API-->>Request: font list JSON Request-->>FontList: parseRawData(data) FontList->>Cache: writeCache(fonts) end FontList-->>CLI: fonts loaded loop For each family CLI->>FontList: getFontByName(term) FontList-->>CLI: filteredList CLI->>GoogleFont: getFirst() GoogleFont-->>CLI: font instance CLI->>GoogleFont: saveAtAsync(variants, dest, format) GoogleFont->>GoogleFont: _getFileMapAsync(format) GoogleFont->>GWFH API: GET /api/fonts/{family} GWFH API-->>GoogleFont: variant URLs loop For each variant GoogleFont->>SystemFont: saveAt(url, dest, fileName) SystemFont->>SystemFont: _saveTmp(url, fileName) SystemFont->>Request: new Request(url) Request->>GWFH API: GET font file GWFH API-->>Request: font file data Request->>Request: validate MIME type Request-->>SystemFont: tmpPath SystemFont->>SystemFont: _move(tmpPath, destFolder) SystemFont-->>GoogleFont: final path end alt All variants succeed GoogleFont-->>CLI: FontResult[] else Some variants fail GoogleFont-->>CLI: throw AggregateError with partial results end end CLI->>CLI: printResult(allResults) CLI-->>User: Success message with paths