Skip to content

Commit 0762d49

Browse files
Move to vue
1 parent 0b74ff4 commit 0762d49

52 files changed

Lines changed: 8275 additions & 6642 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.DS_Store

10 KB
Binary file not shown.

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,5 @@ release-zip/
1717
scripts/_vue.js
1818
src/photon
1919
bin
20+
src/renderer-app/public/photon/
21+
src/renderer-app/public/*.js

bun.lock

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

native/.DS_Store

6 KB
Binary file not shown.

native/mac-input/.DS_Store

6 KB
Binary file not shown.

native/parakeet-backend/.DS_Store

6 KB
Binary file not shown.

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"scripts": {
88
"fullclean": "rm -rf dist .crush *.log vendor release build && bun install",
99
"clear:userdata": "rm -rf \"$HOME/Library/Application Support/WhisperMac\" \"$HOME/Library/Application Support/Electron\" \"$HOME/Library/Application Support/whispermac\" \"$HOME/Library/Application Support/electron\" .whispermac-data",
10-
"build": "tsc && node scripts/copy-assets.js && node scripts/prep-vad-assets.js",
10+
"build": "tsc && cd src/renderer-app && bun run build && cd ../.. && node scripts/copy-assets.js && node scripts/prep-vad-assets.js",
1111
"killothers": "echo 'Noop'",
1212
"start": "bun run killothers && electron dist/main.js",
1313
"dev": "nodemon --exec \"bun run single-dev\" --ignore dist --ignore photon --ignore .crush",
@@ -55,6 +55,7 @@
5555
"concurrently": "^8.0.0",
5656
"electron": "^25.0.0",
5757
"electron-builder": "^24.0.0",
58+
"esbuild": "^0.27.1",
5859
"nodemon": "^3.0.0",
5960
"sharp": "^0.34.3",
6061
"typescript": "^5.0.0"

scripts/copy-assets.js

Lines changed: 11 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -200,38 +200,26 @@ async function discoverFilesRecursive(dirPath, extensions = EXTENSIONS) {
200200
return files;
201201
}
202202

203-
// Parallel renderer file copying
203+
// Copy only error.html from old renderer (deprecated - everything else uses Vue app now)
204204
async function copyRendererFiles() {
205-
console.log("\n📁 Copying renderer files...");
205+
console.log("\n📁 Copying error.html from old renderer...");
206206

207207
if (!fs.existsSync(distDir)) {
208208
fs.mkdirSync(distDir, { recursive: true });
209209
}
210210

211-
// Discover all renderer files
212-
const rendererFiles = await discoverFiles(srcDir, EXTENSIONS);
213-
214-
// Create copy operations
215-
const operations = rendererFiles.map((srcFile) => ({
216-
src: srcFile,
217-
dest: path.join(distDir, path.basename(srcFile)),
218-
type: "renderer",
219-
}));
220-
221-
// Add Vue.js copy operation if it exists
222-
if (fs.existsSync(vueSrcPath)) {
223-
operations.push({
224-
src: vueSrcPath,
225-
dest: vueDistPath,
226-
type: "vue",
227-
});
228-
}
229-
230-
if (operations.length > 0) {
211+
// Only copy error.html as it's still used by ErrorWindowService
212+
const errorHtmlPath = path.join(srcDir, "error.html");
213+
if (fs.existsSync(errorHtmlPath)) {
214+
const operations = [{
215+
src: errorHtmlPath,
216+
dest: path.join(distDir, "error.html"),
217+
type: "renderer",
218+
}];
231219
totalOperations += operations.length;
232220
await parallelCopy(operations);
233221
} else {
234-
console.log("No renderer files found to copy");
222+
console.log("No error.html found to copy");
235223
}
236224
}
237225

scripts/prep-vad-assets.js

Lines changed: 17 additions & 89 deletions
Original file line numberDiff line numberDiff line change
@@ -1,91 +1,19 @@
11
#!/usr/bin/env node
22

3-
const fs = require("fs");
4-
const path = require("path");
5-
6-
function ensureDir(dirPath) {
7-
if (!fs.existsSync(dirPath)) {
8-
fs.mkdirSync(dirPath, { recursive: true });
9-
}
10-
}
11-
12-
function copyFile(fromPath, toPath) {
13-
ensureDir(path.dirname(toPath));
14-
fs.copyFileSync(fromPath, toPath);
15-
console.log(
16-
`Copied ${path.basename(fromPath)} -> ${path.relative(
17-
path.join(__dirname, ".."),
18-
toPath,
19-
)}`,
20-
);
21-
}
22-
23-
function copyDirFiltered(fromDir, toDir, allowedExtensions) {
24-
if (!fs.existsSync(fromDir)) return;
25-
ensureDir(toDir);
26-
const items = fs.readdirSync(fromDir);
27-
for (const item of items) {
28-
const src = path.join(fromDir, item);
29-
const dest = path.join(toDir, item);
30-
const stat = fs.statSync(src);
31-
if (stat.isDirectory()) {
32-
copyDirFiltered(src, dest, allowedExtensions);
33-
} else {
34-
const ext = path.extname(item).toLowerCase();
35-
if (!allowedExtensions || allowedExtensions.includes(ext)) {
36-
copyFile(src, dest);
37-
}
38-
}
39-
}
40-
}
41-
42-
(function main() {
43-
const projectRoot = path.join(__dirname, "..");
44-
const distRendererDir = path.join(projectRoot, "dist/renderer");
45-
46-
ensureDir(distRendererDir);
47-
48-
const vadWebDist = path.join(
49-
projectRoot,
50-
"node_modules/@ricky0123/vad-web/dist",
51-
);
52-
const ortWebDist = path.join(
53-
projectRoot,
54-
"node_modules/onnxruntime-web/dist",
55-
);
56-
57-
const vadFiles = [
58-
"bundle.min.js",
59-
"vad.worklet.bundle.min.js",
60-
"silero_vad_v5.onnx",
61-
"silero_vad_legacy.onnx",
62-
];
63-
for (const file of vadFiles) {
64-
const src = path.join(vadWebDist, file);
65-
const dest = path.join(distRendererDir, file);
66-
if (!fs.existsSync(src)) {
67-
console.warn(`WARN: Missing ${src}; did you install dependencies?`);
68-
continue;
69-
}
70-
copyFile(src, dest);
71-
}
72-
73-
const allowedExtensions = [".js", ".mjs", ".wasm"];
74-
if (fs.existsSync(ortWebDist)) {
75-
copyDirFiltered(ortWebDist, distRendererDir, allowedExtensions);
76-
} else {
77-
console.warn(
78-
`WARN: ${ortWebDist} not found; skipping onnxruntime-web copy.`,
79-
);
80-
}
81-
82-
// Copy audio visualizer script into dist/renderer
83-
const visualizerSrc = path.join(
84-
projectRoot,
85-
"src/renderer/audio-visualizer.js",
86-
);
87-
const visualizerDest = path.join(distRendererDir, "audio-visualizer.js");
88-
if (fs.existsSync(visualizerSrc)) {
89-
copyFile(visualizerSrc, visualizerDest);
90-
}
91-
})();
3+
/**
4+
* This script has been deprecated.
5+
*
6+
* VAD assets are now copied automatically via vite-plugin-static-copy
7+
* configured in src/renderer-app/vite.config.ts
8+
*
9+
* The Vite plugin copies the following files during build:
10+
* - vad.worklet.bundle.min.js (from @ricky0123/vad-web)
11+
* - silero_vad_v5.onnx (from @ricky0123/vad-web)
12+
* - silero_vad_legacy.onnx (from @ricky0123/vad-web)
13+
* - *.wasm files (from onnxruntime-web)
14+
* - *.mjs files (from onnxruntime-web)
15+
*
16+
* This file is kept for reference but no longer performs any operations.
17+
*/
18+
19+
console.log("prep-vad-assets.js: VAD assets are now handled by vite-plugin-static-copy in renderer-app/vite.config.ts");

src/.DS_Store

10 KB
Binary file not shown.

0 commit comments

Comments
 (0)