Giter VIP home page Giter VIP logo

Comments (6)

loreanvictor avatar loreanvictor commented on May 16, 2024 1

This is a bug. The recursive watching of source markdown files (src.base parameter in configs, which defaults to docs/md) should be supported.

I am unable to reproduce locally (node v 12.16.0 / macOS). What is your node version / OS? Apparently there are issues with ts-node-dev's recursive file watching and node 14.

I am not sure if it will actually be fixed anytime soon or if lower versions of node will solve the issue, as this seems to be a caveat of node's own fs.watch API which stops it from properly functioning on platforms other than Windows and macOS. The behavior change that results in raised issues is evidently due to node 14 throwing an error vs previous versions silently ignoring it.

I'll keep this issue open to monitor the situation with ts-node-dev issues. If there is no fix in near future for this, I suspect the best course of action would be to look for an alternative at least for non-Windows/macOs machines (though that perhaps leads to slower reload times on dev).

P.S. @mnn in the meantime you can actually add your work-around in .codedoc/watch.ts, so that codedoc serve (or codedoc s) would work for you (if it is more convenient). I suspect it would look something like this:

// .codedoc/watch.ts

import { exec, spawn } from 'child_process';
import { config } from './config';

const cmd = 'find'; 
const params = `${config.src.base} | entr -r ts-node .codedoc/serve`;

// ...

(Though you would need to test to ensure this works).

from codedoc.

mnn avatar mnn commented on May 16, 2024 1

I am using Linux 64b (Manjaro) and node 13.12.0.

Oh yes, multiplatform file watching is rather problematic. This is not a first time I hit similar issue, most likely caused by the same underlying cause.

Thank you very much for the tip, it lead me to this (a bit convoluted) solution:

const cmd = 'find';
const params = `${config.src.base} | entr -r npx --no-install ts-node -P .codedoc/tsconfig.json .codedoc/serve`;

from codedoc.

loreanvictor avatar loreanvictor commented on May 16, 2024 1

as part of this commit, this also should be fixed. the fix is deployed via the combination of @codedoc/[email protected] and @codedoc/[email protected], and you should be able to update to it like this:

npm i -g @codedoc/cli@latest
codedoc update latest

in this update, tiered watching is used, and markdown files are now watched using node-watch, which should be able to properly watch recursive file changes on Linux machines as well. ts-node-dev is only used for watching TypeScript code, which should already be working properly with recursive watching even on Linux machines.

@mnn since I do not have a Linux machine for testing, I am going to keep this issue open for now until you confirm this update fixes the recursive watching issue.

from codedoc.

mnn avatar mnn commented on May 16, 2024 1

Sorry, don't have much free time now. Just quickly tested it on a fresh project (same directory structure as my original project), and change detection is working now 🙂. Thank you very much.

from codedoc.

loreanvictor avatar loreanvictor commented on May 16, 2024

thats a nice work-around.

unfortunately, filewatcher (which is used by ts-node-dev for watching files) itself seems to be dead, so a stable/performant solution might not come soon. I will play around with a fork of filewatcher / ts-node-dev that uses this package instead, see if it works out.

if this drags out long, I will add your solution to the boilerplate repo so that new repositories will use entr instead of ts-node-dev on linux machines. I am just a bit hesitant due to the performance drawback.

from codedoc.

loreanvictor avatar loreanvictor commented on May 16, 2024

Sorry, don't have much free time now. Just quickly tested it on a fresh project (same directory structure as my original project), and change detection is working now 🙂. Thank you very much.

thank you for testing, and that was still pretty fast!

from codedoc.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.