Skip to content
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

Create-Plugin: Ignore grafana dependencies when migrating #119

Merged
merged 1 commit into from
Oct 27, 2022

Conversation

jackw
Copy link
Collaborator

@jackw jackw commented Oct 26, 2022

What this PR does / why we need it:

This PR prevents create-plugin from updating any @grafana/ dependencies that are already listed in a plugins package.json when running npx @create-plugin migrate. Doing so should ease the pain for a plugin developer migrating without needing to edit source code to deal with typescript errors in build or test.

This feels a little tricky to implement as we rely heavily on the templates for location of dependencies and delete @grafana/** dependencies that are listed as devDependencies when they should be dependencies etc. This led me to opt for to storing references to the "original" package versions then, when calculating the NPM updates, use these references instead to keep the moving / deleting logic without changing the package versions.

Before After
Screenshot 2022-10-26 at 16 15 07 Screenshot 2022-10-26 at 16 15 20

Which issue(s) this PR fixes:

Fixes #49

Special notes for your reviewer:
Bear in mind create-plugin will still introduce @grafana dependencies with the "latest" version if they are not present in the plugins package.json. An example of this is clock-panel that has no e2e setup however during migration e2e and e2e-selectors are added along with a docker compose that reference 9.1.2. I don't really think we should get too smart with this and I'm leaning towards us adding a "next steps" document for post migration that covers these sorts of things to aid developers to make the most out of the setup create-plugin migration will provide.

@jackw jackw added dependencies Update one or more dependencies version create-plugin related to the create-plugin tool labels Oct 26, 2022
@jackw jackw added this to the v1.0.0 milestone Oct 26, 2022
@jackw jackw self-assigned this Oct 26, 2022
Copy link
Member

@academo academo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@jackw jackw merged commit 974862c into main Oct 27, 2022
@jackw jackw deleted the jackw/fix-migrate-deps branch October 27, 2022 09:45
Copy link
Collaborator

@leventebalogh leventebalogh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍

return {
dependencyUpdates,
devDependencyUpdates,
};
}

function ignoreGrafanaDependencies(dependencyUpdates: UpdateSummary, prevGrafanaDependencies: Record<string, string>) {
const whatever = Object.keys(prevGrafanaDependencies);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Whatever! 😬

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
create-plugin related to the create-plugin tool dependencies Update one or more dependencies version
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Migrate: Don't change grafana dependency versions
3 participants