Add chokidar to repo
This commit is contained in:
parent
4edac451e4
commit
238ca8c812
|
|
@ -1,4 +1,10 @@
|
|||
# Miller code editor
|
||||
|
||||
This is a code editor/IDE based on CodeMirror.
|
||||
Its primary goal is to provide the user with a stack/column-based navigation history, making codebase navigation easier without getting lost.
|
||||
Its primary goal is to provide the user with a stack/column-based navigation history, making codebase navigation easier without getting lost.
|
||||
|
||||
## Features
|
||||
- [*] Basic file editing
|
||||
- [*] Terminal integration
|
||||
- [ ] File watching
|
||||
- [ ] LSP support
|
||||
|
|
@ -9,6 +9,7 @@
|
|||
"version": "0.1.0",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"chokidar": "^4.0.3",
|
||||
"electron-squirrel-startup": "^1.0.1",
|
||||
"node-pty": "^1.0.0"
|
||||
},
|
||||
|
|
@ -28,6 +29,7 @@
|
|||
"@eslint/eslintrc": "^3.3.1",
|
||||
"@eslint/js": "^9.39.1",
|
||||
"@tailwindcss/vite": "^4.1.17",
|
||||
"@types/chokidar": "^1.7.5",
|
||||
"@types/electron-squirrel-startup": "^1.0.2",
|
||||
"@typescript-eslint/eslint-plugin": "^8.46.3",
|
||||
"@typescript-eslint/parser": "^8.46.3",
|
||||
|
|
@ -3342,6 +3344,17 @@
|
|||
"@types/responselike": "^1.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@types/chokidar": {
|
||||
"version": "1.7.5",
|
||||
"resolved": "https://registry.npmjs.org/@types/chokidar/-/chokidar-1.7.5.tgz",
|
||||
"integrity": "sha512-PDkSRY7KltW3M60hSBlerxI8SFPXsO3AL/aRVsO4Kh9IHRW74Ih75gUuTd/aE4LSSFqypb10UIX3QzOJwBQMGQ==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@types/events": "*",
|
||||
"@types/node": "*"
|
||||
}
|
||||
},
|
||||
"node_modules/@types/electron-squirrel-startup": {
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://registry.npmjs.org/@types/electron-squirrel-startup/-/electron-squirrel-startup-1.0.2.tgz",
|
||||
|
|
@ -3378,6 +3391,13 @@
|
|||
"dev": true,
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/@types/events": {
|
||||
"version": "3.0.3",
|
||||
"resolved": "https://registry.npmjs.org/@types/events/-/events-3.0.3.tgz",
|
||||
"integrity": "sha512-trOc4AAUThEz9hapPtSd7wf5tiQKvTtu5b371UxXdTuqzIh0ArcRspRP0i0Viu+LXstIQ1z96t1nsPxT9ol01g==",
|
||||
"dev": true,
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/@types/fs-extra": {
|
||||
"version": "9.0.13",
|
||||
"resolved": "https://registry.npmjs.org/@types/fs-extra/-/fs-extra-9.0.13.tgz",
|
||||
|
|
@ -4684,6 +4704,21 @@
|
|||
"dev": true,
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/chokidar": {
|
||||
"version": "4.0.3",
|
||||
"resolved": "https://registry.npmjs.org/chokidar/-/chokidar-4.0.3.tgz",
|
||||
"integrity": "sha512-Qgzu8kfBvo+cA4962jnP1KkS6Dop5NS6g7R5LFYJr4b8Ub94PPQXUksCw9PvXoeXPRRddRNC5C1JQUR2SMGtnA==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"readdirp": "^4.0.1"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 14.16.0"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://paulmillr.com/funding/"
|
||||
}
|
||||
},
|
||||
"node_modules/chownr": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/chownr/-/chownr-2.0.0.tgz",
|
||||
|
|
@ -9879,6 +9914,19 @@
|
|||
"node": ">= 6"
|
||||
}
|
||||
},
|
||||
"node_modules/readdirp": {
|
||||
"version": "4.1.2",
|
||||
"resolved": "https://registry.npmjs.org/readdirp/-/readdirp-4.1.2.tgz",
|
||||
"integrity": "sha512-GDhwkLfywWL2s6vEjyhri+eXmfH6j1L7JE27WhqLeYzoh/A3DBaYGEj2H/HFZCn/kMfim73FXxEJTw06WtxQwg==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">= 14.18.0"
|
||||
},
|
||||
"funding": {
|
||||
"type": "individual",
|
||||
"url": "https://paulmillr.com/funding/"
|
||||
}
|
||||
},
|
||||
"node_modules/rechoir": {
|
||||
"version": "0.8.0",
|
||||
"resolved": "https://registry.npmjs.org/rechoir/-/rechoir-0.8.0.tgz",
|
||||
|
|
|
|||
|
|
@ -34,6 +34,7 @@
|
|||
"@eslint/eslintrc": "^3.3.1",
|
||||
"@eslint/js": "^9.39.1",
|
||||
"@tailwindcss/vite": "^4.1.17",
|
||||
"@types/chokidar": "^1.7.5",
|
||||
"@types/electron-squirrel-startup": "^1.0.2",
|
||||
"@typescript-eslint/eslint-plugin": "^8.46.3",
|
||||
"@typescript-eslint/parser": "^8.46.3",
|
||||
|
|
@ -53,6 +54,7 @@
|
|||
"vite": "^7.2.2"
|
||||
},
|
||||
"dependencies": {
|
||||
"chokidar": "^4.0.3",
|
||||
"electron-squirrel-startup": "^1.0.1",
|
||||
"node-pty": "^1.0.0"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,6 +6,8 @@ import fs from "fs";
|
|||
const fsp = fs.promises;
|
||||
import path from "path";
|
||||
|
||||
import * as chokidar from "chokidar";
|
||||
|
||||
type FolderTree = {
|
||||
name: string;
|
||||
path: string;
|
||||
|
|
@ -15,6 +17,7 @@ type FolderTree = {
|
|||
|
||||
// Track the currently opened folder for security checks
|
||||
let currentWorkspaceRoot: string | null = null;
|
||||
let watcher: chokidar.FSWatcher | null = null;
|
||||
|
||||
// Track previously opened files outside the workspace
|
||||
const openedFiles = new Set<string>();
|
||||
|
|
@ -55,6 +58,13 @@ export async function handleOpenFolder(
|
|||
if (!result.canceled && result.filePaths.length > 0) {
|
||||
const folderPath = result.filePaths[0];
|
||||
currentWorkspaceRoot = folderPath; // Track the opened folder
|
||||
watcher = chokidar.watch(folderPath, {
|
||||
ignoreInitial: true,
|
||||
});
|
||||
watcher.on("all", (event, path) => {
|
||||
console.log("chokidar", event, path);
|
||||
});
|
||||
|
||||
return {
|
||||
name: path.basename(folderPath),
|
||||
path: folderPath,
|
||||
|
|
|
|||
Loading…
Reference in New Issue