-
-
Notifications
You must be signed in to change notification settings - Fork 9.4k
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
Vue: Enhance Support for vue-component-meta with tsconfig References #26698
Vue: Enhance Support for vue-component-meta with tsconfig References #26698
Conversation
☁️ Nx Cloud ReportCI is running/has finished running commands for commit 5aab872. As they complete they will appear below. Click to see the status, the terminal output, and the build insights. 📂 See all runs for this CI Pipeline Execution ✅ Successfully ran 1 targetSent with 💌 from NxCloud. |
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.
Thank you, @larsrickert, for providing the workaround. Additionally, your open issue regarding vue language-tools is noted. I'm currently seeking feedback from @johnsoncodehk on this matter. Meanwhile, I'll conduct some tests before granting approval. However, I'm inclined to change the function name ..WithWorkaround
, so I'll be working on finding a suitable implementation for that adjustment.
I believe the correct approach is to provide a valid tsconfig to the checker directly. Therefore, what we've implemented, suggested by @larsrickert, isn't a workaround but rather our first solution. This involves explicitly passing the valid tsconfig in main.ts. Another, more ideal option would be to create a lookup manager that automatically locates a valid tsconfig for a .vue file from references in case we have it |
so @larsrickert it is not vue-componet-meta limitation it is meant to be like that we got a response from Johson |
@chakAs3 I updated the docs, hopefully its clearer now that it is the recommended solution |
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.
@larsrickert, appreciate you taking the time to create this pull request and helping us by including the necessary documentation 🙏 ! I left a small suggestion for you to look into regarding the documentation when you can.
Let me know once you've addressed it, and I'll gladly take another look.
Looking forward to hearing from you.
Hope you have a fantastic day.
Stay safe
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.
LGTM
Or perhaps this is a bit off-topic, could we add a prompt to inform users that setting |
I would like to take a look at this separately. Once this PR is merged, we can check if setting the tsconfig improves performance, otherwise we need to take a look at the performance issues in more detail |
@kasperpeulen Hey :) I assumed this PR would be included in version 8.1 yesterday but it seems like it isn't. |
@larsrickert The problem is that this PR (and a couple others) mistakenly targeted and was merged to |
I double checked it, it is in fact released. It is only missing in the changelog, thats what caused my confusing :D |
What I did
We need to pass a valid
tsconfig
file tovue-component-meta
to work correctly.When using tsconfig references in the default
tsconfig.json
, the user must explicitly set which tsconfig to use, otherwise docgen might be broken or not work correctly.I added a framework option to change the tsconfig that
vue-component-meta
uses.Note: The setup shown in the example below is actually pretty common since its the default that you get from the official Vue starter CLI.
Example:
Show example
tsconfig.json
tsconfig.app.json
tsconfig.node.json not relevant for this example
Checklist for Contributors
Testing
The changes in this PR are covered in the following automated tests:
Manual testing
This section is mandatory for all contributions. If you believe no manual test is necessary, please state so explicitly. Thanks!
yarn task --task sandbox --start-from auto --template vue3-vite/default-ts
sandbox/vue3-vite-default.ts
, replacetsconfig.json
with:sandbox/vue3-vite-default.ts
, create `tsconfig.app.json with:src/stories/Header.vue
, move the prop type tosrc/stories/types.ts
and import it from@/stories/types
vue-component-meta
does not resolve the references so it does not consider the@/
import alias.storybook/main.ts
, add framework option:Documentation
MIGRATION.MD
Checklist for Maintainers
When this PR is ready for testing, make sure to add
ci:normal
,ci:merged
orci:daily
GH label to it to run a specific set of sandboxes. The particular set of sandboxes can be found incode/lib/cli/src/sandbox-templates.ts
Make sure this PR contains one of the labels below:
Available labels
bug
: Internal changes that fixes incorrect behavior.maintenance
: User-facing maintenance tasks.dependencies
: Upgrading (sometimes downgrading) dependencies.build
: Internal-facing build tooling & test updates. Will not show up in release changelog.cleanup
: Minor cleanup style change. Will not show up in release changelog.documentation
: Documentation only changes. Will not show up in release changelog.feature request
: Introducing a new feature.BREAKING CHANGE
: Changes that break compatibility in some way with current major version.other
: Changes that don't fit in the above categories.🦋 Canary release
This PR does not have a canary release associated. You can request a canary release of this pull request by mentioning the
@storybookjs/core
team here.core team members can create a canary release here or locally with
gh workflow run --repo storybookjs/storybook canary-release-pr.yml --field pr=<PR_NUMBER>