grafana / plugin-tools

Create Grafana plugins with ease.
https://grafana.com/developers/plugin-tools/
Apache License 2.0
57 stars 30 forks source link

Bug: create plugin "update" script modifies (prettyfies) all files in plugin's directory #1131

Open cletter7 opened 6 days ago

cletter7 commented 6 days ago

Which package(s) does this bug affect?

Package versions

5.3.10

What happened?

When running npx @grafana/create-plugin@latest update command it seems it prettifies all files in the plugin directory. This creates a lot of changes which complicates the review.

What you expected to happen

Only files inside .config directory should be prettified.

How to reproduce it (as minimally and precisely as possible)

  1. Pick any plugin that doesn't have the latest config.
  2. Plugin should have some files that are not prettified (e.g. test *.jsonc files, *.md etc.).
  3. Run npx @grafana/create-plugin@latest update
  4. Observe how files outside .config folder got modified (prettified).

Environment

System: OS: macOS 15.0 CPU: (10) arm64 Apple M1 Pro Memory: 863.66 MB / 32.00 GB Shell: 5.9 - /bin/zsh Binaries: Node: 20.15.0 - ~/.nvm/versions/node/v20.15.0/bin/node Yarn: 1.22.22 - /opt/homebrew/bin/yarn npm: 10.7.0 - ~/.nvm/versions/node/v20.15.0/bin/npm Watchman: 2024.09.09.00 - /opt/homebrew/bin/watchman Browsers: Brave Browser: 128.1.69.168 Chrome: 129.0.6668.59 Safari: 18.0

Additional context

No response

jackw commented 4 days ago

Thanks for writing this up @cletter7 however I'm struggling to reproduce it in my plugin. I created a markdown file in the root of the plugin directory that prettier will act on. I ran npx -y @grafana/create-plugin@latest update from the root. It didn't run prettier over the md file. I then run npx prettier --write *.md and it formats it.

Image

Do you have a reproduction case I can take a look at?