@strapi/strapi 5.12.1 → 5.12.3

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 (263) hide show
  1. package/dist/cli.js +89 -45
  2. package/dist/cli.js.map +1 -1
  3. package/dist/cli.mjs +90 -42
  4. package/dist/cli.mjs.map +1 -1
  5. package/dist/package.json.js +6 -0
  6. package/dist/package.json.js.map +1 -0
  7. package/dist/package.json.mjs +4 -0
  8. package/dist/package.json.mjs.map +1 -0
  9. package/dist/src/cli/commands/admin/create-user.js +124 -0
  10. package/dist/src/cli/commands/admin/create-user.js.map +1 -0
  11. package/dist/src/cli/commands/admin/create-user.mjs +121 -0
  12. package/dist/src/cli/commands/admin/create-user.mjs.map +1 -0
  13. package/dist/src/cli/commands/admin/reset-user-password.js +61 -0
  14. package/dist/src/cli/commands/admin/reset-user-password.js.map +1 -0
  15. package/dist/src/cli/commands/admin/reset-user-password.mjs +58 -0
  16. package/dist/src/cli/commands/admin/reset-user-password.mjs.map +1 -0
  17. package/dist/src/cli/commands/build.js +29 -0
  18. package/dist/src/cli/commands/build.js.map +1 -0
  19. package/dist/src/cli/commands/build.mjs +27 -0
  20. package/dist/src/cli/commands/build.mjs.map +1 -0
  21. package/dist/src/cli/commands/components/list.js +32 -0
  22. package/dist/src/cli/commands/components/list.js.map +1 -0
  23. package/dist/src/cli/commands/components/list.mjs +29 -0
  24. package/dist/src/cli/commands/components/list.mjs.map +1 -0
  25. package/dist/src/cli/commands/configuration/dump.js +53 -0
  26. package/dist/src/cli/commands/configuration/dump.js.map +1 -0
  27. package/dist/src/cli/commands/configuration/dump.mjs +50 -0
  28. package/dist/src/cli/commands/configuration/dump.mjs.map +1 -0
  29. package/dist/src/cli/commands/configuration/restore.js +173 -0
  30. package/dist/src/cli/commands/configuration/restore.js.map +1 -0
  31. package/dist/src/cli/commands/configuration/restore.mjs +170 -0
  32. package/dist/src/cli/commands/configuration/restore.mjs.map +1 -0
  33. package/dist/src/cli/commands/console.js +31 -0
  34. package/dist/src/cli/commands/console.js.map +1 -0
  35. package/dist/src/cli/commands/console.mjs +28 -0
  36. package/dist/src/cli/commands/console.mjs.map +1 -0
  37. package/dist/src/cli/commands/content-types/list.js +32 -0
  38. package/dist/src/cli/commands/content-types/list.js.map +1 -0
  39. package/dist/src/cli/commands/content-types/list.mjs +29 -0
  40. package/dist/src/cli/commands/content-types/list.mjs.map +1 -0
  41. package/dist/src/cli/commands/controllers/list.js +32 -0
  42. package/dist/src/cli/commands/controllers/list.js.map +1 -0
  43. package/dist/src/cli/commands/controllers/list.mjs +29 -0
  44. package/dist/src/cli/commands/controllers/list.mjs.map +1 -0
  45. package/dist/src/cli/commands/develop.js +32 -0
  46. package/dist/src/cli/commands/develop.js.map +1 -0
  47. package/dist/src/cli/commands/develop.mjs +30 -0
  48. package/dist/src/cli/commands/develop.mjs.map +1 -0
  49. package/dist/src/cli/commands/export/action.js +126 -0
  50. package/dist/src/cli/commands/export/action.js.map +1 -0
  51. package/dist/src/cli/commands/export/action.mjs +124 -0
  52. package/dist/src/cli/commands/export/action.mjs.map +1 -0
  53. package/dist/src/cli/commands/export/command.js +15 -0
  54. package/dist/src/cli/commands/export/command.js.map +1 -0
  55. package/dist/src/cli/commands/export/command.mjs +13 -0
  56. package/dist/src/cli/commands/export/command.mjs.map +1 -0
  57. package/dist/src/cli/commands/generate.js +18 -0
  58. package/dist/src/cli/commands/generate.js.map +1 -0
  59. package/dist/src/cli/commands/generate.mjs +16 -0
  60. package/dist/src/cli/commands/generate.mjs.map +1 -0
  61. package/dist/src/cli/commands/hooks/list.js +32 -0
  62. package/dist/src/cli/commands/hooks/list.js.map +1 -0
  63. package/dist/src/cli/commands/hooks/list.mjs +29 -0
  64. package/dist/src/cli/commands/hooks/list.mjs.map +1 -0
  65. package/dist/src/cli/commands/import/action.js +124 -0
  66. package/dist/src/cli/commands/import/action.js.map +1 -0
  67. package/dist/src/cli/commands/import/action.mjs +122 -0
  68. package/dist/src/cli/commands/import/action.mjs.map +1 -0
  69. package/dist/src/cli/commands/import/command.js +59 -0
  70. package/dist/src/cli/commands/import/command.js.map +1 -0
  71. package/dist/src/cli/commands/import/command.mjs +57 -0
  72. package/dist/src/cli/commands/import/command.mjs.map +1 -0
  73. package/dist/src/cli/commands/index.js +64 -0
  74. package/dist/src/cli/commands/index.js.map +1 -0
  75. package/dist/src/cli/commands/index.mjs +62 -0
  76. package/dist/src/cli/commands/index.mjs.map +1 -0
  77. package/dist/src/cli/commands/middlewares/list.js +32 -0
  78. package/dist/src/cli/commands/middlewares/list.js.map +1 -0
  79. package/dist/src/cli/commands/middlewares/list.mjs +29 -0
  80. package/dist/src/cli/commands/middlewares/list.mjs.map +1 -0
  81. package/dist/src/cli/commands/policies/list.js +32 -0
  82. package/dist/src/cli/commands/policies/list.js.map +1 -0
  83. package/dist/src/cli/commands/policies/list.mjs +29 -0
  84. package/dist/src/cli/commands/policies/list.mjs.map +1 -0
  85. package/dist/src/cli/commands/report.js +39 -0
  86. package/dist/src/cli/commands/report.js.map +1 -0
  87. package/dist/src/cli/commands/report.mjs +37 -0
  88. package/dist/src/cli/commands/report.mjs.map +1 -0
  89. package/dist/src/cli/commands/routes/list.js +40 -0
  90. package/dist/src/cli/commands/routes/list.js.map +1 -0
  91. package/dist/src/cli/commands/routes/list.mjs +37 -0
  92. package/dist/src/cli/commands/routes/list.mjs.map +1 -0
  93. package/dist/src/cli/commands/services/list.js +32 -0
  94. package/dist/src/cli/commands/services/list.js.map +1 -0
  95. package/dist/src/cli/commands/services/list.mjs +29 -0
  96. package/dist/src/cli/commands/services/list.mjs.map +1 -0
  97. package/dist/src/cli/commands/start.js +28 -0
  98. package/dist/src/cli/commands/start.js.map +1 -0
  99. package/dist/src/cli/commands/start.mjs +26 -0
  100. package/dist/src/cli/commands/start.mjs.map +1 -0
  101. package/dist/src/cli/commands/telemetry/disable.js +72 -0
  102. package/dist/src/cli/commands/telemetry/disable.js.map +1 -0
  103. package/dist/src/cli/commands/telemetry/disable.mjs +69 -0
  104. package/dist/src/cli/commands/telemetry/disable.mjs.map +1 -0
  105. package/dist/src/cli/commands/telemetry/enable.js +88 -0
  106. package/dist/src/cli/commands/telemetry/enable.js.map +1 -0
  107. package/dist/src/cli/commands/telemetry/enable.mjs +85 -0
  108. package/dist/src/cli/commands/telemetry/enable.mjs.map +1 -0
  109. package/dist/src/cli/commands/templates/generate.js +15 -0
  110. package/dist/src/cli/commands/templates/generate.js.map +1 -0
  111. package/dist/src/cli/commands/templates/generate.mjs +13 -0
  112. package/dist/src/cli/commands/templates/generate.mjs.map +1 -0
  113. package/dist/src/cli/commands/transfer/action.js +141 -0
  114. package/dist/src/cli/commands/transfer/action.js.map +1 -0
  115. package/dist/src/cli/commands/transfer/action.mjs +139 -0
  116. package/dist/src/cli/commands/transfer/action.mjs.map +1 -0
  117. package/dist/src/cli/commands/transfer/command.js +61 -0
  118. package/dist/src/cli/commands/transfer/command.js.map +1 -0
  119. package/dist/src/cli/commands/transfer/command.mjs +59 -0
  120. package/dist/src/cli/commands/transfer/command.mjs.map +1 -0
  121. package/dist/src/cli/commands/ts/generate-types.js +40 -0
  122. package/dist/src/cli/commands/ts/generate-types.js.map +1 -0
  123. package/dist/src/cli/commands/ts/generate-types.mjs +37 -0
  124. package/dist/src/cli/commands/ts/generate-types.mjs.map +1 -0
  125. package/dist/src/cli/commands/version.js +17 -0
  126. package/dist/src/cli/commands/version.js.map +1 -0
  127. package/dist/src/cli/commands/version.mjs +15 -0
  128. package/dist/src/cli/commands/version.mjs.map +1 -0
  129. package/dist/src/cli/utils/commander.js +125 -0
  130. package/dist/src/cli/utils/commander.js.map +1 -0
  131. package/dist/src/cli/utils/commander.mjs +116 -0
  132. package/dist/src/cli/utils/commander.mjs.map +1 -0
  133. package/dist/src/cli/utils/data-transfer.js +378 -0
  134. package/dist/src/cli/utils/data-transfer.js.map +1 -0
  135. package/dist/src/cli/utils/data-transfer.mjs +359 -0
  136. package/dist/src/cli/utils/data-transfer.mjs.map +1 -0
  137. package/dist/src/cli/utils/helpers.js +114 -0
  138. package/dist/src/cli/utils/helpers.js.map +1 -0
  139. package/dist/src/cli/utils/helpers.mjs +107 -0
  140. package/dist/src/cli/utils/helpers.mjs.map +1 -0
  141. package/dist/src/cli/utils/logger.js +125 -0
  142. package/dist/src/cli/utils/logger.js.map +1 -0
  143. package/dist/src/cli/utils/logger.mjs +104 -0
  144. package/dist/src/cli/utils/logger.mjs.map +1 -0
  145. package/dist/src/cli/utils/telemetry.js +27 -0
  146. package/dist/src/cli/utils/telemetry.js.map +1 -0
  147. package/dist/src/cli/utils/telemetry.mjs +25 -0
  148. package/dist/src/cli/utils/telemetry.mjs.map +1 -0
  149. package/dist/src/cli/utils/tsconfig.js +25 -0
  150. package/dist/src/cli/utils/tsconfig.js.map +1 -0
  151. package/dist/src/cli/utils/tsconfig.mjs +23 -0
  152. package/dist/src/cli/utils/tsconfig.mjs.map +1 -0
  153. package/dist/src/node/build.js +90 -0
  154. package/dist/src/node/build.js.map +1 -0
  155. package/dist/src/node/build.mjs +69 -0
  156. package/dist/src/node/build.mjs.map +1 -0
  157. package/dist/src/node/core/admin-customisations.js +27 -0
  158. package/dist/src/node/core/admin-customisations.js.map +1 -0
  159. package/dist/src/node/core/admin-customisations.mjs +25 -0
  160. package/dist/src/node/core/admin-customisations.mjs.map +1 -0
  161. package/dist/{chunks/aliases-BkD9BImE.js → src/node/core/aliases.js} +3 -42
  162. package/dist/src/node/core/aliases.js.map +1 -0
  163. package/dist/{chunks/aliases-CZgVGGH9.mjs → src/node/core/aliases.mjs} +4 -41
  164. package/dist/src/node/core/aliases.mjs.map +1 -0
  165. package/dist/src/node/core/config.js +18 -0
  166. package/dist/src/node/core/config.js.map +1 -0
  167. package/dist/src/node/core/config.mjs +16 -0
  168. package/dist/src/node/core/config.mjs.map +1 -0
  169. package/dist/src/node/core/dependencies.js +186 -0
  170. package/dist/src/node/core/dependencies.js.map +1 -0
  171. package/dist/src/node/core/dependencies.mjs +183 -0
  172. package/dist/src/node/core/dependencies.mjs.map +1 -0
  173. package/dist/src/node/core/env.js +32 -0
  174. package/dist/src/node/core/env.js.map +1 -0
  175. package/dist/src/node/core/env.mjs +29 -0
  176. package/dist/src/node/core/env.mjs.map +1 -0
  177. package/dist/src/node/core/errors.js +51 -0
  178. package/dist/src/node/core/errors.js.map +1 -0
  179. package/dist/src/node/core/errors.mjs +48 -0
  180. package/dist/src/node/core/errors.mjs.map +1 -0
  181. package/dist/src/node/core/files.js +68 -0
  182. package/dist/src/node/core/files.js.map +1 -0
  183. package/dist/src/node/core/files.mjs +63 -0
  184. package/dist/src/node/core/files.mjs.map +1 -0
  185. package/dist/src/node/core/managers.js +27 -0
  186. package/dist/src/node/core/managers.js.map +1 -0
  187. package/dist/src/node/core/managers.mjs +25 -0
  188. package/dist/src/node/core/managers.mjs.map +1 -0
  189. package/dist/src/node/core/monorepo.js +30 -0
  190. package/dist/src/node/core/monorepo.js.map +1 -0
  191. package/dist/src/node/core/monorepo.mjs +28 -0
  192. package/dist/src/node/core/monorepo.mjs.map +1 -0
  193. package/dist/src/node/core/plugins.js +140 -0
  194. package/dist/src/node/core/plugins.js.map +1 -0
  195. package/dist/src/node/core/plugins.mjs +137 -0
  196. package/dist/src/node/core/plugins.mjs.map +1 -0
  197. package/dist/src/node/core/timer.js +33 -0
  198. package/dist/src/node/core/timer.js.map +1 -0
  199. package/dist/src/node/core/timer.mjs +30 -0
  200. package/dist/src/node/core/timer.mjs.map +1 -0
  201. package/dist/src/node/create-build-context.js +111 -0
  202. package/dist/src/node/create-build-context.js.map +1 -0
  203. package/dist/src/node/create-build-context.mjs +109 -0
  204. package/dist/src/node/create-build-context.mjs.map +1 -0
  205. package/dist/src/node/develop.js +312 -0
  206. package/dist/src/node/develop.js.map +1 -0
  207. package/dist/src/node/develop.mjs +291 -0
  208. package/dist/src/node/develop.mjs.map +1 -0
  209. package/dist/src/node/staticFiles.js +81 -0
  210. package/dist/src/node/staticFiles.js.map +1 -0
  211. package/dist/src/node/staticFiles.mjs +78 -0
  212. package/dist/src/node/staticFiles.mjs.map +1 -0
  213. package/dist/src/node/vite/build.js +14 -0
  214. package/dist/src/node/vite/build.js.map +1 -0
  215. package/dist/src/node/vite/build.mjs +12 -0
  216. package/dist/src/node/vite/build.mjs.map +1 -0
  217. package/dist/{chunks/config-D3Y5s3ui.js → src/node/vite/config.js} +12 -50
  218. package/dist/src/node/vite/config.js.map +1 -0
  219. package/dist/{chunks/config-BFUn1raM.mjs → src/node/vite/config.mjs} +6 -44
  220. package/dist/src/node/vite/config.mjs.map +1 -0
  221. package/dist/src/node/vite/plugins.js +46 -0
  222. package/dist/src/node/vite/plugins.js.map +1 -0
  223. package/dist/src/node/vite/plugins.mjs +44 -0
  224. package/dist/src/node/vite/plugins.mjs.map +1 -0
  225. package/dist/{chunks/watch-gkyBsmAJ.js → src/node/vite/watch.js} +2 -45
  226. package/dist/src/node/vite/watch.js.map +1 -0
  227. package/dist/{chunks/watch-DUnlAAiK.mjs → src/node/vite/watch.mjs} +2 -45
  228. package/dist/src/node/vite/watch.mjs.map +1 -0
  229. package/dist/src/node/webpack/build.js +37 -0
  230. package/dist/src/node/webpack/build.js.map +1 -0
  231. package/dist/src/node/webpack/build.mjs +35 -0
  232. package/dist/src/node/webpack/build.mjs.map +1 -0
  233. package/dist/{chunks/config-Bcu3_xSp.js → src/node/webpack/config.js} +10 -8
  234. package/dist/src/node/webpack/config.js.map +1 -0
  235. package/dist/{chunks/config-DKpJU9io.mjs → src/node/webpack/config.mjs} +5 -3
  236. package/dist/src/node/webpack/config.mjs.map +1 -0
  237. package/dist/{chunks/watch-CNfkm7Fm.js → src/node/webpack/watch.js} +2 -51
  238. package/dist/src/node/webpack/watch.js.map +1 -0
  239. package/dist/{chunks/watch-BEC39t49.mjs → src/node/webpack/watch.mjs} +2 -51
  240. package/dist/src/node/webpack/watch.mjs.map +1 -0
  241. package/package.json +22 -22
  242. package/dist/chunks/aliases-BkD9BImE.js.map +0 -1
  243. package/dist/chunks/aliases-CZgVGGH9.mjs.map +0 -1
  244. package/dist/chunks/build-B6f5SABm.js +0 -87
  245. package/dist/chunks/build-B6f5SABm.js.map +0 -1
  246. package/dist/chunks/build-BQc6C2UF.mjs +0 -85
  247. package/dist/chunks/build-BQc6C2UF.mjs.map +0 -1
  248. package/dist/chunks/build-C4qN5x5L.js +0 -59
  249. package/dist/chunks/build-C4qN5x5L.js.map +0 -1
  250. package/dist/chunks/build-D6MP0Rwu.mjs +0 -57
  251. package/dist/chunks/build-D6MP0Rwu.mjs.map +0 -1
  252. package/dist/chunks/config-BFUn1raM.mjs.map +0 -1
  253. package/dist/chunks/config-Bcu3_xSp.js.map +0 -1
  254. package/dist/chunks/config-D3Y5s3ui.js.map +0 -1
  255. package/dist/chunks/config-DKpJU9io.mjs.map +0 -1
  256. package/dist/chunks/index-DGhshfMs.mjs +0 -3160
  257. package/dist/chunks/index-DGhshfMs.mjs.map +0 -1
  258. package/dist/chunks/index-DW2NjgW9.js +0 -3185
  259. package/dist/chunks/index-DW2NjgW9.js.map +0 -1
  260. package/dist/chunks/watch-BEC39t49.mjs.map +0 -1
  261. package/dist/chunks/watch-CNfkm7Fm.js.map +0 -1
  262. package/dist/chunks/watch-DUnlAAiK.mjs.map +0 -1
  263. package/dist/chunks/watch-gkyBsmAJ.js.map +0 -1
