Skip to content

Commit ae73f4f

Browse files
committed
Cleaned up widget code
1 parent 9d1ffa9 commit ae73f4f

File tree

14 files changed

+98
-94
lines changed

14 files changed

+98
-94
lines changed

.github/workflows/pr.yaml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,3 +61,16 @@ jobs:
6161

6262
- name: Build assets
6363
run: task coding-standards:shell:check
64+
65+
check-widget-coding-standards:
66+
name: Check widget coding standards
67+
runs-on: ubuntu-latest
68+
steps:
69+
- uses: actions/checkout@v4
70+
71+
- uses: arduino/setup-task@v2
72+
with:
73+
repo-token: ${{ secrets.GITHUB_TOKEN }}
74+
75+
- name: Lint widget
76+
run: task compose -- run --rm prettier 'widget/' --check

.prettierignore

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,5 @@
1-
# Ignore Svelte stuff
2-
widget/
1+
build/
2+
3+
# Ignore some Svelte stuff
4+
widget/.svelte-kit/
5+
widget/static/

Taskfile.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,8 @@ tasks:
4545
silent: true
4646

4747
translations:extract:
48+
deps:
49+
- docker:pull
4850
cmds:
4951
- task compose -- run --rm symfony /app/task/scripts/translations-extract
5052
- task: coding-standards:yaml:apply
@@ -55,23 +57,29 @@ tasks:
5557

5658
coding-standards:apply:
5759
desc: "Apply coding standards"
60+
deps:
61+
- docker:pull
5862
cmds:
5963
- task: coding-standards:assets:apply
6064
- task: coding-standards:composer:apply
6165
- task: coding-standards:markdown:apply
6266
- task: coding-standards:php:apply
6367
- task: coding-standards:twig:apply
68+
- task: coding-standards:widget:apply
6469
- task: coding-standards:yaml:apply
6570
silent: true
6671

6772
coding-standards:check:
6873
desc: "Apply coding standards"
74+
deps:
75+
- docker:pull
6976
cmds:
7077
- task: coding-standards:assets:check
7178
- task: coding-standards:composer:check
7279
- task: coding-standards:markdown:check
7380
- task: coding-standards:php:check
7481
- task: coding-standards:twig:check
82+
- task: coding-standards:widget:check
7583
- task: coding-standards:yaml:check
7684
silent: true
7785

@@ -86,6 +94,17 @@ tasks:
8694
- task: coding-standards:assets:apply
8795
- task compose -- run --rm prettier 'assets/' --check
8896

97+
coding-standards:widget:apply:
98+
desc: "Apply coding standards for widget"
99+
cmds:
100+
- task compose -- run --rm prettier 'widget/' --write
101+
102+
coding-standards:widget:check:
103+
desc: "Apply and check coding standards for widget"
104+
cmds:
105+
- task: coding-standards:widget:apply
106+
- task compose -- run --rm prettier 'widget/' --check
107+
89108
coding-standards:composer:apply:
90109
desc: "Apply coding standards for Composer"
91110
cmds:
@@ -202,6 +221,12 @@ tasks:
202221
cmds:
203222
- "{{.APP_DOCKER_COMPOSE}} {{.CLI_ARGS}}"
204223

224+
docker:pull:
225+
cmds:
226+
- COMPOSE_PROFILES='*' task compose -- pull
227+
- COMPOSE_PROFILES='*' task compose -- build
228+
silent: true
229+
205230
default:
206231
cmds:
207232
- task --list-all

build/standalone/assets/tidy_feedback.css

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

build/standalone/tidy_feedback.min.js

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

