@strapi/strapi 5.0.0-beta.1 → 5.0.0-beta.2

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 (204) hide show
  1. package/dist/admin.d.ts.map +1 -1
  2. package/dist/admin.js +5 -0
  3. package/dist/admin.js.map +1 -1
  4. package/dist/admin.mjs +4 -0
  5. package/dist/admin.mjs.map +1 -1
  6. package/dist/cli/commands/admin/create-user.js +2 -2
  7. package/dist/cli/commands/admin/create-user.js.map +1 -1
  8. package/dist/cli/commands/admin/create-user.mjs +88 -0
  9. package/dist/cli/commands/admin/create-user.mjs.map +1 -0
  10. package/dist/cli/commands/admin/reset-user-password.js +2 -2
  11. package/dist/cli/commands/admin/reset-user-password.js.map +1 -1
  12. package/dist/cli/commands/admin/reset-user-password.mjs +44 -0
  13. package/dist/cli/commands/admin/reset-user-password.mjs.map +1 -0
  14. package/dist/cli/commands/build.mjs +30 -0
  15. package/dist/cli/commands/build.mjs.map +1 -0
  16. package/dist/cli/commands/components/list.js +2 -2
  17. package/dist/cli/commands/components/list.js.map +1 -1
  18. package/dist/cli/commands/components/list.mjs +24 -0
  19. package/dist/cli/commands/components/list.mjs.map +1 -0
  20. package/dist/cli/commands/configuration/dump.js +2 -2
  21. package/dist/cli/commands/configuration/dump.js.map +1 -1
  22. package/dist/cli/commands/configuration/dump.mjs +41 -0
  23. package/dist/cli/commands/configuration/dump.mjs.map +1 -0
  24. package/dist/cli/commands/configuration/restore.js +2 -2
  25. package/dist/cli/commands/configuration/restore.js.map +1 -1
  26. package/dist/cli/commands/configuration/restore.mjs +140 -0
  27. package/dist/cli/commands/configuration/restore.mjs.map +1 -0
  28. package/dist/cli/commands/console.js +2 -2
  29. package/dist/cli/commands/console.js.map +1 -1
  30. package/dist/cli/commands/console.mjs +27 -0
  31. package/dist/cli/commands/console.mjs.map +1 -0
  32. package/dist/cli/commands/content-types/list.js +2 -2
  33. package/dist/cli/commands/content-types/list.js.map +1 -1
  34. package/dist/cli/commands/content-types/list.mjs +24 -0
  35. package/dist/cli/commands/content-types/list.mjs.map +1 -0
  36. package/dist/cli/commands/controllers/list.js +2 -2
  37. package/dist/cli/commands/controllers/list.js.map +1 -1
  38. package/dist/cli/commands/controllers/list.mjs +24 -0
  39. package/dist/cli/commands/controllers/list.mjs.map +1 -0
  40. package/dist/cli/commands/develop.mjs +27 -0
  41. package/dist/cli/commands/develop.mjs.map +1 -0
  42. package/dist/cli/commands/export/action.mjs +116 -0
  43. package/dist/cli/commands/export/action.mjs.map +1 -0
  44. package/dist/cli/commands/export/command.mjs +24 -0
  45. package/dist/cli/commands/export/command.mjs.map +1 -0
  46. package/dist/cli/commands/generate.mjs +13 -0
  47. package/dist/cli/commands/generate.mjs.map +1 -0
  48. package/dist/cli/commands/hooks/list.js +2 -2
  49. package/dist/cli/commands/hooks/list.js.map +1 -1
  50. package/dist/cli/commands/hooks/list.mjs +24 -0
  51. package/dist/cli/commands/hooks/list.mjs.map +1 -0
  52. package/dist/cli/commands/import/action.mjs +105 -0
  53. package/dist/cli/commands/import/action.mjs.map +1 -0
  54. package/dist/cli/commands/import/command.mjs +68 -0
  55. package/dist/cli/commands/import/command.mjs.map +1 -0
  56. package/dist/cli/commands/index.mjs +71 -0
  57. package/dist/cli/commands/index.mjs.map +1 -0
  58. package/dist/cli/commands/middlewares/list.js +2 -2
  59. package/dist/cli/commands/middlewares/list.js.map +1 -1
  60. package/dist/cli/commands/middlewares/list.mjs +24 -0
  61. package/dist/cli/commands/middlewares/list.mjs.map +1 -0
  62. package/dist/cli/commands/plugin/build.mjs +85 -0
  63. package/dist/cli/commands/plugin/build.mjs.map +1 -0
  64. package/dist/cli/commands/plugin/init/action.js +1 -1
  65. package/dist/cli/commands/plugin/init/action.js.map +1 -1
  66. package/dist/cli/commands/plugin/init/action.mjs +409 -0
  67. package/dist/cli/commands/plugin/init/action.mjs.map +1 -0
  68. package/dist/cli/commands/plugin/init/command.mjs +10 -0
  69. package/dist/cli/commands/plugin/init/command.mjs.map +1 -0
  70. package/dist/cli/commands/plugin/init/files/admin.mjs +283 -0
  71. package/dist/cli/commands/plugin/init/files/admin.mjs.map +1 -0
  72. package/dist/cli/commands/plugin/init/files/editorConfig.mjs +26 -0
  73. package/dist/cli/commands/plugin/init/files/editorConfig.mjs.map +1 -0
  74. package/dist/cli/commands/plugin/init/files/eslint.mjs +11 -0
  75. package/dist/cli/commands/plugin/init/files/eslint.mjs.map +1 -0
  76. package/dist/cli/commands/plugin/init/files/gitIgnore.mjs +34 -0
  77. package/dist/cli/commands/plugin/init/files/gitIgnore.mjs.map +1 -0
  78. package/dist/cli/commands/plugin/init/files/prettier.mjs +25 -0
  79. package/dist/cli/commands/plugin/init/files/prettier.mjs.map +1 -0
  80. package/dist/cli/commands/plugin/init/files/server.mjs +360 -0
  81. package/dist/cli/commands/plugin/init/files/server.mjs.map +1 -0
  82. package/dist/cli/commands/plugin/init/files/typescript.mjs +66 -0
  83. package/dist/cli/commands/plugin/init/files/typescript.mjs.map +1 -0
  84. package/dist/cli/commands/plugin/link-watch.mjs +82 -0
  85. package/dist/cli/commands/plugin/link-watch.mjs.map +1 -0
  86. package/dist/cli/commands/plugin/verify.mjs +34 -0
  87. package/dist/cli/commands/plugin/verify.mjs.map +1 -0
  88. package/dist/cli/commands/plugin/watch.mjs +83 -0
  89. package/dist/cli/commands/plugin/watch.mjs.map +1 -0
  90. package/dist/cli/commands/policies/list.js +2 -2
  91. package/dist/cli/commands/policies/list.js.map +1 -1
  92. package/dist/cli/commands/policies/list.mjs +24 -0
  93. package/dist/cli/commands/policies/list.mjs.map +1 -0
  94. package/dist/cli/commands/report.js +2 -2
  95. package/dist/cli/commands/report.js.map +1 -1
  96. package/dist/cli/commands/report.mjs +35 -0
  97. package/dist/cli/commands/report.mjs.map +1 -0
  98. package/dist/cli/commands/routes/list.js +2 -2
  99. package/dist/cli/commands/routes/list.js.map +1 -1
  100. package/dist/cli/commands/routes/list.mjs +28 -0
  101. package/dist/cli/commands/routes/list.mjs.map +1 -0
  102. package/dist/cli/commands/services/list.js +2 -2
  103. package/dist/cli/commands/services/list.js.map +1 -1
  104. package/dist/cli/commands/services/list.mjs +24 -0
  105. package/dist/cli/commands/services/list.mjs.map +1 -0
  106. package/dist/cli/commands/start.js +1 -1
  107. package/dist/cli/commands/start.js.map +1 -1
  108. package/dist/cli/commands/start.mjs +24 -0
  109. package/dist/cli/commands/start.mjs.map +1 -0
  110. package/dist/cli/commands/telemetry/disable.mjs +67 -0
  111. package/dist/cli/commands/telemetry/disable.mjs.map +1 -0
  112. package/dist/cli/commands/telemetry/enable.mjs +86 -0
  113. package/dist/cli/commands/telemetry/enable.mjs.map +1 -0
  114. package/dist/cli/commands/templates/generate.mjs +74 -0
  115. package/dist/cli/commands/templates/generate.mjs.map +1 -0
  116. package/dist/cli/commands/transfer/action.mjs +131 -0
  117. package/dist/cli/commands/transfer/action.mjs.map +1 -0
  118. package/dist/cli/commands/transfer/command.mjs +84 -0
  119. package/dist/cli/commands/transfer/command.mjs.map +1 -0
  120. package/dist/cli/commands/ts/generate-types.js +2 -2
  121. package/dist/cli/commands/ts/generate-types.js.map +1 -1
  122. package/dist/cli/commands/ts/generate-types.mjs +35 -0
  123. package/dist/cli/commands/ts/generate-types.mjs.map +1 -0
  124. package/dist/cli/commands/version.mjs +13 -0
  125. package/dist/cli/commands/version.mjs.map +1 -0
  126. package/dist/cli/index.mjs +49 -0
  127. package/dist/cli/index.mjs.map +1 -0
  128. package/dist/cli/utils/commander.mjs +109 -0
  129. package/dist/cli/utils/commander.mjs.map +1 -0
  130. package/dist/cli/utils/data-transfer.js +2 -2
  131. package/dist/cli/utils/data-transfer.js.map +1 -1
  132. package/dist/cli/utils/data-transfer.mjs +339 -0
  133. package/dist/cli/utils/data-transfer.mjs.map +1 -0
  134. package/dist/cli/utils/helpers.mjs +100 -0
  135. package/dist/cli/utils/helpers.mjs.map +1 -0
  136. package/dist/cli/utils/logger.mjs +80 -0
  137. package/dist/cli/utils/logger.mjs.map +1 -0
  138. package/dist/cli/utils/pkg.d.ts.map +1 -1
  139. package/dist/cli/utils/pkg.js +18 -15
  140. package/dist/cli/utils/pkg.js.map +1 -1
  141. package/dist/cli/utils/pkg.mjs +87 -0
  142. package/dist/cli/utils/pkg.mjs.map +1 -0
  143. package/dist/cli/utils/telemetry.mjs +22 -0
  144. package/dist/cli/utils/telemetry.mjs.map +1 -0
  145. package/dist/cli/utils/tsconfig.mjs +23 -0
  146. package/dist/cli/utils/tsconfig.mjs.map +1 -0
  147. package/dist/node/build.mjs +58 -0
  148. package/dist/node/build.mjs.map +1 -0
  149. package/dist/node/core/admin-customisations.mjs +22 -0
  150. package/dist/node/core/admin-customisations.mjs.map +1 -0
  151. package/dist/node/core/aliases.d.ts.map +1 -1
  152. package/dist/node/core/aliases.js +3 -1
  153. package/dist/node/core/aliases.js.map +1 -1
  154. package/dist/node/core/aliases.mjs +30 -0
  155. package/dist/node/core/aliases.mjs.map +1 -0
  156. package/dist/node/core/config.mjs +16 -0
  157. package/dist/node/core/config.mjs.map +1 -0
  158. package/dist/node/core/dependencies.mjs +151 -0
  159. package/dist/node/core/dependencies.mjs.map +1 -0
  160. package/dist/node/core/env.d.ts.map +1 -1
  161. package/dist/node/core/env.js +7 -4
  162. package/dist/node/core/env.js.map +1 -1
  163. package/dist/node/core/env.mjs +23 -0
  164. package/dist/node/core/env.mjs.map +1 -0
  165. package/dist/node/core/errors.mjs +29 -0
  166. package/dist/node/core/errors.mjs.map +1 -0
  167. package/dist/node/core/files.mjs +43 -0
  168. package/dist/node/core/files.mjs.map +1 -0
  169. package/dist/node/core/managers.mjs +17 -0
  170. package/dist/node/core/managers.mjs.map +1 -0
  171. package/dist/node/core/monorepo.mjs +20 -0
  172. package/dist/node/core/monorepo.mjs.map +1 -0
  173. package/dist/node/core/plugins.mjs +93 -0
  174. package/dist/node/core/plugins.mjs.map +1 -0
  175. package/dist/node/core/timer.mjs +27 -0
  176. package/dist/node/core/timer.mjs.map +1 -0
  177. package/dist/node/create-build-context.js +1 -1
  178. package/dist/node/create-build-context.js.map +1 -1
  179. package/dist/node/create-build-context.mjs +91 -0
  180. package/dist/node/create-build-context.mjs.map +1 -0
  181. package/dist/node/develop.js +1 -1
  182. package/dist/node/develop.js.map +1 -1
  183. package/dist/node/develop.mjs +252 -0
  184. package/dist/node/develop.mjs.map +1 -0
  185. package/dist/node/staticFiles.d.ts.map +1 -1
  186. package/dist/node/staticFiles.js +25 -3
  187. package/dist/node/staticFiles.js.map +1 -1
  188. package/dist/node/staticFiles.mjs +76 -0
  189. package/dist/node/staticFiles.mjs.map +1 -0
  190. package/dist/node/vite/build.mjs +12 -0
  191. package/dist/node/vite/build.mjs.map +1 -0
  192. package/dist/node/vite/config.mjs +99 -0
  193. package/dist/node/vite/config.mjs.map +1 -0
  194. package/dist/node/vite/plugins.mjs +43 -0
  195. package/dist/node/vite/plugins.mjs.map +1 -0
  196. package/dist/node/vite/watch.mjs +52 -0
  197. package/dist/node/vite/watch.mjs.map +1 -0
  198. package/dist/node/webpack/build.mjs +39 -0
  199. package/dist/node/webpack/build.mjs.map +1 -0
  200. package/dist/node/webpack/config.mjs +228 -0
  201. package/dist/node/webpack/config.mjs.map +1 -0
  202. package/dist/node/webpack/watch.mjs +92 -0
  203. package/dist/node/webpack/watch.mjs.map +1 -0
  204. package/package.json +24 -24
