generator-folklore 3.0.2 → 3.0.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (83) 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/laravel/index.js +5 -5
  17. package/lib/generators/lerna-package/index.js +1 -3
  18. package/lib/generators/lerna-repository/index.js +1 -3
  19. package/lib/generators/node-project/index.js +164 -0
  20. package/lib/generators/{js/templates/src/lib/.gitkeep → node-project/templates/index.js} +0 -0
  21. package/lib/generators/npm-package/index.js +3 -5
  22. package/lib/generators/prettier/index.js +19 -6
  23. package/lib/generators/prettier/templates/prettierrc.json +3 -1
  24. package/lib/generators/{js → react-app}/index.js +22 -52
  25. package/lib/generators/{js → react-app}/templates/_package.json +0 -0
  26. package/lib/generators/react-app/templates/index.js +23 -0
  27. package/lib/generators/react-app/templates/src/components/App.jsx +45 -0
  28. package/lib/generators/react-app/templates/src/components/Container.jsx +40 -0
  29. package/lib/generators/{js → react-app}/templates/src/components/buttons/Button.jsx +4 -18
  30. package/lib/generators/react-app/templates/src/components/layouts/Main.jsx +27 -0
  31. package/lib/generators/react-app/templates/src/components/menus/Menu.jsx +62 -0
  32. package/lib/generators/{js → react-app}/templates/src/components/pages/Error.jsx +8 -12
  33. package/lib/generators/react-app/templates/src/components/pages/Home.jsx +32 -0
  34. package/lib/generators/{js → react-app}/templates/src/components/partials/PageMeta.jsx +11 -11
  35. package/lib/generators/{js → react-app}/templates/src/contexts/KeysContext.jsx +0 -0
  36. package/lib/generators/{js/templates/styles → react-app/templates/src/lib}/.gitkeep +0 -0
  37. package/lib/generators/{js → react-app}/templates/src/lib/PropTypes.js +0 -0
  38. package/lib/generators/{js → react-app}/templates/src/lib/utils.js +0 -0
  39. package/lib/generators/react-app/templates/src/polyfills/index.js +6 -0
  40. package/lib/generators/react-app/templates/src/polyfills/intl-en.js +2 -0
  41. package/lib/generators/react-app/templates/src/polyfills/intl-fr.js +2 -0
  42. package/lib/generators/react-app/templates/src/polyfills/should.js +14 -0
  43. package/lib/generators/react-app/templates/styles/.gitkeep +0 -0
  44. package/lib/generators/{js/templates/styles/buttons/button.scss → react-app/templates/styles/buttons/button.module.scss} +1 -0
  45. package/lib/generators/{js/templates/styles/layouts/main.scss → react-app/templates/styles/layouts/main.module.scss} +0 -0
  46. package/lib/generators/{js/templates/styles/menus/menu.scss → react-app/templates/styles/menus/menu.module.scss} +0 -0
  47. package/lib/generators/{js/templates/styles/pages/error.scss → react-app/templates/styles/pages/error.module.scss} +0 -0
  48. package/lib/generators/{js/templates/styles/pages/home.scss → react-app/templates/styles/pages/home.module.scss} +0 -0
  49. package/lib/generators/rollup/index.js +54 -0
  50. package/lib/generators/rollup/templates/config.js +50 -0
  51. package/lib/generators/scss/index.js +3 -16
  52. package/lib/generators/scss/templates/{main.scss → styles.scss} +0 -0
  53. package/lib/generators/server/index.js +81 -0
  54. package/lib/generators/server/templates/server.js +59 -0
  55. package/lib/generators/storybook/index.js +1 -7
  56. package/lib/generators/stylelint/index.js +13 -14
  57. package/lib/lib/utils.js +17 -0
  58. package/package.json +2 -2
  59. package/lib/generators/babel/templates/babel-preset-react.js +0 -7
  60. package/lib/generators/babel/templates/babel-preset.js +0 -57
  61. package/lib/generators/babel/templates/babelrc +0 -5
  62. package/lib/generators/babel/templates/utils/processScss.js +0 -10
  63. package/lib/generators/babel/templates/utils/transformRequireIgnore.js +0 -80
  64. package/lib/generators/html/templates/index.js +0 -9
  65. package/lib/generators/html/templates/root.js +0 -23
  66. package/lib/generators/html/templates/utils.js +0 -7
  67. package/lib/generators/js/templates/browserslistrc +0 -9
  68. package/lib/generators/js/templates/config.js +0 -33
  69. package/lib/generators/js/templates/index.js +0 -41
  70. package/lib/generators/js/templates/src/actions/LayoutActions.js +0 -12
  71. package/lib/generators/js/templates/src/actions/SiteActions.js +0 -22
  72. package/lib/generators/js/templates/src/components/App.jsx +0 -52
  73. package/lib/generators/js/templates/src/components/Root.jsx +0 -70
  74. package/lib/generators/js/templates/src/components/layouts/Main.jsx +0 -52
  75. package/lib/generators/js/templates/src/components/menus/Menu.jsx +0 -60
  76. package/lib/generators/js/templates/src/components/messages/Success.jsx +0 -36
  77. package/lib/generators/js/templates/src/components/pages/Home.jsx +0 -32
  78. package/lib/generators/js/templates/src/components/partials/Label.jsx +0 -32
  79. package/lib/generators/js/templates/src/reducers/LayoutReducer.js +0 -32
  80. package/lib/generators/js/templates/src/reducers/SiteReducer.js +0 -36
  81. package/lib/generators/js/templates/src/reducers/index.js +0 -7
  82. package/lib/generators/js/templates/src/vendor/polyfills/intl-en.js +0 -2
  83. package/lib/generators/js/templates/src/vendor/polyfills/intl-fr.js +0 -2
