generator-folklore 3.0.27 → 3.0.29

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.
Files changed (37) hide show
  1. package/lib/generators/build/index.js +12 -0
  2. package/lib/generators/build/templates/.jsconfig.json +9 -0
  3. package/lib/generators/build/templates/.tsconfig.json +7 -0
  4. package/lib/generators/laravel/templates/_composer.json +2 -1
  5. package/lib/generators/laravel/templates/laravel/config/app.php +5 -4
  6. package/lib/generators/laravel/templates/laravel/routes/api.php +3 -0
  7. package/lib/generators/laravel/templates/laravel/routes/console.php +5 -2
  8. package/lib/generators/laravel-panneau/templates/app/Models/Block.php +1 -1
  9. package/lib/generators/laravel-panneau/templates/app/Models/Page.php +1 -1
  10. package/lib/generators/laravel-panneau/templates/index.js +1 -1
  11. package/lib/generators/laravel-panneau/templates/resources/assets/js/components/Panneau.jsx +2 -4
  12. package/lib/generators/laravel-project/index.js +1 -1
  13. package/lib/generators/laravel-project/templates/laravel/app/Models/User.php +1 -1
  14. package/lib/generators/laravel-project/templates/laravel/config/app.php +2 -2
  15. package/lib/generators/laravel-project/templates/laravel/routes/api.php +3 -0
  16. package/lib/generators/micromag-project/templates/Routes.jsx +1 -9
  17. package/lib/generators/react-app/index.js +16 -6
  18. package/lib/generators/react-app/templates/_package.json +4 -0
  19. package/lib/generators/react-app/templates/src/components/{App.jsx → App.tsx} +8 -16
  20. package/lib/generators/react-app/templates/src/components/{Routes.jsx → Routes.tsx} +0 -8
  21. package/lib/generators/react-app/templates/src/components/buttons/{Button.jsx → Button.tsx} +29 -27
  22. package/lib/generators/react-app/templates/src/components/layouts/{Main.jsx → Main.tsx} +1 -10
  23. package/lib/generators/react-app/templates/src/components/menus/{Menu.jsx → Menu.tsx} +13 -9
  24. package/lib/generators/react-app/templates/src/components/pages/{Error.jsx → Error.tsx} +1 -10
  25. package/lib/generators/react-app/templates/src/components/pages/{Home.jsx → Home.tsx} +0 -9
  26. package/lib/generators/react-app/templates/src/components/partials/PageMeta.tsx +16 -0
  27. package/lib/generators/react-app/templates/src/contexts/KeysContext.tsx +14 -0
  28. package/lib/generators/react-app/templates/types/base.d.ts +79 -0
  29. package/lib/generators/react-app/templates/types/blocks.d.ts +41 -0
  30. package/lib/generators/react-app/templates/types/forms.d.ts +55 -0
  31. package/lib/generators/react-app/templates/types/global.d.ts +28 -0
  32. package/lib/generators/react-app/templates/types/metadata.d.ts +36 -0
  33. package/lib/generators/react-package/index.js +1 -1
  34. package/package.json +2 -2
  35. package/lib/generators/react-app/templates/src/components/partials/PageMeta.jsx +0 -31
  36. package/lib/generators/react-app/templates/src/contexts/KeysContext.jsx +0 -37
  37. package/lib/generators/react-app/templates/src/lib/PropTypes.js +0 -66
@@ -83,6 +83,18 @@ module.exports = class AppGenerator extends _generator.default {
83
83
  this.addDevDependencies({
84
84
  '@folklore/cli': '^0.1.28'
85
85
  });
86
+ this.addDevDependencies({
87
+ '@tsconfig/create-react-app': '^2.0.7'
88
+ });
89
+ },
90
+ templates() {
91
+ // const srcPathJs = this.templatePath('.jsconfig.json');
92
+ // const destPathJs = this.destinationPath('jsconfig.json');
93
+ // this.fs.copy(srcPathJs, destPathJs);
94
+
95
+ const srcPathTs = this.templatePath('.tsconfig.json');
96
+ const destPathTs = this.destinationPath('tsconfig.json');
97
+ this.fs.copy(srcPathTs, destPathTs);
86
98
  }
87
99
  };
88
100
  }
@@ -0,0 +1,9 @@
1
+ {
2
+ "compilerOptions": {
3
+ "jsx": "react-jsx",
4
+ "module": "esnext",
5
+ "moduleResolution": "Bundler",
6
+ "target": "ES5"
7
+ },
8
+ "include": ["src/**/*"]
9
+ }
@@ -0,0 +1,7 @@
1
+ {
2
+ "extends": "@tsconfig/create-react-app/tsconfig.json",
3
+ "compilerOptions": {
4
+ "strict": false
5
+ },
6
+ "include": []
7
+ }
@@ -3,6 +3,7 @@
3
3
  "folklore/image": "v1.x-dev",
