-
Notifications
You must be signed in to change notification settings - Fork 272
Conversation
@@ -1,7 +1,7 @@ | |||
# SYNOPSIS | |||
|
|||
[![NPM Package](https://img.shields.io/npm/v/ethereumjs-util.svg?style=flat-square)](https://www.npmjs.org/package/ethereumjs-util) | |||
[![Actions Status](https://github.com/ethereumjs/ethereumjs-util/workflows/Build/badge.svg)](https://github.com/ethereumjs/ethereumjs-util/actions | |||
[![Actions Status](https://github.com/ethereumjs/ethereumjs-util/workflows/Build/badge.svg)](https://github.com/ethereumjs/ethereumjs-util/actions) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
also fixed a missing )
here.
docs/README.md
Outdated
|
||
**● setLength**: *[setLengthLeft]()* = setLengthLeft | ||
• **rlp**: *"/Users/ryanghods/dev/ethereumjs-util/node_modules/rlp/dist/index"* |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Huh this is funny. It looks like it is trying to automatically document this line import rlp = require('rlp')
and accidentally inserting my file system path. Didn't seem to happen anywhere else though. I'll see if there is any way to solve it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi Ryan, thanks for having a start on this. Yeah, this is what I meant in the issue description comment in the last paragraph mentioning the require
syntax used.
This would need some deeper analysis.
Some possible ideas:
- Eventually it is possible to replace some of this special
require
syntax includes with normalimport
statements (would be best) - There might be a
TypeDoc
option I have missed to prevent this from being included in the docs (second best) - Eventually there is some for of comment syntax to be placed above the respective
require
statements to indicate toTypeDoc
to not to include the lines (third best, no problem though either)
docs/README.md
Outdated
* [KECCAK256_RLP_S](README.md#const-keccak256_rlp_s) | ||
* [MAX_INTEGER](README.md#const-max_integer) | ||
* [TWO_POW256](README.md#const-two_pow256) | ||
* [assert](README.md#const-assert) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the case I mentioned in the issue, having this assert
here is completely nonsense.
Also on a second thought along having a look into the PR: it would actually be a lot nicer to have the documentation also structured along the different modules like If it gets too complicated (writing some doc template or whatever, but also depends on the complexity) it might not be worth it, but otherwise it would make the docs a lot more readable. |
@holgerd77 ok thanks I will investigate further, would be great to have it split by module like you suggested. Do you have any thoughts on adding npm run docs:build as a husky precommit or gh action so docs are automatically regenerated after any changes? |
* create `src/externals.ts` and `test/externals.spec.ts`
I discovered a new library mode feature in typedoc@next that seems to align with what we're trying to accomplish here by separating the docs by src file. I pushed a commit if you want to take a look and see what you think of the generated docs with the new configuration in I also added a src file Converting Side note, husky wasn't letting me push without running |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, will merge, thanks Ryan!
@@ -112,8 +113,8 @@ | |||
"prettier": "^1.15.3", | |||
"ts-node": "^8.6.2", | |||
"tslint": "^5.12.0", | |||
"typedoc": "^0.14.0", | |||
"typedoc-plugin-markdown": "^1.1.21", | |||
"typedoc": "next", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great find with this library
mode! Just browsed through the previews of the documentation files, that is exactly what we need here I would say. This makes the functionality of this library so much more approcheable, great! 😄
This next tag is pretty much unspecific and takes out some determinism for a dev installation. Think in this case it's worth though also considering that this is just a dev dependency for the doc generation, so it is not even changing "implicit" dev environment behavior (if there is a new next version) but will be clearly noted if doc generation behaves differently.
We just should remember to update this once there is the occasion and this gets officially published.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes it was relieving to find library mode, it perfectly fit our needs :) Agreed about moving from the next tag as soon as we can, I’ll keep an eye out for releases.
@@ -100,6 +100,7 @@ | |||
"@ethereumjs/config-tslint": "^1.1.0", | |||
"@types/mocha": "^5.2.7", | |||
"@types/node": "^11.9.0", | |||
"@types/secp256k1": "3.5.0", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For the reference: new @types/secp2561
dependency
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, thanks, by the way this should be updated to 3.5.2 for the new types in the PR for updating secp256k1 to latest (although I’m sure it’ll split out an error letting you know after rebasing on master :)
Also maybe we can add a question “Does this PR add or modify any dependencies?” to a contributing PR template so we can always have that information in the OP, I forget sometimes to mention (sorry!)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We have one for Grid here that is nice to have, I’m sure we can write something similar for the monorepo. https://github.com/ethereum/grid/blob/master/.github/PULL_REQUEST_TEMPLATE.md
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, would likely make sense to have some unified PR template throughout the EthereumJS libraries. Would be something to be proposed and discussed here https://github.com/ethereumjs/organization if we want to continue on that.
const secp256k1 = require('secp256k1') | ||
import BN = require('bn.js') | ||
import * as secp256k1 from 'secp256k1' | ||
import * as BN from 'bn.js' | ||
import { toBuffer, setLength, setLengthLeft, bufferToHex } from './bytes' | ||
import { keccak } from './hash' | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did have a look at all module files, also checked the linking from README
. This looks good and consistent now.
@@ -1,7 +1,7 @@ | |||
const createKeccakHash = require('keccak') | |||
const createHash = require('create-hash') | |||
const ethjsUtil = require('ethjs-util') | |||
import rlp = require('rlp') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cool that this ugly syntax version could be replaced on so many occurrences.
/** | ||
* [`secp256k1`](https://github.com/cryptocoinjs/secp256k1-node/) | ||
*/ | ||
export { secp256k1 } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice to have this in a separate file now, this generally make library exports easier to grasp and more explicit, e.g. to have this new externals.spec.ts
test file along is a great addition.
I first thought if it would be necessary to hide this respectively just have this for documentation purposes and recommend (e.g. by stating in the docs) to use the index.ts
exposure for importing the re-exports as a user. Second thought lead me to think that this is not necessary and it is very much ok to have this new externals
entrypoint as an alternative. This will likely stay pretty stable and remains fully backwards-compatible.
Ah, the Husky questions: Build docs on Husky precommit: we discussed some time ago WHEN to actually build the documentation with some people - think @alcuadrado and @s1na - and we came to the conclusion (sorry, don't find the reference any more) that is best for the end user of a library when the docs build meet the last release version and don't just correspond to So we would want to establish the practice here to always rebuild the documentation along a release - this would likely be my job - this hasn't completely established though yet. It's also likely to have some exceptions here, e.g. on a PR like this one probably doesn't want to wait with building the docs and keep this unproven to work until the next release. Workflow for lint run on pushing: this is eventually if code hasn't been touched for some longer time and linting rules changed with new |
Here's the discussion where @s1na suggests to trigger a job in the event of a release. In the following comments, I suggested that the CI job would build the docs and perform a |
nice @evertonfraga thank you for the link and context. i like the git diff with exit code idea, very neat, and could be simple to trigger with gh actions on new tags and/or releases. |
@evertonfraga took me some time to grasp all your guys' ideas and think through the practical implications, but I am finally there. 🙃 So - yes - would think this combination of using the |
This PR updates TypeDoc and docs, closes #230.
Thanks @holgerd77 for the updated script.