-
Notifications
You must be signed in to change notification settings - Fork 1
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
Update rollup bundling config #33
Conversation
@@ -70,7 +70,6 @@ export function ConfigSelect(props: ConfigSelectProps) { | |||
allowCustomValue={props.allowCustomValue} | |||
autoFocus={props.autoFocus} | |||
backspaceRemovesValue={props.backspaceRemovesValue} | |||
className={props.className} |
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 removed passing the className
prop down as the current behaviour is already overriding the className (see commonProps
on line 43).
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.
Should we still be passing 'width-30'
as the className?
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's still being passed by commonProps.
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 comments are less critique and more questions. I hadn't heard of some of these concepts before, so someone else should probably also review it
src/sql/ResourceSelector.test.tsx
Outdated
@@ -24,6 +24,10 @@ describe('ResourceSelector', () => { | |||
render(<ResourceSelector {...props} default="foo" value={defaultKey} fetch={fetch} onChange={onChange} />); | |||
expect(screen.queryByText('default (foo)')).toBeInTheDocument(); | |||
|
|||
// TODO ResourceSelectorProps should be updated to make `label` required |
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.
Is this todo for in this pr or a reminder for a follow up issue?
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.
Reminder for a follow up, could potentially be done in this PR though, just have to go through the places where this component is used and make sure it can be changed to a required prop.
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.
Actually, going to leave the prop as optional to match the InlineField component's label prop. I'll remove this TODO comment and close the other PR.
@@ -70,7 +70,6 @@ export function ConfigSelect(props: ConfigSelectProps) { | |||
allowCustomValue={props.allowCustomValue} | |||
autoFocus={props.autoFocus} | |||
backspaceRemovesValue={props.backspaceRemovesValue} | |||
className={props.className} |
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.
Should we still be passing 'width-30'
as the className?
@@ -1,8 +1,8 @@ | |||
export { ConnectionConfig, ConnectionConfigProps } from './ConnectionConfig'; | |||
export { ConnectionConfig, type ConnectionConfigProps } from './ConnectionConfig'; |
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.
What does adding type here 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.
In Typescript, types are erased because js doesn't actually have the same runtime concept of types like ts. But when code is being transpiled, this export statement is actually trying to find something exported from the ConnectionConfig module, but since it's erased, it doesn't actually find anything. Adding type here indicates that it's just importing a type and there's nothing actually exported.
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.
Nice! And thanks for switching to Rollup's watcher. It's so much faster now.
How come we don't generate one index file for development and one for production anymore?
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'm not a rollup/bundling expert but this looks cool to me! Yay tree shaking!
There are a couple of neat new(ish?) things here that I didn't know about like importing just types or this React.DependencyList thing, might be cool to do a little lightning talk or something at a frontend weekly to share in case other people are interested :) I bet I'm not the only one new to it!
"dist" | ||
], | ||
"repository": "github:grafana/grafana-aws-sdk-react", | ||
"author": "Grafana Labs <[email protected]> (https://grafanap.com)", |
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.
😴
@@ -1,4 +1,4 @@ | |||
import React from 'react'; | |||
import React, { DependencyList } from 'react'; |
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 don't think I've heard of this one!
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.
👆🏻
@sunker I was following the reasoning from 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.
@sunker I was following the reasoning from the @grafana/ui config
Makes sense! Thanks
9780eb1
to
87715d7
Compare
Fixes: #30
Update rollup config to take advantage of treeshaking and esm builds.
As an example, see the config for
@grafana/ui
which is supposed to be an up-to-date config for bundling libraries.Quick manual tests with Cloudwatch, Athena, Redshift, Timestream, and X-Ray by checking the config editor and the query editor and everything still works.