-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
docs: add types and documentation #11
Conversation
hacdias
commented
Nov 27, 2020
- TypeScript typings
- Update README with some docs
@jacobheun as I think you have more experience with TypeScript, I'm pinging you here to ask you to validate my TypeScript typings: am I writing them the way they're supposed to be? Is there any configuration that I'm missing? I feel like there's something lacking |
Tapping @Gozala and @hugomrdias for TS typings, they're currently adding typings through js-ipfs/js-libp2p. We've also started using a github action typechecker, that would be good to setup here as well, https://github.com/gozala/typescript-error-reporter-action. |
My advice is to not manually write definitions and do the same thing we are doing in ipfs and libp2p. We are using JSdoc to type the code inline and aegir to check and generate definitions. |
License: MIT Signed-off-by: Henrique Dias <[email protected]>
License: MIT Signed-off-by: Henrique Dias <[email protected]>
License: MIT Signed-off-by: Henrique Dias <[email protected]>
"lodash.flatten": "^4.4.0", | ||
"winston": "^3.3.3" |
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.
would be better to use Array.flat and consider pino instead of winston
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.
The linter complains because Array.flat was not available on Node 10. I could not change the engines to Node 12.
Thanks for the pino suggestion!
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.
why are you supporting node10 ?
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.
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.
wait why are flattening that method returns an object not a array
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.
why are you supporting node10 ?
@hugomrdias every time I change the engines in package.json to:
"engines": {
"node": ">=12.0.0"
},
I get:
./node_modules/.bin/aegir lint-package-json
./package.json
✖ valid-values-engines - node: engines - Invalid value for engines
1 error
0 warnings
Command failed with exit code 2: npmPkgJsonLint /Users/henriquedias/Code/testground/sdk-js/package.json -c /Users/henriquedias/Code/testground/sdk-js/node_modules/aegir/src/config/.npmpackagejsonlintrc.json
Then I saw this and assumed we had to support Node 10.
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.
ah got it i will fix that, sorry my bad, that rule is dumb
Thanks @hugomrdias. Quick question, is the bundle size checker tailored only for packages that can go into the browser? For example, here I'm getting the error |
Q: will this be only targeted at node ? we would also might want to include browser, electron, react-native nodes in the tests. |
See comment above. I want to make it work on the browser, but I didn't find alternatives for those functions of the |
its tailored to everything that might use bundlers and those will not include node globals or builtins |
Everything "native" should be injected rather than locking yourself right from the beginning into nodejs |
the architecture of this should abstract these things in a way we can implement env specific implementations, and then swap them as needed. Some solutions might just be injecting as globals or process.env vars or abstract into an interface that can be implemented for different envs. ie. browser doesnt have network interfaces but libp2p in some cases might overcome that or you might need some hooks to orchestrate external nodes to delegate. React native has interfaces but the way to get them is really different from nodejs. |
Sounds reasonable. If we take into account that the test is always started by Testground, we will always have a way to obtain those informations and pass them to the tests somehow. I will rework the environment specific variables so we can inject them. I will probably go for the interface way. Seems more flexible. |
Superseeded by #15 |
@hugomrdias After investigating, we can do so for stuff like 'path' and 'os'. However, I can't find any redis client that does not depend on Node built-ins. I will investigate. If you know any, that'd be great. |
ah right, the only solution i found for browser connection is to use https://webd.is/ |