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"
|
2019-11-11 06:59:30 -05:00
|
|
|
|
|
|
|
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
|
|
|
|
2019-11-11 06:59:30 -05: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
|
|
|
|
|
2019-11-11 07:30:12 -05:00
|
|
|
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\": {
|
2019-11-11 06:59:30 -05:00
|
|
|
\"indentation\": "$indentSpaces"
|
2019-08-21 16:01:23 -04:00
|
|
|
}
|
|
|
|
}" > .stylelintrc
|
|
|
|
fi
|
|
|
|
|
2020-10-09 02:40:45 -04:00
|
|
|
echo "${stylelint_path}" >> $GITHUB_PATH
|
2019-08-21 16:01:23 -04:00
|
|
|
|
2019-11-11 07:12:02 -05:00
|
|
|
echo $pattern
|
2020-10-09 02:40:45 -04:00
|
|
|
sh -c "$stylelint_path $pattern"
|