mirror of
https://github.com/creyD/prettier_action.git
synced 2026-04-15 12:50:31 +02:00
Merge pull request #34 from sebastianks/feature-add-plugins
Feature add plugins
This commit is contained in:
@@ -35,6 +35,10 @@ inputs:
|
|||||||
description: Only prettify files changed in the last commit, can't be used with file_pattern!
|
description: Only prettify files changed in the last commit, can't be used with file_pattern!
|
||||||
required: false
|
required: false
|
||||||
default: false
|
default: false
|
||||||
|
prettier_plugins:
|
||||||
|
description: Install Prettier plugins, i.e. `@prettier/prettier-php @prettier/some-other-plugin`
|
||||||
|
required: false
|
||||||
|
default: ''
|
||||||
|
|
||||||
runs:
|
runs:
|
||||||
using: 'docker'
|
using: 'docker'
|
||||||
|
|||||||
@@ -36,6 +36,19 @@ case $INPUT_PRETTIER_VERSION in
|
|||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
|
# Install plugins
|
||||||
|
if [ -n "$INPUT_PRETTIER_PLUGINS" ]; then
|
||||||
|
for plugin in $INPUT_PRETTIER_PLUGINS; do
|
||||||
|
echo "Checking plugin: $plugin"
|
||||||
|
# check regex against @prettier/xyz
|
||||||
|
if ! echo "$plugin" | grep -Eq '(@prettier\/)+(plugin-[a-z\-]+)'; then
|
||||||
|
echo "$plugin does not seem to be a valid @prettier/plugin-x plugin. Exiting."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
npm install --silent --global $INPUT_PRETTIER_PLUGINS
|
||||||
|
fi
|
||||||
|
|
||||||
echo "Prettifing files..."
|
echo "Prettifing files..."
|
||||||
echo "Files:"
|
echo "Files:"
|
||||||
prettier $INPUT_PRETTIER_OPTIONS || echo "Problem running prettier with $INPUT_PRETTIER_OPTIONS"
|
prettier $INPUT_PRETTIER_OPTIONS || echo "Problem running prettier with $INPUT_PRETTIER_OPTIONS"
|
||||||
|
|||||||
Reference in New Issue
Block a user