generator-folklore 3.0.7 → 3.0.9

Sign up to get free protection for your applications and to get access to all the features.
Files changed (44) hide show
  1. package/Readme.md +11 -5
  2. package/lib/generators/app/index.js +3 -0
  3. package/lib/generators/babel/index.js +8 -1
  4. package/lib/generators/build/index.js +3 -1
  5. package/lib/generators/cli/index.js +4 -1
  6. package/lib/generators/docs/index.js +9 -4
  7. package/lib/generators/eslint/index.js +12 -1
  8. package/lib/generators/intl/index.js +4 -2
  9. package/lib/generators/laravel-auth/templates/routes/auth.php +2 -0
  10. package/lib/generators/laravel-panneau/index.js +7 -1
  11. package/lib/generators/laravel-panneau/templates/app/Contracts/Resources/Block.php +10 -0
  12. package/lib/generators/laravel-panneau/templates/app/Http/Middleware/Authenticate.php +27 -0
  13. package/lib/generators/laravel-panneau/templates/app/Http/Resources/BlockResource.php +1 -1
  14. package/lib/generators/laravel-panneau/templates/app/Http/Resources/BlocksCollection.php +2 -0
  15. package/lib/generators/laravel-panneau/templates/app/Http/Resources/PageResource.php +6 -4
  16. package/lib/generators/laravel-panneau/templates/app/Models/Block.php +10 -0
  17. package/lib/generators/laravel-panneau/templates/app/Models/Media.php +11 -0
  18. package/lib/generators/laravel-panneau/templates/app/Models/Page.php +12 -2
  19. package/lib/generators/laravel-panneau/templates/app/Panneau/PanneauServiceProvider.php +16 -0
  20. package/lib/generators/laravel-panneau/templates/app/Panneau/Resources/Users.php +2 -1
  21. package/lib/generators/laravel-panneau/templates/app/Resources/Block.php +10 -0
  22. package/lib/generators/laravel-panneau/templates/app/Resources/Blocks/ImageBlock.php +1 -1
  23. package/lib/generators/laravel-panneau/templates/app/Resources/Blocks/TextBlock.php +1 -1
  24. package/lib/generators/laravel-panneau/templates/routes.php +3 -1
  25. package/lib/generators/laravel-project/index.js +3 -3
  26. package/lib/generators/laravel-project/templates/laravel/app/Actions/Fortify/CreateNewUser.php +41 -0
  27. package/lib/generators/laravel-project/templates/laravel/app/Actions/Fortify/ResetUserPassword.php +31 -0
  28. package/lib/generators/laravel-project/templates/laravel/app/Actions/Fortify/UpdateUserPassword.php +34 -0
  29. package/lib/generators/laravel-project/templates/laravel/app/Actions/Fortify/UpdateUserProfileInformation.php +61 -0
  30. package/lib/generators/laravel-project/templates/laravel/app/Providers/TelescopeServiceProvider.php +67 -0
  31. package/lib/generators/laravel-project/templates/laravel/config/app.php +1 -0
  32. package/lib/generators/laravel-project/templates/laravel/routes/web.php +4 -1
  33. package/lib/generators/lerna-repository/index.js +8 -3
  34. package/lib/generators/npm-package/index.js +6 -2
  35. package/lib/generators/prettier/index.js +5 -1
  36. package/lib/generators/react-app/index.js +22 -2
  37. package/lib/generators/react-app/templates/src/components/Container.jsx +10 -8
  38. package/lib/generators/react-package/index.js +14 -5
  39. package/lib/generators/rollup/index.js +8 -1
  40. package/lib/generators/server/index.js +9 -2
  41. package/lib/generators/storybook/index.js +9 -1
  42. package/lib/generators/stylelint/index.js +7 -2
  43. package/lib/generators/test/index.js +10 -1
  44. package/package.json +3 -3
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
- Laravel 5 project, JS, Sass, and miscellaneous Laravel boilerplate.
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:npm-package
36
+ yo folklore:node-project
32
37
  ```
33
- NPM package
38
+
39
+ Node package
@@ -53,6 +53,9 @@ module.exports = class AppGenerator extends _generator.default {
53
53
  choices: [{
54
54
  name: 'HTML',
55
55
  value: 'html-project'
56
+ }, {
57
+ name: 'Laravel',
58
+ value: 'laravel-project'
56
59
  }, {
57
60
  name: 'Node',
58
61
  value: 'node-project'
@@ -56,7 +56,14 @@ module.exports = class BabelGenerator extends _generator.default {
56
56
  },
57
57
 
58
58
  dependencies() {
59
- this.addDevDependencies(['@babel/cli', '@babel/core', '@babel/node', '@babel/plugin-transform-runtime', '@babel/preset-env', '@babel/preset-react']);
59
+ this.addDevDependencies({
60
+ '@babel/core': '^7.19.3',
61
+ '@babel/cli': 'latest',
62
+ '@babel/node': 'latest',
63
+ '@babel/plugin-transform-runtime': 'latest',
64
+ '@babel/preset-env': 'latest',
65
+ '@babel/preset-react': 'latest'
66
+ });
60
67
  }
61
68
 
62
69
  };
@@ -92,7 +92,9 @@ module.exports = class AppGenerator extends _generator.default {
92
92
  },
93
93
 
94
94
  dependencies() {
95
- this.addDevDependencies(['@folklore/cli@^0.0.47']);
95
+ this.addDevDependencies({
96
+ '@folklore/cli': '^0.0.47'
97
+ });
96
98
  }
97
99
 
98
100
  };
@@ -75,7 +75,10 @@ module.exports = class CliGenerator extends _generator.default {
75
75
  },
76
76
 
77
77
  dependencies() {
78
- this.addDependencies(['commander', 'debug']);
78
+ this.addDependencies({
79
+ 'commander': 'latest',
80
+ 'debug': 'latest'
81
+ });
79
82
  }
80
83
 
81
84
  };
@@ -1,11 +1,11 @@
1
1
  "use strict";
2
2
 
3
+ var _chalk = _interopRequireDefault(require("chalk"));
4
+
3
5
  var _lodash = _interopRequireDefault(require("lodash"));
4
6
 
5
7
  var _path = _interopRequireDefault(require("path"));
6
8
 
7
- var _chalk = _interopRequireDefault(require("chalk"));
8
-
9
9
  var _generator = _interopRequireDefault(require("../../lib/generator"));
10
10
 
11
11
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
@@ -141,10 +141,15 @@ module.exports = class DocsGenerator extends _generator.default {
141
141
  return;
142
142
  }
143
143
 
144
- this.addDevDependencies(['gitbook-cli@latest']);
144
+ this.addDevDependencies({
145
+ 'gitbook-cli': 'latest'
146
+ });
145
147
 
146
148
  if (this.options.language === 'js') {
147
- this.addDevDependencies(['jsdoc@latest', 'jsdoc-babel@latest']);
149
+ this.addDevDependencies({
150
+ jsdoc: 'latest',
151
+ 'jsdoc-babel': 'latest'
152
+ });
148
153
  }
149
154
  }
150
155
 
@@ -32,7 +32,18 @@ module.exports = class EslintGenerator extends _generator.default {
32
32
  },
33
33
 
34
34
  dependencies() {
35
- this.addDevDependencies(['babel-preset-airbnb@^5.0.0', '@babel/eslint-parser@^7.0.0', 'eslint@^8.0.0', 'eslint-config-airbnb@^19.0.0', 'eslint-config-prettier@^8.0.0', 'eslint-plugin-prettier@^4.0.0', 'eslint-plugin-import@^2.0.0', 'eslint-plugin-jsx-a11y@^6.0.0', 'eslint-plugin-react@^7.0.0', 'eslint-plugin-formatjs@^4.0.0']);
35
+ this.addDevDependencies({
36
+ 'babel-preset-airbnb': 'latest',
37
+ '@babel/eslint-parser': 'latest',
38
+ eslint: '^8.0.0',
39
+ 'eslint-config-airbnb': 'latest',
40
+ 'eslint-config-prettier': 'latest',
41
+ 'eslint-plugin-prettier': 'latest',
42
+ 'eslint-plugin-import': 'latest',
43
+ 'eslint-plugin-jsx-a11y': 'latest',
44
+ 'eslint-plugin-react': 'latest',
45
+ 'eslint-plugin-formatjs': 'latest'
46
+ });
36
47
  }
37
48
 
38
49
  };
@@ -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$ '${outputPath}' '${translationsPath}'`;
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',
@@ -76,7 +76,9 @@ module.exports = class IntlGenerator extends _generator.default {
76
76
  },
