@strapi/strapi 5.0.0-beta.1 → 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.
- package/README.md +4 -4
- package/dist/admin.d.ts.map +1 -1
- package/dist/admin.js +12 -4
- package/dist/admin.js.map +1 -1
- package/dist/admin.mjs +10 -4
- package/dist/admin.mjs.map +1 -1
- package/dist/cli/commands/admin/create-user.js +2 -2
- package/dist/cli/commands/admin/create-user.js.map +1 -1
- package/dist/cli/commands/admin/create-user.mjs +88 -0
- package/dist/cli/commands/admin/create-user.mjs.map +1 -0
- package/dist/cli/commands/admin/reset-user-password.js +2 -2
- package/dist/cli/commands/admin/reset-user-password.js.map +1 -1
- package/dist/cli/commands/admin/reset-user-password.mjs +44 -0
- package/dist/cli/commands/admin/reset-user-password.mjs.map +1 -0
- package/dist/cli/commands/build.mjs +30 -0
- package/dist/cli/commands/build.mjs.map +1 -0
- package/dist/cli/commands/components/list.js +2 -2
- package/dist/cli/commands/components/list.js.map +1 -1
- package/dist/cli/commands/components/list.mjs +24 -0
- package/dist/cli/commands/components/list.mjs.map +1 -0
- package/dist/cli/commands/configuration/dump.js +2 -2
- package/dist/cli/commands/configuration/dump.js.map +1 -1
- package/dist/cli/commands/configuration/dump.mjs +41 -0
- package/dist/cli/commands/configuration/dump.mjs.map +1 -0
- package/dist/cli/commands/configuration/restore.js +2 -2
- package/dist/cli/commands/configuration/restore.js.map +1 -1
- package/dist/cli/commands/configuration/restore.mjs +140 -0
- package/dist/cli/commands/configuration/restore.mjs.map +1 -0
- package/dist/cli/commands/console.js +2 -2
- package/dist/cli/commands/console.js.map +1 -1
- package/dist/cli/commands/console.mjs +27 -0
- package/dist/cli/commands/console.mjs.map +1 -0
- package/dist/cli/commands/content-types/list.js +2 -2
- package/dist/cli/commands/content-types/list.js.map +1 -1
- package/dist/cli/commands/content-types/list.mjs +24 -0
- package/dist/cli/commands/content-types/list.mjs.map +1 -0
- package/dist/cli/commands/controllers/list.js +2 -2
- package/dist/cli/commands/controllers/list.js.map +1 -1
- package/dist/cli/commands/controllers/list.mjs +24 -0
- package/dist/cli/commands/controllers/list.mjs.map +1 -0
- package/dist/cli/commands/develop.mjs +27 -0
- package/dist/cli/commands/develop.mjs.map +1 -0
- package/dist/cli/commands/export/action.js.map +1 -1
- package/dist/cli/commands/export/action.mjs +116 -0
- package/dist/cli/commands/export/action.mjs.map +1 -0
- package/dist/cli/commands/export/command.mjs +24 -0
- package/dist/cli/commands/export/command.mjs.map +1 -0
- package/dist/cli/commands/generate.mjs +13 -0
- package/dist/cli/commands/generate.mjs.map +1 -0
- package/dist/cli/commands/hooks/list.js +2 -2
- package/dist/cli/commands/hooks/list.js.map +1 -1
- package/dist/cli/commands/hooks/list.mjs +24 -0
- package/dist/cli/commands/hooks/list.mjs.map +1 -0
- package/dist/cli/commands/import/action.js.map +1 -1
- package/dist/cli/commands/import/action.mjs +105 -0
- package/dist/cli/commands/import/action.mjs.map +1 -0
- package/dist/cli/commands/import/command.mjs +68 -0
- package/dist/cli/commands/import/command.mjs.map +1 -0
- package/dist/cli/commands/index.d.ts.map +1 -1
- package/dist/cli/commands/index.js +1 -14
- package/dist/cli/commands/index.js.map +1 -1
- package/dist/cli/commands/index.mjs +58 -0
- package/dist/cli/commands/index.mjs.map +1 -0
- package/dist/cli/commands/middlewares/list.js +2 -2
- package/dist/cli/commands/middlewares/list.js.map +1 -1
- package/dist/cli/commands/middlewares/list.mjs +24 -0
- package/dist/cli/commands/middlewares/list.mjs.map +1 -0
- package/dist/cli/commands/plugin/init/files/typescript.d.ts.map +1 -1
- package/dist/cli/commands/policies/list.js +2 -2
- package/dist/cli/commands/policies/list.js.map +1 -1
- package/dist/cli/commands/policies/list.mjs +24 -0
- package/dist/cli/commands/policies/list.mjs.map +1 -0
- package/dist/cli/commands/report.js +2 -2
- package/dist/cli/commands/report.js.map +1 -1
- package/dist/cli/commands/report.mjs +35 -0
- package/dist/cli/commands/report.mjs.map +1 -0
- package/dist/cli/commands/routes/list.js +2 -2
- package/dist/cli/commands/routes/list.js.map +1 -1
- package/dist/cli/commands/routes/list.mjs +28 -0
- package/dist/cli/commands/routes/list.mjs.map +1 -0
- package/dist/cli/commands/services/list.js +2 -2
- package/dist/cli/commands/services/list.js.map +1 -1
- package/dist/cli/commands/services/list.mjs +24 -0
- package/dist/cli/commands/services/list.mjs.map +1 -0
- package/dist/cli/commands/start.js +1 -1
- package/dist/cli/commands/start.js.map +1 -1
- package/dist/cli/commands/start.mjs +24 -0
- package/dist/cli/commands/start.mjs.map +1 -0
- package/dist/cli/commands/telemetry/disable.mjs +67 -0
- package/dist/cli/commands/telemetry/disable.mjs.map +1 -0
- package/dist/cli/commands/telemetry/enable.mjs +86 -0
- package/dist/cli/commands/telemetry/enable.mjs.map +1 -0
- package/dist/cli/commands/templates/generate.mjs +74 -0
- package/dist/cli/commands/templates/generate.mjs.map +1 -0
- package/dist/cli/commands/transfer/action.mjs +131 -0
- package/dist/cli/commands/transfer/action.mjs.map +1 -0
- package/dist/cli/commands/transfer/command.mjs +84 -0
- package/dist/cli/commands/transfer/command.mjs.map +1 -0
- package/dist/cli/commands/ts/generate-types.d.ts.map +1 -1
- package/dist/cli/commands/ts/generate-types.js +4 -5
- package/dist/cli/commands/ts/generate-types.js.map +1 -1
- package/dist/cli/commands/ts/generate-types.mjs +34 -0
- package/dist/cli/commands/ts/generate-types.mjs.map +1 -0
- package/dist/cli/commands/version.mjs +13 -0
- package/dist/cli/commands/version.mjs.map +1 -0
- package/dist/cli/index.d.ts.map +1 -1
- package/dist/cli/index.js +30 -0
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/index.mjs +79 -0
- package/dist/cli/index.mjs.map +1 -0
- package/dist/cli/utils/commander.d.ts +2 -2
- package/dist/cli/utils/commander.d.ts.map +1 -1
- package/dist/cli/utils/commander.mjs +109 -0
- package/dist/cli/utils/commander.mjs.map +1 -0
- package/dist/cli/utils/data-transfer.d.ts +4 -4
- package/dist/cli/utils/data-transfer.d.ts.map +1 -1
- package/dist/cli/utils/data-transfer.js +32 -24
- package/dist/cli/utils/data-transfer.js.map +1 -1
- package/dist/cli/utils/data-transfer.mjs +347 -0
- package/dist/cli/utils/data-transfer.mjs.map +1 -0
- package/dist/cli/utils/helpers.d.ts +1 -1
- package/dist/cli/utils/helpers.d.ts.map +1 -1
- package/dist/cli/utils/helpers.mjs +100 -0
- package/dist/cli/utils/helpers.mjs.map +1 -0
- package/dist/cli/utils/logger.mjs +80 -0
- package/dist/cli/utils/logger.mjs.map +1 -0
- package/dist/cli/utils/pkg.d.ts.map +1 -1
- package/dist/cli/utils/telemetry.mjs +22 -0
- package/dist/cli/utils/telemetry.mjs.map +1 -0
- package/dist/cli/utils/tsconfig.d.ts.map +1 -1
- package/dist/cli/utils/tsconfig.mjs +23 -0
- package/dist/cli/utils/tsconfig.mjs.map +1 -0
- package/dist/node/build.mjs +58 -0
- package/dist/node/build.mjs.map +1 -0
- package/dist/node/core/admin-customisations.mjs +22 -0
- package/dist/node/core/admin-customisations.mjs.map +1 -0
- package/dist/node/core/aliases.d.ts +1 -1
- package/dist/node/core/aliases.d.ts.map +1 -1
- package/dist/node/core/aliases.js +8 -5
- package/dist/node/core/aliases.js.map +1 -1
- package/dist/node/core/aliases.mjs +31 -0
- package/dist/node/core/aliases.mjs.map +1 -0
- package/dist/node/core/config.d.ts.map +1 -1
- package/dist/node/core/config.mjs +16 -0
- package/dist/node/core/config.mjs.map +1 -0
- package/dist/node/core/dependencies.d.ts.map +1 -1
- package/dist/node/core/dependencies.js +5 -1
- package/dist/node/core/dependencies.js.map +1 -1
- package/dist/node/core/dependencies.mjs +155 -0
- package/dist/node/core/dependencies.mjs.map +1 -0
- package/dist/node/core/env.d.ts.map +1 -1
- package/dist/node/core/env.js +7 -4
- package/dist/node/core/env.js.map +1 -1
- package/dist/node/core/env.mjs +23 -0
- package/dist/node/core/env.mjs.map +1 -0
- package/dist/node/core/errors.mjs +29 -0
- package/dist/node/core/errors.mjs.map +1 -0
- package/dist/node/core/files.mjs +43 -0
- package/dist/node/core/files.mjs.map +1 -0
- package/dist/node/core/managers.mjs +17 -0
- package/dist/node/core/managers.mjs.map +1 -0
- package/dist/node/core/monorepo.mjs +20 -0
- package/dist/node/core/monorepo.mjs.map +1 -0
- package/dist/node/core/plugins.mjs +93 -0
- package/dist/node/core/plugins.mjs.map +1 -0
- package/dist/node/core/timer.mjs +27 -0
- package/dist/node/core/timer.mjs.map +1 -0
- package/dist/node/create-build-context.d.ts.map +1 -1
- package/dist/node/create-build-context.js +1 -1
- package/dist/node/create-build-context.js.map +1 -1
- package/dist/node/create-build-context.mjs +91 -0
- package/dist/node/create-build-context.mjs.map +1 -0
- package/dist/node/develop.js +1 -1
- package/dist/node/develop.js.map +1 -1
- package/dist/node/develop.mjs +252 -0
- package/dist/node/develop.mjs.map +1 -0
- package/dist/node/staticFiles.d.ts.map +1 -1
- package/dist/node/staticFiles.js +25 -3
- package/dist/node/staticFiles.js.map +1 -1
- package/dist/node/staticFiles.mjs +76 -0
- package/dist/node/staticFiles.mjs.map +1 -0
- package/dist/node/vite/build.mjs +12 -0
- package/dist/node/vite/build.mjs.map +1 -0
- package/dist/node/vite/config.mjs +99 -0
- package/dist/node/vite/config.mjs.map +1 -0
- package/dist/node/vite/plugins.mjs +43 -0
- package/dist/node/vite/plugins.mjs.map +1 -0
- package/dist/node/vite/watch.mjs +52 -0
- package/dist/node/vite/watch.mjs.map +1 -0
- package/dist/node/webpack/build.mjs +39 -0
- package/dist/node/webpack/build.mjs.map +1 -0
- package/dist/node/webpack/config.mjs +228 -0
- package/dist/node/webpack/config.mjs.map +1 -0
- package/dist/node/webpack/watch.mjs +92 -0
- package/dist/node/webpack/watch.mjs.map +1 -0
- package/package.json +33 -40
- package/dist/cli/commands/plugin/build.d.ts +0 -7
- package/dist/cli/commands/plugin/build.d.ts.map +0 -1
- package/dist/cli/commands/plugin/build.js +0 -88
- package/dist/cli/commands/plugin/build.js.map +0 -1
- package/dist/cli/commands/plugin/init/action.d.ts +0 -6
- package/dist/cli/commands/plugin/init/action.d.ts.map +0 -1
- package/dist/cli/commands/plugin/init/action.js +0 -414
- package/dist/cli/commands/plugin/init/action.js.map +0 -1
- package/dist/cli/commands/plugin/init/command.d.ts +0 -7
- package/dist/cli/commands/plugin/init/command.d.ts.map +0 -1
- package/dist/cli/commands/plugin/init/command.js +0 -9
- package/dist/cli/commands/plugin/init/command.js.map +0 -1
- package/dist/cli/commands/plugin/init/files/admin.d.ts +0 -5
- package/dist/cli/commands/plugin/init/files/admin.d.ts.map +0 -1
- package/dist/cli/commands/plugin/init/files/admin.js +0 -283
- package/dist/cli/commands/plugin/init/files/admin.js.map +0 -1
- package/dist/cli/commands/plugin/init/files/editorConfig.d.ts +0 -4
- package/dist/cli/commands/plugin/init/files/editorConfig.d.ts.map +0 -1
- package/dist/cli/commands/plugin/init/files/editorConfig.js +0 -26
- package/dist/cli/commands/plugin/init/files/editorConfig.js.map +0 -1
- package/dist/cli/commands/plugin/init/files/eslint.d.ts +0 -4
- package/dist/cli/commands/plugin/init/files/eslint.d.ts.map +0 -1
- package/dist/cli/commands/plugin/init/files/eslint.js +0 -11
- package/dist/cli/commands/plugin/init/files/eslint.js.map +0 -1
- package/dist/cli/commands/plugin/init/files/gitIgnore.d.ts +0 -4
- package/dist/cli/commands/plugin/init/files/gitIgnore.d.ts.map +0 -1
- package/dist/cli/commands/plugin/init/files/gitIgnore.js +0 -34
- package/dist/cli/commands/plugin/init/files/gitIgnore.js.map +0 -1
- package/dist/cli/commands/plugin/init/files/prettier.d.ts +0 -5
- package/dist/cli/commands/plugin/init/files/prettier.d.ts.map +0 -1
- package/dist/cli/commands/plugin/init/files/prettier.js +0 -25
- package/dist/cli/commands/plugin/init/files/prettier.js.map +0 -1
- package/dist/cli/commands/plugin/init/files/server.d.ts +0 -5
- package/dist/cli/commands/plugin/init/files/server.d.ts.map +0 -1
- package/dist/cli/commands/plugin/init/files/server.js +0 -360
- package/dist/cli/commands/plugin/init/files/server.js.map +0 -1
- package/dist/cli/commands/plugin/init/files/typescript.js +0 -66
- package/dist/cli/commands/plugin/init/files/typescript.js.map +0 -1
- package/dist/cli/commands/plugin/init/index.d.ts +0 -2
- package/dist/cli/commands/plugin/init/index.d.ts.map +0 -1
- package/dist/cli/commands/plugin/link-watch.d.ts +0 -7
- package/dist/cli/commands/plugin/link-watch.d.ts.map +0 -1
- package/dist/cli/commands/plugin/link-watch.js +0 -89
- package/dist/cli/commands/plugin/link-watch.js.map +0 -1
- package/dist/cli/commands/plugin/verify.d.ts +0 -7
- package/dist/cli/commands/plugin/verify.d.ts.map +0 -1
- package/dist/cli/commands/plugin/verify.js +0 -37
- package/dist/cli/commands/plugin/verify.js.map +0 -1
- package/dist/cli/commands/plugin/watch.d.ts +0 -7
- package/dist/cli/commands/plugin/watch.d.ts.map +0 -1
- package/dist/cli/commands/plugin/watch.js +0 -86
- package/dist/cli/commands/plugin/watch.js.map +0 -1
- package/dist/cli/utils/pkg.js +0 -108
- 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
|
|
62
|
+
yarn create strapi
|
|
63
63
|
```
|
|
64
64
|
|
|
65
65
|
**or**
|
|
66
66
|
|
|
67
|
-
- (
|
|
67
|
+
- (Using npx to install the Strapi project.)
|
|
68
68
|
|
|
69
69
|
```bash
|
|
70
|
-
npx create-strapi
|
|
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).
|
|
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
|
|
package/dist/admin.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"admin.d.ts","sourceRoot":"","sources":["../src/admin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAe,MAAM,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/
|
|
5
|
-
const
|
|
6
|
-
const
|
|
7
|
-
const
|
|
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/
|
|
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/
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
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
|
});
|
package/dist/admin.mjs.map
CHANGED
|
@@ -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/
|
|
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.
|
|
49
|
-
const app = await core.
|
|
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 {
|
|
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":";;;;;;;;;;;AAgBA,MAAM,iBAAiBA,MAAI,IAAA,SAAS,MAAM,uBAAuB,EAAE;AAEnE,MAAM,oBAAoBA,MACvB,IAAA,SACA,IAAI,GAAG,6CAA6C,EACpD,QAAQ,SAAS,wDAAwD,EACzE,QAAQ,SAAS,wDAAwD,EACzE,QAAQ,MAAM,2CAA2C;AAE5D,MAAM,oBAAoBA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"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":";;;;;;AAgBA,MAAM,iBAAiB,IAAI,SAAS,MAAM,uBAAuB,EAAE;AAEnE,MAAM,oBAAoB,IACvB,SACA,IAAI,GAAG,6CAA6C,EACpD,QAAQ,SAAS,wDAAwD,EACzE,QAAQ,SAAS,wDAAwD,EACzE,QAAQ,MAAM,2CAA2C;AAE5D,MAAM,oBAAoB,IAAI,OAAO,EAAE,MAAM;AAAA,EAC3C,OAAO;AAAA,EACP,UAAU;AAAA,EACV,WAAW,IAAI,OAAA,EAAS,KAAK,EAAE,SAAS,wB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MAAM,SAAS,OAAO,aAAyB,OAAO;AACpD,MAAI,EAAE,OAAO,UAAU,WAAW,aAAa;AAE/C,MACE,EAAE,QAAQ,KAAK,KACf,EAAE,QAAQ,QAAQ,KAClB,EAAE,QAAQ,SAAS,KACnB,EAAE,QAAQ,QAAQ,KAClB,QAAQ,MAAM,OACd;AACA,UAAM,UAAU,MAAM,SAAS,OAAO,eAAe;AAEjD,QAAA,CAAC,QAAQ,SAAS;AACpB,cAAQ,KAAK,CAAC;AAAA,IAChB;AAEA,KAAC,EAAE,OAAO,UAAU,WAAW,aAAa;AAAA,EAC9C;AAEI,MAAA;AACF,UAAM,kBAAkB,SAAS,EAAE,OAAO,UAAU,WAAW,UAAU;AAAA,WAClE,KAAK;AACR,QAAA,eAAe,IAAI,iBAAiB;AACtC,cAAQ,MAAM,IAAI,OAAO,CAAC,CAAC;AAAA,IAC7B;AAEA,YAAQ,KAAK,CAAC;AAAA,EAChB;AAEA,SAAO,YAAY,EAAE,OAAO,UAAU,WAAW,UAAU;AAC7D;AAKA,MAAM,UAAyB,MAAM;AACnC,SAAO,cAAc,mBAAmB,EACrC,MAAM,cAAc,EACpB,YAAY,oBAAoB,EAChC,OAAO,uBAAuB,wBAAwB,EACtD,OAAO,6BAA6B,2BAA2B,EAC/D,OAAO,gCAAgC,6BAA6B,EACpE,OAAO,8BAA8B,4BAA4B,EACjE,OAAO,UAAU,qBAAqB,MAAM,CAAC;AAClD;"}
|
|
@@ -18,8 +18,8 @@ const promptQuestions = [
|
|
|
18
18
|
}
|
|
19
19
|
];
|
|
20
20
|
async function changePassword({ email, password }) {
|
|
21
|
-
const appContext = await core.
|
|
22
|
-
const app = await core.
|
|
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 {
|
|
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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OC,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));\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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.
|
|
13
|
-
const app = await core.
|
|
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 {
|
|
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.
|
|
13
|
-
const app = await core.
|
|
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 {
|
|
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.
|
|
14
|
-
const app = await core.
|
|
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));
|