Skip to content
This repository was archived by the owner on Oct 20, 2025. It is now read-only.

Commit b9e924d

Browse files
authored
SSR (#16)
1 parent b8d9d4b commit b9e924d

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+2984
-1791
lines changed

.eslintrc.cjs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,8 @@ module.exports = {
1212
"vue/require-default-prop": 0,
1313
"indent": ["error", 4],
1414
"quotes": ["error", "double"],
15+
"object-curly-spacing": ["error", "always"],
16+
"semi": ["error", "always"],
17+
"comma-spacing": ["error", { "before": false, "after": true }]
1518
}
16-
}
19+
};

.github/workflows/run-tests.yml

Lines changed: 68 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,10 @@ jobs:
1010
matrix:
1111
php: [8.1, 8.0]
1212
laravel: [9.*]
13+
ssr: [true, false]
1314
dependency-version: [prefer-lowest, prefer-stable]
1415

15-
name: P${{ matrix.php }} - ${{ matrix.dependency-version }}
16+
name: Test P${{ matrix.php }} - L${{ matrix.laravel }} - SSR ${{ matrix.ssr }} - ${{ matrix.dependency-version }}
1617

1718
steps:
1819
- name: Checkout code
@@ -75,12 +76,24 @@ jobs:
7576
cd app
7677
php artisan websockets:serve &
7778
79+
- name: Start SSR server
80+
run: |
81+
cd app
82+
sed -i -e "s|SPLADE_SSR_ENABLED=false|SPLADE_SSR_ENABLED=true|g" .env
83+
node bootstrap/ssr/ssr.js &
84+
if: matrix.ssr == true
85+
7886
- name: Run Laravel Server
7987
run: |
8088
cd app
8189
php artisan serve &
8290
83-
- name: Execute tests
91+
- name: Execute Feature/Unit tests
92+
run: |
93+
cd app
94+
php artisan test
95+
96+
- name: Execute Dusk tests
8497
run: |
8598
cd app
8699
php artisan dusk
@@ -112,3 +125,56 @@ jobs:
112125
with:
113126
name: logs
114127
path: app/storage/logs
128+
129+
stub-tests:
130+
runs-on: ubuntu-latest
131+
132+
strategy:
133+
fail-fast: true
134+
matrix:
135+
php: [8.1, 8.0]
136+
laravel: [9.*]
137+
dependency-version: [prefer-lowest, prefer-stable]
138+
139+
name: Test Stubs P${{ matrix.php }} - L${{ matrix.laravel }} - ${{ matrix.dependency-version }}
140+
141+
steps:
142+
- name: Setup PHP
143+
uses: shivammathur/setup-php@v2
144+
with:
145+
php-version: ${{ matrix.php }}
146+
extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, bcmath, soap, intl, gd, exif, iconv, imagick, mysql, mysqli, pdo_mysql
147+
coverage: none
148+
149+
- name: Setup Laravel
150+
run: |
151+
composer create-project laravel/laravel:^9 .
152+
composer require protonemedia/laravel-splade
153+
rm -rf vendor/protonemedia/laravel-splade
154+
155+
- name: Checkout code
156+
uses: actions/checkout@v2
157+
with:
158+
path: "vendor/protonemedia/laravel-splade"
159+
160+
- name: Install Splade
161+
run: |
162+
composer dump
163+
php artisan splade:install
164+
165+
- name: Install NPM dependencies
166+
run: |
167+
npm i
168+
rm -rf node_modules/@protonemedia/laravel-splade/dist
169+
cp -R vendor/protonemedia/laravel-splade/dist node_modules/@protonemedia/laravel-splade/
170+
171+
- name: Compile assets
172+
run: npm run build
173+
174+
- name: Start SSR server
175+
run: |
176+
echo "SPLADE_SSR_ENABLED=true" >> .env
177+
node bootstrap/ssr/ssr.mjs &
178+
179+
- name: Run Test command
180+
run: php artisan splade:ssr-test

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,4 @@ testbench.yaml
1111
vendor
1212
node_modules
1313
protonemedia-laravel-splade-*.tgz
14+
app/bootstrap/ssr*

