generator-folklore 3.0.6 → 3.0.7
Sign up to get free protection for your applications and to get access to all the features.
- package/lib/generators/build/index.js +1 -1
- package/lib/generators/eslint/index.js +1 -1
- package/lib/generators/intl/index.js +1 -1
- package/lib/generators/laravel-mediatheque/index.js +18 -0
- package/lib/generators/laravel-mediatheque/instructions/ServiceProvider.php +26 -0
- package/lib/generators/laravel-panneau/index.js +45 -5
- package/lib/generators/laravel-panneau/instructions/ServiceProvider.php +21 -0
- package/lib/generators/laravel-panneau/instructions/config.php +13 -0
- package/lib/generators/laravel-panneau/templates/app/Contracts/Repositories/Pages.php +2 -2
- package/lib/generators/laravel-panneau/templates/app/Contracts/Resources/Blocks/Image.php +15 -0
- package/lib/generators/laravel-panneau/templates/app/Contracts/Resources/Blocks/Text.php +2 -0
- package/lib/generators/laravel-panneau/templates/app/Models/Block.php +1 -0
- package/lib/generators/laravel-panneau/templates/app/Panneau/Fields/.gitkeep +0 -0
- package/lib/generators/laravel-panneau/templates/app/Panneau/Http/Resources/BlocksCollection.php +2 -0
- package/lib/generators/laravel-panneau/templates/app/Panneau/Http/Resources/UsersCollection.php +10 -0
- package/lib/generators/laravel-panneau/templates/app/Panneau/PanneauServiceProvider.php +30 -4
- package/lib/generators/laravel-panneau/templates/app/Panneau/Resources/Blocks/ImageBlock.php +30 -0
- package/lib/generators/laravel-panneau/templates/app/Panneau/Resources/Blocks/TextBlock.php +3 -2
- package/lib/generators/laravel-panneau/templates/app/Panneau/Resources/Blocks.php +4 -1
- package/lib/generators/laravel-panneau/templates/app/Panneau/Resources/Pages/Page.php +2 -2
- package/lib/generators/laravel-panneau/templates/app/Panneau/Resources/Pages.php +2 -2
- package/lib/generators/laravel-panneau/templates/app/Repositories/Pages.php +2 -2
- package/lib/generators/laravel-panneau/templates/app/Resources/Blocks/ImageBlock.php +27 -0
- package/lib/generators/laravel-panneau/templates/app/Resources/Blocks/TextBlock.php +6 -1
- package/lib/generators/laravel-panneau/templates/config.php +29 -0
- package/lib/generators/laravel-panneau/templates/index.js +1 -1
- package/lib/generators/laravel-panneau/templates/lang/en/panneau.php +4 -0
- package/lib/generators/laravel-panneau/templates/lang/fr/panneau.php +4 -0
- package/lib/generators/laravel-panneau/templates/resources/assets/js/components/panneau/fields/PageSlug.jsx +68 -0
- package/lib/generators/laravel-project/index.js +27 -12
- package/lib/generators/laravel-project/templates/laravel/app/Contracts/Repositories/Users.php +17 -0
- package/lib/generators/laravel-project/templates/laravel/app/Models/User.php +0 -30
- package/lib/generators/laravel-project/templates/laravel/app/Providers/AppServiceProvider.php +90 -15
- package/lib/generators/laravel-project/templates/laravel/app/Repositories/Users.php +4 -3
- package/lib/generators/laravel-project/templates/laravel/config/app.php +2 -2
- package/lib/generators/laravel-project/templates/laravel/config/image.php +204 -0
- package/lib/generators/prettier/index.js +1 -1
- package/lib/generators/react-app/index.js +2 -2
- package/lib/generators/stylelint/index.js +1 -1
- package/package.json +5 -4
- package/lib/generators/laravel-panneau/templates/app/Panneau/Fields/Block.php +0 -22
- package/lib/generators/laravel-panneau/templates/app/Panneau/Fields/Blocks.php +0 -87
- package/lib/generators/laravel-panneau/templates/app/Panneau/Fields/Page.php +0 -51
- package/lib/generators/laravel-panneau/templates/app/Panneau/Fields/PageSlug.php +0 -34
- package/lib/generators/laravel-panneau/templates/app/Panneau/Fields/PageSlugLocalized.php +0 -18
- package/lib/generators/laravel-panneau/templates/app/Panneau/Resources/Blocks/BlockWithBlocks.php +0 -110
@@ -289,19 +289,18 @@ module.exports = class LaravelProjectGenerator extends _generator.default {
|
|
289
289
|
if (this.options.mediatheque) {
|
290
290
|
this.composeWith('folklore:laravel-mediatheque', {
|
291
291
|
'project-name': this.options['project-name'],
|
292
|
-
'skip-install': true
|
292
|
+
'skip-install': true,
|
293
|
+
quiet: true
|
293
294
|
});
|
294
|
-
}
|
295
|
-
|
296
|
-
|
297
|
-
|
298
|
-
|
299
|
-
|
300
|
-
|
301
|
-
|
302
|
-
//
|
303
|
-
// }
|
304
|
-
// if (this.options.auth) {
|
295
|
+
}
|
296
|
+
|
297
|
+
if (this.options.panneau) {
|
298
|
+
this.composeWith('folklore:laravel-panneau', {
|
299
|
+
'project-name': this.options['project-name'],
|
300
|
+
'skip-install': skipInstall,
|
301
|
+
quiet: true
|
302
|
+
});
|
303
|
+
} // if (this.options.auth) {
|
305
304
|
// this.composeWith('folklore:laravel-auth', {
|
306
305
|
// 'project-name': this.options['project-name'],
|
307
306
|
// 'js-path': jsSrcPath,
|
@@ -368,6 +367,14 @@ module.exports = class LaravelProjectGenerator extends _generator.default {
|
|
368
367
|
'folklore/laravel-folklore': 'v1.x-dev',
|
369
368
|
'folklore/laravel-locale': 'v8.x-dev',
|
370
369
|
'folklore/laravel-image': 'v1.x-dev'
|
370
|
+
},
|
371
|
+
'require-dev': {
|
372
|
+
'laravel/telescope': '^4.0.0'
|
373
|
+
},
|
374
|
+
extra: {
|
375
|
+
laravel: {
|
376
|
+
'dont-discover': ['laravel/telescope']
|
377
|
+
}
|
371
378
|
}
|
372
379
|
});
|
373
380
|
},
|
@@ -490,6 +497,14 @@ module.exports = class LaravelProjectGenerator extends _generator.default {
|
|
490
497
|
await this.spawnCommand('php', ['artisan', 'vendor:publish', '--provider=Folklore\\Image\\ServiceProvider']);
|
491
498
|
},
|
492
499
|
|
500
|
+
async telescope() {
|
501
|
+
if (this.options['skip-install']) {
|
502
|
+
return;
|
503
|
+
}
|
504
|
+
|
505
|
+
await this.spawnCommand('php', ['artisan', 'telescope:install']);
|
506
|
+
},
|
507
|
+
|
493
508
|
async valet() {
|
494
509
|
if (this.options['skip-install']) {
|
495
510
|
return;
|
@@ -0,0 +1,17 @@
|
|
1
|
+
<?php
|
2
|
+
|
3
|
+
namespace App\Contracts\Repositories;
|
4
|
+
|
5
|
+
use Folklore\Contracts\Repositories\Users as BaseUsers;
|
6
|
+
use App\Contracts\Resources\User as UserResource;
|
7
|
+
|
8
|
+
interface Users extends BaseUsers
|
9
|
+
{
|
10
|
+
public function findById(string $id): ?UserResource;
|
11
|
+
|
12
|
+
public function findByEmail(string $email): ?UserResource;
|
13
|
+
|
14
|
+
public function create($data): UserResource;
|
15
|
+
|
16
|
+
public function update(string $id, $data): ?UserResource;
|
17
|
+
}
|
@@ -13,36 +13,6 @@ class User extends BaseUser
|
|
13
13
|
{
|
14
14
|
use HasApiTokens, HasFactory;
|
15
15
|
|
16
|
-
/**
|
17
|
-
* The attributes that are mass assignable.
|
18
|
-
*
|
19
|
-
* @var array<int, string>
|
20
|
-
*/
|
21
|
-
protected $fillable = [
|
22
|
-
'name',
|
23
|
-
'email',
|
24
|
-
'password',
|
25
|
-
];
|
26
|
-
|
27
|
-
/**
|
28
|
-
* The attributes that should be hidden for serialization.
|
29
|
-
*
|
30
|
-
* @var array<int, string>
|
31
|
-
*/
|
32
|
-
protected $hidden = [
|
33
|
-
'password',
|
34
|
-
'remember_token',
|
35
|
-
];
|
36
|
-
|
37
|
-
/**
|
38
|
-
* The attributes that should be cast.
|
39
|
-
*
|
40
|
-
* @var array<string, string>
|
41
|
-
*/
|
42
|
-
protected $casts = [
|
43
|
-
'email_verified_at' => 'datetime',
|
44
|
-
];
|
45
|
-
|
46
16
|
public function toResource(): UserContract
|
47
17
|
{
|
48
18
|
return new UserResource($this);
|
package/lib/generators/laravel-project/templates/laravel/app/Providers/AppServiceProvider.php
CHANGED
@@ -6,9 +6,66 @@ use Illuminate\Support\ServiceProvider;
|
|
6
6
|
use Illuminate\Support\Facades\Schema;
|
7
7
|
use Illuminate\Http\Resources\Json\JsonResource;
|
8
8
|
use Illuminate\Http\Request;
|
9
|
+
use Illuminate\Support\Arr;
|
9
10
|
|
10
11
|
class AppServiceProvider extends ServiceProvider
|
11
12
|
{
|
13
|
+
/**
|
14
|
+
* Register any application services.
|
15
|
+
*
|
16
|
+
* @return void
|
17
|
+
*/
|
18
|
+
public function register()
|
19
|
+
{
|
20
|
+
$this->registerRepositories();<% if (options.mediatheque) { %>
|
21
|
+
$this->registerMediatheque();<% } %>
|
22
|
+
$this->registerTelescope();
|
23
|
+
}
|
24
|
+
|
25
|
+
protected function registerRepositories()
|
26
|
+
{
|
27
|
+
$this->app->bind(
|
28
|
+
\Folklore\Contracts\Repositories\Users::class,
|
29
|
+
\App\Repositories\Users::class
|
30
|
+
);
|
31
|
+
|
32
|
+
$this->app->bind(
|
33
|
+
\App\Contracts\Repositories\Users::class,
|
34
|
+
\App\Repositories\Users::class
|
35
|
+
);<% if (options.panneau) { %>
|
36
|
+
|
37
|
+
$this->app->bind(
|
38
|
+
\Folklore\Contracts\Repositories\Pages::class,
|
39
|
+
\App\Repositories\Pages::class
|
40
|
+
);
|
41
|
+
|
42
|
+
$this->app->bind(
|
43
|
+
\App\Contracts\Repositories\Pages::class,
|
44
|
+
\App\Repositories\Pages::class
|
45
|
+
);<% } %>
|
46
|
+
}<% if (options.mediatheque) { %>
|
47
|
+
|
48
|
+
protected function registerMediatheque()
|
49
|
+
{
|
50
|
+
$this->app->bind(
|
51
|
+
\Folklore\Mediatheque\Contracts\Models\Media::class,
|
52
|
+
\App\Models\Media::class
|
53
|
+
);
|
54
|
+
|
55
|
+
$this->app->bind(
|
56
|
+
\Folklore\Mediatheque\Contracts\Models\File::class,
|
57
|
+
\App\Models\MediaFile::class
|
58
|
+
);
|
59
|
+
}<% } %>
|
60
|
+
|
61
|
+
protected function registerTelescope()
|
62
|
+
{
|
63
|
+
if ($this->app->environment('local')) {
|
64
|
+
$this->app->register(\Laravel\Telescope\TelescopeServiceProvider::class);
|
65
|
+
$this->app->register(TelescopeServiceProvider::class);
|
66
|
+
}
|
67
|
+
}
|
68
|
+
|
12
69
|
/**
|
13
70
|
* Bootstrap any application services.
|
14
71
|
*
|
@@ -16,30 +73,48 @@ class AppServiceProvider extends ServiceProvider
|
|
16
73
|
*/
|
17
74
|
public function boot()
|
18
75
|
{
|
76
|
+
// Some defaults
|
19
77
|
Schema::defaultStringLength(191);
|
20
78
|
JsonResource::withoutWrapping();
|
21
79
|
|
80
|
+
$this->bootRequest();
|
81
|
+
|
82
|
+
$this->bootImage();
|
83
|
+
}
|
84
|
+
|
85
|
+
protected function bootRequest()
|
86
|
+
{
|
22
87
|
// Determine site from request
|
23
88
|
Request::macro('site', function () {
|
24
89
|
return null;
|
25
90
|
});
|
26
91
|
}
|
27
92
|
|
28
|
-
|
29
|
-
* Register any application services.
|
30
|
-
*
|
31
|
-
* @return void
|
32
|
-
*/
|
33
|
-
public function register()
|
34
|
-
{
|
35
|
-
$this->registerRepositories();
|
36
|
-
}
|
37
|
-
|
38
|
-
protected function registerRepositories()
|
93
|
+
protected function bootImage()
|
39
94
|
{
|
40
|
-
$
|
41
|
-
|
42
|
-
|
43
|
-
|
95
|
+
foreach (config('image.sizes') as $filter) {
|
96
|
+
$id = $filter['id'];
|
97
|
+
$data = Arr::except($filter, ['id']);
|
98
|
+
if (sizeof($data) === 0) {
|
99
|
+
continue;
|
100
|
+
}
|
101
|
+
$newFilter = [];
|
102
|
+
if (isset($filter['maxWidth'])) {
|
103
|
+
$newFilter['width'] = $filter['maxWidth'];
|
104
|
+
}
|
105
|
+
if (isset($filter['maxHeight'])) {
|
106
|
+
$newFilter['height'] = $filter['maxHeight'];
|
107
|
+
}
|
108
|
+
if (isset($filter['width'])) {
|
109
|
+
$newFilter['width'] = $filter['width'];
|
110
|
+
}
|
111
|
+
if (isset($filter['height'])) {
|
112
|
+
$newFilter['height'] = $filter['height'];
|
113
|
+
}
|
114
|
+
if (isset($filter['width']) && isset($filter['height'])) {
|
115
|
+
$newFilter['crop'] = true;
|
116
|
+
}
|
117
|
+
$this->app['image']->filter($id, $newFilter);
|
118
|
+
}
|
44
119
|
}
|
45
120
|
}
|
@@ -3,11 +3,12 @@
|
|
3
3
|
namespace App\Repositories;
|
4
4
|
|
5
5
|
use Folklore\Repositories\Users as BaseUsers;
|
6
|
+
use App\Contracts\Repositories\Users as UsersContract;
|
6
7
|
use Illuminate\Database\Eloquent\Model;
|
7
8
|
use App\Models\User as UserModel;
|
8
9
|
use App\Contracts\Resources\User as UserContract;
|
9
10
|
|
10
|
-
class Users extends BaseUsers
|
11
|
+
class Users extends BaseUsers implements UsersContract
|
11
12
|
{
|
12
13
|
protected function newModel(): Model
|
13
14
|
{
|
@@ -24,12 +25,12 @@ class Users extends BaseUsers
|
|
24
25
|
return parent::findByEmail($email);
|
25
26
|
}
|
26
27
|
|
27
|
-
public function create(
|
28
|
+
public function create($data): UserContract
|
28
29
|
{
|
29
30
|
return parent::create($data);
|
30
31
|
}
|
31
32
|
|
32
|
-
public function update(string $id,
|
33
|
+
public function update(string $id, $data): ?UserContract
|
33
34
|
{
|
34
35
|
return parent::update($id, $data);
|
35
36
|
}
|
@@ -194,8 +194,8 @@ return [
|
|
194
194
|
// App\Providers\BroadcastServiceProvider::class,
|
195
195
|
App\Providers\EventServiceProvider::class,
|
196
196
|
App\Providers\RouteServiceProvider::class,
|
197
|
-
App\Providers\ViewServiceProvider::class
|
198
|
-
|
197
|
+
App\Providers\ViewServiceProvider::class,<% if (options.panneau) { %>
|
198
|
+
App\Panneau\PanneauServiceProvider::class,<% } %>
|
199
199
|
],
|
200
200
|
|
201
201
|
/*
|
@@ -0,0 +1,204 @@
|
|
1
|
+
<?php
|
2
|
+
|
3
|
+
return [
|
4
|
+
|
5
|
+
/*
|
6
|
+
|--------------------------------------------------------------------------
|
7
|
+
| Image sizes
|
8
|
+
|--------------------------------------------------------------------------
|
9
|
+
*/
|
10
|
+
'sizes' => [
|
11
|
+
[
|
12
|
+
'id' => 'original',
|
13
|
+
],
|
14
|
+
[
|
15
|
+
'id' => 'thumbnail',
|
16
|
+
'width' => 200,
|
17
|
+
'height' => 200,
|
18
|
+
],
|
19
|
+
[
|
20
|
+
'id' => 'small',
|
21
|
+
'maxWidth' => 500,
|
22
|
+
'maxHeight' => 500,
|
23
|
+
],
|
24
|
+
[
|
25
|
+
'id' => 'medium',
|
26
|
+
'maxWidth' => 800,
|
27
|
+
'maxHeight' => 800,
|
28
|
+
],
|
29
|
+
[
|
30
|
+
'id' => 'large',
|
31
|
+
'maxWidth' => 1600,
|
32
|
+
'maxHeight' => 1600,
|
33
|
+
],
|
34
|
+
],
|
35
|
+
|
36
|
+
/*
|
37
|
+
|--------------------------------------------------------------------------
|
38
|
+
| Image Filters
|
39
|
+
|--------------------------------------------------------------------------
|
40
|
+
|
|
41
|
+
| The list of filters you can use when making an image or generating an url.
|
42
|
+
| There is some built-in filters, and you can add or replace any. It is also
|
43
|
+
| possible to declare a filter with an array or a closure instead of a Filter
|
44
|
+
| Class.
|
45
|
+
|
|
46
|
+
*/
|
47
|
+
'filters' => [
|
48
|
+
'blur' => \Folklore\Image\Filters\Blur::class,
|
49
|
+
'colorize' => \Folklore\Image\Filters\Colorize::class,
|
50
|
+
'gamma' => \Folklore\Image\Filters\Gamma::class,
|
51
|
+
'grayscale' => \Folklore\Image\Filters\Grayscale::class,
|
52
|
+
'interlace' => \Folklore\Image\Filters\Interlace::class,
|
53
|
+
'negative' => \Folklore\Image\Filters\Negative::class,
|
54
|
+
'rotate' => \Folklore\Image\Filters\Rotate::class,
|
55
|
+
'resize' => \Folklore\Image\Filters\Resize::class
|
56
|
+
],
|
57
|
+
|
58
|
+
/*
|
59
|
+
|--------------------------------------------------------------------------
|
60
|
+
| Default Source
|
61
|
+
|--------------------------------------------------------------------------
|
62
|
+
|
|
63
|
+
| This option define the default source to be used by the Image facade. The
|
64
|
+
| source determine where the image files are read and saved.
|
65
|
+
|
|
66
|
+
*/
|
67
|
+
'source' => 'public',
|
68
|
+
|
69
|
+
/*
|
70
|
+
|--------------------------------------------------------------------------
|
71
|
+
| Sources
|
72
|
+
|--------------------------------------------------------------------------
|
73
|
+
|
|
74
|
+
| The list of sources where you store images.
|
75
|
+
|
|
76
|
+
| Supported driver: "local", "filesystem"
|
77
|
+
|
|
78
|
+
*/
|
79
|
+
'sources' => [
|
80
|
+
|
81
|
+
'public' => [
|
82
|
+
// The local driver use a local path on the machine.
|
83
|
+
'driver' => 'local',
|
84
|
+
|
85
|
+
// The path where the images are stored.
|
86
|
+
'path' => public_path()
|
87
|
+
],
|
88
|
+
|
89
|
+
'cloud' => [
|
90
|
+
// The filesystem driver lets you use the filesystem from laravel.
|
91
|
+
'driver' => 'filesystem',
|
92
|
+
|
93
|
+
// The filesystem disk where the images are stored.
|
94
|
+
'disk' => 'public',
|
95
|
+
|
96
|
+
// The path on the disk where the images are stored. If set to null,
|
97
|
+
// it will start from the root.
|
98
|
+
'path' => null,
|
99
|
+
|
100
|
+
// Cache the file on local machine. It can be useful for remote files.
|
101
|
+
'cache' => true,
|
102
|
+
|
103
|
+
// The path where you want to put cached files
|
104
|
+
'cache_path' => storage_path('image/cache')
|
105
|
+
]
|
106
|
+
|
107
|
+
],
|
108
|
+
|
109
|
+
/*
|
110
|
+
|--------------------------------------------------------------------------
|
111
|
+
| URL Generator
|
112
|
+
|--------------------------------------------------------------------------
|
113
|
+
|
|
114
|
+
| The URL Generator configuration is used when generating an image url
|
115
|
+
| and by the router to generate a pattern for catching image requests.
|
116
|
+
| These are the defaults values and you can overide it in each routes or
|
117
|
+
| when generating an url using the `pattern` parameter.
|
118
|
+
|
|
119
|
+
*/
|
120
|
+
'url' => [
|
121
|
+
// The format of the url that will be generated. The `{filters}` placeholder
|
122
|
+
// will be replaced by the filters according to the `filters_format`.
|
123
|
+
'format' => '{dirname}/{basename}{filters}.{extension}',
|
124
|
+
|
125
|
+
// The format of the filters that will replace `{filters}` in the
|
126
|
+
// url `format` above. The `{filter}` placeholder will be replaced by
|
127
|
+
// each filter according to the `filter_format` and joined
|
128
|
+
// by the `filter_separator`.
|
129
|
+
'filters_format' => '-filters({filter})',
|
130
|
+
|
131
|
+
// The format of a filter.
|
132
|
+
'filter_format' => '{key}({value})',
|
133
|
+
|
134
|
+
// The separator for each filter
|
135
|
+
'filter_separator' => '-',
|
136
|
+
|
137
|
+
// This is the regex that will replace any placeholders in the option 'format'.
|
138
|
+
// They are used when the route pattern is generated and added to the
|
139
|
+
// Laravel Router to match image request.
|
140
|
+
'placeholders_patterns' => [
|
141
|
+
'host' => '(.*?)?',
|
142
|
+
'dirname' => '(.*?)?',
|
143
|
+
'basename' => '([^\/\.]+?)',
|
144
|
+
'filename' => '([^\/]+)',
|
145
|
+
'extension' => '(jpeg|jpg|gif|png)',
|
146
|
+
]
|
147
|
+
],
|
148
|
+
|
149
|
+
/*
|
150
|
+
|--------------------------------------------------------------------------
|
151
|
+
| Routes
|
152
|
+
|--------------------------------------------------------------------------
|
153
|
+
|
|
154
|
+
| Default configuration for image routes. See routes/image.php
|
155
|
+
|
|
156
|
+
*/
|
157
|
+
'routes' => [
|
158
|
+
// Path to the routes file that will be automatically loaded. Set to null
|
159
|
+
// to prevent auto-loading of routes.
|
160
|
+
'map' => base_path('routes/images.php'),
|
161
|
+
|
162
|
+
// Default domain for routes
|
163
|
+
'domain' => null,
|
164
|
+
|
165
|
+
// Default namespace for controller
|
166
|
+
'namespace' => null,
|
167
|
+
|
168
|
+
// Default middlewares for routes
|
169
|
+
'middleware' => [],
|
170
|
+
|
171
|
+
// The controller serving the images
|
172
|
+
'controller' => '\Folklore\Image\Http\ImageController@serve',
|
173
|
+
|
174
|
+
// The name of the pattern that will be added to the Laravel Router.
|
175
|
+
'pattern_name' => 'image_pattern',
|
176
|
+
|
177
|
+
// The middleware used when a route as `cache` enabled
|
178
|
+
'cache_middleware' => 'image.middleware.cache'
|
179
|
+
],
|
180
|
+
|
181
|
+
/*
|
182
|
+
|--------------------------------------------------------------------------
|
183
|
+
| Image Driver
|
184
|
+
|--------------------------------------------------------------------------
|
185
|
+
|
|
186
|
+
| This option controls the default image "driver" used by Imagine library
|
187
|
+
| to manipulate images.
|
188
|
+
|
|
189
|
+
| Supported: "gd", "imagick", "gmagick"
|
190
|
+
|
|
191
|
+
*/
|
192
|
+
'driver' => 'gd',
|
193
|
+
|
194
|
+
/*
|
195
|
+
|--------------------------------------------------------------------------
|
196
|
+
| Memory limit
|
197
|
+
|--------------------------------------------------------------------------
|
198
|
+
|
|
199
|
+
| When manipulating an image, the memory limit is increased to this value
|
200
|
+
|
|
201
|
+
*/
|
202
|
+
'memory_limit' => '128M',
|
203
|
+
|
204
|
+
];
|
@@ -31,7 +31,7 @@ module.exports = class PrettierGenerator extends _generator.default {
|
|
31
31
|
},
|
32
32
|
|
33
33
|
dependencies() {
|
34
|
-
this.addDevDependencies(['prettier', '@prettier/plugin-php', '@trivago/prettier-plugin-sort-imports']);
|
34
|
+
this.addDevDependencies(['prettier@^2.0.0', '@prettier/plugin-php@^0.18.0', '@trivago/prettier-plugin-sort-imports@^3.0.0']);
|
35
35
|
}
|
36
36
|
|
37
37
|
};
|
@@ -108,8 +108,8 @@ module.exports = class ReactAppGenerator extends _generator.default {
|
|
108
108
|
},
|
109
109
|
|
110
110
|
dependencies() {
|
111
|
-
this.addDependencies(['react', 'react-dom', 'prop-types', 'react-intl', 'react-router', 'react-router-dom', 'react-helmet', 'classnames', '@folklore/routes', '@folklore/fonts', '@folklore/forms', '@folklore/fetch', '@folklore/hooks', '@folklore/tracking', // Polyfills
|
112
|
-
'intl', '@formatjs/intl-locale', '@formatjs/intl-pluralrules', 'intersection-observer', 'resize-observer-polyfill']);
|
111
|
+
this.addDependencies(['react@^18.0.0', 'react-dom@^18.0.0', 'prop-types@^15.0.0', 'react-intl@^6.0.0', 'react-router@^6.0.0', 'react-router-dom@^6.0.0', 'react-helmet@^6.0.0', 'classnames@^2.0.0', '@folklore/routes@^0.1.0', '@folklore/fonts@^0.0.1', '@folklore/forms@^0.0.1', '@folklore/fetch@^0.1.0', '@folklore/hooks@^0.0.1', '@folklore/tracking@^0.0.1', // Polyfills
|
112
|
+
'intl@^1.0.0', '@formatjs/intl-locale@^3.0.0', '@formatjs/intl-pluralrules@^5.0.0', 'intersection-observer@^0.12.0', 'resize-observer-polyfill@1.0.0']);
|
113
113
|
}
|
114
114
|
|
115
115
|
};
|
@@ -37,7 +37,7 @@ module.exports = class StylelintGenerator extends _generator.default {
|
|
37
37
|
},
|
38
38
|
|
39
39
|
dependencies() {
|
40
|
-
this.addDevDependencies(['stylelint', 'stylelint-config-standard-scss', 'stylelint-config-idiomatic-order', 'stylelint-config-prettier']);
|
40
|
+
this.addDevDependencies(['stylelint@^14.0.0', 'stylelint-config-standard-scss@^5.0.0', 'stylelint-config-idiomatic-order@^8.0.0', 'stylelint-config-prettier@^9.0.0']);
|
41
41
|
}
|
42
42
|
|
43
43
|
};
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "generator-folklore",
|
3
|
-
"version": "3.0.
|
3
|
+
"version": "3.0.7",
|
4
4
|
"description": "Yeoman generator for projects at Folklore",
|
5
5
|
"keywords": [
|
6
6
|
"yeoman-generator"
|
@@ -9,9 +9,9 @@
|
|
9
9
|
"scripts": {
|
10
10
|
"clean:lib": "rm -rf lib/*",
|
11
11
|
"clean": "npm run clean:lib",
|
12
|
-
"copy:
|
12
|
+
"copy:dirs": "find src/ -type d | grep -E '(/templates|/instructions)$' | sed 's/src\\/\\///g' | xargs -I{} cp -r \"src/{}\" \"lib/{}\"",
|
13
13
|
"compile": "../../node_modules/.bin/babel -d lib/ src/",
|
14
|
-
"build": "npm run compile && npm run copy:
|
14
|
+
"build": "npm run compile && npm run copy:dirs",
|
15
15
|
"test": "echo \"Error: no test specified\" && exit 1",
|
16
16
|
"prepare": "npm run clean && npm run build"
|
17
17
|
},
|
@@ -31,6 +31,7 @@
|
|
31
31
|
"dependencies": {
|
32
32
|
"chalk": "^4.0.0",
|
33
33
|
"change-case": "^4.1.2",
|
34
|
+
"cli-highlight": "^2.1.11",
|
34
35
|
"glob": "^7.2.0",
|
35
36
|
"immutable": "^4.0.0",
|
36
37
|
"is-utf8": "^0.2.1",
|
@@ -39,5 +40,5 @@
|
|
39
40
|
"yeoman-generator": "^5.6.1",
|
40
41
|
"yeoman-remote": "^1.0.1"
|
41
42
|
},
|
42
|
-
"gitHead": "
|
43
|
+
"gitHead": "bc3878a65d256dd8742a6deea2699252d4a4dfb0"
|
43
44
|
}
|
@@ -1,22 +0,0 @@
|
|
1
|
-
<?php
|
2
|
-
|
3
|
-
namespace App\Panneau\Fields;
|
4
|
-
|
5
|
-
use Panneau\Fields\ResourceItem;
|
6
|
-
|
7
|
-
class Block extends ResourceItem
|
8
|
-
{
|
9
|
-
public function resource(): string
|
10
|
-
{
|
11
|
-
return 'blocks';
|
12
|
-
}
|
13
|
-
|
14
|
-
public function attributes(): ?array
|
15
|
-
{
|
16
|
-
return array_merge(parent::attributes(), [
|
17
|
-
'placeholder' => trans('panneau.fields.blocks_placeholder'),
|
18
|
-
'itemLabelPath' => 'title',
|
19
|
-
'itemDescriptionPath' => null,
|
20
|
-
]);
|
21
|
-
}
|
22
|
-
}
|
@@ -1,87 +0,0 @@
|
|
1
|
-
<?php
|
2
|
-
|
3
|
-
namespace App\Panneau\Fields;
|
4
|
-
|
5
|
-
use Panneau\Fields\Items;
|
6
|
-
use Panneau\Fields\ResourceItem;
|
7
|
-
use App\Panneau\Resources\Blocks\BlockWithBlocks;
|
8
|
-
|
9
|
-
class Blocks extends Items
|
10
|
-
{
|
11
|
-
protected $currentDepth = 0;
|
12
|
-
|
13
|
-
protected $maxDepth = null;
|
14
|
-
|
15
|
-
protected $excludeTypes = [];
|
16
|
-
|
17
|
-
public function itemField(): ?string
|
18
|
-
{
|
19
|
-
return Block::class;
|
20
|
-
}
|
21
|
-
|
22
|
-
public function attributes(): ?array
|
23
|
-
{
|
24
|
-
// With types
|
25
|
-
$itemField = $this->itemField();
|
26
|
-
$itemField = !is_null($itemField) ? resolve($itemField) : null;
|
27
|
-
$itemResource =
|
28
|
-
!is_null($itemField) && $itemField instanceof ResourceItem
|
29
|
-
? $itemField->makeResource()
|
30
|
-
: null;
|
31
|
-
$resourceTypes =
|
32
|
-
!is_null($itemResource) && $itemResource->hasTypes() ? $itemResource->getTypes() : null;
|
33
|
-
|
34
|
-
$attributes = [
|
35
|
-
'withoutFormGroup' => true,
|
36
|
-
'addItemLabel' => trans('panneau.fields.add_block'),
|
37
|
-
'noItemLabel' => trans('panneau.fields.no_blocks'),
|
38
|
-
'itemLabel' => trans('panneau.fields.block'),
|
39
|
-
'withoutSort' => false,
|
40
|
-
];
|
41
|
-
|
42
|
-
if (!is_null($resourceTypes)) {
|
43
|
-
$attributes['types'] = $resourceTypes
|
44
|
-
->filter(function ($type) {
|
45
|
-
$key = get_class($type);
|
46
|
-
return !in_array($key, $this->excludeTypes);
|
47
|
-
})
|
48
|
-
->map(function ($type) {
|
49
|
-
$hasBlocks = collect($type->fields())->contains(function ($field) {
|
50
|
-
return $field instanceof self;
|
51
|
-
});
|
52
|
-
if (isset($this->maxDepth) && $hasBlocks) {
|
53
|
-
return new BlockWithBlocks($type, $this->currentDepth + 1);
|
54
|
-
}
|
55
|
-
return $type;
|
56
|
-
})
|
57
|
-
->filter(function ($type) {
|
58
|
-
if (isset($this->maxDepth) && $type instanceof BlockWithBlocks) {
|
59
|
-
return $type->currentDepth() < $this->maxDepth;
|
60
|
-
}
|
61
|
-
return true;
|
62
|
-
})
|
63
|
-
->values()
|
64
|
-
->toArray();
|
65
|
-
}
|
66
|
-
|
67
|
-
return $attributes;
|
68
|
-
}
|
69
|
-
|
70
|
-
public function maxDepth($depth)
|
71
|
-
{
|
72
|
-
$this->maxDepth = $depth;
|
73
|
-
return $this;
|
74
|
-
}
|
75
|
-
|
76
|
-
public function currentDepth($depth)
|
77
|
-
{
|
78
|
-
$this->currentDepth = $depth;
|
79
|
-
return $this;
|
80
|
-
}
|
81
|
-
|
82
|
-
public function withoutType($type)
|
83
|
-
{
|
84
|
-
$this->excludeTypes[] = is_object($type) ? get_class($type) : $type;
|
85
|
-
return $this;
|
86
|
-
}
|
87
|
-
}
|