covenant-bridge 0.2.0 → 0.2.2
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/manifest.json +5 -1
- package/package.json +4 -3
- package/scripts/copy-addons.js +54 -0
package/manifest.json
CHANGED
package/package.json
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "covenant-bridge",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.2",
|
|
4
4
|
"description": "LinuxCNC to Eden bridge worker",
|
|
5
5
|
"main": "dist/backend.js",
|
|
6
6
|
"type": "commonjs",
|
|
7
7
|
"files": [
|
|
8
8
|
"dist",
|
|
9
|
-
"manifest.json"
|
|
9
|
+
"manifest.json",
|
|
10
|
+
"scripts"
|
|
10
11
|
],
|
|
11
12
|
"keywords": [
|
|
12
13
|
"linuxcnc",
|
|
@@ -34,7 +35,7 @@
|
|
|
34
35
|
"typescript": "^5.0.0"
|
|
35
36
|
},
|
|
36
37
|
"scripts": {
|
|
37
|
-
"copy-addons": "
|
|
38
|
+
"copy-addons": "node scripts/copy-addons.js",
|
|
38
39
|
"build": "rm -rf *.edenite && npm run copy-addons && tsup && genesis build . -o bridge.edenite",
|
|
39
40
|
"clean": "rm -rf dist build",
|
|
40
41
|
"rebuild": "npm run clean && npm run build"
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
const fs = require('fs');
|
|
2
|
+
const path = require('path');
|
|
3
|
+
|
|
4
|
+
const ADDONS = [
|
|
5
|
+
'@linuxcnc-node/core',
|
|
6
|
+
'@linuxcnc-node/gcode',
|
|
7
|
+
'@linuxcnc-node/hal'
|
|
8
|
+
];
|
|
9
|
+
|
|
10
|
+
const DEST_DIR = path.join(__dirname, '../build/Release');
|
|
11
|
+
|
|
12
|
+
// Ensure destination directory exists
|
|
13
|
+
if (!fs.existsSync(DEST_DIR)) {
|
|
14
|
+
fs.mkdirSync(DEST_DIR, { recursive: true });
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
console.log('Copying native addons...');
|
|
18
|
+
|
|
19
|
+
let copiedCount = 0;
|
|
20
|
+
|
|
21
|
+
for (const addon of ADDONS) {
|
|
22
|
+
try {
|
|
23
|
+
// Resolve package root via package.json
|
|
24
|
+
// We treat @linuxcnc-node packages as having a standard structure with build/Release
|
|
25
|
+
const pkgJsonPath = require.resolve(`${addon}/package.json`, { paths: [path.join(__dirname, '..')] });
|
|
26
|
+
const pkgDir = path.dirname(pkgJsonPath);
|
|
27
|
+
const sourceDir = path.join(pkgDir, 'build/Release');
|
|
28
|
+
|
|
29
|
+
if (!fs.existsSync(sourceDir)) {
|
|
30
|
+
console.warn(`⚠️ Source directory not found for ${addon}: ${sourceDir}`);
|
|
31
|
+
continue;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
const files = fs.readdirSync(sourceDir);
|
|
35
|
+
for (const file of files) {
|
|
36
|
+
if (file.endsWith('.node')) {
|
|
37
|
+
const srcFile = path.join(sourceDir, file);
|
|
38
|
+
const destFile = path.join(DEST_DIR, file);
|
|
39
|
+
|
|
40
|
+
fs.copyFileSync(srcFile, destFile);
|
|
41
|
+
console.log(`✅ Copied ${file} from ${addon}`);
|
|
42
|
+
copiedCount++;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
} catch (err) {
|
|
46
|
+
console.warn(`⚠️ Could not resolve or copy addons for ${addon}:`, err.message);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
if (copiedCount === 0) {
|
|
51
|
+
console.warn('⚠️ No native addons were copied. This might be fine if specific addons are not installed.');
|
|
52
|
+
} else {
|
|
53
|
+
console.log(`🎉 Successfully copied ${copiedCount} native addon(s).`);
|
|
54
|
+
}
|