@@ -0,0 +1,283 @@
1
+ import { outdent } from "outdent";
2
+ const PLUGIN_ICON_CODE = outdent`
3
+ import { Puzzle } from '@strapi/icons';
4
+
5
+ const PluginIcon = () => <Puzzle />;
6
+
7
+ export { PluginIcon };
8
+ `;
9
+ const APP_CODE = outdent`
10
+ import { Page } from '@strapi/strapi/admin';
11
+ import { Switch, Route } from 'react-router-dom';
12
+
13
+ import { PLUGIN_ID } from '../pluginId';
14
+
15
+ import { HomePage } from './HomePage';
16
+
17
+ const App = () => {
18
+ return (
19
+ <Switch>
20
+ <Route index element={<HomePage />} />
21
+ <Route path="*" element={<Page.Error />} />
22
+ </Switch>
23
+ );
24
+ };
25
+
26
+ export { App };
27
+ `;
28
+ const HOMEPAGE_CODE = outdent`
29
+ import { Main } from '@strapi/design-system';
30
+ import { useIntl } from 'react-intl';
31
+
32
+ import { getTranslation } from '../utils/getTranslation';
33
+
34
+ const HomePage = () => {
35
+ const { formatMessage } = useIntl();
36
+
37
+ return (
38
+ <Main>
39
+ <h1>Welcome to {formatMessage({ id: getTranslation("plugin.name") })}</h1>
40
+ </Main>
41
+ )
42
+ }
43
+
44
+ export { HomePage };
45
+ `;
46
+ const TYPESCRIPT = [
47
+ {
48
+ name: "admin/src/index.ts",
49
+ contents: outdent`
50
+ import { prefixPluginTranslations } from './utils/prefixPluginTranslations';
51
+ import { PLUGIN_ID } from './pluginId';
52
+ import { Initializer } from './components/Initializer';
53
+ import { PluginIcon } from './components/PluginIcon';
54
+
55
+ export default {
56
+ register(app: any) {
57
+ app.addMenuLink({
58
+ to: \`plugins/\${PLUGIN_ID}\`,
59
+ icon: PluginIcon,
60
+ intlLabel: {
61
+ id: \`\${PLUGIN_ID}.plugin.name\`,
62
+ defaultMessage: PLUGIN_ID,
63
+ },
64
+ Component: async () => {
65
+ const { App } = await import('./pages/App');
66
+
67
+ return App;
68
+ },
69
+ });
70
+
71
+ app.registerPlugin({
72
+ id: PLUGIN_ID,
73
+ initializer: Initializer,
74
+ isReady: false,
75
+ name: PLUGIN_ID,
76
+ });
77
+ },
78
+
79
+ async registerTrads(app: any) {
80
+ const { locales } = app;
81
+
82
+ const importedTranslations = await Promise.all(
83
+ (locales as string[]).map((locale) => {
84
+ return import(\`./translations/\${locale}.json\`)
85
+ .then(({ default: data }) => {
86
+ return {
87
+ data: prefixPluginTranslations(data, PLUGIN_ID),
88
+ locale,
89
+ };
90
+ })
91
+ .catch(() => {
92
+ return {
93
+ data: {},
94
+ locale,
95
+ };
96
+ });
97
+ })
98
+ );
99
+
100
+ return importedTranslations;
101
+ },
102
+ };
103
+ `
104
+ },
105
+ {
106
+ name: "admin/src/components/PluginIcon.tsx",
107
+ contents: PLUGIN_ICON_CODE
108
+ },
109
+ {
110
+ name: "admin/src/components/Initializer.tsx",
111
+ contents: outdent`
112
+ import { useEffect, useRef } from 'react';
113
+
114
+ import { PLUGIN_ID } from '../pluginId';
115
+
116
+ type InitializerProps = {
117
+ setPlugin: (id: string) => void;
118
+ };
119
+
120
+ const Initializer = ({ setPlugin }: InitializerProps) => {
121
+ const ref = useRef(setPlugin);
122
+
123
+ useEffect(() => {
124
+ ref.current(PLUGIN_ID);
125
+ }, []);
126
+
127
+ return null;
128
+ };
129
+
130
+ export { Initializer };
131
+ `
132
+ },
133
+ {
134
+ name: "admin/src/pages/App.tsx",
135
+ contents: APP_CODE
136
+ },
137
+ {
138
+ name: "admin/src/pages/HomePage.tsx",
139
+ contents: HOMEPAGE_CODE
140
+ },
141
+ {
142
+ name: "admin/src/utils/getTranslation.ts",
143
+ contents: outdent`
144
+ import { PLUGIN_ID } from '../pluginId';
145
+
146
+ const getTranslation = (id: string) => \`\${PLUGIN_ID}.\${id}\`;
147
+
148
+ export { getTranslation };
149
+ `
150
+ },
151
+ {
152
+ name: "admin/src/translations/en.json",
153
+ contents: outdent`
154
+ {}
155
+ `
156
+ },
157
+ {
158
+ /**
159
+ * TODO: remove this when we release design-system V2
160
+ */
161
+ name: "admin/custom.d.ts",
162
+ contents: outdent`
163
+ declare module '@strapi/design-system/*';
164
+ declare module '@strapi/design-system';
165
+ `
166
+ }
167
+ ];
168
+ const JAVASCRIPT = [
169
+ {
170
+ name: "admin/src/index.js",
171
+ contents: outdent`
172
+ import { prefixPluginTranslations } from './utils/prefixPluginTranslations';
173
+ import { PLUGIN_ID } from './pluginId';
174
+ import { Initializer } from './components/Initializer';
175
+ import { PluginIcon } from './components/PluginIcon';
176
+
177
+ export default {
178
+ register(app) {
179
+ app.addMenuLink({
180
+ to: \`plugins/\${PluginIcon}\`,
181
+ icon: PluginIcon,
182
+ intlLabel: {
183
+ id: \`\${PLUGIN_ID}.plugin.name\`,
184
+ defaultMessage: PLUGIN_ID,
185
+ },
186
+ Component: async () => {
187
+ const { App } = await import('./pages/App');
188
+
189
+ return App;
190
+ },
191
+ });
192
+
193
+ app.registerPlugin({
194
+ id: PLUGIN_ID,
195
+ initializer: Initializer,
196
+ isReady: false,
197
+ name: PLUGIN_ID,
198
+ });
199
+ },
200
+
201
+ async registerTrads(app) {
202
+ const { locales } = app;
203
+
204
+ const importedTranslations = await Promise.all(
205
+ locales.map((locale) => {
206
+ return import(\`./translations/\${locale}.json\`)
207
+ .then(({ default: data }) => {
208
+ return {
209
+ data: prefixPluginTranslations(data, PLUGIN_ID),
210
+ locale,
211
+ };
212
+ })
213
+ .catch(() => {
214
+ return {
215
+ data: {},
216
+ locale,
217
+ };
218
+ });
219
+ })
220
+ );
221
+
222
+ return importedTranslations;
223
+ },
224
+ };
225
+ `
226
+ },
227
+ {
228
+ name: "admin/src/components/PluginIcon.jsx",
229
+ contents: PLUGIN_ICON_CODE
230
+ },
231
+ {
232
+ name: "admin/src/components/Initializer.jsx",
233
+ contents: outdent`
234
+ import { useEffect, useRef } from 'react';
235
+
236
+ import { PLUGIN_ID } from '../pluginId';
237
+
238
+ /**
239
+ * @type {import('react').FC<{ setPlugin: (id: string) => void }>}
240
+ */
241
+ const Initializer = ({ setPlugin }) => {
242
+ const ref = useRef(setPlugin);
243
+
244
+ useEffect(() => {
245
+ ref.current(PLUGIN_ID);
246
+ }, []);
247
+
248
+ return null;
249
+ };
250
+
251
+ export { Initializer };
252
+ `
253
+ },
254
+ {
255
+ name: "admin/src/pages/App.jsx",
256
+ contents: APP_CODE
257
+ },
258
+ {
259
+ name: "admin/src/pages/HomePage.jsx",
260
+ contents: HOMEPAGE_CODE
261
+ },
262
+ {
263
+ name: "admin/src/utils/getTranslation.js",
264
+ contents: outdent`
265
+ import { PLUGIN_ID } from '../pluginId';
266
+
267
+ const getTranslation = (id) => \`\${PLUGIN_ID}.\${id}\`;
268
+
269
+ export { getTranslation };
270
+ `
271
+ },
272
+ {
273
+ name: "admin/src/translations/en.json",
274
+ contents: outdent`
275
+ {}
276
+ `
277
+ }
278
+ ];
279
+ export {
280
+ JAVASCRIPT as adminJavascriptFiles,
281
+ TYPESCRIPT as adminTypescriptFiles
282
+ };
283
+ //# sourceMappingURL=admin.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"admin.mjs","sources":["../../../../../../src/cli/commands/plugin/init/files/admin.ts"],"sourcesContent":["import { TemplateFile } from '@strapi/pack-up';\nimport { outdent } from 'outdent';\n\nconst PLUGIN_ICON_CODE = outdent`\nimport { Puzzle } from '@strapi/icons';\n\nconst PluginIcon = () => <Puzzle />;\n\nexport { PluginIcon };\n`;\n\nconst APP_CODE = outdent`\nimport { Page } from '@strapi/strapi/admin';\nimport { Switch, Route } from 'react-router-dom';\n\nimport { PLUGIN_ID } from '../pluginId';\n\nimport { HomePage } from './HomePage';\n\nconst App = () => {\n return (\n <Switch>\n <Route index element={<HomePage />} />\n <Route path=\"*\" element={<Page.Error />} />\n </Switch>\n );\n};\n\nexport { App };\n`;\n\nconst HOMEPAGE_CODE = outdent`\n import { Main } from '@strapi/design-system';\n import { useIntl } from 'react-intl';\n\n import { getTranslation } from '../utils/getTranslation';\n\n const HomePage = () => {\n const { formatMessage } = useIntl();\n\n return (\n <Main>\n <h1>Welcome to {formatMessage({ id: getTranslation(\"plugin.name\") })}</h1>\n </Main>\n )\n }\n\n export { HomePage };\n`;\n\nconst TYPESCRIPT: TemplateFile[] = [\n {\n name: 'admin/src/index.ts',\n contents: outdent`\n import { prefixPluginTranslations } from './utils/prefixPluginTranslations';\n import { PLUGIN_ID } from './pluginId';\n import { Initializer } from './components/Initializer';\n import { PluginIcon } from './components/PluginIcon';\n \n export default {\n register(app: any) {\n app.addMenuLink({\n to: \\`plugins/\\${PLUGIN_ID}\\`,\n icon: PluginIcon,\n intlLabel: {\n id: \\`\\${PLUGIN_ID}.plugin.name\\`,\n defaultMessage: PLUGIN_ID,\n },\n Component: async () => {\n const { App } = await import('./pages/App');\n \n return App;\n },\n });\n \n app.registerPlugin({\n id: PLUGIN_ID,\n initializer: Initializer,\n isReady: false,\n name: PLUGIN_ID,\n });\n },\n \n async registerTrads(app: any) {\n const { locales } = app;\n \n const importedTranslations = await Promise.all(\n (locales as string[]).map((locale) => {\n return import(\\`./translations/\\${locale}.json\\`)\n .then(({ default: data }) => {\n return {\n data: prefixPluginTranslations(data, PLUGIN_ID),\n locale,\n };\n })\n .catch(() => {\n return {\n data: {},\n locale,\n };\n });\n })\n );\n \n return importedTranslations;\n },\n };\n `,\n },\n {\n name: 'admin/src/components/PluginIcon.tsx',\n contents: PLUGIN_ICON_CODE,\n },\n {\n name: 'admin/src/components/Initializer.tsx',\n contents: outdent`\n import { useEffect, useRef } from 'react';\n\n import { PLUGIN_ID } from '../pluginId';\n \n type InitializerProps = {\n setPlugin: (id: string) => void;\n };\n \n const Initializer = ({ setPlugin }: InitializerProps) => {\n const ref = useRef(setPlugin);\n \n useEffect(() => {\n ref.current(PLUGIN_ID);\n }, []);\n \n return null;\n };\n \n export { Initializer };\n `,\n },\n {\n name: 'admin/src/pages/App.tsx',\n contents: APP_CODE,\n },\n {\n name: 'admin/src/pages/HomePage.tsx',\n contents: HOMEPAGE_CODE,\n },\n {\n name: 'admin/src/utils/getTranslation.ts',\n contents: outdent`\n import { PLUGIN_ID } from '../pluginId';\n\n const getTranslation = (id: string) => \\`\\${PLUGIN_ID}.\\${id}\\`;\n\n export { getTranslation };\n `,\n },\n {\n name: 'admin/src/translations/en.json',\n contents: outdent`\n {}\n `,\n },\n {\n /**\n * TODO: remove this when we release design-system V2\n */\n name: 'admin/custom.d.ts',\n contents: outdent`\n declare module '@strapi/design-system/*';\n declare module '@strapi/design-system';\n `,\n },\n];\n\nconst JAVASCRIPT: TemplateFile[] = [\n {\n name: 'admin/src/index.js',\n contents: outdent`\n import { prefixPluginTranslations } from './utils/prefixPluginTranslations';\n import { PLUGIN_ID } from './pluginId';\n import { Initializer } from './components/Initializer';\n import { PluginIcon } from './components/PluginIcon';\n \n export default {\n register(app) {\n app.addMenuLink({\n to: \\`plugins/\\${PluginIcon}\\`,\n icon: PluginIcon,\n intlLabel: {\n id: \\`\\${PLUGIN_ID}.plugin.name\\`,\n defaultMessage: PLUGIN_ID,\n },\n Component: async () => {\n const { App } = await import('./pages/App');\n \n return App;\n },\n });\n \n app.registerPlugin({\n id: PLUGIN_ID,\n initializer: Initializer,\n isReady: false,\n name: PLUGIN_ID,\n });\n },\n \n async registerTrads(app) {\n const { locales } = app;\n \n const importedTranslations = await Promise.all(\n locales.map((locale) => {\n return import(\\`./translations/\\${locale}.json\\`)\n .then(({ default: data }) => {\n return {\n data: prefixPluginTranslations(data, PLUGIN_ID),\n locale,\n };\n })\n .catch(() => {\n return {\n data: {},\n locale,\n };\n });\n })\n );\n \n return importedTranslations;\n },\n };\n `,\n },\n {\n name: 'admin/src/components/PluginIcon.jsx',\n contents: PLUGIN_ICON_CODE,\n },\n {\n name: 'admin/src/components/Initializer.jsx',\n contents: outdent`\n import { useEffect, useRef } from 'react';\n \n import { PLUGIN_ID } from '../pluginId';\n \n /**\n * @type {import('react').FC<{ setPlugin: (id: string) => void }>}\n */ \n const Initializer = ({ setPlugin }) => {\n const ref = useRef(setPlugin);\n \n useEffect(() => {\n ref.current(PLUGIN_ID);\n }, []);\n \n return null;\n };\n \n export { Initializer };\n `,\n },\n {\n name: 'admin/src/pages/App.jsx',\n contents: APP_CODE,\n },\n {\n name: 'admin/src/pages/HomePage.jsx',\n contents: HOMEPAGE_CODE,\n },\n {\n name: 'admin/src/utils/getTranslation.js',\n contents: outdent`\n import { PLUGIN_ID } from '../pluginId';\n \n const getTranslation = (id) => \\`\\${PLUGIN_ID}.\\${id}\\`;\n \n export { getTranslation };\n `,\n },\n {\n name: 'admin/src/translations/en.json',\n contents: outdent`\n {}\n `,\n },\n];\n\nexport { TYPESCRIPT as adminTypescriptFiles, JAVASCRIPT as adminJavascriptFiles };\n"],"names":[],"mappings":";AAGA,MAAM,mBAAmB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAQzB,MAAM,WAAW;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAoBjB,MAAM,gBAAgB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAmBtB,MAAM,aAA6B;AAAA,EACjC;AAAA,IACE,MAAM;AAAA,IACN,UAAU;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAuDZ;AAAA,EACA;AAAA,IACE,MAAM;AAAA,IACN,UAAU;AAAA,EACZ;AAAA,EACA;AAAA,IACE,MAAM;AAAA,IACN,UAAU;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAqBZ;AAAA,EACA;AAAA,IACE,MAAM;AAAA,IACN,UAAU;AAAA,EACZ;AAAA,EACA;AAAA,IACE,MAAM;AAAA,IACN,UAAU;AAAA,EACZ;AAAA,EACA;AAAA,IACE,MAAM;AAAA,IACN,UAAU;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOZ;AAAA,EACA;AAAA,IACE,MAAM;AAAA,IACN,UAAU;AAAA;AAAA;AAAA,EAGZ;AAAA,EACA;AAAA;AAAA;AAAA;AAAA,IAIE,MAAM;AAAA,IACN,UAAU;AAAA;AAAA;AAAA;AAAA,EAIZ;AACF;AAEA,MAAM,aAA6B;AAAA,EACjC;AAAA,IACE,MAAM;AAAA,IACN,UAAU;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAuDZ;AAAA,EACA;AAAA,IACE,MAAM;AAAA,IACN,UAAU;AAAA,EACZ;AAAA,EACA;AAAA,IACE,MAAM;AAAA,IACN,UAAU;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAoBZ;AAAA,EACA;AAAA,IACE,MAAM;AAAA,IACN,UAAU;AAAA,EACZ;AAAA,EACA;AAAA,IACE,MAAM;AAAA,IACN,UAAU;AAAA,EACZ;AAAA,EACA;AAAA,IACE,MAAM;AAAA,IACN,UAAU;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOZ;AAAA,EACA;AAAA,IACE,MAAM;AAAA,IACN,UAAU;AAAA;AAAA;AAAA,EAGZ;AACF;"}
@@ -0,0 +1,26 @@
1
+ import { outdent } from "outdent";
2
+ const editorConfigFile = {
3
+ name: ".editorconfig",
4
+ contents: outdent`
5
+ root = true
6
+
7
+ [*]
8
+ indent_style = space
9
+ indent_size = 2
10
+ end_of_line = lf
11
+ charset = utf-8
12
+ trim_trailing_whitespace = true
13
+ insert_final_newline = true
14
+
15
+ [{package.json,*.yml}]
16
+ indent_style = space
17
+ indent_size = 2
18
+
19
+ [*.md]
20
+ trim_trailing_whitespace = false
21
+ `
22
+ };
23
+ export {
24
+ editorConfigFile
25
+ };
26
+ //# sourceMappingURL=editorConfig.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"editorConfig.mjs","sources":["../../../../../../src/cli/commands/plugin/init/files/editorConfig.ts"],"sourcesContent":["import { TemplateFile } from '@strapi/pack-up';\nimport { outdent } from 'outdent';\n\nconst editorConfigFile: TemplateFile = {\n name: '.editorconfig',\n contents: outdent`\n root = true\n\n [*]\n indent_style = space\n indent_size = 2\n end_of_line = lf\n charset = utf-8\n trim_trailing_whitespace = true\n insert_final_newline = true\n \n [{package.json,*.yml}]\n indent_style = space\n indent_size = 2\n \n [*.md]\n trim_trailing_whitespace = false\n `,\n};\n\nexport { editorConfigFile };\n"],"names":[],"mappings":";AAGA,MAAM,mBAAiC;AAAA,EACrC,MAAM;AAAA,EACN,UAAU;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAkBZ;"}
@@ -0,0 +1,11 @@
1
+ import { outdent } from "outdent";
2
+ const eslintIgnoreFile = {
3
+ name: ".eslintignore",
4
+ contents: outdent`
5
+ dist
6
+ `
7
+ };
8
+ export {
9
+ eslintIgnoreFile
10
+ };
11
+ //# sourceMappingURL=eslint.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"eslint.mjs","sources":["../../../../../../src/cli/commands/plugin/init/files/eslint.ts"],"sourcesContent":["import { TemplateFile } from '@strapi/pack-up';\nimport { outdent } from 'outdent';\n\nconst eslintIgnoreFile: TemplateFile = {\n name: '.eslintignore',\n contents: outdent`\n dist\n `,\n};\n\nexport { eslintIgnoreFile };\n"],"names":[],"mappings":";AAGA,MAAM,mBAAiC;AAAA,EACrC,MAAM;AAAA,EACN,UAAU;AAAA;AAAA;AAGZ;"}
@@ -0,0 +1,34 @@
1
+ import { outdent } from "outdent";
2
+ const gitIgnoreFile = {
3
+ name: ".gitignore",
4
+ contents: outdent`
5
+ # See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
6
+
7
+ # dependencies
8
+ node_modules
9
+ .pnp
10
+ .pnp.js
11
+
12
+ # testing
13
+ coverage
14
+
15
+ # production
16
+ dist
17
+
18
+ # misc
19
+ .DS_Store
20
+ *.pem
21
+
22
+ # debug
23
+ npm-debug.log*
24
+ yarn-debug.log*
25
+ yarn-error.log*
26
+
27
+ # local env files
28
+ .env
29
+ `
30
+ };
31
+ export {
32
+ gitIgnoreFile
33
+ };
34
+ //# sourceMappingURL=gitIgnore.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"gitIgnore.mjs","sources":["../../../../../../src/cli/commands/plugin/init/files/gitIgnore.ts"],"sourcesContent":["import { TemplateFile } from '@strapi/pack-up';\nimport { outdent } from 'outdent';\n\nconst gitIgnoreFile: TemplateFile = {\n name: '.gitignore',\n contents: outdent`\n # See https://help.github.com/articles/ignoring-files/ for more about ignoring files.\n\n # dependencies\n node_modules\n .pnp\n .pnp.js\n \n # testing\n coverage\n \n # production\n dist\n \n # misc\n .DS_Store\n *.pem\n \n # debug\n npm-debug.log*\n yarn-debug.log*\n yarn-error.log*\n \n # local env files\n .env \n `,\n};\n\nexport { gitIgnoreFile };\n"],"names":[],"mappings":";AAGA,MAAM,gBAA8B;AAAA,EAClC,MAAM;AAAA,EACN,UAAU;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AA0BZ;"}
@@ -0,0 +1,25 @@
1
+ import { outdent } from "outdent";
2
+ const prettierFile = {
3
+ name: ".prettierrc",
4
+ contents: outdent`
5
+ {
6
+ "endOfLine": 'lf',
7
+ "tabWidth": 2,
8
+ "printWidth": 100,
9
+ "singleQuote": true,
10
+ "trailingComma": 'es5',
11
+ }
12
+ `
13
+ };
14
+ const prettierIgnoreFile = {
15
+ name: ".prettierignore",
16
+ contents: outdent`
17
+ dist
18
+ coverage
19
+ `
20
+ };
21
+ export {
22
+ prettierFile,
23
+ prettierIgnoreFile
24
+ };
25
+ //# sourceMappingURL=prettier.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"prettier.mjs","sources":["../../../../../../src/cli/commands/plugin/init/files/prettier.ts"],"sourcesContent":["import { TemplateFile } from '@strapi/pack-up';\nimport { outdent } from 'outdent';\n\nconst prettierFile: TemplateFile = {\n name: '.prettierrc',\n contents: outdent`\n {\n \"endOfLine\": 'lf',\n \"tabWidth\": 2,\n \"printWidth\": 100,\n \"singleQuote\": true,\n \"trailingComma\": 'es5',\n }\n `,\n};\n\nconst prettierIgnoreFile: TemplateFile = {\n name: '.prettierignore',\n contents: outdent`\n dist\n coverage\n `,\n};\n\nexport { prettierFile, prettierIgnoreFile };\n"],"names":[],"mappings":";AAGA,MAAM,eAA6B;AAAA,EACjC,MAAM;AAAA,EACN,UAAU;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AASZ;AAEA,MAAM,qBAAmC;AAAA,EACvC,MAAM;AAAA,EACN,UAAU;AAAA;AAAA;AAAA;AAIZ;"}