@twinfinity/templates 5.0.3-ci.26252 → 6.0.0-ci.28595

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/LICENSE ADDED
@@ -0,0 +1,5 @@
1
+ Copyright 2025 Twinfinity
2
+
3
+ Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies.
4
+
5
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
@@ -3,6 +3,9 @@ import fs from 'fs/promises';
3
3
  import path from 'path';
4
4
  import handlebars from 'handlebars';
5
5
  export class ProjectCreator {
6
+ templatePath;
7
+ outputPath;
8
+ _projectName;
6
9
  constructor(templatePath, outputPath) {
7
10
  this.templatePath = templatePath;
8
11
  this.outputPath = outputPath;
@@ -1 +1 @@
1
- {"version":3,"file":"ProjectCreator.js","sourceRoot":"","sources":["../src/ProjectCreator.ts"],"names":[],"mappings":"AAAA,OAAO,QAAsB,MAAM,UAAU,CAAC;AAC9C,OAAO,EAAE,MAAM,aAAa,CAAC;AAC7B,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,UAAU,MAAM,YAAY,CAAC;AAEpC,MAAM,OAAO,cAAc;IAGvB,YACqB,YAAoB,EACpB,UAAkB;QADlB,iBAAY,GAAZ,YAAY,CAAQ;QACpB,eAAU,GAAV,UAAU,CAAQ;Q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AAC;IAEO,KAAK,CAAC,IAAI,CAAC,GAAW,EAAE,GAAW,EAAE,IAAS;QAClD,MAAM,KAAK,GAAG,MAAM,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QACjC,IAAI,KAAK,CAAC,WAAW,EAAE,EAAE,CAAC;YACtB,MAAM,EAAE,CAAC,KAAK,CAAC,GAAG,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;YACzC,KAAK,MAAM,IAAI,IAAI,MAAM,EAAE,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC;gBACvC,MAAM,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,IAAI,CAAC,EAAE,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,IAAI,CAAC,EAAE,IAAI,CAAC,CAAC;YACtE,CAAC;QACL,CAAC;aAAM,CAAC;YACJ,MAAM,WAAW,GAAG,MAAM,EAAE,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC;YAC3C,MAAM,QAAQ,GAAG,UAAU,CAAC,OAAO,CAAC,WAAW,CAAC,QAAQ,EAAE,CAAC,CAAC;YAC5D,MAAM,OAAO,GAAG,QAAQ,CAAC,IAAI,CAAC,CAAC;YAC/B,MAAM,EAAE,CAAC,SAAS,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC;QACrC,CAAC;IACL,CAAC;CACJ"}
package/package.json CHANGED
@@ -1,6 +1,10 @@
1
1
  {
2
2
  "name": "@twinfinity/templates",
3
- "packageManager": "yarn@3.2.1",
3
+ "version": "6.0.0-ci.28595",
4
+ "description": "CLI for scaffolding Twinfinity starter projects",
5
+ "author": "Twinfinity",
6
+ "license": "ISC",
7
+ "homepage": "https://docs.twinfinity.com/api/twinfinity-templates",
4
8
  "files": [
5
9
  "dist",
6
10
  "templates"
@@ -10,9 +14,10 @@
10
14
  "twinfinity-templates": "./dist/index.js"
11
15
  },
12
16
  "engines": {
13
- "node": ">=16"
17
+ "bun": ">= 1.0.0"
14
18
  },
15
19
  "scripts": {
20
+ "setVersion": "bun run ../scripts/set-version.mts twinfinity-templates",
16
21
  "build": "tsc"
17
22
  },
18
23
  "dependencies": {
@@ -23,6 +28,5 @@
23
28
  },
24
29
  "devDependencies": {
25
30
  "typescript": "^5.8.3"
26
- },
27
- "version": "5.0.3-ci.26252"
28
- }
31
+ }
32
+ }
@@ -1,21 +1,20 @@
1
- {
2
- "name": "{{projectName}}",
3
- "packageManager": "yarn@3.2.1",
4
- "private": true,
5
- "scripts": {
6
- "build": "webpack --config webpack.config.js",
7
- "serve": "webpack serve --config webpack.config.js --mode development --env development"
8
- },
9
- "dependencies": {
10
- "@twinfinity/authentication": "^4.0.0",
11
- "@twinfinity/core": "^4.0.0"
12
- },
13
- "devDependencies": {
14
- "html-webpack-plugin": "^5.6.0",
15
- "ts-loader": "^9.5.1",
16
- "typescript": "^5.3.3",
17
- "webpack": "^5.89.0",
18
- "webpack-cli": "^5.1.4",
19
- "webpack-dev-server": "^4.15.1"
20
- }
21
- }
1
+ {
2
+ "name": "{{projectName}}",
3
+ "private": true,
4
+ "scripts": {
5
+ "build": "webpack --config webpack.config.js",
6
+ "serve": "webpack serve --config webpack.config.js --mode development --env development"
7
+ },
8
+ "dependencies": {
9
+ "@twinfinity/authentication": "^6.0.0",
10
+ "@twinfinity/core": "^6.0.0"
11
+ },
12
+ "devDependencies": {
13
+ "html-webpack-plugin": "^5.6.0",
14
+ "ts-loader": "^9.5.1",
15
+ "typescript": "^5.3.3",
16
+ "webpack": "^5.89.0",
17
+ "webpack-cli": "^5.1.4",
18
+ "webpack-dev-server": "^4.15.1"
19
+ }
20
+ }
@@ -1,5 +1,5 @@
1
1
  import { TwinfinitySession } from '@twinfinity/authentication';