77
77
 
78
78
  dependencies() {
79
- this.addDevDependencies(['@folklore/cli@^0.0.47']);
79
+ this.addDevDependencies({
80
+ '@folklore/cli': '^0.0.47'
81
+ });
80
82
  }
81
83
 
82
84
  };
@@ -1,5 +1,7 @@
1
1
  <?php
2
2
 
3
+ use Illuminate\Support\Facades\Route;
4
+
3
5
  Route::groupWithLocales(function ($locale) {
4
6
  // Authentication Routes...
5
7
  Route::getLocalized('login', 'LoginController@showLoginForm')->nameWithLocale('auth.login');
@@ -69,7 +69,13 @@ module.exports = class LaravelPanneauGenerator extends _generator.default {
69
69
  },
70
70
 
71
71
  packageJSON() {
72
- this.addDependencies(['@panneau/app@^1.0.3-alpha.1', '@panneau/core@^1.0.3-alpha.1', '@panneau/data@^1.0.3-alpha.1', '@panneau/field-text@^1.0.3-alpha.1', '@panneau/field-localized@^1.0.3-alpha.1']);
72
+ this.addDependencies({
73
+ '@panneau/app': '^1.0.3-alpha.1',
74
+ '@panneau/core': '^1.0.3-alpha.1',
75
+ '@panneau/data': '^1.0.3-alpha.1',
76
+ '@panneau/field-text': '^1.0.3-alpha.1',
77
+ '@panneau/field-localized': '^1.0.3-alpha.1'
78
+ });
73
79
  },
74
80
 
75
81
  config() {
@@ -0,0 +1,10 @@
1
+ <?php
2
+
3
+ namespace App\Contracts\Resources;
4
+
5
+ use Folklore\Contracts\Resources\Block as BaseBlock;
6
+
7
+ interface Block extends BaseBlock
8
+ {
9
+
10
+ }
@@ -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
+ }
@@ -3,7 +3,7 @@
3
3
  namespace App\Http\Resources;
4
4
 
5
5
  use Illuminate\Http\Resources\Json\JsonResource;
6
- use App\Contracts\Resources\HasBlocks;
6
+ use Folklore\Contracts\Resources\HasBlocks;
7
7
  use Folklore\Http\Resources\LocalizedResource;
8
8
  use App\Contracts\Resources\Blocks\Text as TextBlock;
9
9
 
@@ -2,6 +2,8 @@
2
2
 
3
3
  namespace App\Http\Resources;
4
4
 
5
+ use Folklore\Http\Resources\Collection;
6
+
5
7
  class BlocksCollection extends Collection
6
8
  {
7
9
  public $collects = BlockResource::class;
@@ -3,10 +3,10 @@
3
3
  namespace App\Http\Resources;
4
4
 
5
5
  use Illuminate\Http\Resources\Json\JsonResource;
6
- use App\Http\Resources\Medias\ImageResource;
7
6
  use App\Contracts\Resources\Page;
8
- use App\Contracts\Resources\HasBlocks;
9
7
  use App\Contracts\Resources\Pages\Home as HomePage;
8
+ use Folklore\Http\Resources\MediaResource;
9
+ use Folklore\Contracts\Resources\HasBlocks;
10
10
 
11
11
  class PageResource extends JsonResource
12
12
  {
@@ -19,6 +19,8 @@ class PageResource extends JsonResource
19
19
  public function toArray($request)
20
20
  {
21
21
  $locale = $request->locale();
22
+ $image = $this->image();
23
+ $parent = $this->parent();
22
24
  return [
23
25
  'id' => $this->id(),
24
26
  'type' => $this->type(),
@@ -26,10 +28,10 @@ class PageResource extends JsonResource
26
28
  'title' => $this->title($locale),
27
29
  'description' => $this->description($locale),
28
30
  'slug' => $this->slug($locale),
29
- 'image' => !is_null($image) ? new ImageResource($image) : null,
31
+ 'image' => !is_null($image) ? new MediaResource($image) : null,
30
32
  'parent' =>
31
33
  !is_null($parent) && $parent instanceof Page
32
- ? new ParentPageResource($parent)
34
+ ? new PageResource($parent)
33
35
  : null,
34
36
 
35
37
  $this->mergeWhen($this->resource instanceof HasBlocks, function () {
@@ -2,12 +2,22 @@
2
2
 
3
3
  namespace App\Models;
4
4
 
5
+ use App\Contracts\Resources\Block as BlockContract;
6
+ use App\Resources\Block as BlockResource;
5
7
  use Folklore\Models\Block as BaseBlock;
8
+ use Illuminate\Database\Eloquent\Factories\HasFactory;
6
9
 
7
10
  class Block extends BaseBlock
8
11
  {
12
+ use HasFactory;
13
+
9
14
  protected $typeResources = [
10
15
  'text' => \App\Resources\Blocks\TextBlock::class,
11
16
  'image' => \App\Resources\Blocks\ImageBlock::class,
12
17
  ];
18
+
19
+ public function toResource(): BlockContract
20
+ {
21
+ return $this->toTypedResource() ?? new BlockResource($this);
22
+ }
13
23
  }
@@ -0,0 +1,11 @@
1
+ <?php
2
+
3
+ namespace App\Models;
4
+
5
+ use Folklore\Models\Media as BaseMedia;
6
+ use Illuminate\Database\Eloquent\Factories\HasFactory;
7
+
8
+ class Media extends BaseMedia
9
+ {
10
+ use HasFactory;
11
+ }
@@ -2,11 +2,21 @@
2
2
 
3
3
  namespace App\Models;
4
4
 
5
+ use App\Contracts\Resources\Page as PageContract;
6
+ use App\Resources\Page as PageResource;
5
7
  use Folklore\Models\Page as BasePage;
8
+ use Illuminate\Database\Eloquent\Factories\HasFactory;
6
9
 
7
10
  class Page extends BasePage
8
11
  {
9
- protected $typeResources = [
10
- 'text' => \App\Resources\Pages\HomePage::class,
12
+ use HasFactory;
13
+
14
+ protected $typedResources = [
15
+ 'home' => \App\Resources\Pages\HomePage::class,
11
16
  ];
17
+
18
+ public function toResource(): PageContract
19
+ {
20
+ return $this->toTypedResource() ?? new PageResource($this);
21
+ }
12
22
  }
@@ -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
  }
@@ -51,7 +51,8 @@ class Users extends Resource
51
51
  ],
52
52
  ])
53
53
  ->withoutReset()
54
- ->withDefaultValue('guest'),
54
+ ->withDefaultValue('admin')
55
+ ->isRequired(),
55
56
  ];
56
57
  }
57
58
  }
@@ -0,0 +1,10 @@
1
+ <?php
2
+
3
+ namespace App\Resources;
4
+
5
+ use Folklore\Resources\Block as BaseBlock;
6
+
7
+ class Block extends BaseBlock
8
+ {
9
+
10
+ }
@@ -2,7 +2,7 @@
2
2
 
3
3
  namespace App\Resources\Blocks;
4
4
 
5
- use Folklore\Resources\Block;
5
+ use App\Resources\Block;
6
6
  use App\Contracts\Resources\Blocks\Text as TextBlockContract;
7
7
  use Folklore\Contracts\Resources\Image as ImageContract;
8
8
  use Folklore\Resources\Image;
@@ -2,7 +2,7 @@
2
2
 
3
3
  namespace App\Resources\Blocks;
4
4
 
5
- use Folklore\Resources\Block;
5
+ use App\Resources\Block;
6
6
  use App\Contracts\Resources\Blocks\Text as TextBlockContract;
7
7
 
8
8
  class TextBlock extends Block implements TextBlockContract
@@ -10,7 +10,9 @@ Panneau::router()->group(function () {
10
10
  return app('tus-server')->serve();
11
11
  })->where('any', '.*');
12
12
 
13
- Panneau::router()->auth();
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': skipInstall,
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': skipInstall,
308
+ // 'skip-install': true,
309
309
  // 'install-npm': true,
310
310
  // quiet: true,
311
311
  // });
@@ -373,7 +373,7 @@ module.exports = class LaravelProjectGenerator extends _generator.default {
373
373
  },
374
374
  extra: {
375
375
  laravel: {
376
- 'dont-discover': ['laravel/telescope']
376
+ 'dont-discover': ['laravel/telescope', 'folklore/laravel-folklore']
377
377
  }
378
378
  }
379
379
  });
