generator-folklore 3.0.8 → 3.0.9
Sign up to get free protection for your applications and to get access to all the features.
- package/Readme.md +11 -5
- package/lib/generators/app/index.js +3 -0
- package/lib/generators/intl/index.js +1 -1
- package/lib/generators/laravel-auth/templates/routes/auth.php +2 -0
- package/lib/generators/laravel-panneau/templates/app/Http/Middleware/Authenticate.php +27 -0
- package/lib/generators/laravel-panneau/templates/app/Panneau/PanneauServiceProvider.php +16 -0
- package/lib/generators/laravel-panneau/templates/app/Panneau/Resources/Users.php +2 -1
- package/lib/generators/laravel-panneau/templates/routes.php +3 -1
- package/lib/generators/laravel-project/index.js +2 -2
- package/lib/generators/laravel-project/templates/laravel/app/Providers/TelescopeServiceProvider.php +67 -0
- package/lib/generators/laravel-project/templates/laravel/routes/web.php +4 -1
- package/lib/generators/react-app/templates/src/components/Container.jsx +10 -8
- package/lib/generators/stylelint/index.js +1 -1
- package/package.json +2 -2
package/Readme.md
CHANGED
@@ -1,12 +1,15 @@
|
|
1
1
|
# Folklore Generator
|
2
|
+
|
2
3
|
Yeoman generator to start projects at Folklore
|
3
4
|
|
4
5
|
## Install
|
6
|
+
|
5
7
|
```
|
6
8
|
npm install -g generator-folklore
|
7
9
|
```
|
8
10
|
|
9
11
|
## Usage
|
12
|
+
|
10
13
|
```
|
11
14
|
yo folklore
|
12
15
|
```
|
@@ -14,20 +17,23 @@ yo folklore
|
|
14
17
|
## Sub-Generators
|
15
18
|
|
16
19
|
```
|
17
|
-
yo folklore:laravel
|
20
|
+
yo folklore:laravel-project
|
18
21
|
```
|
19
|
-
|
22
|
+
|
23
|
+
Laravel boilerplate.
|
20
24
|
|
21
25
|
--
|
22
26
|
|
23
27
|
```
|
24
|
-
yo folklore:html
|
28
|
+
yo folklore:html-project
|
25
29
|
```
|
30
|
+
|
26
31
|
HTML static application
|
27
32
|
|
28
33
|
--
|
29
34
|
|
30
35
|
```
|
31
|
-
yo folklore:
|
36
|
+
yo folklore:node-project
|
32
37
|
```
|
33
|
-
|
38
|
+
|
39
|
+
Node package
|
@@ -62,7 +62,7 @@ module.exports = class IntlGenerator extends _generator.default {
|
|
62
62
|
'without-id-only': withoutIdOnly = false,
|
63
63
|
locales
|
64
64
|
} = this.options;
|
65
|
-
const intlCommand = `flklr intl --po${withoutIdOnly ? ' --without-id-only' : ''} --output-path
|
65
|
+
const intlCommand = `flklr intl --po${withoutIdOnly ? ' --without-id-only' : ''} --output-path '${outputPath}' '${translationsPath}'`;
|
66
66
|
this.packageJson.merge({
|
67
67
|
scripts: jsonPath !== null ? {
|
68
68
|
intl: 'npm run intl:build && npm run intl:copy',
|
@@ -0,0 +1,27 @@
|
|
1
|
+
<?php
|
2
|
+
|
3
|
+
namespace App\Http\Middleware;
|
4
|
+
|
5
|
+
use Illuminate\Auth\Middleware\Authenticate as Middleware;
|
6
|
+
|
7
|
+
class Authenticate extends Middleware
|
8
|
+
{
|
9
|
+
/**
|
10
|
+
* Get the path the user should be redirected to when they are not authenticated.
|
11
|
+
*
|
12
|
+
* @param \Illuminate\Http\Request $request
|
13
|
+
* @return string|null
|
14
|
+
*/
|
15
|
+
protected function redirectTo($request)
|
16
|
+
{
|
17
|
+
if (!$request->expectsJson()) {
|
18
|
+
$routeWithLocale =
|
19
|
+
route_with_locale('login') .
|
20
|
+
'?' .
|
21
|
+
http_build_query([
|
22
|
+
'next' => $request->fullUrl(),
|
23
|
+
]);
|
24
|
+
return $request->isPanneau() ? route('panneau.auth.login') : $routeWithLocale;
|
25
|
+
}
|
26
|
+
}
|
27
|
+
}
|
@@ -10,6 +10,11 @@ use Panneau\Support\LocalizedField;
|
|
10
10
|
use Folklore\Panneau\Fields\PageSlug as PageSlugField;
|
11
11
|
use Panneau\Support\Facade as Panneau;
|
12
12
|
|
13
|
+
use Illuminate\Http\Request;
|
14
|
+
use Laravel\Fortify\Fortify;
|
15
|
+
use Illuminate\Support\Facades\Hash;
|
16
|
+
use App\Models\User;
|
17
|
+
|
13
18
|
class PanneauServiceProvider extends BaseServiceProvider
|
14
19
|
{
|
15
20
|
/**
|
@@ -31,6 +36,7 @@ class PanneauServiceProvider extends BaseServiceProvider
|
|
31
36
|
{
|
32
37
|
$this->bootFields();
|
33
38
|
$this->bootViews();
|
39
|
+
$this->bootAuth();
|
34
40
|
}
|
35
41
|
|
36
42
|
protected function bootFields()
|
@@ -71,4 +77,14 @@ class PanneauServiceProvider extends BaseServiceProvider
|
|
71
77
|
$view->composer('errors::*', \App\Panneau\Composers\AppComposer::class);
|
72
78
|
});
|
73
79
|
}
|
80
|
+
|
81
|
+
protected function bootAuth()
|
82
|
+
{
|
83
|
+
Fortify::authenticateUsing(function (Request $request) {
|
84
|
+
$user = User::where('email', $request->email)->first();
|
85
|
+
if (!is_null($user) && Hash::check($request->password, $user->password)) {
|
86
|
+
return $user;
|
87
|
+
}
|
88
|
+
});
|
89
|
+
}
|
74
90
|
}
|
@@ -10,7 +10,9 @@ Panneau::router()->group(function () {
|
|
10
10
|
return app('tus-server')->serve();
|
11
11
|
})->where('any', '.*');
|
12
12
|
|
13
|
-
|
13
|
+
Route::middleware(['web'])->group(function () {
|
14
|
+
Panneau::router()->auth();
|
15
|
+
});
|
14
16
|
|
15
17
|
Route::namespace('\App\Panneau\Http\Controllers')
|
16
18
|
->middleware(['web', 'auth', 'can:view,' . \Panneau\Panneau::class])
|
@@ -297,7 +297,7 @@ module.exports = class LaravelProjectGenerator extends _generator.default {
|
|
297
297
|
if (this.options.panneau) {
|
298
298
|
this.composeWith('folklore:laravel-panneau', {
|
299
299
|
'project-name': this.options['project-name'],
|
300
|
-
'skip-install':
|
300
|
+
'skip-install': true,
|
301
301
|
quiet: true
|
302
302
|
});
|
303
303
|
} // if (this.options.auth) {
|
@@ -305,7 +305,7 @@ module.exports = class LaravelProjectGenerator extends _generator.default {
|
|
305
305
|
// 'project-name': this.options['project-name'],
|
306
306
|
// 'js-path': jsSrcPath,
|
307
307
|
// 'styles-path': stylesSrcPath,
|
308
|
-
// 'skip-install':
|
308
|
+
// 'skip-install': true,
|
309
309
|
// 'install-npm': true,
|
310
310
|
// quiet: true,
|
311
311
|
// });
|
package/lib/generators/laravel-project/templates/laravel/app/Providers/TelescopeServiceProvider.php
ADDED
@@ -0,0 +1,67 @@
|
|
1
|
+
<?php
|
2
|
+
|
3
|
+
namespace App\Providers;
|
4
|
+
|
5
|
+
use Illuminate\Support\Facades\Gate;
|
6
|
+
use Laravel\Telescope\IncomingEntry;
|
7
|
+
use Laravel\Telescope\Telescope;
|
8
|
+
use Laravel\Telescope\TelescopeApplicationServiceProvider;
|
9
|
+
|
10
|
+
class TelescopeServiceProvider extends TelescopeApplicationServiceProvider
|
11
|
+
{
|
12
|
+
/**
|
13
|
+
* Register any application services.
|
14
|
+
*
|
15
|
+
* @return void
|
16
|
+
*/
|
17
|
+
public function register()
|
18
|
+
{
|
19
|
+
// Telescope::night();
|
20
|
+
|
21
|
+
$this->hideSensitiveRequestDetails();
|
22
|
+
|
23
|
+
Telescope::filter(function (IncomingEntry $entry) {
|
24
|
+
if ($this->app->environment('local')) {
|
25
|
+
return true;
|
26
|
+
}
|
27
|
+
|
28
|
+
return $entry->isReportableException() ||
|
29
|
+
$entry->isFailedRequest() ||
|
30
|
+
$entry->isFailedJob() ||
|
31
|
+
$entry->isScheduledTask() ||
|
32
|
+
$entry->hasMonitoredTag();
|
33
|
+
});
|
34
|
+
}
|
35
|
+
|
36
|
+
/**
|
37
|
+
* Prevent sensitive request details from being logged by Telescope.
|
38
|
+
*
|
39
|
+
* @return void
|
40
|
+
*/
|
41
|
+
protected function hideSensitiveRequestDetails()
|
42
|
+
{
|
43
|
+
if ($this->app->environment('local')) {
|
44
|
+
return;
|
45
|
+
}
|
46
|
+
|
47
|
+
Telescope::hideRequestParameters(['_token']);
|
48
|
+
|
49
|
+
Telescope::hideRequestHeaders(['cookie', 'x-csrf-token', 'x-xsrf-token']);
|
50
|
+
}
|
51
|
+
|
52
|
+
/**
|
53
|
+
* Register the Telescope gate.
|
54
|
+
*
|
55
|
+
* This gate determines who can access Telescope in non-local environments.
|
56
|
+
*
|
57
|
+
* @return void
|
58
|
+
*/
|
59
|
+
protected function gate()
|
60
|
+
{
|
61
|
+
Gate::define('viewTelescope', function ($user) {
|
62
|
+
return in_array($user->email, [
|
63
|
+
//
|
64
|
+
]);
|
65
|
+
});
|
66
|
+
}
|
67
|
+
}
|
@@ -1,5 +1,6 @@
|
|
1
1
|
<?php
|
2
2
|
|
3
|
+
use Illuminate\Support\Facades\Route;
|
3
4
|
use App\Http\Controllers\HomeController;
|
4
5
|
|
5
6
|
//Redirect to current langage home
|
@@ -8,5 +9,7 @@ Route::get('/', [HomeController::class, 'redirect'])->name('home');
|
|
8
9
|
Route::groupWithLocales(function () {
|
9
10
|
Route::getTrans('/', [HomeController::class, 'index'])->nameWithLocale('home');
|
10
11
|
Route::getTrans('/test', [HomeController::class, 'index'])->nameWithLocale('test');
|
11
|
-
Route::getTrans('/test/{with_param}', [HomeController::class, 'index'])->nameWithLocale(
|
12
|
+
Route::getTrans('/test/{with_param}', [HomeController::class, 'index'])->nameWithLocale(
|
13
|
+
'test_with_param'
|
14
|
+
);
|
12
15
|
});
|
@@ -8,21 +8,23 @@ import { BrowserRouter } from 'react-router-dom';
|
|
8
8
|
import App from './App';
|
9
9
|
|
10
10
|
const propTypes = {
|
11
|
-
|
12
|
-
|
13
|
-
PropTypes.
|
14
|
-
|
15
|
-
|
11
|
+
intl: PropTypes.shape({
|
12
|
+
locale: PropTypes.string,
|
13
|
+
messages: PropTypes.oneOfType([
|
14
|
+
PropTypes.objectOf(PropTypes.objectOf(PropTypes.string)),
|
15
|
+
PropTypes.objectOf(PropTypes.string),
|
16
|
+
]),
|
17
|
+
}),
|
16
18
|
routes: PropTypes.objectOf(PropTypes.string),
|
17
19
|
};
|
18
20
|
|
19
21
|
const defaultProps = {
|
20
|
-
|
21
|
-
messages: {},
|
22
|
+
intl: null,
|
22
23
|
routes: {},
|
23
24
|
};
|
24
25
|
|
25
|
-
function Container({
|
26
|
+
function Container({ intl, routes }) {
|
27
|
+
const { locale = null, messages = null } = intl || {};
|
26
28
|
return (
|
27
29
|
<IntlProvider locale={locale} messages={messages[locale] || messages}>
|
28
30
|
<BrowserRouter>
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "generator-folklore",
|
3
|
-
"version": "3.0.
|
3
|
+
"version": "3.0.9",
|
4
4
|
"description": "Yeoman generator for projects at Folklore",
|
5
5
|
"keywords": [
|
6
6
|
"yeoman-generator"
|
@@ -40,5 +40,5 @@
|
|
40
40
|
"yeoman-generator": "^5.7.0",
|
41
41
|
"yeoman-remote": "^1.0.1"
|
42
42
|
},
|
43
|
-
"gitHead": "
|
43
|
+
"gitHead": "88e0fd31cded9ff974e5b50f4c76464ef26efb12"
|
44
44
|
}
|