@intelligentgraphics/ig.gfx.packager 3.0.4 → 3.0.5

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/readme.md CHANGED
@@ -294,35 +294,89 @@ The path specified after the media:// schema will be resolved within a directory
294
294
 
295
295
  ### \_Index.json generation
296
296
 
297
- The packager has a cli command `generateIndex [directory]`, it will generate an \_Index.json file for Evaluator packages.
298
- The ts files have to adhere to a certain form to be processed.
299
-
300
- 1. The namespace/module name has to have two parts like: `namespace IG.Test`
301
- 2. The evaluator class has to extend the base evaluator class IEvaluator from IGX.Eval
302
- 3. The parameters have the following JSDoc structure
303
- ```javascript
304
- /** Symbolische Angabe der Korpusbreite in der Form "W100"
305
- * Wird in der abgeleitet Klasse kontextbezogen in den Realwert Width gemapped.
306
- * @default "W50"
307
- * @creatorType String
308
- * @summary Symbolische Angabe der Korpusbreite
309
- */
310
- Corpus_Width: string;
311
- ```
312
- which results in the following
313
- ```
314
- {
315
- "Name": "Corpus_Width",
316
- "Description": "Symbolische Angabe der Korpusbreite",
317
- "Type": "String",
318
- "Default": "W50",
319
- "DisplayIndex": 1
320
- }
321
- ```
322
- 4. `DisplayIndex` is generated from the order of the parameters
323
- 5. Jsdoc for the Evaluator has to be above class
324
- 6. Parameter and Package name length need to be <=45
325
- 7. Description is cut off after 99 characters
297
+ The packager has a cli command `npm run generateIndex [directory]` to generate an \_Index.json file for an Evaluator package.
298
+
299
+ You may need to register this command in the package.json of your git repository by adding the following attribute to the scripts object:
300
+
301
+ ```json
302
+ "scripts": {
303
+ "generateIndex": "packager generateIndex"
304
+ },
305
+ ```
306
+
307
+ This command collects all classes that either implement or extend the IEvaluator class from IGX.Eval, collects the properties of their parameters
308
+ and generates the \_Index.json file based on JSDoc informations for the properties and the class.
309
+
310
+ The following jsdoc attributes are supported:
311
+
312
+ - _default_ -> the default value
313
+ - _creatorType_ -> to define the type (like Material, String, Geometry)
314
+ - _summary_ -> to set a short description for the parameter. By default the generator will use the text above the attributes as the description.
315
+
316
+ **Example:**
317
+
318
+ ```ts
319
+ namespace IG.Test {
320
+ interface Params {
321
+ /**
322
+ * Width of the corpus.
323
+ *
324
+ * Additional informations used to document the property internally
325
+ *
326
+ * @default 1.0
327
+ * @creatorType Float
328
+ * @summary Width of the corpus
329
+ */
330
+ Corpus_Width?: number | string;
331
+
332
+ /**
333
+ * Type of the corpus
334
+ *
335
+ * @default "extra_wide"
336
+ * @creatorType String
337
+ */
338
+ Corpus_Type?: string;
339
+ }
340
+
341
+ /**
342
+ * The description of my evaluator
343
+ */
344
+ export class MyEvaluator extends IGX.IEvaluator {
345
+ public static Create(
346
+ productId: string,
347
+ path: string,
348
+ parameters: Params,
349
+ ): IGX.EvalResponse {}
350
+ }
351
+ }
352
+ ```
353
+
354
+ The code snippet above will generate the following \_Index.json output:
355
+
356
+ ```json
357
+ [
358
+ {
359
+ "Name": "IG.Test.MyEvaluator",
360
+ "Description": "The description of my evaluator",
361
+ "Type": "Evaluator",
362
+ "Parameters": [
363
+ {
364
+ "Name": "Corpus_Width",
365
+ "Description": "Symbolische Angabe der Korpusbreite",
366
+ "Default": "W50",
367
+ "Type": "String",
368
+ "DisplayIndex": 1
369
+ }
370
+ ]
371
+ }
372
+ ]
373
+ ```
374
+
375
+ **Migrating from a handwritten \_Index.json to an auto generated one:**
376
+
377
+ 1. Make sure all Evaluators implement or extend the IGX.IEvaluator class.
378
+ 2. Run the index generation. The output should be nearly identical. If an evaluator does not have an explicit Parameter type, the generator will reuse the informations from an existing \_Index.json file.
379
+ 3. Now you can choose to add the parameter types either incrementally or all at once.
326
380
 
327
381
  ## Troubleshoot
328
382
 
@@ -333,6 +387,14 @@ Afterwards you may need to reload your editor in order for the installed files t
333
387
 
334
388
  ## History
335
389
 
390
+ **IG.GFX.Packager 3.0.5**
391
+
392
+ - update documentation for generateIndex command
393
+ - enforce better property order for parameters
394
+ - improve index generation
395
+ - use typechecker for index generation to improve reliability
396
+ - reuse parameters of existing \_index.json when no parameters are defined for an evaluator
397
+
336
398
  **IG.GFX.Packager 3.0.4**
337
399
 
338
400
  - start a troubleshoot section