daml/sdk/pre-commit/yarn-lock-check.sh
Raphael Speyer f7faf1e1f5
HOTFIX: fix precommit for main (#18863)
* HOTFIX: fix precommit (#18854)

* fix precommit

* avoid moving package.json

---------

Co-authored-by: = <=>

* fix yarn-lock-check precommit

---------

Co-authored-by: = <=>
2024-03-26 07:55:20 +01:00

19 lines
520 B
Bash
Executable File

#!/usr/bin/env bash
# Copyright (c) 2024 Digital Asset (Switzerland) GmbH and/or its affiliates. All rights reserved.
# SPDX-License-Identifier: Apache-2.0
set -euo pipefail
TMP_DIR=$(mktemp -d)
trap 'rm -rf -- "$TMP_DIR"' EXIT
cp sdk/package.json sdk/yarn.lock $TMP_DIR
(cd $TMP_DIR; yarn install --silent > /dev/null)
if ! diff -u sdk/yarn.lock $TMP_DIR/yarn.lock; then
echo "FAIL: yarn.lock could not satisfy package.json" 1>&2
echo "FAIL: yarn.lock requires all of the above changes" 1>&2
exit 1
fi