@@ -0,0 +1,41 @@
1
+ <?php
2
+
3
+ namespace App\Actions\Fortify;
4
+
5
+ use App\Contracts\Repositories\Users;
6
+ use Illuminate\Support\Facades\Hash;
7
+ use Illuminate\Support\Facades\Validator;
8
+ use Illuminate\Validation\Rule;
9
+ use Laravel\Fortify\Contracts\CreatesNewUsers;
10
+
11
+ class CreateNewUser implements CreatesNewUsers
12
+ {
13
+ use PasswordValidationRules;
14
+
15
+ /**
16
+ * Validate and create a newly registered user.
17
+ *
18
+ * @param array $input
19
+ * @return \App\Models\User
20
+ */
21
+ public function create(array $input)
22
+ {
23
+ Validator::make($input, [
24
+ 'name' => ['required', 'string', 'max:255'],
25
+ 'email' => [
26
+ 'required',
27
+ 'string',
28
+ 'email',
29
+ 'max:255',
30
+ Rule::unique(User::class),
31
+ ],
32
+ 'password' => $this->passwordRules(),
33
+ ])->validate();
34
+
35
+ return resolve(Users::class)->create([
36
+ 'name' => $input['name'],
37
+ 'email' => $input['email'],
38
+ 'password' => Hash::make($input['password']),
39
+ ]);
40
+ }
41
+ }
@@ -0,0 +1,31 @@
1
+ <?php
2
+
3
+ namespace App\Actions\Fortify;
4
+
5
+ use Illuminate\Support\Facades\Hash;
6
+ use Illuminate\Support\Facades\Validator;
7
+ use Laravel\Fortify\Contracts\ResetsUserPasswords;
8
+ use App\Contracts\Repositories\Users;
9
+
10
+ class ResetUserPassword implements ResetsUserPasswords
11
+ {
12
+ use PasswordValidationRules;
13
+
14
+ /**
15
+ * Validate and reset the user's forgotten password.
16
+ *
17
+ * @param mixed $user
18
+ * @param array $input
19
+ * @return void
20
+ */
21
+ public function reset($user, array $input)
22
+ {
23
+ Validator::make($input, [
24
+ 'password' => $this->passwordRules(),
25
+ ])->validate();
26
+
27
+ resolve(Users::class)->update($user->id(), [
28
+ 'password' => Hash::make($input['password']),
29
+ ]);
30
+ }
31
+ }
@@ -0,0 +1,34 @@
1
+ <?php
2
+
3
+ namespace App\Actions\Fortify;
4
+
5
+ use Illuminate\Support\Facades\Hash;
6
+ use Illuminate\Support\Facades\Validator;
7
+ use Laravel\Fortify\Contracts\UpdatesUserPasswords;
8
+ use App\Contracts\Repositories\Users;
9
+
10
+ class UpdateUserPassword implements UpdatesUserPasswords
11
+ {
12
+ use PasswordValidationRules;
13
+
14
+ /**
15
+ * Validate and update the user's password.
16
+ *
17
+ * @param mixed $user
18
+ * @param array $input
19
+ * @return void
20
+ */
21
+ public function update($user, array $input)
22
+ {
23
+ Validator::make($input, [
24
+ 'current_password' => ['required', 'string', 'current_password:web'],
25
+ 'password' => $this->passwordRules(),
26
+ ], [
27
+ 'current_password.current_password' => __('The provided password does not match your current password.'),
28
+ ])->validateWithBag('updatePassword');
29
+
30
+ resolve(Users::class)->update($user->id(), [
31
+ 'password' => Hash::make($input['password']),
32
+ ]);
33
+ }
34
+ }
@@ -0,0 +1,61 @@
1
+ <?php
2
+
3
+ namespace App\Actions\Fortify;
4
+
5
+ use Illuminate\Contracts\Auth\MustVerifyEmail;
6
+ use Illuminate\Support\Facades\Validator;
7
+ use Illuminate\Validation\Rule;
8
+ use Laravel\Fortify\Contracts\UpdatesUserProfileInformation;
9
+ use App\Contracts\Repositories\Users;
10
+
11
+ class UpdateUserProfileInformation implements UpdatesUserProfileInformation
12
+ {
13
+ /**
14
+ * Validate and update the given user's profile information.
15
+ *
16
+ * @param mixed $user
17
+ * @param array $input
18
+ * @return void
19
+ */
20
+ public function update($user, array $input)
21
+ {
22
+ Validator::make($input, [
23
+ 'name' => ['required', 'string', 'max:255'],
24
+
25
+ 'email' => [
26
+ 'required',
27
+ 'string',
28
+ 'email',
29
+ 'max:255',
30
+ Rule::unique('users')->ignore($user->id()),
31
+ ],
32
+ ])->validateWithBag('updateProfileInformation');
33
+
34
+ if ($input['email'] !== $user->email() && $user instanceof MustVerifyEmail) {
35
+ $this->updateVerifiedUser($user, $input);
36
+ } else {
37
+ resolve(Users::class)->update($user->id(), [
38
+ 'name' => $input['name'],
39
+ 'email' => $input['email'],
40
+ ]);
41
+ }
42
+ }
43
+
44
+ /**
45
+ * Update the given verified user's profile information.
46
+ *
47
+ * @param mixed $user
48
+ * @param array $input
49
+ * @return void
50
+ */
51
+ protected function updateVerifiedUser($user, array $input)
52
+ {
53
+ $user = resolve(Users::class)->update($user->id(), [
54
+ 'name' => $input['name'],
55
+ 'email' => $input['email'],
56
+ 'email_verified_at' => null,
57
+ ]);
58
+
59
+ $user->sendEmailVerificationNotification();
60
+ }
61
+ }
@@ -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
+ }
@@ -185,6 +185,7 @@ return [
185
185
  /*
186
186
  * Package Service Providers...
187
187
  */
188
+ Folklore\ServiceProvider::class,
188
189
 
189
190
  /*
190
191
  * Application Service Providers...
@@ -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('test_with_param');
12
+ Route::getTrans('/test/{with_param}', [HomeController::class, 'index'])->nameWithLocale(
13
+ 'test_with_param'
14
+ );
12
15
  });
@@ -1,11 +1,11 @@
1
1
  "use strict";
2
2
 
3
+ var _chalk = _interopRequireDefault(require("chalk"));
4
+
3
5
  var _lodash = _interopRequireDefault(require("lodash"));
4
6
 
5
7
  var _path = _interopRequireDefault(require("path"));
6
8
 
7
- var _chalk = _interopRequireDefault(require("chalk"));
8
-
9
9
  var _generator = _interopRequireDefault(require("../../lib/generator"));
10
10
 
11
11
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
@@ -217,7 +217,12 @@ module.exports = class LernaRepositoryGenerator extends _generator.default {
217
217
  return;
218
218
  }
219
219
 
220
- this.addDevDependencies(['lerna@latest', 'glob@latest', 'mkdirp@latest', '@babel/runtime@latest']);
220
+ this.addDevDependencies({
221
+ lerna: 'latest',
222
+ glob: 'latest',
223
+ mkdirp: 'latest',
224
+ '@babel/runtime': 'latest'
225
+ });
221
226
  },
222
227
 
223
228
  bootstrap() {
@@ -240,8 +240,12 @@ module.exports = class NpmPackageGenerator extends _generator.default {
240
240
  return;
241
241
  }
242
242
 
243
- this.addDependencies(['@babel/runtime@latest']);
244
- this.addDevDependencies(['jest@latest']);
243
+ this.addDependencies({
244
+ '@babel/runtime': 'latest'
245
+ });
246
+ this.addDevDependencies({
247
+ jest: 'latest'
248
+ });
245
249
  }
246
250
 
247
251
  };
@@ -31,7 +31,11 @@ module.exports = class PrettierGenerator extends _generator.default {
31
31
  },
32
32
 
33
33
  dependencies() {
34
- this.addDevDependencies(['prettier@^2.0.0', '@prettier/plugin-php@^0.18.0', '@trivago/prettier-plugin-sort-imports@^3.0.0']);
34
+ this.addDevDependencies({
35
+ prettier: 'latest',
36
+ '@prettier/plugin-php': 'latest',
37
+ '@trivago/prettier-plugin-sort-imports': 'latest'
38
+ });
35
39
  }
36
40
 
37
41
  };
@@ -108,8 +108,28 @@ module.exports = class ReactAppGenerator extends _generator.default {
108
108
  },
109
109
 
110
110
  dependencies() {
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']);
111
+ this.addDependencies({
112
+ react: '^18.0.0',
113
+ 'react-dom': '^18.0.0',
114
+ 'prop-types': '^15.0.0',
115
+ 'react-intl': '^6.0.0',
116
+ 'react-router': '^6.0.0',
117
+ 'react-router-dom': '^6.0.0',
118
+ 'react-helmet': '^6.0.0',
119
+ classnames: 'latest',
120
+ '@folklore/routes': '^0.1.1',
121
+ '@folklore/fonts': '^0.0.11',
122
+ '@folklore/forms': '^0.0.19',
123
+ '@folklore/fetch': '^0.1.15',
124
+ '@folklore/hooks': '^0.0.27',
125
+ '@folklore/tracking': '^0.0.14',
126
+ // Polyfills
127
+ intl: 'latest',
128
+ '@formatjs/intl-locale': 'latest',
129
+ '@formatjs/intl-pluralrules': 'latest',
130
+ 'intersection-observer': 'latest',
131
+ 'resize-observer-polyfill': 'latest'
132
+ });
113
133
  }
114
134
 
115
135
  };
@@ -8,21 +8,23 @@ import { BrowserRouter } from 'react-router-dom';
8
8
  import App from './App';
9
9
 
10
10
  const propTypes = {
11
- locale: PropTypes.string,
12
- messages: PropTypes.oneOfType([
13
- PropTypes.objectOf(PropTypes.objectOf(PropTypes.string)),
14
- PropTypes.objectOf(PropTypes.string),
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
- locale: 'fr',
21
- messages: {},
22
+ intl: null,
22
23
  routes: {},
23
24
  };
24
25
 
25
- function Container({ locale, messages, routes }) {
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>
@@ -1,13 +1,13 @@
1
1
  "use strict";
2
2
 
3
- var _lodash = _interopRequireDefault(require("lodash"));
4
-
5
- var _path = _interopRequireDefault(require("path"));
6
-
7
3
  var _chalk = _interopRequireDefault(require("chalk"));
8
4
 
9
5
  var _changeCase = require("change-case");
10
6
 
7
+ var _lodash = _interopRequireDefault(require("lodash"));
8
+
9
+ var _path = _interopRequireDefault(require("path"));
10
+
11
11
  var _generator = _interopRequireDefault(require("../../lib/generator"));
12
12
 
13
13
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
@@ -192,7 +192,16 @@ module.exports = class ReactPackageGenerator extends _generator.default {
192
192
  return;
193
193
  }
194
194
 
195
- this.addDevDependencies(['domready@latest', 'jquery@latest', 'enzyme@latest', 'react-test-renderer@latest', '@storybook/react@latest', '@storybook/addon-actions@latest', 'extract-text-webpack-plugin@latest', 'html-webpack-plugin@latest']);
195
+ this.addDevDependencies({
196
+ domready: 'latest',
197
+ jquery: 'latest',
198
+ enzyme: 'latest',
199
+ 'react-test-renderer': 'latest',
200
+ '@storybook/react': 'latest',
201
+ '@storybook/addon-actions': 'latest',
202
+ 'extract-text-webpack-plugin': 'latest',
203
+ 'html-webpack-plugin': 'latest'
204
+ });
196
205
  }
197
206
 
198
207
  };
@@ -37,7 +37,14 @@ module.exports = class RollupGenerator extends _generator.default {
37
37
  },
38
38
 
39
39
  dependencies() {
40
- this.addDevDependencies(['@rollup/plugin-babel', '@rollup/plugin-commonjs', '@rollup/plugin-json', '@rollup/plugin-node-resolve', '@rollup/plugin-replace', 'rollup']);
40
+ this.addDevDependencies({
41
+ '@rollup/plugin-babel': 'latest',
42
+ '@rollup/plugin-commonjs': 'latest',
43
+ '@rollup/plugin-json': 'latest',
44
+ '@rollup/plugin-node-resolve': 'latest',
45
+ '@rollup/plugin-replace': 'latest',
46
+ rollup: '^2.79.1'
47
+ });
41
48
  }
42
49
 
43
50
  };
@@ -60,10 +60,17 @@ module.exports = class ServerGenerator extends _generator.default {
60
60
  const {
61
61
  'socket-io': socketIo
62
62
  } = this.options;
63
- this.addDependencies(['commander', 'debug', 'ejs', 'express']);
63
+ this.addDependencies({
64
+ commander: 'latest',
65
+ debug: 'latest',
66
+ ejs: 'latest',
67
+ express: 'latest'
68
+ });
64
69
 
65
70
  if (socketIo) {
66
- this.addDependencies(['socket.io']);
71
+ this.addDependencies({
72
+ 'socket.io': 'latest'
73
+ });
67
74
  }
68
75
  }
69
76
 
@@ -79,7 +79,15 @@ module.exports = class StorybookGenerator extends _generator.default {
79
79
  return;
80
80
  }
81
81
 
82
- this.addDevDependencies(['@storybook/addon-actions@latest', '@storybook/addon-info@latest', '@storybook/addon-storyshots@latest', '@storybook/addons@latest', '@storybook/react@latest', '@storybook/storybook-deployer@latest', 'glob-loader@latest']);
82
+ this.addDevDependencies({
83
+ '@storybook/addon-actions': 'latest',
84
+ '@storybook/addon-info': 'latest',
85
+ '@storybook/addon-storyshots': 'latest',
86
+ '@storybook/addons': 'latest',
87
+ '@storybook/react': 'latest',
88
+ '@storybook/storybook-deployer': 'latest',
89
+ 'glob-loader': 'latest'
90
+ });
83
91
  }
84
92
 
85
93
  };
@@ -12,7 +12,7 @@ module.exports = class StylelintGenerator extends _generator.default {
12
12
  this.option('camel-case', {
13
13
  type: Boolean,
14
14
  required: false,
15
- defaults: false
15
+ defaults: true
16
16
  });
17
17
  }
18
18
 
@@ -37,7 +37,12 @@ module.exports = class StylelintGenerator extends _generator.default {
37
37
  },
38
38
 
39
39
  dependencies() {
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']);
40
+ this.addDevDependencies({
41
+ stylelint: '^14.0.0',
42
+ 'stylelint-config-standard-scss': 'latest',
43
+ 'stylelint-config-idiomatic-order': 'latest',
44
+ 'stylelint-config-prettier': 'latest'
45
+ });
41
46
  }
42
47
 
43
48
  };
@@ -67,7 +67,16 @@ module.exports = class TestGenerator extends _generator.default {
67
67
  return;
68
68
  }
69
69
 
70
- this.addDevDependencies(['babel-jest@latest', 'enzyme@latest', 'enzyme-adapter-react-16@latest', 'eslint-plugin-jest@latest', 'jest@latest', 'jsdom@latest', 'react-test-renderer@latest', 'sinon@latest']);
70
+ this.addDevDependencies({
71
+ 'babel-jest': 'latest',
72
+ enzyme: 'latest',
73
+ 'enzyme-adapter-react-16': 'latest',
74
+ 'eslint-plugin-jest': 'latest',
75
+ jest: 'latest',
76
+ jsdom: 'latest',
77
+ 'react-test-renderer': 'latest',
78
+ sinon: 'latest'
79
+ });
71
80
  }
72
81
 
73
82
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "generator-folklore",
3
- "version": "3.0.7",
3
+ "version": "3.0.9",
4
4
  "description": "Yeoman generator for projects at Folklore",
5
5
  "keywords": [
6
6
  "yeoman-generator"
@@ -37,8 +37,8 @@
37
37
  "is-utf8": "^0.2.1",
38
38
  "lodash": "^4.17.21",
39
39
  "password-generator": "^2.3.2",
40
- "yeoman-generator": "^5.6.1",
40
+ "yeoman-generator": "^5.7.0",
41
41
  "yeoman-remote": "^1.0.1"
42
42
  },
43
- "gitHead": "bc3878a65d256dd8742a6deea2699252d4a4dfb0"
43
+ "gitHead": "88e0fd31cded9ff974e5b50f4c76464ef26efb12"
44
44
  }