Files
grafana/scripts/validate-npm-packages.sh
T
Josh Hunt e5087650c9 [release-12.1.3] NPM: Backport NPM publishing from main (#111997)
* Backport npm publishing workflow from main

* Ignore false-cjs in validate-npm-packages

(cherry picked from commit 6916b39439)

* Ignore untyped-resolutions for grafana-i18n in validate-npm-packages
2025-10-06 13:51:59 +01:00

24 lines
728 B
Bash
Executable File

#!/bin/bash
set -e
# This script is used to validate the npm packages that are published to npmjs.org are in the correct format.
# It won't catch things like malformed JS or Types but it will assert that the package has
# the correct files and package.json properties.
ARTIFACTS_DIR="./npm-artifacts"
for file in "$ARTIFACTS_DIR"/*.tgz; do
echo "🔍 Checking NPM package: $file"
if [[ "$file" == *"@grafana-i18n"* ]]; then
IGNORE_RULES="named-exports false-cjs untyped-resolution"
else
IGNORE_RULES="named-exports false-cjs"
fi
# shellcheck disable=SC2086
yarn attw "$file" --ignore-rules $IGNORE_RULES --profile node16
yarn publint "$file"
done
echo "🚀 All NPM package checks passed! 🚀"
exit 0