-
Notifications
You must be signed in to change notification settings - Fork 309
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
test(react-query): add tsd #99
Conversation
👷 Deploy request for slash-libraries pending review.Visit the deploys page to approve it
|
@@ -11,7 +15,7 @@ | |||
}, | |||
"main": "./src/index.ts", | |||
"scripts": { | |||
"build": "rm -rf dist esm && tsc --declaration --emitDeclarationOnly --declarationDir dist && rollup -c rollup.config.js", | |||
"build": "rm -rf dist esm && tsc --declaration --emitDeclarationOnly --declarationDir dist && rollup -c rollup.config.js && pnpify tsd", |
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.
I chained pnpify tsd
after original build
It will make error in process of build if there is error in tsd code.
check that it is fine please
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 not running tests in the test
script, rather than build
? We always check if the test
passes before a PR is merged.
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.
@raon0211
I want to split it(pnpify tsd
) from yarn build
too.
but cannot find any code that execute just only test
before a PR is merged.
Where can i check that code?
I found only circleci using jest in .circleci/config.yml, not yarn test.
Isn't test
just used as just naming, right?
Is there any setting executing yarn test
not visible for me?
or Could you help me check it out please?
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 looks so @manudeli .
But, despite it, I think running tsd
in build
script is not appropriate.
We can do other better things like adding tsd
test step to Circle CI config, or etc.
We will tell you about it soon, thanks!
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.
@hoseungjang Okay.
I removed tsd in script:build
and added a script:tsd
seperately in this commit fb022af.
this script:tsd
is intended to be easy to use whether anyone know pnpify is required to use tsd on yarn berry project or not.
"scripts": {
"build": "rm -rf dist esm && tsc --declaration --emitDeclarationOnly --declarationDir dist && rollup -c rollup.config.js",
"prepack": "yarn build",
"test": "echo \"no test specified.\"",
"tsd": "pnpify tsd", // added: to use tsd on yarn berry
"typecheck": "tsc --noEmit"
},
If anyone have used script build
, it will make definition files so you can use tsd
after.
How about next new Pull Request for doing better thing that you said after merging this Pull Request?
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 are discussing this. Please wait a bit 🙏
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.
Seperating tsd script and adding that in prepack lifecycle seems good to me.
But like you said, it would be better to do it in the new PR.
This seems fine to merge.
"scripts": {
"prepack": "yarn build && yarn tsd",
"tsd": "pnpify tsd"
},
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.
I fixed scripts as what you comment in a42814c
thanks for your guide :)
const queryKey = ['example'] as const; | ||
const queryFn = async () => 'response'; | ||
|
||
/* eslint-disable react-hooks/rules-of-hooks */ |
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.
ISSUE CLOSED: #86
This is continuous PR along #73 to add tsd for testing typescript type
#73 (comment)
TSD set up with some code
Could you together check that
tsd really require @yarnpkg/pnpify in yarn/berry
please?I think TSD need @yarnpkg/pnpify in yarn/berry environment. but I can't be confident on it
when i first setup tsd in my personal project using yarn classic, tsd worked really fine.
but if no @yarnpkg/pnpify in yarn/berry environment like @toss/slash, when I exucute
yarn tsd
, I metcannot find module tsd, react-query
error.after paying to find proper solution, I met this solution on issue in SamVerschueren/tsd using @yarnpkg/pnpify
PR Checklist