package/dist/cli.js CHANGED
@@ -1,50 +1,94 @@
1
1
  'use strict';
2
2
 
3
- require('commander');
4
- var cli = require('./chunks/index-DW2NjgW9.js');
5
- require('@strapi/cloud-cli');
6
- require('@strapi/utils');
7
- require('lodash');
8
- require('inquirer');
9
- require('@strapi/core');
10
- require('chalk');
11
- require('lodash/fp');
12
- require('boxen');
13
- require('cli-table3');
14
- require('fs');
15
- require('path');
16
- require('fs-extra');
17
- require('crypto');
18
- require('@strapi/typescript-utils');
19
- require('node:os');
20
- require('node:fs/promises');
21
- require('node:path');
22
- require('semver');
23
- require('resolve-from');
24
- require('execa');
25
- require('read-pkg-up');
26
- require('perf_hooks');
27
- require('browserslist');
28
- require('dotenv');
29
- require('esbuild-register/dist/node');
30
- require('node:fs');
31
- require('lodash/camelCase');
32
- require('outdent');
33
- require('react');
34
- require('react-dom/server');
35
- require('@strapi/admin/_internal');
36
- require('repl');
37
- require('node:cluster');
38
- require('chokidar');
39
- require('os');
40
- require('@strapi/logger');
41
- require('ora');
42
- require('@strapi/data-transfer');
43
- require('cli-progress');
44
- require('typescript');
3
+ var commander = require('commander');
4
+ var index = require('./src/cli/commands/index.js');
5
+ var logger = require('./src/cli/utils/logger.js');
6
+ var tsconfig = require('./src/cli/utils/tsconfig.js');
7
+ var _package = require('./package.json.js');
45
8
 
