GithubHelp home page GithubHelp logo

Watch command? about invoke-build HOT 5 CLOSED

nightroman avatar nightroman commented on May 27, 2024
Watch command?

from invoke-build.

Comments (5)

nightroman avatar nightroman commented on May 27, 2024

I am not familiar with gulp and its watch command. I will google but it would be useful if you describe some specs it terms of Invoke-Build.

from invoke-build.

nightroman avatar nightroman commented on May 27, 2024

A naive approach from the top of my head. A working example of FileSystemWatcher in PowerShell
is here. We configure it for required files and events and start it in a console which is kept running.
From the appropriate event handler we call Invoke-Build with specified tasks and parameters, as usual.

from invoke-build.

nightroman avatar nightroman commented on May 27, 2024

Just to be clear, the above does not need anything extra in Invoke-Build. It
is just a PowerShell script which uses Invoke-Build as it is.

It is too simple and needs some work, depending on scenarios. For example, one
may want to wait for multiple changes to complete before triggering a build.
Or maybe it is fine that it is called for each event but the file system may
send multiple events for the same file (from the remarks from the link).

So a properly designed script is needed. But it is still not directly related
to Invoked-Build. If you are thinking of some sort of integration then some
specs are definitely needed. I do not have any practical use cases on my own.

from invoke-build.

nightroman avatar nightroman commented on May 27, 2024

The script uses the Action parameter. Yet another approach is possible and
may be simpler because processing is done not by PowerShell jobs. We just
subscribe to events without actions

Register-ObjectEvent $fsw Created -SourceIdentifier FileCreated
Register-ObjectEvent $fsw Deleted -SourceIdentifier FileDeleted
Register-ObjectEvent $fsw Changed -SourceIdentifier FileChanged

Then in the main script we use Wait-Event or check for events periodically by
Get-Event, process them and remove by Remove-Event. Then repeat
waiting for events.

from invoke-build.

nightroman avatar nightroman commented on May 27, 2024

I created the tool Watch-Directory.ps1. It is designed for any command processing changes specified as a parameter, normally a script block. In your case this command may call Invoke-Build. The tool is not final and not fully tested but it seems to be working.

from invoke-build.

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.