app/.env.example

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,3 +45,5 @@ VITE_PUSHER_PORT="${PUSHER_PORT}"
4545
VITE_PUSHER_SCHEME="${PUSHER_SCHEME}"
4646
VITE_PUSHER_HOST="${PUSHER_HOST}"
4747
VITE_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}"
48+
49+
SPLADE_SSR_ENABLED=false

app/app/Http/Controllers/EventController.php

Lines changed: 0 additions & 36 deletions
This file was deleted.

app/package-lock.json

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

app/package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,10 @@
22
"private": true,
33
"scripts": {
44
"dev": "vite",
5-
"build": "vite build"
5+
"build": "vite build && vite build --ssr"
66
},
77
"devDependencies": {
8+
"@protonemedia/laravel-splade": "file:../protonemedia-laravel-splade-0.1.2.tgz",
89
"@tailwindcss/forms": "^0.5.2",
910
"@tailwindcss/typography": "^0.5.2",
1011
"@vitejs/plugin-vue": "^2.3.3",
@@ -17,7 +18,6 @@
1718
"pusher-js": "^7.2.0",
1819
"tailwindcss": "^3.1.0",
1920
"vite": "^2.9.11",
20-
"vue": "^3.2.37",
21-
"@protonemedia/laravel-splade": "file:../protonemedia-laravel-splade-0.1.2.tgz"
21+
"vue": "^3.2.37"
2222
}
2323
}

app/phpunit.xml.dist

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="./vendor/phpunit/phpunit/phpunit.xsd" bootstrap="vendor/autoload.php" colors="true">
3+
<testsuites>
4+
<testsuite name="Unit">
5+
<directory suffix="Test.php">./tests/Unit</directory>
6+
</testsuite>
7+
<testsuite name="Feature">
8+
<directory suffix="Test.php">./tests/Feature</directory>
9+
</testsuite>
10+
</testsuites>
11+
<coverage processUncoveredFiles="true">
12+
<include>
13+
<directory suffix=".php">./app</directory>
14+
</include>
15+
</coverage>
16+
<php>
17+
<env name="APP_ENV" value="testing"/>
18+
<env name="BCRYPT_ROUNDS" value="4"/>
19+
<env name="CACHE_DRIVER" value="array"/>
20+
<env name="DB_CONNECTION" value="sqlite"/>
21+
<env name="MAIL_MAILER" value="array"/>
22+
<env name="QUEUE_CONNECTION" value="sync"/>
23+
<env name="SESSION_DRIVER" value="array"/>
24+
<env name="TELESCOPE_ENABLED" value="false"/>
25+
</php>
26+
</phpunit>

app/resources/js/app.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
1-
import './bootstrap';
2-
import '../css/app.css';
1+
import "./bootstrap";
2+
import "../css/app.css";
33

4-
import { createApp } from 'vue'
4+
import { createApp } from "vue";
55

66
// for dev
7-
// import { renderSpladeApp, SpladePlugin } from '../../../dist/protone-media-laravel-splade'
7+
// import { renderSpladeApp, SpladePlugin } from "../../../dist/protone-media-laravel-splade";
88

99
// for build
10-
import { renderSpladeApp, SpladePlugin } from '@protonemedia/laravel-splade'
10+
import { renderSpladeApp, SpladePlugin } from "@protonemedia/laravel-splade";
1111

12-
const el = document.getElementById('app')
12+
const el = document.getElementById("app");
1313

1414
createApp({
1515
render: renderSpladeApp({ el })
1616
})
1717
.use(SpladePlugin, {
18-
'max_keep_alive': 10,
19-
'transform_anchors': false,
18+
"max_keep_alive": 10,
19+
"transform_anchors": false,
2020
})
2121
.mount(el);

0 commit comments

Comments
 (0)