9
+ const createCLI = async (argv, command = new commander.Command())=>{
10
+ // Initial program setup
11
+ command.storeOptionsAsProperties(false).allowUnknownOption(true);
12
+ // Help command
13
+ command.helpOption('-h, --help', 'Display help for command');
14
+ command.addHelpCommand('help [command]', 'Display help for command');
15
+ command.version(_package.version, '-v, --version', 'Output the version number');
16
+ const cwd = process.cwd();
17
+ const hasDebug = argv.includes('--debug');
18
+ const hasSilent = argv.includes('--silent');
19
+ const logger$1 = logger.createLogger({
20
+ debug: hasDebug,
21
+ silent: hasSilent,
22
+ timestamp: false
23
+ });
24
+ const tsconfig$1 = tsconfig.loadTsConfig({
25
+ cwd,
26
+ path: 'tsconfig.json',
27
+ logger: logger$1
28
+ });
29
+ const ctx = {
30
+ cwd,
31
+ logger: logger$1,
32
+ tsconfig: tsconfig$1
33
+ };
34
+ // Load all commands
35
+ for (const commandFactory of index.commands){
36
+ try {
37
+ const subCommand = await commandFactory({
38
+ command,
39
+ argv,
40
+ ctx
41
+ });
42
+ // Add this command to the Commander command object
43
+ if (subCommand) {
44
+ command.addCommand(subCommand);
45
+ }
46
+ } catch (e) {
47
+ console.error(`Failed to load command`, e);
48
+ }
49
+ }
50
+ // TODO v6: remove these deprecation notices
51
+ const deprecatedCommands = [
52
+ {
53
+ name: 'plugin:init',
54
+ message: 'Please use `npx @strapi/sdk-plugin init` instead.'
55
+ },
56
+ {
57
+ name: 'plugin:verify',
58
+ message: 'After migrating your plugin to v5, use `strapi-plugin verify`'
59
+ },
60
+ {
61
+ name: 'plugin:watch',
62
+ message: 'After migrating your plugin to v5, use `strapi-plugin watch`'
63
+ },
64
+ {
65
+ name: 'plugin:watch:link',
66
+ message: 'After migrating your plugin to v5, use `strapi-plugin watch:link`'
67
+ },
68
+ {
69
+ name: 'plugin:build',
70
+ message: 'After migrating your plugin to v5, use `strapi-plugin build`'
71
+ }
72
+ ];
73
+ // Add hidden commands for deprecatedCommands that output a warning that the command has been removed.
74
+ deprecatedCommands.forEach(({ name, message })=>{
75
+ const deprecated = new commander.Command(name).command(name).description('(deprecated)').action(()=>{
76
+ console.warn(`The command ${name} has been deprecated. See the Strapi 5 migration guide for more information.`);
77
+ if (message) {
78
+ console.warn(message);
79
+ }
80
+ });
81
+ command.addCommand(deprecated, {
82
+ hidden: true
83
+ });
84
+ });
85
+ return command;
86
+ };
87
+ const runCLI = async (argv = process.argv, command = new commander.Command())=>{
88
+ const commands = await createCLI(argv, command);
89
+ await commands.parseAsync(argv);
90
+ };
46
91
 
