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
User | Most Recent Commit | # Commits |
---|
Other Committers
User | Most Recent Commit | # Commits |
---|
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.
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.
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');
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:
url
(String
): requiredoptions
(Object
): optional.callback
(Function
): optional.function(data)
.console.log
ged.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);
The object options
may include these properties (default values are in bold):
'format'
:'manifest'
, 'json'
, 'plain'
}'manifest'
: a format that is appropriate for an Echidna manifest'json'
: a JSON object'plain'
: text, one line per resource, fields separated by spaces: URL STATUS [TYPE]
'compactUrls'
true
, false
}'includeErrors'
true
, false
}'includeTypes'
true
, false
}'manifest'
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