generator-folklore 3.0.3 → 3.0.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (205) hide show
  1. package/lib/generators/app/index.js +3 -51
  2. package/lib/generators/babel/index.js +28 -101
  3. package/lib/generators/babel/templates/config.js +16 -0
  4. package/lib/generators/browserslist/index.js +4 -9
  5. package/lib/generators/build/index.js +40 -29
  6. package/lib/generators/cli/index.js +92 -0
  7. package/lib/generators/cli/templates/cli.js +22 -0
  8. package/lib/generators/cli/templates/commands/default.js +16 -0
  9. package/lib/generators/docs/index.js +1 -2
  10. package/lib/generators/editorconfig/index.js +12 -22
  11. package/lib/generators/eslint/index.js +12 -13
  12. package/lib/generators/{html → html-project}/index.js +60 -73
  13. package/lib/generators/{html → html-project}/templates/folklore.png +0 -0
  14. package/lib/generators/{html → html-project}/templates/gitignore +0 -0
  15. package/lib/generators/{html → html-project}/templates/index.html.ejs +4 -1
  16. package/lib/generators/intl/index.js +93 -0
  17. package/lib/generators/laravel/index.js +5 -5
  18. package/lib/generators/laravel-mediatheque/index.js +133 -0
  19. package/lib/generators/laravel-mediatheque/templates/app/Models/Media.php +9 -0
  20. package/lib/generators/laravel-mediatheque/templates/app/Models/MediaFile.php +9 -0
  21. package/lib/generators/laravel-panneau/index.js +49 -28
  22. package/lib/generators/laravel-panneau/templates/app/Contracts/Repositories/Pages.php +19 -0
  23. package/lib/generators/laravel-panneau/templates/app/Contracts/Resources/Blocks/Text.php +10 -0
  24. package/lib/generators/laravel-panneau/templates/app/Contracts/Resources/Page.php +10 -0
  25. package/lib/generators/laravel-panneau/templates/app/Contracts/Resources/Pages/Home.php +9 -0
  26. package/lib/generators/laravel-panneau/templates/app/Http/Resources/BlockResource.php +37 -0
  27. package/lib/generators/laravel-panneau/templates/app/Http/Resources/BlocksCollection.php +8 -0
  28. package/lib/generators/laravel-panneau/templates/app/Http/Resources/PageResource.php +47 -0
  29. package/lib/generators/laravel-panneau/templates/app/Http/Resources/PagesCollection.php +10 -0
  30. package/lib/generators/laravel-panneau/templates/app/Models/Block.php +3 -13
  31. package/lib/generators/laravel-panneau/templates/app/Models/Page.php +3 -60
  32. package/lib/generators/laravel-panneau/templates/app/Panneau/Composers/AppComposer.php +50 -0
  33. package/lib/generators/laravel-panneau/templates/app/Panneau/Fields/Block.php +22 -0
  34. package/lib/generators/laravel-panneau/templates/app/Panneau/Fields/Blocks.php +87 -0
  35. package/lib/generators/laravel-panneau/templates/app/Panneau/Fields/Page.php +51 -0
  36. package/lib/generators/laravel-panneau/templates/app/Panneau/Fields/PageSlug.php +34 -0
  37. package/lib/generators/laravel-panneau/templates/app/Panneau/Fields/PageSlugLocalized.php +18 -0
  38. package/lib/generators/laravel-panneau/templates/app/Panneau/Http/Controllers/AccountController.php +41 -0
  39. package/lib/generators/laravel-panneau/templates/app/Panneau/Http/Controllers/Controller.php +19 -0
  40. package/lib/generators/laravel-panneau/templates/app/Panneau/Http/Controllers/HomeController.php +16 -0
  41. package/lib/generators/laravel-panneau/templates/app/Panneau/Http/Controllers/PagesController.php +24 -0
  42. package/lib/generators/laravel-panneau/templates/app/Panneau/Http/Controllers/UploadController.php +27 -0
  43. package/lib/generators/laravel-panneau/templates/app/Panneau/Http/Controllers/UsersController.php +32 -0
  44. package/lib/generators/laravel-panneau/templates/app/Panneau/Http/Requests/AccountUpdateRequest.php +29 -0
  45. package/lib/generators/laravel-panneau/templates/app/Panneau/Http/Requests/UploadRequest.php +29 -0
  46. package/lib/generators/laravel-panneau/templates/app/Panneau/Http/Resources/BlockResource.php +39 -0
  47. package/lib/generators/laravel-panneau/templates/app/Panneau/Http/Resources/BlocksCollection.php +8 -0
  48. package/lib/generators/laravel-panneau/templates/app/Panneau/Http/Resources/PageResource.php +56 -0
  49. package/lib/generators/laravel-panneau/templates/app/Panneau/Http/Resources/PagesCollection.php +10 -0
  50. package/lib/generators/laravel-panneau/templates/app/Panneau/Http/Resources/UserResource.php +24 -0
  51. package/lib/generators/laravel-panneau/templates/app/Panneau/PanneauServiceProvider.php +48 -0
  52. package/lib/generators/laravel-panneau/templates/app/Panneau/Policies/PanneauPolicy.php +32 -0
  53. package/lib/generators/laravel-panneau/templates/app/Panneau/Resources/Blocks/BlockWithBlocks.php +110 -0
  54. package/lib/generators/laravel-panneau/templates/app/Panneau/Resources/Blocks/TextBlock.php +27 -0
  55. package/lib/generators/laravel-panneau/templates/app/Panneau/Resources/Blocks.php +42 -0
  56. package/lib/generators/laravel-panneau/templates/app/Panneau/Resources/Pages/Page.php +28 -0
  57. package/lib/generators/laravel-panneau/templates/app/Panneau/Resources/Pages.php +92 -0
  58. package/lib/generators/laravel-panneau/templates/app/Panneau/Resources/Users.php +57 -0
  59. package/lib/generators/laravel-panneau/templates/app/Repositories/Pages.php +42 -0
  60. package/lib/generators/laravel-panneau/templates/app/Resources/Blocks/TextBlock.php +14 -0
  61. package/lib/generators/laravel-panneau/templates/app/Resources/Page.php +10 -0
  62. package/lib/generators/laravel-panneau/templates/app/Resources/Pages/HomePage.php +10 -0
  63. package/lib/generators/laravel-panneau/templates/app.blade.php +8 -0
  64. package/lib/generators/laravel-panneau/templates/index.js +32 -0
  65. package/lib/generators/laravel-panneau/templates/lang/en/panneau.php +62 -0
  66. package/lib/generators/laravel-panneau/templates/lang/fr/panneau.php +62 -0
  67. package/lib/generators/laravel-panneau/templates/layout.blade.php +17 -48
  68. package/lib/generators/laravel-panneau/templates/resources/assets/js/components/Panneau.jsx +68 -0
  69. package/lib/generators/{js/templates/src/lib/.gitkeep → laravel-panneau/templates/resources/assets/js/components/panneau/fields/PageSlug.jsx} +0 -0
  70. package/lib/generators/laravel-panneau/templates/resources/assets/js/components/panneau/fields/PageSlugLocalized.jsx +43 -0
  71. package/lib/generators/laravel-panneau/templates/resources/assets/js/components/panneau/fields/index.js +2 -0
  72. package/lib/generators/laravel-panneau/templates/resources/assets/styles/panneau.scss +2 -0
  73. package/lib/generators/laravel-panneau/templates/routes.php +30 -0
  74. package/lib/generators/laravel-project/index.js +504 -0
  75. package/lib/generators/laravel-project/templates/env +41 -0
  76. package/lib/generators/laravel-project/templates/laravel/app/Composers/AppComposer.php +48 -0
  77. package/lib/generators/laravel-project/templates/laravel/app/Composers/IntlComposer.php +10 -0
  78. package/lib/generators/laravel-project/templates/laravel/app/Composers/MetaComposer.php +48 -0
  79. package/lib/generators/laravel-project/templates/laravel/app/Composers/RoutesComposer.php +19 -0
  80. package/lib/generators/laravel-project/templates/laravel/app/Contracts/Resources/User.php +10 -0
  81. package/lib/generators/laravel-project/templates/laravel/app/Http/Controllers/HomeController.php +18 -0
  82. package/lib/generators/laravel-project/templates/laravel/app/Http/Middleware/TrustProxies.php +28 -0
  83. package/lib/generators/laravel-project/templates/laravel/app/Http/Resources/UserResource.php +21 -0
  84. package/lib/generators/laravel-project/templates/laravel/app/Models/User.php +50 -0
  85. package/lib/generators/laravel-project/templates/laravel/app/Providers/AppServiceProvider.php +45 -0
  86. package/lib/generators/laravel-project/templates/laravel/app/Providers/RouteServiceProvider.php +64 -0
  87. package/lib/generators/laravel-project/templates/laravel/app/Providers/ViewServiceProvider.php +33 -0
  88. package/lib/generators/laravel-project/templates/laravel/app/Repositories/Users.php +36 -0
  89. package/lib/generators/laravel-project/templates/laravel/app/Resources/User.php +11 -0
  90. package/lib/generators/laravel-project/templates/laravel/config/app.php +216 -0
  91. package/lib/generators/laravel-project/templates/laravel/config/auth.php +116 -0
  92. package/lib/generators/laravel-project/templates/laravel/config/services.php +39 -0
  93. package/lib/generators/laravel-project/templates/laravel/lang/en/content.php +5 -0
  94. package/lib/generators/laravel-project/templates/laravel/lang/en/errors.php +17 -0
  95. package/lib/generators/laravel-project/templates/laravel/lang/en/meta.php +11 -0
  96. package/lib/generators/laravel-project/templates/laravel/lang/en/routes.php +4 -0
  97. package/lib/generators/laravel-project/templates/laravel/lang/fr/auth.php +19 -0
  98. package/lib/generators/laravel-project/templates/laravel/lang/fr/content.php +5 -0
  99. package/lib/generators/laravel-project/templates/laravel/lang/fr/errors.php +17 -0
  100. package/lib/generators/laravel-project/templates/laravel/lang/fr/meta.php +11 -0
  101. package/lib/generators/laravel-project/templates/laravel/lang/fr/pagination.php +19 -0
  102. package/lib/generators/laravel-project/templates/laravel/lang/fr/passwords.php +22 -0
  103. package/lib/generators/laravel-project/templates/laravel/lang/fr/routes.php +12 -0
  104. package/lib/generators/laravel-project/templates/laravel/lang/fr/validation.php +146 -0
  105. package/lib/generators/{js/templates/styles → laravel-project/templates/laravel/resources/assets/fonts}/.gitkeep +0 -0
  106. package/lib/generators/{laravel-panneau/templates/app/Schemas/Fields → laravel-project/templates/laravel/resources/assets/img}/.gitkeep +0 -0
  107. package/lib/generators/laravel-project/templates/laravel/resources/assets/img/folklore.png +0 -0
  108. package/lib/generators/laravel-project/templates/laravel/resources/views/analytics/body.blade.php +3 -0
  109. package/lib/generators/laravel-project/templates/laravel/resources/views/analytics/gpt.blade.php +16 -0
  110. package/lib/generators/laravel-project/templates/laravel/resources/views/analytics/head.blade.php +1 -0
  111. package/lib/generators/laravel-project/templates/laravel/resources/views/app.blade.php +8 -0
  112. package/lib/generators/laravel-project/templates/laravel/resources/views/errors/401.blade.php +8 -0
  113. package/lib/generators/laravel-project/templates/laravel/resources/views/errors/403.blade.php +8 -0
  114. package/lib/generators/laravel-project/templates/laravel/resources/views/errors/404.blade.php +8 -0
  115. package/lib/generators/laravel-project/templates/laravel/resources/views/errors/500.blade.php +8 -0
  116. package/lib/generators/laravel-project/templates/laravel/resources/views/layout.blade.php +33 -0
  117. package/lib/generators/laravel-project/templates/laravel/resources/views/meta/all.blade.php +4 -0
  118. package/lib/generators/laravel-project/templates/laravel/resources/views/meta/base.blade.php +11 -0
  119. package/lib/generators/laravel-project/templates/laravel/resources/views/meta/facebook.blade.php +4 -0
  120. package/lib/generators/laravel-project/templates/laravel/resources/views/meta/opengraph.blade.php +9 -0
  121. package/lib/generators/laravel-project/templates/laravel/resources/views/meta/twitter.blade.php +5 -0
  122. package/lib/generators/laravel-project/templates/laravel/routes/web.php +12 -0
  123. package/lib/generators/lerna-package/index.js +1 -3
  124. package/lib/generators/lerna-repository/index.js +1 -3
  125. package/lib/generators/node-project/index.js +164 -0
  126. package/lib/generators/node-project/templates/index.js +0 -0
  127. package/lib/generators/npm-package/index.js +3 -5
  128. package/lib/generators/prettier/index.js +19 -6
  129. package/lib/generators/prettier/templates/prettierrc.json +3 -1
  130. package/lib/generators/{js → react-app}/index.js +22 -52
  131. package/lib/generators/{js → react-app}/templates/_package.json +0 -0
  132. package/lib/generators/react-app/templates/index.js +23 -0
  133. package/lib/generators/react-app/templates/src/components/App.jsx +46 -0
  134. package/lib/generators/react-app/templates/src/components/Container.jsx +40 -0
  135. package/lib/generators/{js → react-app}/templates/src/components/buttons/Button.jsx +4 -18
  136. package/lib/generators/react-app/templates/src/components/layouts/Main.jsx +27 -0
  137. package/lib/generators/react-app/templates/src/components/menus/Menu.jsx +62 -0
  138. package/lib/generators/{js → react-app}/templates/src/components/pages/Error.jsx +10 -14
  139. package/lib/generators/react-app/templates/src/components/pages/Home.jsx +32 -0
  140. package/lib/generators/{js → react-app}/templates/src/components/partials/PageMeta.jsx +11 -11
  141. package/lib/generators/{js → react-app}/templates/src/contexts/KeysContext.jsx +0 -0
  142. package/lib/generators/react-app/templates/src/lib/.gitkeep +0 -0
  143. package/lib/generators/{js → react-app}/templates/src/lib/PropTypes.js +0 -0
  144. package/lib/generators/{js → react-app}/templates/src/lib/utils.js +0 -0
  145. package/lib/generators/react-app/templates/src/polyfills/index.js +6 -0
  146. package/lib/generators/react-app/templates/src/polyfills/intl-en.js +2 -0
  147. package/lib/generators/react-app/templates/src/polyfills/intl-fr.js +2 -0
  148. package/lib/generators/react-app/templates/src/polyfills/should.js +14 -0
  149. package/lib/generators/react-app/templates/styles/.gitkeep +0 -0
  150. package/lib/generators/{js/templates/styles/buttons/button.scss → react-app/templates/styles/buttons/button.module.scss} +1 -0
  151. package/lib/generators/{js/templates/styles/layouts/main.scss → react-app/templates/styles/layouts/main.module.scss} +0 -0
  152. package/lib/generators/{js/templates/styles/menus/menu.scss → react-app/templates/styles/menus/menu.module.scss} +0 -0
  153. package/lib/generators/{js/templates/styles/pages/error.scss → react-app/templates/styles/pages/error.module.scss} +0 -0
  154. package/lib/generators/{js/templates/styles/pages/home.scss → react-app/templates/styles/pages/home.module.scss} +0 -0
  155. package/lib/generators/rollup/index.js +54 -0
  156. package/lib/generators/rollup/templates/config.js +50 -0
  157. package/lib/generators/scss/index.js +3 -16
  158. package/lib/generators/scss/templates/{main.scss → styles.scss} +0 -0
  159. package/lib/generators/server/index.js +81 -0
  160. package/lib/generators/server/templates/server.js +59 -0
  161. package/lib/generators/storybook/index.js +1 -7
  162. package/lib/generators/stylelint/index.js +13 -14
  163. package/lib/lib/generator.js +9 -0
  164. package/lib/lib/utils.js +17 -0
  165. package/package.json +2 -2
  166. package/lib/generators/babel/templates/babel-preset-react.js +0 -7
  167. package/lib/generators/babel/templates/babel-preset.js +0 -57
  168. package/lib/generators/babel/templates/babelrc +0 -5
  169. package/lib/generators/babel/templates/utils/processScss.js +0 -10
  170. package/lib/generators/babel/templates/utils/transformRequireIgnore.js +0 -80
  171. package/lib/generators/html/templates/index.js +0 -9
  172. package/lib/generators/html/templates/root.js +0 -23
  173. package/lib/generators/html/templates/utils.js +0 -7
  174. package/lib/generators/js/templates/browserslistrc +0 -9
  175. package/lib/generators/js/templates/config.js +0 -33
  176. package/lib/generators/js/templates/index.js +0 -41
  177. package/lib/generators/js/templates/src/actions/LayoutActions.js +0 -12
  178. package/lib/generators/js/templates/src/actions/SiteActions.js +0 -22
  179. package/lib/generators/js/templates/src/components/App.jsx +0 -52
  180. package/lib/generators/js/templates/src/components/Root.jsx +0 -70
  181. package/lib/generators/js/templates/src/components/layouts/Main.jsx +0 -52
  182. package/lib/generators/js/templates/src/components/menus/Menu.jsx +0 -60
  183. package/lib/generators/js/templates/src/components/messages/Success.jsx +0 -36
  184. package/lib/generators/js/templates/src/components/pages/Home.jsx +0 -32
  185. package/lib/generators/js/templates/src/components/partials/Label.jsx +0 -32
  186. package/lib/generators/js/templates/src/reducers/LayoutReducer.js +0 -32
  187. package/lib/generators/js/templates/src/reducers/SiteReducer.js +0 -36
  188. package/lib/generators/js/templates/src/reducers/index.js +0 -7
  189. package/lib/generators/js/templates/src/vendor/polyfills/intl-en.js +0 -2
  190. package/lib/generators/js/templates/src/vendor/polyfills/intl-fr.js +0 -2
  191. package/lib/generators/laravel-panneau/templates/_composer.json +0 -6
  192. package/lib/generators/laravel-panneau/templates/_package.json +0 -11
  193. package/lib/generators/laravel-panneau/templates/app/Http/Controllers/Panneau/HomeController.php +0 -14
  194. package/lib/generators/laravel-panneau/templates/app/Http/Controllers/Panneau/PagesController.php +0 -11
  195. package/lib/generators/laravel-panneau/templates/app/Models/Mediatheque/File.php +0 -13
  196. package/lib/generators/laravel-panneau/templates/app/Models/Mediatheque/Picture.php +0 -13
  197. package/lib/generators/laravel-panneau/templates/app/Models/Mediatheque/Video.php +0 -34
  198. package/lib/generators/laravel-panneau/templates/app/Providers/PanneauServiceProvider.php +0 -23
  199. package/lib/generators/laravel-panneau/templates/app/Reducers/SlugExtractReducer.php +0 -18
  200. package/lib/generators/laravel-panneau/templates/app/Resources/Pages.php +0 -54
  201. package/lib/generators/laravel-panneau/templates/app/Schemas/Blocks/Base.php +0 -22
  202. package/lib/generators/laravel-panneau/templates/app/Schemas/Bubbles/Base.php +0 -22
  203. package/lib/generators/laravel-panneau/templates/app/Schemas/Pages/Base.php +0 -36
  204. package/lib/generators/laravel-panneau/templates/resources/lang/en/panneau.php +0 -12
  205. package/lib/generators/laravel-panneau/templates/resources/lang/fr/panneau.php +0 -12
