node documentation just documents the current node, but to write portable node.js, its important to know about when APIs were introduced (or changed incompatibly)
I regularly find developers attempting to use features that only exist on the most recent Node.js versions, such as the v8 module, without realizing it doesn't exist on some LTS versions.
It would be quite helpful if the API docs were annotated with the version in which an API was introduced.
cc: @chrisdickinson @bhajian
(edited by @addaleax)
Now that basic tooling for this feature is available in the doctool, it would be nice to see if we can get some people together for looking up the versions in which features were added/deprecated! If you’d like to volunteer, I’d suggest you just comment on this issue.
Documentation files for which this is definitely worthwhile:
Docs for which this may or may not make sense:
See: https://github.com/nodejs/node/pull/6495
/cc @addaleax
Yep, I guess I can land that one now.
@sam-github If you don’t mind, I’d like to use this issue (edit your original comment) to keep a list of the doc files for which this work needs to be done and tag this good-first-contribution?
that sounds like an excellent idea @addaleax
@TheAlphaNerd @sam-github @bengl Looking good to everybody? Is this something you can share via social media in this state? :)
tweeted: https://twitter.com/bengl/status/728016045110222848
Also, I'm unclear on this: some features were added in one version and then only documented in another. Which versions should the added field represent?
@bengl The version in which it was added, not the one in which it was documented. :)
@addaleax I don't mind, I'm thrilled to see you can get this going.
https://nodejs.org/api/tls.html#tls_event_resumesession is one thing that's bit me before, it didn't used to have a callback... and now the callback is mandatory, its one of the few APIs that changed a _lot_, but not in a way that will cause your code to blow up... just quietly hang.
Minor issue, perhaps, but it's unclear to me how to maintain this going forward. Specifically, if I add a new API today, I add the docs material, and the YAML data...but what version do I put? 6.1.0 is the current version. So, 6.1.1. But what if the next version is actually 6.2.0? Do we care? Does someone have to go through and update everything? Am I overthinking it?
You’re not overthinking. :D What @bengl did in ec67abe4a7c074bb66700c4aede56ffd4aaf3363 was to leave a TODO comment for process.cpuUsage, and I think that’s a reasonable approach as long as there are only so many features added in a single version.
It might be nice to hear some of @nodejs/release’s opinions on this, too.
What about something like Added: after 6.1.0 or Added: > 6.1.0?
One approach that could work is to leave placeholders in the documentation and add a pre-release check:
diff --git a/Makefile b/Makefile
index 8612055..6ea73bf 100644
--- a/Makefile
+++ b/Makefile
@@ -429,6 +429,10 @@ PACKAGEMAKER ?= /Developer/Applications/Utilities/PackageMaker.app/Contents/MacO
PKGDIR=out/dist-osx
release-only:
+ @if `grep -q REPLACEME doc/api/*.md`; then \
+ echo 'Please update Added: tags in the documentation first.' ; \
+ exit 1 ; \
+ fi
@if [ "$(shell git status --porcelain | egrep -v '^\?\? ')" = "" ]; then \
exit 0 ; \
else \
I like that @bnoordhuis
If the release folks are generally okay with that, I’d like that approach, too.
Alternatively, if that turns out to be too much work, one could do something like Added: __VERSION__ to the docs and apply the same replacement logic that is used for doc/template.html.
I would consider doing this on release relatively trivial.
Generally though, we're missing something: Features will either land in a semver-minor, or wait for a major. So you'll virtually always be targeting the next minor release.
Seems like a fine idea to me.
Just picked a small module punycode to start. I hope this helps.
@nodejs/documentation
Working on cli.md right now and finding myself having to choose between when something was implemented vs. when it was documented.
I'm inclined to go with when it was documented as there's no guarantee that behavior didn't change between original implementation and eventual documentation.
This is all for stuff that was implemented and documented during v0.1.x (e.g., NODE_PATH) so I'm not sure it really matters much for 99+% of people who will be referencing the info, but want to get the principle straight in case it comes up elsewhere with more recent stuff.
@Trott Well, sometimes behaviour also changes after things being documented.
So far, I’ve gone pretty much by when features were actually added rather than documented… Ultimately, something like little PHP-style per-feature changelogs would be pretty cool, and I’d like to push for implementing that once the main work over here is done. (I don’t consider it as important as added: info, but if you feel differently, please say so.)
And yes, I don’t think anything before v0.6 or so matters to anyone anymore, but it’s kinda cool having a rough overview of what happened when in the dark ages. :)
Should we also add this information for
addons.mddebugger.mddomain.mdglobals.mdor can this issue be closed?
globals.md
Maybe, if anyone’s up for that. Everything in there is ancient, so it shouldn’t make a huge difference…
I'll take globals.md @addaleax
@italoacasas are you still up for globals.md?
@lpinca I forgot about this completely, I'm a little busy right now with some tests, but I'm going to tackle this down in a week if no one does first.
@italoacasas sure, just let me know if you don't have the time. I would really like to see this completed.
@lpinca well If someone else wants to make globals.md update, feel free, please. I don't want to stop anyone contribution.
If when I finish the stream tests, globals.md still undone, I will do the update.
@sam-github is this fully resolved?
I think this can be closed now, yes.
Most helpful comment
One approach that could work is to leave placeholders in the documentation and add a pre-release check: