This commit is contained in:
2025-10-25 20:11:21 +02:00
commit fd37421245
700 changed files with 211892 additions and 0 deletions

View File

@@ -0,0 +1,108 @@
---
created: 2025-02-12 12:01
updated: 2025-07-04 07:27
tags:
- Laravel/Packages
---
# Install / update
```bash
npm uninstall @flareapp/flare-client @flareapp/flare-vue @flareapp/js @flareapp/vite @flareapp/vite-plugin-sourcemap-uploader @flareapp/vue
```
```bash
npm install @flareapp/js @flareapp/vue @flareapp/vite
```
```bash
composer require spatie/laravel-activitylog spatie/laravel-ignition
```
```js flare.js
import {flare} from "@flareapp/js";
flare.beforeSubmit = (report) => {
// Filter out errors that are not useful
if ([
'Request failed with status code 401',
'Network Error',
'Failed to fetch dynamically imported module',
'is not a valid JavaScript MIME type',
'Unable to preload CSS',
'Request aborted',
'Importing a module script failed.',
].some(v => report.message.includes(v))) {
return false;
}
// Filter silly bots
if ([
'adsbot',
'googlebot'
].some(v => report.context.request.useragent.includes(v))) {
return false;
}
return report;
};
export default flare;
```
```js app.js
import {flareVue} from "@flareapp/vue";
import flare from './plugins/flare';
if (import.meta.env.PROD) {
flare.light();
}
// createApp()
.use(flareVue)
//. .mount(el)
```
```js vite.config.js
import flareSourcemapUploader from '@flareapp/vite';
return {
plugins: [
// bla
flareSourcemapUploader({
key: env.VITE_FLARE_KEY,
}),
],
};
```
```php AppServiceProvider
private function versionStuff(): void
{
\Illuminate\Support\Facades\App::macro('getVersion', function () {
if (app()->isLocal()) {
return time();
}
if (file_exists(base_path('commit_hash.txt'))) {
return trim(file_get_contents(base_path('commit_hash.txt')));
}
return md5(base_path());
});
\Illuminate\Support\Facades\Cache::macro('getVersion', function () {
return app()->isLocal() ? time() : \Illuminate\Support\Facades\Cache::remember('version', now()->addDay(), fn() => App::getVersion());
});
\Spatie\LaravelIgnition\Facades\Flare::determineVersionUsing(function () {
return \Illuminate\Support\Facades\Cache::getVersion();
});
}
private function startLogBatch(): void
{
if (!\Spatie\Activitylog\Facades\LogBatch::isOpen()) {
\Spatie\Activitylog\Facades\LogBatch::startBatch();
\Illuminate\Support\Facades\Context::add('batch_uuid', \Spatie\Activitylog\Facades\LogBatch::getUuid());
}
}
```