@strapi/generators 5.0.0-beta.0 → 5.0.0-beta.1
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/dist/plopfile.d.ts.map +1 -1
- package/dist/plopfile.js +0 -86
- package/dist/plopfile.js.map +1 -1
- package/dist/plopfile.mjs +0 -85
- package/dist/plopfile.mjs.map +1 -1
- package/dist/templates/ts/middleware.ts.hbs +2 -2
- package/package.json +7 -7
- package/dist/files/js/plugin/.gitattributes +0 -103
- package/dist/files/js/plugin/admin/src/components/Initializer/index.js +0 -26
- package/dist/files/js/plugin/admin/src/components/PluginIcon/index.js +0 -12
- package/dist/files/js/plugin/admin/src/index.js +0 -61
- package/dist/files/js/plugin/admin/src/pages/App/index.js +0 -25
- package/dist/files/js/plugin/admin/src/pages/HomePage/index.js +0 -20
- package/dist/files/js/plugin/admin/src/pluginId.js +0 -5
- package/dist/files/js/plugin/admin/src/translations/en.json +0 -1
- package/dist/files/js/plugin/admin/src/translations/fr.json +0 -1
- package/dist/files/js/plugin/admin/src/utils/getTrad.js +0 -5
- package/dist/files/js/plugin/admin/src/utils/prefixPluginTranslations.js +0 -11
- package/dist/files/js/plugin/server/bootstrap.js +0 -5
- package/dist/files/js/plugin/server/config/index.js +0 -6
- package/dist/files/js/plugin/server/content-types/index.js +0 -3
- package/dist/files/js/plugin/server/controllers/index.js +0 -7
- package/dist/files/js/plugin/server/controllers/my-controller.js.hbs +0 -10
- package/dist/files/js/plugin/server/destroy.js +0 -5
- package/dist/files/js/plugin/server/index.js +0 -25
- package/dist/files/js/plugin/server/middlewares/index.js +0 -3
- package/dist/files/js/plugin/server/policies/index.js +0 -3
- package/dist/files/js/plugin/server/register.js +0 -5
- package/dist/files/js/plugin/server/routes/index.js +0 -10
- package/dist/files/js/plugin/server/services/index.js +0 -7
- package/dist/files/js/plugin/server/services/my-service.js +0 -7
- package/dist/files/js/plugin/strapi-admin.js +0 -3
- package/dist/files/js/plugin/strapi-server.js +0 -3
- package/dist/files/ts/plugin/.gitattributes +0 -103
- package/dist/files/ts/plugin/admin/src/components/Initializer/index.tsx +0 -24
- package/dist/files/ts/plugin/admin/src/components/PluginIcon/index.tsx +0 -12
- package/dist/files/ts/plugin/admin/src/index.tsx +0 -67
- package/dist/files/ts/plugin/admin/src/pages/App/index.tsx +0 -25
- package/dist/files/ts/plugin/admin/src/pages/HomePage/index.tsx +0 -19
- package/dist/files/ts/plugin/admin/src/pluginId.ts +0 -5
- package/dist/files/ts/plugin/admin/src/translations/en.json +0 -1
- package/dist/files/ts/plugin/admin/src/translations/fr.json +0 -1
- package/dist/files/ts/plugin/admin/src/utils/getTrad.ts +0 -5
- package/dist/files/ts/plugin/admin/src/utils/prefixPluginTranslations.ts +0 -13
- package/dist/files/ts/plugin/custom.d.ts +0 -5
- package/dist/files/ts/plugin/server/bootstrap.ts +0 -5
- package/dist/files/ts/plugin/server/config/index.ts +0 -4
- package/dist/files/ts/plugin/server/content-types/index.ts +0 -1
- package/dist/files/ts/plugin/server/controllers/index.ts +0 -5
- package/dist/files/ts/plugin/server/controllers/my-controller.ts.hbs +0 -10
- package/dist/files/ts/plugin/server/destroy.ts +0 -5
- package/dist/files/ts/plugin/server/index.ts +0 -23
- package/dist/files/ts/plugin/server/middlewares/index.ts +0 -1
- package/dist/files/ts/plugin/server/policies/index.ts +0 -1
- package/dist/files/ts/plugin/server/register.ts +0 -5
- package/dist/files/ts/plugin/server/routes/index.ts +0 -10
- package/dist/files/ts/plugin/server/services/index.ts +0 -5
- package/dist/files/ts/plugin/server/services/my-service.ts +0 -7
- package/dist/files/ts/plugin/strapi-admin.js +0 -3
- package/dist/files/ts/plugin/strapi-server.js +0 -3
- package/dist/files/ts/plugin/tsconfig.json +0 -20
- package/dist/files/ts/plugin/tsconfig.server.json +0 -25
- package/dist/plops/plugin.d.ts +0 -4
- package/dist/plops/plugin.d.ts.map +0 -1
- package/dist/templates/js/README.md.hbs +0 -3
- package/dist/templates/js/plugin-package.json.hbs +0 -42
- package/dist/templates/ts/README.md.hbs +0 -3
- package/dist/templates/ts/plugin-package.json.hbs +0 -49
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@strapi/generators",
|
|
3
|
-
"version": "5.0.0-beta.
|
|
3
|
+
"version": "5.0.0-beta.1",
|
|
4
4
|
"description": "Interactive API generator.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"strapi",
|
|
@@ -46,8 +46,8 @@
|
|
|
46
46
|
},
|
|
47
47
|
"dependencies": {
|
|
48
48
|
"@sindresorhus/slugify": "1.1.0",
|
|
49
|
-
"@strapi/typescript-utils": "5.0.0-beta.
|
|
50
|
-
"@strapi/utils": "5.0.0-beta.
|
|
49
|
+
"@strapi/typescript-utils": "5.0.0-beta.1",
|
|
50
|
+
"@strapi/utils": "5.0.0-beta.1",
|
|
51
51
|
"chalk": "4.1.2",
|
|
52
52
|
"copyfiles": "2.4.1",
|
|
53
53
|
"fs-extra": "10.1.0",
|
|
@@ -56,13 +56,13 @@
|
|
|
56
56
|
"pluralize": "8.0.0"
|
|
57
57
|
},
|
|
58
58
|
"devDependencies": {
|
|
59
|
-
"@strapi/pack-up": "5.0.0-beta.
|
|
60
|
-
"eslint-config-custom": "5.0.0-beta.
|
|
61
|
-
"tsconfig": "5.0.0-beta.
|
|
59
|
+
"@strapi/pack-up": "5.0.0-beta.1",
|
|
60
|
+
"eslint-config-custom": "5.0.0-beta.1",
|
|
61
|
+
"tsconfig": "5.0.0-beta.1"
|
|
62
62
|
},
|
|
63
63
|
"engines": {
|
|
64
64
|
"node": ">=18.0.0 <=20.x.x",
|
|
65
65
|
"npm": ">=6.0.0"
|
|
66
66
|
},
|
|
67
|
-
"gitHead": "
|
|
67
|
+
"gitHead": "ae773621dfcbc67c49dc6fa52ac41ea5de676ecb"
|
|
68
68
|
}
|
|
@@ -1,103 +0,0 @@
|
|
|
1
|
-
# From https://github.com/Danimoth/gitattributes/blob/master/Web.gitattributes
|
|
2
|
-
|
|
3
|
-
# Handle line endings automatically for files detected as text
|
|
4
|
-
# and leave all files detected as binary untouched.
|
|
5
|
-
* text=auto
|
|
6
|
-
|
|
7
|
-
#
|
|
8
|
-
# The above will handle all files NOT found below
|
|
9
|
-
#
|
|
10
|
-
|
|
11
|
-
#
|
|
12
|
-
## These files are text and should be normalized (Convert crlf => lf)
|
|
13
|
-
#
|
|
14
|
-
|
|
15
|
-
# source code
|
|
16
|
-
*.php text
|
|
17
|
-
*.css text
|
|
18
|
-
*.sass text
|
|
19
|
-
*.scss text
|
|
20
|
-
*.less text
|
|
21
|
-
*.styl text
|
|
22
|
-
*.js text eol=lf
|
|
23
|
-
*.coffee text
|
|
24
|
-
*.json text
|
|
25
|
-
*.htm text
|
|
26
|
-
*.html text
|
|
27
|
-
*.xml text
|
|
28
|
-
*.svg text
|
|
29
|
-
*.txt text
|
|
30
|
-
*.ini text
|
|
31
|
-
*.inc text
|
|
32
|
-
*.pl text
|
|
33
|
-
*.rb text
|
|
34
|
-
*.py text
|
|
35
|
-
*.scm text
|
|
36
|
-
*.sql text
|
|
37
|
-
*.sh text
|
|
38
|
-
*.bat text
|
|
39
|
-
|
|
40
|
-
# templates
|
|
41
|
-
*.ejs text
|
|
42
|
-
*.hbt text
|
|
43
|
-
*.jade text
|
|
44
|
-
*.haml text
|
|
45
|
-
*.hbs text
|
|
46
|
-
*.dot text
|
|
47
|
-
*.tmpl text
|
|
48
|
-
*.phtml text
|
|
49
|
-
|
|
50
|
-
# git config
|
|
51
|
-
.gitattributes text
|
|
52
|
-
.gitignore text
|
|
53
|
-
.gitconfig text
|
|
54
|
-
|
|
55
|
-
# code analysis config
|
|
56
|
-
.jshintrc text
|
|
57
|
-
.jscsrc text
|
|
58
|
-
.jshintignore text
|
|
59
|
-
.csslintrc text
|
|
60
|
-
|
|
61
|
-
# misc config
|
|
62
|
-
*.yaml text
|
|
63
|
-
*.yml text
|
|
64
|
-
.editorconfig text
|
|
65
|
-
|
|
66
|
-
# build config
|
|
67
|
-
*.npmignore text
|
|
68
|
-
*.bowerrc text
|
|
69
|
-
|
|
70
|
-
# Heroku
|
|
71
|
-
Procfile text
|
|
72
|
-
.slugignore text
|
|
73
|
-
|
|
74
|
-
# Documentation
|
|
75
|
-
*.md text
|
|
76
|
-
LICENSE text
|
|
77
|
-
AUTHORS text
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
#
|
|
81
|
-
## These files are binary and should be left untouched
|
|
82
|
-
#
|
|
83
|
-
|
|
84
|
-
# (binary is a macro for -text -diff)
|
|
85
|
-
*.png binary
|
|
86
|
-
*.jpg binary
|
|
87
|
-
*.jpeg binary
|
|
88
|
-
*.gif binary
|
|
89
|
-
*.ico binary
|
|
90
|
-
*.mov binary
|
|
91
|
-
*.mp4 binary
|
|
92
|
-
*.mp3 binary
|
|
93
|
-
*.flv binary
|
|
94
|
-
*.fla binary
|
|
95
|
-
*.swf binary
|
|
96
|
-
*.gz binary
|
|
97
|
-
*.zip binary
|
|
98
|
-
*.7z binary
|
|
99
|
-
*.ttf binary
|
|
100
|
-
*.eot binary
|
|
101
|
-
*.woff binary
|
|
102
|
-
*.pyc binary
|
|
103
|
-
*.pdf binary
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
*
|
|
3
|
-
* Initializer
|
|
4
|
-
*
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
import { useEffect, useRef } from 'react';
|
|
8
|
-
import PropTypes from 'prop-types';
|
|
9
|
-
import pluginId from '../../pluginId';
|
|
10
|
-
|
|
11
|
-
const Initializer = ({ setPlugin }) => {
|
|
12
|
-
const ref = useRef();
|
|
13
|
-
ref.current = setPlugin;
|
|
14
|
-
|
|
15
|
-
useEffect(() => {
|
|
16
|
-
ref.current(pluginId);
|
|
17
|
-
}, []);
|
|
18
|
-
|
|
19
|
-
return null;
|
|
20
|
-
};
|
|
21
|
-
|
|
22
|
-
Initializer.propTypes = {
|
|
23
|
-
setPlugin: PropTypes.func.isRequired,
|
|
24
|
-
};
|
|
25
|
-
|
|
26
|
-
export default Initializer;
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
import { prefixPluginTranslations } from './utils/prefixPluginTranslations';
|
|
2
|
-
import pluginPkg from '../../package.json';
|
|
3
|
-
import pluginId from './pluginId';
|
|
4
|
-
import Initializer from './components/Initializer';
|
|
5
|
-
import PluginIcon from './components/PluginIcon';
|
|
6
|
-
|
|
7
|
-
const name = pluginPkg.strapi.name;
|
|
8
|
-
|
|
9
|
-
export default {
|
|
10
|
-
register(app) {
|
|
11
|
-
app.addMenuLink({
|
|
12
|
-
to: `plugins/${pluginId}`,
|
|
13
|
-
icon: PluginIcon,
|
|
14
|
-
intlLabel: {
|
|
15
|
-
id: `${pluginId}.plugin.name`,
|
|
16
|
-
defaultMessage: name,
|
|
17
|
-
},
|
|
18
|
-
Component: async () => {
|
|
19
|
-
const component = await import('./pages/App');
|
|
20
|
-
|
|
21
|
-
return component;
|
|
22
|
-
},
|
|
23
|
-
permissions: [
|
|
24
|
-
// Uncomment to set the permissions of the plugin here
|
|
25
|
-
// {
|
|
26
|
-
// action: '', // the action name should be plugin::plugin-name.actionType
|
|
27
|
-
// subject: null,
|
|
28
|
-
// },
|
|
29
|
-
],
|
|
30
|
-
});
|
|
31
|
-
app.registerPlugin({
|
|
32
|
-
id: pluginId,
|
|
33
|
-
initializer: Initializer,
|
|
34
|
-
isReady: false,
|
|
35
|
-
name,
|
|
36
|
-
});
|
|
37
|
-
},
|
|
38
|
-
|
|
39
|
-
bootstrap(app) {},
|
|
40
|
-
async registerTrads({ locales }) {
|
|
41
|
-
const importedTrads = await Promise.all(
|
|
42
|
-
locales.map((locale) => {
|
|
43
|
-
return import(`./translations/${locale}.json`)
|
|
44
|
-
.then(({ default: data }) => {
|
|
45
|
-
return {
|
|
46
|
-
data: prefixPluginTranslations(data, pluginId),
|
|
47
|
-
locale,
|
|
48
|
-
};
|
|
49
|
-
})
|
|
50
|
-
.catch(() => {
|
|
51
|
-
return {
|
|
52
|
-
data: {},
|
|
53
|
-
locale,
|
|
54
|
-
};
|
|
55
|
-
});
|
|
56
|
-
})
|
|
57
|
-
);
|
|
58
|
-
|
|
59
|
-
return Promise.resolve(importedTrads);
|
|
60
|
-
},
|
|
61
|
-
};
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
*
|
|
3
|
-
* This component is the skeleton around the actual pages, and should only
|
|
4
|
-
* contain code that should be seen on all pages. (e.g. navigation bar)
|
|
5
|
-
*
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
import React from 'react';
|
|
9
|
-
import { Switch, Route } from 'react-router-dom';
|
|
10
|
-
import { AnErrorOccurred } from '@strapi/helper-plugin';
|
|
11
|
-
import pluginId from '../../pluginId';
|
|
12
|
-
import HomePage from '../HomePage';
|
|
13
|
-
|
|
14
|
-
const App = () => {
|
|
15
|
-
return (
|
|
16
|
-
<div>
|
|
17
|
-
<Switch>
|
|
18
|
-
<Route index element={<HomePage />} />
|
|
19
|
-
<Route path="*" element={<AnErrorOccurred />} />
|
|
20
|
-
</Switch>
|
|
21
|
-
</div>
|
|
22
|
-
);
|
|
23
|
-
};
|
|
24
|
-
|
|
25
|
-
export default App;
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
*
|
|
3
|
-
* HomePage
|
|
4
|
-
*
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
import React from 'react';
|
|
8
|
-
// import PropTypes from 'prop-types';
|
|
9
|
-
import pluginId from '../../pluginId';
|
|
10
|
-
|
|
11
|
-
const HomePage = () => {
|
|
12
|
-
return (
|
|
13
|
-
<div>
|
|
14
|
-
<h1>{pluginId}'s HomePage</h1>
|
|
15
|
-
<p>Happy coding</p>
|
|
16
|
-
</div>
|
|
17
|
-
);
|
|
18
|
-
};
|
|
19
|
-
|
|
20
|
-
export default HomePage;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
const prefixPluginTranslations = (trad, pluginId) => {
|
|
2
|
-
if (!pluginId) {
|
|
3
|
-
throw new TypeError("pluginId can't be empty");
|
|
4
|
-
}
|
|
5
|
-
return Object.keys(trad).reduce((acc, current) => {
|
|
6
|
-
acc[`${pluginId}.${current}`] = trad[current];
|
|
7
|
-
return acc;
|
|
8
|
-
}, {});
|
|
9
|
-
};
|
|
10
|
-
|
|
11
|
-
export { prefixPluginTranslations };
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
const register = require('./register');
|
|
4
|
-
const bootstrap = require('./bootstrap');
|
|
5
|
-
const destroy = require('./destroy');
|
|
6
|
-
const config = require('./config');
|
|
7
|
-
const contentTypes = require('./content-types');
|
|
8
|
-
const controllers = require('./controllers');
|
|
9
|
-
const routes = require('./routes');
|
|
10
|
-
const middlewares = require('./middlewares');
|
|
11
|
-
const policies = require('./policies');
|
|
12
|
-
const services = require('./services');
|
|
13
|
-
|
|
14
|
-
module.exports = {
|
|
15
|
-
register,
|
|
16
|
-
bootstrap,
|
|
17
|
-
destroy,
|
|
18
|
-
config,
|
|
19
|
-
controllers,
|
|
20
|
-
routes,
|
|
21
|
-
services,
|
|
22
|
-
contentTypes,
|
|
23
|
-
policies,
|
|
24
|
-
middlewares,
|
|
25
|
-
};
|
|
@@ -1,103 +0,0 @@
|
|
|
1
|
-
# From https://github.com/Danimoth/gitattributes/blob/master/Web.gitattributes
|
|
2
|
-
|
|
3
|
-
# Handle line endings automatically for files detected as text
|
|
4
|
-
# and leave all files detected as binary untouched.
|
|
5
|
-
* text=auto
|
|
6
|
-
|
|
7
|
-
#
|
|
8
|
-
# The above will handle all files NOT found below
|
|
9
|
-
#
|
|
10
|
-
|
|
11
|
-
#
|
|
12
|
-
## These files are text and should be normalized (Convert crlf => lf)
|
|
13
|
-
#
|
|
14
|
-
|
|
15
|
-
# source code
|
|
16
|
-
*.php text
|
|
17
|
-
*.css text
|
|
18
|
-
*.sass text
|
|
19
|
-
*.scss text
|
|
20
|
-
*.less text
|
|
21
|
-
*.styl text
|
|
22
|
-
*.js text eol=lf
|
|
23
|
-
*.coffee text
|
|
24
|
-
*.json text
|
|
25
|
-
*.htm text
|
|
26
|
-
*.html text
|
|
27
|
-
*.xml text
|
|
28
|
-
*.svg text
|
|
29
|
-
*.txt text
|
|
30
|
-
*.ini text
|
|
31
|
-
*.inc text
|
|
32
|
-
*.pl text
|
|
33
|
-
*.rb text
|
|
34
|
-
*.py text
|
|
35
|
-
*.scm text
|
|
36
|
-
*.sql text
|
|
37
|
-
*.sh text
|
|
38
|
-
*.bat text
|
|
39
|
-
|
|
40
|
-
# templates
|
|
41
|
-
*.ejs text
|
|
42
|
-
*.hbt text
|
|
43
|
-
*.jade text
|
|
44
|
-
*.haml text
|
|
45
|
-
*.hbs text
|
|
46
|
-
*.dot text
|
|
47
|
-
*.tmpl text
|
|
48
|
-
*.phtml text
|
|
49
|
-
|
|
50
|
-
# git config
|
|
51
|
-
.gitattributes text
|
|
52
|
-
.gitignore text
|
|
53
|
-
.gitconfig text
|
|
54
|
-
|
|
55
|
-
# code analysis config
|
|
56
|
-
.jshintrc text
|
|
57
|
-
.jscsrc text
|
|
58
|
-
.jshintignore text
|
|
59
|
-
.csslintrc text
|
|
60
|
-
|
|
61
|
-
# misc config
|
|
62
|
-
*.yaml text
|
|
63
|
-
*.yml text
|
|
64
|
-
.editorconfig text
|
|
65
|
-
|
|
66
|
-
# build config
|
|
67
|
-
*.npmignore text
|
|
68
|
-
*.bowerrc text
|
|
69
|
-
|
|
70
|
-
# Heroku
|
|
71
|
-
Procfile text
|
|
72
|
-
.slugignore text
|
|
73
|
-
|
|
74
|
-
# Documentation
|
|
75
|
-
*.md text
|
|
76
|
-
LICENSE text
|
|
77
|
-
AUTHORS text
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
#
|
|
81
|
-
## These files are binary and should be left untouched
|
|
82
|
-
#
|
|
83
|
-
|
|
84
|
-
# (binary is a macro for -text -diff)
|
|
85
|
-
*.png binary
|
|
86
|
-
*.jpg binary
|
|
87
|
-
*.jpeg binary
|
|
88
|
-
*.gif binary
|
|
89
|
-
*.ico binary
|
|
90
|
-
*.mov binary
|
|
91
|
-
*.mp4 binary
|
|
92
|
-
*.mp3 binary
|
|
93
|
-
*.flv binary
|
|
94
|
-
*.fla binary
|
|
95
|
-
*.swf binary
|
|
96
|
-
*.gz binary
|
|
97
|
-
*.zip binary
|
|
98
|
-
*.7z binary
|
|
99
|
-
*.ttf binary
|
|
100
|
-
*.eot binary
|
|
101
|
-
*.woff binary
|
|
102
|
-
*.pyc binary
|
|
103
|
-
*.pdf binary
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
*
|
|
3
|
-
* Initializer
|
|
4
|
-
*
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
import { useEffect, useRef } from 'react';
|
|
8
|
-
import pluginId from '../../pluginId';
|
|
9
|
-
|
|
10
|
-
type InitializerProps = {
|
|
11
|
-
setPlugin: (id: string) => void;
|
|
12
|
-
};
|
|
13
|
-
|
|
14
|
-
const Initializer = ({ setPlugin }: InitializerProps) => {
|
|
15
|
-
const ref = useRef(setPlugin);
|
|
16
|
-
|
|
17
|
-
useEffect(() => {
|
|
18
|
-
ref.current(pluginId);
|
|
19
|
-
}, []);
|
|
20
|
-
|
|
21
|
-
return null;
|
|
22
|
-
};
|
|
23
|
-
|
|
24
|
-
export default Initializer;
|
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
import { prefixPluginTranslations } from './utils/prefixPluginTranslations';
|
|
2
|
-
|
|
3
|
-
import pluginPkg from '../../package.json';
|
|
4
|
-
import pluginId from './pluginId';
|
|
5
|
-
import Initializer from './components/Initializer';
|
|
6
|
-
import PluginIcon from './components/PluginIcon';
|
|
7
|
-
|
|
8
|
-
const name = pluginPkg.strapi.name;
|
|
9
|
-
|
|
10
|
-
export default {
|
|
11
|
-
register(app: any) {
|
|
12
|
-
app.addMenuLink({
|
|
13
|
-
to: `plugins/${pluginId}`,
|
|
14
|
-
icon: PluginIcon,
|
|
15
|
-
intlLabel: {
|
|
16
|
-
id: `${pluginId}.plugin.name`,
|
|
17
|
-
defaultMessage: name,
|
|
18
|
-
},
|
|
19
|
-
Component: async () => {
|
|
20
|
-
const component = await import('./pages/App');
|
|
21
|
-
|
|
22
|
-
return component;
|
|
23
|
-
},
|
|
24
|
-
permissions: [
|
|
25
|
-
// Uncomment to set the permissions of the plugin here
|
|
26
|
-
// {
|
|
27
|
-
// action: '', // the action name should be plugin::plugin-name.actionType
|
|
28
|
-
// subject: null,
|
|
29
|
-
// },
|
|
30
|
-
],
|
|
31
|
-
});
|
|
32
|
-
const plugin = {
|
|
33
|
-
id: pluginId,
|
|
34
|
-
initializer: Initializer,
|
|
35
|
-
isReady: false,
|
|
36
|
-
name,
|
|
37
|
-
};
|
|
38
|
-
|
|
39
|
-
app.registerPlugin(plugin);
|
|
40
|
-
},
|
|
41
|
-
|
|
42
|
-
bootstrap(app: any) {},
|
|
43
|
-
|
|
44
|
-
async registerTrads(app: any) {
|
|
45
|
-
const { locales } = app;
|
|
46
|
-
|
|
47
|
-
const importedTrads = await Promise.all(
|
|
48
|
-
(locales as any[]).map((locale) => {
|
|
49
|
-
return import(`./translations/${locale}.json`)
|
|
50
|
-
.then(({ default: data }) => {
|
|
51
|
-
return {
|
|
52
|
-
data: prefixPluginTranslations(data, pluginId),
|
|
53
|
-
locale,
|
|
54
|
-
};
|
|
55
|
-
})
|
|
56
|
-
.catch(() => {
|
|
57
|
-
return {
|
|
58
|
-
data: {},
|
|
59
|
-
locale,
|
|
60
|
-
};
|
|
61
|
-
});
|
|
62
|
-
})
|
|
63
|
-
);
|
|
64
|
-
|
|
65
|
-
return Promise.resolve(importedTrads);
|
|
66
|
-
},
|
|
67
|
-
};
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
*
|
|
3
|
-
* This component is the skeleton around the actual pages, and should only
|
|
4
|
-
* contain code that should be seen on all pages. (e.g. navigation bar)
|
|
5
|
-
*
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
import React from 'react';
|
|
9
|
-
import { Routes, Route } from 'react-router-dom';
|
|
10
|
-
import { AnErrorOccurred } from '@strapi/helper-plugin';
|
|
11
|
-
import pluginId from '../../pluginId';
|
|
12
|
-
import HomePage from '../HomePage';
|
|
13
|
-
|
|
14
|
-
const App = () => {
|
|
15
|
-
return (
|
|
16
|
-
<div>
|
|
17
|
-
<Routes>
|
|
18
|
-
<Route index element={<HomePage />} />
|
|
19
|
-
<Route path="*" element={<AnErrorOccurred />} />
|
|
20
|
-
</Routes>
|
|
21
|
-
</div>
|
|
22
|
-
);
|
|
23
|
-
};
|
|
24
|
-
|
|
25
|
-
export default App;
|