Skip to content

Commit 7f1803d

Browse files
changes in codebolt js
1 parent d0e8921 commit 7f1803d

38 files changed

+1867
-128
lines changed

package-lock.json

Lines changed: 239 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
"LICENSE"
1313
],
1414
"scripts": {
15-
"build": "tsc",
15+
"build": "tsc && node script/copy-wasm.js",
1616
"build:webpack": "webpack",
1717
"build:all": "npm run build && npm run build:webpack",
1818
"build:docs": "typedoc --plugin typedoc-plugin-missing-exports",
@@ -28,6 +28,7 @@
2828
"license": "MIT",
2929
"homepage": "https://codeboltai.github.io",
3030
"dependencies": {
31+
"@codebolt/globby": "^1.0.1",
3132
"@codebolt/types": "^1.0.10",
3233
"@modelcontextprotocol/sdk": "^1.4.1",
3334
"execa": "^9.5.2",
@@ -40,6 +41,7 @@
4041
"timers": "^0.1.1",
4142
"undici": "^7.4.0",
4243
"uri-templates": "^0.2.0",
44+
"web-tree-sitter": "^0.24.1",
4345
"ws": "^8.17.0",
4446
"yargs": "^17.7.2",
4547
"zod": "^3.24.1",

script/copy-wasm.js

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
const fs = require('fs');
2+
const path = require('path');
3+
const { execSync } = require('child_process');
4+
5+
// Define the source and destination directories
6+
const srcDir = './src';
7+
const distDir = './dist';
8+
9+
// Function to find all .wasm files
10+
function findWasmFiles(dir) {
11+
return fs.readdirSync(dir, { withFileTypes: true }).reduce((files, dirent) => {
12+
const fullPath = path.join(dir, dirent.name);
13+
if (dirent.isDirectory()) {
14+
return [...files, ...findWasmFiles(fullPath)];
15+
} else if (dirent.isFile() && dirent.name.endsWith('.wasm')) {
16+
return [...files, fullPath];
17+
}
18+
return files;
19+
}, []);
20+
}
21+
22+
// Function to copy files while preserving directory structure
23+
function copyFiles(files) {
24+
for (const file of files) {
25+
// Calculate the relative path from srcDir
26+
const relativePath = path.relative(srcDir, file);
27+
const destPath = path.join(distDir, relativePath);
28+
29+
// Create directory if it doesn't exist
30+
const destDir = path.dirname(destPath);
31+
if (!fs.existsSync(destDir)) {
32+
fs.mkdirSync(destDir, { recursive: true });
33+
}
34+
35+
// Copy the file
36+
fs.copyFileSync(file, destPath);
37+
console.log(`Copied: ${file} -> ${destPath}`);
38+
}
39+
}
40+
41+
console.log('Finding .wasm files...');
42+
const wasmFiles = findWasmFiles(srcDir);
43+
console.log(`Found ${wasmFiles.length} .wasm files`);
44+
45+
console.log('Copying files to dist directory...');
46+
copyFiles(wasmFiles);
47+
console.log('Done copying .wasm files');

0 commit comments

Comments
 (0)