Boughtmanatee5 / amok

No Reload Live Editing for JavaScript

Home Page:http://amokjs.com/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Amok(1)

tips chat npm

out

Synopsis

amok [options] <SCRIPT | URL>

Installation

npm install amok -g

Description

Amok standalone command line tool that enables rapid prototyping and development of JavaScript based web applications through the client's remote debugging interface.

Given a SCRIPT as the entry point, it will start a zero configuration http development server with a default generated index.html that may be overriden by having a file called index.html. The server may be configured to incrementally watch and compile the scripts through preprocessors, compilers and bundlers. Such as typescript, coffeescript, browserify, webpack and babel.

Alternatively a URL may be specified as the entry point, in which case it will connect to the client directly without starting the development server.

If the client option is enabled, the executable of that client is located and opened with the correct settings to allow it to accept remote debugging connections.

Once connected to a client it mirrors the console output and monitors changes in the file system.

When a change to the source of a script currently loaded in the client is detected, it gets refreshed in the client without restarting the application, keeping the application running without interruption or loosing state.

This refresh changes the source and re-compiles the code in the client, and is applicable to prototypes, classes and closures.

Take note however that the script itself is does not evaluate again as this would corrupt the state, no side effects will occur but notifications are sent to the client as events to enable further processing and evaluation.

Options

-h, --help
  output usage information

-V, --version
  output the version number

--host <HOST>
  specify http host

--port <PORT>
  specify http port

--debugger-host <HOST>
  specify debugger host

--debugger-port <PORT>
  specify debugger port

-i, --interactive
  enable interactive mode

--client <PRESET | COMMAND>
  specify the client to spawn

--compiler <PRESET | COMMAND>
  specify the compiler to spawn

-v, --verbose
  enable verbose logging mode

A client must already listening on the same remote debugging port when launching, or specified with the client option.

A compiler may be specified to process script sources served via the http server with the compiler option, Any extra arguments and options following the option parsing terminator --, will be passed as extra options to the compiler. The specified compiler must have its executable available via PATH.

Examples

amok --client chrome app.js
amok --client chrome http://localhost:9090
amok --client chrome --compiler webpack canvas.js
amok --client chrome --compiler browserify canvas.js -- --transform babelify

See also amok-examples

Client Environment

Events get emitted to aid with domain specific requirements. These events are emitted on the global object, if both window and process are available, events will be emitted on both objects.

process

Event: 'add'

  function (filename) { }

Emitted when a file is added.

Event: 'remove'

  function (filename) { }

Emitted when a file is removed.

Event: 'change'

  function (filename) { }

Emitted when the contents of a file is changed.

Event: 'source'

  function (filename) { }

Emitted when a loaded script gets its source re-compiled.

window

Event: 'add'

  function (event) { }

Dispatched when a file is added, event is a CustomEvent with detail containing the filename relative to the current working directory.

Event: 'remove'

  function (event) { }

Dispatched when a file is removed, event is a CustomEvent with detail containing the filename relative to the current working directory.

Event: 'change'

  function (event) { }

Dispatched when the contents of a file changes, event is a CustomEvent with detail containing the filename relative to the current working directory.

Event: 'source'

  function (event) { }

Dispatched when a loaded script gets its source re-compiled, event is a CustomEvent with detail containing the filename relative to the current working directory.

See Also

amok-examples

About

No Reload Live Editing for JavaScript

http://amokjs.com/

License:MIT License


Languages

Language:JavaScript 99.3%Language:HTML 0.7%