Skip to content

Commit f2f03e5

Browse files
Add version metadata in step files (#38)
* Add version metadata in step files * update
1 parent 71d6287 commit f2f03e5

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

lib/index.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ import {
4343
import { generateComponentMeshes } from "./mesh-generation"
4444
import { mergeExternalStepModels } from "./step-model-merger"
4545
import { normalizeStepNumericExponents } from "./step-text-utils"
46+
import { VERSION } from "./version"
4647

4748
export interface CircuitJsonToStepOptions {
4849
/** Board width in mm (optional if pcb_board is present) */
@@ -113,8 +114,9 @@ export async function circuitJsonToStep(
113114
const productContext = repo.add(
114115
new ProductContext("", appContext, "mechanical"),
115116
)
117+
const productDescription = `Generated by circuit-json-to-step v${VERSION}`
116118
const product = repo.add(
117-
new Product(productName, productName, "", [productContext]),
119+
new Product(productName, productName, productDescription, [productContext]),
118120
)
119121
const productDefContext = repo.add(
120122
new ProductDefinitionContext("part definition", appContext, "design"),

lib/version.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
import packageJson from "../package.json"
2+
3+
// Read version from package.json to embed in generated STEP files
4+
export const VERSION = packageJson.version

0 commit comments

Comments
 (0)