Skip to content

Commit

Permalink
Post-merge; Repo now includes a restructured version of tsd-jsdoc wit…
Browse files Browse the repository at this point in the history
…h our changes incorporated for issues/prs, see #550
  • Loading branch information
dcodeIO committed Dec 15, 2016
1 parent 82e8dd4 commit 8f407a1
Show file tree
Hide file tree
Showing 8 changed files with 2,869 additions and 2,406 deletions.
19 changes: 6 additions & 13 deletions cli/pbts.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,8 @@ exports.main = function(args) {

// There is no proper API for jsdoc, so this executes the CLI and pipes the output
var basedir = path.join(__dirname, "..");
var child = child_process.exec("node \"" + basedir + "/node_modules/jsdoc/jsdoc.js\" -c \"" + basedir + "/jsdoc.types.json\" " + files.map(function(file) { return '"' + file + '"'; }).join(' '), {
var moduleName = argv.name || "mymodule";
var child = child_process.exec("node \"" + basedir + "/node_modules/jsdoc/jsdoc.js\" -c \"" + basedir + "/jsdoc.types.json\" -q \"module=" + encodeURIComponent(moduleName) + "\" " + files.map(function(file) { return '"' + file + '"'; }).join(' '), {
cwd: process.cwd(),
argv0: "node",
stdio: "pipe"
Expand All @@ -69,23 +70,15 @@ exports.main = function(args) {
return;
}

var dts = out.join('').replace(/{$/mg, "{\n").trim();

var header = [
var output = [
"// $> pbts " + process.argv.slice(2).join(' '),
"// Generated " + (new Date()).toUTCString().replace(/GMT/, "UTC"),
""
];

// Remove declare statements and wrap everything in a module
dts = dts.replace(/\bdeclare\s/g, "");
dts = dts.replace(/^/mg, " ");
dts = header.join('\n')+"\ndeclare module " + JSON.stringify(argv.name || "mymodule") + " {\n\n" + dts + "\n\n}\n";
].join('\n') + "\n" + out.join('');

if (argv.out)
fs.writeFileSync(argv.out, dts);
fs.writeFileSync(argv.out, output);
else
process.stdout.write(dts, "utf8");
process.stdout.write(output, "utf8");
});

return undefined;
Expand Down
13 changes: 5 additions & 8 deletions jsdoc.types.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,14 @@
"includePattern": ".+\\.js(doc)?$",
"excludePattern": "(^|\\/|\\\\)_"
},
"templates": {
"jsdoc2tsd": {
"interfacePrefix" : ""
}
},
"opts": {
"encoding" : "utf8",
"recurse" : true,
"private" : false,
"lenient" : true,
"destination" : "console",
"template" : "./node_modules/tsd-jsdoc"
"template" : "./lib/tsd-jsdoc",

"private" : false,
"comments" : true,
"destination" : false
}
}
23 changes: 23 additions & 0 deletions lib/tsd-jsdoc/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
protobuf.js fork of tsd-jsdoc
=============================

This is a slightly modified and restructured version of [tsd-jsdoc](https://github.com/englercj/tsd-jsdoc) for use with protobuf.js, parked here so we can process issues and pull requests.

Options
-------

* **module: `string`**<br />
Wraps everything in a module of the specified name.

* **private: `boolean`**<br />
Skips private members when set to `false`.

* **comments: `boolean`**<br />
Skips any comments when set to `false`.

* **destination: `string|boolean`**<br />
Saves to the specified destination file or to console when set to `false`.

Setting options on the command line
-----------------------------------
Providing `-q, --query <queryString>` on the command line will set respectively override existing options.
Loading

0 comments on commit 8f407a1

Please sign in to comment.