Coder Social home page Coder Social logo

add `watch` option about cli HOT 11 CLOSED

asyncapi avatar asyncapi commented on July 28, 2024 2
add `watch` option

from cli.

Comments (11)

derberg avatar derberg commented on July 28, 2024 1

we already do some watching here

chokidar.watch(filePath).on('all', (event, path) => {
.

so it is a matter of making a global function that can be reused by a command that needs it

from cli.

derberg avatar derberg commented on July 28, 2024 1

tbh I'm not sure, I would first try to check if chokidar community figured it out already, maybe something is already in their issues, or you can check others that use chokidar and how they solved testing. I would go first this direction to see how others tacked it

from cli.

derberg avatar derberg commented on July 28, 2024 1

@imabp well done 👏🏼

from cli.

github-actions avatar github-actions commented on July 28, 2024

This issue has been automatically marked as stale because it has not had recent activity 😴

It will be closed in 120 days if no further activity occurs. To unstale this issue, add a comment with a detailed explanation.

There can be many reasons why some specific issue has no activity. The most probable cause is lack of time, not lack of interest. AsyncAPI Initiative is a Linux Foundation project not owned by a single for-profit company. It is a community-driven initiative ruled under open governance model.

Let us figure out together how to push this issue forward. Connect with us through one of many communication channels we established here.

Thank you for your patience ❤️

from cli.

imabp avatar imabp commented on July 28, 2024

We need native way for watching AsyncAPI resource...

@derberg Do you mean Native as the NodeJS Runtime or based on operating system?

  • If NodeJS Runtime, an oclif hook is required to watch over the file and run the command using nodejs built in module fs. here

Would like to take up this issue :)

from cli.

imabp avatar imabp commented on July 28, 2024

A question @derberg
Do we need watch option as a global flag, or specific to validate ?

from cli.

derberg avatar derberg commented on July 28, 2024

best would be if it is global but that you need to enable it for given command 😄

so validate, diff, should have it, but new, start not really. So would be awesome to have it generic in a sense that when we add new generate command, we easily enable watch for it

from cli.

imabp avatar imabp commented on July 28, 2024

That means the flow goes like this 👇

  1. Create a global function for watch using chokidar
  2. Conditional check --watch flag
  3. If conditional check is true run the global function.

Correct me, if somewhere missing any point

from cli.

imabp avatar imabp commented on July 28, 2024

@derberg please review, #220
Relax and watch specification files 🍻
image

from cli.

imabp avatar imabp commented on July 28, 2024

@derberg The watcher PR is ready to review: #220

I got a bit in stuck moment when writing test for --watch flag using Mocha, @fmvilas because

  • Mocha is unable to close the stream once the test is completed, (as watch mode works in stream), hence npm run test runs for indefinite period of time.

Need some solutions on how do we approach it? Mocking Streams or any other way ?

from cli.

imabp avatar imabp commented on July 28, 2024

@derberg, we can close this issue, as #220 is merged :)

from cli.

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.