« get me outta code hell

hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
path: root/src/content/dependencies/index.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/content/dependencies/index.js')
-rw-r--r--src/content/dependencies/index.js16
1 files changed, 14 insertions, 2 deletions
diff --git a/src/content/dependencies/index.js b/src/content/dependencies/index.js
index a5009804..cfa6346c 100644
--- a/src/content/dependencies/index.js
+++ b/src/content/dependencies/index.js
@@ -11,6 +11,11 @@ import {colors, logWarn} from '#cli';
 import contentFunction, {ContentFunctionSpecError} from '#content-function';
 import {annotateFunction} from '#sugar';
 
+const __dirname = path.dirname(fileURLToPath(import.meta.url));
+
+const codeSrcPath = path.resolve(__dirname, '..');
+const codeRootPath = path.resolve(codeSrcPath, '..');
+
 function cachebust(filePath) {
   if (filePath in cachebust.cache) {
     cachebust.cache[filePath] += 1;
@@ -42,7 +47,9 @@ export function watchContentDependencies({
     close,
   });
 
-  const eslint = new ESLint();
+  const eslint = new ESLint({
+    cwd: codeRootPath,
+  });
 
   const metaPath = fileURLToPath(import.meta.url);
   const metaDirname = path.dirname(metaPath);
@@ -87,6 +94,8 @@ export function watchContentDependencies({
     const filePaths = files.map(file => path.join(watchPath, file));
     for (const filePath of filePaths) {
       if (filePath === metaPath) continue;
+      if (filePath.endsWith('.DS_Store')) continue;
+
       const functionName = getFunctionName(filePath);
       if (!isMocked(functionName)) {
         contentDependencies[functionName] = null;
@@ -98,8 +107,9 @@ export function watchContentDependencies({
     watcher.on('all', (event, filePath) => {
       if (!['add', 'change'].includes(event)) return;
       if (filePath === metaPath) return;
-      handlePathUpdated(filePath);
+      if (filePath.endsWith('.DS_Store')) return;
 
+      handlePathUpdated(filePath);
     });
 
     watcher.on('unlink', (filePath) => {
@@ -108,6 +118,8 @@ export function watchContentDependencies({
         return;
       }
 
+      if (filePath.endsWith('.DS_Store')) return;
+
       handlePathRemoved(filePath);
     });