-
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
docs: added export size in FunctionInfo #2082
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
Conversation
const info = computed(() => functions.find(i => i.name === props.fn)) | ||
const format = (ts: number) => ago(-1, 'day') | ||
const lastUpdated = useTimeAgo(new Date(info.value?.lastUpdated || 0)) | ||
const link = computed(() => `/functions\#category=${encodeURIComponent(info.value.category)}`) | ||
|
||
axios.get('/export-size.md').then(({ data }) => exportSizeMD.value = data) |
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 probably don't want to be fetching this data on each page. Ideally it would work like the other function metadata and be fetched during build time. Maybe instead we can include function size inside of @vueuse/metadata
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.
@wheatjs Thank you for pointing that out, I placed it in metadata.ts and used fs.readFileSync.
Would you happen to know why the document is not rendering?
I can see that console logging it in metadata shows me the correct data taken from export-size.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.
I guess it's because code is being called in server and on client. There's no fs on client.
How do i put a if(process.client) ?
process here doesn't have server or client prop
haha I am not sure how to do this.
Please help :D
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.
You need to run build first and then analyse the size
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 should update
scripts/export-size.ts
to generate a JSON format report, instead of reading the markdown file. - This shouldn't be part of
@vueuse/metadata
but could be a doc-only json.
Hello @antfu, let me know if I still need to change something. |
Looks good. Thanks. |
Description
Added export size information inside FunctionInfo
What is the purpose of this pull request?