Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(prettier): update dependency @trivago/prettier-plugin-sort-imports to v5 #848

Merged
merged 6 commits into from
Dec 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 3 additions & 5 deletions prettier/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,9 @@ RUN mkdir -p /app
WORKDIR /app
COPY package.json .
RUN yarn install && yarn cache clean
RUN cd node_modules/tailwindcss && yarn link
RUN cd node_modules/@trivago/prettier-plugin-sort-imports && yarn link
ENV PATH=/app/node_modules/.bin:$PATH
COPY prettier-with-tailwindcss /usr/local/bin/prettier-with-tailwindcss
COPY install.sh /tmp
RUN /tmp/install.sh
RUN mkdir -p /code
WORKDIR /code
ENTRYPOINT []
CMD ["prettier-with-tailwindcss", "--help"]
CMD ["prettier", "--help"]
2 changes: 1 addition & 1 deletion prettier/info.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ name: prettier
version_cmd: |
prettier --version | sed 's/^/v/; s/$/-2/'
command:
- prettier-with-tailwindcss
- prettier
- "--write"
include:
- "**/*.js"
Expand Down
30 changes: 30 additions & 0 deletions prettier/install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#!/usr/bin/env bash
set -euo pipefail

plugins=(
tailwindcss
@trivago/prettier-plugin-sort-imports
)

for plugin in "${plugins[@]}"; do
(cd /app/node_modules/"$plugin" && yarn link)
done

cat >/usr/local/bin/prettier <<EOM
#!/usr/bin/env bash
if ! yarn --offline link ${plugins[*]} >/dev/null; then
echo "Failed to link yarn modules" >&2
echo "Please report this as an issue" >&2
echo "https://github.com/restyled-io/restylers/issues" >&2
exit 1
fi

trap 'yarn --offline unlink ${plugins[*]} >/dev/null || true' EXIT

/app/node_modules/.bin/prettier "\$@"
EOM

chmod +x /usr/local/bin/prettier

# Copy as a legacy name we may see as CMD in the wild
cp /usr/local/bin/prettier{,-with-tailwindcss}
4 changes: 3 additions & 1 deletion prettier/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@
"name": "@restyled/restyler-prettier",
"version": "0.0.0",
"dependencies": {
"@trivago/prettier-plugin-sort-imports": "^4.3.0",
"@trivago/prettier-plugin-sort-imports": "^5.0.0",
"prettier": "3.4.2",
"prettier-plugin-tailwindcss": "^0.6.0",
"prettier-plugin-svelte": "^3.3.2",
"svelte": "^5.0.0",
"tailwindcss": "^3.3.2"
}
}
10 changes: 0 additions & 10 deletions prettier/prettier-with-tailwindcss

This file was deleted.

Loading