-
Notifications
You must be signed in to change notification settings - Fork 22
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
feat: add types #39
feat: add types #39
Conversation
Adds ts type generation and fixes all tsc errors.
package.json
Outdated
"test:node": "aegir test --target node", | ||
"test:browser": "aegir test --target browser", | ||
"test": "aegir test", | ||
"lint": "aegir lint && aegir lint-package-json", | ||
"release": "aegir release", | ||
"release-minor": "aegir release --type minor", | ||
"release-major": "aegir release --type major", | ||
"build": "aegir build", | ||
"prepublishOnly": "aegir build", |
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 do we need this ?
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.
To publish a minified bundle? Have removed it, shout if it's actually useful.
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 I miss any policy change for our JS libs? Why would we NOT provide a prebuilt browser bundle?
It is documented in https://github.com/ipfs-shipyard/is-ipfs#in-the-browser-through-script-tag so for now I've restored prepublishOnly
in 2a03f54
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.
Just a minor suggestion to avoid hard coding aegir path. Otherwise looks good to me.
@@ -0,0 +1,10 @@ | |||
{ | |||
"extends": "./node_modules/aegir/src/config/tsconfig.aegir.json", |
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.
Let's not assume where exactly aegir is.
"extends": "./node_modules/aegir/src/config/tsconfig.aegir.json", | |
"extends": "aegir/src/config/tsconfig.aegir.json", |
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.
That started failing recently and we don't know why yet.
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 typescript team broke this a minor release last week:
> [email protected] prepare
> aegir build --no-bundle
[11:11:07] Clean ./dist [started]
[11:11:07] Clean ./dist [completed]
[11:11:07] Generate types [started]
tsconfig-types.aegir.json:1:12 - error TS6053: File 'aegir/src/config/tsconfig.aegir.json' not found.
😭
It might be worth considering changing some of the |
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.
@Gozala I'd argue that the purpose of this library is to validate strings/bytes and return clear booleans specifically to avoid false-negatives when comparing types in (non-TS) userland. At least that is why I started using it in ipfs-companion (wanted deterministic CID.isCID
i could trust)
Anyway, adding types sounds sensible, are we good with this as it is now, or should we wait till
tsconfig-types.aegir.json:1:12 - error TS6053: File 'aegir/src/config/tsconfig.aegir.json' not found.
Gets resolved upstream?
@@ -29,28 +30,26 @@ | |||
"url": "https://github.com/ipfs/is-ipfs.git" | |||
}, | |||
"scripts": { | |||
"prepare": "aegir build --no-bundle", |
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.
@hugomrdias What does --no-bundle
do?
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.
It skips the browser bundle step as you don't need it during development, i.e. it only generates types from the jsdoc comments.
This would only start happening if we apply the suggestion from #39 (comment) which we should not do. I would not wait on it getting resolved first, the ts team move at their own cadence with their own conventions. |
It is documented in https://github.com/ipfs-shipyard/is-ipfs#in-the-browser-through-script-tag License: MIT Signed-off-by: Marcin Rataj <[email protected]>
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 shipped as [email protected] |
Adds ts type generation and fixes all tsc errors.