Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR refactors the weak-node-api generator script to improve code organization and maintainability by replacing array-join string concatenation with template literals and extracting reusable functions.
Key Changes:
- Refactored string generation to use template literals instead of array.join() for better readability
- Extracted
generateFile,generateFunctionDecl, andgenerateFunctionImplhelper functions to reduce code duplication - Added test-related npm scripts for CMake-based testing
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| packages/weak-node-api/scripts/generate-weak-node-api.ts | Refactored generator to use template literals and extracted helper functions for file generation, function declarations, and implementations |
| packages/weak-node-api/package.json | Added three new npm scripts for configuring, building, and running CMake-based tests |
| packages/weak-node-api/.gitignore | Added /build-tests/ directory to ignored files |
packages/weak-node-api/package.json
Outdated
| "test": "tsx --test --test-reporter=@reporters/github --test-reporter-destination=stdout --test-reporter=spec --test-reporter-destination=stdout src/node/**/*.test.ts src/node/*.test.ts", | ||
| "test:configure": "cmake -S . -B build-tests -DBUILD_TESTS=ON", | ||
| "test:build": "cmake --build build-tests", | ||
| "test:run": "ctest --test-dir build --output-on-failure", |
There was a problem hiding this comment.
The test:run script references directory build but should reference build-tests to match the test:configure and test:build scripts.
Suggested change
| "test:run": "ctest --test-dir build --output-on-failure", | |
| "test:run": "ctest --test-dir build-tests --output-on-failure", |
a07e77e to
2f7c744
Compare
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.
Minor adjustments to the generator - using string templating and more function calls.