2
- import { BimApi, BimApiLoadOptionsFactory } from '@twinfinity/core';
2
+ import { BimApi } from '@twinfinity/core';
3
3
 
4
4
  const host = '{{twinfinityUrl}}';
5
5
  const clientId = '{{clientId}}';
@@ -16,28 +16,41 @@ async function getApi(): Promise<BimApi> {
16
16
  alert(`Twinfinity session ended: ${e.type}`);
17
17
  });
18
18
 
19
- const canvas = document.getElementById('twinfinity-viewer');
20
- if (canvas == null) {
21
- throw 'Unable find canvas for viewer';
22
- }
23
-
24
- return await BimApi.create(canvas, host, {
19
+ return await BimApi.create('twinfinity-viewer', host, {
25
20
  session: twinfinitySession
26
21
  });
27
22
  }
28
23
 
29
24
  async function main(): Promise<void> {
30
- // Find a loadable project
31
25
  const api = await getApi();
26
+
27
+ // Find a loadable project
32
28
  const containers = await api.backend.getContainers();
33
29
  const containerWithGeometry = containers.find((container) => container.hasGeometry);
34
-
35
- // Load project if found
36
- if (containerWithGeometry != null) {
37
- api.setContainer(containerWithGeometry, BimApiLoadOptionsFactory.all());
38
- } else {
30
+ if (containerWithGeometry == null) {
39
31
  console.log('No container with geometry');
32
+ return;
40
33
  }
34
+
35
+ // Select the container without implicitly loading any IFC files.
36
+ await api.setContainer(containerWithGeometry, 'skip-ifc-load');
37
+
38
+ // Fetch the list of IFC files in the container and load their hierarchies.
39
+ const ifcFiles = await api.backend.getIfcChanges(containerWithGeometry);
40
+ await api.ifc.add(ifcFiles);
41
+
42
+ // Load property sets for the IFC products.
43
+ await api.ifc.loadPropertySets();
44
+
45
+ // Frame the loaded scene with the camera before geometry starts streaming in.
46
+ api.viewer.addOrUpdateEnvironment({
47
+ boundingInfo: api.ifc.regionBoundingInfo,
48
+ positionCameraToFitBounds: true
49
+ });
50
+
51
+ // Build geometry for the loaded IFC products and add it to the viewer as each mesh is ready.
52
+ const geometryBuilder = await api.ifc.geometryBuilder();
53
+ await geometryBuilder.build(({ geometry }) => api.viewer.addOrReplaceMesh(geometry));
41
54
  }
42
55
 
43
- main();
56
+ main().catch(console.error);