4
4
  "folklore/laravel-locale": "^3.0",
5
5
  "barryvdh/laravel-debugbar": "^3.2",
6
- "hackzilla/password-generator": "^1.4"
6
+ "hackzilla/password-generator": "^1.4",
7
+ "laravel/sanctum": "^4.2"
7
8
  }
8
9
  }
@@ -189,12 +189,13 @@ return [
189
189
  * Application Service Providers...
190
190
  */
191
191
  App\Providers\AppServiceProvider::class,
192
- App\Providers\AuthServiceProvider::class,
192
+ // App\Providers\AuthServiceProvider::class,
193
193
  // App\Providers\BroadcastServiceProvider::class,
194
- App\Providers\EventServiceProvider::class,<% if (options.panneau) { %>
195
- App\Providers\PanneauServiceProvider::class,<% } %>
194
+ // App\Providers\EventServiceProvider::class,
196
195
  App\Providers\RouteServiceProvider::class,
197
- App\Providers\ViewServiceProvider::class,
196
+ App\Providers\ViewServiceProvider::class,<% if (options.panneau) { %>
197
+ App\Providers\FortifyServiceProvider::class,
198
+ App\Panneau\PanneauServiceProvider::class,<% } %>
198
199
  ],
199
200
 
200
201
  /*
@@ -0,0 +1,3 @@
1
+ <?php
2
+
3
+ use Illuminate\Support\Facades\Route;
@@ -1,8 +1,11 @@
1
1
  <?php
2
2
 
3
3
  use Illuminate\Foundation\Inspiring;
4
+ use Illuminate\Support\Facades\Schedule;
4
5
 
5
- //Db Install
6
+ $isProduction = app()->environment('production');
7
+
8
+ // DB Install
6
9
  Artisan::command('db:install {--force}', function () {
7
10
  $args = [];
8
11
  if ($this->option('force')) {
@@ -12,7 +15,7 @@ Artisan::command('db:install {--force}', function () {
12
15
  Artisan::call('db:seed', $args);
13
16
  })->describe('Install database');
14
17
 
15
- //DB reset
18
+ // DB reset
16
19
  Artisan::command('db:reset {--force}', function () {
17
20
  $args = [];
18
21
  if ($this->option('force')) {
@@ -16,7 +16,7 @@ class Block extends BaseBlock
16
16
  'image' => \App\Entities\Blocks\ImageBlock::class,
17
17
  ];
18
18
 
19
- public function toResource(): BlockContract
19
+ public function toEntity(): BlockContract
20
20
  {
21
21
  return $this->toTypedEntity() ?? new BlockResource($this);
22
22
  }
@@ -15,7 +15,7 @@ class Page extends BasePage
15
15
  'home' => \App\Resources\Pages\HomePage::class,
16
16
  ];
17
17
 
18
- public function toResource(): PageContract
18
+ public function toEntity(): PageContract
19
19
  {
20
20
  return $this->toTypedEntity() ?? new PageResource($this);
21
21
  }
@@ -18,7 +18,7 @@ function renderApp(Container, props) {
18
18
  function loadContainer({ isPanneau = false }) {
19
19
  return isPanneau
20
20
  ? import('./components/Panneau').then(({ default: Container }) => Container)
21
- : import('./components/Container').then(({ default: Container }) => Container);
21
+ : import('./components/App').then(({ default: Container }) => Container);
22
22
  }
23
23
 
24
24
  const props = getAppProps();
@@ -4,8 +4,6 @@ import { FIELDS_NAMESPACE } from '@panneau/core/contexts';
4
4
  import PropTypes from 'prop-types';
5
5
  import React, { useState, useEffect } from 'react';
6
6
 
7
- import * as AppPropTypes from '../lib/PropTypes';
8
-
9
7
  import * as fieldsComponents from './panneau/fields';
10
8
 
11
9
  import '../../styles/panneau.scss';
@@ -14,8 +12,8 @@ const propTypes = {
14
12
  definition: PropTypes.object.isRequired, // eslint-disable-line react/forbid-prop-types
15
13
  baseUrl: PropTypes.string.isRequired,
16
14
  uploadEndpoint: PropTypes.string,
17
- user: AppPropTypes.user,
18
- statusCode: AppPropTypes.statusCode,
15
+ user: PropTypes.object,
16
+ statusCode: PropTypes.string,
19
17
  };
20
18
 
21
19
  const defaultProps = {
@@ -33,7 +33,7 @@ module.exports = class LaravelProjectGenerator extends _generator.default {
33
33
  this.option('laravel-version', {
34
34
  type: String,
35
35
  desc: 'Laravel version',
36
- defaults: '10'
36
+ defaults: '12'
37
37
  });
38
38
  this.option('laravel-branch', {
39
39
  type: String,
@@ -13,7 +13,7 @@ class User extends BaseUser
13
13
  {
14
14
  use HasApiTokens, HasFactory;
15
15
 
16
- public function toResource(): UserContract
16
+ public function toEntity(): UserContract
17
17
  {
18
18
  return new UserResource($this);
19
19
  }
@@ -191,9 +191,9 @@ return [
191
191
  * Application Service Providers...
192
192
  */
