Skip to content

Commit

Permalink
Migrate from Laravel Mix to Vite (#97)
Browse files Browse the repository at this point in the history
* Add npm dependencies

* Update build scripts

* Configure Vite

* Remove `webpack.mix.js`

* Use ES modules

* Rename ENV variables

* Add PostCSS configuration for Tailwind

* Use new `@vite` Blade directive

* Ignore build assets

* feat: update node dependencies

* fix: vite run

* Fix inertia require

* Fix: remove deprecated tilde in app.css imports

* Fix: rename mix environment variable to use vite prefix

* fix: vite env import

* fix(vite build): css not found error

---------

Co-authored-by: Shift <[email protected]>
Co-authored-by: Jan Pihl <[email protected]>
Co-authored-by: jpih <[email protected]>
  • Loading branch information
4 people authored Oct 6, 2024
1 parent fa67103 commit 006289a
Show file tree
Hide file tree
Showing 19 changed files with 3,154 additions and 75,436 deletions.
6 changes: 3 additions & 3 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ APP_DEBUG=true
APP_URL=http://localhost
APP_PUBLIC_URL=http://localhost
APP_IS_VPN=false
MIX_APP_MAX_ORDER_COUNT=8
VITE_APP_MAX_ORDER_COUNT=8

APP_PORTALS_URL=http://127.0.0.1:8000
APP_PORTALS_API_SECRET=secret
Expand Down Expand Up @@ -59,8 +59,8 @@ PUSHER_APP_KEY=
PUSHER_APP_SECRET=
PUSHER_APP_CLUSTER=mt1

MIX_PUSHER_APP_KEY="${PUSHER_APP_KEY}"
MIX_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}"
VITE_PUSHER_APP_KEY="${PUSHER_APP_KEY}"
VITE_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}"

OCTANE_HTTPS=false
OCTANE_WORKERS=4
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/node_modules
/public/hot
/public/build
/public/storage
/resources/*.csv
/storage/*.key
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ RUN apk add --no-cache nodejs npm
RUN npm install

# build application
# RUN npm run production
# RUN npm run build

# install roadrunner
COPY --from=spiralscout/roadrunner:2023.3.2 /usr/bin/rr /usr/bin/rr
Expand Down
2 changes: 1 addition & 1 deletion app/Http/Controllers/PersonController.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ public function buy(Request $request, int $id, int $articleID)
$article = Article::findOrFail($articleID);

$amount = $request['amount'];
if (! is_numeric($amount) || $amount < 1 || $amount > env('MIX_APP_MAX_ORDER_COUNT')) {
if (! is_numeric($amount) || $amount < 1 || $amount > env('VITE_APP_MAX_ORDER_COUNT')) {
return Redirect::route('person.show', ['id' => $id]);
}

Expand Down
2 changes: 1 addition & 1 deletion composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11,705 changes: 3,042 additions & 8,663 deletions package-lock.json

Large diffs are not rendered by default.

16 changes: 8 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,28 +3,27 @@
"description": "Tally system for the first week of the Department of Electrical Engineering and Information Technology at FH Aachen - University of Applied Sciences.",
"version": "2.0.0",
"license": "MIT",
"type": "module",
"repository": {
"type": "git",
"url": "https://github.com/fsr5-fhaachen/strichlistensystem"
},
"scripts": {
"dev": "npm run development",
"development": "mix",
"watch": "mix watch",
"watch-poll": "mix watch -- --watch-options-poll=1000",
"hot": "mix watch --hot",
"prod": "npm run production",
"production": "mix --production"
"dev": "vite",
"build": "vite build"
},
"devDependencies": {
"autoprefixer": "^10.4.20",
"axios": "^1.7.7",
"browser-sync": "^2.26.2",
"browser-sync-webpack-plugin": "^2.3.0",
"laravel-mix": "^6.0.49",
"laravel-vite-plugin": "^1.0.5",
"lodash": "^4.17.21",
"postcss": "^8.4.47",
"tailwindcss": "^3.4.12",
"unplugin-vue-components": "^0.27.4",
"unplugin-auto-import": "^0.18.3",
"vite": "^5.4.7",
"vue-loader": "^17.4.2"
},
"dependencies": {
Expand All @@ -35,6 +34,7 @@
"@fortawesome/vue-fontawesome": "^3.0.8",
"@inertiajs/inertia": "^0.11.1",
"@inertiajs/inertia-vue3": "^0.6.0",
"@vitejs/plugin-vue": "^5.1.4",
"@vueuse/core": "^11.1.0",
"nprogress": "^0.2.0",
"postcss-import": "^16.1.0",
Expand Down
6 changes: 6 additions & 0 deletions postcss.config.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
module.exports = {
plugins: {
tailwindcss: {},
autoprefixer: {},
},
}
Loading

0 comments on commit 006289a

Please sign in to comment.