generator-folklore 3.0.16 → 3.0.18

Sign up to get free protection for your applications and to get access to all the features.
Files changed (42) hide show
  1. package/lib/generators/app/index.js +5 -20
  2. package/lib/generators/babel/index.js +0 -12
  3. package/lib/generators/browserslist/index.js +0 -7
  4. package/lib/generators/build/index.js +0 -17
  5. package/lib/generators/cli/index.js +0 -18
  6. package/lib/generators/docs/index.js +5 -34
  7. package/lib/generators/editorconfig/index.js +0 -6
  8. package/lib/generators/eslint/index.js +0 -11
  9. package/lib/generators/html-project/index.js +0 -30
  10. package/lib/generators/intl/index.js +0 -13
  11. package/lib/generators/laravel/index.js +5 -77
  12. package/lib/generators/laravel-auth/index.js +0 -25
  13. package/lib/generators/laravel-mediatheque/index.js +0 -28
  14. package/lib/generators/laravel-package/index.js +0 -33
  15. package/lib/generators/laravel-panneau/index.js +0 -49
  16. package/lib/generators/laravel-project/index.js +11 -78
  17. package/lib/generators/lerna-package/index.js +0 -36
  18. package/lib/generators/lerna-repository/index.js +0 -34
  19. package/lib/generators/node-project/index.js +0 -28
  20. package/lib/generators/npm-package/index.js +0 -36
  21. package/lib/generators/prettier/index.js +0 -11
  22. package/lib/generators/react-app/index.js +5 -30
  23. package/lib/generators/react-app/templates/index.js +3 -3
  24. package/lib/generators/react-app/templates/src/components/App.jsx +28 -32
  25. package/lib/generators/react-app/templates/src/components/Routes.jsx +46 -0
  26. package/lib/generators/react-app/templates/src/components/buttons/Button.jsx +3 -0
  27. package/lib/generators/react-app/templates/src/components/layouts/Main.jsx +1 -3
  28. package/lib/generators/react-app/templates/src/components/menus/Menu.jsx +2 -3
  29. package/lib/generators/react-package/index.js +0 -33
  30. package/lib/generators/rollup/index.js +0 -13
  31. package/lib/generators/sass-lint/index.js +0 -9
  32. package/lib/generators/scss/index.js +0 -16
  33. package/lib/generators/server/index.js +0 -15
  34. package/lib/generators/storybook/index.js +0 -16
  35. package/lib/generators/stylelint/index.js +0 -11
  36. package/lib/generators/stylelint/templates/stylelintrc +2 -1
  37. package/lib/generators/test/index.js +0 -16
  38. package/lib/lib/generator.js +4 -24
  39. package/lib/lib/mysql.js +0 -10
  40. package/lib/lib/utils.js +0 -4
  41. package/package.json +2 -2
  42. package/lib/generators/react-app/templates/src/components/Container.jsx +0 -42
@@ -1,42 +1,38 @@
1
+ import { RoutesProvider } from '@folklore/routes';
2
+ import PropTypes from 'prop-types';
1
3
  import React from 'react';
2
- // import PropTypes from 'prop-types';
3
- import { Route, Routes } from 'react-router-dom';
4
- import { useRoutes } from '@folklore/routes';
4
+ import { IntlProvider } from 'react-intl';
5
+ import { BrowserRouter } from 'react-router-dom';
5
6
 
6
- // import { useUrlGenerator } from '@folklore/routes';
7
7
  // import * as AppPropTypes from '../lib/PropTypes';
8
- import MainLayout from './layouts/Main';
9
- import ErrorPage from './pages/Error';
10
- import HomePage from './pages/Home';
8
+ import Routes from './Routes';
11
9
 
12
- import '<%= getRelativeStylesPath('components/App.jsx', 'styles.scss') %>';
10
+ const propTypes = {
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
+ }),
18
+ routes: PropTypes.objectOf(PropTypes.string),
19
+ };
13
20
 
14
- const propTypes = {};
21
+ const defaultProps = {
22
+ intl: null,
23
+ routes: {},
24
+ };
15
25
 