193
193
  App\Providers\AppServiceProvider::class,
194
- App\Providers\AuthServiceProvider::class,
194
+ // App\Providers\AuthServiceProvider::class,
195
195
  // App\Providers\BroadcastServiceProvider::class,
196
- App\Providers\EventServiceProvider::class,
196
+ // App\Providers\EventServiceProvider::class,
197
197
  App\Providers\RouteServiceProvider::class,
198
198
  App\Providers\ViewServiceProvider::class,<% if (options.panneau) { %>
199
199
  App\Providers\FortifyServiceProvider::class,
@@ -0,0 +1,3 @@
1
+ <?php
2
+
3
+ use Illuminate\Support\Facades\Route;
@@ -4,17 +4,12 @@ import { Route, Switch } from 'wouter';
4
4
  import { useRoutes } from '@folklore/routes';
5
5
 
6
6
  // import { useUrlGenerator } from '@folklore/routes';
7
- // import * as AppPropTypes from '../lib/PropTypes';
8
7
  import MainLayout from './layouts/Main';
9
- import ErrorPage from './pages/Error';
8
+ // import ErrorPage from './pages/Error';
10
9
  import HomePage from './pages/Home';
11
10
 
12
11
  import '<%= getRelativeStylesPath('components/App.jsx', 'styles.css') %>';
13
12
 
14
- const propTypes = {};
15
-
16
- const defaultProps = {};
17
-
18
13
  function Routes() {
19
14
  const routes = useRoutes() || {};
20
15
  return (
@@ -28,7 +23,4 @@ function Routes() {
28
23
  );
29
24
  }
30
25
 
31
- Routes.propTypes = propTypes;
32
- Routes.defaultProps = defaultProps;
33
-
34
26
  export default Routes;
@@ -25,6 +25,9 @@ module.exports = class ReactAppGenerator extends _generator.default {
25
25
  this.option('styles-path', {
26
26
  type: String
27
27
  });
28
+ this.option('types-path', {
29
+ type: String
30
+ });
28
31
  }
29
32
  initializing() {
30
33
  this.react_features = [];
@@ -78,6 +81,13 @@ module.exports = class ReactAppGenerator extends _generator.default {
78
81
  const destPath = this.destinationPath(stylesPath);
79
82
  this.fs.copyTpl(srcPath, destPath, templateData);
80
83
  },
84
+ types() {
85
+ const typesPath = this.options['types-path'] || _path.default.join(this.options.path, 'types');
86
+ console.log('yo', typesPath, this.templatePath('types'));
87
+ const srcPath = this.templatePath('types');
88
+ const destPath = this.destinationPath(typesPath);
89
+ this.fs.copy(srcPath, destPath);
90
+ },
81
91
  packageJSON() {
82
92
  const srcPath = this.templatePath('_package.json');
83
93
  const destPath = this.destinationPath('package.json');
@@ -88,17 +98,17 @@ module.exports = class ReactAppGenerator extends _generator.default {
88
98
  },
89
99
  dependencies() {
90
100
  this.addDependencies({
91
- react: '^19.1.1',
92
- 'react-dom': '^19.1.1',
101
+ react: '^18.3.1',
102
+ 'react-dom': '^18.3.1',
93
103
  'react-intl': '^7.1.1',
94
104
  wouter: '^3.7.1',
95
105
  'react-helmet': '^6.1.0',
96
106
  classnames: '^2.5.1',
97
- '@folklore/routes': '^0.2.42',
98
- '@folklore/fonts': '^0.0.15',
99
- '@folklore/forms': '^0.0.28',
107
+ '@folklore/routes': '^0.2.43',
108
+ '@folklore/fonts': '^0.0.16',
109
+ '@folklore/forms': '^0.0.29',
100
110
  '@folklore/fetch': '^0.1.21',
101
- '@folklore/hooks': '^0.0.74',
111
+ '@folklore/hooks': '^0.0.75',
102
112
  '@folklore/tracking': '^0.0.33',
103
113
  // Polyfills
104
114
  intl: '^1.2.5',
@@ -14,6 +14,10 @@
14
14
  {
15
15
  "name": "Nicolas Roy-Bourdages",
16
16
  "email": "nrb@folklore.email"
17
+ },
18
+ {
19
+ "name": "Samuel Poisson",
20
+ "email": "samuel@urbania.ca"
17
21
  }
18
22
  ]
19
23
  }
@@ -1,24 +1,18 @@
1
1
  import { RoutesProvider } from '@folklore/routes';
2
- import PropTypes from 'prop-types';
3
- import React from 'react';
4
2
  import { IntlProvider } from 'react-intl';
5
3
  import { Router } from 'wouter';
6
4
 
7
- // import * as AppPropTypes from '../lib/PropTypes';
8
5
  import Routes from './Routes';
9
6
 
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
- };
7
+ interface AppProps {
8
+ intl?: {
9
+ locale?: string;
10
+ messages?: Record<string, Record<string, string>> | Record<string, string>;
11
+ } | null;
12
+ routes?: Record<string, string>;
13
+ }
20
14
 
21
- function App({ intl = null, routes = { home: '/' } }) {
15
+ function App({ intl = null, routes = { home: '/' } }: AppProps) {
22
16
  const { locale = 'fr', messages = {} } = intl || {};
23
17
  return (
24
18
  <IntlProvider locale={locale} messages={messages[locale] || messages}>
@@ -31,6 +25,4 @@ function App({ intl = null, routes = { home: '/' } }) {
31
25
  );
32
26
  }
33
27
 
34
- App.propTypes = propTypes;
35
-
36
28
  export default App;
@@ -1,18 +1,12 @@
1
- import React from 'react';
2
- // import PropTypes from 'prop-types';
3
1
  import { Route, Switch } from 'wouter';
4
2
  import { useRoutes } from '@folklore/routes';
5
3
 
6
- // import { useUrlGenerator } from '@folklore/routes';
7
- // import * as AppPropTypes from '../lib/PropTypes';
8
4
  import MainLayout from './layouts/Main';
9
5
  import ErrorPage from './pages/Error';
10
6
  import HomePage from './pages/Home';
11
7
 
12
8
  import '<%= getRelativeStylesPath('components/App.jsx', 'styles.css') %>';
13
9
 
14
- const propTypes = {};
15
-
16
10
  function Routes() {
17
11
  const routes = useRoutes() || {};
18
12
  return (
@@ -31,6 +25,4 @@ function Routes() {
31
25
  );
32
26
  }
33
27
 
34
- Routes.propTypes = propTypes;
35
-
36
28
  export default Routes;
@@ -1,32 +1,36 @@
1
1
  /* eslint-disable react/button-has-type */
2
- import React from 'react';
3
- import PropTypes from 'prop-types';
2
+ import { ReactNode, MouseEvent } from 'react';
4
3
  import classNames from 'classnames';
5
4
  import { Link } from 'wouter';
6
5
 
7
- import * as AppPropTypes from '../../lib/PropTypes';
8
-
9
6
  import styles from '<%= getRelativeStylesPath('components/buttons/Button.jsx', 'buttons/button.module.css') %>';
10
7
 
11
- const propTypes = {
12
- text: PropTypes.string,
13
- type: PropTypes.string,
14
- href: PropTypes.string,
15
- external: PropTypes.bool,
16
- direct: PropTypes.bool,
17
- target: PropTypes.string,
18
- label: AppPropTypes.label,
19
- children: AppPropTypes.label,
20
- icon: PropTypes.node,
21
- iconPosition: PropTypes.oneOf(['left', 'right', 'inline']),
22
- disabled: PropTypes.bool,
23
- loading: PropTypes.bool,
24
- disableOnLoading: PropTypes.bool,
25
- className: PropTypes.string,
26
- iconClassName: PropTypes.string,
27
- labelClassName: PropTypes.string,
28
- onClick: PropTypes.func,
29
- };
8
+ interface Message {
9
+ id: string;
10
+ defaultMessage?: string;
11
+ }
12
+
13
+ type Label = Message | ReactNode;
14
+
15
+ interface ButtonProps {
16
+ text?: string | null;
17
+ type?: 'button' | 'submit' | 'reset';
18
+ href?: string | null;
19
+ external?: boolean;
20
+ direct?: boolean;
21
+ target?: string;
22
+ label?: Label | null;
23
+ children?: Label | null;
24
+ icon?: ReactNode | null;
25
+ iconPosition?: 'left' | 'right' | 'inline';
26
+ disabled?: boolean;
27
+ loading?: boolean;
28
+ disableOnLoading?: boolean;
29
+ className?: string | null;
30
+ iconClassName?: string | null;
31
+ labelClassName?: string | null;
32
+ onClick?: ((e: MouseEvent<HTMLButtonElement | HTMLAnchorElement>) => void) | null;
33
+ }
30
34
 
31
35
  function Button({
32
36
  text = null,
@@ -46,7 +50,7 @@ function Button({
46
50
  iconClassName = null,
47
51
  labelClassName = null,
48
52
  onClick = null,
49
- }) {
53
+ }: ButtonProps) {
50
54
  const finalLabel = label || children;
51
55
  const hasChildren = label !== null && children !== null;
52
56
  const hasIcon = icon !== null;
@@ -135,8 +139,6 @@ function Button({
135
139
  {content}
136
140
  </button>
137
141
  );
138
- };
139
-
140
- Button.propTypes = propTypes;
142
+ }
141
143
 
142
144
  export default Button;
@@ -1,13 +1,6 @@
1
- import React from 'react';
2
- import PropTypes from 'prop-types';
3
-
4
1
  import styles from '<%= getRelativeStylesPath('components/layouts/Main.jsx', 'layouts/main.module.css') %>';
5
2
 
6
- const propTypes = {
7
- children: PropTypes.node.isRequired,
8
- };
9
-
10
- function MainLayout({ children = null }) {
3
+ function MainLayout({ children = null }: { children: React.ReactNode }) {
11
4
  return (
12
5
  <div className={styles.container}>
13
6
  <div className={styles.inner}>
@@ -17,6 +10,4 @@ function MainLayout({ children = null }) {
17
10
  );
18
11
  };
19
12
 
20
- MainLayout.propTypes = propTypes;
21
-
22
13
  export default MainLayout;
@@ -1,19 +1,23 @@
1
1
  /* eslint-disable react/no-array-index-key */
2
- import React from 'react';
3
- import PropTypes from 'prop-types';
4
2
  import classNames from 'classnames';
5
3
  import { Link } from 'wouter';
6
4
 
7
- import * as AppPropTypes from '../../lib/PropTypes';
8
-
9
5
  import styles from '<%= getRelativeStylesPath('components/menus/Menu.jsx', 'menus/menu.module.css') %>';
10
6
 
11
- const propTypes = {
12
- items: AppPropTypes.menuItems,
13
- className: PropTypes.string,
14
- };
7
+ interface MenuItem {
8
+ label: string;
9
+ url: string;
10
+ active?: boolean;
11
+ external?: boolean;
12
+ target?: string;
13
+ }
14
+
15
+ interface MenuProps {
16
+ items?: MenuItem[];
17
+ className?: string | null;
18
+ }
15
19
 
16
- function Menu({ items = [], className = null }) {
20
+ function Menu({ items = [], className = null }: MenuProps) {
17
21
  return (
18
22
  <nav
19
23
  className={classNames([
@@ -1,11 +1,8 @@
1
1
  /* eslint-disable react/jsx-props-no-spreading */
2
- import React from 'react';
3
- import PropTypes from 'prop-types';
4
2
  import { Link } from 'wouter';
5
3
  import { defineMessages, FormattedMessage } from 'react-intl';
6
4
  import { useUrlGenerator } from '@folklore/routes';
7
5
 
8
- // import * as AppPropTypes from '../../lib/PropTypes';
9
6
  import PageMeta from '../partials/PageMeta';
10
7
 
11
8
  import styles from '<%= getRelativeStylesPath('components/pages/Error.jsx', 'pages/error.module.css') %>';
@@ -69,11 +66,7 @@ export const messages = defineMessages({
69
66
  },
70
67
  });
71
68
 
72
- const propTypes = {
73
- statusCode: PropTypes.number,
74
- };
75
-
76
- function ErrorPage({ statusCode = 404 }) {
69
+ function ErrorPage({ statusCode = 404 }: { statusCode?: number }) {
77
70
  const url = useUrlGenerator();
78
71
  return (
79
72
  <div className={styles.container}>
@@ -95,6 +88,4 @@ function ErrorPage({ statusCode = 404 }) {
95
88
  );
96
89
  };
97
90
 
98
- ErrorPage.propTypes = propTypes;
99
-
100
91
  export default ErrorPage;
@@ -1,8 +1,5 @@
1
- import React from 'react';
2
- // import PropTypes from 'prop-types';
3
1
  import { defineMessages } from 'react-intl';
4
2
 
5
- // import * as AppPropTypes from '../../lib/PropTypes';
6
3
  import PageMeta from '../partials/PageMeta';
7
4
 
8
5
  import styles from '<%= getRelativeStylesPath('components/pages/Home.jsx', 'pages/home.module.css') %>';
@@ -14,10 +11,6 @@ const messages = defineMessages({
14
11
  },
15
12
  });
16
13
 
17
- const propTypes = {
18
- // intl: AppPropTypes.intl.isRequired,
19
- };
20
-
21
14
  function HomePage () {
22
15
  return (
23
16
  <div className={styles.container}>
@@ -27,6 +20,4 @@ function HomePage () {
27
20
  );
28
21
  }
29
22
 
30
- HomePage.propTypes = propTypes;
31
-
32
23
  export default HomePage;
@@ -0,0 +1,16 @@
1
+ /* eslint-disable react/no-array-index-key */
2
+ import { Helmet } from 'react-helmet';
3
+ import { useIntl } from 'react-intl';
4
+
5
+ import { isMessage } from '../../lib/utils';
6
+
7
+ function PageMeta({ title = null }: { title: string | object | null }) {
8
+ const intl = useIntl();
9
+ return (
10
+ <Helmet>
11
+ <title>{isMessage(title) ? intl.formatMessage(title) : title}</title>
12
+ </Helmet>
13
+ );
14
+ }
15
+
16
+ export default PageMeta;
@@ -0,0 +1,14 @@
1
+ /* globals GOOGLE_API_KEY: true */
2
+ import React, { useContext } from 'react';
3
+
4
+ const KeysContext = React.createContext({
5
+ googleApiKey: typeof GOOGLE_API_KEY !== 'undefined' ? GOOGLE_API_KEY : null,
6
+ });
7
+
8
+ export const useKeys = () => useContext(KeysContext);
9
+
10
+ export const KeysProvider = ({ children = null, keys = null }: { children: React.ReactNode, keys: object | null }) => (
11
+ <KeysContext.Provider value={keys}>{children}</KeysContext.Provider>
12
+ );
13
+
14
+ export default KeysContext;
@@ -0,0 +1,79 @@
1
+ interface IntlMessage {
2
+ id?: string;
3
+ defaultMessage?: string;
4
+ }
5
+
6
+ interface Labels {
7
+ [key: string]: string;
8
+ }
9
+
10
+ interface Theme {
11
+ name: string;
12
+ }
13
+
14
+ interface ImageSize {
15
+ id: string;
16
+ url: string;
17
+ width: number;
18
+ height: number;
19
+ }
20
+
21
+ interface Source {
22
+ id: string;
23
+ mime?: string | null;
24
+ url: string;
25
+ size?: number | null;
26
+ }
27
+
28
+ interface Embed {
29
+ provider: string;
30
+ iframeUrl?: string;
31
+ html?: string;
32
+ }
33
+
34
+ interface Media {
35
+ id: string;
36
+ type: string;
37
+ url: string;
38
+ name?: string | null;
39
+ description?: string | null;
40
+ files?: Record<string, Source>;
41
+ }
42
+
43
+ interface Image extends Media, ImageSize {
44
+ type: 'image';
45
+ sizes: ImageSize[];
46
+ credits?: string;
47
+ }
48
+
49
+ interface Audio extends Media {
50
+ type: 'audio';
51
+ }
52
+
53
+ interface Video extends Media {
54
+ type: 'video';
55
+ embed?: Embed;
56
+ sources?: Source[];
57
+ }
58
+
59
+ interface MenuItem {
60
+ id: string;
61
+ href: string;
62
+ external?: boolean;
63
+ label?: string | ReactNode;
64
+ icon?: ReactNode;
65
+ }
66
+
67
+ interface Page {
68
+ id: string;
69
+ title?: string | null;
70
+ slug?: string | null;
71
+ path?: string | null;
72
+ description?: string | null;
73
+ image?: Image | null;
74
+ }
75
+
76
+ interface User {
77
+ id: string;
78
+ }
79
+
@@ -0,0 +1,41 @@
1
+ export interface BaseBlock {
2
+ id: string;
3
+ uuid?: string;
4
+ type: string;
5
+ placement?: string;
6
+ }
7
+
8
+ export interface TextBlock extends BaseBlock {
9
+ type: 'text';
10
+ }
11
+
12
+ export interface ImageBlock extends BaseBlock {
13
+ type: 'image';
14
+ media: {
15
+ url: string;
16
+ width?: number;
17
+ height?: number;
18
+ };
19
+ caption?: string;
20
+ }
21
+
22
+ export interface HeadingBlock extends BaseBlock {
23
+ type: 'heading';
24
+ }
25
+
26
+ export interface CardsBlock extends BaseBlock {
27
+ type: 'cards';
28
+ cards: Card[];
29
+ }
30
+
31
+ export type Block = TextBlock | ImageBlock | HeadingBlock | CardsBlock | BaseBlock;
32
+
33
+ export interface BaseCard {
34
+ id: string;
35
+ type: string;
36
+ title?: string | null;
37
+ description?: string | null;
38
+ image?: Image | null;
39
+ }
40
+
41
+ export type Card = BaseCard;
@@ -0,0 +1,55 @@
1
+ interface BaseField {
2
+ name: string;
3
+ type: string;
4
+ component?: string;
5
+ label?: string;
6
+ description?: string;
7
+ image?: Image | null;
8
+ }
9
+
10
+ interface FieldOption {
11
+ value: string;
12
+ label: string;
13
+ }
14
+
15
+ interface OptionsField extends BaseField {
16
+ type: 'options';
17
+ options: FieldOption[];
18
+ multiple?: boolean;
19
+ }
20
+
21
+ interface ButtonsField extends OptionsField {
22
+ type: 'buttons';
23
+ }
24
+
25
+ interface SelectField extends OptionsField {
26
+ type: 'select';
27
+ }
28
+
29
+ interface TextField extends BaseField {
30
+ type: 'text';
31
+ }
32
+
33
+ type FormBaseField = OptionsField | TextField | BaseField;
34
+
35
+ interface GroupField extends BaseField {
36
+ type: 'group';
37
+ fields: FormBaseField[];
38
+ }
39
+
40
+ type FormField = FormBaseField | GroupField;
41
+
42
+ interface Form {
43
+ id: string;
44
+ title?: string;
45
+ fields: FormField[];
46
+ }
47
+
48
+ interface FormErrors {
49
+ [fieldName: string]: string[] | null;
50
+ }
51
+
52
+ interface FormSnippet {
53
+ id: string;
54
+ title?: string;
55
+ }
@@ -0,0 +1,28 @@
1
+ /* eslint-disable @typescript-eslint/no-explicit-any */
2
+ declare module '*.scss' {
3
+ const value: any;
4
+ export default value;
5
+ }
6
+ declare module '*.css' {
7
+ const value: any;
8
+ export default value;
9
+ }
10
+ declare module '*.png' {
11
+ const value: any;
12
+ export default value;
13
+ }
14
+ declare module '*.svg' {
15
+ const value: any;
16
+ export default value;
17
+ export const ReactComponent: any;
18
+ }
19
+
20
+ declare module '*.md' {
21
+ const value: string;
22
+ export default value;
23
+ }
24
+
25
+ interface Window {
26
+ cioanalytics: any;
27
+ cioanalyticsReady?: () => void;
28
+ }
@@ -0,0 +1,36 @@
1
+ interface Microformat {
2
+ '@context': string;
3
+ '@type': string;
4
+ identifier: string;
5
+ [key: string]: unknown;
6
+ }
7
+
8
+ interface Taxonomy {
9
+ id: string;
10
+ type: string;
11
+ label: string;
12
+ slug: string;
13
+ }
14
+
15
+ interface Category extends Taxonomy {
16
+ type: 'category';
17
+ }
18
+
19
+ interface Author {
20
+ id: string;
21
+ slug: string;
22
+ name: string;
23
+ image?: Image | null;
24
+ isPerson?: boolean;
25
+ }
26
+
27
+ interface Credit {
28
+ author?: Author | null;
29
+ name?: string | null;
30
+ role?: string;
31
+ }
32
+
33
+ interface Organisation {
34
+ id: string;
35
+ name: string;
36
+ }
@@ -155,7 +155,7 @@ module.exports = class ReactPackageGenerator extends _generator.default {
155
155
  if (this.options['skip-install']) {
156
156
  return;
157
157
  }
158
- this.addDependencies(['react@latest', 'prop-types@latest', 'react-dom@latest']);
158
+ this.addDependencies(['react@18.3.1', 'prop-types@latest', 'react-dom@18.3.1']);
159
159
  },
160
160
  npmInstallDev() {
161
161
  if (this.options['skip-install']) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "generator-folklore",
3
- "version": "3.0.27",
3
+ "version": "3.0.29",
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.9.0",
41
41
  "yeoman-remote": "^1.0.1"
42
42
  },
43
- "gitHead": "2056c43ca08a0a3eafdd4542887c6923871e100b"
43
+ "gitHead": "d700a0347ce006f62fa5e83f79435a1d283e80d3"
44
44
  }
@@ -1,31 +0,0 @@
1
- /* eslint-disable react/no-array-index-key */
2
- import React from 'react';
3
- import { Helmet } from 'react-helmet';
4
- import { defineMessages, useIntl } from 'react-intl';
5
-
6
- import * as AppPropTypes from '../../lib/PropTypes';
7
- import { isMessage } from '../../lib/utils';
8
-
9
- const messages = defineMessages({
10
- title: {
11
- defaultMessage: 'Title',
12
- description: 'Page title',
13
- },
14
- });
15
-
16
- const propTypes = {
17
- title: AppPropTypes.message,
18
- };
19
-
20
- function PageMeta({ title = null }) {
21
- const intl = useIntl();
22
- return (
23
- <Helmet>
24
- <title>{isMessage(title) ? intl.formatMessage(title) : title}</title>
25
- </Helmet>
26
- );
27
- }
28
-
29
- PageMeta.propTypes = propTypes;
30
-
31
- export default PageMeta;
@@ -1,37 +0,0 @@
1
- /* globals GOOGLE_API_KEY: true */
2
-
3
- /* eslint-disable react/jsx-props-no-spreading */
4
- import PropTypes from 'prop-types';
5
- import React, { useContext } from 'react';
6
-
7
- const KeysContext = React.createContext({
8
- googleApiKey: typeof GOOGLE_API_KEY !== 'undefined' ? GOOGLE_API_KEY : null,
9
- });
10
-
11
- export const useKeys = () => useContext(KeysContext);
12
-
13
- export const withKeys = (WrappedComponent) => {
14
- const getDisplayName = ({ displayName = null, name = null }) =>
15
- displayName || name || 'Component';
16
-
17
- const WithKeysComponent = (props) => (
18
- <KeysContext.Consumer>
19
- {(keys) => <WrappedComponent {...keys} {...props} />}
20
- </KeysContext.Consumer>
21
- );
22
- WithKeysComponent.displayName = `WithKeys(${getDisplayName(WrappedComponent)})`;
23
- return WithKeysComponent;
24
- };
25
-
26
- const propTypes = {
27
- children: PropTypes.node.isRequired,
28
- keys: PropTypes.objectOf(PropTypes.string),
29
- };
30
-
31
- export const KeysProvider = ({ children = null, keys = null }) => (
32
- <KeysContext.Provider value={keys}>{children}</KeysContext.Provider>
33
- );
34
-
35
- KeysProvider.propTypes = propTypes;
36
-
37
- export default KeysContext;
@@ -1,66 +0,0 @@
1
- import PropTypes from 'prop-types';
2
-
3
- /**
4
- * Core
5
- */
6
- export const urlGenerator = PropTypes.shape({
7
- route: PropTypes.func.isRequired,
8
- });
9
-
10
- export const history = PropTypes.shape({
11
- listen: PropTypes.func.isRequired,
12
- });
13
-
14
- export const intl = PropTypes.shape({
15
- locale: PropTypes.string.isRequired,
16
- formatMessage: PropTypes.func.isRequired,
17
- });
18
-
19
- export const message = PropTypes.shape({
20
- id: PropTypes.string.isRequired,
21
- defaultMessage: PropTypes.string,
22
- });
23
-
24
- export const text = PropTypes.oneOfType([message, PropTypes.string]);
25
-
26
- export const label = PropTypes.oneOfType([message, PropTypes.node]);
27
-
28
- export const statusCode = PropTypes.oneOf([401, 403, 404, 500]);
29
-
30
- /**
31
- * Site
32
- */
33
- export const user = PropTypes.shape({
34
- id: PropTypes.number,
35
- firstname: PropTypes.string,
36
- lastname: PropTypes.string,
37
- email: PropTypes.string,
38
- gender: PropTypes.string,
39
- birthdate: PropTypes.string,
40
- });
41
-
42
- export const menuItem = PropTypes.shape({
43
- label,
44
- url: PropTypes.string,
45
- external: PropTypes.bool,
46
- active: PropTypes.bool,
47
- });
48
- export const menuItems = PropTypes.arrayOf(menuItem);
49
-
50
- /**
51
- * Forms
52
- */
53
- export const errors = PropTypes.oneOfType([PropTypes.string, PropTypes.arrayOf(PropTypes.string)]);
54
- export const formErrors = PropTypes.objectOf(errors);
55
-
56
- export const selectOption = PropTypes.shape({
57
- value: PropTypes.string,
58
- label: PropTypes.string,
59
- });
60
- export const selectOptions = PropTypes.arrayOf(selectOption);
61
-
62
- export const formField = PropTypes.shape({
63
- value: PropTypes.any,
64
- name: PropTypes.string,
65
- });
66
- export const formFields = PropTypes.objectOf(formField);