Skip to content

Commit cf0d450

Browse files
authored
Merge pull request #102 from connorabbas/develop
TS support, Github Actions, Cleanup & Improvements
2 parents 439cd70 + eee3da9 commit cf0d450

34 files changed

+2175
-313
lines changed

.github/workflows/laravel.yml

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
name: Laravel CI
2+
3+
on:
4+
push:
5+
branches: [ "master" ]
6+
pull_request:
7+
branches: [ "master" ]
8+
9+
jobs:
10+
eslint:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v4
14+
15+
- name: Setup Node.js
16+
uses: actions/setup-node@v3
17+
with:
18+
node-version: '20'
19+
cache: 'npm'
20+
21+
- name: Install Dependencies
22+
run: npm ci
23+
24+
- name: Run ESLint
25+
run: npm run lint
26+
27+
laravel:
28+
runs-on: ubuntu-latest
29+
30+
steps:
31+
- uses: actions/checkout@v4
32+
33+
- uses: shivammathur/setup-php@15c43e89cdef867065b0213be354c2841860869e
34+
with:
35+
php-version: '8.3'
36+
extensions: mbstring, xml, ctype, iconv, intl, pdo_sqlite, dom, filter, json, libxml, zip
37+
38+
- name: Copy .env
39+
run: php -r "file_exists('.env') || copy('.env.example', '.env');"
40+
41+
- name: Install PHP Dependencies
42+
run: composer install --prefer-dist --no-progress --no-interaction
43+
44+
- name: Run Pint
45+
run: vendor/bin/pint --test
46+
47+
- name: Setup Node.js
48+
uses: actions/setup-node@v3
49+
with:
50+
node-version: '20'
51+
cache: 'npm'
52+
53+
- name: Install Node Dependencies
54+
run: npm ci
55+
56+
- name: Build Frontend Assets
57+
run: npm run build
58+
59+
- name: Set Environment Variables
60+
run: |
61+
echo "APP_ENV=testing" >> .env
62+
echo "DB_CONNECTION=sqlite" >> .env
63+
echo "DB_DATABASE=database/database.sqlite" >> .env
64+
65+
- name: Generate Application Key
66+
run: php artisan key:generate
67+
68+
- name: Prepare Database
69+
run: |
70+
mkdir -p database
71+
touch database/database.sqlite
72+
73+
- name: Migrate Database
74+
env:
75+
DB_CONNECTION: sqlite
76+
DB_DATABASE: database/database.sqlite
77+
run: php artisan migrate:fresh --force
78+
79+
- name: Run Tests
80+
env:
81+
APP_ENV: testing
82+
DB_CONNECTION: sqlite
83+
DB_DATABASE: database/database.sqlite
84+
run: php artisan test

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ Homestead.yaml
1616
auth.json
1717
npm-debug.log
1818
yarn-error.log
19+
components.d.ts
1920
/.fleet
2021
/.idea
2122
/.vscode

README.md