compose.yaml

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,21 @@ services:
2525
# https://github.com/prettier/prettier/issues/15206) have an official
2626
# docker image.
2727
# https://hub.docker.com/r/jauderho/prettier is good candidate (cf. https://hub.docker.com/search?q=prettier&sort=updated_at&order=desc)
28-
image: jauderho/prettier
28+
# image: jauderho/prettier
29+
build:
30+
# Custom image to include https://github.com/sveltejs/prettier-plugin-svelte
31+
dockerfile_inline: |
32+
# https://github.com/jauderho/dockerfiles/blob/main/prettier/Dockerfile
33+
FROM node:24
34+
35+
RUN npm install -g prettier prettier-plugin-svelte
36+
37+
WORKDIR /work
38+
39+
# Help prettier find our globally installed plugin
40+
# (cf. https://github.com/prettier/prettier/issues/15141#issuecomment-2624767782)
41+
ENTRYPOINT ["prettier", "--plugin", "/usr/local/lib/node_modules/prettier-plugin-svelte/plugin.js"]
42+
CMD ["--help"]
2943
volumes:
3044
- ./:/work
3145
profiles:

docs/widget.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ When done with development, run
8282
task assets:build
8383
```
8484

85-
to build the widget for production and copy the resulting Javascript file
86-
([tidy_feedback.min.js](../widget/static/dist/standalone/tidy_feedback.min.js)) to the [`build`
87-
folder](../build/standalone) (which is under git control).
85+
to build the widget for production and copy the resulting files
86+
([tidy_feedback.min.js](../widget/static/dist/tidy_feedback.min.js) and
87+
[tidy_feedback.css](../widget/static/dist/assets/tidy_feedback.css)) to the [`build` folder](../build/standalone) (which
88+
is under git control).

widget/Taskfile.yml

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,15 +22,15 @@ tasks:
2222
- docker compose run --rm node npx standalone build --all
2323

2424
dev:
25-
desc: "Open widget dev site and start Vite dev server"
25+
desc: 'Open widget dev site and start Vite dev server'
2626
deps: [install]
2727
cmds:
2828
# https://stackoverflow.com/a/73821896
2929
# - docker compose run --env ORIGIN=http://localhost:3000 --rm --publish '{{.APP_PORT}}:{{.APP_PORT}}' node npm run dev -- --port {{.APP_PORT}} --host
3030
- docker compose run --name tidy-feedback-widget --rm --publish '{{.APP_PORT}}:{{.APP_PORT}}' node npm run dev -- --port {{.APP_PORT}} --host
3131

3232
open:
33-
desc: "Open widget dev site"
33+
desc: 'Open widget dev site'
3434
cmds:
3535
- open "{{.WIDGET_URL}}"
3636

@@ -40,14 +40,19 @@ tasks:
4040
- task npm -- install
4141
internal: true
4242

43-
lint:
44-
desc: "Apply and check widget coding standards"
43+
format:
44+
desc: 'Apply and check widget coding standards'
4545
cmds:
4646
- task npm -- run format
47+
48+
lint:
49+
desc: 'Apply and check widget coding standards'
50+
cmds:
51+
- task: format
4752
- task npm -- run lint
4853

4954
npm:
50-
desc: "Run npm command. Example: task npm -- install"
55+
desc: 'Run npm command. Example: task npm -- install'
5156
cmds:
5257
- docker compose run --rm node npm {{.CLI_ARGS}}
5358

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import { autoEmbedWithTarget } from 'svelte-standalone';
1+
import { autoEmbedOnBody } from 'svelte-standalone';
22

33
import Tidy_feedback from './index.svelte';
44

5-
autoEmbedWithTarget(Tidy_feedback, 'tidy_feedback');
5+
autoEmbedOnBody(Tidy_feedback, 'tidy_feedback');

widget/src/_standalone/tidy_feedback/styles/widget.scss

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
@use "@coreui/coreui/scss/themes/bootstrap/bootstrap";
2-
@use './variables.scss';
3-
@use './btn.scss';
1+
@use '@coreui/coreui/scss/themes/bootstrap/bootstrap';
2+
@use './variables';
3+
@use './btn';
44

55
.tidy-feedback-start {
66
position: fixed;

0 commit comments

Comments
 (0)