@intelligentgraphics/ig.gfx.packager 3.0.16 → 3.0.18

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.
Files changed (32) hide show
  1. package/build/bin.mjs +1 -1
  2. package/build/bin.mjs.map +1 -1
  3. package/build/{cli-1ce4d998.mjs → cli-696deaaa.mjs} +32 -32
  4. package/build/cli-696deaaa.mjs.map +1 -0
  5. package/build/{dependencies-030fd607.mjs → dependencies-c1d90884.mjs} +15 -15
  6. package/build/dependencies-c1d90884.mjs.map +1 -0
  7. package/build/{generateIndex-80e7628e.mjs → generateIndex-91a81ae2.mjs} +11 -11
  8. package/build/generateIndex-91a81ae2.mjs.map +1 -0
  9. package/build/{generateParameterType-523072c2.mjs → generateParameterType-f1ed96ce.mjs} +2 -2
  10. package/build/generateParameterType-f1ed96ce.mjs.map +1 -0
  11. package/build/{index-0012fcaa.mjs → index-a4cb5079.mjs} +10 -19
  12. package/build/index-a4cb5079.mjs.map +1 -0
  13. package/build/{index-48221d57.mjs → index-b76b4221.mjs} +340 -14
  14. package/build/index-b76b4221.mjs.map +1 -0
  15. package/build/{postinstall-79673f29.mjs → postinstall-ded4cb8d.mjs} +3 -3
  16. package/build/postinstall-ded4cb8d.mjs.map +1 -0
  17. package/build/{publishNpm-bfd4eb6a.mjs → publishNpm-12d5fcd3.mjs} +4 -4
  18. package/build/publishNpm-12d5fcd3.mjs.map +1 -0
  19. package/build/{versionFile-562e5692.mjs → versionFile-f2fd2610.mjs} +12 -12
  20. package/build/versionFile-f2fd2610.mjs.map +1 -0
  21. package/lib/lib.mjs +387 -70
  22. package/package.json +4 -3
  23. package/readme.md +8 -0
  24. package/build/cli-1ce4d998.mjs.map +0 -1
  25. package/build/dependencies-030fd607.mjs.map +0 -1
  26. package/build/generateIndex-80e7628e.mjs.map +0 -1
  27. package/build/generateParameterType-523072c2.mjs.map +0 -1
  28. package/build/index-0012fcaa.mjs.map +0 -1
  29. package/build/index-48221d57.mjs.map +0 -1
  30. package/build/postinstall-79673f29.mjs.map +0 -1
  31. package/build/publishNpm-bfd4eb6a.mjs.map +0 -1
  32. package/build/versionFile-562e5692.mjs.map +0 -1
package/lib/lib.mjs CHANGED
@@ -39,15 +39,15 @@ const getNodeErrorCode = (error)=>{
39
39
  return error.code;
40
40
  }
41
41
  };
42
- /**
43
- * Permission denied: An attempt was made to access a file in a way forbidden by its file access permissions.
44
- *
45
- * @param {unknown} error
42
+ /**
43
+ * Permission denied: An attempt was made to access a file in a way forbidden by its file access permissions.
44
+ *
45
+ * @param {unknown} error
46
46
  */ const isErrorEACCES = (error)=>getNodeErrorCode(error) === "EACCES";
47
- /**
48
- * No such file or directory: Commonly raised by fs operations to indicate that a component of the specified pathname does not exist. No entity (file or directory) could be found by the given path.
49
- *
50
- * @param {unknown} error
47
+ /**
48
+ * No such file or directory: Commonly raised by fs operations to indicate that a component of the specified pathname does not exist. No entity (file or directory) could be found by the given path.
49
+ *
50
+ * @param {unknown} error
51
51
  */ const isErrorENOENT = (error)=>getNodeErrorCode(error) === "ENOENT";
52
52
  const isErrorEPERM = (error)=>getNodeErrorCode(error) === "EPERM";
