stylelint/entrypoint.sh

37 lines
701 B
Bash
Raw Permalink Normal View History

2019-08-21 16:01:23 -04:00
#!/bin/sh
set -e
2019-11-11 07:12:02 -05:00
configPath="./"
indentSpaces=2
pattern="*.css"
if [ ! -z "${CONFIG_PATH}" ]; then
configPath=$CONFIG_PATH
fi
if [ ! -z "${INDENT_SPACES}" ]; then
indent_spaces=$INDENT_SPACES
fi
if [ ! -z "${PATTERN}" ]; then
pattern=$PATTERN
fi
2019-08-21 16:01:23 -04:00
stylelint_path="node_modules/.bin/stylelint"
2019-08-21 16:01:23 -04:00
if [ ! -e stylelint_path ]; then
2019-10-25 13:35:47 -04:00
yarn add stylelint stylelint-config-standard --silent
2019-08-21 16:01:23 -04:00
fi
if [ ! "$(echo ${configPath}.stylelintrc*)" != "${configPath}.stylelintrc*" ]; then
2019-10-25 13:35:47 -04:00
echo "{
2019-08-21 16:01:23 -04:00
\"extends\": \"stylelint-config-standard\",
\"rules\": {
\"indentation\": "$indentSpaces"
2019-08-21 16:01:23 -04:00
}
}" > .stylelintrc
fi
echo "${stylelint_path}" >> $GITHUB_PATH
2019-08-21 16:01:23 -04:00
2019-11-11 07:12:02 -05:00
echo $pattern
sh -c "$stylelint_path $pattern"