Patrick Williams | 91f8ad3 | 2020-12-29 17:19:12 -0600 | [diff] [blame] | 1 | #!/bin/bash |
Derick Montague | bf2131f | 2020-05-29 11:21:36 -0500 | [diff] [blame] | 2 | # Run GUI Linting and Formatting as part of the CI Build process |
| 3 | # |
| 4 | # This is a short term solution. The long term solution to will be to |
| 5 | # add much of this to the build script. |
| 6 | # |
| 7 | |
| 8 | set -e |
| 9 | |
Patrick Williams | 91f8ad3 | 2020-12-29 17:19:12 -0600 | [diff] [blame] | 10 | # When called from openbmc-build-scripts, the `pwd` could be anywhere, but |
| 11 | # the root of the repo is passed in the first argument. Switch to the repo |
| 12 | # root so npm/git run in the right place. |
| 13 | if [ -n "$1" ]; then |
| 14 | cd "$1" |
| 15 | fi |
| 16 | |
Ed Tanous | 02e1497 | 2024-02-27 12:59:56 -0800 | [diff] [blame] | 17 | npm install |
Derick Montague | bf2131f | 2020-05-29 11:21:36 -0500 | [diff] [blame] | 18 | npm run lint |
Ed Tanous | 02e1497 | 2024-02-27 12:59:56 -0800 | [diff] [blame] | 19 | |
| 20 | # CI might be running a different version of NPM than yocto, and we don't |
| 21 | # want to trigger a formatting failure if package-lock.json has changed |
| 22 | # Therefore, revert it back to what it was previously. |
| 23 | git checkout package-lock.json |
Patrick Williams | 91f8ad3 | 2020-12-29 17:19:12 -0600 | [diff] [blame] | 24 | git --no-pager diff --exit-code |