generator-folklore 3.0.4 → 3.0.5
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.
- package/lib/generators/babel/index.js +1 -1
- package/lib/generators/react-app/templates/index.js +6 -5
- package/lib/generators/react-app/templates/src/components/App.jsx +30 -27
- package/lib/generators/react-app/templates/src/components/Container.jsx +40 -0
- package/lib/generators/react-app/templates/src/components/menus/Menu.jsx +2 -2
- package/lib/generators/rollup/templates/config.js +7 -4
- package/package.json +2 -2
- package/lib/generators/react-app/templates/src/components/Routes.jsx +0 -43
@@ -46,7 +46,7 @@ module.exports = class BabelGenerator extends _generator.default {
|
|
46
46
|
'transform-runtime': transformRuntime,
|
47
47
|
'react-intl': reactIntl
|
48
48
|
} = this.options;
|
49
|
-
const srcPath = this.templatePath('config');
|
49
|
+
const srcPath = this.templatePath('config.js');
|
50
50
|
const destPath = this.destinationPath('babel.config.js');
|
51
51
|
this.fs.copyTpl(srcPath, destPath, {
|
52
52
|
react,
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import React from 'react';
|
2
2
|
import { createRoot } from 'react-dom/client';
|
3
3
|
|
4
|
-
import
|
4
|
+
import Container from './components/Container';
|
5
5
|
import shouldPolyfill from './polyfills/should';
|
6
6
|
|
7
7
|
function getAppProps() {
|
@@ -9,10 +9,11 @@ function getAppProps() {
|
|
9
9
|
}
|
10
10
|
|
11
11
|
function renderApp(props) {
|
12
|
-
const
|
13
|
-
const
|
14
|
-
const
|
15
|
-
root
|
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);
|
16
17
|
}
|
17
18
|
|
18
19
|
if (shouldPolyfill()) {
|
@@ -1,40 +1,43 @@
|
|
1
|
-
import { RoutesProvider } from '@folklore/routes';
|
2
|
-
import PropTypes from 'prop-types';
|
3
1
|
import React from 'react';
|
4
|
-
import
|
5
|
-
import {
|
2
|
+
// import PropTypes from 'prop-types';
|
3
|
+
import { Route, Routes } from 'react-router-dom';
|
6
4
|
|
5
|
+
// import { useUrlGenerator } from '@folklore/routes';
|
7
6
|
// import * as AppPropTypes from '../lib/PropTypes';
|
8
|
-
import
|
7
|
+
import MainLayout from './layouts/Main';
|
8
|
+
import ErrorPage from './pages/Error';
|
9
|
+
import HomePage from './pages/Home';
|
9
10
|
|
10
11
|
import '<%= getRelativeStylesPath('components/App.jsx', 'styles.scss') %>';
|
11
12
|
|
12
|
-
const propTypes = {
|
13
|
-
locale: PropTypes.string,
|
14
|
-
messages: PropTypes.oneOfType([
|
15
|
-
PropTypes.objectOf(PropTypes.objectOf(PropTypes.string)),
|
16
|
-
PropTypes.objectOf(PropTypes.string),
|
17
|
-
]),
|
18
|
-
routes: PropTypes.objectOf(PropTypes.string),
|
19
|
-
};
|
13
|
+
const propTypes = {};
|
20
14
|
|
21
|
-
const defaultProps = {
|
22
|
-
locale: 'fr',
|
23
|
-
messages: {},
|
24
|
-
routes: {},
|
25
|
-
};
|
15
|
+
const defaultProps = {};
|
26
16
|
|
27
|
-
function App(
|
17
|
+
function App() {
|
18
|
+
// const urlGenerator = useUrlGenerator();
|
28
19
|
return (
|
29
|
-
<
|
30
|
-
<
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
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>
|
36
39
|
);
|
37
|
-
}
|
40
|
+
}
|
38
41
|
|
39
42
|
App.propTypes = propTypes;
|
40
43
|
App.defaultProps = defaultProps;
|
@@ -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;
|
@@ -30,7 +30,7 @@ function Menu({ items, className }) {
|
|
30
30
|
])}
|
31
31
|
>
|
32
32
|
<ul className={styles.items}>
|
33
|
-
{items.map(({ label, url, active = false, external = false }, index) => (
|
33
|
+
{items.map(({ label, url, active = false, external = false, target = '_blank' }, index) => (
|
34
34
|
<li
|
35
35
|
className={classNames([
|
36
36
|
styles.item,
|
@@ -41,7 +41,7 @@ function Menu({ items, className }) {
|
|
41
41
|
key={`item-${index}`}
|
42
42
|
>
|
43
43
|
{external ? (
|
44
|
-
<a href={url} className={styles.link}>
|
44
|
+
<a href={url} target={target} className={styles.link}>
|
45
45
|
<Label>{label}</Label>
|
46
46
|
</a>
|
47
47
|
) : (
|
@@ -1,9 +1,9 @@
|
|
1
|
-
import path from 'path';
|
2
1
|
import babel from '@rollup/plugin-babel';
|
3
2
|
import commonjs from '@rollup/plugin-commonjs';
|
4
3
|
import json from '@rollup/plugin-json';
|
5
4
|
import resolve from '@rollup/plugin-node-resolve';
|
6
5
|
import replace from '@rollup/plugin-replace';
|
6
|
+
import path from 'path';
|
7
7
|
|
8
8
|
export const plugins = [
|
9
9
|
json(),
|
@@ -20,9 +20,12 @@ export const plugins = [
|
|
20
20
|
babelHelpers: 'runtime',
|
21
21
|
}),
|
22
22
|
replace({
|
23
|
-
|
24
|
-
|
25
|
-
|
23
|
+
values: {
|
24
|
+
'process.env.NODE_ENV': JSON.stringify('production'),
|
25
|
+
__buildDate__: () => JSON.stringify(new Date()),
|
26
|
+
__buildVersion: 15,
|
27
|
+
},
|
28
|
+
preventAssignment: false,
|
26
29
|
}),
|
27
30
|
];
|
28
31
|
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "generator-folklore",
|
3
|
-
"version": "3.0.
|
3
|
+
"version": "3.0.5",
|
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": "
|
42
|
+
"gitHead": "49ba685c19aa4e7e0a358eb8d7f04a285e5732a5"
|
43
43
|
}
|
@@ -1,43 +0,0 @@
|
|
1
|
-
import React from 'react';
|
2
|
-
// import PropTypes from 'prop-types';
|
3
|
-
import { Route, Routes as Switch } 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
|
-
const propTypes = {};
|
12
|
-
|
13
|
-
const defaultProps = {};
|
14
|
-
|
15
|
-
function Routes() {
|
16
|
-
// const urlGenerator = useUrlGenerator();
|
17
|
-
return (
|
18
|
-
<Switch>
|
19
|
-
<Route
|
20
|
-
path="/"
|
21
|
-
exact
|
22
|
-
element={
|
23
|
-
<MainLayout>
|
24
|
-
<HomePage />
|
25
|
-
</MainLayout>
|
26
|
-
}
|
27
|
-
/>
|
28
|
-
<Route
|
29
|
-
path="*"
|
30
|
-
element={
|
31
|
-
<MainLayout>
|
32
|
-
<ErrorPage />
|
33
|
-
</MainLayout>
|
34
|
-
}
|
35
|
-
/>
|
36
|
-
</Switch>
|
37
|
-
);
|
38
|
-
}
|
39
|
-
|
40
|
-
Routes.propTypes = propTypes;
|
41
|
-
Routes.defaultProps = defaultProps;
|
42
|
-
|
43
|
-
export default Routes;
|