@@ -1,16 +1,22 @@
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 JsGenerator extends _generator.default {
13
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
14
+
15
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
16
+
17
+ function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
18
+
19
+ module.exports = class ReactAppGenerator extends _generator.default {
14
20
  // The name `constructor` is important here
15
21
  constructor(...args) {
16
22
  super(...args);
@@ -18,20 +24,13 @@ module.exports = class JsGenerator extends _generator.default {
18
24
  type: String,
19
25
  required: false
20
26
  });
21
- this.option('babel-compile', {
22
- type: Boolean,
23
- defaults: false
24
- });
25
27
  this.option('path', {
26
28
  type: String,
27
- defaults: 'src/js'
29
+ defaults: 'src'
28
30
  });
29
31
  this.option('styles-path', {
30
32
  type: String
31
33
  });
32
- this.option('root-props-import', {
33
- type: String
34
- });
35
34
  }
36
35
 
37
36
  initializing() {
@@ -46,7 +45,7 @@ module.exports = class JsGenerator extends _generator.default {
46
45
  }
47
46
 
48
47
  console.log(_chalk.default.yellow('\n----------------------'));
49
- console.log('Javascript Generator');
48
+ console.log('React App Generator');
50
49
  console.log(_chalk.default.yellow('----------------------\n'));
51
50
  },
52
51
 
@@ -71,20 +70,6 @@ module.exports = class JsGenerator extends _generator.default {
71
70
  };
72
71
  }
73
72
 
