@strapi/strapi 5.0.0-beta.0 → 5.0.0-beta.10

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 (258) hide show
  1. package/README.md +4 -4
  2. package/dist/admin.d.ts.map +1 -1
  3. package/dist/admin.js +12 -4
  4. package/dist/admin.js.map +1 -1
  5. package/dist/admin.mjs +10 -4
  6. package/dist/admin.mjs.map +1 -1
  7. package/dist/cli/commands/admin/create-user.js +2 -2
  8. package/dist/cli/commands/admin/create-user.js.map +1 -1
  9. package/dist/cli/commands/admin/create-user.mjs +88 -0
  10. package/dist/cli/commands/admin/create-user.mjs.map +1 -0
  11. package/dist/cli/commands/admin/reset-user-password.js +2 -2
  12. package/dist/cli/commands/admin/reset-user-password.js.map +1 -1
  13. package/dist/cli/commands/admin/reset-user-password.mjs +44 -0
  14. package/dist/cli/commands/admin/reset-user-password.mjs.map +1 -0
  15. package/dist/cli/commands/build.js.map +1 -1
  16. package/dist/cli/commands/build.mjs +30 -0
  17. package/dist/cli/commands/build.mjs.map +1 -0
  18. package/dist/cli/commands/components/list.js +2 -2
  19. package/dist/cli/commands/components/list.js.map +1 -1
  20. package/dist/cli/commands/components/list.mjs +24 -0
  21. package/dist/cli/commands/components/list.mjs.map +1 -0
  22. package/dist/cli/commands/configuration/dump.js +2 -2
  23. package/dist/cli/commands/configuration/dump.js.map +1 -1
  24. package/dist/cli/commands/configuration/dump.mjs +41 -0
  25. package/dist/cli/commands/configuration/dump.mjs.map +1 -0
  26. package/dist/cli/commands/configuration/restore.js +2 -2
  27. package/dist/cli/commands/configuration/restore.js.map +1 -1
  28. package/dist/cli/commands/configuration/restore.mjs +140 -0
  29. package/dist/cli/commands/configuration/restore.mjs.map +1 -0
  30. package/dist/cli/commands/console.js +2 -2
  31. package/dist/cli/commands/console.js.map +1 -1
  32. package/dist/cli/commands/console.mjs +27 -0
  33. package/dist/cli/commands/console.mjs.map +1 -0
  34. package/dist/cli/commands/content-types/list.js +2 -2
  35. package/dist/cli/commands/content-types/list.js.map +1 -1
  36. package/dist/cli/commands/content-types/list.mjs +24 -0
  37. package/dist/cli/commands/content-types/list.mjs.map +1 -0
  38. package/dist/cli/commands/controllers/list.js +2 -2
  39. package/dist/cli/commands/controllers/list.js.map +1 -1
  40. package/dist/cli/commands/controllers/list.mjs +24 -0
  41. package/dist/cli/commands/controllers/list.mjs.map +1 -0
  42. package/dist/cli/commands/develop.js.map +1 -1
  43. package/dist/cli/commands/develop.mjs +27 -0
  44. package/dist/cli/commands/develop.mjs.map +1 -0
  45. package/dist/cli/commands/export/action.js.map +1 -1
  46. package/dist/cli/commands/export/action.mjs +116 -0
  47. package/dist/cli/commands/export/action.mjs.map +1 -0
  48. package/dist/cli/commands/export/command.mjs +24 -0
  49. package/dist/cli/commands/export/command.mjs.map +1 -0
  50. package/dist/cli/commands/generate.mjs +13 -0
  51. package/dist/cli/commands/generate.mjs.map +1 -0
  52. package/dist/cli/commands/hooks/list.js +2 -2
  53. package/dist/cli/commands/hooks/list.js.map +1 -1
  54. package/dist/cli/commands/hooks/list.mjs +24 -0
  55. package/dist/cli/commands/hooks/list.mjs.map +1 -0
  56. package/dist/cli/commands/import/action.js.map +1 -1
  57. package/dist/cli/commands/import/action.mjs +105 -0
  58. package/dist/cli/commands/import/action.mjs.map +1 -0
  59. package/dist/cli/commands/import/command.mjs +68 -0
  60. package/dist/cli/commands/import/command.mjs.map +1 -0
  61. package/dist/cli/commands/index.d.ts.map +1 -1
  62. package/dist/cli/commands/index.js +1 -14
  63. package/dist/cli/commands/index.js.map +1 -1
  64. package/dist/cli/commands/index.mjs +58 -0
  65. package/dist/cli/commands/index.mjs.map +1 -0
  66. package/dist/cli/commands/middlewares/list.js +2 -2
  67. package/dist/cli/commands/middlewares/list.js.map +1 -1
  68. package/dist/cli/commands/middlewares/list.mjs +24 -0
  69. package/dist/cli/commands/middlewares/list.mjs.map +1 -0
  70. package/dist/cli/commands/plugin/init/files/typescript.d.ts.map +1 -1
  71. package/dist/cli/commands/policies/list.js +2 -2
  72. package/dist/cli/commands/policies/list.js.map +1 -1
  73. package/dist/cli/commands/policies/list.mjs +24 -0
  74. package/dist/cli/commands/policies/list.mjs.map +1 -0
  75. package/dist/cli/commands/report.js +2 -2
  76. package/dist/cli/commands/report.js.map +1 -1
  77. package/dist/cli/commands/report.mjs +35 -0
  78. package/dist/cli/commands/report.mjs.map +1 -0
  79. package/dist/cli/commands/routes/list.js +2 -2
  80. package/dist/cli/commands/routes/list.js.map +1 -1
  81. package/dist/cli/commands/routes/list.mjs +28 -0
  82. package/dist/cli/commands/routes/list.mjs.map +1 -0
  83. package/dist/cli/commands/services/list.js +2 -2
  84. package/dist/cli/commands/services/list.js.map +1 -1
  85. package/dist/cli/commands/services/list.mjs +24 -0
  86. package/dist/cli/commands/services/list.mjs.map +1 -0
  87. package/dist/cli/commands/start.js +1 -1
  88. package/dist/cli/commands/start.js.map +1 -1
  89. package/dist/cli/commands/start.mjs +24 -0
  90. package/dist/cli/commands/start.mjs.map +1 -0
  91. package/dist/cli/commands/telemetry/disable.mjs +67 -0
  92. package/dist/cli/commands/telemetry/disable.mjs.map +1 -0
  93. package/dist/cli/commands/telemetry/enable.mjs +86 -0
  94. package/dist/cli/commands/telemetry/enable.mjs.map +1 -0
  95. package/dist/cli/commands/templates/generate.mjs +74 -0
  96. package/dist/cli/commands/templates/generate.mjs.map +1 -0
  97. package/dist/cli/commands/transfer/action.mjs +131 -0
  98. package/dist/cli/commands/transfer/action.mjs.map +1 -0
  99. package/dist/cli/commands/transfer/command.mjs +84 -0
  100. package/dist/cli/commands/transfer/command.mjs.map +1 -0
  101. package/dist/cli/commands/ts/generate-types.d.ts.map +1 -1
  102. package/dist/cli/commands/ts/generate-types.js +4 -5
  103. package/dist/cli/commands/ts/generate-types.js.map +1 -1
  104. package/dist/cli/commands/ts/generate-types.mjs +34 -0
  105. package/dist/cli/commands/ts/generate-types.mjs.map +1 -0
  106. package/dist/cli/commands/version.mjs +13 -0
  107. package/dist/cli/commands/version.mjs.map +1 -0
  108. package/dist/cli/index.d.ts.map +1 -1
  109. package/dist/cli/index.js +30 -0
  110. package/dist/cli/index.js.map +1 -1
  111. package/dist/cli/index.mjs +79 -0
  112. package/dist/cli/index.mjs.map +1 -0
  113. package/dist/cli/utils/commander.d.ts +2 -2
  114. package/dist/cli/utils/commander.d.ts.map +1 -1
  115. package/dist/cli/utils/commander.mjs +109 -0
  116. package/dist/cli/utils/commander.mjs.map +1 -0
  117. package/dist/cli/utils/data-transfer.d.ts +5 -5
  118. package/dist/cli/utils/data-transfer.d.ts.map +1 -1
  119. package/dist/cli/utils/data-transfer.js +32 -24
  120. package/dist/cli/utils/data-transfer.js.map +1 -1
  121. package/dist/cli/utils/data-transfer.mjs +347 -0
  122. package/dist/cli/utils/data-transfer.mjs.map +1 -0
  123. package/dist/cli/utils/helpers.d.ts +1 -1
  124. package/dist/cli/utils/helpers.d.ts.map +1 -1
  125. package/dist/cli/utils/helpers.mjs +100 -0
  126. package/dist/cli/utils/helpers.mjs.map +1 -0
  127. package/dist/cli/utils/logger.mjs +80 -0
  128. package/dist/cli/utils/logger.mjs.map +1 -0
  129. package/dist/cli/utils/pkg.d.ts.map +1 -1
  130. package/dist/cli/utils/telemetry.mjs +22 -0
  131. package/dist/cli/utils/telemetry.mjs.map +1 -0
  132. package/dist/cli/utils/tsconfig.d.ts.map +1 -1
  133. package/dist/cli/utils/tsconfig.mjs +23 -0
  134. package/dist/cli/utils/tsconfig.mjs.map +1 -0
  135. package/dist/node/build.mjs +58 -0
  136. package/dist/node/build.mjs.map +1 -0
  137. package/dist/node/core/admin-customisations.mjs +22 -0
  138. package/dist/node/core/admin-customisations.mjs.map +1 -0
  139. package/dist/node/core/aliases.d.ts +1 -1
  140. package/dist/node/core/aliases.d.ts.map +1 -1
  141. package/dist/node/core/aliases.js +8 -5
  142. package/dist/node/core/aliases.js.map +1 -1
  143. package/dist/node/core/aliases.mjs +31 -0
  144. package/dist/node/core/aliases.mjs.map +1 -0
  145. package/dist/node/core/config.d.ts.map +1 -1
  146. package/dist/node/core/config.mjs +16 -0
  147. package/dist/node/core/config.mjs.map +1 -0
  148. package/dist/node/core/dependencies.d.ts.map +1 -1
  149. package/dist/node/core/dependencies.js +5 -1
  150. package/dist/node/core/dependencies.js.map +1 -1
  151. package/dist/node/core/dependencies.mjs +155 -0
  152. package/dist/node/core/dependencies.mjs.map +1 -0
  153. package/dist/node/core/env.d.ts.map +1 -1
  154. package/dist/node/core/env.js +7 -4
  155. package/dist/node/core/env.js.map +1 -1
  156. package/dist/node/core/env.mjs +23 -0
  157. package/dist/node/core/env.mjs.map +1 -0
  158. package/dist/node/core/errors.mjs +29 -0
  159. package/dist/node/core/errors.mjs.map +1 -0
  160. package/dist/node/core/files.mjs +43 -0
  161. package/dist/node/core/files.mjs.map +1 -0
  162. package/dist/node/core/managers.mjs +17 -0
  163. package/dist/node/core/managers.mjs.map +1 -0
  164. package/dist/node/core/monorepo.mjs +20 -0
  165. package/dist/node/core/monorepo.mjs.map +1 -0
  166. package/dist/node/core/plugins.mjs +93 -0
  167. package/dist/node/core/plugins.mjs.map +1 -0
  168. package/dist/node/core/timer.mjs +27 -0
  169. package/dist/node/core/timer.mjs.map +1 -0
  170. package/dist/node/create-build-context.d.ts +3 -3
  171. package/dist/node/create-build-context.d.ts.map +1 -1
  172. package/dist/node/create-build-context.js +1 -1
  173. package/dist/node/create-build-context.js.map +1 -1
  174. package/dist/node/create-build-context.mjs +91 -0
  175. package/dist/node/create-build-context.mjs.map +1 -0
  176. package/dist/node/develop.d.ts.map +1 -1
  177. package/dist/node/develop.js +7 -1
  178. package/dist/node/develop.js.map +1 -1
  179. package/dist/node/develop.mjs +252 -0
  180. package/dist/node/develop.mjs.map +1 -0
  181. package/dist/node/staticFiles.d.ts.map +1 -1
  182. package/dist/node/staticFiles.js +25 -3
  183. package/dist/node/staticFiles.js.map +1 -1
  184. package/dist/node/staticFiles.mjs +76 -0
  185. package/dist/node/staticFiles.mjs.map +1 -0
  186. package/dist/node/types.d.ts +2 -2
  187. package/dist/node/types.d.ts.map +1 -1
  188. package/dist/node/vite/build.mjs +12 -0
  189. package/dist/node/vite/build.mjs.map +1 -0
  190. package/dist/node/vite/config.mjs +99 -0
  191. package/dist/node/vite/config.mjs.map +1 -0
  192. package/dist/node/vite/plugins.mjs +43 -0
  193. package/dist/node/vite/plugins.mjs.map +1 -0
  194. package/dist/node/vite/watch.js.map +1 -1
  195. package/dist/node/vite/watch.mjs +52 -0
  196. package/dist/node/vite/watch.mjs.map +1 -0
  197. package/dist/node/webpack/build.mjs +39 -0
  198. package/dist/node/webpack/build.mjs.map +1 -0
  199. package/dist/node/webpack/config.mjs +228 -0
  200. package/dist/node/webpack/config.mjs.map +1 -0
  201. package/dist/node/webpack/watch.js.map +1 -1
  202. package/dist/node/webpack/watch.mjs +92 -0
  203. package/dist/node/webpack/watch.mjs.map +1 -0
  204. package/package.json +35 -40
  205. package/dist/cli/commands/plugin/build.d.ts +0 -7
  206. package/dist/cli/commands/plugin/build.d.ts.map +0 -1
  207. package/dist/cli/commands/plugin/build.js +0 -88
  208. package/dist/cli/commands/plugin/build.js.map +0 -1
  209. package/dist/cli/commands/plugin/init/action.d.ts +0 -7
  210. package/dist/cli/commands/plugin/init/action.d.ts.map +0 -1
  211. package/dist/cli/commands/plugin/init/action.js +0 -414
  212. package/dist/cli/commands/plugin/init/action.js.map +0 -1
  213. package/dist/cli/commands/plugin/init/command.d.ts +0 -7
  214. package/dist/cli/commands/plugin/init/command.d.ts.map +0 -1
  215. package/dist/cli/commands/plugin/init/command.js +0 -9
  216. package/dist/cli/commands/plugin/init/command.js.map +0 -1
  217. package/dist/cli/commands/plugin/init/files/admin.d.ts +0 -5
  218. package/dist/cli/commands/plugin/init/files/admin.d.ts.map +0 -1
  219. package/dist/cli/commands/plugin/init/files/admin.js +0 -283
  220. package/dist/cli/commands/plugin/init/files/admin.js.map +0 -1
  221. package/dist/cli/commands/plugin/init/files/editorConfig.d.ts +0 -4
  222. package/dist/cli/commands/plugin/init/files/editorConfig.d.ts.map +0 -1
  223. package/dist/cli/commands/plugin/init/files/editorConfig.js +0 -26
  224. package/dist/cli/commands/plugin/init/files/editorConfig.js.map +0 -1
  225. package/dist/cli/commands/plugin/init/files/eslint.d.ts +0 -4
  226. package/dist/cli/commands/plugin/init/files/eslint.d.ts.map +0 -1
  227. package/dist/cli/commands/plugin/init/files/eslint.js +0 -11
  228. package/dist/cli/commands/plugin/init/files/eslint.js.map +0 -1
  229. package/dist/cli/commands/plugin/init/files/gitIgnore.d.ts +0 -4
  230. package/dist/cli/commands/plugin/init/files/gitIgnore.d.ts.map +0 -1
  231. package/dist/cli/commands/plugin/init/files/gitIgnore.js +0 -34
  232. package/dist/cli/commands/plugin/init/files/gitIgnore.js.map +0 -1
  233. package/dist/cli/commands/plugin/init/files/prettier.d.ts +0 -5
  234. package/dist/cli/commands/plugin/init/files/prettier.d.ts.map +0 -1
  235. package/dist/cli/commands/plugin/init/files/prettier.js +0 -25
  236. package/dist/cli/commands/plugin/init/files/prettier.js.map +0 -1
  237. package/dist/cli/commands/plugin/init/files/server.d.ts +0 -5
  238. package/dist/cli/commands/plugin/init/files/server.d.ts.map +0 -1
  239. package/dist/cli/commands/plugin/init/files/server.js +0 -360
  240. package/dist/cli/commands/plugin/init/files/server.js.map +0 -1
  241. package/dist/cli/commands/plugin/init/files/typescript.js +0 -66
  242. package/dist/cli/commands/plugin/init/files/typescript.js.map +0 -1
  243. package/dist/cli/commands/plugin/init/index.d.ts +0 -2
  244. package/dist/cli/commands/plugin/init/index.d.ts.map +0 -1
  245. package/dist/cli/commands/plugin/link-watch.d.ts +0 -7
  246. package/dist/cli/commands/plugin/link-watch.d.ts.map +0 -1
  247. package/dist/cli/commands/plugin/link-watch.js +0 -89
  248. package/dist/cli/commands/plugin/link-watch.js.map +0 -1
  249. package/dist/cli/commands/plugin/verify.d.ts +0 -7
  250. package/dist/cli/commands/plugin/verify.d.ts.map +0 -1
  251. package/dist/cli/commands/plugin/verify.js +0 -37
  252. package/dist/cli/commands/plugin/verify.js.map +0 -1
  253. package/dist/cli/commands/plugin/watch.d.ts +0 -7
  254. package/dist/cli/commands/plugin/watch.d.ts.map +0 -1
  255. package/dist/cli/commands/plugin/watch.js +0 -86
  256. package/dist/cli/commands/plugin/watch.js.map +0 -1
  257. package/dist/cli/utils/pkg.js +0 -108
  258. package/dist/cli/utils/pkg.js.map +0 -1
