@titanpl/core 2.0.9 → 2.1.0

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/configure.js CHANGED
@@ -1,50 +1,50 @@
1
- import { readFileSync, existsSync, writeFileSync } from 'fs';
2
- import { resolve, dirname } from 'path';
3
- import { fileURLToPath } from 'url';
4
- import { platform as _platform } from 'os';
5
- import { spawnSync } from 'child_process';
6
-
7
- const __filename = fileURLToPath(import.meta.url);
8
- const __dirname = dirname(__filename);
9
- const platform = _platform();
10
- const titanConfigPath = resolve(__dirname, 'titan.json');
11
-
12
- console.log(`Configuring titan.json for platform: ${platform}`);
13
-
14
- // 1. Platform-specific output file name
15
- let libFile = "";
16
- if (platform === "win32") {
17
- libFile = "titan_core.dll";
18
- } else if (platform === "darwin") {
19
- libFile = "libtitan_core.dylib";
20
- } else {
21
- libFile = "libtitan_core.so";
22
- }
23
-
24
- const nativeDir = resolve(__dirname, "native");
25
- const expectedBinary = resolve(nativeDir, "target/release", libFile);
26
-
27
- // 2. Build if binary missing
28
- if (!existsSync(expectedBinary)) {
29
- console.log(`Native binary missing.`);
30
- }
31
-
32
- // 3. Update titan.json
33
- try {
34
- const content = readFileSync(titanConfigPath, "utf8");
35
- const titanConfig = JSON.parse(content);
36
-
37
- const relativeLibPath = `native/target/release/${libFile}`;
38
-
39
- if (!titanConfig.native) {
40
- titanConfig.native = {};
41
- }
42
-
43
- titanConfig.native.path = relativeLibPath;
44
-
45
- writeFileSync(titanConfigPath, JSON.stringify(titanConfig, null, 2));
46
- console.log(`Updated titan.json to use native binary: ${relativeLibPath}`);
47
- } catch (error) {
48
- console.error("Error updating titan.json:", error);
49
- process.exit(1);
50
- }
1
+ import { readFileSync, existsSync, writeFileSync } from 'fs';
2
+ import { resolve, dirname } from 'path';
3
+ import { fileURLToPath } from 'url';
4
+ import { platform as _platform } from 'os';
5
+ import { spawnSync } from 'child_process';
6
+
7
+ const __filename = fileURLToPath(import.meta.url);
8
+ const __dirname = dirname(__filename);
9
+ const platform = _platform();
10
+ const titanConfigPath = resolve(__dirname, 'titan.json');
11
+
12
+ console.log(`Configuring titan.json for platform: ${platform}`);
13
+
14
+ // 1. Platform-specific output file name
15
+ let libFile = "";
16
+ if (platform === "win32") {
17
+ libFile = "titan_core.dll";
18
+ } else if (platform === "darwin") {
19
+ libFile = "libtitan_core.dylib";
20
+ } else {
21
+ libFile = "libtitan_core.so";
22
+ }
23
+
24
+ const nativeDir = resolve(__dirname, "native");
25
+ const expectedBinary = resolve(nativeDir, "target/release", libFile);
26
+
27
+ // 2. Build if binary missing
28
+ if (!existsSync(expectedBinary)) {
29
+ console.log(`Native binary missing.`);
30
+ }
31
+
32
+ // 3. Update titan.json
33
+ try {
34
+ const content = readFileSync(titanConfigPath, "utf8");
35
+ const titanConfig = JSON.parse(content);
36
+
37
+ const relativeLibPath = `native/target/release/${libFile}`;
38
+
39
+ if (!titanConfig.native) {
40
+ titanConfig.native = {};
41
+ }
42
+
43
+ titanConfig.native.path = relativeLibPath;
44
+
45
+ writeFileSync(titanConfigPath, JSON.stringify(titanConfig, null, 2));
46
+ console.log(`Updated titan.json to use native binary: ${relativeLibPath}`);
47
+ } catch (error) {
48
+ console.error("Error updating titan.json:", error);
49
+ process.exit(1);
50
+ }