Docs no long build
nsipplswezey opened this issue · comments
After a npm install -g documentation
which is required to build the docs
npm run docs
runs the following command "docs": "documentation core/module.js -o docs -f html"
The command. Throws the following error:
Unknown command: core/module.js. Did you mean "documentation build core/module.js -o docs -f html"?
Look's like the documentation
package has been updated to use a build
command.
Additionally running
documentation build core/module.js -o docs -f html
Fails at parsing with the babylon
which is the js parser that documentation
now uses to parse javascript; unexpected token errors wherever an empty arrow function is passed:
nodal/core/required/controller.js: Unexpected token (19:38)
17 | this._status = 200;
18 |
> 19 | this._responder = responder || () => {};
| ^
20 |
21 | this._securityPolicies = {};
22 |
at Parser.pp.raise (/usr/local/lib/node_modules/documentation/node_modules/babylon/index.js:1378:13)
at Parser.pp.unexpected (/usr/local/lib/node_modules/documentation/node_modules/babylon/index.js:2817:8)
at Parser.pp.parseParenAndDistinguishExpression (/usr/local/lib/node_modules/documentation/node_modules/babylon/index.js:843:12)
at Parser.parseParenAndDistinguishExpression (/usr/local/lib/node_modules/documentation/node_modules/babylon/index.js:3876:26)
at Parser.pp.parseExprAtom (/usr/local/lib/node_modules/documentation/node_modules/babylon/index.js:708:19)
at Parser.parseExprAtom (/usr/local/lib/node_modules/documentation/node_modules/babylon/index.js:4305:22)
at Parser.pp.parseExprSubscripts (/usr/local/lib/node_modules/documentation/node_modules/babylon/index.js:504:19)
at Parser.pp.parseMaybeUnary (/usr/local/lib/node_modules/documentation/node_modules/babylon/index.js:484:19)
at Parser.pp.parseExprOp (/usr/local/lib/node_modules/documentation/node_modules/babylon/index.js:446:42)
at Parser.pp.parseExprOps (/usr/local/lib/node_modules/documentation/node_modules/babylon/index.js:419:17)
Went ahead verified that it's a babylon
parsing error using their online parser
https://tonicdev.com/npm/babylon with an empty arrow function () => {}
Throws the same error.
Wrapping the empty arrow function in parens solves the syntax error.
Looks like the solution is to wrap empty anonymous arrow functions with parens
> 19 | this._responder = responder || () => {};
| ^
becomes
> 19 | this._responder = responder || (() => {});
| ^
Gave this a shot on my local repo and the docs built fine.
I don't expect that this will break anything, but will test before making a PR.
This is a Node 6.0 issue. () => {}
without parentheses is no longer valid syntax. I'll be pushing a Node-6 compatible update in the next week or two which should take care of this issue (and others). 👍
Awesome.
Just PRed the npm run docs
change since that will go from broken to less broken. You can merge it, or reject it and just do it yourself.