16
- const defaultProps = {};
17
-
18
- function App() {
19
- const routes = useRoutes() || {};
26
+ function App({ intl, routes }) {
27
+ const { locale = 'fr', messages = {} } = intl || {};
20
28
  return (
21
- <Routes>
22
- <Route
23
- path={routes.home || '/'}
24
- exact
25
- element={
26
- <MainLayout>
27
- <HomePage />
28
- </MainLayout>
29
- }
30
- />
31
- <Route
32
- path="*"
33
- element={
34
- <MainLayout>
35
- <ErrorPage />
36
- </MainLayout>
37
- }
38
- />
39
- </Routes>
29
+ <IntlProvider locale={locale} messages={messages[locale] || messages}>
30
+ <BrowserRouter>
31
+ <RoutesProvider routes={routes}>
32
+ <Routes />
33
+ </RoutesProvider>
34
+ </BrowserRouter>
35
+ </IntlProvider>
40
36
  );
41
37
  }
42
38
 
@@ -0,0 +1,46 @@
1
+ import React from 'react';
2
+ // import PropTypes from 'prop-types';
3
+ import { Route, Routes } from 'react-router-dom';
4
+ import { useRoutes } from '@folklore/routes';
5
+
6
+ // import { useUrlGenerator } from '@folklore/routes';
7
+ // import * as AppPropTypes from '../lib/PropTypes';
8
+ import MainLayout from './layouts/Main';
9
+ import ErrorPage from './pages/Error';
10
+ import HomePage from './pages/Home';
11
+
12
+ import '<%= getRelativeStylesPath('components/App.jsx', 'styles.scss') %>';
13
+
14
+ const propTypes = {};
15
+
16
+ const defaultProps = {};
17
+
18
+ function Routes() {
19
+ const routes = useRoutes() || {};
20
+ return (
21
+ <Routes>
22
+ <Route
23
+ path={routes.home || '/'}
24
+ exact
25
+ element={
26
+ <MainLayout>
27
+ <HomePage />
28
+ </MainLayout>
29
+ }
30
+ />
31
+ <Route
32
+ path="*"
33
+ element={
34
+ <MainLayout>
35
+ <ErrorPage />
36
+ </MainLayout>
37
+ }
38
+ />
39
+ </Routes>
40
+ );
41
+ }
42
+
43
+ Routes.propTypes = propTypes;
44
+ Routes.defaultProps = defaultProps;
45
+
46
+ export default Routes;
@@ -9,6 +9,7 @@ import * as AppPropTypes from '../../lib/PropTypes';
9
9
  import styles from '<%= getRelativeStylesPath('components/buttons/Button.jsx', 'buttons/button.module.scss') %>';
10
10
 
11
11
  const propTypes = {
12
+ text: PropTypes.string,
12
13
  type: PropTypes.string,
13
14
  href: PropTypes.string,
14
15
  external: PropTypes.bool,
@@ -28,6 +29,7 @@ const propTypes = {
28
29
  };
29
30
 
30
31
  const defaultProps = {
32
+ text: null,
31
33
  type: 'button',
32
34
  href: null,
33
35
  external: false,
@@ -47,6 +49,7 @@ const defaultProps = {
47
49
  };
48
50
 
49
51
  function Button({
52
+ text,
50
53
  type,
51
54
  href,
52
55
  external,
@@ -7,9 +7,7 @@ const propTypes = {
7
7
  children: PropTypes.node.isRequired,
8
8
  };
9
9
 
10
- const defaultProps = {
11
-
12
- };
10
+ const defaultProps = {};
13
11
 
14
12
  function MainLayout({ children }) {
15
13
  return (
@@ -5,7 +5,6 @@ import classNames from 'classnames';
5
5
  import { Link } from 'react-router-dom';
6
6
 
7
7
  import * as AppPropTypes from '../../lib/PropTypes';
8
- import Label from '../partials/Label';
9
8
 
10
9
  import styles from '<%= getRelativeStylesPath('components/menus/Menu.jsx', 'menus/menu.module.scss') %>';
11
10
 
@@ -42,11 +41,11 @@ function Menu({ items, className }) {
42
41
  >
43
42
  {external ? (
44
43
  <a href={url} target={target} className={styles.link}>
45
- <Label>{label}</Label>
44
+ {label}
46
45
  </a>
47
46
  ) : (
48
47
  <Link to={url} className={styles.link}>
49
- <Label>{label}</Label>
48
+ {label}
50
49
  </Link>
51
50
  )}
52
51
  </li>
@@ -1,17 +1,11 @@
1
1
  "use strict";
2
2
 
3
3
  var _chalk = _interopRequireDefault(require("chalk"));
4
-
5
4
  var _changeCase = require("change-case");
6
-
7
5
  var _lodash = _interopRequireDefault(require("lodash"));
8
-
9
6
  var _path = _interopRequireDefault(require("path"));
10
-
11
7
  var _generator = _interopRequireDefault(require("../../lib/generator"));
12
-
13
8
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
14
-
15
9
  module.exports = class ReactPackageGenerator extends _generator.default {
16
10
  constructor(...args) {
17
11
  super(...args);
@@ -49,22 +43,18 @@ module.exports = class ReactPackageGenerator extends _generator.default {
49
43
  defaults: './examples'
50
44
  });
51
45
  }
52
-
53
46
  get prompting() {
54
47
  return {
55
48
  welcome() {
56
49
  if (this.options.quiet) {
57
50
  return;
58
51
  }
59
-
60
52
  console.log(_chalk.default.yellow('\n----------------------'));
61
53
  console.log('React Package Generator');
62
54
  console.log(_chalk.default.yellow('----------------------\n'));
63
55
  },
64
-
65
56
  prompts() {
66
57
  const prompts = [];
67
-
68
58
  if (!this.options['package-name']) {
69
59
  prompts.push({
70
60
  type: 'input',
@@ -76,7 +66,6 @@ module.exports = class ReactPackageGenerator extends _generator.default {
76
66
  }
77
67
  });
78
68
  }
79
-
80
69
  if (!this.options['component-name']) {
81
70
  prompts.push({
82
71
  type: 'input',
@@ -88,38 +77,27 @@ module.exports = class ReactPackageGenerator extends _generator.default {
88
77
  }
89
78
  });
90
79
  }
91
-
92
80
  if (!prompts.length) {
93
81
  return null;
94
82
  }
95
-
96
83
  return this.prompt(prompts).then(answers => {
97
84
  if (answers['package-name']) {
98
85
  this.options['package-name'] = answers['package-name'];
99
86
  }
100
-
101
87
  if (answers['component-name']) {
102
88
  this.options['component-name'] = answers['component-name'];
103
89
  }
104
90
  });
105
91
  }
106
-
107
92
  };
108
93
  }
109
-
110
94
  configuring() {
111
95
  const srcPath = _lodash.default.get(this.options, 'src-path');
112
-
113
96
  const destPath = _lodash.default.get(this.options, 'dest-path');
114
-
115
97
  const tmpPath = _lodash.default.get(this.options, 'tmp-path');
116
-
117
98
  const buildPath = _lodash.default.get(this.options, 'build-path');
118
-
119
99
  const examplesPath = _lodash.default.get(this.options, 'examples-path');
120
-
121
100
  const skipInstall = _lodash.default.get(this.options, 'skip-install', false);
122
-
123
101
  this.composeWith('folklore:npm-package', {
124
102
  'package-name': this.options['package-name'],
125
103
  src: false,
@@ -142,7 +120,6 @@ module.exports = class ReactPackageGenerator extends _generator.default {
142
120
  quiet: true
143
121
  });
144
122
  }
145
-
146
123
  get writing() {
147
124
  return {
148
125
  examples() {
@@ -150,7 +127,6 @@ module.exports = class ReactPackageGenerator extends _generator.default {
150
127
  const destPath = this.destinationPath('examples');
151
128
  this.fs.copyTpl(srcPath, destPath, this);
152
129
  },
153
-
154
130
  src() {
155
131
  const srcPath = this.templatePath('src');
156
132
  const destPath = this.destinationPath('src');
@@ -158,13 +134,11 @@ module.exports = class ReactPackageGenerator extends _generator.default {
158
134
  componentName: this.options['component-name']
159
135
  });
160
136
  },
161
-
162
137
  storybook() {
163
138
  const srcPath = this.templatePath('storybook');
164
139
  const destPath = this.destinationPath('.storybook');
165
140
  this.fs.copyTpl(srcPath, destPath, {});
166
141
  },
167
-
168
142
  packageJSON() {
169
143
  const packagePath = this.destinationPath('package.json');
170
144
  this.fs.extendJSON(packagePath, {
@@ -173,25 +147,20 @@ module.exports = class ReactPackageGenerator extends _generator.default {
173
147
  }
174
148
  });
175
149
  }
176
-
177
150
  };
178
151
  }
179
-
180
152
  get install() {
181
153
  return {
182
154
  npmInstall() {
183
155
  if (this.options['skip-install']) {
184
156
  return;
185
157
  }
186
-
187
158
  this.addDependencies(['react@latest', 'prop-types@latest', 'react-dom@latest']);
188
159
  },
189
-
190
160
  npmInstallDev() {
191
161
  if (this.options['skip-install']) {
192
162
  return;
193
163
  }
194
-
195
164
  this.addDevDependencies({
196
165
  domready: 'latest',
197
166
  jquery: 'latest',
@@ -203,8 +172,6 @@ module.exports = class ReactPackageGenerator extends _generator.default {
203
172
  'html-webpack-plugin': 'latest'
204
173
  });
205
174
  }
206
-
207
175
  };
208
176
  }
209
-
210
177
  };
@@ -1,33 +1,25 @@
1
1
  "use strict";
2
2
 
3
3
  var _chalk = _interopRequireDefault(require("chalk"));
4
-
5
4
  var _path = _interopRequireDefault(require("path"));
6
-
7
5
  var _generator = _interopRequireDefault(require("../../lib/generator"));
8
-
9
6
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
10
-
11
7
  module.exports = class RollupGenerator extends _generator.default {
12
8
  constructor(...args) {
13
9
  super(...args);
14
10
  }
15
-
16
11
  get prompting() {
17
12
  return {
18
13
  welcome() {
19
14
  if (this.options.quiet) {
20
15
  return;
21
16
  }
22
-
23
17
  console.log(_chalk.default.yellow('\n----------------------'));
24
18
  console.log('Rollup Generator');
25
19
  console.log(_chalk.default.yellow('----------------------\n'));
26
20
  }
27
-
28
21
  };
29
22
  }
30
-
31
23
  get writing() {
32
24
  return {
33
25
  config() {
@@ -35,7 +27,6 @@ module.exports = class RollupGenerator extends _generator.default {
35
27
  const destPath = this.destinationPath('rollup.config.js');
36
28
  this.fs.copyTpl(srcPath, destPath);
37
29
  },
38
-
39
30
  dependencies() {
40
31
  this.addDevDependencies({
41
32
  '@rollup/plugin-babel': 'latest',
@@ -46,16 +37,12 @@ module.exports = class RollupGenerator extends _generator.default {
46
37
  rollup: '^2.79.1'
47
38
  });
48
39
  }
49
-
50
40
  };
51
41
  }
52
-
53
42
  async install() {
54
43
  if (this.options['skip-install']) {
55
44
  return;
56
45
  }
57
-
58
46
  await this.spawnCommand('npm', ['install']);
59
47
  }
60
-
61
48
  };
@@ -1,11 +1,8 @@
1
1
  "use strict";
2
2
 
3
3
  var _chalk = _interopRequireDefault(require("chalk"));
4
-
5
4
  var _generator = _interopRequireDefault(require("../../lib/generator"));
6
-
7
5
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
8
-
9
6
  module.exports = class SassLintGenerator extends _generator.default {
10
7
  constructor(...args) {
11
8
  super(...args);
@@ -15,22 +12,18 @@ module.exports = class SassLintGenerator extends _generator.default {
15
12
  defaults: false
16
13
  });
17
14
  }
18
-
19
15
  get prompting() {
20
16
  return {
21
17
  welcome() {
22
18
  if (this.options.quiet) {
23
19
  return;
24
20
  }
25
-
26
21
  console.log(_chalk.default.yellow('\n----------------------'));
27
22
  console.log('Sass lint Generator');
28
23
  console.log(_chalk.default.yellow('----------------------\n'));
29
24
  }
30
-
31
25
  };
32
26
  }
33
-
34
27
  get writing() {
35
28
  return {
36
29
  eslintrc() {
@@ -40,8 +33,6 @@ module.exports = class SassLintGenerator extends _generator.default {
40
33
  camelCase: this.options['camel-case']
41
34
  });
42
35
  }
43
-
44
36
  };
45
37
  }
46
-
47
38
  };
@@ -1,13 +1,9 @@
1
1
  "use strict";
2
2
 
3
3
  var _chalk = _interopRequireDefault(require("chalk"));
4
-
5
4
  var _path = _interopRequireDefault(require("path"));
6
-
7
5
  var _generator = _interopRequireDefault(require("../../lib/generator"));
8
-
9
6
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
10
-
11
7
  module.exports = class ScssGenerator extends _generator.default {
12
8
  constructor(...args) {
13
9
  super(...args);
@@ -19,43 +15,34 @@ module.exports = class ScssGenerator extends _generator.default {
19
15
  type: String,
20
16
  defaults: 'src/scss'
21
17
  });
22
-
23
18
  this.stylesPath = destPath => this.destinationPath(_path.default.join(this.options.path, destPath || ''));
24
19
  }
25
-
26
20
  get prompting() {
27
21
  return {
28
22
  welcome() {
29
23
  if (this.options.quiet) {
30
24
  return;
31
25
  }
32
-
33
26
  console.log(_chalk.default.yellow('\n----------------------'));
34
27
  console.log('SCSS Generator');
35
28
  console.log(_chalk.default.yellow('----------------------\n'));
36
29
  },
37
-
38
30
  prompts() {
39
31
  const prompts = [];
40
-
41
32
  if (!this.options['project-name']) {
42
33
  prompts.push(ScssGenerator.prompts.project_name);
43
34
  }
44
-
45
35
  if (!prompts.length) {
46
36
  return null;
47
37
  }
48
-
49
38
  return this.prompt(prompts).then(answers => {
50
39
  if (answers['project-name']) {
51
40
  this.options['project-name'] = answers['project-name'];
52
41
  }
53
42
  });
54
43
  }
55
-
56
44
  };
57
45
  }
58
-
59
46
  get writing() {
60
47
  return {
61
48
  styles() {
@@ -63,14 +50,11 @@ module.exports = class ScssGenerator extends _generator.default {
63
50
  const destPath = this.stylesPath('styles.scss');
64
51
  this.fs.copy(srcPath, destPath);
65
52
  },
66
-
67
53
  commmons() {
68
54
  const srcPath = this.templatePath('commons');
69
55
  const destPath = this.stylesPath('commons');
70
56
  this.fs.copy(srcPath, destPath);
71
57
  }
72
-
73
58
  };
74
59
  }
75
-
76
60
  };
@@ -1,15 +1,10 @@
1
1
  "use strict";
2
2
 
3
3
  var _chalk = _interopRequireDefault(require("chalk"));
4
-
5
4
  var _lodash = _interopRequireDefault(require("lodash"));
6
-
7
5
  var _path = _interopRequireDefault(require("path"));
8
-
9
6
  var _generator = _interopRequireDefault(require("../../lib/generator"));
10
-
11
7
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
12
-
13
8
  module.exports = class ServerGenerator extends _generator.default {
14
9
  // The name `constructor` is important here
15
10
  constructor(...args) {
@@ -27,22 +22,18 @@ module.exports = class ServerGenerator extends _generator.default {
27
22
  defaults: false
28
23
  });
29
24
  }
30
-
31
25
  get prompting() {
32
26
  return {
33
27
  welcome() {
34
28
  if (this.options.quiet) {
35
29
  return;
36
30
  }
37
-
38
31
  console.log(_chalk.default.yellow('\n----------------------'));
39
32
  console.log('Server Generator');
40
33
  console.log(_chalk.default.yellow('----------------------\n'));
41
34
  }
42
-
43
35
  };
44
36
  }
45
-
46
37
  get writing() {
47
38
  return {
48
39
  index() {
@@ -55,7 +46,6 @@ module.exports = class ServerGenerator extends _generator.default {
55
46
  socketIo
56
47
  });
57
48
  },
58
-
59
49
  dependencies() {
60
50
  const {
61
51
  'socket-io': socketIo
@@ -66,23 +56,18 @@ module.exports = class ServerGenerator extends _generator.default {
66
56
  ejs: 'latest',
67
57
  express: 'latest'
68
58
  });
69
-
70
59
  if (socketIo) {
71
60
  this.addDependencies({
72
61
  'socket.io': 'latest'
73
62
  });
74
63
  }
75
64
  }
76
-
77
65
  };
78
66
  }
79
-
80
67
  async install() {
81
68
  if (this.options['skip-install']) {
82
69
  return;
83
70
  }
84
-
85
71
  await this.spawnCommand('npm', ['install']);
86
72
  }
87
-
88
73
  };
@@ -1,13 +1,9 @@
1
1
  "use strict";
2
2
 
3
3
  var _chalk = _interopRequireDefault(require("chalk"));
4
-
5
4
  var _path = _interopRequireDefault(require("path"));
6
-
7
5
  var _generator = _interopRequireDefault(require("../../lib/generator"));
8
-
9
6
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
10
-
11
7
  module.exports = class StorybookGenerator extends _generator.default {
12
8
  constructor(...args) {
13
9
  super(...args);
@@ -21,25 +17,20 @@ module.exports = class StorybookGenerator extends _generator.default {
21
17
  required: false,
22
18
  defaults: '../src/__stories__/*.story.jsx'
23
19
  });
24
-
25
20
  this.storybookPath = destPath => this.destinationPath(_path.default.join(this.options.path, destPath));
26
21
  }
27
-
28
22
  get prompting() {
29
23
  return {
30
24
  welcome() {
31
25
  if (this.options.quiet) {
32
26
  return;
33
27
  }
34
-
35
28
  console.log(_chalk.default.yellow('\n----------------------'));
36
29
  console.log('Storybook Generator');
37
30
  console.log(_chalk.default.yellow('----------------------\n'));
38
31
  }
39
-
40
32
  };
41
33
  }
42
-
43
34
  get writing() {
44
35
  return {
45
36
  staticFiles() {
@@ -52,13 +43,11 @@ module.exports = class StorybookGenerator extends _generator.default {
52
43
  this.fs.copy(this.templatePath('preview-head.html'), this.storybookPath('preview-head.html'));
53
44
  this.fs.copy(this.templatePath('storiesOf.jsx'), this.storybookPath('storiesOf.jsx'));
54
45
  },
55
-
56
46
  storiesPattern() {
57
47
  this.fs.copyTpl(this.templatePath('stories.pattern'), this.storybookPath('stories.pattern'), {
58
48
  pattern: this.options.pattern
59
49
  });
60
50
  },
61
-
62
51
  packageJSON() {
63
52
  const packageJSON = this.fs.exists(destPath) ? this.fs.readJSON(destPath) : {};
64
53
  packageJSON['storybook-deployer'] = {
@@ -68,17 +57,14 @@ module.exports = class StorybookGenerator extends _generator.default {
68
57
  };
69
58
  this.packageJson.merge(packageJSON);
70
59
  }
71
-
72
60
  };
73
61
  }
74
-
75
62
  get install() {
76
63
  return {
77
64
  npm() {
78
65
  if (this.options['skip-install']) {
79
66
  return;
80
67
  }
81
-
82
68
  this.addDevDependencies({
83
69
  '@storybook/addon-actions': 'latest',
84
70
  '@storybook/addon-info': 'latest',
@@ -89,8 +75,6 @@ module.exports = class StorybookGenerator extends _generator.default {
89
75
  'glob-loader': 'latest'
90
76
  });
91
77
  }
92
-
93
78
  };
94
79
  }
95
-
96
80
  };