74
- configuring() {
75
- const skipInstall = this.options['skip-install'];
76
- this.composeWith('folklore:babel', {
77
- 'react-app': !this.options['babel-compile'],
78
- compile: this.options['babel-compile'],
79
- 'skip-install': skipInstall,
80
- quiet: true
81
- });
82
- this.composeWith('folklore:eslint', {
83
- 'skip-install': skipInstall,
84
- quiet: true
85
- });
86
- }
87
-
88
73
  get writing() {
89
74
  return {
90
75
  directory() {
@@ -100,10 +85,7 @@ module.exports = class JsGenerator extends _generator.default {
100
85
 
101
86
  index() {
102
87
  const jsPath = this.options.path;
103
- const rootPropsImport = this.options['root-props-import'] || null;
104
- this.fs.copyTpl(this.templatePath('index.js'), this.destinationPath(_path.default.join(jsPath, 'index.js')), {
105
- rootPropsImport
106
- });
88
+ this.fs.copyTpl(this.templatePath('index.js'), this.destinationPath(_path.default.join(jsPath, 'index.js')));
107
89
  },
108
90
 
109
91
  styles() {
@@ -116,41 +98,29 @@ module.exports = class JsGenerator extends _generator.default {
116
98
  this.fs.copyTpl(srcPath, destPath, templateData);
117
99
  },
118
100
 
119
- config() {
120
- const jsPath = _lodash.default.get(this.options, 'path');
121
-
122
- const srcPath = this.templatePath('config.js');
123
- const destPath = this.destinationPath(_path.default.join(jsPath, 'config.js'));
124
- this.fs.copy(srcPath, destPath);
125
- },
126
-
127
- browserslistrc() {
128
- const srcPath = this.templatePath('browserslistrc');
129
- const destPath = this.destinationPath('.browserslistrc');
130
- this.fs.copy(srcPath, destPath);
131
- },
132
-
133
101
  packageJSON() {
134
102
  const srcPath = this.templatePath('_package.json');
135
103
  const destPath = this.destinationPath('package.json');
136
104
  const packageJSON = this.fs.readJSON(srcPath);
137
- packageJSON.name = this.options['project-name'];
138
- const currentPackageJSON = this.fs.exists(destPath) ? this.fs.readJSON(destPath) : {};
139
- this.fs.writeJSON(destPath, _lodash.default.merge(packageJSON, currentPackageJSON));
105
+ this.packageJson.merge(_objectSpread(_objectSpread({}, packageJSON), {}, {
106
+ name: this.options['project-name']
107
+ }));
108
+ },
109
+
110
+ dependencies() {
111
+ this.addDependencies(['react', 'react-dom', 'prop-types', 'react-intl', 'react-router', 'react-router-dom', 'react-helmet', 'classnames', '@folklore/routes', '@folklore/fonts', '@folklore/forms', '@folklore/fetch', '@folklore/hooks', '@folklore/tracking', // Polyfills
112
+ 'intl', '@formatjs/intl-locale', '@formatjs/intl-pluralrules', 'intersection-observer', 'resize-observer-polyfill']);
140
113
  }
141
114
 
142
115
  };
143
116
  }
144
117
 
145
- install() {
118
+ async install() {
146
119
  if (this.options['skip-install']) {
147
120
  return;
148
121
  }
149
122
 
150
- const dependencies = ['domready@latest', 'fastclick@latest', 'keymirror@latest', 'lodash@latest', 'react@latest', 'prop-types@latest', 'react-dom@latest', 'react-redux@latest', 'react-intl@latest', 'react-router@^5.0.1', 'react-router-dom@latest', 'connected-react-router@latest', 'react-helmet@latest', 'node-polyglot@latest', 'classnames@latest', '@folklore/react-container@latest', '@folklore/fonts@latest', '@folklore/forms@latest', '@folklore/tracking@latest', 'react-loadable@latest', 'webfontloader@latest', 'intl@latest'];
151
- const devDependencies = ['html-webpack-plugin@latest'];
152
- this.addDependencies(dependencies);
153
- this.addDevDependencies(devDependencies);
123
+ await this.spawnCommand('npm', ['install']);
154
124
  }
155
125
 
156
126
  };
@@ -0,0 +1,23 @@
1
+ import React from 'react';
2
+ import { createRoot } from 'react-dom/client';
3
+
4
+ import Container from './components/Container';
5
+ import shouldPolyfill from './polyfills/should';
6
+
7
+ function getAppProps() {
8
+ return window.props || {};
9
+ }
10
+
11
+ function renderApp(props) {
12
+ const element = document.getElementById('app');
13
+ const container = React.createElement(Container, props);
14
+ const strictMode = React.createElement(React.StrictMode, {}, container);
15
+ const root = createRoot(element);
16
+ root.render(strictMode);
17
+ }
18
+
19
+ if (shouldPolyfill()) {
20
+ import('./polyfills/index').then(() => renderApp(getAppProps()));
21
+ } else {
22
+ renderApp(getAppProps());
23
+ }
@@ -0,0 +1,45 @@
1
+ import React from 'react';
2
+ // import PropTypes from 'prop-types';
3
+ import { Route, Routes } from 'react-router-dom';
4
+
5
+ // import { useUrlGenerator } from '@folklore/routes';
6
+ // import * as AppPropTypes from '../lib/PropTypes';
7
+ import MainLayout from './layouts/Main';
8
+ import ErrorPage from './pages/Error';
9
+ import HomePage from './pages/Home';
10
+
11
+ import '<%= getRelativeStylesPath('components/App.jsx', 'styles.scss') %>';
12
+
13
+ const propTypes = {};
14
+
15
+ const defaultProps = {};
16
+
17
+ function App() {
18
+ // const urlGenerator = useUrlGenerator();
19
+ return (
20
+ <Routes>
21
+ <Route
22
+ path="/"
23
+ exact
24
+ element={
25
+ <MainLayout>
26
+ <HomePage />
27
+ </MainLayout>
28
+ }
29
+ />
30
+ <Route
31
+ path="*"
32
+ element={
33
+ <MainLayout>
34
+ <ErrorPage />
35
+ </MainLayout>
36
+ }
37
+ />
38
+ </Routes>
39
+ );
40
+ }
41
+
42
+ App.propTypes = propTypes;
43
+ App.defaultProps = defaultProps;
44
+
45
+ export default App;
@@ -0,0 +1,40 @@
1
+ import { RoutesProvider } from '@folklore/routes';
2
+ import PropTypes from 'prop-types';
3
+ import React from 'react';
4
+ import { IntlProvider } from 'react-intl';
5
+ import { BrowserRouter } from 'react-router-dom';
6
+
7
+ // import * as AppPropTypes from '../lib/PropTypes';
8
+ import App from './App';
9
+
10
+ const propTypes = {
11
+ locale: PropTypes.string,
12
+ messages: PropTypes.oneOfType([
13
+ PropTypes.objectOf(PropTypes.objectOf(PropTypes.string)),
14
+ PropTypes.objectOf(PropTypes.string),
15
+ ]),
16
+ routes: PropTypes.objectOf(PropTypes.string),
17
+ };
18
+
19
+ const defaultProps = {
20
+ locale: 'fr',
21
+ messages: {},
22
+ routes: {},
23
+ };
24
+
25
+ function Container({ locale, messages, routes }) {
26
+ return (
27
+ <IntlProvider locale={locale} messages={messages[locale] || messages}>
28
+ <BrowserRouter>
29
+ <RoutesProvider routes={routes}>
30
+ <App />
31
+ </RoutesProvider>
32
+ </BrowserRouter>
33
+ </IntlProvider>
34
+ );
35
+ }
36
+
37
+ Container.propTypes = propTypes;
38
+ Container.defaultProps = defaultProps;
39
+
40
+ export default Container;
@@ -5,9 +5,8 @@ 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
- import styles from '<%= getRelativeStylesPath('components/buttons/Button.jsx', 'buttons/button.scss') %>';
9
+ import styles from '<%= getRelativeStylesPath('components/buttons/Button.jsx', 'buttons/button.module.scss') %>';
11
10
 
12
11
  const propTypes = {
13
12
  type: PropTypes.string,
@@ -22,9 +21,6 @@ const propTypes = {
22
21
  disabled: PropTypes.bool,
23
22
  loading: PropTypes.bool,
24
23
  disableOnLoading: PropTypes.bool,
25
- small: PropTypes.bool,
26
- big: PropTypes.bool,
27
- withShadow: PropTypes.bool,
28
24
  className: PropTypes.string,
29
25
  iconClassName: PropTypes.string,
30
26
  labelClassName: PropTypes.string,
@@ -44,16 +40,13 @@ const defaultProps = {
44
40
  disabled: false,
45
41
  loading: false,
46
42
  disableOnLoading: true,
47
- small: false,
48
- big: false,
49
- withShadow: false,
50
43
  className: null,
51
44
  iconClassName: null,
52
45
  labelClassName: null,
53
46
  onClick: null,
54
47
  };
55
48
 
56
- const Button = ({
49
+ function Button({
57
50
  type,
58
51
  href,
59
52
  external,
@@ -66,16 +59,12 @@ const Button = ({
66
59
  disabled,
67
60
  loading,
68
61
  disableOnLoading,
69
- small,
70
- big,
71
- withShadow,
72
62
  onClick,
73
63
  className,
74
64
  iconClassName,
75
65
  labelClassName,
76
- }) => {
66
+ }) {
77
67
  const finalLabel = label || children;
78
- const text = <Label>{finalLabel}</Label>;
79
68
  const hasChildren = label !== null && children !== null;
80
69
  const hasIcon = icon !== null;
81
70
  const hasInlineIcon = hasIcon && (iconPosition === 'inline' || text === null);
@@ -120,7 +109,7 @@ const Button = ({
120
109
  {hasChildren ? children : null}
121
110
  </>
122
111
  ) : null}
123
- {!hasIcon ? text : null}
112
+ {!hasIcon ? finalLabel : null}
124
113
  {hasChildren ? children : null}
125
114
  </>
126
115
  );
@@ -131,9 +120,6 @@ const Button = ({
131
120
  [styles.withIcon]: hasIcon,
132
121
  [styles.withIconColumns]: hasIconColumns,
133
122
  [styles.withText]: text !== null,
134
- [styles.withShadow]: withShadow,
135
- [styles.isSmall]: small,
136
- [styles.isBig]: big,
137
123
  [styles.isLink]: href !== null,
138
124
  [styles.isDisabled]: disabled,
139
125
  [styles.isLoading]: loading,
@@ -0,0 +1,27 @@
1
+ import React from 'react';
2
+ import PropTypes from 'prop-types';
3
+
4
+ import styles from '<%= getRelativeStylesPath('components/layouts/Main.jsx', 'layouts/main.module.scss') %>';
5
+
6
+ const propTypes = {
7
+ children: PropTypes.node.isRequired,
8
+ };
9
+
10
+ const defaultProps = {
11
+
12
+ };
13
+
14
+ function MainLayout({ children }) {
15
+ return (
16
+ <div className={styles.container}>
17
+ <div className={styles.inner}>
18
+ <div className={styles.content}>{children}</div>
19
+ </div>
20
+ </div>
21
+ );
22
+ };
23
+
24
+ MainLayout.propTypes = propTypes;
25
+ MainLayout.defaultProps = defaultProps;
26
+
27
+ export default MainLayout;
@@ -0,0 +1,62 @@
1
+ /* eslint-disable react/no-array-index-key */
2
+ import React from 'react';
3
+ import PropTypes from 'prop-types';
4
+ import classNames from 'classnames';
5
+ import { Link } from 'react-router-dom';
6
+
7
+ import * as AppPropTypes from '../../lib/PropTypes';
8
+ import Label from '../partials/Label';
9
+
10
+ import styles from '<%= getRelativeStylesPath('components/menus/Menu.jsx', 'menus/menu.module.scss') %>';
11
+
12
+ const propTypes = {
13
+ items: AppPropTypes.menuItems,
14
+ className: PropTypes.string,
15
+ };
16
+
17
+ const defaultProps = {
18
+ items: [],
19
+ className: null,
20
+ };
21
+
22
+ function Menu({ items, className }) {
23
+ return (
24
+ <nav
25
+ className={classNames([
26
+ styles.container,
27
+ {
28
+ [className]: className !== null,
29
+ },
30
+ ])}
31
+ >
32
+ <ul className={styles.items}>
33
+ {items.map(({ label, url, active = false, external = false, target = '_blank' }, index) => (
34
+ <li
35
+ className={classNames([
36
+ styles.item,
37
+ {
38
+ [styles.active]: active,
39
+ },
40
+ ])}
41
+ key={`item-${index}`}
42
+ >
43
+ {external ? (
44
+ <a href={url} target={target} className={styles.link}>
45
+ <Label>{label}</Label>
46
+ </a>
47
+ ) : (
48
+ <Link to={url} className={styles.link}>
49
+ <Label>{label}</Label>
50
+ </Link>
51
+ )}
52
+ </li>
53
+ ))}
54
+ </ul>
55
+ </nav>
56
+ );
57
+ }
58
+
59
+ Menu.propTypes = propTypes;
60
+ Menu.defaultProps = defaultProps;
61
+
62
+ export default Menu;
@@ -1,16 +1,14 @@
1
1
  /* eslint-disable react/jsx-props-no-spreading */
2
2
  import React from 'react';
3
3
  import PropTypes from 'prop-types';
4
- import { connect } from 'react-redux';
5
4
  import { Link } from 'react-router-dom';
6
- import { defineMessages } from 'react-intl';
7
- import { useUrlGenerator } from '@folklore/react-container';
5
+ import { defineMessages, FormattedMessage } from 'react-intl';
6
+ import { useUrlGenerator } from '@folklore/routes';
8
7
 
9
8
  // import * as AppPropTypes from '../../lib/PropTypes';
10
9
  import PageMeta from '../partials/PageMeta';
11
- import Label from '../partials/Label';
12
10
 
13
- import styles from '<%= getRelativeStylesPath('components/pages/Error.jsx', 'pages/error.scss') %>';
11
+ import styles from '<%= getRelativeStylesPath('components/pages/Error.jsx', 'pages/error.module.scss') %>';
14
12
 
15
13
  export const messages = defineMessages({
16
14
  metaTitle401: {
@@ -79,21 +77,21 @@ const defaultProps = {
79
77
  statusCode: 404,
80
78
  };
81
79
 
82
- const ErrorPage = ({ statusCode }) => {
80
+ function ErrorPage({ statusCode }) {
83
81
  const urlGenerator = useUrlGenerator();
84
82
  return (
85
83
  <div className={styles.container}>
86
84
  <PageMeta title={messages[`metaTitle${statusCode || 404}`]} />
87
85
  <div className={styles.inner}>
88
86
  <h1 className={styles.title}>
89
- <Label>{messages[`title${statusCode || 404}`]}</Label>
87
+ <FormattedMessage {...messages[`title${statusCode || 404}`]} />
90
88
  </h1>
91
89
  <p className={styles.description}>
92
- <Label>{messages[`description${statusCode || 404}`]}</Label>
90
+ <FormattedMessage {...messages[`description${statusCode || 404}`]} />
93
91
  </p>
94
92
  <div className={styles.actions}>
95
93
  <Link to={urlGenerator.route('home')}>
96
- <Label>{messages.gotoHome}</Label>
94
+ <FormattedMessage {...messages.gotoHome} />
97
95
  </Link>
98
96
  </div>
99
97
  </div>
@@ -104,6 +102,4 @@ const ErrorPage = ({ statusCode }) => {
104
102
  ErrorPage.propTypes = propTypes;
105
103
  ErrorPage.defaultProps = defaultProps;
106
104
 
107
- export default connect(({ site: { statusCode } }) => ({
108
- statusCode,
109
- }))(ErrorPage);
105
+ export default ErrorPage;
@@ -0,0 +1,32 @@
1
+ import React from 'react';
2
+ // import PropTypes from 'prop-types';
3
+ import { defineMessages } from 'react-intl';
4
+
5
+ // import * as AppPropTypes from '../../lib/PropTypes';
6
+ import PageMeta from '../partials/PageMeta';
7
+
8
+ import styles from '<%= getRelativeStylesPath('components/pages/Home.jsx', 'pages/home.module.scss') %>';
9
+
10
+ const messages = defineMessages({
11
+ metaTitle: {
12
+ defaultMessage: 'Home',
13
+ description: 'Page title'
14
+ },
15
+ });
16
+
17
+ const propTypes = {
18
+ // intl: AppPropTypes.intl.isRequired,
19
+ };
20
+
21
+ function HomePage () {
22
+ return (
23
+ <div className={styles.container}>
24
+ <PageMeta title={messages.metaTitle} />
25
+ <div className={styles.logo} />
26
+ </div>
27
+ );
28
+ }
29
+
30
+ HomePage.propTypes = propTypes;
31
+
32
+ export default HomePage;
@@ -1,20 +1,19 @@
1
1
  /* eslint-disable react/no-array-index-key */
2
2
  import React from 'react';
3
3
  import { Helmet } from 'react-helmet';
4
- import { defineMessages, injectIntl } from 'react-intl';
4
+ import { defineMessages, useIntl } from 'react-intl';
5
5
 
6
6
  import * as AppPropTypes from '../../lib/PropTypes';
7
7
  import { isMessage } from '../../lib/utils';
8
8
 
9
9
  const messages = defineMessages({
10
10
  title: {
11
- id: 'meta.title',
12
11
  defaultMessage: 'Title',
12
+ description: 'Page title',
13
13
  },
14
14
  });
15
15
 
16
16
  const propTypes = {
17
- intl: AppPropTypes.intl.isRequired,
18
17
  title: AppPropTypes.message,
19
18
  };
20
19
 
@@ -22,15 +21,16 @@ const defaultProps = {
22
21
  title: messages.title,
23
22
  };
24
23
 
25
- const PageMeta = ({
26
- intl, title,
27
- }) => (
28
- <Helmet>
29
- <title>{isMessage(title) ? intl.formatMessage(title) : title}</title>
30
- </Helmet>
31
- );
24
+ function PageMeta({ title }) {
25
+ const intl = useIntl();
26
+ return (
27
+ <Helmet>
28
+ <title>{isMessage(title) ? intl.formatMessage(title) : title}</title>
29
+ </Helmet>
30
+ );
31
+ }
32
32
 
33
33
  PageMeta.propTypes = propTypes;
34
34
  PageMeta.defaultProps = defaultProps;
35
35
 
36
- export default React.memo(injectIntl(PageMeta));
36
+ export default React.memo(PageMeta);
@@ -0,0 +1,6 @@
1
+ import 'intl';
2
+ import '@formatjs/intl-locale/polyfill';
3
+ import '@formatjs/intl-pluralrules/polyfill';
4
+ import 'intersection-observer';
5
+ import ResizeObserver from 'resize-observer-polyfill';
6
+ window.ResizeObserver = ResizeObserver;
@@ -0,0 +1,2 @@
1
+ import 'intl/locale-data/jsonp/en';
2
+ import '@formatjs/intl-pluralrules/locale-data/en'; // Add locale data for de
@@ -0,0 +1,2 @@
1
+ import 'intl/locale-data/jsonp/fr';
2
+ import '@formatjs/intl-pluralrules/locale-data/fr'; // Add locale data for de
@@ -0,0 +1,14 @@
1
+ import { shouldPolyfill as shouldPolyfillLocale } from '@formatjs/intl-locale/should-polyfill';
2
+ import { shouldPolyfill as shouldPolyfillPlural } from '@formatjs/intl-pluralrules/should-polyfill';
3
+
4
+ function should() {
5
+ return (
6
+ typeof window.Intl === 'undefined' ||
7
+ shouldPolyfillLocale() ||
8
+ shouldPolyfillPlural() ||
9
+ typeof window.IntersectionObserver === 'undefined' ||
10
+ typeof window.ResizeObserver === 'undefined'
11
+ );
12
+ }
13
+
14
+ export default should;
@@ -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
+ };