package/README.md CHANGED
@@ -59,18 +59,18 @@ Install Strapi with this **Quickstart** command to create a Strapi project insta
59
59
  - (Use **yarn** to install the Strapi project (recommended). [Install yarn with these docs](https://yarnpkg.com/lang/en/docs/install/).)
60
60
 
61
61
  ```bash
62
- yarn create strapi-app my-project --quickstart
62
+ yarn create strapi
63
63
  ```
64
64
 
65
65
  **or**
66
66
 
67
- - (Use npm/npx to install the Strapi project.)
67
+ - (Using npx to install the Strapi project.)
68
68
 
69
69
  ```bash
70
- npx create-strapi-app my-project --quickstart
70
+ npx create-strapi@latest
71
71
  ```
72
72
 
73
- This command generates a brand new project with the default features (authentication, permissions, content management, content type builder & file upload). The **Quickstart** command installs Strapi using a **SQLite** database which is used for prototyping in development.
73
+ This command generates a brand new project with the default features (authentication, permissions, content management, content type builder & file upload).
74
74
 
75
75
  Enjoy 🎉
76
76
 
@@ -1 +1 @@
1
- {"version":3,"file":"admin.d.ts","sourceRoot":"","sources":["../src/admin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAe,MAAM,4BAA4B,CAAC;AAQ1E,QAAA,MAAM,MAAM,cAAe,WAAW,GAAG,IAAI,4BAA4B,eAAe,kBAcvF,CAAC;AAEF,OAAO,EAAE,MAAM,IAAI,WAAW,EAAE,CAAC;AACjC,YAAY,EAAE,eAAe,EAAE,CAAC;AAEhC,cAAc,4BAA4B,CAAC"}
1
+ {"version":3,"file":"admin.d.ts","sourceRoot":"","sources":["../src/admin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAe,MAAM,4BAA4B,CAAC;AAU1E,QAAA,MAAM,MAAM,cAAe,WAAW,GAAG,IAAI,4BAA4B,eAAe,kBAkBvF,CAAC;AAEF,OAAO,EAAE,MAAM,IAAI,WAAW,EAAE,CAAC;AACjC,YAAY,EAAE,eAAe,EAAE,CAAC;AAEhC,cAAc,4BAA4B,CAAC"}
package/dist/admin.js CHANGED
@@ -1,21 +1,27 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
3
  const strapiAdmin = require("@strapi/admin/strapi-admin");
4
- const contentTypeBuilder = require("@strapi/plugin-content-type-builder/strapi-admin");
5
- const email = require("@strapi/plugin-email/strapi-admin");
6
- const upload = require("@strapi/plugin-upload/strapi-admin");
7
- const i18n = require("@strapi/plugin-i18n/strapi-admin");
4
+ const contentTypeBuilder = require("@strapi/content-type-builder/strapi-admin");
5
+ const contentManager = require("@strapi/content-manager/strapi-admin");
6
+ const email = require("@strapi/email/strapi-admin");
7
+ const upload = require("@strapi/upload/strapi-admin");
8
+ const i18n = require("@strapi/i18n/strapi-admin");
8
9
  const contentReleases = require("@strapi/content-releases/strapi-admin");
10
+ const reviewWorkflows = require("@strapi/review-workflows/strapi-admin");
9
11
  const _interopDefault = (e) => e && e.__esModule ? e : { default: e };
10
12
  const contentTypeBuilder__default = /* @__PURE__ */ _interopDefault(contentTypeBuilder);
13
+ const contentManager__default = /* @__PURE__ */ _interopDefault(contentManager);
11
14
  const email__default = /* @__PURE__ */ _interopDefault(email);
12
15
  const upload__default = /* @__PURE__ */ _interopDefault(upload);
13
16
  const i18n__default = /* @__PURE__ */ _interopDefault(i18n);
14
17
  const contentReleases__default = /* @__PURE__ */ _interopDefault(contentReleases);
18
+ const reviewWorkflows__default = /* @__PURE__ */ _interopDefault(reviewWorkflows);
15
19
  const render = (mountNode, { plugins, ...restArgs }) => {
16
20
  return strapiAdmin.renderAdmin(mountNode, {
17
21
  ...restArgs,
18
22
  plugins: {
23
+ // @ts-expect-error – TODO: fix this
24
+ "content-manager": contentManager__default.default,
19
25
  "content-type-builder": contentTypeBuilder__default.default,
20
26
  // @ts-expect-error – TODO: fix this
21
27
  email: email__default.default,
@@ -23,6 +29,8 @@ const render = (mountNode, { plugins, ...restArgs }) => {
23
29
  // @ts-expect-error – TODO: fix this, the "types" folder has it wrong.
24
30
  contentReleases: contentReleases__default.default,
25
31
  i18n: i18n__default.default,
32
+ // @ts-expect-error – TODO: fix this, the "types" folder has it wrong.
33
+ reviewWorkflows: reviewWorkflows__default.default,
26
34
  ...plugins
27
35
  }
28
36
  });
package/dist/admin.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"admin.js","sources":["../src/admin.ts"],"sourcesContent":["import { RenderAdminArgs, renderAdmin } from '@strapi/admin/strapi-admin';\nimport contentTypeBuilder from '@strapi/plugin-content-type-builder/strapi-admin';\nimport email from '@strapi/plugin-email/strapi-admin';\n// @ts-expect-error – No types, yet.\nimport upload from '@strapi/plugin-upload/strapi-admin';\nimport i18n from '@strapi/plugin-i18n/strapi-admin';\nimport contentReleases from '@strapi/content-releases/strapi-admin';\n\nconst render = (mountNode: HTMLElement | null, { plugins, ...restArgs }: RenderAdminArgs) => {\n return renderAdmin(mountNode, {\n ...restArgs,\n plugins: {\n 'content-type-builder': contentTypeBuilder,\n // @ts-expect-error – TODO: fix this\n email,\n upload,\n // @ts-expect-error – TODO: fix this, the \"types\" folder has it wrong.\n contentReleases,\n i18n,\n ...plugins,\n },\n });\n};\n\nexport { render as renderAdmin };\nexport type { RenderAdminArgs };\n\nexport * from '@strapi/admin/strapi-admin';\n"],"names":["renderAdmin","contentTypeBuilder","email","upload","contentReleases","i18n"],"mappings":";;;;;;;;;;;;;;AAQA,MAAM,SAAS,CAAC,WAA+B,EAAE,SAAS,GAAG,eAAgC;AAC3F,SAAOA,YAAAA,YAAY,WAAW;AAAA,IAC5B,GAAG;AAAA,IACH,SAAS;AAAA,MACP,wBAAwBC,4BAAA;AAAA;AAAA,MAAA,OAExBC,eAAA;AAAA,MAAA,QACAC,gBAAA;AAAA;AAAA,MAAA,iBAEAC,yBAAA;AAAA,MAAA,MACAC,cAAA;AAAA,MACA,GAAG;AAAA,IACL;AAAA,EAAA,CACD;AACH;;;;;;;;;"}
1
+ {"version":3,"file":"admin.js","sources":["../src/admin.ts"],"sourcesContent":["import { RenderAdminArgs, renderAdmin } from '@strapi/admin/strapi-admin';\nimport contentTypeBuilder from '@strapi/content-type-builder/strapi-admin';\nimport contentManager from '@strapi/content-manager/strapi-admin';\nimport email from '@strapi/email/strapi-admin';\n// @ts-expect-error – No types, yet.\nimport upload from '@strapi/upload/strapi-admin';\nimport i18n from '@strapi/i18n/strapi-admin';\nimport contentReleases from '@strapi/content-releases/strapi-admin';\nimport reviewWorkflows from '@strapi/review-workflows/strapi-admin';\n\nconst render = (mountNode: HTMLElement | null, { plugins, ...restArgs }: RenderAdminArgs) => {\n return renderAdmin(mountNode, {\n ...restArgs,\n plugins: {\n // @ts-expect-error – TODO: fix this\n 'content-manager': contentManager,\n 'content-type-builder': contentTypeBuilder,\n // @ts-expect-error – TODO: fix this\n email,\n upload,\n // @ts-expect-error – TODO: fix this, the \"types\" folder has it wrong.\n contentReleases,\n i18n,\n // @ts-expect-error – TODO: fix this, the \"types\" folder has it wrong.\n reviewWorkflows,\n ...plugins,\n },\n });\n};\n\nexport { render as renderAdmin };\nexport type { RenderAdminArgs };\n\nexport * from '@strapi/admin/strapi-admin';\n"],"names":["renderAdmin","contentManager","contentTypeBuilder","email","upload","contentReleases","i18n","reviewWorkflows"],"mappings":";;;;;;;;;;;;;;;;;;AAUA,MAAM,SAAS,CAAC,WAA+B,EAAE,SAAS,GAAG,eAAgC;AAC3F,SAAOA,YAAAA,YAAY,WAAW;AAAA,IAC5B,GAAG;AAAA,IACH,SAAS;AAAA;AAAA,MAEP,mBAAmBC,wBAAA;AAAA,MACnB,wBAAwBC,4BAAA;AAAA;AAAA,MAAA,OAExBC,eAAA;AAAA,MAAA,QACAC,gBAAA;AAAA;AAAA,MAAA,iBAEAC,yBAAA;AAAA,MAAA,MACAC,cAAA;AAAA;AAAA,MAAA,iBAEAC,yBAAA;AAAA,MACA,GAAG;AAAA,IACL;AAAA,EAAA,CACD;AACH;;;;;;;;;"}
package/dist/admin.mjs CHANGED
@@ -1,14 +1,18 @@
1
1
  import { renderAdmin } from "@strapi/admin/strapi-admin";
2
2
  export * from "@strapi/admin/strapi-admin";
3
- import contentTypeBuilder from "@strapi/plugin-content-type-builder/strapi-admin";
4
- import email from "@strapi/plugin-email/strapi-admin";
5
- import upload from "@strapi/plugin-upload/strapi-admin";
6
- import i18n from "@strapi/plugin-i18n/strapi-admin";
3
+ import contentTypeBuilder from "@strapi/content-type-builder/strapi-admin";
4
+ import contentManager from "@strapi/content-manager/strapi-admin";
5
+ import email from "@strapi/email/strapi-admin";
6
+ import upload from "@strapi/upload/strapi-admin";
7
+ import i18n from "@strapi/i18n/strapi-admin";
7
8
  import contentReleases from "@strapi/content-releases/strapi-admin";
9
+ import reviewWorkflows from "@strapi/review-workflows/strapi-admin";
8
10
  const render = (mountNode, { plugins, ...restArgs }) => {
9
11
  return renderAdmin(mountNode, {
10
12
  ...restArgs,
11
13
  plugins: {
14
+ // @ts-expect-error – TODO: fix this
15
+ "content-manager": contentManager,
12
16
  "content-type-builder": contentTypeBuilder,
13
17
  // @ts-expect-error – TODO: fix this
14
18
  email,
@@ -16,6 +20,8 @@ const render = (mountNode, { plugins, ...restArgs }) => {
16
20
  // @ts-expect-error – TODO: fix this, the "types" folder has it wrong.
17
21
  contentReleases,
18
22
  i18n,
23
+ // @ts-expect-error – TODO: fix this, the "types" folder has it wrong.
24
+ reviewWorkflows,
19
25
  ...plugins
20
26
  }
21
27
  });
@@ -1 +1 @@
1
- {"version":3,"file":"admin.mjs","sources":["../src/admin.ts"],"sourcesContent":["import { RenderAdminArgs, renderAdmin } from '@strapi/admin/strapi-admin';\nimport contentTypeBuilder from '@strapi/plugin-content-type-builder/strapi-admin';\nimport email from '@strapi/plugin-email/strapi-admin';\n// @ts-expect-error – No types, yet.\nimport upload from '@strapi/plugin-upload/strapi-admin';\nimport i18n from '@strapi/plugin-i18n/strapi-admin';\nimport contentReleases from '@strapi/content-releases/strapi-admin';\n\nconst render = (mountNode: HTMLElement | null, { plugins, ...restArgs }: RenderAdminArgs) => {\n return renderAdmin(mountNode, {\n ...restArgs,\n plugins: {\n 'content-type-builder': contentTypeBuilder,\n // @ts-expect-error – TODO: fix this\n email,\n upload,\n // @ts-expect-error – TODO: fix this, the \"types\" folder has it wrong.\n contentReleases,\n i18n,\n ...plugins,\n },\n });\n};\n\nexport { render as renderAdmin };\nexport type { RenderAdminArgs };\n\nexport * from '@strapi/admin/strapi-admin';\n"],"names":[],"mappings":";;;;;;;AAQA,MAAM,SAAS,CAAC,WAA+B,EAAE,SAAS,GAAG,eAAgC;AAC3F,SAAO,YAAY,WAAW;AAAA,IAC5B,GAAG;AAAA,IACH,SAAS;AAAA,MACP,wBAAwB;AAAA;AAAA,MAExB;AAAA,MACA;AAAA;AAAA,MAEA;AAAA,MACA;AAAA,MACA,GAAG;AAAA,IACL;AAAA,EAAA,CACD;AACH;"}
1
+ {"version":3,"file":"admin.mjs","sources":["../src/admin.ts"],"sourcesContent":["import { RenderAdminArgs, renderAdmin } from '@strapi/admin/strapi-admin';\nimport contentTypeBuilder from '@strapi/content-type-builder/strapi-admin';\nimport contentManager from '@strapi/content-manager/strapi-admin';\nimport email from '@strapi/email/strapi-admin';\n// @ts-expect-error – No types, yet.\nimport upload from '@strapi/upload/strapi-admin';\nimport i18n from '@strapi/i18n/strapi-admin';\nimport contentReleases from '@strapi/content-releases/strapi-admin';\nimport reviewWorkflows from '@strapi/review-workflows/strapi-admin';\n\nconst render = (mountNode: HTMLElement | null, { plugins, ...restArgs }: RenderAdminArgs) => {\n return renderAdmin(mountNode, {\n ...restArgs,\n plugins: {\n // @ts-expect-error – TODO: fix this\n 'content-manager': contentManager,\n 'content-type-builder': contentTypeBuilder,\n // @ts-expect-error – TODO: fix this\n email,\n upload,\n // @ts-expect-error – TODO: fix this, the \"types\" folder has it wrong.\n contentReleases,\n i18n,\n // @ts-expect-error – TODO: fix this, the \"types\" folder has it wrong.\n reviewWorkflows,\n ...plugins,\n },\n });\n};\n\nexport { render as renderAdmin };\nexport type { RenderAdminArgs };\n\nexport * from '@strapi/admin/strapi-admin';\n"],"names":[],"mappings":";;;;;;;;;AAUA,MAAM,SAAS,CAAC,WAA+B,EAAE,SAAS,GAAG,eAAgC;AAC3F,SAAO,YAAY,WAAW;AAAA,IAC5B,GAAG;AAAA,IACH,SAAS;AAAA;AAAA,MAEP,mBAAmB;AAAA,MACnB,wBAAwB;AAAA;AAAA,MAExB;AAAA,MACA;AAAA;AAAA,MAEA;AAAA,MACA;AAAA;AAAA,MAEA;AAAA,MACA,GAAG;AAAA,IACL;AAAA,EAAA,CACD;AACH;"}
@@ -45,8 +45,8 @@ const promptQuestions = [
45
45
  }
46
46
  ];
47
47
  async function createAdmin({ email, password, firstname, lastname }) {
48
- const appContext = await core.strapiFactory.compile();
49
- const app = await core.strapiFactory(appContext).load();
48
+ const appContext = await core.compileStrapi();
49
+ const app = await core.createStrapi(appContext).load();
50
50
  const user = await app.admin.services.user.exists({ email });
51
51
  if (user) {
52
52
  console.error(`User with email "${email}" already exists`);
@@ -1 +1 @@
1
- {"version":3,"file":"create-user.js","sources":["../../../../src/cli/commands/admin/create-user.ts"],"sourcesContent":["import { createCommand } from 'commander';\nimport { yup } from '@strapi/utils';\nimport _ from 'lodash';\nimport inquirer from 'inquirer';\nimport { strapiFactory } from '@strapi/core';\n\nimport { runAction } from '../../utils/helpers';\nimport type { StrapiCommand } from '../../types';\n\ninterface CmdOptions {\n email?: string;\n password?: string;\n firstname?: string;\n lastname?: string;\n}\n\nconst emailValidator = yup.string().email('Invalid email address').lowercase();\n\nconst passwordValidator = yup\n .string()\n .min(8, 'Password must be at least 8 characters long')\n .matches(/[a-z]/, 'Password must contain at least one lowercase character')\n .matches(/[A-Z]/, 'Password must contain at least one uppercase character')\n .matches(/\\d/, 'Password must contain at least one number');\n\nconst adminCreateSchema = yup.object().shape({\n email: emailValidator,\n password: passwordValidator,\n firstname: yup.string().trim().required('First name is required'),\n lastname: yup.string(),\n});\n\ninterface Answers {\n email: string;\n password: string;\n firstname: string;\n lastname: string;\n confirm: boolean;\n}\n\n/**\n * It's not an observable, in reality this is\n * `ReadOnlyArray<inquirer.DistinctQuestion<Answers>>`\n * but then the logic of the validate function needs to change.\n */\n// eslint-disable-next-line rxjs/finnish\nconst promptQuestions: inquirer.QuestionCollection<Answers> = [\n {\n type: 'input',\n name: 'email',\n message: 'Admin email?',\n async validate(value: string) {\n const validEmail = await emailValidator.validate(value);\n return validEmail === value || validEmail;\n },\n },\n {\n type: 'password',\n name: 'password',\n message: 'Admin password?',\n async validate(value: string) {\n const validPassword = await passwordValidator.validate(value);\n return validPassword === value || validPassword;\n },\n },\n { type: 'input', name: 'firstname', message: 'First name?' },\n { type: 'input', name: 'lastname', message: 'Last name?' },\n {\n type: 'confirm',\n name: 'confirm',\n message: 'Do you really want to create a new admin?',\n },\n];\n\nasync function createAdmin({ email, password, firstname, lastname }: CmdOptions) {\n const appContext = await strapiFactory.compile();\n const app = await strapiFactory(appContext).load();\n\n const user = await app.admin.services.user.exists({ email });\n\n if (user) {\n console.error(`User with email \"${email}\" already exists`);\n process.exit(1);\n }\n\n const superAdminRole = await app.admin.services.role.getSuperAdmin();\n\n await app.admin.services.user.create({\n email,\n firstname,\n lastname,\n isActive: true,\n roles: [superAdminRole.id],\n ...(password && { password, registrationToken: null }),\n });\n\n console.log(`Successfully created new admin`);\n process.exit(0);\n}\n\n/**\n * Create new admin user\n */\nconst action = async (cmdOptions: CmdOptions = {}) => {\n let { email, password, firstname, lastname } = cmdOptions;\n\n if (\n _.isEmpty(email) &&\n _.isEmpty(password) &&\n _.isEmpty(firstname) &&\n _.isEmpty(lastname) &&\n process.stdin.isTTY\n ) {\n const inquiry = await inquirer.prompt(promptQuestions);\n\n if (!inquiry.confirm) {\n process.exit(0);\n }\n\n ({ email, password, firstname, lastname } = inquiry);\n }\n\n try {\n await adminCreateSchema.validate({ email, password, firstname, lastname });\n } catch (err) {\n if (err instanceof yup.ValidationError) {\n console.error(err.errors[0]);\n }\n\n process.exit(1);\n }\n\n return createAdmin({ email, password, firstname, lastname });\n};\n\n/**\n * `$ strapi admin:create-user`\n */\nconst command: StrapiCommand = () => {\n return createCommand('admin:create-user')\n .alias('admin:create')\n .description('Create a new admin')\n .option('-e, --email <email>', 'Email of the new admin')\n .option('-p, --password <password>', 'Password of the new admin')\n .option('-f, --firstname <first name>', 'First name of the new admin')\n .option('-l, --lastname <last name>', 'Last name of the new admin')\n .action(runAction('admin:create-user', action));\n};\n\nexport { action, command };\n"],"names":["yup","strapiFactory","_","inquirer","createCommand","runAction"],"mappings":"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"}
1
+ {"version":3,"file":"create-user.js","sources":["../../../../src/cli/commands/admin/create-user.ts"],"sourcesContent":["import { createCommand } from 'commander';\nimport { yup } from '@strapi/utils';\nimport _ from 'lodash';\nimport inquirer from 'inquirer';\nimport { createStrapi, compileStrapi } from '@strapi/core';\n\nimport { runAction } from '../../utils/helpers';\nimport type { StrapiCommand } from '../../types';\n\ninterface CmdOptions {\n email?: string;\n password?: string;\n firstname?: string;\n lastname?: string;\n}\n\nconst emailValidator = yup.string().email('Invalid email address').lowercase();\n\nconst passwordValidator = yup\n .string()\n .min(8, 'Password must be at least 8 characters long')\n .matches(/[a-z]/, 'Password must contain at least one lowercase character')\n .matches(/[A-Z]/, 'Password must contain at least one uppercase character')\n .matches(/\\d/, 'Password must contain at least one number');\n\nconst adminCreateSchema = yup.object().shape({\n email: emailValidator,\n password: passwordValidator,\n firstname: yup.string().trim().required('First name is required'),\n lastname: yup.string(),\n});\n\ninterface Answers {\n email: string;\n password: string;\n firstname: string;\n lastname: string;\n confirm: boolean;\n}\n\n/**\n * It's not an observable, in reality this is\n * `ReadOnlyArray<inquirer.DistinctQuestion<Answers>>`\n * but then the logic of the validate function needs to change.\n */\n// eslint-disable-next-line rxjs/finnish\nconst promptQuestions: inquirer.QuestionCollection<Answers> = [\n {\n type: 'input',\n name: 'email',\n message: 'Admin email?',\n async validate(value: string) {\n const validEmail = await emailValidator.validate(value);\n return validEmail === value || validEmail;\n },\n },\n {\n type: 'password',\n name: 'password',\n message: 'Admin password?',\n async validate(value: string) {\n const validPassword = await passwordValidator.validate(value);\n return validPassword === value || validPassword;\n },\n },\n { type: 'input', name: 'firstname', message: 'First name?' },\n { type: 'input', name: 'lastname', message: 'Last name?' },\n {\n type: 'confirm',\n name: 'confirm',\n message: 'Do you really want to create a new admin?',\n },\n];\n\nasync function createAdmin({ email, password, firstname, lastname }: CmdOptions) {\n const appContext = await compileStrapi();\n const app = await createStrapi(appContext).load();\n\n const user = await app.admin!.services.user.exists({ email });\n\n if (user) {\n console.error(`User with email \"${email}\" already exists`);\n process.exit(1);\n }\n\n const superAdminRole = await app.admin!.services.role.getSuperAdmin();\n\n await app.admin!.services.user.create({\n email,\n firstname,\n lastname,\n isActive: true,\n roles: [superAdminRole.id],\n ...(password && { password, registrationToken: null }),\n });\n\n console.log(`Successfully created new admin`);\n process.exit(0);\n}\n\n/**\n * Create new admin user\n */\nconst action = async (cmdOptions: CmdOptions = {}) => {\n let { email, password, firstname, lastname } = cmdOptions;\n\n if (\n _.isEmpty(email) &&\n _.isEmpty(password) &&\n _.isEmpty(firstname) &&\n _.isEmpty(lastname) &&\n process.stdin.isTTY\n ) {\n const inquiry = await inquirer.prompt(promptQuestions);\n\n if (!inquiry.confirm) {\n process.exit(0);\n }\n\n ({ email, password, firstname, lastname } = inquiry);\n }\n\n try {\n await adminCreateSchema.validate({ email, password, firstname, lastname });\n } catch (err) {\n if (err instanceof yup.ValidationError) {\n console.error(err.errors[0]);\n }\n\n process.exit(1);\n }\n\n return createAdmin({ email, password, firstname, lastname });\n};\n\n/**\n * `$ strapi admin:create-user`\n */\nconst command: StrapiCommand = () => {\n return createCommand('admin:create-user')\n .alias('admin:create')\n .description('Create a new admin')\n .option('-e, --email <email>', 'Email of the new admin')\n .option('-p, --password <password>', 'Password of the new admin')\n .option('-f, --firstname <first name>', 'First name of the new admin')\n .option('-l, --lastname <last name>', 'Last name of the new admin')\n .action(runAction('admin:create-user', action));\n};\n\nexport { action, command };\n"],"names":["yup","compileStrapi","createStrapi","_","inquirer","createCommand","runAction"],"mappings":"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"}
@@ -0,0 +1,88 @@
1
+ import { createCommand } from "commander";
2
+ import { yup } from "@strapi/utils";
3
+ import _ from "lodash";
4
+ import inquirer from "inquirer";
5
+ import { compileStrapi, createStrapi } from "@strapi/core";
6
+ import { runAction } from "../../utils/helpers.mjs";
7
+ const emailValidator = yup.string().email("Invalid email address").lowercase();
8
+ const passwordValidator = yup.string().min(8, "Password must be at least 8 characters long").matches(/[a-z]/, "Password must contain at least one lowercase character").matches(/[A-Z]/, "Password must contain at least one uppercase character").matches(/\d/, "Password must contain at least one number");
9
+ const adminCreateSchema = yup.object().shape({
10
+ email: emailValidator,
11
+ password: passwordValidator,
12
+ firstname: yup.string().trim().required("First name is required"),
13
+ lastname: yup.string()
14
+ });
15
+ const promptQuestions = [
16
+ {
17
+ type: "input",
18
+ name: "email",
19
+ message: "Admin email?",
20
+ async validate(value) {
21
+ const validEmail = await emailValidator.validate(value);
22
+ return validEmail === value || validEmail;
23
+ }
24
+ },
25
+ {
26
+ type: "password",
27
+ name: "password",
28
+ message: "Admin password?",
29
+ async validate(value) {
30
+ const validPassword = await passwordValidator.validate(value);
31
+ return validPassword === value || validPassword;
32
+ }
33
+ },
34
+ { type: "input", name: "firstname", message: "First name?" },
35
+ { type: "input", name: "lastname", message: "Last name?" },
36
+ {
37
+ type: "confirm",
38
+ name: "confirm",
39
+ message: "Do you really want to create a new admin?"
40
+ }
41
+ ];
42
+ async function createAdmin({ email, password, firstname, lastname }) {
43
+ const appContext = await compileStrapi();
44
+ const app = await createStrapi(appContext).load();
45
+ const user = await app.admin.services.user.exists({ email });
46
+ if (user) {
47
+ console.error(`User with email "${email}" already exists`);
48
+ process.exit(1);
49
+ }
50
+ const superAdminRole = await app.admin.services.role.getSuperAdmin();
51
+ await app.admin.services.user.create({
52
+ email,
53
+ firstname,
54
+ lastname,
55
+ isActive: true,
56
+ roles: [superAdminRole.id],
57
+ ...password && { password, registrationToken: null }
58
+ });
59
+ console.log(`Successfully created new admin`);
60
+ process.exit(0);
61
+ }
62
+ const action = async (cmdOptions = {}) => {
63
+ let { email, password, firstname, lastname } = cmdOptions;
64
+ if (_.isEmpty(email) && _.isEmpty(password) && _.isEmpty(firstname) && _.isEmpty(lastname) && process.stdin.isTTY) {
65
+ const inquiry = await inquirer.prompt(promptQuestions);
66
+ if (!inquiry.confirm) {
67
+ process.exit(0);
68
+ }
69
+ ({ email, password, firstname, lastname } = inquiry);
70
+ }
71
+ try {
72
+ await adminCreateSchema.validate({ email, password, firstname, lastname });
73
+ } catch (err) {
74
+ if (err instanceof yup.ValidationError) {
75
+ console.error(err.errors[0]);
76
+ }
77
+ process.exit(1);
78
+ }
79
+ return createAdmin({ email, password, firstname, lastname });
80
+ };
81
+ const command = () => {
82
+ return createCommand("admin:create-user").alias("admin:create").description("Create a new admin").option("-e, --email <email>", "Email of the new admin").option("-p, --password <password>", "Password of the new admin").option("-f, --firstname <first name>", "First name of the new admin").option("-l, --lastname <last name>", "Last name of the new admin").action(runAction("admin:create-user", action));
83
+ };
84
+ export {
85
+ action,
86
+ command
87
+ };
88
+ //# sourceMappingURL=create-user.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"create-user.mjs","sources":["../../../../src/cli/commands/admin/create-user.ts"],"sourcesContent":["import { createCommand } from 'commander';\nimport { yup } from '@strapi/utils';\nimport _ from 'lodash';\nimport inquirer from 'inquirer';\nimport { createStrapi, compileStrapi } from '@strapi/core';\n\nimport { runAction } from '../../utils/helpers';\nimport type { StrapiCommand } from '../../types';\n\ninterface CmdOptions {\n email?: string;\n password?: string;\n firstname?: string;\n lastname?: string;\n}\n\nconst emailValidator = yup.string().email('Invalid email address').lowercase();\n\nconst passwordValidator = yup\n .string()\n .min(8, 'Password must be at least 8 characters long')\n .matches(/[a-z]/, 'Password must contain at least one lowercase character')\n .matches(/[A-Z]/, 'Password must contain at least one uppercase character')\n .matches(/\\d/, 'Password must contain at least one number');\n\nconst adminCreateSchema = yup.object().shape({\n email: emailValidator,\n password: passwordValidator,\n firstname: yup.string().trim().required('First name is required'),\n lastname: yup.string(),\n});\n\ninterface Answers {\n email: string;\n password: string;\n firstname: string;\n lastname: string;\n confirm: boolean;\n}\n\n/**\n * It's not an observable, in reality this is\n * `ReadOnlyArray<inquirer.DistinctQuestion<Answers>>`\n * but then the logic of the validate function needs to change.\n */\n// eslint-disable-next-line rxjs/finnish\nconst promptQuestions: inquirer.QuestionCollection<Answers> = [\n {\n type: 'input',\n name: 'email',\n message: 'Admin email?',\n async validate(value: string) {\n const validEmail = await emailValidator.validate(value);\n return validEmail === value || validEmail;\n },\n },\n {\n type: 'password',\n name: 'password',\n message: 'Admin password?',\n async validate(value: string) {\n const validPassword = await passwordValidator.validate(value);\n return validPassword === value || validPassword;\n },\n },\n { type: 'input', name: 'firstname', message: 'First name?' },\n { type: 'input', name: 'lastname', message: 'Last name?' },\n {\n type: 'confirm',\n name: 'confirm',\n message: 'Do you really want to create a new admin?',\n },\n];\n\nasync function createAdmin({ email, password, firstname, lastname }: CmdOptions) {\n const appContext = await compileStrapi();\n const app = await createStrapi(appContext).load();\n\n const user = await app.admin!.services.user.exists({ email });\n\n if (user) {\n console.error(`User with email \"${email}\" already exists`);\n process.exit(1);\n }\n\n const superAdminRole = await app.admin!.services.role.getSuperAdmin();\n\n await app.admin!.services.user.create({\n email,\n firstname,\n lastname,\n isActive: true,\n roles: [superAdminRole.id],\n ...(password && { password, registrationToken: null }),\n });\n\n console.log(`Successfully created new admin`);\n process.exit(0);\n}\n\n/**\n * Create new admin user\n */\nconst action = async (cmdOptions: CmdOptions = {}) => {\n let { email, password, firstname, lastname } = cmdOptions;\n\n if (\n _.isEmpty(email) &&\n _.isEmpty(password) &&\n _.isEmpty(firstname) &&\n _.isEmpty(lastname) &&\n process.stdin.isTTY\n ) {\n const inquiry = await inquirer.prompt(promptQuestions);\n\n if (!inquiry.confirm) {\n process.exit(0);\n }\n\n ({ email, password, firstname, lastname } = inquiry);\n }\n\n try {\n await adminCreateSchema.validate({ email, password, firstname, lastname });\n } catch (err) {\n if (err instanceof yup.ValidationError) {\n console.error(err.errors[0]);\n }\n\n process.exit(1);\n }\n\n return createAdmin({ email, password, firstname, lastname });\n};\n\n/**\n * `$ strapi admin:create-user`\n */\nconst command: StrapiCommand = () => {\n return createCommand('admin:create-user')\n .alias('admin:create')\n .description('Create a new admin')\n .option('-e, --email <email>', 'Email of the new admin')\n .option('-p, --password <password>', 'Password of the new admin')\n .option('-f, --firstname <first name>', 'First name of the new admin')\n .option('-l, --lastname <last name>', 'Last name of the new admin')\n .action(runAction('admin:create-user', action));\n};\n\nexport { action, command };\n"],"names":[],"mappings":"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"}
@@ -18,8 +18,8 @@ const promptQuestions = [
18
18
  }
19
19
  ];
20
20
  async function changePassword({ email, password }) {
21
- const appContext = await core.strapiFactory.compile();
22
- const app = await core.strapiFactory(appContext).load();
21
+ const appContext = await core.compileStrapi();
22
+ const app = await core.createStrapi(appContext).load();
23
23
  await app.admin.services.user.resetPasswordByEmail(email, password);
24
24
  console.log(`Successfully reset user's password`);
25
25
  process.exit(0);
@@ -1 +1 @@
1
- {"version":3,"file":"reset-user-password.js","sources":["../../../../src/cli/commands/admin/reset-user-password.ts"],"sourcesContent":["import _ from 'lodash';\nimport inquirer from 'inquirer';\nimport { createCommand } from 'commander';\nimport { strapiFactory } from '@strapi/core';\n\nimport type { StrapiCommand } from '../../types';\nimport { runAction } from '../../utils/helpers';\n\ninterface CmdOptions {\n email?: string;\n password?: string;\n}\n\ninterface Answers {\n email: string;\n password: string;\n confirm: boolean;\n}\n\nconst promptQuestions: ReadonlyArray<inquirer.DistinctQuestion<Answers>> = [\n { type: 'input', name: 'email', message: 'User email?' },\n { type: 'password', name: 'password', message: 'New password?' },\n {\n type: 'confirm',\n name: 'confirm',\n message: \"Do you really want to reset this user's password?\",\n },\n];\n\nasync function changePassword({ email, password }: CmdOptions) {\n const appContext = await strapiFactory.compile();\n const app = await strapiFactory(appContext).load();\n\n await app.admin.services.user.resetPasswordByEmail(email, password);\n\n console.log(`Successfully reset user's password`);\n process.exit(0);\n}\n\n/**\n * Reset user's password\n */\nconst action = async (cmdOptions: CmdOptions = {}) => {\n const { email, password } = cmdOptions;\n\n if (_.isEmpty(email) && _.isEmpty(password) && process.stdin.isTTY) {\n const inquiry = await inquirer.prompt(promptQuestions);\n\n if (!inquiry.confirm) {\n process.exit(0);\n }\n\n return changePassword(inquiry);\n }\n\n if (_.isEmpty(email) || _.isEmpty(password)) {\n console.error('Missing required options `email` or `password`');\n process.exit(1);\n }\n\n return changePassword({ email, password });\n};\n\n/**\n * `$ strapi admin:reset-user-password`\n */\nconst command: StrapiCommand = () => {\n return createCommand('admin:reset-user-password')\n .alias('admin:reset-password')\n .description(\"Reset an admin user's password\")\n .option('-e, --email <email>', 'The user email')\n .option('-p, --password <password>', 'New password for the user')\n .action(runAction('admin:reset-user-password', action));\n};\n\nexport { action, command };\n"],"names":["strapiFactory","_","inquirer","createCommand","runAction"],"mappings":";;;;;;;;;;AAmBA,MAAM,kBAAqE;AAAA,EACzE,EAAE,MAAM,SAAS,MAAM,SAAS,SAAS,cAAc;AAAA,EACvD,EAAE,MAAM,YAAY,MAAM,YAAY,SAAS,gBAAgB;AAAA,EAC/D;AAAA,IACE,MAAM;AAAA,IACN,MAAM;AAAA,IACN,SAAS;AAAA,EACX;AACF;AAEA,eAAe,eAAe,EAAE,OAAO,YAAwB;AACvD,QAAA,aAAa,MAAMA,mBAAc;AACvC,QAAM,MAAM,MAAMA,KAAAA,cAAc,UAAU,EAAE,KAAK;AAEjD,QAAM,IAAI,MAAM,SAAS,KAAK,qBAAqB,OAAO,QAAQ;AAElE,UAAQ,IAAI,oCAAoC;AAChD,UAAQ,KAAK,CAAC;AAChB;AAKA,MAAM,SAAS,OAAO,aAAyB,OAAO;AAC9C,QAAA,EAAE,OAAO,SAAa,IAAA;AAExB,MAAAC,mBAAE,QAAQ,KAAK,KAAKA,WAAA,QAAE,QAAQ,QAAQ,KAAK,QAAQ,MAAM,OAAO;AAClE,UAAM,UAAU,MAAMC,kBAAAA,QAAS,OAAO,eAAe;AAEjD,QAAA,CAAC,QAAQ,SAAS;AACpB,cAAQ,KAAK,CAAC;AAAA,IAChB;AAEA,WAAO,eAAe,OAAO;AAAA,EAC/B;AAEA,MAAID,WAAAA,QAAE,QAAQ,KAAK,KAAKA,WAAAA,QAAE,QAAQ,QAAQ,GAAG;AAC3C,YAAQ,MAAM,gDAAgD;AAC9D,YAAQ,KAAK,CAAC;AAAA,EAChB;AAEA,SAAO,eAAe,EAAE,OAAO,SAAU,CAAA;AAC3C;AAKA,MAAM,UAAyB,MAAM;AAC5B,SAAAE,UAAA,cAAc,2BAA2B,EAC7C,MAAM,sBAAsB,EAC5B,YAAY,gCAAgC,EAC5C,OAAO,uBAAuB,gBAAgB,EAC9C,OAAO,6BAA6B,2BAA2B,EAC/D,OAAOC,kBAAU,6BAA6B,MAAM,CAAC;AAC1D;;;"}
1
+ {"version":3,"file":"reset-user-password.js","sources":["../../../../src/cli/commands/admin/reset-user-password.ts"],"sourcesContent":["import _ from 'lodash';\nimport inquirer from 'inquirer';\nimport { createCommand } from 'commander';\nimport { createStrapi, compileStrapi } from '@strapi/core';\n\nimport type { StrapiCommand } from '../../types';\nimport { runAction } from '../../utils/helpers';\n\ninterface CmdOptions {\n email?: string;\n password?: string;\n}\n\ninterface Answers {\n email: string;\n password: string;\n confirm: boolean;\n}\n\nconst promptQuestions: ReadonlyArray<inquirer.DistinctQuestion<Answers>> = [\n { type: 'input', name: 'email', message: 'User email?' },\n { type: 'password', name: 'password', message: 'New password?' },\n {\n type: 'confirm',\n name: 'confirm',\n message: \"Do you really want to reset this user's password?\",\n },\n];\n\nasync function changePassword({ email, password }: CmdOptions) {\n const appContext = await compileStrapi();\n const app = await createStrapi(appContext).load();\n\n await app.admin!.services.user.resetPasswordByEmail(email, password);\n\n console.log(`Successfully reset user's password`);\n process.exit(0);\n}\n\n/**\n * Reset user's password\n */\nconst action = async (cmdOptions: CmdOptions = {}) => {\n const { email, password } = cmdOptions;\n\n if (_.isEmpty(email) && _.isEmpty(password) && process.stdin.isTTY) {\n const inquiry = await inquirer.prompt(promptQuestions);\n\n if (!inquiry.confirm) {\n process.exit(0);\n }\n\n return changePassword(inquiry);\n }\n\n if (_.isEmpty(email) || _.isEmpty(password)) {\n console.error('Missing required options `email` or `password`');\n process.exit(1);\n }\n\n return changePassword({ email, password });\n};\n\n/**\n * `$ strapi admin:reset-user-password`\n */\nconst command: StrapiCommand = () => {\n return createCommand('admin:reset-user-password')\n .alias('admin:reset-password')\n .description(\"Reset an admin user's password\")\n .option('-e, --email <email>', 'The user email')\n .option('-p, --password <password>', 'New password for the user')\n .action(runAction('admin:reset-user-password', action));\n};\n\nexport { action, command };\n"],"names":["compileStrapi","createStrapi","_","inquirer","createCommand","runAction"],"mappings":";;;;;;;;;;AAmBA,MAAM,kBAAqE;AAAA,EACzE,EAAE,MAAM,SAAS,MAAM,SAAS,SAAS,cAAc;AAAA,EACvD,EAAE,MAAM,YAAY,MAAM,YAAY,SAAS,gBAAgB;AAAA,EAC/D;AAAA,IACE,MAAM;AAAA,IACN,MAAM;AAAA,IACN,SAAS;AAAA,EACX;AACF;AAEA,eAAe,eAAe,EAAE,OAAO,YAAwB;AACvD,QAAA,aAAa,MAAMA,KAAAA;AACzB,QAAM,MAAM,MAAMC,KAAAA,aAAa,UAAU,EAAE,KAAK;AAEhD,QAAM,IAAI,MAAO,SAAS,KAAK,qBAAqB,OAAO,QAAQ;AAEnE,UAAQ,IAAI,oCAAoC;AAChD,UAAQ,KAAK,CAAC;AAChB;AAKA,MAAM,SAAS,OAAO,aAAyB,OAAO;AAC9C,QAAA,EAAE,OAAO,SAAa,IAAA;AAExB,MAAAC,mBAAE,QAAQ,KAAK,KAAKA,WAAA,QAAE,QAAQ,QAAQ,KAAK,QAAQ,MAAM,OAAO;AAClE,UAAM,UAAU,MAAMC,kBAAAA,QAAS,OAAO,eAAe;AAEjD,QAAA,CAAC,QAAQ,SAAS;AACpB,cAAQ,KAAK,CAAC;AAAA,IAChB;AAEA,WAAO,eAAe,OAAO;AAAA,EAC/B;AAEA,MAAID,WAAAA,QAAE,QAAQ,KAAK,KAAKA,WAAAA,QAAE,QAAQ,QAAQ,GAAG;AAC3C,YAAQ,MAAM,gDAAgD;AAC9D,YAAQ,KAAK,CAAC;AAAA,EAChB;AAEA,SAAO,eAAe,EAAE,OAAO,SAAU,CAAA;AAC3C;AAKA,MAAM,UAAyB,MAAM;AAC5B,SAAAE,UAAA,cAAc,2BAA2B,EAC7C,MAAM,sBAAsB,EAC5B,YAAY,gCAAgC,EAC5C,OAAO,uBAAuB,gBAAgB,EAC9C,OAAO,6BAA6B,2BAA2B,EAC/D,OAAOC,kBAAU,6BAA6B,MAAM,CAAC;AAC1D;;;"}
@@ -0,0 +1,44 @@
1
+ import _ from "lodash";
2
+ import inquirer from "inquirer";
3
+ import { createCommand } from "commander";
4
+ import { compileStrapi, createStrapi } from "@strapi/core";
5
+ import { runAction } from "../../utils/helpers.mjs";
6
+ const promptQuestions = [
7
+ { type: "input", name: "email", message: "User email?" },
8
+ { type: "password", name: "password", message: "New password?" },
9
+ {
10
+ type: "confirm",
11
+ name: "confirm",
12
+ message: "Do you really want to reset this user's password?"
13
+ }
14
+ ];
15
+ async function changePassword({ email, password }) {
16
+ const appContext = await compileStrapi();
17
+ const app = await createStrapi(appContext).load();
18
+ await app.admin.services.user.resetPasswordByEmail(email, password);
19
+ console.log(`Successfully reset user's password`);
20
+ process.exit(0);
21
+ }
22
+ const action = async (cmdOptions = {}) => {
23
+ const { email, password } = cmdOptions;
24
+ if (_.isEmpty(email) && _.isEmpty(password) && process.stdin.isTTY) {
25
+ const inquiry = await inquirer.prompt(promptQuestions);
26
+ if (!inquiry.confirm) {
27
+ process.exit(0);
28
+ }
29
+ return changePassword(inquiry);
30
+ }
31
+ if (_.isEmpty(email) || _.isEmpty(password)) {
32
+ console.error("Missing required options `email` or `password`");
33
+ process.exit(1);
34
+ }
35
+ return changePassword({ email, password });
36
+ };
37
+ const command = () => {
38
+ return createCommand("admin:reset-user-password").alias("admin:reset-password").description("Reset an admin user's password").option("-e, --email <email>", "The user email").option("-p, --password <password>", "New password for the user").action(runAction("admin:reset-user-password", action));
39
+ };
40
+ export {
41
+ action,
42
+ command
43
+ };
44
+ //# sourceMappingURL=reset-user-password.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"reset-user-password.mjs","sources":["../../../../src/cli/commands/admin/reset-user-password.ts"],"sourcesContent":["import _ from 'lodash';\nimport inquirer from 'inquirer';\nimport { createCommand } from 'commander';\nimport { createStrapi, compileStrapi } from '@strapi/core';\n\nimport type { StrapiCommand } from '../../types';\nimport { runAction } from '../../utils/helpers';\n\ninterface CmdOptions {\n email?: string;\n password?: string;\n}\n\ninterface Answers {\n email: string;\n password: string;\n confirm: boolean;\n}\n\nconst promptQuestions: ReadonlyArray<inquirer.DistinctQuestion<Answers>> = [\n { type: 'input', name: 'email', message: 'User email?' },\n { type: 'password', name: 'password', message: 'New password?' },\n {\n type: 'confirm',\n name: 'confirm',\n message: \"Do you really want to reset this user's password?\",\n },\n];\n\nasync function changePassword({ email, password }: CmdOptions) {\n const appContext = await compileStrapi();\n const app = await createStrapi(appContext).load();\n\n await app.admin!.services.user.resetPasswordByEmail(email, password);\n\n console.log(`Successfully reset user's password`);\n process.exit(0);\n}\n\n/**\n * Reset user's password\n */\nconst action = async (cmdOptions: CmdOptions = {}) => {\n const { email, password } = cmdOptions;\n\n if (_.isEmpty(email) && _.isEmpty(password) && process.stdin.isTTY) {\n const inquiry = await inquirer.prompt(promptQuestions);\n\n if (!inquiry.confirm) {\n process.exit(0);\n }\n\n return changePassword(inquiry);\n }\n\n if (_.isEmpty(email) || _.isEmpty(password)) {\n console.error('Missing required options `email` or `password`');\n process.exit(1);\n }\n\n return changePassword({ email, password });\n};\n\n/**\n * `$ strapi admin:reset-user-password`\n */\nconst command: StrapiCommand = () => {\n return createCommand('admin:reset-user-password')\n .alias('admin:reset-password')\n .description(\"Reset an admin user's password\")\n .option('-e, --email <email>', 'The user email')\n .option('-p, --password <password>', 'New password for the user')\n .action(runAction('admin:reset-user-password', action));\n};\n\nexport { action, command };\n"],"names":[],"mappings":";;;;;AAmBA,MAAM,kBAAqE;AAAA,EACzE,EAAE,MAAM,SAAS,MAAM,SAAS,SAAS,cAAc;AAAA,EACvD,EAAE,MAAM,YAAY,MAAM,YAAY,SAAS,gBAAgB;AAAA,EAC/D;AAAA,IACE,MAAM;AAAA,IACN,MAAM;AAAA,IACN,SAAS;AAAA,EACX;AACF;AAEA,eAAe,eAAe,EAAE,OAAO,YAAwB;AACvD,QAAA,aAAa,MAAM;AACzB,QAAM,MAAM,MAAM,aAAa,UAAU,EAAE,KAAK;AAEhD,QAAM,IAAI,MAAO,SAAS,KAAK,qBAAqB,OAAO,QAAQ;AAEnE,UAAQ,IAAI,oCAAoC;AAChD,UAAQ,KAAK,CAAC;AAChB;AAKA,MAAM,SAAS,OAAO,aAAyB,OAAO;AAC9C,QAAA,EAAE,OAAO,SAAa,IAAA;AAExB,MAAA,EAAE,QAAQ,KAAK,KAAK,EAAE,QAAQ,QAAQ,KAAK,QAAQ,MAAM,OAAO;AAClE,UAAM,UAAU,MAAM,SAAS,OAAO,eAAe;AAEjD,QAAA,CAAC,QAAQ,SAAS;AACpB,cAAQ,KAAK,CAAC;AAAA,IAChB;AAEA,WAAO,eAAe,OAAO;AAAA,EAC/B;AAEA,MAAI,EAAE,QAAQ,KAAK,KAAK,EAAE,QAAQ,QAAQ,GAAG;AAC3C,YAAQ,MAAM,gDAAgD;AAC9D,YAAQ,KAAK,CAAC;AAAA,EAChB;AAEA,SAAO,eAAe,EAAE,OAAO,SAAU,CAAA;AAC3C;AAKA,MAAM,UAAyB,MAAM;AAC5B,SAAA,cAAc,2BAA2B,EAC7C,MAAM,sBAAsB,EAC5B,YAAY,gCAAgC,EAC5C,OAAO,uBAAuB,gBAAgB,EAC9C,OAAO,6BAA6B,2BAA2B,EAC/D,OAAO,UAAU,6BAA6B,MAAM,CAAC;AAC1D;"}
@@ -1 +1 @@
1
- {"version":3,"file":"build.js","sources":["../../../src/cli/commands/build.ts"],"sourcesContent":["import { createCommand } from 'commander';\nimport type { StrapiCommand } from '../types';\n\nimport { build as nodeBuild, BuildOptions } from '../../node/build';\nimport { handleUnexpectedError } from '../../node/core/errors';\n\ninterface BuildCLIOptions extends BuildOptions {}\n\nconst action = async (options: BuildCLIOptions) => {\n try {\n if (options.bundler === 'webpack') {\n options.logger.warn(\n '[@strapi/strapi]: Using webpack as a bundler is deprecated. You should migrate to vite.'\n );\n }\n\n /**\n * ENFORCE NODE_ENV to production when building\n */\n process.env.NODE_ENV = process.env.NODE_ENV ?? 'production';\n\n if (process.env.NODE_ENV !== 'production') {\n options.logger.warn(\n '[@strapi/strapi]: The NODE_ENV is not set to production. This may result in unexpected behavior.'\n );\n }\n\n await nodeBuild(options);\n } catch (err) {\n handleUnexpectedError(err);\n }\n};\n\n/**\n * `$ strapi build`\n */\nconst command: StrapiCommand = ({ ctx }) => {\n return createCommand('build')\n .option('--bundler [bundler]', 'Bundler to use (webpack or vite)', 'vite')\n .option('-d, --debug', 'Enable debugging mode with verbose logs', false)\n .option('--minify', 'Minify the output', true)\n .option('--silent', \"Don't log anything\", false)\n .option('--sourcemap', 'Produce sourcemaps', false)\n .option('--stats', 'Print build statistics to the console', false)\n .description('Build the strapi admin app')\n .action(async (options: BuildCLIOptions) => {\n return action({ ...options, ...ctx });\n });\n};\n\nexport { command };\n"],"names":["nodeBuild","handleUnexpectedError","createCommand"],"mappings":";;;;;AAQA,MAAM,SAAS,OAAO,YAA6B;AAC7C,MAAA;AACE,QAAA,QAAQ,YAAY,WAAW;AACjC,cAAQ,OAAO;AAAA,QACb;AAAA,MAAA;AAAA,IAEJ;AAKA,YAAQ,IAAI,WAAW,QAAQ,IAAI,YAAY;AAE3C,QAAA,QAAQ,IAAI,aAAa,cAAc;AACzC,cAAQ,OAAO;AAAA,QACb;AAAA,MAAA;AAAA,IAEJ;AAEA,UAAMA,MAAAA,MAAU,OAAO;AAAA,WAChB,KAAK;AACZC,WAAA,sBAAsB,GAAG;AAAA,EAC3B;AACF;AAKA,MAAM,UAAyB,CAAC,EAAE,UAAU;AAC1C,SAAOC,UAAAA,cAAc,OAAO,EACzB,OAAO,uBAAuB,oCAAoC,MAAM,EACxE,OAAO,eAAe,2CAA2C,KAAK,EACtE,OAAO,YAAY,qBAAqB,IAAI,EAC5C,OAAO,YAAY,sBAAsB,KAAK,EAC9C,OAAO,eAAe,sBAAsB,KAAK,EACjD,OAAO,WAAW,yCAAyC,KAAK,EAChE,YAAY,4BAA4B,EACxC,OAAO,OAAO,YAA6B;AAC1C,WAAO,OAAO,EAAE,GAAG,SAAS,GAAG,IAAK,CAAA;AAAA,EAAA,CACrC;AACL;;"}
1
+ {"version":3,"file":"build.js","sources":["../../../src/cli/commands/build.ts"],"sourcesContent":["import { createCommand } from 'commander';\nimport type { StrapiCommand } from '../types';\n\nimport { build as nodeBuild, BuildOptions } from '../../node/build';\nimport { handleUnexpectedError } from '../../node/core/errors';\n\ntype BuildCLIOptions = BuildOptions;\n\nconst action = async (options: BuildCLIOptions) => {\n try {\n if (options.bundler === 'webpack') {\n options.logger.warn(\n '[@strapi/strapi]: Using webpack as a bundler is deprecated. You should migrate to vite.'\n );\n }\n\n /**\n * ENFORCE NODE_ENV to production when building\n */\n process.env.NODE_ENV = process.env.NODE_ENV ?? 'production';\n\n if (process.env.NODE_ENV !== 'production') {\n options.logger.warn(\n '[@strapi/strapi]: The NODE_ENV is not set to production. This may result in unexpected behavior.'\n );\n }\n\n await nodeBuild(options);\n } catch (err) {\n handleUnexpectedError(err);\n }\n};\n\n/**\n * `$ strapi build`\n */\nconst command: StrapiCommand = ({ ctx }) => {\n return createCommand('build')\n .option('--bundler [bundler]', 'Bundler to use (webpack or vite)', 'vite')\n .option('-d, --debug', 'Enable debugging mode with verbose logs', false)\n .option('--minify', 'Minify the output', true)\n .option('--silent', \"Don't log anything\", false)\n .option('--sourcemap', 'Produce sourcemaps', false)\n .option('--stats', 'Print build statistics to the console', false)\n .description('Build the strapi admin app')\n .action(async (options: BuildCLIOptions) => {\n return action({ ...options, ...ctx });\n });\n};\n\nexport { command };\n"],"names":["nodeBuild","handleUnexpectedError","createCommand"],"mappings":";;;;;AAQA,MAAM,SAAS,OAAO,YAA6B;AAC7C,MAAA;AACE,QAAA,QAAQ,YAAY,WAAW;AACjC,cAAQ,OAAO;AAAA,QACb;AAAA,MAAA;AAAA,IAEJ;AAKA,YAAQ,IAAI,WAAW,QAAQ,IAAI,YAAY;AAE3C,QAAA,QAAQ,IAAI,aAAa,cAAc;AACzC,cAAQ,OAAO;AAAA,QACb;AAAA,MAAA;AAAA,IAEJ;AAEA,UAAMA,MAAAA,MAAU,OAAO;AAAA,WAChB,KAAK;AACZC,WAAA,sBAAsB,GAAG;AAAA,EAC3B;AACF;AAKA,MAAM,UAAyB,CAAC,EAAE,UAAU;AAC1C,SAAOC,UAAAA,cAAc,OAAO,EACzB,OAAO,uBAAuB,oCAAoC,MAAM,EACxE,OAAO,eAAe,2CAA2C,KAAK,EACtE,OAAO,YAAY,qBAAqB,IAAI,EAC5C,OAAO,YAAY,sBAAsB,KAAK,EAC9C,OAAO,eAAe,sBAAsB,KAAK,EACjD,OAAO,WAAW,yCAAyC,KAAK,EAChE,YAAY,4BAA4B,EACxC,OAAO,OAAO,YAA6B;AAC1C,WAAO,OAAO,EAAE,GAAG,SAAS,GAAG,IAAK,CAAA;AAAA,EAAA,CACrC;AACL;;"}
@@ -0,0 +1,30 @@
1
+ import { createCommand } from "commander";
2
+ import { build } from "../../node/build.mjs";
3
+ import { handleUnexpectedError } from "../../node/core/errors.mjs";
4
+ const action = async (options) => {
5
+ try {
6
+ if (options.bundler === "webpack") {
7
+ options.logger.warn(
8
+ "[@strapi/strapi]: Using webpack as a bundler is deprecated. You should migrate to vite."
9
+ );
10
+ }
11
+ process.env.NODE_ENV = process.env.NODE_ENV ?? "production";
12
+ if (process.env.NODE_ENV !== "production") {
13
+ options.logger.warn(
14
+ "[@strapi/strapi]: The NODE_ENV is not set to production. This may result in unexpected behavior."
15
+ );
16
+ }
17
+ await build(options);
18
+ } catch (err) {
19
+ handleUnexpectedError(err);
20
+ }
21
+ };
22
+ const command = ({ ctx }) => {
23
+ return createCommand("build").option("--bundler [bundler]", "Bundler to use (webpack or vite)", "vite").option("-d, --debug", "Enable debugging mode with verbose logs", false).option("--minify", "Minify the output", true).option("--silent", "Don't log anything", false).option("--sourcemap", "Produce sourcemaps", false).option("--stats", "Print build statistics to the console", false).description("Build the strapi admin app").action(async (options) => {
24
+ return action({ ...options, ...ctx });
25
+ });
26
+ };
27
+ export {
28
+ command
29
+ };
30
+ //# sourceMappingURL=build.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"build.mjs","sources":["../../../src/cli/commands/build.ts"],"sourcesContent":["import { createCommand } from 'commander';\nimport type { StrapiCommand } from '../types';\n\nimport { build as nodeBuild, BuildOptions } from '../../node/build';\nimport { handleUnexpectedError } from '../../node/core/errors';\n\ntype BuildCLIOptions = BuildOptions;\n\nconst action = async (options: BuildCLIOptions) => {\n try {\n if (options.bundler === 'webpack') {\n options.logger.warn(\n '[@strapi/strapi]: Using webpack as a bundler is deprecated. You should migrate to vite.'\n );\n }\n\n /**\n * ENFORCE NODE_ENV to production when building\n */\n process.env.NODE_ENV = process.env.NODE_ENV ?? 'production';\n\n if (process.env.NODE_ENV !== 'production') {\n options.logger.warn(\n '[@strapi/strapi]: The NODE_ENV is not set to production. This may result in unexpected behavior.'\n );\n }\n\n await nodeBuild(options);\n } catch (err) {\n handleUnexpectedError(err);\n }\n};\n\n/**\n * `$ strapi build`\n */\nconst command: StrapiCommand = ({ ctx }) => {\n return createCommand('build')\n .option('--bundler [bundler]', 'Bundler to use (webpack or vite)', 'vite')\n .option('-d, --debug', 'Enable debugging mode with verbose logs', false)\n .option('--minify', 'Minify the output', true)\n .option('--silent', \"Don't log anything\", false)\n .option('--sourcemap', 'Produce sourcemaps', false)\n .option('--stats', 'Print build statistics to the console', false)\n .description('Build the strapi admin app')\n .action(async (options: BuildCLIOptions) => {\n return action({ ...options, ...ctx });\n });\n};\n\nexport { command };\n"],"names":["nodeBuild"],"mappings":";;;AAQA,MAAM,SAAS,OAAO,YAA6B;AAC7C,MAAA;AACE,QAAA,QAAQ,YAAY,WAAW;AACjC,cAAQ,OAAO;AAAA,QACb;AAAA,MAAA;AAAA,IAEJ;AAKA,YAAQ,IAAI,WAAW,QAAQ,IAAI,YAAY;AAE3C,QAAA,QAAQ,IAAI,aAAa,cAAc;AACzC,cAAQ,OAAO;AAAA,QACb;AAAA,MAAA;AAAA,IAEJ;AAEA,UAAMA,MAAU,OAAO;AAAA,WAChB,KAAK;AACZ,0BAAsB,GAAG;AAAA,EAC3B;AACF;AAKA,MAAM,UAAyB,CAAC,EAAE,UAAU;AAC1C,SAAO,cAAc,OAAO,EACzB,OAAO,uBAAuB,oCAAoC,MAAM,EACxE,OAAO,eAAe,2CAA2C,KAAK,EACtE,OAAO,YAAY,qBAAqB,IAAI,EAC5C,OAAO,YAAY,sBAAsB,KAAK,EAC9C,OAAO,eAAe,sBAAsB,KAAK,EACjD,OAAO,WAAW,yCAAyC,KAAK,EAChE,YAAY,4BAA4B,EACxC,OAAO,OAAO,YAA6B;AAC1C,WAAO,OAAO,EAAE,GAAG,SAAS,GAAG,IAAK,CAAA;AAAA,EAAA,CACrC;AACL;"}
@@ -9,8 +9,8 @@ const _interopDefault = (e) => e && e.__esModule ? e : { default: e };
9
9
  const CLITable__default = /* @__PURE__ */ _interopDefault(CLITable);
10
10
  const chalk__default = /* @__PURE__ */ _interopDefault(chalk);
11
11
  const action = async () => {
12
- const appContext = await core.strapiFactory.compile();
13
- const app = await core.strapiFactory(appContext).register();
12
+ const appContext = await core.compileStrapi();
13
+ const app = await core.createStrapi(appContext).register();
14
14
  const list = Object.keys(app.components);
15
15
  const infoTable = new CLITable__default.default({
16
16
  head: [chalk__default.default.blue("Name")]
@@ -1 +1 @@
1
- {"version":3,"file":"list.js","sources":["../../../../src/cli/commands/components/list.ts"],"sourcesContent":["import { createCommand } from 'commander';\nimport CLITable from 'cli-table3';\nimport chalk from 'chalk';\nimport { strapiFactory } from '@strapi/core';\n\nimport type { StrapiCommand } from '../../types';\nimport { runAction } from '../../utils/helpers';\n\nconst action = async () => {\n const appContext = await strapiFactory.compile();\n const app = await strapiFactory(appContext).register();\n\n const list = Object.keys(app.components);\n\n const infoTable = new CLITable({\n head: [chalk.blue('Name')],\n });\n\n list.forEach((name) => infoTable.push([name]));\n\n console.log(infoTable.toString());\n\n await app.destroy();\n};\n\n/**\n * `$ strapi components:list`\n */\nconst command: StrapiCommand = () => {\n return createCommand('components:list')\n .description('List all the application components')\n .action(runAction('components:list', action));\n};\n\nexport { action, command };\n"],"names":["strapiFactory","CLITable","chalk","createCommand","runAction"],"mappings":";;;;;;;;;;AAQA,MAAM,SAAS,YAAY;AACnB,QAAA,aAAa,MAAMA,mBAAc;AACvC,QAAM,MAAM,MAAMA,KAAAA,cAAc,UAAU,EAAE,SAAS;AAErD,QAAM,OAAO,OAAO,KAAK,IAAI,UAAU;AAEjC,QAAA,YAAY,IAAIC,0BAAS;AAAA,IAC7B,MAAM,CAACC,eAAAA,QAAM,KAAK,MAAM,CAAC;AAAA,EAAA,CAC1B;AAEI,OAAA,QAAQ,CAAC,SAAS,UAAU,KAAK,CAAC,IAAI,CAAC,CAAC;AAErC,UAAA,IAAI,UAAU,SAAU,CAAA;AAEhC,QAAM,IAAI;AACZ;AAKA,MAAM,UAAyB,MAAM;AAC5B,SAAAC,wBAAc,iBAAiB,EACnC,YAAY,qCAAqC,EACjD,OAAOC,kBAAU,mBAAmB,MAAM,CAAC;AAChD;;;"}
1
+ {"version":3,"file":"list.js","sources":["../../../../src/cli/commands/components/list.ts"],"sourcesContent":["import { createCommand } from 'commander';\nimport CLITable from 'cli-table3';\nimport chalk from 'chalk';\nimport { createStrapi, compileStrapi } from '@strapi/core';\n\nimport type { StrapiCommand } from '../../types';\nimport { runAction } from '../../utils/helpers';\n\nconst action = async () => {\n const appContext = await compileStrapi();\n const app = await createStrapi(appContext).register();\n\n const list = Object.keys(app.components);\n\n const infoTable = new CLITable({\n head: [chalk.blue('Name')],\n });\n\n list.forEach((name) => infoTable.push([name]));\n\n console.log(infoTable.toString());\n\n await app.destroy();\n};\n\n/**\n * `$ strapi components:list`\n */\nconst command: StrapiCommand = () => {\n return createCommand('components:list')\n .description('List all the application components')\n .action(runAction('components:list', action));\n};\n\nexport { action, command };\n"],"names":["compileStrapi","createStrapi","CLITable","chalk","createCommand","runAction"],"mappings":";;;;;;;;;;AAQA,MAAM,SAAS,YAAY;AACnB,QAAA,aAAa,MAAMA,KAAAA;AACzB,QAAM,MAAM,MAAMC,KAAAA,aAAa,UAAU,EAAE,SAAS;AAEpD,QAAM,OAAO,OAAO,KAAK,IAAI,UAAU;AAEjC,QAAA,YAAY,IAAIC,0BAAS;AAAA,IAC7B,MAAM,CAACC,eAAAA,QAAM,KAAK,MAAM,CAAC;AAAA,EAAA,CAC1B;AAEI,OAAA,QAAQ,CAAC,SAAS,UAAU,KAAK,CAAC,IAAI,CAAC,CAAC;AAErC,UAAA,IAAI,UAAU,SAAU,CAAA;AAEhC,QAAM,IAAI;AACZ;AAKA,MAAM,UAAyB,MAAM;AAC5B,SAAAC,wBAAc,iBAAiB,EACnC,YAAY,qCAAqC,EACjD,OAAOC,kBAAU,mBAAmB,MAAM,CAAC;AAChD;;;"}
@@ -0,0 +1,24 @@
1
+ import { createCommand } from "commander";
2
+ import CLITable from "cli-table3";
3
+ import chalk from "chalk";
4
+ import { compileStrapi, createStrapi } from "@strapi/core";
5
+ import { runAction } from "../../utils/helpers.mjs";
6
+ const action = async () => {
7
+ const appContext = await compileStrapi();
8
+ const app = await createStrapi(appContext).register();
9
+ const list = Object.keys(app.components);
10
+ const infoTable = new CLITable({
11
+ head: [chalk.blue("Name")]
12
+ });
13
+ list.forEach((name) => infoTable.push([name]));
14
+ console.log(infoTable.toString());
15
+ await app.destroy();
16
+ };
17
+ const command = () => {
18
+ return createCommand("components:list").description("List all the application components").action(runAction("components:list", action));
19
+ };
20
+ export {
21
+ action,
22
+ command
23
+ };
24
+ //# sourceMappingURL=list.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"list.mjs","sources":["../../../../src/cli/commands/components/list.ts"],"sourcesContent":["import { createCommand } from 'commander';\nimport CLITable from 'cli-table3';\nimport chalk from 'chalk';\nimport { createStrapi, compileStrapi } from '@strapi/core';\n\nimport type { StrapiCommand } from '../../types';\nimport { runAction } from '../../utils/helpers';\n\nconst action = async () => {\n const appContext = await compileStrapi();\n const app = await createStrapi(appContext).register();\n\n const list = Object.keys(app.components);\n\n const infoTable = new CLITable({\n head: [chalk.blue('Name')],\n });\n\n list.forEach((name) => infoTable.push([name]));\n\n console.log(infoTable.toString());\n\n await app.destroy();\n};\n\n/**\n * `$ strapi components:list`\n */\nconst command: StrapiCommand = () => {\n return createCommand('components:list')\n .description('List all the application components')\n .action(runAction('components:list', action));\n};\n\nexport { action, command };\n"],"names":[],"mappings":";;;;;AAQA,MAAM,SAAS,YAAY;AACnB,QAAA,aAAa,MAAM;AACzB,QAAM,MAAM,MAAM,aAAa,UAAU,EAAE,SAAS;AAEpD,QAAM,OAAO,OAAO,KAAK,IAAI,UAAU;AAEjC,QAAA,YAAY,IAAI,SAAS;AAAA,IAC7B,MAAM,CAAC,MAAM,KAAK,MAAM,CAAC;AAAA,EAAA,CAC1B;AAEI,OAAA,QAAQ,CAAC,SAAS,UAAU,KAAK,CAAC,IAAI,CAAC,CAAC;AAErC,UAAA,IAAI,UAAU,SAAU,CAAA;AAEhC,QAAM,IAAI;AACZ;AAKA,MAAM,UAAyB,MAAM;AAC5B,SAAA,cAAc,iBAAiB,EACnC,YAAY,qCAAqC,EACjD,OAAO,UAAU,mBAAmB,MAAM,CAAC;AAChD;"}
@@ -9,8 +9,8 @@ const fs__default = /* @__PURE__ */ _interopDefault(fs);
9
9
  const CHUNK_SIZE = 100;
10
10
  const action = async ({ file: filePath, pretty }) => {
11
11
  const output = filePath ? fs__default.default.createWriteStream(filePath) : process.stdout;
12
- const appContext = await core.strapiFactory.compile();
13
- const app = await core.strapiFactory(appContext).load();
12
+ const appContext = await core.compileStrapi();
13
+ const app = await core.createStrapi(appContext).load();
14
14
  const count = await app.query("strapi::core-store").count();
15
15
  const exportData = [];
16
16
  const pageCount = Math.ceil(count / CHUNK_SIZE);
@@ -1 +1 @@
1
- {"version":3,"file":"dump.js","sources":["../../../../src/cli/commands/configuration/dump.ts"],"sourcesContent":["import fs from 'fs';\nimport { createCommand } from 'commander';\nimport { strapiFactory } from '@strapi/core';\n\nimport type { StrapiCommand } from '../../types';\nimport { runAction } from '../../utils/helpers';\n\ninterface CmdOptions {\n file?: string;\n pretty?: boolean;\n}\n\ninterface ExportItem {\n key: string;\n value: string;\n type: string;\n environment: string;\n tag: string;\n}\n\ninterface Output {\n write(str: string): void;\n end(): void;\n}\n\nconst CHUNK_SIZE = 100;\n\n/**\n * Will dump configurations to a file or stdout\n * @param {string} file filepath to use as output\n */\nconst action = async ({ file: filePath, pretty }: CmdOptions) => {\n const output: Output = filePath ? fs.createWriteStream(filePath) : process.stdout;\n\n const appContext = await strapiFactory.compile();\n const app = await strapiFactory(appContext).load();\n\n const count = await app.query('strapi::core-store').count();\n\n const exportData: ExportItem[] = [];\n\n const pageCount = Math.ceil(count / CHUNK_SIZE);\n\n for (let page = 0; page < pageCount; page += 1) {\n const results = await app\n .query('strapi::core-store')\n .findMany({ limit: CHUNK_SIZE, offset: page * CHUNK_SIZE, orderBy: 'key' });\n\n results\n .filter((result) => result.key.startsWith('plugin_'))\n .forEach((result) => {\n exportData.push({\n key: result.key,\n value: result.value,\n type: result.type,\n environment: result.environment,\n tag: result.tag,\n });\n });\n }\n\n const str = JSON.stringify(exportData, null, pretty ? 2 : undefined);\n\n output.write(str);\n output.write('\\n');\n output.end();\n\n // log success only when writting to file\n if (filePath) {\n console.log(`Successfully exported ${exportData.length} configuration entries`);\n }\n process.exit(0);\n};\n\n/**\n * `$ strapi configuration:dump`\n */\nconst command: StrapiCommand = () => {\n return createCommand('configuration:dump')\n .alias('config:dump')\n .description('Dump configurations of your application')\n .option('-f, --file <file>', 'Output file, default output is stdout')\n .option('-p, --pretty', 'Format the output JSON with indentation and line breaks', false)\n .action(runAction('configuration:dump', action));\n};\n\nexport { action, command };\n"],"names":["fs","strapiFactory","createCommand","runAction"],"mappings":";;;;;;;;AAyBA,MAAM,aAAa;AAMnB,MAAM,SAAS,OAAO,EAAE,MAAM,UAAU,aAAyB;AAC/D,QAAM,SAAiB,WAAWA,YAAA,QAAG,kBAAkB,QAAQ,IAAI,QAAQ;AAErE,QAAA,aAAa,MAAMC,mBAAc;AACvC,QAAM,MAAM,MAAMA,KAAAA,cAAc,UAAU,EAAE,KAAK;AAEjD,QAAM,QAAQ,MAAM,IAAI,MAAM,oBAAoB,EAAE;AAEpD,QAAM,aAA2B,CAAA;AAEjC,QAAM,YAAY,KAAK,KAAK,QAAQ,UAAU;AAE9C,WAAS,OAAO,GAAG,OAAO,WAAW,QAAQ,GAAG;AAC9C,UAAM,UAAU,MAAM,IACnB,MAAM,oBAAoB,EAC1B,SAAS,EAAE,OAAO,YAAY,QAAQ,OAAO,YAAY,SAAS,OAAO;AAGzE,YAAA,OAAO,CAAC,WAAW,OAAO,IAAI,WAAW,SAAS,CAAC,EACnD,QAAQ,CAAC,WAAW;AACnB,iBAAW,KAAK;AAAA,QACd,KAAK,OAAO;AAAA,QACZ,OAAO,OAAO;AAAA,QACd,MAAM,OAAO;AAAA,QACb,aAAa,OAAO;AAAA,QACpB,KAAK,OAAO;AAAA,MAAA,CACb;AAAA,IAAA,CACF;AAAA,EACL;AAEA,QAAM,MAAM,KAAK,UAAU,YAAY,MAAM,SAAS,IAAI,MAAS;AAEnE,SAAO,MAAM,GAAG;AAChB,SAAO,MAAM,IAAI;AACjB,SAAO,IAAI;AAGX,MAAI,UAAU;AACZ,YAAQ,IAAI,yBAAyB,WAAW,MAAM,wBAAwB;AAAA,EAChF;AACA,UAAQ,KAAK,CAAC;AAChB;AAKA,MAAM,UAAyB,MAAM;AAC5B,SAAAC,UAAA,cAAc,oBAAoB,EACtC,MAAM,aAAa,EACnB,YAAY,yCAAyC,EACrD,OAAO,qBAAqB,uCAAuC,EACnE,OAAO,gBAAgB,2DAA2D,KAAK,EACvF,OAAOC,kBAAU,sBAAsB,MAAM,CAAC;AACnD;;;"}
1
+ {"version":3,"file":"dump.js","sources":["../../../../src/cli/commands/configuration/dump.ts"],"sourcesContent":["import fs from 'fs';\nimport { createCommand } from 'commander';\nimport { createStrapi, compileStrapi } from '@strapi/core';\n\nimport type { StrapiCommand } from '../../types';\nimport { runAction } from '../../utils/helpers';\n\ninterface CmdOptions {\n file?: string;\n pretty?: boolean;\n}\n\ninterface ExportItem {\n key: string;\n value: string;\n type: string;\n environment: string;\n tag: string;\n}\n\ninterface Output {\n write(str: string): void;\n end(): void;\n}\n\nconst CHUNK_SIZE = 100;\n\n/**\n * Will dump configurations to a file or stdout\n * @param {string} file filepath to use as output\n */\nconst action = async ({ file: filePath, pretty }: CmdOptions) => {\n const output: Output = filePath ? fs.createWriteStream(filePath) : process.stdout;\n\n const appContext = await compileStrapi();\n const app = await createStrapi(appContext).load();\n\n const count = await app.query('strapi::core-store').count();\n\n const exportData: ExportItem[] = [];\n\n const pageCount = Math.ceil(count / CHUNK_SIZE);\n\n for (let page = 0; page < pageCount; page += 1) {\n const results = await app\n .query('strapi::core-store')\n .findMany({ limit: CHUNK_SIZE, offset: page * CHUNK_SIZE, orderBy: 'key' });\n\n results\n .filter((result) => result.key.startsWith('plugin_'))\n .forEach((result) => {\n exportData.push({\n key: result.key,\n value: result.value,\n type: result.type,\n environment: result.environment,\n tag: result.tag,\n });\n });\n }\n\n const str = JSON.stringify(exportData, null, pretty ? 2 : undefined);\n\n output.write(str);\n output.write('\\n');\n output.end();\n\n // log success only when writting to file\n if (filePath) {\n console.log(`Successfully exported ${exportData.length} configuration entries`);\n }\n process.exit(0);\n};\n\n/**\n * `$ strapi configuration:dump`\n */\nconst command: StrapiCommand = () => {\n return createCommand('configuration:dump')\n .alias('config:dump')\n .description('Dump configurations of your application')\n .option('-f, --file <file>', 'Output file, default output is stdout')\n .option('-p, --pretty', 'Format the output JSON with indentation and line breaks', false)\n .action(runAction('configuration:dump', action));\n};\n\nexport { action, command };\n"],"names":["fs","compileStrapi","createStrapi","createCommand","runAction"],"mappings":";;;;;;;;AAyBA,MAAM,aAAa;AAMnB,MAAM,SAAS,OAAO,EAAE,MAAM,UAAU,aAAyB;AAC/D,QAAM,SAAiB,WAAWA,YAAA,QAAG,kBAAkB,QAAQ,IAAI,QAAQ;AAErE,QAAA,aAAa,MAAMC,KAAAA;AACzB,QAAM,MAAM,MAAMC,KAAAA,aAAa,UAAU,EAAE,KAAK;AAEhD,QAAM,QAAQ,MAAM,IAAI,MAAM,oBAAoB,EAAE;AAEpD,QAAM,aAA2B,CAAA;AAEjC,QAAM,YAAY,KAAK,KAAK,QAAQ,UAAU;AAE9C,WAAS,OAAO,GAAG,OAAO,WAAW,QAAQ,GAAG;AAC9C,UAAM,UAAU,MAAM,IACnB,MAAM,oBAAoB,EAC1B,SAAS,EAAE,OAAO,YAAY,QAAQ,OAAO,YAAY,SAAS,OAAO;AAGzE,YAAA,OAAO,CAAC,WAAW,OAAO,IAAI,WAAW,SAAS,CAAC,EACnD,QAAQ,CAAC,WAAW;AACnB,iBAAW,KAAK;AAAA,QACd,KAAK,OAAO;AAAA,QACZ,OAAO,OAAO;AAAA,QACd,MAAM,OAAO;AAAA,QACb,aAAa,OAAO;AAAA,QACpB,KAAK,OAAO;AAAA,MAAA,CACb;AAAA,IAAA,CACF;AAAA,EACL;AAEA,QAAM,MAAM,KAAK,UAAU,YAAY,MAAM,SAAS,IAAI,MAAS;AAEnE,SAAO,MAAM,GAAG;AAChB,SAAO,MAAM,IAAI;AACjB,SAAO,IAAI;AAGX,MAAI,UAAU;AACZ,YAAQ,IAAI,yBAAyB,WAAW,MAAM,wBAAwB;AAAA,EAChF;AACA,UAAQ,KAAK,CAAC;AAChB;AAKA,MAAM,UAAyB,MAAM;AAC5B,SAAAC,UAAA,cAAc,oBAAoB,EACtC,MAAM,aAAa,EACnB,YAAY,yCAAyC,EACrD,OAAO,qBAAqB,uCAAuC,EACnE,OAAO,gBAAgB,2DAA2D,KAAK,EACvF,OAAOC,kBAAU,sBAAsB,MAAM,CAAC;AACnD;;;"}
@@ -0,0 +1,41 @@
1
+ import fs from "fs";
2
+ import { createCommand } from "commander";
3
+ import { compileStrapi, createStrapi } from "@strapi/core";
4
+ import { runAction } from "../../utils/helpers.mjs";
5
+ const CHUNK_SIZE = 100;
6
+ const action = async ({ file: filePath, pretty }) => {
7
+ const output = filePath ? fs.createWriteStream(filePath) : process.stdout;
8
+ const appContext = await compileStrapi();
9
+ const app = await createStrapi(appContext).load();
10
+ const count = await app.query("strapi::core-store").count();
11
+ const exportData = [];
12
+ const pageCount = Math.ceil(count / CHUNK_SIZE);
13
+ for (let page = 0; page < pageCount; page += 1) {
14
+ const results = await app.query("strapi::core-store").findMany({ limit: CHUNK_SIZE, offset: page * CHUNK_SIZE, orderBy: "key" });
15
+ results.filter((result) => result.key.startsWith("plugin_")).forEach((result) => {
16
+ exportData.push({
17
+ key: result.key,
18
+ value: result.value,
19
+ type: result.type,
20
+ environment: result.environment,
21
+ tag: result.tag
22
+ });
23
+ });
24
+ }
25
+ const str = JSON.stringify(exportData, null, pretty ? 2 : void 0);
26
+ output.write(str);
27
+ output.write("\n");
28
+ output.end();
29
+ if (filePath) {
30
+ console.log(`Successfully exported ${exportData.length} configuration entries`);
31
+ }
32
+ process.exit(0);
33
+ };
34
+ const command = () => {
35
+ return createCommand("configuration:dump").alias("config:dump").description("Dump configurations of your application").option("-f, --file <file>", "Output file, default output is stdout").option("-p, --pretty", "Format the output JSON with indentation and line breaks", false).action(runAction("configuration:dump", action));
36
+ };
37
+ export {
38
+ action,
39
+ command
40
+ };
41
+ //# sourceMappingURL=dump.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dump.mjs","sources":["../../../../src/cli/commands/configuration/dump.ts"],"sourcesContent":["import fs from 'fs';\nimport { createCommand } from 'commander';\nimport { createStrapi, compileStrapi } from '@strapi/core';\n\nimport type { StrapiCommand } from '../../types';\nimport { runAction } from '../../utils/helpers';\n\ninterface CmdOptions {\n file?: string;\n pretty?: boolean;\n}\n\ninterface ExportItem {\n key: string;\n value: string;\n type: string;\n environment: string;\n tag: string;\n}\n\ninterface Output {\n write(str: string): void;\n end(): void;\n}\n\nconst CHUNK_SIZE = 100;\n\n/**\n * Will dump configurations to a file or stdout\n * @param {string} file filepath to use as output\n */\nconst action = async ({ file: filePath, pretty }: CmdOptions) => {\n const output: Output = filePath ? fs.createWriteStream(filePath) : process.stdout;\n\n const appContext = await compileStrapi();\n const app = await createStrapi(appContext).load();\n\n const count = await app.query('strapi::core-store').count();\n\n const exportData: ExportItem[] = [];\n\n const pageCount = Math.ceil(count / CHUNK_SIZE);\n\n for (let page = 0; page < pageCount; page += 1) {\n const results = await app\n .query('strapi::core-store')\n .findMany({ limit: CHUNK_SIZE, offset: page * CHUNK_SIZE, orderBy: 'key' });\n\n results\n .filter((result) => result.key.startsWith('plugin_'))\n .forEach((result) => {\n exportData.push({\n key: result.key,\n value: result.value,\n type: result.type,\n environment: result.environment,\n tag: result.tag,\n });\n });\n }\n\n const str = JSON.stringify(exportData, null, pretty ? 2 : undefined);\n\n output.write(str);\n output.write('\\n');\n output.end();\n\n // log success only when writting to file\n if (filePath) {\n console.log(`Successfully exported ${exportData.length} configuration entries`);\n }\n process.exit(0);\n};\n\n/**\n * `$ strapi configuration:dump`\n */\nconst command: StrapiCommand = () => {\n return createCommand('configuration:dump')\n .alias('config:dump')\n .description('Dump configurations of your application')\n .option('-f, --file <file>', 'Output file, default output is stdout')\n .option('-p, --pretty', 'Format the output JSON with indentation and line breaks', false)\n .action(runAction('configuration:dump', action));\n};\n\nexport { action, command };\n"],"names":[],"mappings":";;;;AAyBA,MAAM,aAAa;AAMnB,MAAM,SAAS,OAAO,EAAE,MAAM,UAAU,aAAyB;AAC/D,QAAM,SAAiB,WAAW,GAAG,kBAAkB,QAAQ,IAAI,QAAQ;AAErE,QAAA,aAAa,MAAM;AACzB,QAAM,MAAM,MAAM,aAAa,UAAU,EAAE,KAAK;AAEhD,QAAM,QAAQ,MAAM,IAAI,MAAM,oBAAoB,EAAE;AAEpD,QAAM,aAA2B,CAAA;AAEjC,QAAM,YAAY,KAAK,KAAK,QAAQ,UAAU;AAE9C,WAAS,OAAO,GAAG,OAAO,WAAW,QAAQ,GAAG;AAC9C,UAAM,UAAU,MAAM,IACnB,MAAM,oBAAoB,EAC1B,SAAS,EAAE,OAAO,YAAY,QAAQ,OAAO,YAAY,SAAS,OAAO;AAGzE,YAAA,OAAO,CAAC,WAAW,OAAO,IAAI,WAAW,SAAS,CAAC,EACnD,QAAQ,CAAC,WAAW;AACnB,iBAAW,KAAK;AAAA,QACd,KAAK,OAAO;AAAA,QACZ,OAAO,OAAO;AAAA,QACd,MAAM,OAAO;AAAA,QACb,aAAa,OAAO;AAAA,QACpB,KAAK,OAAO;AAAA,MAAA,CACb;AAAA,IAAA,CACF;AAAA,EACL;AAEA,QAAM,MAAM,KAAK,UAAU,YAAY,MAAM,SAAS,IAAI,MAAS;AAEnE,SAAO,MAAM,GAAG;AAChB,SAAO,MAAM,IAAI;AACjB,SAAO,IAAI;AAGX,MAAI,UAAU;AACZ,YAAQ,IAAI,yBAAyB,WAAW,MAAM,wBAAwB;AAAA,EAChF;AACA,UAAQ,KAAK,CAAC;AAChB;AAKA,MAAM,UAAyB,MAAM;AAC5B,SAAA,cAAc,oBAAoB,EACtC,MAAM,aAAa,EACnB,YAAY,yCAAyC,EACrD,OAAO,qBAAqB,uCAAuC,EACnE,OAAO,gBAAgB,2DAA2D,KAAK,EACvF,OAAO,UAAU,sBAAsB,MAAM,CAAC;AACnD;"}
@@ -10,8 +10,8 @@ const fs__default = /* @__PURE__ */ _interopDefault(fs);
10
10
  const ___default = /* @__PURE__ */ _interopDefault(_);
11
11
  const action = async ({ file: filePath, strategy = "replace" }) => {
12
12
  const input = filePath ? fs__default.default.readFileSync(filePath) : await readStdin();
13
- const appContext = await core.strapiFactory.compile();
14
- const app = await core.strapiFactory(appContext).load();
13
+ const appContext = await core.compileStrapi();
14
+ const app = await core.createStrapi(appContext).load();
15
15
  let dataToImport;
16
16
  try {
17
17
  dataToImport = JSON.parse(___default.default.toString(input));