Skip to content

Conversation

@kraenhansen
Copy link
Collaborator

Minor adjustments to the generator - using string templating and more function calls.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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, and generateFunctionImpl helper 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

"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",
Copy link

Copilot AI Nov 8, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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",

Copilot uses AI. Check for mistakes.
@kraenhansen kraenhansen force-pushed the kh/weak-node-api-refactored-generator branch from a07e77e to 2f7c744 Compare November 8, 2025 21:22
@kraenhansen kraenhansen merged commit 14d6d45 into main Nov 9, 2025
11 checks passed
@kraenhansen kraenhansen deleted the kh/weak-node-api-refactored-generator branch November 9, 2025 06:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants