w3c/echidna-manifester

Name: echidna-manifester

Owner: World Wide Web Consortium

Description: Generates Echidna manifest ? EXPERIMENTAL

Created: 2015-06-04 14:01:12.0

Updated: 2017-09-04 05:53:27.0

Pushed: 2016-02-25 15:10:01.0

Homepage: null

Size: 10

Language: JavaScript

GitHub Committers

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

echidna-manifester

Some people (whose names shall remain a secret) complained that it could be too hard to generate Echidna manifests.

What this tool does is load a file you give to it (local or URL) and try to list all the resources that it loads, and that are situated under the same directory as that file.

In theory, if you've done things well (and your document can be published under TR without modification), then this should list all the dependencies you have that should go into your Echidna manifest. You can paste them there.

Warnings

There are good reasons that this is not supported directly by Echidna. In the general case, if you had a reliable process to detect all the resources that a Web page might load then you would have a solution to the Halting Problem.

So keep in mind that this isn't perfect. For instance, if your document loads stuff that causes other stuff to be loaded by script over time, it's possible that the process will time out before some resources are loaded, and so they won't get loaded. For specs that should not happen, but for instance if ReSpec+PhantomJS are being slow together you could be out of luck.

This also does not generate the first entry (the main document) because it can't guess all the parameters for that. Presumably that's not too bad a problem.

Installation

To use it from the command line, type:

m install -g echidna-manifester

To use as a Node.js module, add it to your package.json file:

endencies": {
?
"echidna-manifest": "^0.1.0"

And require it as usual:

em = require('echidna-manifester');
Usage

From the command line, invoke it with these arguments:

hidna-manifester <PATH/TO/FILE> [OPTIONS-AS-JSON]

Some examples:

hidna-manifester http://berjon.com/
hidna-manifester /tmp/spec.html '{"format": "plain"}'
hidna-manifester https://foo.com/bar.html '{"includeErrors": true, "includeTypes": true}'

As a Node.js module: echidna-manifester exports only one function, run. These are its arguments:

  1. url (String): required
  2. options (Object): optional.
    If absent, default options will be applied.
  3. callback (Function): optional.
    Signature: function(data).
    If absent, the output will be console.logged.
em = require('echidna-manifester');
url = 'https://foo.com/bar.html';
options = {
"format": "json",
"compactUrls": false,

callback = function(data) {
console.dir(data);


un(url, options, callback);
Output formats and options

The object options may include these properties (default values are in bold):

Examples

All these examples use this dummy spec:
http://www.w3.org/People/Antonio/spec/dummy-spec.html

Use from the command line, with default options:

de echidna-manifester http://www.w3.org/People/Antonio/spec/dummy-spec.html
y-spec.html
css
js
://www.w3.org/Consortium/Offices/w3coffice.png
://www.w3.org/2014/10/stdvidthumb.png
jpeg

Invoke from JavaScript, specifying JSON output and failed resources too:

em = require('echidna-manifester');

un(
'http://www.w3.org/People/Antonio/spec/dummy-spec.html',
{
    "format":        "json",
    "includeErrors": true
},
processJSON

son

"ok": [
    {"url": "dummy-spec.html"},
    {"url": "foo.css"},
    {"url": "baz.js"},
    {"url": "http://www.w3.org/Consortium/Offices/w3coffice.png"},
    {"url": "http://www.w3.org/2014/10/stdvidthumb.png"},
    {"url": "bar.jpeg"}
],
"error": [
    {"url": "i-do-not-exist.css"},
    {"url": "i-do-not-exist.svg"}
]

From the command line, in plain text, with full URLs and with types:

de echidna-manifester http://www.w3.org/People/Antonio/spec/dummy-spec.html '{"format": "plain", "includeTypes": true, "compactUrls": false}'
://www.w3.org/People/Antonio/spec/dummy-spec.html ok html
://www.w3.org/People/Antonio/spec/foo.css ok css
://www.w3.org/People/Antonio/spec/baz.js ok js
://www.w3.org/Consortium/Offices/w3coffice.png ok img
://www.w3.org/2014/10/stdvidthumb.png ok img
://www.w3.org/People/Antonio/spec/bar.jpeg ok img

This work is supported by the National Institutes of Health's National Center for Advancing Translational Sciences, Grant Number U24TR002306. This work is solely the responsibility of the creators and does not necessarily represent the official views of the National Institutes of Health.