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 clobbers overridden build/build:dev/dev scripts #820

Open sd2k opened 6 months ago

sd2k commented 6 months ago

Which package(s) does this bug affect?

Package versions

@grafana/create-plugin@4.2.2

What happened?

I have a custom webpack.config.ts so modified the scripts in my package.json to point to ./webpack.config.ts instead of ./.config/webpack/webpack.config.ts. When I run yarn create @grafana/plugin update, it always overrides the scripts back to using the original webpack config file.

What you expected to happen

If the scripts have been customised, they should be ignored by the update process.

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

  1. Create a plugin
  2. Modify the build script to point to a different webpack config
  3. Run yarn create @grafana/plugin update
  4. Notice that the build script has been modified

Environment

❯ npx envinfo --system --binaries --browsers --npmPackages="@grafana/*"

  System:
    OS: macOS 14.4
    CPU: (8) arm64 Apple M1
    Memory: 474.27 MB / 16.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 20.11.0 - ~/Library/Caches/fnm_multishells/30971_1710406991088/bin/node
    Yarn: 1.22.19 - ~/Library/Caches/fnm_multishells/30971_1710406991088/bin/yarn
    npm: 10.2.4 - ~/Library/Caches/fnm_multishells/30971_1710406991088/bin/npm
  Browsers:
    Chrome: 122.0.6261.129
    Firefox: 123.0.1
    Safari: 17.4
  npmPackages:
    @grafana/eslint-config: ^6.0.1 => 6.0.1


### Additional context

_No response_
sympatheticmoose commented 6 months ago

@jackw mind taking a quick look? If just needs putting on the backlog as a bug feel free to do so and remove yourself as assignee if not able to look at in the near term

jackw commented 4 months ago

This is a known issue that we're gonna need to put some thought into to help devs selectively update the various parts of their project when running the command. I'm gonna remove myself for the time being and try to get a proposal together on how that could look.