Skip to content

Commit eedb583

Browse files
authored
Merge pull request #186 from jgphilpott/copilot/fix-gcode-version-issue
fix: correct package.json require path in codeMetadata (version always "Unknown")
2 parents 50f630e + dc2ca77 commit eedb583

File tree

3 files changed

+5
-26
lines changed

3 files changed

+5
-26
lines changed

package-lock.json

Lines changed: 0 additions & 24 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/slicer/gcode/coders.coffee

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -892,7 +892,7 @@ module.exports =
892892

893893
try # Get package version (this will be available in the compiled context).
894894

895-
pkg = require('../../package.json')
895+
pkg = require('../../../package.json')
896896
version = pkg.version
897897

898898
catch

src/slicer/gcode/coders.test.coffee

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -380,8 +380,11 @@ describe 'G-code Generation (Coders)', ->
380380

381381
result = metadataSlicer.codeMetadata()
382382

383+
pkg = require('../../../package.json')
384+
383385
expect(result).toContain('; Generated by Polyslice')
384-
expect(result).toContain('; Version:')
386+
expect(result).toContain('; Version: ' + pkg.version)
387+
expect(result).not.toContain('; Version: Unknown')
385388
expect(result).toContain('; Timestamp:')
386389
expect(result).toContain('; Repository: https://github.com/jgphilpott/polyslice')
387390
expect(result).toContain('; Printer: Ender3')

0 commit comments

Comments
 (0)