@akemona-org/strapi 3.7.0

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 (125) hide show
  1. package/LICENSE +22 -0
  2. package/README.md +163 -0
  3. package/bin/strapi.js +239 -0
  4. package/index.d.ts +13 -0
  5. package/lib/Strapi.js +498 -0
  6. package/lib/commands/admin-reset.js +51 -0
  7. package/lib/commands/build.js +47 -0
  8. package/lib/commands/configurationDump.js +50 -0
  9. package/lib/commands/configurationRestore.js +160 -0
  10. package/lib/commands/console.js +26 -0
  11. package/lib/commands/develop.js +155 -0
  12. package/lib/commands/generate-template.js +97 -0
  13. package/lib/commands/generate.js +66 -0
  14. package/lib/commands/install.js +48 -0
  15. package/lib/commands/new.js +11 -0
  16. package/lib/commands/start.js +8 -0
  17. package/lib/commands/uninstall.js +68 -0
  18. package/lib/commands/watchAdmin.js +35 -0
  19. package/lib/core/app-configuration/config-loader.js +56 -0
  20. package/lib/core/app-configuration/config-provider.js +28 -0
  21. package/lib/core/app-configuration/index.js +99 -0
  22. package/lib/core/bootstrap.js +166 -0
  23. package/lib/core/fs.js +52 -0
  24. package/lib/core/index.js +21 -0
  25. package/lib/core/load-admin.js +36 -0
  26. package/lib/core/load-apis.js +22 -0
  27. package/lib/core/load-components.js +43 -0
  28. package/lib/core/load-extensions.js +71 -0
  29. package/lib/core/load-functions.js +21 -0
  30. package/lib/core/load-hooks.js +117 -0
  31. package/lib/core/load-middlewares.js +130 -0
  32. package/lib/core/load-modules.js +61 -0
  33. package/lib/core/load-plugins.js +68 -0
  34. package/lib/core/load-policies.js +36 -0
  35. package/lib/core/walk.js +27 -0
  36. package/lib/core-api/controller.js +158 -0
  37. package/lib/core-api/index.js +33 -0
  38. package/lib/core-api/service/collection-type.js +122 -0
  39. package/lib/core-api/service/index.js +81 -0
  40. package/lib/core-api/service/single-type.js +68 -0
  41. package/lib/hooks/index.js +97 -0
  42. package/lib/index.js +3 -0
  43. package/lib/load/check-reserved-filename.js +18 -0
  44. package/lib/load/filepath-to-prop-path.js +22 -0
  45. package/lib/load/glob.js +15 -0
  46. package/lib/load/index.js +9 -0
  47. package/lib/load/load-config-files.js +22 -0
  48. package/lib/load/load-files.js +56 -0
  49. package/lib/load/package-path.js +9 -0
  50. package/lib/load/require-file-parse.js +15 -0
  51. package/lib/middlewares/boom/defaults.json +5 -0
  52. package/lib/middlewares/boom/index.js +147 -0
  53. package/lib/middlewares/cors/index.js +66 -0
  54. package/lib/middlewares/cron/defaults.json +5 -0
  55. package/lib/middlewares/cron/index.js +43 -0
  56. package/lib/middlewares/csp/defaults.json +5 -0
  57. package/lib/middlewares/csp/index.js +26 -0
  58. package/lib/middlewares/favicon/defaults.json +7 -0
  59. package/lib/middlewares/favicon/index.js +35 -0
  60. package/lib/middlewares/gzip/defaults.json +6 -0
  61. package/lib/middlewares/gzip/index.js +19 -0
  62. package/lib/middlewares/hsts/defaults.json +7 -0
  63. package/lib/middlewares/hsts/index.js +30 -0
  64. package/lib/middlewares/index.js +120 -0
  65. package/lib/middlewares/ip/defaults.json +7 -0
  66. package/lib/middlewares/ip/index.js +25 -0
  67. package/lib/middlewares/language/defaults.json +9 -0
  68. package/lib/middlewares/language/index.js +40 -0
  69. package/lib/middlewares/logger/defaults.json +8 -0
  70. package/lib/middlewares/logger/index.js +63 -0
  71. package/lib/middlewares/p3p/defaults.json +6 -0
  72. package/lib/middlewares/p3p/index.js +29 -0
  73. package/lib/middlewares/parser/defaults.json +10 -0
  74. package/lib/middlewares/parser/index.js +71 -0
  75. package/lib/middlewares/poweredBy/defaults.json +5 -0
  76. package/lib/middlewares/poweredBy/index.js +16 -0
  77. package/lib/middlewares/public/assets/images/group_people_1.png +0 -0
  78. package/lib/middlewares/public/assets/images/group_people_2.png +0 -0
  79. package/lib/middlewares/public/assets/images/group_people_3.png +0 -0
  80. package/lib/middlewares/public/assets/images/logo_login.png +0 -0
  81. package/lib/middlewares/public/defaults.json +8 -0
  82. package/lib/middlewares/public/index.html +66 -0
  83. package/lib/middlewares/public/index.js +98 -0
  84. package/lib/middlewares/public/serve-static.js +23 -0
  85. package/lib/middlewares/responseTime/defaults.json +5 -0
  86. package/lib/middlewares/responseTime/index.js +25 -0
  87. package/lib/middlewares/responses/defaults.json +5 -0
  88. package/lib/middlewares/responses/index.js +18 -0
  89. package/lib/middlewares/router/defaults.json +7 -0
  90. package/lib/middlewares/router/index.js +64 -0
  91. package/lib/middlewares/router/utils/composeEndpoint.js +25 -0
  92. package/lib/middlewares/router/utils/routerChecker.js +92 -0
  93. package/lib/middlewares/session/defaults.json +18 -0
  94. package/lib/middlewares/session/index.js +140 -0
  95. package/lib/middlewares/xframe/defaults.json +6 -0
  96. package/lib/middlewares/xframe/index.js +33 -0
  97. package/lib/middlewares/xss/defaults.json +6 -0
  98. package/lib/middlewares/xss/index.js +30 -0
  99. package/lib/services/core-store.js +144 -0
  100. package/lib/services/entity-service.js +260 -0
  101. package/lib/services/entity-validator/index.js +199 -0
  102. package/lib/services/entity-validator/validators.js +125 -0
  103. package/lib/services/event-hub.js +15 -0
  104. package/lib/services/metrics/index.js +103 -0
  105. package/lib/services/metrics/is-truthy.js +9 -0
  106. package/lib/services/metrics/middleware.js +33 -0
  107. package/lib/services/metrics/rate-limiter.js +27 -0
  108. package/lib/services/metrics/sender.js +76 -0
  109. package/lib/services/metrics/stringify-deep.js +22 -0
  110. package/lib/services/utils/upload-files.js +70 -0
  111. package/lib/services/webhook-runner.js +159 -0
  112. package/lib/services/webhook-store.js +97 -0
  113. package/lib/services/worker-queue.js +58 -0
  114. package/lib/utils/addSlash.js +10 -0
  115. package/lib/utils/ee.js +123 -0
  116. package/lib/utils/get-prefixed-dependencies.js +7 -0
  117. package/lib/utils/index.js +25 -0
  118. package/lib/utils/openBrowser.js +145 -0
  119. package/lib/utils/resources/key.pub +9 -0
  120. package/lib/utils/resources/openChrome.applescript +83 -0
  121. package/lib/utils/run-checks.js +37 -0
  122. package/lib/utils/success.js +31 -0
  123. package/lib/utils/update-notifier/index.js +96 -0
  124. package/lib/utils/url-from-segments.js +13 -0
  125. package/package.json +143 -0