@@ -1,16 +1,16 @@
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 }; }
12
12
 
13
- module.exports = class HTMLGenerator extends _generator.default {
13
+ module.exports = class HTMLProjectGenerator extends _generator.default {
14
14
  // The name `constructor` is important here
15
15
  constructor(...args) {
16
16
  super(...args);
@@ -18,21 +18,11 @@ module.exports = class HTMLGenerator extends _generator.default {
18
18
  type: String,
19
19
  required: false
20
20
  });
21
- this.option('path', {
22
- type: String,
23
- desc: 'Path for the html project',
24
- defaults: './'
25
- });
26
21
  this.option('src-path', {
27
22
  type: String,
28
23
  desc: 'Path for source',
29
24
  defaults: './src'
30
25
  });
31
- this.option('tmp-path', {
32
- type: String,
33
- desc: 'Path for temp files',
34
- defaults: './.tmp'
35
- });
36
26
  this.option('dest-path', {
37
27
  type: String,
38
28
  desc: 'Path for build',
@@ -43,26 +33,11 @@ module.exports = class HTMLGenerator extends _generator.default {
43
33
  desc: 'Path for the javascript',
44
34
  defaults: ''
45
35
  });
46
- this.option('css-path', {
47
- type: String,
48
- desc: 'Path for the css',
49
- defaults: 'css'
50
- });
51
- this.option('scss-path', {
36
+ this.option('styles-path', {
52
37
  type: String,
53
38
  desc: 'Path for the scss',
54
39
  defaults: 'styles'
55
40
  });
56
- this.option('images-path', {
57
- type: String,
58
- desc: 'Path for the images',
59
- defaults: 'img'
60
- });
61
- this.option('build-path', {
62
- type: String,
63
- desc: 'Path for the build tools',
64
- defaults: 'build'
65
- });
66
41
  this.option('server', {
67
42
  type: Boolean,
68
43
  defaults: false,
@@ -70,7 +45,12 @@ module.exports = class HTMLGenerator extends _generator.default {
70
45
  });
71
46
  this.option('server-path', {
72
47
  type: String,
73
- desc: 'Path for the node.js server'
48
+ desc: 'Path for the node.js server',
49
+ defaults: ''
50
+ });
51
+ this.option('server-filename', {
52
+ type: String,
53
+ desc: 'Filename for the node.js server'
74
54
  });
75
55
 
76
56
  this.srcPath = filePath => this.destinationPath(_path.default.join(this.options['src-path'], filePath));
@@ -84,7 +64,7 @@ module.exports = class HTMLGenerator extends _generator.default {
84
64
  }
85
65
 
86
66
  console.log(_chalk.default.yellow('\n----------------------'));
87
- console.log('HTML Generator');
67
+ console.log('HTML Project Generator');
88
68
  console.log(_chalk.default.yellow('----------------------\n'));
89
69
  },
90
70
 
@@ -110,64 +90,75 @@ module.exports = class HTMLGenerator extends _generator.default {
110
90
  }
111
91
 
112
92
  configuring() {
113
- const projectName = _lodash.default.get(this.options, 'project-name');
114
-
115
- const projectPath = this.destinationPath();
116
-
117
- const srcPath = _lodash.default.get(this.options, 'src-path');
118
-
119
- const destPath = _lodash.default.get(this.options, 'dest-path');
120
-
121
- const buildPath = _lodash.default.get(this.options, 'build-path') || `${projectPath}/build`;
122
-
123
- const jsPath = _lodash.default.get(this.options, 'js-path');
124
-
125
- const jsSrcPath = _path.default.join(projectPath, srcPath, jsPath);
93
+ const {
94
+ 'project-name': projectName,
95
+ 'src-path': srcPath,
96
+ 'dest-path': destPath,
97
+ 'js-path': jsPath,
98
+ 'styles-path': stylesPath,
99
+ 'server-path': serverPath,
100
+ 'server-filename': serverFilename
101
+ } = this.options;
126
102
 
127
- const scssPath = _lodash.default.get(this.options, 'scss-path');
103
+ const jsSrcPath = _path.default.join(srcPath, jsPath);
128
104
 
129
- const scssSrcPath = _path.default.join(projectPath, srcPath, scssPath);
105
+ const stylesSrcPath = _path.default.join(srcPath, stylesPath);
130
106
 
131
- const skipInstall = _lodash.default.get(this.options, 'skip-install', false);
107
+ const serverSrcPath = _path.default.join(srcPath, serverPath);
132
108
 
133
- this.composeWith('folklore:js', {
134
- 'project-name': projectName,
135
- 'hot-reload': true,
136
- path: jsSrcPath,
137
- 'root-props-import': './data/root',
138
- 'skip-install': skipInstall,
109
+ this.composeWith('folklore:prettier', {
110
+ 'skip-install': true,
111
+ quiet: true
112
+ });
113
+ this.composeWith('folklore:eslint', {
114
+ 'skip-install': true,
115
+ quiet: true
116
+ });
117
+ this.composeWith('folklore:stylelint', {
118
+ 'skip-install': true,
119
+ quiet: true
120
+ });
121
+ this.composeWith('folklore:browserslist', {
122
+ 'skip-install': true,
139
123
  quiet: true
140
124
  });
141
125
  this.composeWith('folklore:editorconfig', {
142
126
  quiet: true
143
127
  });
128
+ this.composeWith('folklore:react-app', {
129
+ 'project-name': projectName,
130
+ path: jsSrcPath,
131
+ stylesPath: stylesSrcPath,
132
+ 'skip-install': true,
133
+ quiet: true
134
+ });
144
135
  this.composeWith('folklore:scss', {
145
136
  'project-name': projectName,
146
- path: scssSrcPath,
137
+ path: stylesSrcPath,
147
138
  react: true,
148
- 'skip-install': skipInstall,
139
+ 'skip-install': true,
149
140
  quiet: true
150
141
  });
151
142
 
152
143
  if (this.options.server) {
153
144
  this.composeWith('folklore:server', {
154
- 'project-name': projectName,
155
- path: _lodash.default.get(this.options, 'server-path') || `${projectPath}/server`,
156
- 'skip-install': skipInstall,
145
+ path: serverSrcPath,
146
+ filename: serverFilename,
147
+ 'skip-install': true,
157
148
  quiet: true
158
149
  });
159
150
  }
160
151
 
152
+ console.log(srcPath, jsSrcPath, _path.default.join(jsSrcPath, 'index.js'), _path.default.join(srcPath, 'index.html.ejs'));
161
153
  this.composeWith('folklore:build', {
162
- path: buildPath,
163
154
  'src-path': srcPath,
164
- 'entry-path': _path.default.join(srcPath, 'index'),
155
+ 'entry-path': _path.default.join(jsSrcPath, 'index.js'),
165
156
  'html-path': _path.default.join(srcPath, 'index.html.ejs'),
166
157
  'build-path': destPath,
167
158
  'empty-path': destPath,
168
159
  copy: true,
169
160
  'copy-path': _path.default.join(srcPath, '*.{html,ico,txt,png}'),
170
- 'skip-install': skipInstall,
161
+ 'skip-install': true,
171
162
  quiet: true
172
163
  });
173
164
  }
@@ -196,18 +187,6 @@ module.exports = class HTMLGenerator extends _generator.default {
196
187
  this.fs.copy(srcPath, destPath);
197
188
  },
198
189
 
199
- data() {
200
- const srcPath = this.templatePath('root.js');
201
- const destPath = this.srcPath('data/root.js');
202
- this.fs.copy(srcPath, destPath);
203
- },
204
-
205
- utils() {
206
- const srcPath = this.templatePath('utils.js');
207
- const destPath = this.srcPath('lib/utils.js');
208
- this.fs.copy(srcPath, destPath);
209
- },
210
-
211
190
  gitignore() {
212
191
  const srcPath = this.templatePath('gitignore');
213
192
  const destPath = this.destinationPath('.gitignore');
@@ -217,4 +196,12 @@ module.exports = class HTMLGenerator extends _generator.default {
217
196
  };
218
197
  }
219
198
 
199
+ async install() {
200
+ if (this.options['skip-install']) {
201
+ return;
202
+ }
203
+
204
+ await this.spawnCommand('npm', ['install']);
205
+ }
206
+
220
207
  };
@@ -18,6 +18,9 @@
18
18
  <meta property="og:url" content="">
19
19
  </head>
20
20
  <body>
21
- <div id="root"></div>
21
+ <script type="text/javascript">
22
+ var props = {};
23
+ </script>
24
+ <div id="app"></div>
22
25
  </body>
23
26
  </html>
@@ -0,0 +1,93 @@
1
+ "use strict";
2
+
3
+ var _chalk = _interopRequireDefault(require("chalk"));
4
+
5
+ var _path = _interopRequireDefault(require("path"));
6
+
7
+ var _generator = _interopRequireDefault(require("../../lib/generator"));
8
+
9
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
10
+
11
+ module.exports = class IntlGenerator extends _generator.default {
12
+ constructor(...args) {
13
+ super(...args);
14
+ this.option('translations-path', {
15
+ type: String,
16
+ desc: 'Path for to search for translations',
17
+ defaults: './src/**/*.{js,jsx}'
18
+ });
19
+ this.option('locales', {
20
+ type: String,
21
+ desc: 'Supported locales',
22
+ defaults: 'fr,en'
23
+ });
24
+ this.option('output-path', {
25
+ type: String,
26
+ desc: 'Path to output locale files',
27
+ defaults: './locale'
28
+ });
29
+ this.option('json-path', {
30
+ type: String,
31
+ desc: 'Path to copy json files'
32
+ });
33
+ this.option('without-id-only', {
34
+ type: String,
35
+ desc: 'Extract only messages without id',
36
+ defaults: false
37
+ });
38
+ }
39
+
40
+ get prompting() {
41
+ return {
42
+ welcome() {
43
+ if (this.options.quiet) {
44
+ return;
45
+ }
46
+
47
+ console.log(_chalk.default.yellow('\n----------------------'));
48
+ console.log('Intl Generator');
49
+ console.log(_chalk.default.yellow('----------------------\n'));
50
+ }
51
+
52
+ };
53
+ }
54
+
55
+ get writing() {
56
+ return {
57
+ packageJSON() {
58
+ const {
59
+ 'translations-path': translationsPath = null,
60
+ 'output-path': outputPath = null,
61
+ 'json-path': jsonPath = null,
62
+ 'without-id-only': withoutIdOnly = false,
63
+ locales
64
+ } = this.options;
65
+ const intlCommand = `flklr intl --po${withoutIdOnly ? ' --without-id-only' : ''} --output-path$ '${outputPath}' '${translationsPath}'`;
66
+ this.packageJson.merge({
67
+ scripts: jsonPath !== null ? {
68
+ intl: 'npm run intl:build && npm run intl:copy',
69
+ 'intl:build': intlCommand,
70
+ 'intl:copy': `cp ${_path.default.join(outputPath, '*.json')} ${jsonPath}`
71
+ } : {
72
+ intl: intlCommand
73
+ },
74
+ supportedLocales: locales.split(',')
75
+ });
76
+ },
77
+
78
+ dependencies() {
79
+ this.addDevDependencies(['@folklore/cli']);
80
+ }
81
+
82
+ };
83
+ }
84
+
85
+ async install() {
86
+ if (this.options['skip-install']) {
87
+ return;
88
+ }
89
+
90
+ await this.spawnCommand('npm', ['install']);
91
+ }
92
+
93
+ };
@@ -250,7 +250,7 @@ module.exports = class LaravelGenerator extends _generator.default {
250
250
  project_name: this.options['project-name']
251
251
  }).replace(/^(http)?(s)?(:\/\/)?/, 'http$2://');
252
252
 
253
- this.composeWith('folklore:js', {
253
+ this.composeWith('folklore:react-app', {
254
254
  'project-name': this.options['project-name'],
255
255
  path: jsSrcPath,
256
256
  'styles-path': stylesSrcPath,
@@ -341,11 +341,11 @@ module.exports = class LaravelGenerator extends _generator.default {
341
341
  },
342
342
 
343
343
  packageJSON() {
344
- const jsonPath = this.destinationPath('package.json');
345
344
  const packageJSON = this.fs.exists(jsonPath) ? this.fs.readJSON(jsonPath) : {};
346
- packageJSON.scripts = {};
347
- packageJSON.devDependencies = {};
348
- this.fs.writeJSON(jsonPath, packageJSON);
345
+ this.packageJson.merge(_objectSpread(_objectSpread({}, packageJSON), {}, {
346
+ scripts: {},
347
+ devDependencies: {}
348
+ }));
349
349
  },
350
350
 
351
351
  composerJSON() {
@@ -0,0 +1,133 @@
1
+ "use strict";
2
+
3
+ var _chalk = _interopRequireDefault(require("chalk"));
4
+
5
+ var _glob = _interopRequireDefault(require("glob"));
6
+
7
+ var _lodash = _interopRequireDefault(require("lodash"));
8
+
9
+ var _path = _interopRequireDefault(require("path"));
10
+
11
+ var _generator = _interopRequireDefault(require("../../lib/generator"));
12
+
13
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
14
+
15
+ module.exports = class LaravelMediathequeGenerator extends _generator.default {
16
+ constructor(...args) {
17
+ super(...args);
18
+ this.argument('project-name', {
19
+ type: String,
20
+ required: false
21
+ });
22
+ this.argument('overrides', {
23
+ type: Boolean,
24
+ required: false,
25
+ default: false
26
+ });
27
+ this.argument('skip-publish', {
28
+ type: Boolean,
29
+ required: false,
30
+ default: false
31
+ });
32
+ }
33
+
34
+ get prompting() {
35
+ return {
36
+ welcome() {
37
+ if (this.options.quiet) {
38
+ return;
39
+ }
40
+
41
+ console.log(_chalk.default.yellow('\n----------------------'));
42
+ console.log('Laravel Mediatheque Generator');
43
+ console.log(_chalk.default.yellow('----------------------\n'));
44
+ },
45
+
46
+ prompts() {
47
+ const prompts = [];
48
+
49
+ if (!this.options['project-name']) {
50
+ prompts.push(_generator.default.prompts.project_name);
51
+ }
52
+
53
+ if (!prompts.length) {
54
+ return null;
55
+ }
56
+
57
+ return this.prompt(prompts).then(answers => {
58
+ if (answers['project-name']) {
59
+ this.options['project-name'] = answers['project-name'];
60
+ }
61
+ });
62
+ }
63
+
64
+ };
65
+ }
66
+
67
+ get writing() {
68
+ return {
69
+ composerJSON() {
70
+ this.composerJson.merge({
71
+ require: {
72
+ 'folklore/laravel-folklore': 'v1.x-dev',
73
+ 'folklore/laravel-mediatheque': 'v1.1.x-dev'
74
+ }
75
+ });
76
+ },
77
+
78
+ files() {
79
+ if (!this.options.overrides) {
80
+ return;
81
+ }
82
+
83
+ const folders = ['app'];
84
+ folders.forEach(folder => {
85
+ const templatePath = this.templatePath(folder);
86
+ const destinationPath = this.destinationPath(folder);
87
+
88
+ _glob.default.sync('**', {
89
+ dot: true,
90
+ nodir: true,
91
+ cwd: templatePath
92
+ }).forEach(file => {
93
+ const source = _path.default.join(templatePath, file);
94
+
95
+ const destination = _path.default.join(destinationPath, file);
96
+
97
+ if (file.match(/\.(jpg|jpeg|gif|png)$/i)) {
98
+ this.fs.copy(source, destination);
99
+ } else {
100
+ this.fs.copyTpl(source, destination, {
101
+ project_name: this.options['project-name']
102
+ });
103
+ }
104
+ });
105
+ });
106
+ }
107
+
108
+ };
109
+ }
110
+
111
+ get install() {
112
+ return {
113
+ composer() {
114
+ if (this.options['skip-install']) {
115
+ return;
116
+ }
117
+
118
+ const done = this.async();
119
+ this.spawnCommand('composer', ['install']).on('close', done);
120
+ },
121
+
122
+ async vendorPublish() {
123
+ if (this.options['skip-publish']) {
124
+ return;
125
+ }
126
+
127
+ await this.spawnCommand('php', ['artisan', 'vendor:publish', '--provider=Folklore\\Mediatheque\\ServiceProvider']);
128
+ }
129
+
130
+ };
131
+ }
132
+
133
+ };
@@ -0,0 +1,9 @@
1
+ <?php
2
+
3
+ namespace App\Models;
4
+
5
+ use Folklore\Models\Media as BaseMedia;
6
+
7
+ class Media extends BaseMedia
8
+ {
9
+ }
@@ -0,0 +1,9 @@
1
+ <?php
2
+
3
+ namespace App\Models;
4
+
5
+ use Folklore\Models\MediaFile as BaseMediaFile;
6
+
7
+ class MediaFile extends BaseMediaFile
8
+ {
9
+ }
@@ -1,11 +1,11 @@
1
1
  "use strict";
2
2
 
3
- var _lodash = _interopRequireDefault(require("lodash"));
4
-
5
3
  var _chalk = _interopRequireDefault(require("chalk"));
6
4
 
7
5
  var _glob = _interopRequireDefault(require("glob"));
8
6
 
7
+ var _lodash = _interopRequireDefault(require("lodash"));
8
+
9
9
  var _path = _interopRequireDefault(require("path"));
10
10
 
11
11
  var _generator = _interopRequireDefault(require("../../lib/generator"));
@@ -19,11 +19,6 @@ module.exports = class LaravelPanneauGenerator extends _generator.default {
19
19
  type: String,
20
20
  required: false
21
21
  });
22
- this.option('install-npm', {
23
- type: Boolean,
24
- desc: 'Install NPM dependencies',
25
- defaults: false
26
- });
27
22
  }
28
23
 
29
24
  get prompting() {
@@ -62,24 +57,31 @@ module.exports = class LaravelPanneauGenerator extends _generator.default {
62
57
  get writing() {
63
58
  return {
64
59
  composerJSON() {
65
- const srcPath = this.templatePath('_composer.json');
66
- const destPath = this.destinationPath('composer.json');
67
- const newJson = this.fs.readJSON(srcPath);
68
- const currentJson = this.fs.exists(destPath) ? this.fs.readJSON(destPath) : {};
69
- this.fs.writeJSON(destPath, _lodash.default.merge(currentJson, newJson));
60
+ this.composerJson.merge({
61
+ require: {
62
+ 'folklore/laravel-panneau': 'v1.2.x-dev'
63
+ }
64
+ });
70
65
  },
71
66
 
72
67
  packageJSON() {
73
- const srcPath = this.templatePath('_package.json');
74
- const destPath = this.destinationPath('package.json');
75
- const newJson = this.fs.readJSON(srcPath);
76
- const currentJson = this.fs.exists(destPath) ? this.fs.readJSON(destPath) : {};
77
- this.fs.writeJSON(destPath, _lodash.default.merge(currentJson, newJson));
68
+ this.addDependencies(['@panneau/app@^1.0.0-alpha.193', '@panneau/core@^1.0.0-alpha.193']);
69
+ },
70
+
71
+ routes() {
72
+ const source = this.templatePath('routes.php');
73
+ const destination = this.destinationPath('routes/panneau.php');
74
+
75
+ if (this.fs.exists(destination)) {
76
+ this.fs.delete(destination);
77
+ }
78
+
79
+ this.fs.copyTpl(source, destination, {});
78
80
  },
79
81
 
80
82
  layout() {
81
83
  const source = this.templatePath('layout.blade.php');
82
- const destination = this.destinationPath('resources/views/vendor/panneau/index.blade.php');
84
+ const destination = this.destinationPath('resources/views/vendor/panneau/layout.blade.php');
83
85
 
84
86
  if (this.fs.exists(destination)) {
85
87
  this.fs.delete(destination);
@@ -88,8 +90,29 @@ module.exports = class LaravelPanneauGenerator extends _generator.default {
88
90
  this.fs.copyTpl(source, destination, {});
89
91
  },
90
92
 
93
+ app() {
94
+ const source = this.templatePath('app.blade.php');
95
+ const destination = this.destinationPath('resources/views/vendor/panneau/app.blade.php');
96
+
97
+ if (this.fs.exists(destination)) {
98
+ this.fs.delete(destination);
99
+ }
100
+
101
+ this.fs.copyTpl(source, destination, {});
102
+ },
103
+
104
+ indexJs() {
105
+ const source = this.templatePath('index.js');
106
+ const destination = this.destinationPath('resources/assets/js/index.js');
107
+ this.fs.copyTpl(source, destination, {});
108
+ },
109
+
110
+ npmDependencies() {
111
+ this.addDependencies(['@panneau/app@^1.0.0-alpha.193', '@panneau/core@^1.0.0-alpha.193', '@panneau/data@^1.0.0-alpha.193', '@panneau/field-text@^1.0.0-alpha.193', '@panneau/field-localized@^1.0.0-alpha.193']);
112
+ },
113
+
91
114
  files() {
92
- const folders = ['app', 'resources'];
115
+ const folders = ['app', 'resources', 'lang'];
93
116
  folders.forEach(folder => {
94
117
  const templatePath = this.templatePath(folder);
95
118
  const destinationPath = this.destinationPath(folder);
@@ -119,30 +142,28 @@ module.exports = class LaravelPanneauGenerator extends _generator.default {
119
142
 
120
143
  get install() {
121
144
  return {
122
- composer() {
145
+ async npm() {
123
146
  if (this.options['skip-install']) {
124
147
  return;
125
148
  }
126
149
 
127
- const done = this.async();
128
- this.spawnCommand('composer', ['install']).on('close', done);
150
+ await this.spawnCommand('npm', ['install']);
129
151
  },
130
152
 
131
- vendorPublish() {
153
+ async composer() {
132
154
  if (this.options['skip-install']) {
133
155
  return;
134
156
  }
135
157
 
136
- const done = this.async();
137
- this.spawnCommand('php', ['artisan', 'vendor:publish', '--all']).on('close', done);
158
+ await this.spawnCommand('composer', ['install']);
138
159
  },
139
160
 
140
- panneau() {
141
- if (this.options['skip-install'] && !this.options['install-npm']) {
161
+ async vendorPublish() {
162
+ if (this.options['skip-install']) {
142
163
  return;
143
164
  }
144
165
 
145
- this.addDependencies(['panneau@^0.6.53']);
166
+ await this.spawnCommand('php', ['artisan', 'vendor:publish', '--provider=Panneau\\ServiceProvider']);
146
167
  }
147
168
 
148
169
  };
@@ -0,0 +1,19 @@
1
+ <?php
2
+
3
+ namespace App\Contracts\Repositories;
4
+
5
+ use Folklore\Contracts\Repositories\Pages as BasePages;
6
+ use App\Contracts\Resources\Page as PageResource;
7
+
8
+ interface Pages extends BasePages
9
+ {
10
+ public function findById(string $id): ?PageResource;
11
+
12
+ public function findByHandle(string $handle): ?PageResource;
13
+
14
+ public function findBySlug(string $slug, string $locale = null): ?PageResource;
15
+
16
+ public function create(array $data): PageResource;
17
+
18
+ public function update(string $id, array $data): ?PageResource;
19
+ }
@@ -0,0 +1,10 @@
1
+ <?php
2
+
3
+ namespace App\Contracts\Resources\Blocks;
4
+
5
+ use App\Contracts\Resources\Block as BaseBlock;
6
+
7
+ interface Text extends BaseBlock
8
+ {
9
+ public function body(string $locale): ?string;
10
+ }