53
53
 
@@ -115,14 +115,14 @@ const readPackageAnimationList = (location)=>{
115
115
  };
116
116
  const getPackageReleasesDirectory = (location)=>path.join(location.path, "Releases");
117
117
 
118
- /**
119
- * Detects a published package from a path.
120
- *
121
- * Can return undefined if the package is not installed.
122
- *
123
- * @param {string} resolveBasePath
124
- * @param {string} name
125
- * @return {*} {(PublishedPackageLocation | undefined)}
118
+ /**
119
+ * Detects a published package from a path.
120
+ *
121
+ * Can return undefined if the package is not installed.
122
+ *
123
+ * @param {string} resolveBasePath
124
+ * @param {string} name
125
+ * @return {*} {(PublishedPackageLocation | undefined)}
126
126
  */ const detectPublishedPackageFromPath = (resolveBasePath, name)=>{
127
127
  try {
128
128
  const manifestPath = resolve.sync(name + "/package.json", {
@@ -210,11 +210,11 @@ const getWorkspaceOutputPath = (workspace)=>path.join(workspace.path, "bin");
210
210
  // }
211
211
  // return results;
212
212
  // };
213
- /**
214
- * Recursively determines all installed ig libraries for a workspace.
215
- *
216
- * @param {WorkspaceLocation} workspace
217
- * @returns {PublishedPackageLocation[]}
213
+ /**
214
+ * Recursively determines all installed ig libraries for a workspace.
215
+ *
216
+ * @param {WorkspaceLocation} workspace
217
+ * @returns {PublishedPackageLocation[]}
218
218
  */ const determineWorkspaceIGLibraries = (workspace)=>{
219
219
  const manifest = readWorkspaceNpmManifest(workspace);
220
220
  const libraries = collectIGLibraries(workspace, manifest);
@@ -277,11 +277,11 @@ const getPackageTypescriptFiles = (location)=>glob.sync("**/*.ts", {
277
277
  });
278
278
 
279
279
  const PLUGIN_ID = "0feba3a0-b6d1-11e6-9598-0800200c9a66";
280
- /**
281
- * Starts an IG.Asset.Server session and returns the sessionId
282
- *
283
- * @param {SessionStartParams} params
284
- * @returns
280
+ /**
281
+ * Starts an IG.Asset.Server session and returns the sessionId
282
+ *
283
+ * @param {SessionStartParams} params
284
+ * @returns
285
285
  */ const startSession = async ({ url , authentication , ...params })=>{
286
286
  const payload = {
287
287
  ...params,
@@ -496,16 +496,342 @@ const toposort = (packages)=>{
496
496
  return result;
497
497
  };
498
498
 
499
+ var animationSchema = {
500
+ $schema: "http://json-schema.org/draft-07/schema",
501
+ $id: "https://archive.intelligentgraphics.biz/schemas/gfx/animation.json",
502
+ $comment: "Version 2023-02-17, Source: ig.data.gfx/Specs/animation.json",
503
+ title: "Animation description format",
504
+ additionalProperties: false,
505
+ type: "object",
506
+ properties: {
507
+ $schema: {
508
+ type: "string"
509
+ },
510
+ Id: {
511
+ type: "string",
512
+ description: "Animation id, to be unique in the project scope. Needs to be a valid JavaScript identifier."
513
+ },
514
+ Animations: {
515
+ type: "array",
516
+ description: "Declaration of animation states for gfx objects",
517
+ items: {
518
+ type: "object",
519
+ additionalProperties: false,
520
+ properties: {
521
+ _: {
522
+ type: "string",
523
+ description: "Comment"
524
+ },
525
+ Path: {
526
+ $ref: "#/definitions/igxcPath"
527
+ },
528
+ States: {
529
+ type: "object",
530
+ additionalProperties: {
531
+ type: "object",
532
+ additionalProperties: false,
533
+ properties: {
534
+ Position: {
535
+ $ref: "#/definitions/vec3"
536
+ },
537
+ Rotation: {
538
+ $ref: "#/definitions/rotation"
539
+ },
540
+ Scaling: {
541
+ $ref: "#/definitions/vec3"
542
+ },
543
+ Visibility: {
544
+ type: "boolean"
545
+ },
546
+ Deformation: {
547
+ anyOf: [
548
+ {
549
+ type: "number"
550
+ },
551
+ {
552
+ type: "string"
553
+ }
554
+ ]
555
+ }
556
+ }
557
+ }
558
+ }
559
+ }
560
+ }
561
+ },
562
+ Kinematics: {
563
+ oneOf: [
564
+ {
565
+ $ref: "#/definitions/kinematicChain"
566
+ },
567
+ {
568
+ type: "array",
569
+ items: {
570
+ $ref: "#/definitions/kinematicChain"
571
+ }
572
+ }
573
+ ]
574
+ },
575
+ LinkedPoints: {
576
+ type: "object",
577
+ additionalProperties: {
578
+ type: "array",
579
+ items: {
580
+ type: "string"
581
+ }
582
+ }
583
+ },
584
+ _: {
585
+ type: "string",
586
+ description: "Comment"
587
+ }
588
+ },
589
+ definitions: {
590
+ vec3: {
591
+ type: "object",
592
+ additionalProperties: false,
593
+ properties: {
594
+ X: {
595
+ anyOf: [
596
+ {
597
+ type: "number"
598
+ },
599
+ {
600
+ type: "string"
601
+ }
602
+ ]
603
+ },
604
+ Y: {
605
+ anyOf: [
606
+ {
607
+ type: "number"
608
+ },
609
+ {
610
+ type: "string"
611
+ }
612
+ ]
613
+ },
614
+ Z: {
615
+ anyOf: [
616
+ {
617
+ type: "number"
618
+ },
619
+ {
620
+ type: "string"
621
+ }
622
+ ]
623
+ },
624
+ _: {
625
+ type: "string",
626
+ description: "Comment"
627
+ }
628
+ }
629
+ },
630
+ rotation: {
631
+ type: "object",
632
+ additionalProperties: false,
633
+ properties: {
634
+ Q: {
635
+ description: "If true, the rotation is considered to be a Quaternion. Otherwise, it's interpreted as Euler arcs and W will be ignored.",
636
+ type: "boolean"
637
+ },
638
+ X: {
639
+ anyOf: [
640
+ {
641
+ type: "number"
642
+ },
643
+ {
644
+ type: "string"
645
+ }
646
+ ]
647
+ },
648
+ Y: {
649
+ anyOf: [
650
+ {
651
+ type: "number"
652
+ },
653
+ {
654
+ type: "string"
655
+ }
656
+ ]
657
+ },
658
+ Z: {
659
+ anyOf: [
660
+ {
661
+ type: "number"
662
+ },
663
+ {
664
+ type: "string"
665
+ }
666
+ ]
667
+ },
668
+ W: {
669
+ anyOf: [
670
+ {
671
+ type: "number"
672
+ },
673
+ {
674
+ type: "string"
675
+ }
676
+ ]
677
+ },
678
+ _: {
679
+ type: "string",
680
+ description: "Comment"
681
+ }
682
+ }
683
+ },
684
+ igxcPath: {
685
+ type: "string",
686
+ description: "Relative path of the target object",
687
+ pattern: "^((o|e)\\d+(\\.(o|e)\\d+)*|\\.)$"
688
+ },
689
+ param: {
690
+ type: "string",
691
+ pattern: "^Param\\d+$"
692
+ },
693
+ kinematicChain: {
694
+ type: "object",
695
+ additionalProperties: false,
696
+ properties: {
697
+ GeometryBase: {
698
+ type: "string"
699
+ },
700
+ Joints: {
701
+ type: "array",
702
+ items: {
703
+ type: "object",
704
+ additionalProperties: false,
705
+ properties: {
706
+ Name: {
707
+ oneOf: [
708
+ {
709
+ $ref: "#/definitions/param"
710
+ },
711
+ {
712
+ type: "string"
713
+ }
714
+ ]
715
+ },
716
+ HeadX: {
717
+ oneOf: [
718
+ {
719
+ $ref: "#/definitions/param"
720
+ },
721
+ {
722
+ $ref: "#/definitions/igxcPath"
723
+ }
724
+ ]
725
+ },
726
+ HeadY: {
727
+ oneOf: [
728
+ {
729
+ $ref: "#/definitions/param"
730
+ },
731
+ {
732
+ $ref: "#/definitions/igxcPath"
733
+ }
734
+ ]
735
+ },
736
+ HeadZ: {
737
+ oneOf: [
738
+ {
739
+ $ref: "#/definitions/param"
740
+ },
741
+ {
742
+ $ref: "#/definitions/igxcPath"
743
+ }
744
+ ]
745
+ },
746
+ Tail: {
747
+ oneOf: [
748
+ {
749
+ $ref: "#/definitions/param"
750
+ },
751
+ {
752
+ $ref: "#/definitions/igxcPath"
753
+ }
754
+ ]
755
+ },
756
+ LimitLeft: {
757
+ type: "number"
758
+ },
759
+ LimitRight: {
760
+ type: "number"
761
+ },
762
+ LimitUp: {
763
+ type: "number"
764
+ },
765
+ LimitDown: {
766
+ type: "number"
767
+ },
768
+ FollowJointNode: {
769
+ $ref: "#/definitions/igxcPath"
770
+ },
771
+ _TargetNodeForFollow: {
772
+ type: "string"
773
+ }
774
+ }
775
+ }
776
+ },
777
+ Target: {
778
+ oneOf: [
779
+ {
780
+ $ref: "#/definitions/igxcPath"
781
+ },
782
+ {
783
+ $ref: "#/definitions/param"
784
+ },
785
+ {
786
+ type: "string",
787
+ enum: [
788
+ "subbase"
789
+ ]
790
+ }
791
+ ]
792
+ },
793
+ Parent: {
794
+ oneOf: [
795
+ {
796
+ $ref: "#/definitions/igxcPath"
797
+ },
798
+ {
799
+ type: "string",
800
+ enum: [
801
+ "root"
802
+ ]
803
+ }
804
+ ]
805
+ },
806
+ Tolerance: {
807
+ type: "number"
808
+ },
809
+ MaxIterations: {
810
+ type: "integer"
811
+ },
812
+ _: {
813
+ type: "string",
814
+ description: "Comment"
815
+ },
816
+ __: {
817
+ type: "string",
818
+ description: "Super Comment"
819
+ }
820
+ }
821
+ }
822
+ }
823
+ };
824
+
499
825
  let validateAnimationJson;
500
826
  const getAnimationJsonValidation = async ()=>{
501
827
  if (validateAnimationJson === undefined) {
502
- validateAnimationJson = await axios.get("https://archive.intelligentgraphics.biz/schemas/gfx/animation.json").then(({ data })=>new Ajv({
503
- coerceTypes: true,
504
- allErrors: true,
505
- removeAdditional: true,
506
- useDefaults: "empty",
507
- validateSchema: "log"
508
- }).compile(data));
828
+ validateAnimationJson = new Ajv({
829
+ coerceTypes: true,
830
+ allErrors: true,
831
+ removeAdditional: true,
832
+ useDefaults: "empty",
833
+ validateSchema: "log"
834
+ }).compile(animationSchema);
509
835
  }
510
836
  return validateAnimationJson;
511
837
  };
@@ -709,10 +1035,10 @@ const createBannerComment = (banner)=>{
709
1035
  }
710
1036
  const bannerText = bannerParts.join("\n\n");
711
1037
  if (bannerText) {
712
- return `/*
713
- ${bannerText}
714
- *
715
- * @preserve
1038
+ return `/*
1039
+ ${bannerText}
1040
+ *
1041
+ * @preserve
716
1042
  */`;
717
1043
  }
718
1044
  return undefined;
@@ -926,19 +1252,19 @@ class PackageVersion {
926
1252
  parts.push(`(${base}.${this.buildNumber})`);
927
1253
  return parts.join(" ");
928
1254
  }
929
- /**
930
- * Determines wether the version is lesser than the input version
931
- *
932
- * @param {PackageVersion} version
933
- * @returns
1255
+ /**
1256
+ * Determines wether the version is lesser than the input version
1257
+ *
1258
+ * @param {PackageVersion} version
1259
+ * @returns
934
1260
  */ isLesserThan(version) {
935
1261
  return PackageVersion.toNumber(this) < PackageVersion.toNumber(version);
936
1262
  }
937
- /**
938
- * Determines wether the version is greater than the input version
939
- *
940
- * @param {PackageVersion} version
941
- * @returns
1263
+ /**
1264
+ * Determines wether the version is greater than the input version
1265
+ *
1266
+ * @param {PackageVersion} version
1267
+ * @returns
942
1268
  */ isGreaterThan(version) {
943
1269
  return PackageVersion.toNumber(this) > PackageVersion.toNumber(version);
944
1270
  }
@@ -1094,10 +1420,10 @@ const notRuntimeScripts = [
1094
1420
  "Context",
1095
1421
  "Evaluator"
1096
1422
  ];
1097
- const buildArchiveFromPackage = async (workspaceLocation, packageLocation, data)=>{
1423
+ const buildArchiveFromPackage = async (packageLocation, data, binDir)=>{
1098
1424
  const { domain , subdomain } = parseCreatorPackageName(data);
1099
1425
  const logStep = (step)=>logPackageMessage(data.Package, step);
1100
- const libFilePath = path.join(getWorkspaceOutputPath(workspaceLocation), `${data.Package}.min.js`);
1426
+ const libFilePath = path.join(binDir, `${data.Package}.min.js`);
1101
1427
  const scriptDirectories = [
1102
1428
  packageLocation.path,
1103
1429
  packageLocation.scriptsDir
@@ -1139,7 +1465,7 @@ const buildArchiveFromPackage = async (workspaceLocation, packageLocation, data)
1139
1465
  }
1140
1466
  if (!library) {
1141
1467
  const date = new Date(Date.now());
1142
- library = `/* This file is part of the ${domain} Data Packages.
1468
+ library = `/* This file is part of the ${domain} Data Packages.
1143
1469
  * Copyright (C) ${date.getFullYear()} intelligentgraphics. All Rights Reserved. */`;
1144
1470
  }
1145
1471
  const minifyResult = await terser.minify(library, {
@@ -1211,7 +1537,7 @@ const releaseFolder = async (options)=>{
1211
1537
  cwd: workspace.path
1212
1538
  });
1213
1539
  }
1214
- const binDir = getWorkspaceOutputPath(workspace);
1540
+ const binDir = options.outDir ?? getWorkspaceOutputPath(workspace);
1215
1541
  await fs$1.mkdir(binDir, {
1216
1542
  recursive: true
1217
1543
  });
@@ -1287,7 +1613,7 @@ const releaseFolder = async (options)=>{
1287
1613
  }
1288
1614
  }
1289
1615
  }
1290
- const archive = await buildArchiveFromPackage(workspace, location, packageDescription);
1616
+ const archive = await buildArchiveFromPackage(location, packageDescription, binDir);
1291
1617
  try {
1292
1618
  const zipOutputStream = createWriteStream(zipFilePath);
1293
1619
  await pipeline(archive.generateNodeStream(), zipOutputStream);
@@ -1455,15 +1781,6 @@ const ensureRequiredVersions = async (workspaceLocation, creatorPackage, session
1455
1781
  const newVersionString = libraryVersion.toVersionString({
1456
1782
  buildNumber: true
1457
1783
  });
1458
- const packageNameWithVersion = `${libraryCreatorPackage.Package}_${newVersionString}`;
1459
- const zipFilePath = path.join(getWorkspaceOutputPath(workspaceLocation), `${packageNameWithVersion}.zip`);
1460
- try {
1461
- await fs$1.rm(zipFilePath);
1462
- } catch (err) {
1463
- if (!isErrorENOENT(err)) {
1464
- throw err;
1465
- }
1466
- }
1467
1784
  const session = uploadTargetScope === "Basics" ? await sessionManager.getBasicsSession() : targetSession;
1468
1785
  logPackageMessage(creatorPackage.Package, `Uploading package ${libraryCreatorPackage.Package} with version ${newVersionString} to ${session.domain}.${session.subDomain}`);
1469
1786
  await uploadPackageFromStream(session, {
@@ -1498,10 +1815,10 @@ const createSessionManager = async (params)=>{
1498
1815
  };
1499
1816
  };
1500
1817
 
1501
- /**
1502
- * Extracts and returns script array for _Index.json from a src folder
1503
- *
1504
- * @param folderPath path to a src folder
1818
+ /**
1819
+ * Extracts and returns script array for _Index.json from a src folder
1820
+ *
1821
+ * @param folderPath path to a src folder
1505
1822
  */ function generateIndex({ location , ignore =[] , strictOptional =false }) {
1506
1823
  const files = getPackageTypescriptFiles(location);
1507
1824
  const filtered = files.filter((path)=>{
@@ -1717,11 +2034,11 @@ const isScriptingClassParameterDeclaration = (scriptingClass, memberNode, parame
1717
2034
  }
1718
2035
  return false;
1719
2036
  };
1720
- /**
1721
- * Finds interactors and evaluators within a script file
1722
- *
1723
- * @param {ts.Node} node
1724
- * @return {*}
2037
+ /**
2038
+ * Finds interactors and evaluators within a script file
2039
+ *
2040
+ * @param {ts.Node} node
2041
+ * @return {*}
1725
2042
  */ const findScriptingClasses = (node)=>{
1726
2043
  let body;
1727
2044
  if (ts.isModuleDeclaration(node)) {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@intelligentgraphics/ig.gfx.packager",
3
- "version": "3.0.16",
4
- "description": "IG.GFX.Packager 3.0.16 (3.0.16.100)",
3
+ "version": "3.0.18",
4
+ "description": "IG.GFX.Packager 3.0.18 (3.0.18.100)",
5
5
  "author": "Michael Beier <mb@intelligentgraphics.biz>",
6
6
  "main": "lib/lib.mjs",
7
7
  "types": "lib/lib.d.ts",
@@ -62,6 +62,7 @@
62
62
  "@types/update-notifier": "^6.0.1",
63
63
  "@types/yargs": "^17.0.2",
64
64
  "rollup": "^3.10.0",
65
- "rollup-plugin-dts": "^5.3.0"
65
+ "rollup-plugin-dts": "^5.3.0",
66
+ "vitest": "^0.29.5"
66
67
  }
67
68
  }
package/readme.md CHANGED
@@ -470,6 +470,14 @@ Afterwards you may need to reload your editor in order for the installed files t
470
470
 
471
471
  ## History
472
472
 
473
+ **IG.GFX.Packager 3.0.18**
474
+
475
+ - add animation json schema to own files and no longer load it from archive
476
+
477
+ **IG.GFX.Packager 3.0.17**
478
+
479
+ - use provided bin dir
480
+
473
481
  **IG.GFX.Packager 3.0.16**
474
482
 
475
483
  - fix publishNpm for windows