package/LICENSE ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2015-present Strapi Solutions SAS
2
+
3
+ Portions of the Strapi software are licensed as follows:
4
+
5
+ * All software that resides under an "ee/" directory (the “EE Software”), if that directory exists, is licensed under the license defined in "ee/LICENSE".
6
+
7
+ * All software outside of the above-mentioned directories or restrictions above is available under the "MIT Expat" license as set forth below.
8
+
9
+ MIT Expat License
10
+
11
+ Permission is hereby granted, free of charge, to any person obtaining a copy
12
+ of this software and associated documentation files (the "Software"), to deal
13
+ in the Software without restriction, including without limitation the rights
14
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
15
+ copies of the Software, and to permit persons to whom the Software is
16
+ furnished to do so, subject to the following conditions:
17
+
18
+ The above copyright notice and this permission notice shall be included in all
19
+ copies or substantial portions of the Software.
20
+
21
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,163 @@
1
+ <p align="center">
2
+ <a href="https://strapi.akemona.com">
3
+ <img src="https://strapi.akemona.com/assets/strapi-logo-dark.svg" width="318px" alt="Strapi logo" />
4
+ </a>
5
+ </p>
6
+ <h3 align="center">API creation made simple, secure and fast.</h3>
7
+ <p align="center">The most advanced open-source headless CMS to build powerful APIs with no effort.</p>
8
+ <p align="center"><a href="https://strapi.akemona.com/demo">Try live demo</a></p>
9
+ <br />
10
+
11
+ <p align="center">
12
+ <a href="https://www.npmjs.org/package/strapi">
13
+ <img src="https://img.shields.io/npm/v/strapi/latest.svg" alt="NPM Version" />
14
+ </a>
15
+ <a href="https://www.npmjs.org/package/strapi">
16
+ <img src="https://img.shields.io/npm/dm/strapi.svg" alt="Monthly download on NPM" />
17
+ </a>
18
+ <a href="https://discord.strapi.io">
19
+ <img src="https://img.shields.io/discord/811989166782021633?label=Discord" alt="Strapi on Discord" />
20
+ </a>
21
+ </p>
22
+
23
+ <br>
24
+
25
+ <p align="center">
26
+ <a href="https://strapi.akemona.com">
27
+ <img src="https://raw.githubusercontent.com/strapi/strapi/master/public/assets/administration_panel.png" alt="Administration panel" />
28
+ </a>
29
+ </p>
30
+
31
+ <br>
32
+
33
+ ---
34
+
35
+ ## Deprecation Warning :warning:
36
+
37
+ Hello! We have some news to share,
38
+
39
+ We’ve decided it’ll soon be time to end the support for `strapi`.
40
+
41
+ After years of iterations, Strapi is going to V4 and we won’t maintain V3 packages when it’ll reach its end-of-support milestone (~end of Q3 2022).
42
+
43
+ If you’ve been using `strapi` and have migrated to V4 (or if you want to), you can find the equivalent and updated version of this package at this [URL](https://github.com/strapi/strapi/tree/master/packages/core/strapi) and with the following name on NPM: `@strapi/strapi`.
44
+
45
+ If you’ve contributed to the development of this package, thank you again for that! We hope to see you on the V4 soon.
46
+
47
+ The Akemona team
48
+
49
+ ---
50
+
51
+ Strapi is a free and open-source headless CMS delivering your content anywhere you need.
52
+
53
+ - **Keep control over your data**. With Strapi, you know where your data is stored, and you keep full control at all times.
54
+ - **Self-hosted**. You can host and scale Strapi projects the way you want. You can choose any hosting platform you want: AWS, Render, Netlify, Heroku, a VPS, or a dedicated server. You can scale as you grow, 100% independent.
55
+ - **Database agnostic**. You can choose the database you prefer. Strapi works with SQL & NoSQL databases: MongoDB, PostgreSQL, MySQL, MariaDB, and SQLite.
56
+ - **Customizable**. You can quickly build your logic by fully customizing APIs, routes, or plugins to fit your needs perfectly.
57
+
58
+ ## Getting Started
59
+
60
+ <a href="https://strapi.akemona.com/documentation/developer-docs/latest/getting-started/quick-start.html" target="_blank">Read the Getting Started tutorial</a> or follow the steps below:
61
+
62
+ ### ⏳ Installation
63
+
64
+ Install Strapi with this **Quickstart** command to create a Strapi project instantly:
65
+
66
+ - (Use **yarn** to install the Strapi project (recommended). [Install yarn with these docs](https://yarnpkg.com/lang/en/docs/install/).)
67
+
68
+ ```bash
69
+ yarn create strapi-app my-project --quickstart
70
+ ```
71
+
72
+ **or**
73
+
74
+ - (Use npm/npx to install the Strapi project.)
75
+
76
+ ```bash
77
+ npx create-strapi-app my-project --quickstart
78
+ ```
79
+
80
+ This command generates a brand new project with the default features (authentication, permissions, content management, content type builder & file upload). The **Quickstart** command installs Strapi using a **SQLite** database which is used for prototyping in development.
81
+
82
+ Enjoy 🎉
83
+
84
+ ### 🖐 Requirements
85
+
86
+ Complete installation requirements can be found in the documentation under <a href="https://strapi.akemona.com/documentation/developer-docs/latest/setup-deployment-guides/deployment.html#recommended-requirements">Installation Requirements</a>.
87
+
88
+ **Supported operating systems**:
89
+
90
+ - Ubuntu LTS/Debian 9.x
91
+ - CentOS/RHEL 8
92
+ - macOS Mojave
93
+ - Windows 10
94
+ - Docker - [Docker-Repo](https://github.com/strapi/strapi-docker)
95
+
96
+ (Please note that Strapi may work on other operating systems, but these are not tested nor officially supported at this time.)
97
+
98
+ **Node:**
99
+
100
+ - NodeJS >= 10.16 <=14
101
+ - NPM >= 6.x
102
+
103
+ **Database:**
104
+
105
+ - MongoDB >= 3.6 ([dropping MongoDB support](https://forum.strapi.io/t/dropping-mongodb-support/) in next major version)
106
+ - MySQL >= 5.6
107
+ - MariaDB >= 10.1
108
+ - PostgreSQL >= 10
109
+ - SQLite >= 3
110
+
111
+ **We recommend always using the latest version of Strapi to start your new projects**.
112
+
113
+ ## Features
114
+
115
+ - **Modern Admin Panel:** Elegant, entirely customizable and a fully extensible admin panel.
116
+ - **Secure by default:** Reusable policies, CORS, CSP, P3P, Xframe, XSS, and more.
117
+ - **Plugins Oriented:** Install the auth system, content management, custom plugins, and more, in seconds.
118
+ - **Blazing Fast:** Built on top of Node.js, Strapi delivers amazing performance.
119
+ - **Front-end Agnostic:** Use any front-end framework (React, Vue, Angular, etc.), mobile apps or even IoT.
120
+ - **Powerful CLI:** Scaffold projects and APIs on the fly.
121
+ - **SQL & NoSQL databases:** Works with MongoDB ([dropping MongoDB support](https://forum.strapi.io/t/dropping-mongodb-support/) in next major version), PostgreSQL, MySQL, MariaDB, and SQLite.
122
+
123
+ **[See more on our website](https://strapi.akemona.com/overview)**.
124
+
125
+ ## Contributing
126
+
127
+ Please read our [Contributing Guide](./CONTRIBUTING.md) before submitting a Pull Request to the project.
128
+
129
+ ## Community support
130
+
131
+ For general help using Strapi, please refer to [the official Strapi documentation](https://strapi.akemona.com/documentation/). For additional help, you can use one of these channels to ask a question:
132
+
133
+ - [Discord](https://discord.strapi.io) (For live discussion with the Community and Akemona team)
134
+ - [GitHub](https://github.com/strapi/strapi) (Bug reports, Contributions)
135
+ - [Community Forum](https://forum.strapi.io) (Questions and Discussions)
136
+ - [Academy](https://academy.strapi.io) (Learn the fundamentals of Strapi)
137
+ - [ProductBoard](https://portal.productboard.com/strapi/tabs/2-under-consideration) (Roadmap, Feature requests)
138
+ - [Twitter](https://twitter.com/strapijs) (Get the news fast)
139
+ - [Facebook](https://www.facebook.com/Strapi-616063331867161)
140
+ - [YouTube Channel](https://www.youtube.com/strapi) (Learn from Video Tutorials)
141
+
142
+ ## Migration
143
+
144
+ Follow our [migration guides](https://strapi.akemona.com/documentation/developer-docs/latest/update-migration-guides/migration-guides.html) on the documentation to keep your projects up-to-date.
145
+
146
+ ## Roadmap
147
+
148
+ Check out our [roadmap](https://portal.productboard.com/strapi) to get informed of the latest features released and the upcoming ones. You may also give us insights and vote for a specific feature.
149
+
150
+ ## Documentation
151
+
152
+ See our dedicated [repository](https://github.com/strapi/documentation) for the Strapi documentation, or view our documentation live:
153
+
154
+ - [Developer docs](https://strapi.akemona.com/documentation/developer-docs/latest/getting-started/introduction.html)
155
+ - [User docs](https://strapi.akemona.com/documentation/user-docs/latest/getting-started/introduction.html)
156
+
157
+ ## Try live demo
158
+
159
+ See for yourself what's under the hood by getting access to a [hosted Strapi project](https://strapi.akemona.com/demo) with sample data.
160
+
161
+ ## License
162
+
163
+ See the [LICENSE](./LICENSE) file for licensing information.
package/bin/strapi.js ADDED
@@ -0,0 +1,239 @@
1
+ #!/usr/bin/env node
2
+ 'use strict';
3
+
4
+ const _ = require('lodash');
5
+ const resolveCwd = require('resolve-cwd');
6
+ const { yellow } = require('chalk');
7
+ const { Command } = require('commander');
8
+
9
+ const program = new Command();
10
+
11
+ const packageJSON = require('../package.json');
12
+
13
+ const checkCwdIsStrapiApp = name => {
14
+ let logErrorAndExit = () => {
15
+ console.log(
16
+ `You need to run ${yellow(
17
+ `strapi ${name}`
18
+ )} in a Strapi project. Make sure you are in the right directory`
19
+ );
20
+ process.exit(1);
21
+ };
22
+
23
+ try {
24
+ const pkgJSON = require(process.cwd() + '/package.json');
25
+ if (!_.has(pkgJSON, 'dependencies.strapi')) {
26
+ logErrorAndExit(name);
27
+ }
28
+ } catch (err) {
29
+ logErrorAndExit(name);
30
+ }
31
+ };
32
+
33
+ const getLocalScript = name => (...args) => {
34
+ checkCwdIsStrapiApp(name);
35
+
36
+ const cmdPath = resolveCwd.silent(`strapi/lib/commands/${name}`);
37
+ if (!cmdPath) {
38
+ console.log(
39
+ `Error loading the local ${yellow(
40
+ name
41
+ )} command. Strapi might not be installed in your "node_modules". You may need to run "npm install"`
42
+ );
43
+ process.exit(1);
44
+ }
45
+
46
+ const script = require(cmdPath);
47
+
48
+ Promise.resolve()
49
+ .then(() => {
50
+ return script(...args);
51
+ })
52
+ .catch(error => {
53
+ console.error(`Error while running command ${name}: ${error.message || error}`);
54
+ process.exit(1);
55
+ });
56
+ };
57
+
58
+ // Initial program setup
59
+ program
60
+ .storeOptionsAsProperties(false)
61
+ .passCommandToAction(false)
62
+ .allowUnknownOption(true);
63
+
64
+ program.helpOption('-h, --help', 'Display help for command');
65
+ program.addHelpCommand('help [command]', 'Display help for command');
66
+
67
+ // `$ strapi version` (--version synonym)
68
+ program.version(packageJSON.version, '-v, --version', 'Output the version number');
69
+ program
70
+ .command('version')
71
+ .description('Output your version of Strapi')
72
+ .action(() => {
73
+ process.stdout.write(packageJSON.version + '\n');
74
+ process.exit(0);
75
+ });
76
+
77
+ // `$ strapi console`
78
+ program
79
+ .command('console')
80
+ .description('Open the Strapi framework console')
81
+ .action(getLocalScript('console'));
82
+
83
+ // `$ strapi new`
84
+ program
85
+ .command('new <directory>')
86
+ .option('--no-run', 'Do not start the application after it is created')
87
+ .option('--use-npm', 'Force usage of npm instead of yarn to create the project')
88
+ .option('--debug', 'Display database connection error')
89
+ .option('--quickstart', 'Quickstart app creation')
90
+ .option('--dbclient <dbclient>', 'Database client')
91
+ .option('--dbhost <dbhost>', 'Database host')
92
+ .option('--dbsrv <dbsrv>', 'Database srv')
93
+ .option('--dbport <dbport>', 'Database port')
94
+ .option('--dbname <dbname>', 'Database name')
95
+ .option('--dbusername <dbusername>', 'Database username')
96
+ .option('--dbpassword <dbpassword>', 'Database password')
97
+ .option('--dbssl <dbssl>', 'Database SSL')
98
+ .option('--dbauth <dbauth>', 'Authentication Database')
99
+ .option('--dbfile <dbfile>', 'Database file path for sqlite')
100
+ .option('--dbforce', 'Overwrite database content if any')
101
+ .description('Create a new application')
102
+ .action(require('../lib/commands/new'));
103
+
104
+ // `$ strapi start`
105
+ program
106
+ .command('start')
107
+ .description('Start your Strapi application')
108
+ .action(getLocalScript('start'));
109
+
110
+ // `$ strapi develop`
111
+ program
112
+ .command('develop')
113
+ .alias('dev')
114
+ .option('--no-build', 'Disable build')
115
+ .option('--watch-admin', 'Enable watch', false)
116
+ .option('--polling', 'Watching file changes in network directories', false)
117
+ .option('--browser <name>', 'Open the browser', true)
118
+ .description('Start your Strapi application in development mode')
119
+ .action(getLocalScript('develop'));
120
+
121
+ // `$ strapi generate:api`
122
+ program
123
+ .command('generate:api <id> [attributes...]')
124
+ .option('-a, --api <api>', 'API name to generate the files in')
125
+ .option('-p, --plugin <api>', 'Name of the local plugin')
126
+ .option('-e, --extend <api>', 'Name of the plugin to extend')
127
+ .option('-c, --connection <connection>', 'The name of the connection to use')
128
+ .option('--draft-and-publish', 'Enable draft/publish', false)
129
+ .description('Generate a basic API')
130
+ .action((id, attributes, cliArguments) => {
131
+ cliArguments.attributes = attributes;
132
+ getLocalScript('generate')(id, cliArguments);
133
+ });
134
+
135
+ // `$ strapi generate:controller`
136
+ program
137
+ .command('generate:controller <id>')
138
+ .option('-a, --api <api>', 'API name to generate the files in')
139
+ .option('-p, --plugin <api>', 'Name of the local plugin')
140
+ .option('-e, --extend <api>', 'Name of the plugin to extend')
141
+ .description('Generate a controller for an API')
142
+ .action(getLocalScript('generate'));
143
+
144
+ // `$ strapi generate:model`
145
+ program
146
+ .command('generate:model <id> [attributes...]')
147
+ .option('-a, --api <api>', 'API name to generate a sub API')
148
+ .option('-p, --plugin <api>', 'plugin name')
149
+ .option('-c, --connection <connection>', 'The name of the connection to use')
150
+ .option('--draft-and-publish', 'Enable draft/publish', false)
151
+ .description('Generate a model for an API')
152
+ .action((id, attributes, cliArguments) => {
153
+ cliArguments.attributes = attributes;
154
+ getLocalScript('generate')(id, cliArguments);
155
+ });
156
+
157
+ // `$ strapi generate:policy`
158
+ program
159
+ .command('generate:policy <id>')
160
+ .option('-a, --api <api>', 'API name')
161
+ .option('-p, --plugin <api>', 'plugin name')
162
+ .description('Generate a policy for an API')
163
+ .action(getLocalScript('generate'));
164
+
165
+ // `$ strapi generate:service`
166
+ program
167
+ .command('generate:service <id>')
168
+ .option('-a, --api <api>', 'API name')
169
+ .option('-p, --plugin <api>', 'plugin name')
170
+ .option('-t, --tpl <template>', 'template name')
171
+ .description('Generate a service for an API')
172
+ .action(getLocalScript('generate'));
173
+
174
+ // `$ strapi generate:plugin`
175
+ program
176
+ .command('generate:plugin <id>')
177
+ .option('-n, --name <name>', 'Plugin name')
178
+ .description('Generate a basic plugin')
179
+ .action(getLocalScript('generate'));
180
+
181
+ // `$ strapi generate:template <directory>`
182
+ program
183
+ .command('generate:template <directory>')
184
+ .description('Generate template from Strapi project')
185
+ .action(getLocalScript('generate-template'));
186
+
187
+ program
188
+ .command('build')
189
+ .option('--clean', 'Remove the build and .cache folders', false)
190
+ .option('--no-optimization', 'Build the Administration without assets optimization')
191
+ .description('Builds the strapi admin app')
192
+ .action(getLocalScript('build'));
193
+
194
+ // `$ strapi install`
195
+ program
196
+ .command('install [plugins...]')
197
+ .description('Install a Strapi plugin')
198
+ .action(getLocalScript('install'));
199
+
200
+ // `$ strapi uninstall`
201
+ program
202
+ .command('uninstall [plugins...]')
203
+ .description('Uninstall a Strapi plugin')
204
+ .option('-d, --delete-files', 'Delete files', false)
205
+ .action(getLocalScript('uninstall'));
206
+
207
+ // `$ strapi watch-admin`
208
+ program
209
+ .command('watch-admin')
210
+ .option('--browser <name>', 'Open the browser', true)
211
+ .description('Starts the admin dev server')
212
+ .action(getLocalScript('watchAdmin'));
213
+
214
+ program
215
+ .command('configuration:dump')
216
+ .alias('config:dump')
217
+ .description('Dump configurations of your application')
218
+ .option('-f, --file <file>', 'Output file, default output is stdout')
219
+ .option('-p, --pretty', 'Format the output JSON with indentation and line breaks', false)
220
+ .action(getLocalScript('configurationDump'));
221
+
222
+ program
223
+ .command('configuration:restore')
224
+ .alias('config:restore')
225
+ .description('Restore configurations of your application')
226
+ .option('-f, --file <file>', 'Input file, default input is stdin')
227
+ .option('-s, --strategy <strategy>', 'Strategy name, one of: "replace", "merge", "keep"')
228
+ .action(getLocalScript('configurationRestore'));
229
+
230
+ // Admin
231
+ program
232
+ .command('admin:reset-user-password')
233
+ .alias('admin:reset-password')
234
+ .description("Reset an admin user's password")
235
+ .option('-e, --email <email>', 'The user email')
236
+ .option('-p, --password <password>', 'New password for the user')
237
+ .action(getLocalScript('admin-reset'));
238
+
239
+ program.parseAsync(process.argv);
package/index.d.ts ADDED
@@ -0,0 +1,13 @@
1
+ import { DatabaseManager, Repository } from 'strapi-database';
2
+
3
+ interface Strapi {
4
+ db: DatabaseManager;
5
+
6
+ query(model: string, plugin: string): Repository;
7
+ }
8
+
9
+ export default function createStrapi(opts: any): Strapi;
10
+
11
+ declare global {
12
+ const strapi: Strapi;
13
+ }