Files
headlessui/scripts/lint.sh
T
Robin Malfait 8e79f1cb27 Fix Tree-shaking support (#1247)
* improve Tree Shaking in ESM

Instead of bundling everything into a single ESM file, we generate every
single file as ESM. This is what we did in 1.4.x as well.

I would expect if your library had a single ESM file and you only used 1
function that the application you use it in correctly does the
tree-shakign for you. Apparantly a lot of applications are not properly
setup for this, so let's create multiple files instead.

* update changelog
2022-03-17 17:23:29 +01:00

36 lines
785 B
Bash
Executable File

#!/usr/bin/env bash
set -e
ROOT_DIR="$(git rev-parse --show-toplevel)/"
TARGET_DIR="$(pwd)"
RELATIVE_TARGET_DIR="${TARGET_DIR/$ROOT_DIR/}"
# INFO: This script is always run from the root of the repository. If we execute this script from a
# package then the filters (in this case a path to $RELATIVE_TARGET_DIR) will be applied.
pushd $ROOT_DIR > /dev/null
prettierArgs=()
if ! [ -z "$CI" ]; then
prettierArgs+=("--check")
else
prettierArgs+=("--write")
fi
# Add default arguments
prettierArgs+=('--ignore-unknown')
# Passthrough arguments and flags
prettierArgs+=($@)
# Ensure that a path is passed, otherwise default to the current directory
if [ -z "$@" ]; then
prettierArgs+=("$RELATIVE_TARGET_DIR")
fi
# Execute
yarn prettier "${prettierArgs[@]}"
popd > /dev/null