Lines changed: 24 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,47 +1,55 @@
11
# Laravel, Inertia.js, & PrimeVue Starter Kit
2+
23
## About
3-
![Static Badge](https://img.shields.io/badge/Laravel%20-%20v11%20-%20%23f9322c) ![Static Badge](https://img.shields.io/badge/Inertia.js%20-%20v2%20-%20%236b46c1) ![Static Badge](https://img.shields.io/badge/Vue.js%20-%20v3.5%20-%20rgb(66%20184%20131)) ![Static Badge](https://img.shields.io/badge/PrimeVue%20-%20v4%20-%20rgb(16%20185%20129))
44

5+
![Static Badge](https://img.shields.io/badge/Laravel%20-%20v11%20-%20%23f9322c) ![Static Badge](https://img.shields.io/badge/Inertia.js%20-%20v2%20-%20%236b46c1) ![Static Badge](<https://img.shields.io/badge/Vue.js%20-%20v3.5%20-%20rgb(66%20184%20131)>) ![Static Badge](<https://img.shields.io/badge/PrimeVue%20-%20v4%20-%20rgb(16%20185%20129)>)
56

67
A basic authentication starter kit using [Laravel](https://laravel.com/docs/master), [Intertia.js](https://inertiajs.com/), and [PrimeVue](https://primevue.org/). An equivalent to using [Laravel Breeze](https://laravel.com/docs/master/starter-kits#laravel-breeze), but with the added benefit of all the PrimeVue components at your disposal.
78

89
Do you need a separate Vue SPA front-end instead of using Inertia.js? Consider using the [Vue SPA w/ PrimeVue & Laravel Breeze API Starter Kit](https://github.com/connorabbas/primevue-spa-laravel-api) instead.
910

1011
## Features
11-
- Same auth structure and features as Laravel Breeze with User Profile page
12-
- Need an admin panel? [There's a branch for that.](https://github.com/connorabbas/laravel-inertia-primevue/tree/feature/admin-panel)
13-
- Need SSR support? [There's a branch for that.](https://github.com/connorabbas/laravel-inertia-primevue/tree/feature/ssr)
14-
- Pre-configured [Auto Import](https://primevue.org/autoimport/) PrimeVue components
15-
- Wrapper components for PrimeVue's `Menu`, `MenuBar`, & `PanelMenu` utilizing Inertia's `Link` component
16-
- Light/Dark mode toggle
17-
- `useLazyDataTable()` composable for use with PrimeVue's `DataTable` component for easy filtering/sorting (example usage in `feature/admin-panel` branch)
18-
- Easily customizable theming
12+
13+
- Same auth structure and features as Laravel Breeze with User Profile page
14+
- Need an admin panel? [There's a branch for that.](https://github.com/connorabbas/laravel-inertia-primevue/tree/feature/admin-panel)
15+
- Need SSR support? [There's a branch for that.](https://github.com/connorabbas/laravel-inertia-primevue/tree/feature/ssr)
16+
- Pre-configured [Auto Import](https://primevue.org/autoimport/) PrimeVue components
17+
- Wrapper components for PrimeVue's `Breadcrumb`, `Menu`, `MenuBar`, & `PanelMenu` utilizing Inertia's `Link` component
18+
- Light/Dark mode toggle
19+
- `usePaginatedData()` & `useLazyDataTable()` composables for use with PrimeVue's `DataTable` component for easy pagination/filtering/sorting (example usage in `feature/admin-panel` branch)
20+
- Easily customizable theming
21+
- Configured to use TypeScript (not required)
1922

2023
## Theme
24+
2125
This starter kit provides a light/dark mode toggle by default, and custom theme functionality provided by the powerful **PrimeVue V4** theming system, using styled mode and custom design token values.
2226

2327
The starting point for customizing your theme will be the `resources/js/theme-preset.js` module file. To quickly change the look and feel of your site, swap the [primary](https://primevue.org/theming/styled/#primary) values with a different set of [colors](https://primevue.org/theming/styled/#colors), change the [surface](https://primevue.org/theming/styled/#surface) `colorScheme` values (slate, gray, neutral, etc.), or completely change the [preset theme](https://primevue.org/theming/styled/#presets) (Aura used by default).
2428

2529
Please reference the [PrimeVue Styled Mode Docs](https://primevue.org/theming/styled/) to fully understand how this system works, and how to further customize your theme to make it your own.
2630

2731
## PrimeVue v4 w/ Tailwind CSS
32+
2833
If you have used a previous version of this project using **PrimeVue V3**, you'll know that [PrimeFlex](https://primeflex.org/) was used instead of [Tailwind CSS](https://tailwindcss.com/) for utility class styling. With V4 however, the PrimeTek team has officially suggested [Moving from PrimeFlex to Tailwind CSS](https://primevue.org/guides/primeflex/).
2934

3035
For this reason PrimeFlex has been removed, and Tailwind has been added into the project, along with the [tailwindcss-primeui](https://primevue.org/tailwind/#plugin) plugin. CSS layers have also been implemented so the Tailwind utilities can [override](https://primevue.org/tailwind/#override) the PrimeVue component styling when needed.
3136

3237
---
3338

3439
## Usage with Docker
40+
3541
This starter kit is configured to use Docker Compose for local development with just a few extra steps, powered by images & configuration from [Laravel Sail](https://laravel.com/docs/master/sail). With this setup, you do not need PHP, Composer, PostgreSQL or Node.js installed on your machine to get up and running with this project.
3642

3743
### Setup
44+
3845
1. In a new directory (outside of your Laravel project) create a `docker-compose.yml` file to create a reverse proxy container using [Traefik](https://doc.traefik.io/traefik/getting-started/quick-start/). You can clone/reference this [example implementation](https://github.com/connorabbas/traefik-docker-compose/blob/master/docker-compose.yml).
3946

4047
2. Step into the directory containing the new compose file, and spin up the Traefik container:
4148
```
4249
docker compose up -d
4350
```
4451
3. Update Laravel app `.env`
52+
4553
```env
4654
# Use any desired domain ending with .localhost
4755
# Match with value used in docker-compose.local.yml
@@ -59,10 +67,12 @@ This starter kit is configured to use Docker Compose for local development with
5967
VITE_PORT=5173
6068
FORWARD_DB_PORT=5432
6169
```
62-
3. Build the Laravel app container using one of the following techniques:
63-
- Build manually using docker compose CLI (like above)
64-
- Use [Laravel Sail](https://laravel.com/docs/master/sail)
65-
- Build as a [VS Code Dev Container](https://code.visualstudio.com/docs/devcontainers/tutorial) using the `Dev Containers: Reopen in Container` command
70+
71+
4. Build the Laravel app container using one of the following techniques:
72+
- Build manually using docker compose CLI (like above)
73+
- Use [Laravel Sail](https://laravel.com/docs/master/sail)
74+
- Build as a [VS Code Dev Container](https://code.visualstudio.com/docs/devcontainers/tutorial) using the `Dev Containers: Reopen in Container` command
6675
6776
### Additional configuration
68-
If you wish to add additional services, or swap out PostgreSQL with an alternative database, you can reference the [Laravel Sail stubs](https://github.com/laravel/sail/tree/1.x/stubs) and update the `docker-compose.local.yml` file as needed.
77+
78+
If you wish to add additional services, or swap out PostgreSQL with an alternative database, you can reference the [Laravel Sail stubs](https://github.com/laravel/sail/tree/1.x/stubs) and update the `docker-compose.local.yml` file as needed.

app/Http/Controllers/Auth/NewPasswordController.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ public function create(Request $request): Response
3030
/**
3131
* Handle an incoming new password request.
3232
*
33-
* @throws \Illuminate\Validation\ValidationException
33+
* @throws ValidationException
3434
*/
3535
public function store(Request $request): RedirectResponse
3636
{

app/Http/Controllers/Auth/PasswordResetLinkController.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ public function create(): Response
2525
/**
2626
* Handle an incoming password reset link request.
2727
*
28-
* @throws \Illuminate\Validation\ValidationException
28+
* @throws ValidationException
2929
*/
3030
public function store(Request $request): RedirectResponse
3131
{

app/Http/Requests/Auth/LoginRequest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ public function rules(): array
3535
/**
3636
* Attempt to authenticate the request's credentials.
3737
*
38-
* @throws \Illuminate\Validation\ValidationException
38+
* @throws ValidationException
3939
*/
4040
public function authenticate(): void
4141
{
@@ -55,7 +55,7 @@ public function authenticate(): void
5555
/**
5656
* Ensure the login request is not rate limited.
5757
*
58-
* @throws \Illuminate\Validation\ValidationException
58+
* @throws ValidationException
5959
*/
6060
public function ensureIsNotRateLimited(): void
6161
{

bootstrap/app.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@
1212
)
1313
->withMiddleware(function (Middleware $middleware) {
1414
$middleware->web(append: [
15-
\App\Http\Middleware\HandleInertiaRequests::class,
16-
\Illuminate\Http\Middleware\AddLinkHeadersForPreloadedAssets::class,
15+
App\Http\Middleware\HandleInertiaRequests::class,
16+
Illuminate\Http\Middleware\AddLinkHeadersForPreloadedAssets::class,
1717
]);
1818

1919
//

eslint.config.js

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
// https://eslint.org/docs/latest/use/configure/
2+
// https://eslint.vuejs.org/user-guide/
3+
// https://typescript-eslint.io/rules/?=recommended
4+
5+
import eslint from '@eslint/js';
6+
import eslintConfigPrettier from 'eslint-config-prettier';
7+
import eslintPluginVue from 'eslint-plugin-vue';
8+
import globals from 'globals';
9+
import typescriptEslint from 'typescript-eslint';
10+
11+
export default typescriptEslint.config(
12+
{ ignores: ['*.d.ts', '**/coverage', '**/dist', 'vendor/**', 'public/build/**'] },
13+
{
14+
files: ['**/*.js'],
15+
...eslint.configs.recommended,
16+
languageOptions: {
17+
ecmaVersion: 'latest',
18+
sourceType: 'module',
19+
globals: {
20+
...globals.browser,
21+
process: 'readonly',
22+
module: 'readonly',
23+
require: 'readonly',
24+
Ziggy: 'readonly',
25+
window: 'readonly',
26+
},
27+
},
28+
},
29+
{
30+
files: ['**/*.{ts,vue}'],
31+
extends: [
32+
eslint.configs.recommended,
33+
...typescriptEslint.configs.recommended,
34+
...eslintPluginVue.configs['flat/recommended'],
35+
],
36+
languageOptions: {
37+
ecmaVersion: 'latest',
38+
globals: {
39+
...globals.browser,
40+
Ziggy: 'readonly',
41+
},
42+
sourceType: 'module',
43+
parserOptions: {
44+
parser: typescriptEslint.parser,
45+
},
46+
},
47+
rules: {
48+
'vue/require-default-prop': 'off',
49+
'vue/attribute-hyphenation': 'off',
50+
'vue/multi-word-component-names': 'off',
51+
'vue/block-lang': 'off',
52+
'@typescript-eslint/no-explicit-any': 'off',
53+
},
54+
},
55+
eslintConfigPrettier
56+
);

0 commit comments

Comments
 (0)