Skip to content

Commit

Permalink
dev: Replace Vite by esbuild
Browse files Browse the repository at this point in the history
  • Loading branch information
marien-probesys committed Nov 4, 2024
1 parent afe751b commit 5843249
Show file tree
Hide file tree
Showing 16 changed files with 277 additions and 833 deletions.
35 changes: 0 additions & 35 deletions .vite/empty-assets-dir-plugin.js

This file was deleted.

51 changes: 0 additions & 51 deletions .vite/vite.config.js

This file was deleted.

1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,7 @@ ifndef VERSION
$(error You need to provide a "VERSION" argument)
endif
echo $(VERSION) > VERSION.txt
rm -rf public/assets
$(NPM) run build
$(EDITOR) CHANGELOG.md
git add .
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ Ideas, bug reports and contributions are welcome. Please follow [the contributin

Bileto relies on a bunch of other projects:

- [esbuild](https://esbuild.github.io/)
- [ESLint](https://eslint.org/)
- [Font Awesome icons](https://fontawesome.com)
- [Lexend Font](https://www.lexend.com/)
Expand All @@ -63,6 +64,5 @@ Bileto relies on a bunch of other projects:
- [Symfony](https://symfony.com/)
- [TinyMCE](https://www.tiny.cloud/tinymce/)
- [Turbo](https://turbo.hotwired.dev/)
- [Vite](https://vitejs.dev/)

Thanks to their authors!
46 changes: 23 additions & 23 deletions assets/javascripts/application.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,29 +5,29 @@
import * as Turbo from '@hotwired/turbo';
import { Application } from '@hotwired/stimulus';

import ButtonSelectController from '@/controllers/button_select_controller.js';
import CheckboxesController from '@/controllers/checkboxes_controller.js';
import ColorSchemeController from '@/controllers/color_scheme_controller.js';
import EditorController from '@/controllers/editor_controller.js';
import FormNewAuthorizationController from '@/controllers/form_new_authorization_controller.js';
import FormContractController from '@/controllers/form_contract_controller.js';
import FormPriorityController from '@/controllers/form_priority_controller.js';
import FormTicketActorsController from '@/controllers/form_ticket_actors_controller.js';
import InputTextsController from '@/controllers/input_texts_controller.js';
import MessageDocumentsController from '@/controllers/message_documents_controller.js';
import ModalController from '@/controllers/modal_controller.js';
import ModalOpenerController from '@/controllers/modal_opener_controller.js';
import MultiselectActorsController from '@/controllers/multiselect_actors_controller.js';
import NavigationController from '@/controllers/navigation_controller.js';
import NotificationsController from '@/controllers/notifications_controller.js';
import PasswordController from '@/controllers/password_controller.js';
import PopupController from '@/controllers/popup_controller.js';
import ScrollToController from '@/controllers/scroll_to_controller.js';
import SubmenuController from '@/controllers/submenu_controller.js';
import SwitchController from '@/controllers/switch_controller.js';
import TimelineController from '@/controllers/timeline_controller.js';
import TinymceController from '@/controllers/tinymce_controller.js';
import UserSelectorController from '@/controllers/user_selector_controller.js';
import ButtonSelectController from './controllers/button_select_controller.js';
import CheckboxesController from './controllers/checkboxes_controller.js';
import ColorSchemeController from './controllers/color_scheme_controller.js';
import EditorController from './controllers/editor_controller.js';
import FormNewAuthorizationController from './controllers/form_new_authorization_controller.js';
import FormContractController from './controllers/form_contract_controller.js';
import FormPriorityController from './controllers/form_priority_controller.js';
import FormTicketActorsController from './controllers/form_ticket_actors_controller.js';
import InputTextsController from './controllers/input_texts_controller.js';
import MessageDocumentsController from './controllers/message_documents_controller.js';
import ModalController from './controllers/modal_controller.js';
import ModalOpenerController from './controllers/modal_opener_controller.js';
import MultiselectActorsController from './controllers/multiselect_actors_controller.js';
import NavigationController from './controllers/navigation_controller.js';
import NotificationsController from './controllers/notifications_controller.js';
import PasswordController from './controllers/password_controller.js';
import PopupController from './controllers/popup_controller.js';
import ScrollToController from './controllers/scroll_to_controller.js';
import SubmenuController from './controllers/submenu_controller.js';
import SwitchController from './controllers/switch_controller.js';
import TimelineController from './controllers/timeline_controller.js';
import TinymceController from './controllers/tinymce_controller.js';
import UserSelectorController from './controllers/user_selector_controller.js';

const application = Application.start();
application.register('button-select', ButtonSelectController);
Expand Down
2 changes: 1 addition & 1 deletion assets/javascripts/controllers/modal_controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

import { Controller } from '@hotwired/stimulus';

import { FOCUSABLE_ELEMENTS } from '@/query_selectors.js';
import { FOCUSABLE_ELEMENTS } from '../query_selectors.js';

// Credits to:
// - JoliCode: https://jolicode.com/blog/une-fenetre-modale-accessible
Expand Down
2 changes: 1 addition & 1 deletion assets/javascripts/controllers/switch_controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

import { Controller } from '@hotwired/stimulus';

import { FOCUSABLE_ELEMENTS } from '@/query_selectors.js';
import { FOCUSABLE_ELEMENTS } from '../query_selectors.js';

export default class extends Controller {
static get targets () {
Expand Down
9 changes: 5 additions & 4 deletions config/services.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ parameters:
env(VERSION_FILE): '%kernel.project_dir%/VERSION.txt'

app.default_uploads_directory: '%kernel.project_dir%/uploads'
app.public_directory: "%kernel.project_dir%/public"
app.uploads_directory: '%env(default:app.default_uploads_directory:APP_UPLOADS_DIRECTORY)%'
app.version: '%env(trim:file:VERSION_FILE)%'

Expand Down Expand Up @@ -40,9 +41,9 @@ services:
arguments:
- '%kernel.project_dir%/var/data/encrypt.key'

App\Twig\ViteTagsExtension:
App\Twig\EsbuildAssetExtension:
arguments:
- "%kernel.project_dir%/public/manifest.json"
- "assets"

App\Twig\IconExtension:
arguments:
Expand All @@ -66,9 +67,9 @@ when@dev:
autowire: true
autoconfigure: true

App\Twig\ViteTagsExtension:
App\Twig\EsbuildAssetExtension:
arguments:
- "%kernel.project_dir%/public/manifest.dev.json"
- "dev_assets"

when@test:
services:
Expand Down
3 changes: 2 additions & 1 deletion docs/developers/dependencies.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,10 +78,11 @@ For major versions upgrade, please update the requirements in the file `package.
Also verify that building the assets still works:

```console
$ rm -rf public/assets
$ ./docker/bin/npm run build
```

Check the built assets work correctly by changing the path of the Twig `ViteTagsExtension` extension in the dev environment in the file [`config/services.yaml`](/config/services.yaml) (i.e. use `manifest.json` instead of `manifest.dev.json`).
Check the built assets work correctly by changing the path of the Twig `EsbuildAssetExtension` extension in the dev environment in the file [`config/services.yaml`](/config/services.yaml) (i.e. use `assets` instead of `dev_assets`).

It is also possible to perform a security audit of the dependencies with:

Expand Down
Loading

0 comments on commit 5843249

Please sign in to comment.