@strapi/generators 0.0.0-next.f45143c5e2a8a9d85691d0abf79a3f42024a0c71 → 0.0.0-next.f4ec69568d980c6fee91ce2ee0f41c138347aa81
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/LICENSE +18 -3
- package/dist/index.d.ts +6 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +58 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +34 -0
- package/dist/index.mjs.map +1 -0
- package/dist/plopfile.d.ts +4 -0
- package/dist/plopfile.d.ts.map +1 -0
- package/dist/plopfile.js +586 -0
- package/dist/plopfile.js.map +1 -0
- package/dist/plopfile.mjs +582 -0
- package/dist/plopfile.mjs.map +1 -0
- package/dist/plops/api.d.ts +4 -0
- package/dist/plops/api.d.ts.map +1 -0
- package/dist/plops/content-type.d.ts +4 -0
- package/dist/plops/content-type.d.ts.map +1 -0
- package/dist/plops/controller.d.ts +4 -0
- package/dist/plops/controller.d.ts.map +1 -0
- package/dist/plops/middleware.d.ts +4 -0
- package/dist/plops/middleware.d.ts.map +1 -0
- package/dist/plops/migration.d.ts +4 -0
- package/dist/plops/migration.d.ts.map +1 -0
- package/dist/plops/policy.d.ts +4 -0
- package/dist/plops/policy.d.ts.map +1 -0
- package/dist/plops/prompts/bootstrap-api-prompts.d.ts +4 -0
- package/dist/plops/prompts/bootstrap-api-prompts.d.ts.map +1 -0
- package/dist/plops/prompts/ct-names-prompts.d.ts +4 -0
- package/dist/plops/prompts/ct-names-prompts.d.ts.map +1 -0
- package/dist/plops/prompts/get-attributes-prompts.d.ts +4 -0
- package/dist/plops/prompts/get-attributes-prompts.d.ts.map +1 -0
- package/dist/plops/prompts/get-destination-prompts.d.ts +6 -0
- package/dist/plops/prompts/get-destination-prompts.d.ts.map +1 -0
- package/dist/plops/prompts/kind-prompts.d.ts +4 -0
- package/dist/plops/prompts/kind-prompts.d.ts.map +1 -0
- package/dist/plops/service.d.ts +4 -0
- package/dist/plops/service.d.ts.map +1 -0
- package/dist/plops/utils/get-file-path.d.ts +3 -0
- package/dist/plops/utils/get-file-path.d.ts.map +1 -0
- package/dist/plops/utils/get-formatted-date.d.ts +3 -0
- package/dist/plops/utils/get-formatted-date.d.ts.map +1 -0
- package/dist/plops/utils/validate-attribute-input.d.ts +3 -0
- package/dist/plops/utils/validate-attribute-input.d.ts.map +1 -0
- package/dist/plops/utils/validate-file-name-input.d.ts +3 -0
- package/dist/plops/utils/validate-file-name-input.d.ts.map +1 -0
- package/dist/plops/utils/validate-input.d.ts +3 -0
- package/dist/plops/utils/validate-input.d.ts.map +1 -0
- package/{lib → dist}/templates/js/content-type.schema.json.hbs +0 -1
- package/{lib → dist}/templates/ts/content-type.schema.json.hbs +0 -1
- package/{lib → dist}/templates/ts/middleware.ts.hbs +2 -2
- package/package.json +29 -9
- package/.eslintignore +0 -3
- package/.eslintrc.js +0 -4
- package/lib/files/js/plugin/admin/src/components/Initializer/index.js +0 -26
- package/lib/files/js/plugin/admin/src/components/PluginIcon/index.js +0 -12
- package/lib/files/js/plugin/admin/src/index.js +0 -63
- package/lib/files/js/plugin/admin/src/pages/App/index.js +0 -25
- package/lib/files/js/plugin/admin/src/pages/HomePage/index.js +0 -20
- package/lib/files/js/plugin/admin/src/pluginId.js +0 -5
- package/lib/files/js/plugin/admin/src/translations/en.json +0 -1
- package/lib/files/js/plugin/admin/src/translations/fr.json +0 -1
- package/lib/files/js/plugin/admin/src/utils/getTrad.js +0 -5
- package/lib/files/js/plugin/server/bootstrap.js +0 -5
- package/lib/files/js/plugin/server/config/index.js +0 -6
- package/lib/files/js/plugin/server/content-types/index.js +0 -3
- package/lib/files/js/plugin/server/controllers/index.js +0 -7
- package/lib/files/js/plugin/server/controllers/my-controller.js.hbs +0 -10
- package/lib/files/js/plugin/server/destroy.js +0 -5
- package/lib/files/js/plugin/server/index.js +0 -25
- package/lib/files/js/plugin/server/middlewares/index.js +0 -3
- package/lib/files/js/plugin/server/policies/index.js +0 -3
- package/lib/files/js/plugin/server/register.js +0 -5
- package/lib/files/js/plugin/server/routes/index.js +0 -10
- package/lib/files/js/plugin/server/services/index.js +0 -7
- package/lib/files/js/plugin/server/services/my-service.js +0 -7
- package/lib/files/js/plugin/strapi-admin.js +0 -3
- package/lib/files/js/plugin/strapi-server.js +0 -3
- package/lib/files/ts/plugin/admin/src/components/Initializer/index.tsx +0 -24
- package/lib/files/ts/plugin/admin/src/components/PluginIcon/index.tsx +0 -12
- package/lib/files/ts/plugin/admin/src/index.tsx +0 -67
- package/lib/files/ts/plugin/admin/src/pages/App/index.tsx +0 -25
- package/lib/files/ts/plugin/admin/src/pages/HomePage/index.tsx +0 -19
- package/lib/files/ts/plugin/admin/src/pluginId.ts +0 -5
- package/lib/files/ts/plugin/admin/src/translations/en.json +0 -1
- package/lib/files/ts/plugin/admin/src/translations/fr.json +0 -1
- package/lib/files/ts/plugin/admin/src/utils/getTrad.ts +0 -5
- package/lib/files/ts/plugin/custom.d.ts +0 -5
- package/lib/files/ts/plugin/server/bootstrap.ts +0 -5
- package/lib/files/ts/plugin/server/config/index.ts +0 -4
- package/lib/files/ts/plugin/server/content-types/index.ts +0 -1
- package/lib/files/ts/plugin/server/controllers/index.ts +0 -5
- package/lib/files/ts/plugin/server/controllers/my-controller.ts.hbs +0 -10
- package/lib/files/ts/plugin/server/destroy.ts +0 -5
- package/lib/files/ts/plugin/server/index.ts +0 -23
- package/lib/files/ts/plugin/server/middlewares/index.ts +0 -1
- package/lib/files/ts/plugin/server/policies/index.ts +0 -1
- package/lib/files/ts/plugin/server/register.ts +0 -5
- package/lib/files/ts/plugin/server/routes/index.ts +0 -10
- package/lib/files/ts/plugin/server/services/index.ts +0 -5
- package/lib/files/ts/plugin/server/services/my-service.ts +0 -7
- package/lib/files/ts/plugin/strapi-admin.js +0 -3
- package/lib/files/ts/plugin/strapi-server.js +0 -3
- package/lib/files/ts/plugin/tsconfig.json +0 -20
- package/lib/files/ts/plugin/tsconfig.server.json +0 -25
- package/lib/index.js +0 -37
- package/lib/plopfile.js +0 -28
- package/lib/plops/__tests__/content-type.test.js +0 -179
- package/lib/plops/api.js +0 -82
- package/lib/plops/content-type.js +0 -148
- package/lib/plops/controller.js +0 -36
- package/lib/plops/middleware.js +0 -36
- package/lib/plops/migration.js +0 -33
- package/lib/plops/plugin.js +0 -91
- package/lib/plops/policy.js +0 -36
- package/lib/plops/prompts/bootstrap-api-prompts.js +0 -10
- package/lib/plops/prompts/ct-names-prompts.js +0 -44
- package/lib/plops/prompts/draft-and-publish-prompts.js +0 -10
- package/lib/plops/prompts/get-attributes-prompts.js +0 -105
- package/lib/plops/prompts/get-destination-prompts.js +0 -79
- package/lib/plops/prompts/kind-prompts.js +0 -17
- package/lib/plops/service.js +0 -34
- package/lib/plops/utils/__tests__/get-file-path.test.js +0 -25
- package/lib/plops/utils/get-file-path.js +0 -17
- package/lib/plops/utils/get-formatted-date.js +0 -8
- package/lib/plops/utils/validate-attribute-input.js +0 -11
- package/lib/plops/utils/validate-file-name-input.js +0 -11
- package/lib/plops/utils/validate-input.js +0 -11
- package/lib/templates/js/README.md.hbs +0 -3
- package/lib/templates/js/plugin-package.json.hbs +0 -42
- package/lib/templates/ts/README.md.hbs +0 -3
- package/lib/templates/ts/plugin-package.json.hbs +0 -51
- /package/{lib → dist}/templates/js/collection-type-routes.js.hbs +0 -0
- /package/{lib → dist}/templates/js/controller.js.hbs +0 -0
- /package/{lib → dist}/templates/js/core-controller.js.hbs +0 -0
- /package/{lib → dist}/templates/js/core-router.js.hbs +0 -0
- /package/{lib → dist}/templates/js/core-service.js.hbs +0 -0
- /package/{lib → dist}/templates/js/middleware.js.hbs +0 -0
- /package/{lib → dist}/templates/js/migration.js.hbs +0 -0
- /package/{lib → dist}/templates/js/policy.js.hbs +0 -0
- /package/{lib → dist}/templates/js/service.js.hbs +0 -0
- /package/{lib → dist}/templates/js/single-route.js.hbs +0 -0
- /package/{lib → dist}/templates/js/single-type-routes.js.hbs +0 -0
- /package/{lib → dist}/templates/ts/collection-type-routes.ts.hbs +0 -0
- /package/{lib → dist}/templates/ts/controller.ts.hbs +0 -0
- /package/{lib → dist}/templates/ts/core-controller.ts.hbs +0 -0
- /package/{lib → dist}/templates/ts/core-router.ts.hbs +0 -0
- /package/{lib → dist}/templates/ts/core-service.ts.hbs +0 -0
- /package/{lib → dist}/templates/ts/migration.ts.hbs +0 -0
- /package/{lib → dist}/templates/ts/policy.ts.hbs +0 -0
- /package/{lib → dist}/templates/ts/service.ts.hbs +0 -0
- /package/{lib → dist}/templates/ts/single-route.ts.hbs +0 -0
- /package/{lib → dist}/templates/ts/single-type-routes.ts.hbs +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"controller.d.ts","sourceRoot":"","sources":["../../src/plops/controller.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,MAAM,CAAC;+BAOlB,WAAW;AAAjC,wBA+BE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"middleware.d.ts","sourceRoot":"","sources":["../../src/plops/middleware.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,MAAM,CAAC;+BAOlB,WAAW;AAAjC,wBA+BE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"migration.d.ts","sourceRoot":"","sources":["../../src/plops/migration.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,MAAM,CAAC;+BAKlB,WAAW;AAAjC,wBA0BE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"policy.d.ts","sourceRoot":"","sources":["../../src/plops/policy.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,MAAM,CAAC;+BAOlB,WAAW;AAAjC,wBA+BE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bootstrap-api-prompts.d.ts","sourceRoot":"","sources":["../../../src/plops/prompts/bootstrap-api-prompts.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAEhD,QAAA,MAAM,SAAS,EAAE,KAAK,CAAC,cAAc,CAOpC,CAAC;AAEF,eAAe,SAAS,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ct-names-prompts.d.ts","sourceRoot":"","sources":["../../../src/plops/prompts/ct-names-prompts.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAQhD,QAAA,MAAM,SAAS,EAAE,KAAK,CAAC,cAAc,CAqCpC,CAAC;AAEF,eAAe,SAAS,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-attributes-prompts.d.ts","sourceRoot":"","sources":["../../../src/plops/prompts/get-attributes-prompts.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,WAAW,CAAC;AAkCxD,QAAA,MAAM,oBAAoB,EAAE,sBAyE3B,CAAC;AAEF,eAAe,oBAAoB,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { PromptQuestion } from 'node-plop';
|
|
2
|
+
declare const _default: (action: string, basePath: string, { rootFolder }?: {
|
|
3
|
+
rootFolder?: boolean | undefined;
|
|
4
|
+
}) => Array<PromptQuestion>;
|
|
5
|
+
export default _default;
|
|
6
|
+
//# sourceMappingURL=get-destination-prompts.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-destination-prompts.d.ts","sourceRoot":"","sources":["../../../src/plops/prompts/get-destination-prompts.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;iCAGtC,MAAM,YACJ,MAAM;;MAEf,MAAM,cAAc,CAAC;AAJxB,wBA6EE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"kind-prompts.d.ts","sourceRoot":"","sources":["../../../src/plops/prompts/kind-prompts.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAIhD,QAAA,MAAM,SAAS,EAAE,KAAK,CAAC,cAAc,CAYpC,CAAC;AAEF,eAAe,SAAS,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"service.d.ts","sourceRoot":"","sources":["../../src/plops/service.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,MAAM,CAAC;+BAMlB,WAAW;AAAjC,wBA8BE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-file-path.d.ts","sourceRoot":"","sources":["../../../src/plops/utils/get-file-path.ts"],"names":[],"mappings":"sCAA6B,MAAM;AAAnC,wBAcE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-formatted-date.d.ts","sourceRoot":"","sources":["../../../src/plops/utils/get-formatted-date.ts"],"names":[],"mappings":"gCAAsB,IAAI;AAA1B,wBAKE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validate-attribute-input.d.ts","sourceRoot":"","sources":["../../../src/plops/utils/validate-attribute-input.ts"],"names":[],"mappings":"gCAAuB,MAAM;AAA7B,wBAQE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validate-file-name-input.d.ts","sourceRoot":"","sources":["../../../src/plops/utils/validate-file-name-input.ts"],"names":[],"mappings":"gCAAuB,MAAM;AAA7B,wBAQE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validate-input.d.ts","sourceRoot":"","sources":["../../../src/plops/utils/validate-input.ts"],"names":[],"mappings":"gCAAuB,MAAM;AAA7B,wBAQE"}
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
* `{{ name }}` middleware
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
|
-
import {
|
|
5
|
+
import type { Core } from '@strapi/strapi';
|
|
6
6
|
|
|
7
|
-
export default (config, { strapi }: { strapi: Strapi }) => {
|
|
7
|
+
export default (config, { strapi }: { strapi: Core.Strapi }) => {
|
|
8
8
|
// Add your own logic here.
|
|
9
9
|
return async (ctx, next) => {
|
|
10
10
|
strapi.log.info('In {{ name }} middleware.');
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@strapi/generators",
|
|
3
|
-
"version": "0.0.0-next.
|
|
3
|
+
"version": "0.0.0-next.f4ec69568d980c6fee91ce2ee0f41c138347aa81",
|
|
4
4
|
"description": "Interactive API generator.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"strapi",
|
|
@@ -27,23 +27,43 @@
|
|
|
27
27
|
"url": "https://strapi.io"
|
|
28
28
|
}
|
|
29
29
|
],
|
|
30
|
-
"main": "
|
|
30
|
+
"main": "./dist/index.js",
|
|
31
|
+
"module": "./dist/index.mjs",
|
|
32
|
+
"source": "./src/index.ts",
|
|
33
|
+
"types": "./dist/index.d.ts",
|
|
34
|
+
"files": [
|
|
35
|
+
"dist/"
|
|
36
|
+
],
|
|
31
37
|
"scripts": {
|
|
32
|
-
"
|
|
38
|
+
"build": "pack-up build && run copy-files",
|
|
39
|
+
"clean": "run -T rimraf ./dist",
|
|
40
|
+
"copy-files": "copyfiles -u 1 -a 'src/templates/**/*' 'src/files/**/*' dist",
|
|
41
|
+
"lint": "run -T eslint .",
|
|
42
|
+
"test:ts": "run -T tsc --noEmit",
|
|
43
|
+
"test:unit": "run -T jest",
|
|
44
|
+
"test:unit:watch": "run -T jest --watch",
|
|
45
|
+
"watch": "pack-up watch"
|
|
33
46
|
},
|
|
34
47
|
"dependencies": {
|
|
35
48
|
"@sindresorhus/slugify": "1.1.0",
|
|
36
|
-
"@strapi/typescript-utils": "0.0.0-next.
|
|
37
|
-
"@strapi/utils": "0.0.0-next.
|
|
49
|
+
"@strapi/typescript-utils": "0.0.0-next.f4ec69568d980c6fee91ce2ee0f41c138347aa81",
|
|
50
|
+
"@strapi/utils": "0.0.0-next.f4ec69568d980c6fee91ce2ee0f41c138347aa81",
|
|
38
51
|
"chalk": "4.1.2",
|
|
39
|
-
"
|
|
52
|
+
"copyfiles": "2.4.1",
|
|
53
|
+
"fs-extra": "11.2.0",
|
|
40
54
|
"node-plop": "0.26.3",
|
|
41
|
-
"plop": "
|
|
55
|
+
"plop": "4.0.1",
|
|
42
56
|
"pluralize": "8.0.0"
|
|
43
57
|
},
|
|
58
|
+
"devDependencies": {
|
|
59
|
+
"@strapi/pack-up": "5.0.0",
|
|
60
|
+
"@types/fs-extra": "11.0.4",
|
|
61
|
+
"eslint-config-custom": "0.0.0-next.f4ec69568d980c6fee91ce2ee0f41c138347aa81",
|
|
62
|
+
"tsconfig": "0.0.0-next.f4ec69568d980c6fee91ce2ee0f41c138347aa81"
|
|
63
|
+
},
|
|
44
64
|
"engines": {
|
|
45
|
-
"node": ">=
|
|
65
|
+
"node": ">=18.0.0 <=22.x.x",
|
|
46
66
|
"npm": ">=6.0.0"
|
|
47
67
|
},
|
|
48
|
-
"gitHead": "
|
|
68
|
+
"gitHead": "f4ec69568d980c6fee91ce2ee0f41c138347aa81"
|
|
49
69
|
}
|
package/.eslintignore
DELETED
package/.eslintrc.js
DELETED
|
@@ -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,63 +0,0 @@
|
|
|
1
|
-
import { prefixPluginTranslations } from '@strapi/helper-plugin';
|
|
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(/* webpackChunkName: "[request]" */ './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(
|
|
44
|
-
/* webpackChunkName: "translation-[request]" */ `./translations/${locale}.json`
|
|
45
|
-
)
|
|
46
|
-
.then(({ default: data }) => {
|
|
47
|
-
return {
|
|
48
|
-
data: prefixPluginTranslations(data, pluginId),
|
|
49
|
-
locale,
|
|
50
|
-
};
|
|
51
|
-
})
|
|
52
|
-
.catch(() => {
|
|
53
|
-
return {
|
|
54
|
-
data: {},
|
|
55
|
-
locale,
|
|
56
|
-
};
|
|
57
|
-
});
|
|
58
|
-
})
|
|
59
|
-
);
|
|
60
|
-
|
|
61
|
-
return Promise.resolve(importedTrads);
|
|
62
|
-
},
|
|
63
|
-
};
|
|
@@ -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 path={`/plugins/${pluginId}`} component={HomePage} exact />
|
|
19
|
-
<Route component={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,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,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;
|