grafana-cli: Diff generated ts directly instead of relying on git (#45815) (#45828)

* Add diffing support to grafana-cli cue gen-ts

* Rely on diff comparison in cuetsify pipeline step

* Ignore *.gen.ts files with eslint

* Chore: Fix lint `sdboyer/cuetsify-compare` (#45818)

* Sync drone

(cherry picked from commit 40645ab19e39ff9b0a12b7ebb13a4dc4c5e1d472)

* Fix lint

(cherry picked from commit c95ece983984432fea029335b2b729b09d76c7eb)

* Sign drone

Co-authored-by: Dimitris Sotirakis <sotirakis.dim@gmail.com>
(cherry picked from commit 60db643983)

Co-authored-by: sam boyer <sdboyer@grafana.com>
This commit is contained in:
Dimitris Sotirakis
2022-02-24 12:25:59 +01:00
committed by GitHub
co-authored by sam boyer
parent f443777309
commit 3734b455d7
6 changed files with 97 additions and 101 deletions
+4 -11
View File
@@ -1134,18 +1134,11 @@ def ensure_cuetsified_step():
'validate-scuemata',
],
'commands': [
'# Make sure the git tree is clean.',
'# Stashing changes, since packages that were produced in build-backend step are needed.',
'git stash',
'./bin/linux-amd64/grafana-cli cue gen-ts --grafana-root .',
'# The above command generates Typescript files (*.gen.ts) from all appropriate .cue files.',
'# It is required that the generated Typescript be in sync with the input CUE files.',
'# ...Modulo eslint auto-fixes...:',
'yarn run eslint . --ext .gen.ts --fix',
'# If any filenames are emitted by the below script, run the generator command `grafana-cli cue gen-ts` locally and commit the result.',
'./scripts/clean-git-or-error.sh',
'# Un-stash changes.',
'git stash pop',
'# To enforce this, the following command will attempt to generate Typescript from all',
'# appropriate .cue files, then compare with the corresponding (*.gen.ts) file the generated',
'# code would have been written to. It exits 1 if any diffs are found.',
'./bin/linux-amd64/grafana-cli cue gen-ts --grafana-root . --diff',
],
}