Skip to content

fix: correct package.json require path in codeMetadata (version always "Unknown")#186

Merged
jgphilpott merged 2 commits intomainfrom
copilot/fix-gcode-version-issue
Mar 13, 2026
Merged

fix: correct package.json require path in codeMetadata (version always "Unknown")#186
jgphilpott merged 2 commits intomainfrom
copilot/fix-gcode-version-issue

Conversation

Copy link
Contributor

Copilot AI commented Mar 13, 2026

; Version: in G-code metadata always emitted Unknown because the require path was resolved relative to the compiled file's location and pointed at a non-existent src/package.json.

Changes

  • src/slicer/gcode/coders.coffee — fix off-by-one directory in require path:
    # Before (resolves to src/package.json — does not exist)
    pkg = require('../../package.json')
    
    # After (resolves to root package.json)
    pkg = require('../../../package.json')
  • src/slicer/gcode/coders.test.coffee — strengthen metadata test to assert the version equals the actual pkg.version and explicitly rejects "Unknown".

🔒 GitHub Advanced Security automatically protects Copilot coding agent pull requests. You can protect all pull requests by enabling Advanced Security for your repositories. Learn more about Advanced Security.

… number

Co-authored-by: jgphilpott <4128208+jgphilpott@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix G-code metadata version display issue fix: correct package.json require path in codeMetadata (version always "Unknown") Mar 13, 2026
Copilot AI requested a review from jgphilpott March 13, 2026 06:44
@jgphilpott jgphilpott marked this pull request as ready for review March 13, 2026 06:54
Copilot AI review requested due to automatic review settings March 13, 2026 06:54
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

Fixes the require path for package.json in codeMetadata so the version string in G-code metadata resolves correctly instead of always falling back to "Unknown". Strengthens the test to assert the actual version value.

Changes:

  • Fixed the relative require path from ../../package.json to ../../../package.json in coders.coffee
  • Updated test to verify the version matches pkg.version and rejects "Unknown"
  • Minor package-lock.json churn (removed libc fields)

Reviewed changes

Copilot reviewed 2 out of 3 changed files in this pull request and generated no comments.

File Description
src/slicer/gcode/coders.coffee Fix require path to resolve root package.json
src/slicer/gcode/coders.test.coffee Assert actual version value in metadata test
package-lock.json Unrelated lockfile churn

You can also share your feedback on Copilot code review. Take the survey.

@jgphilpott jgphilpott merged commit eedb583 into main Mar 13, 2026
5 checks passed
@jgphilpott jgphilpott deleted the copilot/fix-gcode-version-issue branch March 13, 2026 07:02
Copilot AI mentioned this pull request Mar 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants