generator-folklore 3.0.3 → 3.0.6

Sign up to get free protection for your applications and to get access to all the features.
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
@@ -3,5 +3,6 @@
3
3
  @import '../commons/mixins';
4
4
 
5
5
  .container {
6
+ @extend %reset-button;
6
7
  display: inline-block;
7
8
  }
@@ -0,0 +1,54 @@
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 RollupGenerator extends _generator.default {
12
+ constructor(...args) {
13
+ super(...args);
14
+ }
15
+
16
+ get prompting() {
17
+ return {
18
+ welcome() {
19
+ if (this.options.quiet) {
20
+ return;
21
+ }
22
+
23
+ console.log(_chalk.default.yellow('\n----------------------'));
24
+ console.log('Rollup Generator');
25
+ console.log(_chalk.default.yellow('----------------------\n'));
26
+ }
27
+
28
+ };
29
+ }
30
+
31
+ get writing() {
32
+ return {
33
+ config() {
34
+ const srcPath = this.templatePath('config.js');
35
+ const destPath = this.destinationPath('rollup.config.js');
36
+ this.fs.copyTpl(srcPath, destPath);
37
+ },
38
+
39
+ dependencies() {
40
+ this.addDevDependencies(['@rollup/plugin-babel', '@rollup/plugin-commonjs', '@rollup/plugin-json', '@rollup/plugin-node-resolve', '@rollup/plugin-replace', 'rollup']);
41
+ }
42
+
43
+ };
44
+ }
45
+
46
+ async install() {
47
+ if (this.options['skip-install']) {
48
+ return;
49
+ }
50
+
51
+ await this.spawnCommand('npm', ['install']);
52
+ }
53
+
54
+ };
@@ -0,0 +1,50 @@
1
+ import babel from '@rollup/plugin-babel';
2
+ import commonjs from '@rollup/plugin-commonjs';
3
+ import json from '@rollup/plugin-json';
4
+ import resolve from '@rollup/plugin-node-resolve';
5
+ import replace from '@rollup/plugin-replace';
6
+ import path from 'path';
7
+
8
+ export const plugins = [
9
+ json(),
10
+ resolve({
11
+ extensions: ['.mjs', '.js', '.jsx', '.json', '.node'],
12
+ jail: path.join(process.cwd(), 'src'),
13
+ preferBuiltins: true,
14
+ }),
15
+ commonjs(),
16
+ babel({
17
+ extensions: ['.mjs', '.js', '.jsx', '.json', '.node'],
18
+ exclude: 'node_modules/**',
19
+ rootMode: 'upward',
20
+ babelHelpers: 'runtime',
21
+ }),
22
+ replace({
23
+ values: {
24
+ 'process.env.NODE_ENV': JSON.stringify('production'),
25
+ __buildDate__: () => JSON.stringify(new Date()),
26
+ __buildVersion: 15,
27
+ },
28
+ preventAssignment: false,
29
+ }),
30
+ ];
31
+
32
+ export default [
33
+ {
34
+ input: 'src/index.js',
35
+ output: {
36
+ file: 'index.js',
37
+ format: 'cjs',
38
+ },
39
+ plugins,
40
+ },
41
+ // {
42
+ // input: 'src/cli.js',
43
+ // output: {
44
+ // file: 'cli.js',
45
+ // format: 'cjs',
46
+ // banner: '#!/usr/bin/env node',
47
+ // },
48
+ // plugins,
49
+ // },
50
+ ];
@@ -19,11 +19,6 @@ module.exports = class ScssGenerator extends _generator.default {
19
19
  type: String,
20
20
  defaults: 'src/scss'
21
21
  });
22
- this.option('react', {
23
- type: Boolean,
24
- required: false,
25
- defaults: false
26
- });
27
22
 
28
23
  this.stylesPath = destPath => this.destinationPath(_path.default.join(this.options.path, destPath || ''));
29
24
  }
@@ -61,19 +56,11 @@ module.exports = class ScssGenerator extends _generator.default {
61
56
  };
62
57
  }
63
58
 
64
- configuring() {
65
- this.composeWith('folklore:stylelint', {
66
- quiet: true,
67
- 'camel-case': this.options.react
68
- });
69
- }
70
-
71
59
  get writing() {
72
60
  return {
73
- main() {
74
- const reactSuffix = this.options.react ? '.global' : '';
75
- const srcPath = this.templatePath('main.scss');
76
- const destPath = this.stylesPath(`main${reactSuffix}.scss`);
61
+ styles() {
62
+ const srcPath = this.templatePath('styles.scss');
63
+ const destPath = this.stylesPath('styles.scss');
77
64
  this.fs.copy(srcPath, destPath);
78
65
  },
79
66
 
@@ -0,0 +1,81 @@
1
+ "use strict";
2
+
3
+ var _chalk = _interopRequireDefault(require("chalk"));
4
+
5
+ var _lodash = _interopRequireDefault(require("lodash"));
6
+
7
+ var _path = _interopRequireDefault(require("path"));
8
+
9
+ var _generator = _interopRequireDefault(require("../../lib/generator"));
10
+
11
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
12
+
13
+ module.exports = class ServerGenerator extends _generator.default {
14
+ // The name `constructor` is important here
15
+ constructor(...args) {
16
+ super(...args);
17
+ this.option('path', {
18
+ type: String,
19
+ defaults: 'src'
20
+ });
21
+ this.option('filename', {
22
+ type: String,
23
+ defaults: 'server.js'
24
+ });
25
+ this.option('socket-io', {
26
+ type: String,
27
+ defaults: false
28
+ });
29
+ }
30
+
31
+ get prompting() {
32
+ return {
33
+ welcome() {
34
+ if (this.options.quiet) {
35
+ return;
36
+ }
37
+
38
+ console.log(_chalk.default.yellow('\n----------------------'));
39
+ console.log('Server Generator');
40
+ console.log(_chalk.default.yellow('----------------------\n'));
41
+ }
42
+
43
+ };
44
+ }
45
+
46
+ get writing() {
47
+ return {
48
+ index() {
49
+ const {
50
+ filename,
51
+ path: serverPath,
52
+ 'socket-io': socketIo
53
+ } = this.options;
54
+ this.fs.copyTpl(this.templatePath('server.js'), this.destinationPath(_path.default.join(serverPath, filename)), {
55
+ socketIo
56
+ });
57
+ },
58
+
59
+ dependencies() {
60
+ const {
61
+ 'socket-io': socketIo
62
+ } = this.options;
63
+ this.addDependencies(['commander', 'debug', 'ejs', 'express']);
64
+
65
+ if (socketIo) {
66
+ this.addDependencies(['socket.io']);
67
+ }
68
+ }
69
+
70
+ };
71
+ }
72
+
73
+ async install() {
74
+ if (this.options['skip-install']) {
75
+ return;
76
+ }
77
+
78
+ await this.spawnCommand('npm', ['install']);
79
+ }
80
+
81
+ };
@@ -0,0 +1,59 @@
1
+ import { program } from 'commander';
2
+ import createDebug from 'debug';
3
+ import { renderFile } from 'ejs';
4
+ import express from 'express';
5
+ import { createServer } from 'http';
6
+ import path from 'path';<% if (socketIo) { %>
7
+ import { Server } from 'socket.io';<% } %>
8
+
9
+ const debug = createDebug('server');
10
+
11
+ program
12
+ .description('Run server')
13
+ .option('-p, --path <path>', 'Path to static', './dist')
14
+ .option('--port <port>', 'Server port', process.env.PORT || 5000);
15
+ program.parse();
16
+
17
+ const { port, path: staticPath } = program.opts();
18
+
19
+ const webPath = path.join(process.cwd(), staticPath);
20
+
21
+ // Express server
22
+ const app = express();
23
+ const httpServer = createServer(app);
24
+ app.set('view engine', 'html');
25
+ app.set('views', webPath);
26
+ app.engine('html', renderFile);
27
+ app.use(express.json());
28
+ app.use(
29
+ express.urlencoded({
30
+ extended: false,
31
+ }),
32
+ );
33
+ app.use(express.static(webPath));
34
+
35
+ app.get('/', async (req, res) =>
36
+ res.render('index.html.ejs', {
37
+ fromServer: true,
38
+ }),
39
+ );
40
+
41
+ app.get('*', async (req, res) => {
42
+ return res.render('index.html.ejs', {
43
+ fromServer: true,
44
+ });
45
+ });<% if (socketIo) { %>
46
+
47
+ // Socket io
48
+ const io = new Server(httpServer, {
49
+ cors: {
50
+ origin: '*',
51
+ methods: ['GET', 'POST'],
52
+ },
53
+ });
54
+ io.on('connection', (socket) => {});<% } %>
55
+
56
+ // Start server
57
+ httpServer.listen(port, () => {
58
+ debug('Listening on port %i', port);
59
+ });
@@ -60,19 +60,13 @@ module.exports = class StorybookGenerator extends _generator.default {
60
60
  },
61
61
 
62
62
  packageJSON() {
63
- const destPath = this.destinationPath('package.json');
64
-
65
- if (!this.fs.exists(destPath)) {
66
- return;
67
- }
68
-
69
63
  const packageJSON = this.fs.exists(destPath) ? this.fs.readJSON(destPath) : {};
70
64
  packageJSON['storybook-deployer'] = {
71
65
  gitUsername: 'Folklore',
72
66
  gitEmail: 'info@folklore.email',
73
67
  commitMessage: 'Deploy Storybook to GitHub Pages'
74
68
  };
75
- this.fs.writeJSON(destPath, packageJSON);
69
+ this.packageJson.merge(packageJSON);
76
70
  }
77
71
 
78
72
  };
@@ -16,29 +16,28 @@ module.exports = class StylelintGenerator extends _generator.default {
16
16
  });
17
17
  }
18
18
 
19
- get prompting() {
20
- return {
21
- welcome() {
22
- if (this.options.quiet) {
23
- return;
24
- }
25
-
26
- console.log(_chalk.default.yellow('\n----------------------'));
27
- console.log('Stylelint Generator');
28
- console.log(_chalk.default.yellow('----------------------\n'));
29
- }
19
+ prompting() {
20
+ if (this.options.quiet) {
21
+ return;
22
+ }
30
23
 
31
- };
24
+ console.log(_chalk.default.yellow('\n----------------------'));
25
+ console.log('Stylelint Generator');
26
+ console.log(_chalk.default.yellow('----------------------\n'));
32
27
  }
33
28
 
34
29
  get writing() {
35
30
  return {
36
- eslintrc() {
31
+ stylelintrc() {
37
32
  const srcPath = this.templatePath('stylelintrc');
38
33
  const destPath = this.destinationPath('.stylelintrc');
39
34
  this.fs.copyTpl(srcPath, destPath, {
40
35
  camelCase: this.options['camel-case']
41
36
  });
37
+ },
38
+
39
+ dependencies() {
40
+ this.addDevDependencies(['stylelint', 'stylelint-config-standard-scss', 'stylelint-config-idiomatic-order', 'stylelint-config-prettier']);
42
41
  }
43
42
 
44
43
  };
@@ -49,7 +48,7 @@ module.exports = class StylelintGenerator extends _generator.default {
49
48
  return;
50
49
  }
51
50
 
52
- await this.addDevDependencies(['stylelint', 'stylelint-config-standard-scss', 'stylelint-config-idiomatic-order', 'stylelint-config-prettier']);
51
+ await this.spawnCommand('npm', ['install']);
53
52
  }
54
53
 
55
54
  };
@@ -25,12 +25,21 @@ class Generator extends _yeomanGenerator.default {
25
25
 
26
26
  constructor(args, options) {
27
27
  super(args, options);
28
+ this._composerJson = null;
28
29
  this.option('quiet', {
29
30
  type: Boolean,
30
31
  defaults: false
31
32
  });
32
33
  }
33
34
 
35
+ get composerJson() {
36
+ if (!this._composerJson) {
37
+ this._composerJson = this.createStorage('composer.json');
38
+ }
39
+
40
+ return this._composerJson;
41
+ }
42
+
34
43
  getConfig() {
35
44
  const configPath = Generator.getConfigPath();
36
45
  return this.fs.exists(configPath) ? this.fs.readJSON(configPath) : {};
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.ensureLeadingDotSlash = ensureLeadingDotSlash;
7
+
8
+ var _lodash = require("lodash");
9
+
10
+ var _path = _interopRequireDefault(require("path"));
11
+
12
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
13
+
14
+ function ensureLeadingDotSlash(filePath) {
15
+ return (0, _lodash.isString)(filePath) && !_path.default.isAbsolute(filePath) && filePath.match(/^\./) === null ? `./${filePath}` : filePath;
16
+ ;
17
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "generator-folklore",
3
- "version": "3.0.3",
3
+ "version": "3.0.6",
4
4
  "description": "Yeoman generator for projects at Folklore",
5
5
  "keywords": [
6
6
  "yeoman-generator"
@@ -39,5 +39,5 @@
39
39
  "yeoman-generator": "^5.6.1",
40
40
  "yeoman-remote": "^1.0.1"
41
41
  },
42
- "gitHead": "cf8f69f622f7ce5476723a2dea46157be2fe5833"
42
+ "gitHead": "8331a20ddf7647db4895648efb495ce23d070fb3"
43
43
  }
@@ -1,7 +0,0 @@
1
- /* eslint-disable global-require */
2
- /* eslint-disable import/no-extraneous-dependencies, import/no-dynamic-require */
3
- module.exports = () => ({
4
- presets: [
5
- require('babel-preset-react-app'),
6
- ],
7
- });
@@ -1,57 +0,0 @@
1
- <% if(hasCompile) { %>const path = require('path');
2
-
3
- <% } %>const env = process.env.BABEL_ENV || process.env.NODE_ENV;
4
- const isEnvDevelopment = env === 'development';
5
- const isEnvProduction = env === 'production';
6
- const isEnvTest = env === 'test';<% if(hasCompile) { %>
7
- const isCommonJS = env === 'cjs';
8
- const isCompiling = env === 'es' || env === 'cjs';<% } %>
9
-
10
- const presets = [
11
- [require.resolve('@babel/preset-env'), isEnvTest ? {
12
- targets: {
13
- node: 'current',
14
- },
15
- } : {
16
- modules: <% if(hasCompile) { %>isCommonJS ? 'commonjs' : false<% } else { %>false<% } %>,
17
- targets: {
18
- ie: 9,
19
- },
20
- }],
21
- require.resolve('@babel/preset-react'),
22
- ];
23
-
24
- const plugins = [
25
- require.resolve('@babel/plugin-syntax-dynamic-import'),
26
- require.resolve('@babel/plugin-proposal-object-rest-spread'),<% if(hasTransformRuntime) { %>
27
- [require.resolve('@babel/plugin-transform-runtime'), {
28
- helpers: true,
29
- polyfill: false,
30
- regenerator: true,
31
- }],<% } %>
32
- ];
33
-
34
- if (isEnvTest) {
35
- plugins.push(require.resolve('babel-plugin-dynamic-import-node'));
36
- }
37
- <% if(hasCompile) { %>
38
- if (isCompiling) {
39
- plugins.push([require.resolve('babel-plugin-css-modules-transform'), {
40
- preprocessCss: path.join(__dirname, './utils/processScss.js'),
41
- extensions: ['.css', '.scss'],
42
- generateScopedName: path.join(__dirname, './utils/getLocalIdent.js'),
43
- }]);
44
- plugins.push([path.join(__dirname, './utils/transformRequireIgnore'), {
45
- extensions: ['.global.scss'],
46
- }]);
47
- <% if(hasReactIntl) { %> if (isCompiling && !isCommonJS) {
48
- plugins.push([require.resolve('babel-plugin-react-intl'), {
49
- messagesDir: './intl/messages/',
50
- }]);
51
- }<% } %>
52
- }
53
- <% } %>
54
- module.exports = () => ({
55
- presets,
56
- plugins,
57
- });
@@ -1,5 +0,0 @@
1
- {
2
- "presets": [
3
- "<%= presetPath %>"
4
- ]
5
- }
@@ -1,10 +0,0 @@
1
- // eslint-disable-next-line import/no-extraneous-dependencies
2
- const sass = require('node-sass');
3
-
4
- module.exports = (data, filename) => {
5
- const result = sass.renderSync({
6
- data,
7
- file: filename,
8
- }).css;
9
- return result.toString('utf8');
10
- };
@@ -1,80 +0,0 @@
1
- /* eslint-disable */
2
- 'use strict';
3
-
4
- Object.defineProperty(exports, "__esModule", {
5
- value: true
6
- });
7
-
8
- exports.default = function () {
9
- function extFix(ext) {
10
- return ext.charAt(0) === '.' ? ext : '.' + ext;
11
- }
12
-
13
- return {
14
- visitor: {
15
- CallExpression: {
16
- enter: function enter(nodePath, _ref) {
17
- var opts = _ref.opts;
18
-
19
- var extensionsInput = [].concat(opts.extensions || []);
20
- if (extensionsInput.length === 0) {
21
- return;
22
- }
23
- var extensions = extensionsInput.map(extFix);
24
- var callee = nodePath.get('callee');
25
-
26
- if (callee.isIdentifier() && callee.equals('name', 'require')) {
27
- var arg = nodePath.get('arguments')[0];
28
- if (arg && arg.isStringLiteral() && extensions.indexOf(_path2.default.extname(arg.node.value)) > -1) {
29
- if (nodePath.parentPath.isVariableDeclarator()) {
30
- throw new Error(arg.node.value + ' should not be assign to variable.');
31
- } else {
32
- nodePath.remove();
33
- }
34
- }
35
- }
36
- }
37
- },
38
-
39
- ImportDeclaration: {
40
- enter: function enter(nodePath, _ref2) {
41
- var opts = _ref2.opts;
42
-
43
- var extensionsInput = [].concat(opts.extensions || []);
44
-
45
- if (extensionsInput.length === 0) {
46
- return;
47
- }
48
- var extensions = extensionsInput.map(extFix);
49
- const regExp = new RegExp('('+extensions.join('|')+')$', 'i');
50
-
51
- if (nodePath.node.source.value.match(regExp)) {
52
- var specifiers = nodePath.get('specifiers');
53
-
54
- if (specifiers.length) {
55
- var specifier = specifiers[specifiers.length - 1];
56
-
57
- if (specifier.isImportDefaultSpecifier()) {
58
- throw new Error(nodePath.node.source.value + ' should not be imported using default imports.');
59
- }
60
- if (specifier.isImportSpecifier()) {
61
- throw new Error(nodePath.node.source.value + ' should not be imported using named imports.');
62
- }
63
- if (specifier.isImportNamespaceSpecifier()) {
64
- throw new Error(nodePath.node.source.value + ' should not be imported using namespace imports.');
65
- }
66
- }
67
-
68
- nodePath.remove();
69
- }
70
- }
71
- }
72
- }
73
- };
74
- };
75
-
76
- var _path = require('path');
77
-
78
- var _path2 = _interopRequireDefault(_path);
79
-
80
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
@@ -1,9 +0,0 @@
1
- import React from 'react';
2
- import ReactDOM from 'react-dom';
3
-
4
- import Root from './components/Root';
5
- import rootProps from './data/root';
6
-
7
- const rootEl = document.getElementById('root');
8
- const root = React.createElement(Root, rootProps);
9
- ReactDOM.render(root, rootEl);
@@ -1,23 +0,0 @@
1
- export default {
2
- locale: 'fr',
3
- messages: {
4
- 'meta.title': 'Titre',
5
- 'meta.title_401': 'Error 401',
6
- 'meta.title_403': 'Error 403',
7
- 'meta.title_404': 'Error 404',
8
- 'meta.title_500': 'Error 500',
9
-
10
- 'errors.title_401': 'Error 401',
11
- 'errors.description_401': 'You are not authorized to access this page.',
12
- 'errors.title_403': 'Error 403',
13
- 'errors.description_403': 'Access to this page is forbidden',
14
- 'errors.title_404': 'Error 404',
15
- 'errors.description_404': 'This page doesn’t exists',
16
- 'errors.title_500': 'Error 500',
17
- 'errors.description_500': 'There was an error',
18
- 'errors.goto_home': 'Go to home',
19
- },
20
- routes: {
21
- home: '/',
22
- },
23
- };
@@ -1,7 +0,0 @@
1
- // eslint-disable-next-line import/prefer-default-export
2
- export const getLocaleFromLocation = (locales = ['fr', 'en'], currentLocation = window.location) => {
3
- const { pathname = '/' } = currentLocation;
4
- const localeRegEx = new RegExp(`^/(${locales.join('|')})(/.*)?$`, 'i');
5
- const matches = pathname.match(localeRegEx);
6
- return matches !== null ? matches[1] : locales[0];
7
- };
@@ -1,9 +0,0 @@
1
- [production staging]
2
- last 4 versions
3
- > 1%
4
- ie >= 9
5
-
6
- [development]
7
- last 4 versions
8
- > 1%
9
- ie >= 9