watchalive
Alive and robust file watcher with plugin system.
Last updated 4 years ago by whitecolor .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install watchalive 
SYNC missed versions from official npm registry.

Watchalive.

A small but robust dev server with smart file watching and transform support.

Generally:

  • http express server
  • lean and smart file watcher
  • socket.io server and client

Useful features:

  • watches only served (requested by client) files
  • transforms (transpiles/compiles) files on the fly using simple plugins
  • handles custom routes
  • proxies requests to other services
  • client gets notified about changes including changed sources

If you have question you may ping on gitter Gitter

Usage (CLI)

npm install watchalive -g

Place watchalive.config.js (or just watchalive.js or wa.config.js as you like) in your project folder. Run "watchalive" from command line.

Example configuration file (loading React.js transformed files with SystemJS loader):

"use strict"
var babel = require('babel-core')

module.exports = {
    base: "..", // base serve directory, relative to process.cwd()
    skip: [/node_modules/], // won't watch, cache and transpile     
    plugin: [
        ["less", {paths: ['client']}], // standard less/css plugin
        [/\.js$/, (source) => // custom transformer
              babel.transform(source, {
                  presets: ["es2015", 'react'],
                  plugins: [
                      ['react-transform', {
                          transforms: [
                              {transform: 'react-transform-jspm-hmr'}
                          ]
                      }]
                  ]
              }).code 
        ]
    ],
    // advanced routing
    route: [
        {'/mobile': '/client/mobile/index.html'},
        {'*': '/client/web/index.html'}
    ],
    // flexible proxy config
    proxy: {
        '/api': 'my-app.dev:2000'
    },
    data: true // send source of changed file with notification message 
}

You can also place config in package.json in "watchalive" section.

Also you can run without config file:

watchalive --port 7007 --base ..

API usage

npm install watchalive
"use strict"
const Watchalive = require('watchalive')
 
var wa = new Watchalive({/*config */})

wa.start()

Deep dive into options!

Client side usage

By default served *.html files get watchalive.js client script injected. You can easily access to this notifications in code:

    watchalive.onFiles(function(changes){
        // *changes* contain array of file names changed
        // can also contain changed file sources {file: ..., data: ...}
    })

Examples of usage

Licence

MIT

Current Tags

  • 1.1.9                                ...           latest (4 years ago)

57 Versions

  • 1.1.9                                ...           4 years ago
  • 1.1.8                                ...           4 years ago
  • 1.1.7                                ...           4 years ago
  • 1.1.6                                ...           4 years ago
  • 1.1.5                                ...           4 years ago
  • 1.1.4                                ...           4 years ago
  • 1.1.3                                ...           4 years ago
  • 1.1.2                                ...           4 years ago
  • 1.1.1                                ...           4 years ago
  • 1.1.0                                ...           4 years ago
  • 1.0.5                                ...           4 years ago
  • 1.0.4                                ...           4 years ago
  • 1.0.3                                ...           4 years ago
  • 1.0.2                                ...           4 years ago
  • 1.0.1                                ...           4 years ago
  • 1.0.0                                ...           4 years ago
  • 0.4.14                                ...           4 years ago
  • 0.4.13                                ...           4 years ago
  • 0.4.12                                ...           4 years ago
  • 0.4.11                                ...           4 years ago
  • 0.4.10                                ...           5 years ago
  • 0.4.9                                ...           5 years ago
  • 0.4.8                                ...           5 years ago
  • 0.4.7                                ...           5 years ago
  • 0.4.6                                ...           5 years ago
  • 0.4.5                                ...           5 years ago
  • 0.4.3                                ...           5 years ago
  • 0.4.2                                ...           5 years ago
  • 0.4.1                                ...           5 years ago
  • 0.4.0                                ...           5 years ago
  • 0.3.0                                ...           5 years ago
  • 0.2.2                                ...           5 years ago
  • 0.2.1                                ...           5 years ago
  • 0.2.0                                ...           5 years ago
  • 0.1.26                                ...           5 years ago
  • 0.1.25                                ...           5 years ago
  • 0.1.24                                ...           5 years ago
  • 0.1.22                                ...           5 years ago
  • 0.1.21                                ...           5 years ago
  • 0.1.20                                ...           5 years ago
  • 0.1.19                                ...           5 years ago
  • 0.1.18                                ...           5 years ago
  • 0.1.17                                ...           5 years ago
  • 0.1.16                                ...           5 years ago
  • 0.1.15                                ...           5 years ago
  • 0.1.14                                ...           5 years ago
  • 0.1.13                                ...           5 years ago
  • 0.1.12                                ...           5 years ago
  • 0.1.11                                ...           5 years ago
  • 0.1.10                                ...           5 years ago
  • 0.1.9                                ...           5 years ago
  • 0.1.8                                ...           5 years ago
  • 0.1.7                                ...           5 years ago
  • 0.1.6                                ...           5 years ago
  • 0.1.5                                ...           5 years ago
  • 0.1.4                                ...           5 years ago
  • 0.1.3                                ...           5 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 58
Dependencies (16)
Dev Dependencies (1)
Dependents (0)
None

Copyright 2014 - 2016 © taobao.org |