47
-
48
- exports.createCLI = cli.createCLI;
49
- exports.runCLI = cli.runCLI;
92
+ exports.createCLI = createCLI;
93
+ exports.runCLI = runCLI;
50
94
  //# sourceMappingURL=cli.js.map
package/dist/cli.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"cli.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"cli.js","sources":["../src/cli/index.ts"],"sourcesContent":["import { Command } from 'commander';\n\nimport { commands as strapiCommands } from './commands';\n\nimport { createLogger } from './utils/logger';\nimport { loadTsConfig } from './utils/tsconfig';\nimport { CLIContext } from './types';\nimport { version } from '../../package.json';\n\nconst createCLI = async (argv: string[], command = new Command()) => {\n // Initial program setup\n command.storeOptionsAsProperties(false).allowUnknownOption(true);\n\n // Help command\n command.helpOption('-h, --help', 'Display help for command');\n command.addHelpCommand('help [command]', 'Display help for command');\n\n command.version(version, '-v, --version', 'Output the version number');\n\n const cwd = process.cwd();\n\n const hasDebug = argv.includes('--debug');\n const hasSilent = argv.includes('--silent');\n\n const logger = createLogger({ debug: hasDebug, silent: hasSilent, timestamp: false });\n\n const tsconfig = loadTsConfig({\n cwd,\n path: 'tsconfig.json',\n logger,\n });\n\n const ctx = {\n cwd,\n logger,\n tsconfig,\n } satisfies CLIContext;\n\n // Load all commands\n for (const commandFactory of strapiCommands) {\n try {\n const subCommand = await commandFactory({ command, argv, ctx });\n\n // Add this command to the Commander command object\n if (subCommand) {\n command.addCommand(subCommand);\n }\n } catch (e) {\n console.error(`Failed to load command`, e);\n }\n }\n\n // TODO v6: remove these deprecation notices\n const deprecatedCommands = [\n { name: 'plugin:init', message: 'Please use `npx @strapi/sdk-plugin init` instead.' },\n {\n name: 'plugin:verify',\n message: 'After migrating your plugin to v5, use `strapi-plugin verify`',\n },\n {\n name: 'plugin:watch',\n message: 'After migrating your plugin to v5, use `strapi-plugin watch`',\n },\n {\n name: 'plugin:watch:link',\n message: 'After migrating your plugin to v5, use `strapi-plugin watch:link`',\n },\n {\n name: 'plugin:build',\n message: 'After migrating your plugin to v5, use `strapi-plugin build`',\n },\n ];\n\n // Add hidden commands for deprecatedCommands that output a warning that the command has been removed.\n deprecatedCommands.forEach(({ name, message }) => {\n const deprecated = new Command(name)\n .command(name)\n .description('(deprecated)')\n .action(() => {\n console.warn(\n `The command ${name} has been deprecated. See the Strapi 5 migration guide for more information.`\n );\n if (message) {\n console.warn(message);\n }\n });\n command.addCommand(deprecated, { hidden: true });\n });\n return command;\n};\n\nconst runCLI = async (argv = process.argv, command = new Command()) => {\n const commands = await createCLI(argv, command);\n await commands.parseAsync(argv);\n};\n\nexport { runCLI, createCLI };\n"],"names":["createCLI","argv","command","Command","storeOptionsAsProperties","allowUnknownOption","helpOption","addHelpCommand","version","cwd","process","hasDebug","includes","hasSilent","logger","createLogger","debug","silent","timestamp","tsconfig","loadTsConfig","path","ctx","commandFactory","strapiCommands","subCommand","addCommand","e","console","error","deprecatedCommands","name","message","forEach","deprecated","description","action","warn","hidden","runCLI","commands","parseAsync"],"mappings":";;;;;;;;AASA,MAAMA,SAAY,GAAA,OAAOC,IAAgBC,EAAAA,OAAAA,GAAU,IAAIC,iBAAS,EAAA,GAAA;;AAE9DD,IAAAA,OAAAA,CAAQE,wBAAwB,CAAC,KAAOC,CAAAA,CAAAA,kBAAkB,CAAC,IAAA,CAAA;;IAG3DH,OAAQI,CAAAA,UAAU,CAAC,YAAc,EAAA,0BAAA,CAAA;IACjCJ,OAAQK,CAAAA,cAAc,CAAC,gBAAkB,EAAA,0BAAA,CAAA;IAEzCL,OAAQM,CAAAA,OAAO,CAACA,gBAAAA,EAAS,eAAiB,EAAA,2BAAA,CAAA;IAE1C,MAAMC,GAAAA,GAAMC,QAAQD,GAAG,EAAA;IAEvB,MAAME,QAAAA,GAAWV,IAAKW,CAAAA,QAAQ,CAAC,SAAA,CAAA;IAC/B,MAAMC,SAAAA,GAAYZ,IAAKW,CAAAA,QAAQ,CAAC,UAAA,CAAA;AAEhC,IAAA,MAAME,WAASC,mBAAa,CAAA;QAAEC,KAAOL,EAAAA,QAAAA;QAAUM,MAAQJ,EAAAA,SAAAA;QAAWK,SAAW,EAAA;AAAM,KAAA,CAAA;AAEnF,IAAA,MAAMC,aAAWC,qBAAa,CAAA;AAC5BX,QAAAA,GAAAA;QACAY,IAAM,EAAA,eAAA;AACNP,gBAAAA;AACF,KAAA,CAAA;AAEA,IAAA,MAAMQ,GAAM,GAAA;AACVb,QAAAA,GAAAA;AACAK,gBAAAA,QAAAA;AACAK,kBAAAA;AACF,KAAA;;IAGA,KAAK,MAAMI,kBAAkBC,cAAgB,CAAA;QAC3C,IAAI;YACF,MAAMC,UAAAA,GAAa,MAAMF,cAAe,CAAA;AAAErB,gBAAAA,OAAAA;AAASD,gBAAAA,IAAAA;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AAS,OAAOtC,IAAOS,GAAAA,OAAAA,CAAQT,IAAI,EAAEC,OAAAA,GAAU,IAAIC,iBAAS,EAAA,GAAA;IAChE,MAAMqC,QAAAA,GAAW,MAAMxC,SAAAA,CAAUC,IAAMC,EAAAA,OAAAA,CAAAA;IACvC,MAAMsC,QAAAA,CAASC,UAAU,CAACxC,IAAAA,CAAAA;AAC5B;;;;;"}
package/dist/cli.mjs CHANGED
@@ -1,43 +1,91 @@
1
- import 'commander';
2
- export { c as createCLI, r as runCLI } from './chunks/index-DGhshfMs.mjs';
3
- import '@strapi/cloud-cli';
4
- import '@strapi/utils';
5
- import 'lodash';
6
- import 'inquirer';
7
- import '@strapi/core';
8
- import 'chalk';
9
- import 'lodash/fp';
10
- import 'boxen';
11
- import 'cli-table3';
12
- import 'fs';
13
- import 'path';
14
- import 'fs-extra';
15
- import 'crypto';
16
- import '@strapi/typescript-utils';
17
- import 'node:os';
18
- import 'node:fs/promises';
19
- import 'node:path';
20
- import 'semver';
21
- import 'resolve-from';
22
- import 'execa';
23
- import 'read-pkg-up';
24
- import 'perf_hooks';
25
- import 'browserslist';
26
- import 'dotenv';
27
- import 'esbuild-register/dist/node';
28
- import 'node:fs';
29
- import 'lodash/camelCase';
30
- import 'outdent';
31
- import 'react';
32
- import 'react-dom/server';
33
- import '@strapi/admin/_internal';
34
- import 'repl';
35
- import 'node:cluster';
36
- import 'chokidar';
37
- import 'os';
38
- import '@strapi/logger';
39
- import 'ora';
40
- import '@strapi/data-transfer';
41
- import 'cli-progress';
42
- import 'typescript';
1
+ import { Command } from 'commander';
2
+ import { commands } from './src/cli/commands/index.mjs';
3
+ import { createLogger } from './src/cli/utils/logger.mjs';
4
+ import { loadTsConfig } from './src/cli/utils/tsconfig.mjs';
5
+ import { version } from './package.json.mjs';
6
+
7
+ const createCLI = async (argv, command = new Command())=>{
8
+ // Initial program setup
9
+ command.storeOptionsAsProperties(false).allowUnknownOption(true);
10
+ // Help command
11
+ command.helpOption('-h, --help', 'Display help for command');
12
+ command.addHelpCommand('help [command]', 'Display help for command');
13
+ command.version(version, '-v, --version', 'Output the version number');
14
+ const cwd = process.cwd();
15
+ const hasDebug = argv.includes('--debug');
16
+ const hasSilent = argv.includes('--silent');
17
+ const logger = createLogger({
18
+ debug: hasDebug,
19
+ silent: hasSilent,
20
+ timestamp: false
21
+ });
22
+ const tsconfig = loadTsConfig({
23
+ cwd,
24
+ path: 'tsconfig.json',
25
+ logger
26
+ });
27
+ const ctx = {
28
+ cwd,
29
+ logger,
30
+ tsconfig
31
+ };
32
+ // Load all commands
33
+ for (const commandFactory of commands){
34
+ try {
35
+ const subCommand = await commandFactory({
36
+ command,
37
+ argv,
38
+ ctx
39
+ });
40
+ // Add this command to the Commander command object
41
+ if (subCommand) {
42
+ command.addCommand(subCommand);
43
+ }
44
+ } catch (e) {
45
+ console.error(`Failed to load command`, e);
46
+ }
47
+ }
48
+ // TODO v6: remove these deprecation notices
49
+ const deprecatedCommands = [
50
+ {
51
+ name: 'plugin:init',
52
+ message: 'Please use `npx @strapi/sdk-plugin init` instead.'
53
+ },
54
+ {
55
+ name: 'plugin:verify',
56
+ message: 'After migrating your plugin to v5, use `strapi-plugin verify`'
57
+ },
58
+ {
59
+ name: 'plugin:watch',
60
+ message: 'After migrating your plugin to v5, use `strapi-plugin watch`'
61
+ },
62
+ {
63
+ name: 'plugin:watch:link',
64
+ message: 'After migrating your plugin to v5, use `strapi-plugin watch:link`'
65
+ },
66
+ {
67
+ name: 'plugin:build',
68
+ message: 'After migrating your plugin to v5, use `strapi-plugin build`'
69
+ }
70
+ ];
71
+ // Add hidden commands for deprecatedCommands that output a warning that the command has been removed.
72
+ deprecatedCommands.forEach(({ name, message })=>{
73
+ const deprecated = new Command(name).command(name).description('(deprecated)').action(()=>{
74
+ console.warn(`The command ${name} has been deprecated. See the Strapi 5 migration guide for more information.`);
75
+ if (message) {
76
+ console.warn(message);
77
+ }
78
+ });
79
+ command.addCommand(deprecated, {
80
+ hidden: true
81
+ });
82
+ });
83
+ return command;
84
+ };
85
+ const runCLI = async (argv = process.argv, command = new Command())=>{
86
+ const commands = await createCLI(argv, command);
87
+ await commands.parseAsync(argv);
88
+ };
89
+
90
+ export { createCLI, runCLI };
43
91
  //# sourceMappingURL=cli.mjs.map
package/dist/cli.mjs.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"cli.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"cli.mjs","sources":["../src/cli/index.ts"],"sourcesContent":["import { Command } from 'commander';\n\nimport { commands as strapiCommands } from './commands';\n\nimport { createLogger } from './utils/logger';\nimport { loadTsConfig } from './utils/tsconfig';\nimport { CLIContext } from './types';\nimport { version } from '../../package.json';\n\nconst createCLI = async (argv: string[], command = new Command()) => {\n // Initial program setup\n command.storeOptionsAsProperties(false).allowUnknownOption(true);\n\n // Help command\n command.helpOption('-h, --help', 'Display help for command');\n command.addHelpCommand('help [command]', 'Display help for command');\n\n command.version(version, '-v, --version', 'Output the version number');\n\n const cwd = process.cwd();\n\n const hasDebug = argv.includes('--debug');\n const hasSilent = argv.includes('--silent');\n\n const logger = createLogger({ debug: hasDebug, silent: hasSilent, timestamp: false });\n\n const tsconfig = loadTsConfig({\n cwd,\n path: 'tsconfig.json',\n logger,\n });\n\n const ctx = {\n cwd,\n logger,\n tsconfig,\n } satisfies CLIContext;\n\n // Load all commands\n for (const commandFactory of strapiCommands) {\n try {\n const subCommand = await commandFactory({ command, argv, ctx });\n\n // Add this command to the Commander command object\n if (subCommand) {\n command.addCommand(subCommand);\n }\n } catch (e) {\n console.error(`Failed to load command`, e);\n }\n }\n\n // TODO v6: remove these deprecation notices\n const deprecatedCommands = [\n { name: 'plugin:init', message: 'Please use `npx @strapi/sdk-plugin init` instead.' },\n {\n name: 'plugin:verify',\n message: 'After migrating your plugin to v5, use `strapi-plugin verify`',\n },\n {\n name: 'plugin:watch',\n message: 'After migrating your plugin to v5, use `strapi-plugin watch`',\n },\n {\n name: 'plugin:watch:link',\n message: 'After migrating your plugin to v5, use `strapi-plugin watch:link`',\n },\n {\n name: 'plugin:build',\n message: 'After migrating your plugin to v5, use `strapi-plugin build`',\n },\n ];\n\n // Add hidden commands for deprecatedCommands that output a warning that the command has been removed.\n deprecatedCommands.forEach(({ name, message }) => {\n const deprecated = new Command(name)\n .command(name)\n .description('(deprecated)')\n .action(() => {\n console.warn(\n `The command ${name} has been deprecated. See the Strapi 5 migration guide for more information.`\n );\n if (message) {\n console.warn(message);\n }\n });\n command.addCommand(deprecated, { hidden: true });\n });\n return command;\n};\n\nconst runCLI = async (argv = process.argv, command = new Command()) => {\n const commands = await createCLI(argv, command);\n await commands.parseAsync(argv);\n};\n\nexport { runCLI, createCLI };\n"],"names":["createCLI","argv","command","Command","storeOptionsAsProperties","allowUnknownOption","helpOption","addHelpCommand","version","cwd","process","hasDebug","includes","hasSilent","logger","createLogger","debug","silent","timestamp","tsconfig","loadTsConfig","path","ctx","commandFactory","strapiCommands","subCommand","addCommand","e","console","error","deprecatedCommands","name","message","forEach","deprecated","description","action","warn","hidden","runCLI","commands","parseAsync"],"mappings":";;;;;;AASA,MAAMA,SAAY,GAAA,OAAOC,IAAgBC,EAAAA,OAAAA,GAAU,IAAIC,OAAS,EAAA,GAAA;;AAE9DD,IAAAA,OAAAA,CAAQE,wBAAwB,CAAC,KAAOC,CAAAA,CAAAA,kBAAkB,CAAC,IAAA,CAAA;;IAG3DH,OAAQI,CAAAA,UAAU,CAAC,YAAc,EAAA,0BAAA,CAAA;IACjCJ,OAAQK,CAAAA,cAAc,CAAC,gBAAkB,EAAA,0BAAA,CAAA;IAEzCL,OAAQM,CAAAA,OAAO,CAACA,OAAAA,EAAS,eAAiB,EAAA,2BAAA,CAAA;IAE1C,MAAMC,GAAAA,GAAMC,QAAQD,GAAG,EAAA;IAEvB,MAAME,QAAAA,GAAWV,IAAKW,CAAAA,QAAQ,CAAC,SAAA,CAA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C,CAAC,EAAEF,IAAI,EAAEC,OAAO,EAAE,GAAA;QAC3C,MAAME,UAAAA,GAAa,IAAI/B,OAAAA,CAAQ4B,IAC5B7B,CAAAA,CAAAA,OAAO,CAAC6B,IAAAA,CAAAA,CACRI,WAAW,CAAC,cACZC,CAAAA,CAAAA,MAAM,CAAC,IAAA;AACNR,YAAAA,OAAAA,CAAQS,IAAI,CACV,CAAC,YAAY,EAAEN,IAAAA,CAAK,4EAA4E,CAAC,CAAA;AAEnG,YAAA,IAAIC,OAAS,EAAA;AACXJ,gBAAAA,OAAAA,CAAQS,IAAI,CAACL,OAAAA,CAAAA;AACf;AACF,SAAA,CAAA;QACF9B,OAAQwB,CAAAA,UAAU,CAACQ,UAAY,EAAA;YAAEI,MAAQ,EAAA;AAAK,SAAA,CAAA;AAChD,KAAA,CAAA;IACA,OAAOpC,OAAAA;AACT;AAEMqC,MAAAA,MAAAA,GAAS,OAAOtC,IAAOS,GAAAA,OAAAA,CAAQT,IAAI,EAAEC,OAAAA,GAAU,IAAIC,OAAS,EAAA,GAAA;IAChE,MAAMqC,QAAAA,GAAW,MAAMxC,SAAAA,CAAUC,IAAMC,EAAAA,OAAAA,CAAAA;IACvC,MAAMsC,QAAAA,CAASC,UAAU,CAACxC,IAAAA,CAAAA;AAC5B;;;;"}
@@ -0,0 +1,6 @@
1
+ 'use strict';
2
+
3
+ var version = "5.12.2";
4
+
5
+ exports.version = version;
6
+ //# sourceMappingURL=package.json.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"package.json.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;"}
@@ -0,0 +1,4 @@
1
+ var version = "5.12.2";
2
+
3
+ export { version };
4
+ //# sourceMappingURL=package.json.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"package.json.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;"}
@@ -0,0 +1,124 @@
1
+ 'use strict';
2
+
3
+ var commander = require('commander');
4
+ var utils = require('@strapi/utils');
5
+ var _ = require('lodash');
6
+ var inquirer = require('inquirer');
7
+ var core = require('@strapi/core');
8
+ var helpers = require('../../utils/helpers.js');
9
+
10
+ const emailValidator = utils.yup.string().email('Invalid email address').lowercase();
11
+ const passwordValidator = utils.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');
12
+ const adminCreateSchema = utils.yup.object().shape({
13
+ email: emailValidator,
14
+ password: passwordValidator,
15
+ firstname: utils.yup.string().trim().required('First name is required'),
16
+ lastname: utils.yup.string()
17
+ });
18
+ /**
19
+ * It's not an observable, in reality this is
20
+ * `ReadOnlyArray<inquirer.DistinctQuestion<Answers>>`
21
+ * but then the logic of the validate function needs to change.
22
+ */ // eslint-disable-next-line rxjs/finnish
23
+ const promptQuestions = [
24
+ {
25
+ type: 'input',
26
+ name: 'email',
27
+ message: 'Admin email?',
28
+ async validate (value) {
29
+ const validEmail = await emailValidator.validate(value);
30
+ return validEmail === value || validEmail;
31
+ }
32
+ },
33
+ {
34
+ type: 'password',
35
+ name: 'password',
36
+ message: 'Admin password?',
37
+ async validate (value) {
38
+ const validPassword = await passwordValidator.validate(value);
39
+ return validPassword === value || validPassword;
40
+ }
41
+ },
42
+ {
43
+ type: 'input',
44
+ name: 'firstname',
45
+ message: 'First name?'
46
+ },
47
+ {
48
+ type: 'input',
49
+ name: 'lastname',
50
+ message: 'Last name?'
51
+ },
52
+ {
53
+ type: 'confirm',
54
+ name: 'confirm',
55
+ message: 'Do you really want to create a new admin?'
56
+ }
57
+ ];
58
+ async function createAdmin({ email, password, firstname, lastname }) {
59
+ const appContext = await core.compileStrapi();
60
+ const app = await core.createStrapi(appContext).load();
61
+ const user = await app.admin.services.user.exists({
62
+ email
63
+ });
64
+ if (user) {
65
+ console.error(`User with email "${email}" already exists`);
66
+ process.exit(1);
67
+ }
68
+ const superAdminRole = await app.admin.services.role.getSuperAdmin();
69
+ await app.admin.services.user.create({
70
+ email,
71
+ firstname,
72
+ lastname,
73
+ isActive: true,
74
+ roles: [
75
+ superAdminRole.id
76
+ ],
77
+ ...password && {
78
+ password,
79
+ registrationToken: null
80
+ }
81
+ });
82
+ console.log(`Successfully created new admin`);
83
+ process.exit(0);
84
+ }
85
+ /**
86
+ * Create new admin user
87
+ */ const action = async (cmdOptions = {})=>{
88
+ let { email, password, firstname, lastname } = cmdOptions;
89
+ if (_.isEmpty(email) && _.isEmpty(password) && _.isEmpty(firstname) && _.isEmpty(lastname) && process.stdin.isTTY) {
90
+ const inquiry = await inquirer.prompt(promptQuestions);
91
+ if (!inquiry.confirm) {
92
+ process.exit(0);
93
+ }
94
+ ({ email, password, firstname, lastname } = inquiry);
95
+ }
96
+ try {
97
+ await adminCreateSchema.validate({
98
+ email,
99
+ password,
100
+ firstname,
101
+ lastname
102
+ });
103
+ } catch (err) {
104
+ if (err instanceof utils.yup.ValidationError) {
105
+ console.error(err.errors[0]);
106
+ }
107
+ process.exit(1);
108
+ }
109
+ return createAdmin({
110
+ email,
111
+ password,
112
+ firstname,
113
+ lastname
114
+ });
115
+ };
116
+ /**
117
+ * `$ strapi admin:create-user`
118
+ */ const command = ()=>{
119
+ return commander.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(helpers.runAction('admin:create-user', action));
120
+ };
121
+
122
+ exports.action = action;
123
+ exports.command = command;
124
+ //# sourceMappingURL=create-user.js.map
@@ -0,0 +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 { 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":["emailValidator","yup","string","email","lowercase","passwordValidator","min","matches","adminCreateSchema","object","shape","password","firstname","trim","required","lastname","promptQuestions","type","name","message","validate","value","validEmail","validPassword","createAdmin","appContext","compileStrapi","app","createStrapi","load","user","admin","services","exists","console","error","process","exit","superAdminRole","role","getSuperAdmin","create","isActive","roles","id","registrationToken","log","action","cmdOptions","_","isEmpty","stdin","isTTY","inquiry","inquirer","prompt","confirm","err","ValidationError","errors","command","createCommand","alias","description","option","runAction"],"mappings":";;;;;;;;;AAgBA,MAAMA,iBAAiBC,SAAIC,CAAAA,MAAM,GAAGC,KAAK,CAAC,yBAAyBC,SAAS,EAAA;AAE5E,MAAMC,oBAAoBJ,SACvBC,CAAAA,MAAM,GACNI,GAAG,CAAC,GAAG,6CACPC,CAAAA,CAAAA,OAAO,CAAC,OAAA,EAAS,0DACjBA,OAAO,CAAC,SAAS,wD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A,EAAuB,wBAC9BA,CAAAA,CAAAA,MAAM,CAAC,2BAAA,EAA6B,2BACpCA,CAAAA,CAAAA,MAAM,CAAC,8BAAA,EAAgC,6BACvCA,CAAAA,CAAAA,MAAM,CAAC,4BAAA,EAA8B,4BACrCjB,CAAAA,CAAAA,MAAM,CAACkB,iBAAAA,CAAU,mBAAqBlB,EAAAA,MAAAA,CAAAA,CAAAA;AAC3C;;;;;"}
@@ -0,0 +1,121 @@
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
+
8
+ const emailValidator = yup.string().email('Invalid email address').lowercase();
9
+ 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');
10
+ const adminCreateSchema = yup.object().shape({
11
+ email: emailValidator,
12
+ password: passwordValidator,
13
+ firstname: yup.string().trim().required('First name is required'),
14
+ lastname: yup.string()
15
+ });
16
+ /**
17
+ * It's not an observable, in reality this is
18
+ * `ReadOnlyArray<inquirer.DistinctQuestion<Answers>>`
19
+ * but then the logic of the validate function needs to change.
20
+ */ // eslint-disable-next-line rxjs/finnish
21
+ const promptQuestions = [
22
+ {
23
+ type: 'input',
24
+ name: 'email',
25
+ message: 'Admin email?',
26
+ async validate (value) {
27
+ const validEmail = await emailValidator.validate(value);
28
+ return validEmail === value || validEmail;
29
+ }
30
+ },
31
+ {
32
+ type: 'password',
33
+ name: 'password',
34
+ message: 'Admin password?',
35
+ async validate (value) {
36
+ const validPassword = await passwordValidator.validate(value);
37
+ return validPassword === value || validPassword;
38
+ }
39
+ },
40
+ {
41
+ type: 'input',
42
+ name: 'firstname',
43
+ message: 'First name?'
44
+ },
45
+ {
46
+ type: 'input',
47
+ name: 'lastname',
48
+ message: 'Last name?'
49
+ },
50
+ {
51
+ type: 'confirm',
52
+ name: 'confirm',
53
+ message: 'Do you really want to create a new admin?'
54
+ }
55
+ ];
56
+ async function createAdmin({ email, password, firstname, lastname }) {
57
+ const appContext = await compileStrapi();
58
+ const app = await createStrapi(appContext).load();
59
+ const user = await app.admin.services.user.exists({
60
+ email
61
+ });
62
+ if (user) {
63
+ console.error(`User with email "${email}" already exists`);
64
+ process.exit(1);
65
+ }
66
+ const superAdminRole = await app.admin.services.role.getSuperAdmin();
67
+ await app.admin.services.user.create({
68
+ email,
69
+ firstname,
70
+ lastname,
71
+ isActive: true,
72
+ roles: [
73
+ superAdminRole.id
74
+ ],
75
+ ...password && {
76
+ password,
77
+ registrationToken: null
78
+ }
79
+ });
80
+ console.log(`Successfully created new admin`);
81
+ process.exit(0);
82
+ }
83
+ /**
84
+ * Create new admin user
85
+ */ const action = async (cmdOptions = {})=>{
86
+ let { email, password, firstname, lastname } = cmdOptions;
87
+ if (_.isEmpty(email) && _.isEmpty(password) && _.isEmpty(firstname) && _.isEmpty(lastname) && process.stdin.isTTY) {
88
+ const inquiry = await inquirer.prompt(promptQuestions);
89
+ if (!inquiry.confirm) {
90
+ process.exit(0);
91
+ }
92
+ ({ email, password, firstname, lastname } = inquiry);
93
+ }
94
+ try {
95
+ await adminCreateSchema.validate({
96
+ email,
97
+ password,
98
+ firstname,
99
+ lastname
100
+ });
101
+ } catch (err) {
102
+ if (err instanceof yup.ValidationError) {
103
+ console.error(err.errors[0]);
104
+ }
105
+ process.exit(1);
106
+ }
107
+ return createAdmin({
108
+ email,
109
+ password,
110
+ firstname,
111
+ lastname
112
+ });
113
+ };
114
+ /**
115
+ * `$ strapi admin:create-user`
116
+ */ const command = ()=>{
117
+ 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));
118
+ };
119
+
120
+ export { action, command };
121
+ //# 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":["emailValidator","yup","string","email","lowercase","passwordValidator","min","matches","adminCreateSchema","object","shape","password","firstname","trim","required","lastname","promptQuestions","type","name","message","validate","value","validEmail","validPassword","createAdmin","appContext","compileStrapi","app","createStrapi","load","user","admin","services","exists","console","error","process","exit","superAdminRole","role","getSuperAdmin","create","isActive","roles","id","registrationToken","log","action","cmdOptions","_","isEmpty","stdin","isTTY","inquiry","inquirer","prompt","confirm","err","ValidationError","errors","command","createCommand","alias","description","option","runAction"],"mappings":";;;;;;;AAgBA,MAAMA,iBAAiBC,GAAIC,CAAAA,MAAM,GAAGC,KAAK,CAAC,yBAAyBC,SAAS,EAAA;AAE5E,MAAMC,oBAAoBJ,GACvBC,CAAAA,MAAM,GACNI,GAAG,CAAC,GAAG,6CACPC,CAAAA,CAAAA,OAAO,CAAC,OAAA,EAAS,0DACjBA,OAAO,CAAC,SAAS,wDACjBA,CAAAA,CAAAA,OAAO,CAAC,IAAM,EAAA,2CAAA,CAAA;AAEjB,MAAMC,iBAAoBP,GAAAA,GAAAA,CAAIQ,MAAM,EAAA,CAAGC,KAAK,CAAC;IAC3CP,KAAOH,EAAAA,cAAAA;IACPW,QAAUN,EAAAA,iBAAAA;AACVO,IAAAA,SAAAA,EAAWX,IAAIC,MAAM,EAAA,CAAGW,IAAI,EAAA,CAAGC,QAAQ,CAAC,wBAAA,CAAA;AACxCC,IAAAA,QAAAA,EAAUd,IAAIC,MAAM;AACtB,CAAA,CAAA;AAUA;;;;AAIC;AAED,MAAMc,eAAwD,GAAA;AAC5D,IAAA;QACEC,IAAM,EAAA,OAAA;QACNC,IAAM,EAAA,OAAA;QACNC,OAAS,EAAA,cAAA;AACT,QAAA,MAAMC,UAASC,KAAa,EAAA;AAC1B,YAAA,MAAMC,UAAa,GAAA,MAAMtB,cAAeoB,CAAAA,QAAQ,CAACC,KAAAA,CAAAA;AACjD,YAAA,OAAOC,eAAeD,KAASC,IAAAA,UAAAA;AACjC;AACF,KAAA;AACA,IAAA;QACEL,IAAM,EAAA,UAAA;QACNC,IAAM,EAAA,UAAA;QACNC,OAAS,EAAA,iBAAA;AACT,QAAA,MAAMC,UAASC,KAAa,EAAA;AAC1B,YAAA,MAAME,aAAgB,GAAA,MAAMlB,iBAAkBe,CAAAA,QAAQ,CAACC,KAAAA,CAAAA;AACvD,YAAA,OAAOE,kBAAkBF,KAASE,IAAAA,aAAAA;AACpC;AACF,K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