generator-folklore 3.0.20 → 3.0.21
Sign up to get free protection for your applications and to get access to all the features.
- package/lib/generators/build/index.js +1 -1
- package/lib/generators/eslint/index.js +2 -2
- package/lib/generators/intl/index.js +1 -1
- package/lib/generators/laravel-auth/templates/resources/assets/js/components/Auth.jsx +1 -1
- package/lib/generators/laravel-auth/templates/resources/assets/js/components/forms/Login.jsx +2 -2
- package/lib/generators/laravel-panneau/templates/resources/assets/js/components/panneau/fields/PageSlug.jsx +1 -1
- package/lib/generators/micromag-project/index.js +114 -0
- package/lib/generators/micromag-project/templates/Home.jsx +33 -0
- package/lib/generators/micromag-project/templates/Routes.jsx +34 -0
- package/lib/generators/micromag-project/templates/data.json +38 -0
- package/lib/generators/micromag-project/templates/home.module.scss +19 -0
- package/lib/generators/micromag-project/templates/styles.scss +2 -0
- package/lib/generators/prettier/index.js +2 -2
- package/lib/generators/react-app/index.js +6 -7
- package/lib/generators/react-app/templates/src/components/App.jsx +6 -4
- package/lib/generators/react-app/templates/src/components/Routes.jsx +13 -20
- package/lib/generators/react-app/templates/src/components/buttons/Button.jsx +2 -2
- package/lib/generators/react-app/templates/src/components/menus/Menu.jsx +2 -2
- package/lib/generators/react-app/templates/src/components/pages/Error.jsx +2 -2
- package/lib/generators/stylelint/index.js +4 -4
- package/package.json +2 -2
@@ -30,8 +30,8 @@ module.exports = class EslintGenerator extends _generator.default {
|
|
30
30
|
'@babel/eslint-parser': '^7.18.9',
|
31
31
|
eslint: '^8.0.0',
|
32
32
|
'eslint-config-airbnb': '^19.0.4',
|
33
|
-
'eslint-config-prettier': '^
|
34
|
-
'eslint-plugin-prettier': '^
|
33
|
+
'eslint-config-prettier': '^9.1.0',
|
34
|
+
'eslint-plugin-prettier': '^5.1.3',
|
35
35
|
'eslint-plugin-import': '^2.26.0',
|
36
36
|
'eslint-plugin-jsx-a11y': '^6.6.1',
|
37
37
|
'eslint-plugin-react': '^7.30.1',
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import React from 'react';
|
2
2
|
// import PropTypes from 'prop-types';
|
3
|
-
import { Route, Switch } from '
|
3
|
+
import { Route, Switch } from 'wouter';
|
4
4
|
import { withUrlGenerator } from '@folklore/react-container';
|
5
5
|
|
6
6
|
import * as AppPropTypes from '../lib/PropTypes';
|
package/lib/generators/laravel-auth/templates/resources/assets/js/components/forms/Login.jsx
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
import React, { useState } from 'react';
|
2
2
|
import PropTypes from 'prop-types';
|
3
3
|
import { defineMessages, injectIntl, FormattedMessage } from 'react-intl';
|
4
|
-
import { Link } from '
|
4
|
+
import { Link } from 'wouter';
|
5
5
|
import classNames from 'classnames';
|
6
6
|
import { withUrlGenerator } from '@folklore/react-container';
|
7
7
|
import { useForm } from '@folklore/forms';
|
@@ -71,7 +71,7 @@ const LoginForm = ({
|
|
71
71
|
helpText={(
|
72
72
|
<div className={styles.forgot}>
|
73
73
|
<Link
|
74
|
-
|
74
|
+
href={urlGenerator.route('auth.password.request')}
|
75
75
|
className={styles.link}
|
76
76
|
>
|
77
77
|
<FormattedMessage {...messages.forgotPassword} />
|
@@ -4,7 +4,7 @@ import TextField from '@panneau/field-text';
|
|
4
4
|
import classNames from 'classnames';
|
5
5
|
import PropTypes from 'prop-types';
|
6
6
|
import React from 'react';
|
7
|
-
import { generatePath } from '
|
7
|
+
import { generatePath } from '@folklore/routes';
|
8
8
|
|
9
9
|
const propTypes = {
|
10
10
|
fieldLocale: PropTypes.string,
|
@@ -0,0 +1,114 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
var _chalk = _interopRequireDefault(require("chalk"));
|
4
|
+
var _lodash = _interopRequireDefault(require("lodash"));
|
5
|
+
var _path = _interopRequireDefault(require("path"));
|
6
|
+
var _generator = _interopRequireDefault(require("../../lib/generator"));
|
7
|
+
var _utils = require("../../lib/utils");
|
8
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
9
|
+
module.exports = class MicromagProjectGenerator extends _generator.default {
|
10
|
+
// The name `constructor` is important here
|
11
|
+
constructor(...args) {
|
12
|
+
super(...args);
|
13
|
+
this.argument('project-name', {
|
14
|
+
type: String,
|
15
|
+
required: false
|
16
|
+
});
|
17
|
+
this.option('src-path', {
|
18
|
+
type: String,
|
19
|
+
desc: 'Path for source',
|
20
|
+
defaults: './src'
|
21
|
+
});
|
22
|
+
this.option('dest-path', {
|
23
|
+
type: String,
|
24
|
+
desc: 'Path for build',
|
25
|
+
defaults: './dist'
|
26
|
+
});
|
27
|
+
this.srcPath = filePath => this.destinationPath(_path.default.join(this.options['src-path'], filePath));
|
28
|
+
}
|
29
|
+
get prompting() {
|
30
|
+
return {
|
31
|
+
welcome() {
|
32
|
+
if (this.options.quiet) {
|
33
|
+
return;
|
34
|
+
}
|
35
|
+
console.log(_chalk.default.yellow('\n----------------------'));
|
36
|
+
console.log('Micromag Project Generator');
|
37
|
+
console.log(_chalk.default.yellow('----------------------\n'));
|
38
|
+
},
|
39
|
+
prompts() {
|
40
|
+
const prompts = [];
|
41
|
+
if (!this.options['project-name']) {
|
42
|
+
prompts.push(_generator.default.prompts.project_name);
|
43
|
+
}
|
44
|
+
if (!prompts.length) {
|
45
|
+
return null;
|
46
|
+
}
|
47
|
+
return this.prompt(prompts).then(answers => {
|
48
|
+
if (answers['project-name']) {
|
49
|
+
this.options['project-name'] = answers['project-name'];
|
50
|
+
}
|
51
|
+
});
|
52
|
+
}
|
53
|
+
};
|
54
|
+
}
|
55
|
+
async configuring() {
|
56
|
+
const {
|
57
|
+
'project-name': projectName,
|
58
|
+
'src-path': srcPath,
|
59
|
+
'dest-path': destPath
|
60
|
+
} = this.options;
|
61
|
+
await this.composeWith('folklore:html-project', {
|
62
|
+
'skip-install': true,
|
63
|
+
quiet: true,
|
64
|
+
'project-name': projectName,
|
65
|
+
'src-path': srcPath,
|
66
|
+
'dest-path': destPath
|
67
|
+
});
|
68
|
+
}
|
69
|
+
get conflicts() {
|
70
|
+
return {
|
71
|
+
home() {
|
72
|
+
const {
|
73
|
+
'src-path': srcPath
|
74
|
+
} = this.options;
|
75
|
+
const templateData = {
|
76
|
+
getRelativeStylesPath: (from, src) => _path.default.relative(this.destinationPath(_path.default.dirname(_path.default.join(srcPath, from))), this.destinationPath(_path.default.join(_path.default.join(srcPath, 'styles'), src)))
|
77
|
+
};
|
78
|
+
this.fs.delete(this.srcPath('components/pages/Home.jsx'));
|
79
|
+
this.fs.delete(this.srcPath('styles/pages/home.module.scss'));
|
80
|
+
this.fs.copyTpl(this.templatePath('Home.jsx'), this.srcPath('components/pages/Home.jsx'), templateData);
|
81
|
+
this.fs.copyTpl(this.templatePath('home.module.scss'), this.srcPath('styles/pages/home.module.scss'), templateData);
|
82
|
+
},
|
83
|
+
routes() {
|
84
|
+
const {
|
85
|
+
'src-path': srcPath
|
86
|
+
} = this.options;
|
87
|
+
const templateData = {
|
88
|
+
getRelativeStylesPath: (from, src) => _path.default.relative(this.destinationPath(_path.default.dirname(_path.default.join(srcPath, from))), this.destinationPath(_path.default.join(_path.default.join(srcPath, 'styles'), src)))
|
89
|
+
};
|
90
|
+
this.fs.delete(this.srcPath('components/Routes.jsx'));
|
91
|
+
this.fs.copyTpl(this.templatePath('Routes.jsx'), this.srcPath('components/Routes.jsx'), templateData);
|
92
|
+
},
|
93
|
+
styles() {
|
94
|
+
this.fs.delete(this.srcPath('styles/styles.scss'));
|
95
|
+
this.fs.copyTpl(this.templatePath('styles.scss'), this.srcPath('styles/styles.scss'));
|
96
|
+
},
|
97
|
+
micromag() {
|
98
|
+
this.fs.copyTpl(this.templatePath('data.json'), this.srcPath('micromag/data.json'));
|
99
|
+
},
|
100
|
+
dependencies() {
|
101
|
+
this.addDependencies({
|
102
|
+
'@micromag/viewer': '^0.3.492',
|
103
|
+
'@micromag/intl': '^0.3.488'
|
104
|
+
});
|
105
|
+
}
|
106
|
+
};
|
107
|
+
}
|
108
|
+
async install() {
|
109
|
+
if (this.options['skip-install']) {
|
110
|
+
return;
|
111
|
+
}
|
112
|
+
await this.spawnCommand('npm', ['install']);
|
113
|
+
}
|
114
|
+
};
|
@@ -0,0 +1,33 @@
|
|
1
|
+
import '@micromag/intl/locale/fr';
|
2
|
+
import Micromag from '@micromag/viewer';
|
3
|
+
import React from 'react';
|
4
|
+
import { useIntl } from 'react-intl';
|
5
|
+
|
6
|
+
// import * as AppPropTypes from '../../lib/PropTypes';
|
7
|
+
import story from '../../micromag/data.json';
|
8
|
+
|
9
|
+
import styles from '<%= getRelativeStylesPath('components/pages/Home.jsx', 'pages/home.module.scss') %>';
|
10
|
+
|
11
|
+
const propTypes = {
|
12
|
+
// intl: AppPropTypes.intl.isRequired,
|
13
|
+
};
|
14
|
+
|
15
|
+
function HomePage() {
|
16
|
+
const { locale } = useIntl();
|
17
|
+
return (
|
18
|
+
<div className={styles.container}>
|
19
|
+
<Micromag
|
20
|
+
story={story}
|
21
|
+
locale={locale}
|
22
|
+
// basePath={basePath}
|
23
|
+
// memoryRouter
|
24
|
+
pathWithIndex
|
25
|
+
className={styles.micromag}
|
26
|
+
/>
|
27
|
+
</div>
|
28
|
+
);
|
29
|
+
}
|
30
|
+
|
31
|
+
HomePage.propTypes = propTypes;
|
32
|
+
|
33
|
+
export default HomePage;
|
@@ -0,0 +1,34 @@
|
|
1
|
+
import React from 'react';
|
2
|
+
// import PropTypes from 'prop-types';
|
3
|
+
import { Route, Switch } from 'wouter';
|
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
|
+
<Switch>
|
22
|
+
<Route>
|
23
|
+
<MainLayout>
|
24
|
+
<HomePage />
|
25
|
+
</MainLayout>
|
26
|
+
</Route>
|
27
|
+
</Switch>
|
28
|
+
);
|
29
|
+
}
|
30
|
+
|
31
|
+
Routes.propTypes = propTypes;
|
32
|
+
Routes.defaultProps = defaultProps;
|
33
|
+
|
34
|
+
export default Routes;
|
@@ -0,0 +1,38 @@
|
|
1
|
+
{
|
2
|
+
"components": [
|
3
|
+
{
|
4
|
+
"id": "screen1",
|
5
|
+
"type": "text-title",
|
6
|
+
"background": {
|
7
|
+
"color": { "color": "#ffcc00", "alpha": 1 },
|
8
|
+
"image": null,
|
9
|
+
"fit": "contain",
|
10
|
+
"repeat": true
|
11
|
+
},
|
12
|
+
"layout": "middle",
|
13
|
+
"title": {
|
14
|
+
"body": "<h1>Écran 1</h1>"
|
15
|
+
},
|
16
|
+
"text": {
|
17
|
+
"body": "<p>Texte</p>"
|
18
|
+
}
|
19
|
+
},
|
20
|
+
{
|
21
|
+
"id": "screen2",
|
22
|
+
"type": "text-title",
|
23
|
+
"background": {
|
24
|
+
"color": { "color": "#cc0000", "alpha": 1 },
|
25
|
+
"image": null,
|
26
|
+
"fit": "contain",
|
27
|
+
"repeat": true
|
28
|
+
},
|
29
|
+
"layout": "middle",
|
30
|
+
"title": {
|
31
|
+
"body": "<h1>Écran 2</h1>"
|
32
|
+
},
|
33
|
+
"text": {
|
34
|
+
"body": "<p>Texte</p>"
|
35
|
+
}
|
36
|
+
}
|
37
|
+
]
|
38
|
+
}
|
@@ -0,0 +1,19 @@
|
|
1
|
+
@import '../commons/variables';
|
2
|
+
@import '../commons/placeholders';
|
3
|
+
@import '../commons/mixins';
|
4
|
+
|
5
|
+
.container {
|
6
|
+
position: fixed;
|
7
|
+
top: 0;
|
8
|
+
left: 0;
|
9
|
+
width: 100%;
|
10
|
+
height: 100%;
|
11
|
+
|
12
|
+
.micromag {
|
13
|
+
position: absolute;
|
14
|
+
top: 0;
|
15
|
+
left: 0;
|
16
|
+
width: 100%;
|
17
|
+
height: 100%;
|
18
|
+
}
|
19
|
+
}
|
@@ -25,8 +25,8 @@ module.exports = class PrettierGenerator extends _generator.default {
|
|
25
25
|
},
|
26
26
|
dependencies() {
|
27
27
|
this.addDevDependencies({
|
28
|
-
prettier: '^2.
|
29
|
-
'@prettier/plugin-php': '^0.
|
28
|
+
prettier: '^3.2.5',
|
29
|
+
'@prettier/plugin-php': '^0.22.2',
|
30
30
|
'@trivago/prettier-plugin-sort-imports': '^4.1.1'
|
31
31
|
});
|
32
32
|
}
|
@@ -92,16 +92,15 @@ module.exports = class ReactAppGenerator extends _generator.default {
|
|
92
92
|
'react-dom': '^18.0.0',
|
93
93
|
'prop-types': '^15.0.0',
|
94
94
|
'react-intl': '^6.0.0',
|
95
|
-
'
|
96
|
-
'react-router-dom': '^6.0.0',
|
95
|
+
'wouter': '^3.0.0',
|
97
96
|
'react-helmet': '^6.0.0',
|
98
97
|
classnames: '^2.3.1',
|
99
|
-
'@folklore/routes': '^0.
|
100
|
-
'@folklore/fonts': '^0.0.
|
101
|
-
'@folklore/forms': '^0.0.
|
98
|
+
'@folklore/routes': '^0.2.31',
|
99
|
+
'@folklore/fonts': '^0.0.13',
|
100
|
+
'@folklore/forms': '^0.0.22',
|
102
101
|
'@folklore/fetch': '^0.1.15',
|
103
|
-
'@folklore/hooks': '^0.0.
|
104
|
-
'@folklore/tracking': '^0.0.
|
102
|
+
'@folklore/hooks': '^0.0.42',
|
103
|
+
'@folklore/tracking': '^0.0.16',
|
105
104
|
// Polyfills
|
106
105
|
intl: '^1.2.5',
|
107
106
|
'@formatjs/intl-locale': '^3.0.5',
|
@@ -2,7 +2,7 @@ import { RoutesProvider } from '@folklore/routes';
|
|
2
2
|
import PropTypes from 'prop-types';
|
3
3
|
import React from 'react';
|
4
4
|
import { IntlProvider } from 'react-intl';
|
5
|
-
import {
|
5
|
+
import { Router } from 'wouter';
|
6
6
|
|
7
7
|
// import * as AppPropTypes from '../lib/PropTypes';
|
8
8
|
import Routes from './Routes';
|
@@ -20,18 +20,20 @@ const propTypes = {
|
|
20
20
|
|
21
21
|
const defaultProps = {
|
22
22
|
intl: null,
|
23
|
-
routes: {
|
23
|
+
routes: {
|
24
|
+
home: '/'
|
25
|
+
},
|
24
26
|
};
|
25
27
|
|
26
28
|
function App({ intl, routes }) {
|
27
29
|
const { locale = 'fr', messages = {} } = intl || {};
|
28
30
|
return (
|
29
31
|
<IntlProvider locale={locale} messages={messages[locale] || messages}>
|
30
|
-
<
|
32
|
+
<Router>
|
31
33
|
<RoutesProvider routes={routes}>
|
32
34
|
<Routes />
|
33
35
|
</RoutesProvider>
|
34
|
-
</
|
36
|
+
</Router>
|
35
37
|
</IntlProvider>
|
36
38
|
);
|
37
39
|
}
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import React from 'react';
|
2
2
|
// import PropTypes from 'prop-types';
|
3
|
-
import { Route,
|
3
|
+
import { Route, Switch } from 'wouter';
|
4
4
|
import { useRoutes } from '@folklore/routes';
|
5
5
|
|
6
6
|
// import { useUrlGenerator } from '@folklore/routes';
|
@@ -18,25 +18,18 @@ const defaultProps = {};
|
|
18
18
|
function Routes() {
|
19
19
|
const routes = useRoutes() || {};
|
20
20
|
return (
|
21
|
-
<
|
22
|
-
<Route
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
element={
|
34
|
-
<MainLayout>
|
35
|
-
<ErrorPage />
|
36
|
-
</MainLayout>
|
37
|
-
}
|
38
|
-
/>
|
39
|
-
</Routes>
|
21
|
+
<Switch>
|
22
|
+
<Route path={routes.home || '/'}>
|
23
|
+
<MainLayout>
|
24
|
+
<HomePage />
|
25
|
+
</MainLayout>
|
26
|
+
</Route>
|
27
|
+
<Route>
|
28
|
+
<MainLayout>
|
29
|
+
<ErrorPage />
|
30
|
+
</MainLayout>
|
31
|
+
</Route>
|
32
|
+
</Switch>
|
40
33
|
);
|
41
34
|
}
|
42
35
|
|
@@ -2,7 +2,7 @@
|
|
2
2
|
import React from 'react';
|
3
3
|
import PropTypes from 'prop-types';
|
4
4
|
import classNames from 'classnames';
|
5
|
-
import { Link } from '
|
5
|
+
import { Link } from 'wouter';
|
6
6
|
|
7
7
|
import * as AppPropTypes from '../../lib/PropTypes';
|
8
8
|
|
@@ -140,7 +140,7 @@ function Button({
|
|
140
140
|
{content}
|
141
141
|
</a>
|
142
142
|
) : (
|
143
|
-
<Link
|
143
|
+
<Link href={href} className={buttonClassNames} onClick={onClick}>
|
144
144
|
{content}
|
145
145
|
</Link>
|
146
146
|
);
|
@@ -2,7 +2,7 @@
|
|
2
2
|
import React from 'react';
|
3
3
|
import PropTypes from 'prop-types';
|
4
4
|
import classNames from 'classnames';
|
5
|
-
import { Link } from '
|
5
|
+
import { Link } from 'wouter';
|
6
6
|
|
7
7
|
import * as AppPropTypes from '../../lib/PropTypes';
|
8
8
|
|
@@ -44,7 +44,7 @@ function Menu({ items, className }) {
|
|
44
44
|
{label}
|
45
45
|
</a>
|
46
46
|
) : (
|
47
|
-
<Link
|
47
|
+
<Link href={url} className={styles.link}>
|
48
48
|
{label}
|
49
49
|
</Link>
|
50
50
|
)}
|
@@ -1,7 +1,7 @@
|
|
1
1
|
/* eslint-disable react/jsx-props-no-spreading */
|
2
2
|
import React from 'react';
|
3
3
|
import PropTypes from 'prop-types';
|
4
|
-
import { Link } from '
|
4
|
+
import { Link } from 'wouter';
|
5
5
|
import { defineMessages, FormattedMessage } from 'react-intl';
|
6
6
|
import { useUrlGenerator } from '@folklore/routes';
|
7
7
|
|
@@ -90,7 +90,7 @@ function ErrorPage({ statusCode }) {
|
|
90
90
|
<FormattedMessage {...messages[`description${statusCode || 404}`]} />
|
91
91
|
</p>
|
92
92
|
<div className={styles.actions}>
|
93
|
-
<Link
|
93
|
+
<Link href={url('home')}>
|
94
94
|
<FormattedMessage {...messages.gotoHome} />
|
95
95
|
</Link>
|
96
96
|
</div>
|
@@ -31,10 +31,10 @@ module.exports = class StylelintGenerator extends _generator.default {
|
|
31
31
|
},
|
32
32
|
dependencies() {
|
33
33
|
this.addDevDependencies({
|
34
|
-
stylelint: '^
|
35
|
-
'stylelint-config-standard-scss': '^
|
36
|
-
'stylelint-config-idiomatic-order': '^
|
37
|
-
'stylelint-config-standard': '^
|
34
|
+
stylelint: '^16.2.1',
|
35
|
+
'stylelint-config-standard-scss': '^13.0.0',
|
36
|
+
'stylelint-config-idiomatic-order': '^10.0.0',
|
37
|
+
'stylelint-config-standard': '^36.0.0'
|
38
38
|
});
|
39
39
|
}
|
40
40
|
};
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "generator-folklore",
|
3
|
-
"version": "3.0.
|
3
|
+
"version": "3.0.21",
|
4
4
|
"description": "Yeoman generator for projects at Folklore",
|
5
5
|
"keywords": [
|
6
6
|
"yeoman-generator"
|
@@ -40,5 +40,5 @@
|
|
40
40
|
"yeoman-generator": "^5.7.0",
|
41
41
|
"yeoman-remote": "^1.0.1"
|
42
42
|
},
|
43
|
-
"gitHead": "
|
43
|
+
"gitHead": "e187175793ce4d11d128d39929b4779c534081bd"
|
44
44
|
}
|