geomcli 0.5.26 → 0.5.27

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
- import { tGeomFunc, tParamVal, EFormat, tAllPageDef, tPackage } from 'geometrix';
1
+ import { tGeomFunc, tParamVal, tParamDef, EFormat, tAllPageDef, tPackage } from 'geometrix';
2
2
 
3
- declare function geom_write(iPartName: string, fgeom: tGeomFunc, simTime: number, iParam: tParamVal, iFormat: EFormat, iFace?: string, iDir?: string, iFname?: string): Promise<string>;
3
+ declare function geom_write(iPartName: string, fgeom: tGeomFunc, simTime: number, iParam: tParamVal, iPDef: tParamDef, iFormat: EFormat, iFace?: string, iDir?: string, iFname?: string): Promise<string>;
4
4
 
5
5
  /**
6
6
  * Docs for `geom_cli` function.
package/dist/index.js CHANGED
@@ -62,12 +62,12 @@ function writeParams(iPartName, idparams, oDir, oFileName) {
62
62
  const fName2 = checkDirFName(oDir, file_name);
63
63
  let rlog = `Write ${paramNb} parameters in file ${fName2}
64
64
  `;
65
- const file_content = createParamFile(datestr, idparams, "Written by geom_cli");
65
+ const file_content = createParamFile(datestr, iPartName, idparams, "Written by geom_cli");
66
66
  rlog += createDir(oDir);
67
67
  write_textFile(fName2, file_content);
68
68
  return rlog;
69
69
  }
70
- function readParams(paramPath, printLog) {
70
+ function readParams(paramPath, expectedPartName, printLog) {
71
71
  let rParamVal = {};
72
72
  if (paramPath !== "") {
73
73
  let rlog = `Read parameter file ${paramPath}
@@ -77,6 +77,13 @@ function readParams(paramPath, printLog) {
77
77
  }
78
78
  const fContentStr = fs.readFileSync(paramPath, "utf8");
79
79
  const [obj] = parseParamFile(fContentStr);
80
+ if (obj.partName !== expectedPartName) {
81
+ rlog += `warn329: file partName: '${obj.partName}' expected partName: '${expectedPartName}'
82
+ `;
83
+ } else {
84
+ rlog += `file partName: ${obj.partName}
85
+ `;
86
+ }
80
87
  rlog += `file lastModif: ${obj.lastModif}
81
88
  `;
82
89
  rlog += `file comment: ${obj.comment}
@@ -89,7 +96,7 @@ function readParams(paramPath, printLog) {
89
96
  }
90
97
  return rParamVal;
91
98
  }
92
- async function geom_write(iPartName, fgeom, simTime, iParam, iFormat, iFace = "", iDir = ".", iFname = "") {
99
+ async function geom_write(iPartName, fgeom, simTime, iParam, iPDef, iFormat, iFace = "", iDir = ".", iFname = "") {
93
100
  let rlog = "";
94
101
  const fSuffix = fileSuffix(iFormat);
95
102
  const fBin = fileBin(iFormat);
@@ -104,10 +111,10 @@ async function geom_write(iPartName, fgeom, simTime, iParam, iFormat, iFace = ""
104
111
  const fName2 = checkDirFName(iDir, fName);
105
112
  rlog += createDir(iDir);
106
113
  if (fBin) {
107
- const fContent = await fileBinContent(fgeom, simTime, iParam, iFormat);
114
+ const fContent = await fileBinContent(fgeom, simTime, iParam, iPDef, iFormat);
108
115
  rlog += await write_binFile(fName2, fContent);
109
116
  } else {
110
- const fContent = fileTextContent(fgeom, iParam, nFace, iFormat);
117
+ const fContent = fileTextContent(fgeom, iParam, iPDef, nFace, iFormat);
111
118
  rlog += write_textFile(fName2, fContent);
112
119
  }
113
120
  return rlog;
@@ -174,7 +181,7 @@ function computeGeom(dList, selD, paramPath, modif, printLog) {
174
181
  `;
175
182
  const dParam = designParam(theD.pDef);
176
183
  try {
177
- dParam.applyParamVal(readParams(paramPath, printLog));
184
+ dParam.applyParamVal(readParams(paramPath, theD.pDef.partName, printLog));
178
185
  dParam.applyParamVal(parseModif(modif, printLog));
179
186
  } catch (emsg) {
180
187
  console.log("err271: error while applying new parameters");
@@ -357,7 +364,7 @@ async function list_parameters(dList, iPath, selD, paramPath, modif) {
357
364
  `;
358
365
  const dParam = designParam(theD.pDef);
359
366
  try {
360
- dParam.applyParamVal(readParams(paramPath, true));
367
+ dParam.applyParamVal(readParams(paramPath, theD.pDef.partName, true));
361
368
  dParam.applyParamVal(parseModif(modif, true));
362
369
  } catch (emsg) {
363
370
  console.log("err272: error while applying new parameters");
@@ -614,7 +621,7 @@ async function geom_cli(iArgs, dList, appPackage, outDir = "output") {
614
621
  const oOpt = decompose_outopt(outopt);
615
622
  const dParam = designParam(theD.pDef);
616
623
  try {
617
- dParam.applyParamVal(readParams(paramPath, false));
624
+ dParam.applyParamVal(readParams(paramPath, theD.pDef.partName, false));
618
625
  dParam.applyParamVal(parseModif(paramModif, false));
619
626
  } catch (emsg) {
620
627
  console.log("err273: error while applying new parameters");
@@ -645,6 +652,7 @@ async function geom_cli(iArgs, dList, appPackage, outDir = "output") {
645
652
  theD.pGeom,
646
653
  simtime,
647
654
  dParam.getParamVal(),
655
+ theD.pDef,
648
656
  oOpt.eFormat,
649
657
  // output-format
650
658
  //EFormat.eSVG,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "geomcli",
3
- "version": "0.5.26",
3
+ "version": "0.5.27",
4
4
  "description": "the nodejs companion library of geometrix",
5
5
  "private": false,
6
6
  "repository": {
@@ -41,20 +41,20 @@
41
41
  "clean": "shx rm -fr build dist node_modules"
42
42
  },
43
43
  "dependencies": {
44
- "geometrix": "^0.5.20",
44
+ "geometrix": "^0.5.23",
45
45
  "yargs": "^17.7.2"
46
46
  },
47
47
  "devDependencies": {
48
48
  "@types/yargs": "^17.0.32",
49
49
  "@typescript-eslint/eslint-plugin": "^7.0.1",
50
50
  "@typescript-eslint/parser": "^7.0.1",
51
- "eslint": "^8.56.0",
51
+ "eslint": "^8.57.0",
52
52
  "eslint-config-prettier": "^9.1.0",
53
53
  "npm-run-all": "^4.1.5",
54
54
  "prettier": "^3.2.5",
55
55
  "shx": "^0.3.4",
56
56
  "tsup": "^8.0.2",
57
- "typescript": "^5.3.3",
57
+ "typescript": "^5.4.2",
58
58
  "vitest": "^1.3.1"
59
59
  },
60
60
  "exports": {