Closed trusktr closed 5 years ago
Overall, the code is all the same, and I stuck any
where needed just to get it working.
The only change I did was convert Leafdoc
from a function
to class
(which is nicer to work with in TypeScript's type system).
Hmmm, although the output is not totally empty like it was in #42 on this branch, taking the same input from #42 now outputs the following markdown with some parts missing:
Leafdoc includes a small command-line utility, useful when running from a console or a shell script, accepting some of the Leafdoc options. The syntax is:
leafdoc [options] [files]
Option | Type | Default | Description |
---|---|---|---|
template |
String
| 'templates/basic' |
Akin to Leafdoc.templateDir |
t |
|
|
Alias of template |
character |
String
| '@' |
Akin to Leafdoc.leadingCharacter |
c |
|
|
Alias of character |
verbose |
Boolean
| false |
Akin to Leafdoc.verbose |
v |
|
|
Alias of verbose |
output |
String
| undefined |
File to write the documentation to. If left empty, documentation will be outputted to stdout instead. |
o |
|
|
Alias of output
Alias of output |
json |
Boolean
| false |
Write the internal JSON representation of the documentation instead of a templated HTML file. |
I'll look into this next.
I appreciate the effort in making this pull request, but don't support the idea of forcing maintainers to switch to another language just to fix a certain bug (which could be fixed directly).
Additionally, as it stands, the PR would add typescript as a subdependency of the package (through ts-node
), significantly increasing package size & the number of dependencies it brings.
The repo and latest release are both in a non-working state for me, and sticking typescript in was an easy solution to get the repo working locally (I'm npm link
ing it).
I got tired of jsdoc/tsdoc/etc libs not working, so I decided to pick one and get it working.
I chose Leafdoc because it is actually one of the simplest and was easy to get it working, which is nice!
forcing maintainers to switch to another language
I'm not forcing anyone. This PR doesn't have to be merged. I can't make you click the green merge button. ;)
(BTW, TypeScript is awesome, and the only non-JS parts I added were a limited set of type annotations, which is barely another language).
increasing package size & the number of dependencies
That's true. To make TypeScript a dev dependency only, cli.js
could be add to rollup
config and outputted to dist
, with the package.json bin
field updated to point to the dist file.
But that's more work for maintainers IMO. So there's tradeoffs. Is the space savings from not including ts-node more important? Maybe, maybe not. In my opinion, no.
After these changes, I am no longer having any issues with https://github.com/Leaflet/Leafdoc/issues/42 (the meaning of life, universe, and everything), and it works on my end (
npm link
ed into my project). The output is full!Converting to TypeScript was an easy way to fix the problem of
src/cli.js
importingsrc/leafdoc.js
which hadimport
syntax in it.So I added
ts-node
, converted the files to.ts
, and it simply worked.Overall, the code is all the same, and I stuck
any
s where needed just to get it working on this first pass.The only change I did was convert
Leafdoc
from afunction
to aclass
(which is nicer to work with in TypeScript's type system).