@strapi/strapi 5.0.0-beta.8 → 5.0.0-rc.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.
- package/LICENSE +18 -3
- package/README.md +4 -4
- package/dist/cli/commands/build.d.ts.map +1 -1
- package/dist/cli/commands/build.js +0 -6
- package/dist/cli/commands/build.js.map +1 -1
- package/dist/cli/commands/build.mjs +0 -6
- package/dist/cli/commands/build.mjs.map +1 -1
- package/dist/cli/commands/index.d.ts.map +1 -1
- package/dist/cli/commands/index.js +4 -12
- package/dist/cli/commands/index.js.map +1 -1
- package/dist/cli/commands/index.mjs +4 -12
- package/dist/cli/commands/index.mjs.map +1 -1
- package/dist/cli/commands/plugin/init/files/typescript.d.ts.map +1 -1
- package/dist/cli/index.d.ts.map +1 -1
- package/dist/cli/index.js +32 -2
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/index.mjs +32 -2
- package/dist/cli/index.mjs.map +1 -1
- package/dist/cli/types.d.ts +1 -1
- package/dist/cli/types.d.ts.map +1 -1
- package/dist/cli/utils/logger.d.ts +4 -1
- package/dist/cli/utils/logger.d.ts.map +1 -1
- package/dist/cli/utils/logger.js +68 -13
- package/dist/cli/utils/logger.js.map +1 -1
- package/dist/cli/utils/logger.mjs +49 -13
- package/dist/cli/utils/logger.mjs.map +1 -1
- package/dist/node/core/aliases.d.ts.map +1 -1
- package/dist/node/core/aliases.js +1 -0
- package/dist/node/core/aliases.js.map +1 -1
- package/dist/node/core/aliases.mjs +1 -0
- package/dist/node/core/aliases.mjs.map +1 -1
- package/dist/node/core/dependencies.d.ts.map +1 -1
- package/dist/node/core/dependencies.js +4 -0
- package/dist/node/core/dependencies.js.map +1 -1
- package/dist/node/core/dependencies.mjs +4 -0
- package/dist/node/core/dependencies.mjs.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 +1 -1
- package/dist/node/create-build-context.mjs.map +1 -1
- package/dist/node/vite/config.js +1 -1
- package/dist/node/vite/config.js.map +1 -1
- package/dist/node/vite/config.mjs +1 -1
- package/dist/node/vite/config.mjs.map +1 -1
- package/package.json +26 -23
- 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/build.mjs +0 -85
- package/dist/cli/commands/plugin/build.mjs.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 -413
- package/dist/cli/commands/plugin/init/action.js.map +0 -1
- package/dist/cli/commands/plugin/init/action.mjs +0 -408
- package/dist/cli/commands/plugin/init/action.mjs.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/command.mjs +0 -10
- package/dist/cli/commands/plugin/init/command.mjs.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/admin.mjs +0 -283
- package/dist/cli/commands/plugin/init/files/admin.mjs.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/editorConfig.mjs +0 -26
- package/dist/cli/commands/plugin/init/files/editorConfig.mjs.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/eslint.mjs +0 -11
- package/dist/cli/commands/plugin/init/files/eslint.mjs.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/gitIgnore.mjs +0 -34
- package/dist/cli/commands/plugin/init/files/gitIgnore.mjs.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/prettier.mjs +0 -25
- package/dist/cli/commands/plugin/init/files/prettier.mjs.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/server.mjs +0 -360
- package/dist/cli/commands/plugin/init/files/server.mjs.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/files/typescript.mjs +0 -66
- package/dist/cli/commands/plugin/init/files/typescript.mjs.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/link-watch.mjs +0 -82
- package/dist/cli/commands/plugin/link-watch.mjs.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/verify.mjs +0 -34
- package/dist/cli/commands/plugin/verify.mjs.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/commands/plugin/watch.mjs +0 -83
- package/dist/cli/commands/plugin/watch.mjs.map +0 -1
- package/dist/cli/utils/pkg.js +0 -111
- package/dist/cli/utils/pkg.js.map +0 -1
- package/dist/cli/utils/pkg.mjs +0 -87
- package/dist/cli/utils/pkg.mjs.map +0 -1
package/LICENSE
CHANGED
|
@@ -2,7 +2,21 @@ Copyright (c) 2015-present Strapi Solutions SAS
|
|
|
2
2
|
|
|
3
3
|
Portions of the Strapi software are licensed as follows:
|
|
4
4
|
|
|
5
|
-
* All software that resides under an "ee/" directory (the “EE Software”), if that directory exists, is licensed under the license defined
|
|
5
|
+
* All software that resides under an "ee/" directory (the “EE Software”), if that directory exists, is licensed under the license defined below.
|
|
6
|
+
|
|
7
|
+
Enterprise License
|
|
8
|
+
|
|
9
|
+
If you or the company you represent has entered into a written agreement referencing the Enterprise Edition of the Strapi source code available at
|
|
10
|
+
https://github.com/strapi/strapi, then such agreement applies to your use of the Enterprise Edition of the Strapi Software. If you or the company you
|
|
11
|
+
represent is using the Enterprise Edition of the Strapi Software in connection with a subscription to our cloud offering, then the agreement you have
|
|
12
|
+
agreed to with respect to our cloud offering and the licenses included in such agreement apply to your use of the Enterprise Edition of the Strapi Software.
|
|
13
|
+
Otherwise, the Strapi Enterprise Software License Agreement (found here https://strapi.io/enterprise-terms) applies to your use of the Enterprise Edition of the Strapi Software.
|
|
14
|
+
|
|
15
|
+
BY ACCESSING OR USING THE ENTERPRISE EDITION OF THE STRAPI SOFTWARE, YOU ARE AGREEING TO BE BOUND BY THE RELEVANT REFERENCED AGREEMENT.
|
|
16
|
+
IF YOU ARE NOT AUTHORIZED TO ACCEPT THESE TERMS ON BEHALF OF THE COMPANY YOU REPRESENT OR IF YOU DO NOT AGREE TO ALL OF THE RELEVANT TERMS AND CONDITIONS REFERENCED AND YOU
|
|
17
|
+
HAVE NOT OTHERWISE EXECUTED A WRITTEN AGREEMENT WITH STRAPI, YOU ARE NOT AUTHORIZED TO ACCESS OR USE OR ALLOW ANY USER TO ACCESS OR USE ANY PART OF
|
|
18
|
+
THE ENTERPRISE EDITION OF THE STRAPI SOFTWARE. YOUR ACCESS RIGHTS ARE CONDITIONAL ON YOUR CONSENT TO THE RELEVANT REFERENCED TERMS TO THE EXCLUSION OF ALL OTHER TERMS;
|
|
19
|
+
IF THE RELEVANT REFERENCED TERMS ARE CONSIDERED AN OFFER BY YOU, ACCEPTANCE IS EXPRESSLY LIMITED TO THE RELEVANT REFERENCED TERMS.
|
|
6
20
|
|
|
7
21
|
* All software outside of the above-mentioned directories or restrictions above is available under the "MIT Expat" license as set forth below.
|
|
8
22
|
|
|
@@ -18,5 +32,6 @@ furnished to do so, subject to the following conditions:
|
|
|
18
32
|
The above copyright notice and this permission notice shall be included in all
|
|
19
33
|
copies or substantial portions of the Software.
|
|
20
34
|
|
|
21
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
22
|
-
|
|
35
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
36
|
+
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,
|
|
37
|
+
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 SOFTWARE.
|
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
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"build.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/build.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"build.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/build.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAqB9C;;GAEG;AACH,QAAA,MAAM,OAAO,EAAE,aAYd,CAAC;AAEF,OAAO,EAAE,OAAO,EAAE,CAAC"}
|
|
@@ -10,12 +10,6 @@ const action = async (options) => {
|
|
|
10
10
|
"[@strapi/strapi]: Using webpack as a bundler is deprecated. You should migrate to vite."
|
|
11
11
|
);
|
|
12
12
|
}
|
|
13
|
-
process.env.NODE_ENV = process.env.NODE_ENV ?? "production";
|
|
14
|
-
if (process.env.NODE_ENV !== "production") {
|
|
15
|
-
options.logger.warn(
|
|
16
|
-
"[@strapi/strapi]: The NODE_ENV is not set to production. This may result in unexpected behavior."
|
|
17
|
-
);
|
|
18
|
-
}
|
|
19
13
|
await build.build(options);
|
|
20
14
|
} catch (err) {
|
|
21
15
|
errors.handleUnexpectedError(err);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"build.js","sources":["../../../src/cli/commands/build.ts"],"sourcesContent":["import { createCommand } from 'commander';\nimport type { StrapiCommand } from '../types';\n\nimport { build as nodeBuild, BuildOptions } from '../../node/build';\nimport { handleUnexpectedError } from '../../node/core/errors';\n\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
|
|
1
|
+
{"version":3,"file":"build.js","sources":["../../../src/cli/commands/build.ts"],"sourcesContent":["import { createCommand } from 'commander';\nimport type { StrapiCommand } from '../types';\n\nimport { build as nodeBuild, BuildOptions } from '../../node/build';\nimport { handleUnexpectedError } from '../../node/core/errors';\n\ntype BuildCLIOptions = BuildOptions;\n\nconst action = async (options: BuildCLIOptions) => {\n try {\n if (options.bundler === 'webpack') {\n options.logger.warn(\n '[@strapi/strapi]: Using webpack as a bundler is deprecated. You should migrate to vite.'\n );\n }\n\n await nodeBuild(options);\n } catch (err) {\n handleUnexpectedError(err);\n }\n};\n\n/**\n * `$ strapi build`\n */\nconst command: StrapiCommand = ({ ctx }) => {\n return createCommand('build')\n .option('--bundler [bundler]', 'Bundler to use (webpack or vite)', 'vite')\n .option('-d, --debug', 'Enable debugging mode with verbose logs', false)\n .option('--minify', 'Minify the output', true)\n .option('--silent', \"Don't log anything\", false)\n .option('--sourcemap', 'Produce sourcemaps', false)\n .option('--stats', 'Print build statistics to the console', false)\n .description('Build the strapi admin app')\n .action(async (options: BuildCLIOptions) => {\n return action({ ...options, ...ctx });\n });\n};\n\nexport { command };\n"],"names":["nodeBuild","handleUnexpectedError","createCommand"],"mappings":";;;;;AAQA,MAAM,SAAS,OAAO,YAA6B;AAC7C,MAAA;AACE,QAAA,QAAQ,YAAY,WAAW;AACjC,cAAQ,OAAO;AAAA,QACb;AAAA,MAAA;AAAA,IAEJ;AAEA,UAAMA,MAAAA,MAAU,OAAO;AAAA,WAChB,KAAK;AACZC,WAAA,sBAAsB,GAAG;AAAA,EAC3B;AACF;AAKA,MAAM,UAAyB,CAAC,EAAE,UAAU;AAC1C,SAAOC,UAAAA,cAAc,OAAO,EACzB,OAAO,uBAAuB,oCAAoC,MAAM,EACxE,OAAO,eAAe,2CAA2C,KAAK,EACtE,OAAO,YAAY,qBAAqB,IAAI,EAC5C,OAAO,YAAY,sBAAsB,KAAK,EAC9C,OAAO,eAAe,sBAAsB,KAAK,EACjD,OAAO,WAAW,yCAAyC,KAAK,EAChE,YAAY,4BAA4B,EACxC,OAAO,OAAO,YAA6B;AAC1C,WAAO,OAAO,EAAE,GAAG,SAAS,GAAG,IAAK,CAAA;AAAA,EAAA,CACrC;AACL;;"}
|
|
@@ -8,12 +8,6 @@ const action = async (options) => {
|
|
|
8
8
|
"[@strapi/strapi]: Using webpack as a bundler is deprecated. You should migrate to vite."
|
|
9
9
|
);
|
|
10
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
11
|
await build(options);
|
|
18
12
|
} catch (err) {
|
|
19
13
|
handleUnexpectedError(err);
|
|
@@ -1 +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
|
|
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 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;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;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/index.ts"],"names":[],"mappings":"AA6BA,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEzC,eAAO,MAAM,QAAQ,EAAE,aAAa,EAgCnC,CAAC"}
|
|
@@ -26,11 +26,6 @@ const version = require("./version.js");
|
|
|
26
26
|
const command = require("./export/command.js");
|
|
27
27
|
const command$1 = require("./import/command.js");
|
|
28
28
|
const command$2 = require("./transfer/command.js");
|
|
29
|
-
const build$1 = require("./plugin/build.js");
|
|
30
|
-
const command$3 = require("./plugin/init/command.js");
|
|
31
|
-
const linkWatch = require("./plugin/link-watch.js");
|
|
32
|
-
const watch = require("./plugin/watch.js");
|
|
33
|
-
const verify = require("./plugin/verify.js");
|
|
34
29
|
const commands = [
|
|
35
30
|
createUser.command,
|
|
36
31
|
resetUserPassword.command,
|
|
@@ -57,15 +52,12 @@ const commands = [
|
|
|
57
52
|
develop.command,
|
|
58
53
|
command,
|
|
59
54
|
command$1,
|
|
60
|
-
command$2
|
|
55
|
+
command$2
|
|
61
56
|
/**
|
|
62
|
-
*
|
|
57
|
+
* Cloud
|
|
63
58
|
*/
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
linkWatch.command,
|
|
67
|
-
watch.command,
|
|
68
|
-
verify.command
|
|
59
|
+
// TODO V5: Uncomment when cloud-cli is ready
|
|
60
|
+
// cloudCommands,
|
|
69
61
|
];
|
|
70
62
|
exports.commands = commands;
|
|
71
63
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../src/cli/commands/index.ts"],"sourcesContent":["import { command as createAdminUser } from './admin/create-user';\nimport { command as resetAdminUserPassword } from './admin/reset-user-password';\nimport { command as listComponents } from './components/list';\nimport { command as configurationDump } from './configuration/dump';\nimport { command as configurationRestore } from './configuration/restore';\nimport { command as listContentTypes } from './content-types/list';\nimport { command as listControllers } from './controllers/list';\nimport { command as listHooks } from './hooks/list';\nimport { command as listMiddlewares } from './middlewares/list';\nimport { command as listPolicies } from './policies/list';\nimport { command as listRoutes } from './routes/list';\nimport { command as listServices } from './services/list';\nimport { command as disableTelemetry } from './telemetry/disable';\nimport { command as enableTelemetry } from './telemetry/enable';\nimport { command as generateTemplates } from './templates/generate';\nimport { command as generateTsTypes } from './ts/generate-types';\nimport { command as buildCommand } from './build';\nimport { command as consoleCommand } from './console';\nimport { command as developCommand } from './develop';\nimport { command as generateCommand } from './generate';\nimport { command as reportCommand } from './report';\nimport { command as startCommand } from './start';\nimport { command as versionCommand } from './version';\nimport exportCommand from './export/command';\nimport importCommand from './import/command';\nimport transferCommand from './transfer/command';\n\nimport {
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../src/cli/commands/index.ts"],"sourcesContent":["// import { buildStrapiCloudCommands as cloudCommands } from '@strapi/cloud-cli';\n\nimport { command as createAdminUser } from './admin/create-user';\nimport { command as resetAdminUserPassword } from './admin/reset-user-password';\nimport { command as listComponents } from './components/list';\nimport { command as configurationDump } from './configuration/dump';\nimport { command as configurationRestore } from './configuration/restore';\nimport { command as listContentTypes } from './content-types/list';\nimport { command as listControllers } from './controllers/list';\nimport { command as listHooks } from './hooks/list';\nimport { command as listMiddlewares } from './middlewares/list';\nimport { command as listPolicies } from './policies/list';\nimport { command as listRoutes } from './routes/list';\nimport { command as listServices } from './services/list';\nimport { command as disableTelemetry } from './telemetry/disable';\nimport { command as enableTelemetry } from './telemetry/enable';\nimport { command as generateTemplates } from './templates/generate';\nimport { command as generateTsTypes } from './ts/generate-types';\nimport { command as buildCommand } from './build';\nimport { command as consoleCommand } from './console';\nimport { command as developCommand } from './develop';\nimport { command as generateCommand } from './generate';\nimport { command as reportCommand } from './report';\nimport { command as startCommand } from './start';\nimport { command as versionCommand } from './version';\nimport exportCommand from './export/command';\nimport importCommand from './import/command';\nimport transferCommand from './transfer/command';\n\nimport { StrapiCommand } from '../types';\n\nexport const commands: StrapiCommand[] = [\n createAdminUser,\n resetAdminUserPassword,\n listComponents,\n configurationDump,\n configurationRestore,\n consoleCommand,\n listContentTypes,\n listControllers,\n generateCommand,\n listHooks,\n listMiddlewares,\n listPolicies,\n reportCommand,\n listRoutes,\n listServices,\n startCommand,\n disableTelemetry,\n enableTelemetry,\n generateTemplates,\n generateTsTypes,\n versionCommand,\n buildCommand,\n developCommand,\n exportCommand,\n importCommand,\n transferCommand,\n /**\n * Cloud\n */\n // TODO V5: Uncomment when cloud-cli is ready\n // cloudCommands,\n];\n"],"names":["createAdminUser","resetAdminUserPassword","listComponents","configurationDump","configurationRestore","consoleCommand","listContentTypes","listControllers","generateCommand","listHooks","listMiddlewares","listPolicies","reportCommand","listRoutes","listServices","startCommand","disableTelemetry","enableTelemetry","generateTemplates","generateTsTypes","versionCommand","buildCommand","developCommand","exportCommand","importCommand","transferCommand"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+BO,MAAM,WAA4B;AAAA,EACvCA,WAAA;AAAA,EACAC,kBAAA;AAAA,EACAC,KAAA;AAAA,EACAC,KAAA;AAAA,EACAC,QAAA;AAAA,EACAC,QAAA;AAAA,EACAC,OAAA;AAAA,EACAC,OAAA;AAAA,EACAC,SAAA;AAAA,EACAC,OAAA;AAAA,EACAC,OAAA;AAAA,EACAC,OAAA;AAAA,EACAC,OAAA;AAAA,EACAC,OAAA;AAAA,EACAC,OAAA;AAAA,EACAC,MAAA;AAAA,EACAC,QAAA;AAAA,EACAC,OAAA;AAAA,EACAC,WAAA;AAAA,EACAC,cAAA;AAAA,EACAC,QAAA;AAAA,EACAC,MAAA;AAAA,EACAC,QAAA;AAAA,EACAC;AAAAA,EACAC;AAAAA,EACAC;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAMF;;"}
|
|
@@ -24,11 +24,6 @@ import { command as command$k } from "./version.mjs";
|
|
|
24
24
|
import command$n from "./export/command.mjs";
|
|
25
25
|
import command$o from "./import/command.mjs";
|
|
26
26
|
import command$p from "./transfer/command.mjs";
|
|
27
|
-
import { command as command$q } from "./plugin/build.mjs";
|
|
28
|
-
import command$r from "./plugin/init/command.mjs";
|
|
29
|
-
import { command as command$s } from "./plugin/link-watch.mjs";
|
|
30
|
-
import { command as command$t } from "./plugin/watch.mjs";
|
|
31
|
-
import { command as command$u } from "./plugin/verify.mjs";
|
|
32
27
|
const commands = [
|
|
33
28
|
command,
|
|
34
29
|
command$1,
|
|
@@ -55,15 +50,12 @@ const commands = [
|
|
|
55
50
|
command$m,
|
|
56
51
|
command$n,
|
|
57
52
|
command$o,
|
|
58
|
-
command$p
|
|
53
|
+
command$p
|
|
59
54
|
/**
|
|
60
|
-
*
|
|
55
|
+
* Cloud
|
|
61
56
|
*/
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
command$s,
|
|
65
|
-
command$t,
|
|
66
|
-
command$u
|
|
57
|
+
// TODO V5: Uncomment when cloud-cli is ready
|
|
58
|
+
// cloudCommands,
|
|
67
59
|
];
|
|
68
60
|
export {
|
|
69
61
|
commands
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","sources":["../../../src/cli/commands/index.ts"],"sourcesContent":["import { command as createAdminUser } from './admin/create-user';\nimport { command as resetAdminUserPassword } from './admin/reset-user-password';\nimport { command as listComponents } from './components/list';\nimport { command as configurationDump } from './configuration/dump';\nimport { command as configurationRestore } from './configuration/restore';\nimport { command as listContentTypes } from './content-types/list';\nimport { command as listControllers } from './controllers/list';\nimport { command as listHooks } from './hooks/list';\nimport { command as listMiddlewares } from './middlewares/list';\nimport { command as listPolicies } from './policies/list';\nimport { command as listRoutes } from './routes/list';\nimport { command as listServices } from './services/list';\nimport { command as disableTelemetry } from './telemetry/disable';\nimport { command as enableTelemetry } from './telemetry/enable';\nimport { command as generateTemplates } from './templates/generate';\nimport { command as generateTsTypes } from './ts/generate-types';\nimport { command as buildCommand } from './build';\nimport { command as consoleCommand } from './console';\nimport { command as developCommand } from './develop';\nimport { command as generateCommand } from './generate';\nimport { command as reportCommand } from './report';\nimport { command as startCommand } from './start';\nimport { command as versionCommand } from './version';\nimport exportCommand from './export/command';\nimport importCommand from './import/command';\nimport transferCommand from './transfer/command';\n\nimport {
|
|
1
|
+
{"version":3,"file":"index.mjs","sources":["../../../src/cli/commands/index.ts"],"sourcesContent":["// import { buildStrapiCloudCommands as cloudCommands } from '@strapi/cloud-cli';\n\nimport { command as createAdminUser } from './admin/create-user';\nimport { command as resetAdminUserPassword } from './admin/reset-user-password';\nimport { command as listComponents } from './components/list';\nimport { command as configurationDump } from './configuration/dump';\nimport { command as configurationRestore } from './configuration/restore';\nimport { command as listContentTypes } from './content-types/list';\nimport { command as listControllers } from './controllers/list';\nimport { command as listHooks } from './hooks/list';\nimport { command as listMiddlewares } from './middlewares/list';\nimport { command as listPolicies } from './policies/list';\nimport { command as listRoutes } from './routes/list';\nimport { command as listServices } from './services/list';\nimport { command as disableTelemetry } from './telemetry/disable';\nimport { command as enableTelemetry } from './telemetry/enable';\nimport { command as generateTemplates } from './templates/generate';\nimport { command as generateTsTypes } from './ts/generate-types';\nimport { command as buildCommand } from './build';\nimport { command as consoleCommand } from './console';\nimport { command as developCommand } from './develop';\nimport { command as generateCommand } from './generate';\nimport { command as reportCommand } from './report';\nimport { command as startCommand } from './start';\nimport { command as versionCommand } from './version';\nimport exportCommand from './export/command';\nimport importCommand from './import/command';\nimport transferCommand from './transfer/command';\n\nimport { StrapiCommand } from '../types';\n\nexport const commands: StrapiCommand[] = [\n createAdminUser,\n resetAdminUserPassword,\n listComponents,\n configurationDump,\n configurationRestore,\n consoleCommand,\n listContentTypes,\n listControllers,\n generateCommand,\n listHooks,\n listMiddlewares,\n listPolicies,\n reportCommand,\n listRoutes,\n listServices,\n startCommand,\n disableTelemetry,\n enableTelemetry,\n generateTemplates,\n generateTsTypes,\n versionCommand,\n buildCommand,\n developCommand,\n exportCommand,\n importCommand,\n transferCommand,\n /**\n * Cloud\n */\n // TODO V5: Uncomment when cloud-cli is ready\n // cloudCommands,\n];\n"],"names":["createAdminUser","resetAdminUserPassword","listComponents","configurationDump","configurationRestore","consoleCommand","listContentTypes","listControllers","generateCommand","listHooks","listMiddlewares","listPolicies","reportCommand","listRoutes","listServices","startCommand","disableTelemetry","enableTelemetry","generateTemplates","generateTsTypes","versionCommand","buildCommand","developCommand","exportCommand","importCommand","transferCommand"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AA+BO,MAAM,WAA4B;AAAA,EACvCA;AAAAA,EACAC;AAAAA,EACAC;AAAAA,EACAC;AAAAA,EACAC;AAAAA,EACAC;AAAAA,EACAC;AAAAA,EACAC;AAAAA,EACAC;AAAAA,EACAC;AAAAA,EACAC;AAAAA,EACAC;AAAAA,EACAC;AAAAA,EACAC;AAAAA,EACAC;AAAAA,EACAC;AAAAA,EACAC;AAAAA,EACAC;AAAAA,EACAC;AAAAA,EACAC;AAAAA,EACAC;AAAAA,EACAC;AAAAA,EACAC;AAAAA,EACAC;AAAAA,EACAC;AAAAA,EACAC;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAMF;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"typescript.d.ts","sourceRoot":"","sources":["../../../../../../src/cli/commands/plugin/init/files/typescript.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAG/C,UAAU,aAAa;IACrB,YAAY,EAAE,YAAY,CAAC;IAC3B,iBAAiB,EAAE,YAAY,CAAC;CACjC;AAED,QAAA,MAAM,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"typescript.d.ts","sourceRoot":"","sources":["../../../../../../src/cli/commands/plugin/init/files/typescript.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAG/C,UAAU,aAAa;IACrB,YAAY,EAAE,YAAY,CAAC;IAC3B,iBAAiB,EAAE,YAAY,CAAC;CACjC;AAED,QAAA,MAAM,KAAK,EAAE,aA4CZ,CAAC;AAEF,QAAA,MAAM,MAAM,EAAE,aA0Cb,CAAC;AAEF,OAAO,EAAE,KAAK,IAAI,kBAAkB,EAAE,MAAM,IAAI,mBAAmB,EAAE,CAAC"}
|
package/dist/cli/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/cli/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAQpC,QAAA,MAAM,SAAS,SAAgB,MAAM,EAAE,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/cli/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAQpC,QAAA,MAAM,SAAS,SAAgB,MAAM,EAAE,wCAqFtC,CAAC;AAEF,QAAA,MAAM,MAAM,uDAGX,CAAC;AAEF,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,CAAC"}
|
package/dist/cli/index.js
CHANGED
|
@@ -28,15 +28,45 @@ const createCLI = async (argv, command = new commander.Command()) => {
|
|
|
28
28
|
logger: logger$1,
|
|
29
29
|
tsconfig: tsconfig$1
|
|
30
30
|
};
|
|
31
|
-
index.commands
|
|
31
|
+
for (const commandFactory of index.commands) {
|
|
32
32
|
try {
|
|
33
|
-
const subCommand = commandFactory({ command, argv, ctx });
|
|
33
|
+
const subCommand = await commandFactory({ command, argv, ctx });
|
|
34
34
|
if (subCommand) {
|
|
35
35
|
command.addCommand(subCommand);
|
|
36
36
|
}
|
|
37
37
|
} catch (e) {
|
|
38
38
|
console.error(`Failed to load command`, e);
|
|
39
39
|
}
|
|
40
|
+
}
|
|
41
|
+
const deprecatedCommands = [
|
|
42
|
+
{ name: "plugin:init", message: "Please use `npx @strapi/sdk-plugin init` instead." },
|
|
43
|
+
{
|
|
44
|
+
name: "plugin:verify",
|
|
45
|
+
message: "After migrating your plugin to v5, use `strapi-plugin verify`"
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
name: "plugin:watch",
|
|
49
|
+
message: "After migrating your plugin to v5, use `strapi-plugin watch`"
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
name: "plugin:watch:link",
|
|
53
|
+
message: "After migrating your plugin to v5, use `strapi-plugin watch:link`"
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
name: "plugin:build",
|
|
57
|
+
message: "After migrating your plugin to v5, use `strapi-plugin build`"
|
|
58
|
+
}
|
|
59
|
+
];
|
|
60
|
+
deprecatedCommands.forEach(({ name, message }) => {
|
|
61
|
+
const deprecated = new commander.Command(name).command(name).description("(deprecated)").action(() => {
|
|
62
|
+
console.warn(
|
|
63
|
+
`The command ${name} has been deprecated. See the Strapi 5 migration guide for more information.`
|
|
64
|
+
);
|
|
65
|
+
if (message) {
|
|
66
|
+
console.warn(message);
|
|
67
|
+
}
|
|
68
|
+
});
|
|
69
|
+
command.addCommand(deprecated, { hidden: true });
|
|
40
70
|
});
|
|
41
71
|
return command;
|
|
42
72
|
};
|
package/dist/cli/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.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';\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(\n // eslint-disable-next-line @typescript-eslint/no-var-requires\n require('../../package.json').version,\n '-v, --version',\n 'Output the version number'\n );\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
|
|
1
|
+
{"version":3,"file":"index.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';\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(\n // eslint-disable-next-line @typescript-eslint/no-var-requires\n require('../../package.json').version,\n '-v, --version',\n 'Output the version number'\n );\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":["Command","logger","createLogger","tsconfig","loadTsConfig","strapiCommands"],"mappings":";;;;;;AAQA,MAAM,YAAY,OAAO,MAAgB,UAAU,IAAIA,wBAAc;AAEnE,UAAQ,yBAAy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Ae,IAAI;AAAA,MAAA;AAErB,UAAI,SAAS;AACX,gBAAQ,KAAK,OAAO;AAAA,MACtB;AAAA,IAAA,CACD;AACH,YAAQ,WAAW,YAAY,EAAE,QAAQ,KAAM,CAAA;AAAA,EAAA,CAChD;AACM,SAAA;AACT;AAEM,MAAA,SAAS,OAAO,OAAO,QAAQ,MAAM,UAAU,IAAIA,UAAAA,cAAc;AACrE,QAAM,WAAW,MAAM,UAAU,MAAM,OAAO;AACxC,QAAA,SAAS,WAAW,IAAI;AAChC;;;"}
|
package/dist/cli/index.mjs
CHANGED
|
@@ -26,15 +26,45 @@ const createCLI = async (argv, command = new Command()) => {
|
|
|
26
26
|
logger,
|
|
27
27
|
tsconfig
|
|
28
28
|
};
|
|
29
|
-
|
|
29
|
+
for (const commandFactory of commands) {
|
|
30
30
|
try {
|
|
31
|
-
const subCommand = commandFactory({ command, argv, ctx });
|
|
31
|
+
const subCommand = await commandFactory({ command, argv, ctx });
|
|
32
32
|
if (subCommand) {
|
|
33
33
|
command.addCommand(subCommand);
|
|
34
34
|
}
|
|
35
35
|
} catch (e) {
|
|
36
36
|
console.error(`Failed to load command`, e);
|
|
37
37
|
}
|
|
38
|
+
}
|
|
39
|
+
const deprecatedCommands = [
|
|
40
|
+
{ name: "plugin:init", message: "Please use `npx @strapi/sdk-plugin init` instead." },
|
|
41
|
+
{
|
|
42
|
+
name: "plugin:verify",
|
|
43
|
+
message: "After migrating your plugin to v5, use `strapi-plugin verify`"
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
name: "plugin:watch",
|
|
47
|
+
message: "After migrating your plugin to v5, use `strapi-plugin watch`"
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
name: "plugin:watch:link",
|
|
51
|
+
message: "After migrating your plugin to v5, use `strapi-plugin watch:link`"
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
name: "plugin:build",
|
|
55
|
+
message: "After migrating your plugin to v5, use `strapi-plugin build`"
|
|
56
|
+
}
|
|
57
|
+
];
|
|
58
|
+
deprecatedCommands.forEach(({ name, message }) => {
|
|
59
|
+
const deprecated = new Command(name).command(name).description("(deprecated)").action(() => {
|
|
60
|
+
console.warn(
|
|
61
|
+
`The command ${name} has been deprecated. See the Strapi 5 migration guide for more information.`
|
|
62
|
+
);
|
|
63
|
+
if (message) {
|
|
64
|
+
console.warn(message);
|
|
65
|
+
}
|
|
66
|
+
});
|
|
67
|
+
command.addCommand(deprecated, { hidden: true });
|
|
38
68
|
});
|
|
39
69
|
return command;
|
|
40
70
|
};
|
package/dist/cli/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.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';\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(\n // eslint-disable-next-line @typescript-eslint/no-var-requires\n require('../../package.json').version,\n '-v, --version',\n 'Output the version number'\n );\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
|
|
1
|
+
{"version":3,"file":"index.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';\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(\n // eslint-disable-next-line @typescript-eslint/no-var-requires\n require('../../package.json').version,\n '-v, --version',\n 'Output the version number'\n );\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);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AAI,EAChC,QAAQ,IAAI,EACZ,YAAY,cAAc,EAC1B,OAAO,MAAM;AACJ,cAAA;AAAA,QACN,eAAe,IAAI;AAAA,MAAA;AAErB,UAAI,SAAS;AACX,gBAAQ,KAAK,OAAO;AAAA,MACtB;AAAA,IAAA,CACD;AACH,YAAQ,WAAW,YAAY,EAAE,QAAQ,KAAM,CAAA;AAAA,EAAA,CAChD;AACM,SAAA;AACT;AAEM,MAAA,SAAS,OAAO,OAAO,QAAQ,MAAM,UAAU,IAAI,cAAc;AACrE,QAAMC,YAAW,MAAM,UAAU,MAAM,OAAO;AACxC,QAAAA,UAAS,WAAW,IAAI;AAChC;"}
|
package/dist/cli/types.d.ts
CHANGED
package/dist/cli/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/cli/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AACxC,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAE5C,MAAM,WAAW,UAAU;IACzB,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,QAAQ,CAAC;CACrB;AAED,MAAM,MAAM,aAAa,GAAG,CAAC,MAAM,EAAE;IACnC,OAAO,EAAE,OAAO,CAAC;IACjB,IAAI,EAAE,MAAM,EAAE,CAAC;IACf,GAAG,EAAE,UAAU,CAAC;CACjB,KAAK,IAAI,GAAG,OAAO,CAAC"}
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/cli/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AACxC,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAE5C,MAAM,WAAW,UAAU;IACzB,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,QAAQ,CAAC;CACrB;AAED,MAAM,MAAM,aAAa,GAAG,CAAC,MAAM,EAAE;IACnC,OAAO,EAAE,OAAO,CAAC;IACjB,IAAI,EAAE,MAAM,EAAE,CAAC;IACf,GAAG,EAAE,UAAU,CAAC;CACjB,KAAK,IAAI,GAAG,OAAO,GAAG,OAAO,CAAC,IAAI,GAAG,OAAO,CAAC,CAAC"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import ora from 'ora';
|
|
2
|
+
import * as cliProgress from 'cli-progress';
|
|
2
3
|
export interface LoggerOptions {
|
|
3
4
|
silent?: boolean;
|
|
4
5
|
debug?: boolean;
|
|
@@ -9,10 +10,12 @@ export interface Logger {
|
|
|
9
10
|
errors: number;
|
|
10
11
|
debug: (...args: unknown[]) => void;
|
|
11
12
|
info: (...args: unknown[]) => void;
|
|
13
|
+
success: (...args: unknown[]) => void;
|
|
12
14
|
warn: (...args: unknown[]) => void;
|
|
13
15
|
error: (...args: unknown[]) => void;
|
|
14
16
|
log: (...args: unknown[]) => void;
|
|
15
|
-
spinner: (text: string) => Pick<ora.Ora, 'succeed' | 'fail' | 'start' | 'text'>;
|
|
17
|
+
spinner: (text: string) => Pick<ora.Ora, 'succeed' | 'fail' | 'start' | 'text' | 'isSpinning'>;
|
|
18
|
+
progressBar: (totalSize: number, text: string) => Pick<cliProgress.SingleBar, 'start' | 'stop' | 'update'>;
|
|
16
19
|
}
|
|
17
20
|
declare const createLogger: (options?: LoggerOptions) => Logger;
|
|
18
21
|
export { createLogger };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../../../src/cli/utils/logger.ts"],"names":[],"mappings":"AACA,OAAO,
|
|
1
|
+
{"version":3,"file":"logger.d.ts","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+2,53 @@
|
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
3
|
const chalk = require("chalk");
|
|
4
4
|
const ora = require("ora");
|
|
5
|
+
const cliProgress = require("cli-progress");
|
|
5
6
|
const _interopDefault = (e) => e && e.__esModule ? e : { default: e };
|
|
7
|
+
function _interopNamespace(e) {
|
|
8
|
+
if (e && e.__esModule)
|
|
9
|
+
return e;
|
|
10
|
+
const n = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } });
|
|
11
|
+
if (e) {
|
|
12
|
+
for (const k in e) {
|
|
13
|
+
if (k !== "default") {
|
|
14
|
+
const d = Object.getOwnPropertyDescriptor(e, k);
|
|
15
|
+
Object.defineProperty(n, k, d.get ? d : {
|
|
16
|
+
enumerable: true,
|
|
17
|
+
get: () => e[k]
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
n.default = e;
|
|
23
|
+
return Object.freeze(n);
|
|
24
|
+
}
|
|
6
25
|
const chalk__default = /* @__PURE__ */ _interopDefault(chalk);
|
|
7
26
|
const ora__default = /* @__PURE__ */ _interopDefault(ora);
|
|
27
|
+
const cliProgress__namespace = /* @__PURE__ */ _interopNamespace(cliProgress);
|
|
28
|
+
const silentSpinner = {
|
|
29
|
+
succeed() {
|
|
30
|
+
return this;
|
|
31
|
+
},
|
|
32
|
+
fail() {
|
|
33
|
+
return this;
|
|
34
|
+
},
|
|
35
|
+
start() {
|
|
36
|
+
return this;
|
|
37
|
+
},
|
|
38
|
+
text: "",
|
|
39
|
+
isSpinning: false
|
|
40
|
+
};
|
|
41
|
+
const silentProgressBar = {
|
|
42
|
+
start() {
|
|
43
|
+
return this;
|
|
44
|
+
},
|
|
45
|
+
stop() {
|
|
46
|
+
return this;
|
|
47
|
+
},
|
|
48
|
+
update() {
|
|
49
|
+
return this;
|
|
50
|
+
}
|
|
51
|
+
};
|
|
8
52
|
const createLogger = (options = {}) => {
|
|
9
53
|
const { silent = false, debug = false, timestamp = true } = options;
|
|
10
54
|
const state = { errors: 0, warning: 0 };
|
|
@@ -39,6 +83,15 @@ const createLogger = (options = {}) => {
|
|
|
39
83
|
}
|
|
40
84
|
console.info(chalk__default.default.blue(`${timestamp ? ` [${(/* @__PURE__ */ new Date()).toISOString()}]` : ""}`), ...args);
|
|
41
85
|
},
|
|
86
|
+
success(...args) {
|
|
87
|
+
if (silent) {
|
|
88
|
+
return;
|
|
89
|
+
}
|
|
90
|
+
console.info(
|
|
91
|
+
chalk__default.default.green(`[SUCCESS]${timestamp ? ` [${(/* @__PURE__ */ new Date()).toISOString()}]` : ""}`),
|
|
92
|
+
...args
|
|
93
|
+
);
|
|
94
|
+
},
|
|
42
95
|
warn(...args) {
|
|
43
96
|
state.warning += 1;
|
|
44
97
|
if (silent) {
|
|
@@ -59,23 +112,25 @@ const createLogger = (options = {}) => {
|
|
|
59
112
|
...args
|
|
60
113
|
);
|
|
61
114
|
},
|
|
62
|
-
// @ts-expect-error – returning a subpart of ora is fine because the types tell us what is what.
|
|
63
115
|
spinner(text) {
|
|
64
116
|
if (silent) {
|
|
65
|
-
return
|
|
66
|
-
succeed() {
|
|
67
|
-
return this;
|
|
68
|
-
},
|
|
69
|
-
fail() {
|
|
70
|
-
return this;
|
|
71
|
-
},
|
|
72
|
-
start() {
|
|
73
|
-
return this;
|
|
74
|
-
},
|
|
75
|
-
text: ""
|
|
76
|
-
};
|
|
117
|
+
return silentSpinner;
|
|
77
118
|
}
|
|
78
119
|
return ora__default.default(text);
|
|
120
|
+
},
|
|
121
|
+
progressBar(totalSize, text) {
|
|
122
|
+
if (silent) {
|
|
123
|
+
return silentProgressBar;
|
|
124
|
+
}
|
|
125
|
+
const progressBar = new cliProgress__namespace.SingleBar({
|
|
126
|
+
format: `${text ? `${text} |` : ""}${chalk__default.default.green("{bar}")}| {percentage}%`,
|
|
127
|
+
barCompleteChar: "█",
|
|
128
|
+
barIncompleteChar: "░",
|
|
129
|
+
hideCursor: true,
|
|
130
|
+
forceRedraw: true
|
|
131
|
+
});
|
|
132
|
+
progressBar.start(totalSize, 0);
|
|
133
|
+
return progressBar;
|
|
79
134
|
}
|
|
80
135
|
};
|
|
81
136
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"logger.js","sources":["../../../src/cli/utils/logger.ts"],"sourcesContent":["import chalk from 'chalk';\nimport ora from 'ora';\n\nexport interface LoggerOptions {\n silent?: boolean;\n debug?: boolean;\n timestamp?: boolean;\n}\n\nexport interface Logger {\n warnings: number;\n errors: number;\n debug: (...args: unknown[]) => void;\n info: (...args: unknown[]) => void;\n warn: (...args: unknown[]) => void;\n error: (...args: unknown[]) => void;\n log: (...args: unknown[]) => void;\n spinner: (text: string) => Pick<ora.Ora, 'succeed' | 'fail' | 'start' | 'text'>;\n}\n\nconst createLogger = (options: LoggerOptions = {}): Logger => {\n const { silent = false, debug = false, timestamp = true } = options;\n\n const state = { errors: 0, warning: 0 };\n\n return {\n get warnings() {\n return state.warning;\n },\n\n get errors() {\n return state.errors;\n },\n\n debug(...args) {\n if (silent || !debug) {\n return;\n }\n\n console.log(\n chalk.cyan(`[DEBUG]${timestamp ? `\\t[${new Date().toISOString()}]` : ''}`),\n ...args\n );\n },\n\n info(...args) {\n if (silent) {\n return;\n }\n\n console.info(\n chalk.blue(`[INFO]${timestamp ? `\\t[${new Date().toISOString()}]` : ''}`),\n ...args\n );\n },\n\n log(...args) {\n if (silent) {\n return;\n }\n\n console.info(chalk.blue(`${timestamp ? `\\t[${new Date().toISOString()}]` : ''}`), ...args);\n },\n\n warn(...args) {\n state.warning += 1;\n\n if (silent) {\n return;\n }\n\n console.warn(\n chalk.yellow(`[WARN]${timestamp ? `\\t[${new Date().toISOString()}]` : ''}`),\n ...args\n );\n },\n\n error(...args) {\n state.errors += 1;\n\n if (silent) {\n return;\n }\n\n console.error(\n chalk.red(`[ERROR]${timestamp ? `\\t[${new Date().toISOString()}]` : ''}`),\n ...args\n );\n },\n\n
|
|
1
|
+
{"version":3,"file":"logger.js","sources":["../../../src/cli/utils/logger.ts"],"sourcesContent":["import chalk from 'chalk';\nimport ora, { Ora } from 'ora';\nimport * as cliProgress from 'cli-progress';\n\nexport interface LoggerOptions {\n silent?: boolean;\n debug?: boolean;\n timestamp?: boolean;\n}\n\nexport interface Logger {\n warnings: number;\n errors: number;\n debug: (...args: unknown[]) => void;\n info: (...args: unknown[]) => void;\n success: (...args: unknown[]) => void;\n warn: (...args: unknown[]) => void;\n error: (...args: unknown[]) => void;\n log: (...args: unknown[]) => void;\n spinner: (text: string) => Pick<ora.Ora, 'succeed' | 'fail' | 'start' | 'text' | 'isSpinning'>;\n progressBar: (\n totalSize: number,\n text: string\n ) => Pick<cliProgress.SingleBar, 'start' | 'stop' | 'update'>;\n}\n\nconst silentSpinner = {\n succeed() {\n return this;\n },\n fail() {\n return this;\n },\n start() {\n return this;\n },\n text: '',\n isSpinning: false,\n} as Ora;\n\nconst silentProgressBar = {\n start() {\n return this;\n },\n stop() {\n return this;\n },\n update() {\n return this;\n },\n} as unknown as cliProgress.SingleBar;\n\nconst createLogger = (options: LoggerOptions = {}): Logger => {\n const { silent = false, debug = false, timestamp = true } = options;\n\n const state = { errors: 0, warning: 0 };\n\n return {\n get warnings() {\n return state.warning;\n },\n\n get errors() {\n return state.errors;\n },\n\n debug(...args) {\n if (silent || !debug) {\n return;\n }\n\n console.log(\n chalk.cyan(`[DEBUG]${timestamp ? `\\t[${new Date().toISOString()}]` : ''}`),\n ...args\n );\n },\n\n info(...args) {\n if (silent) {\n return;\n }\n\n console.info(\n chalk.blue(`[INFO]${timestamp ? `\\t[${new Date().toISOString()}]` : ''}`),\n ...args\n );\n },\n\n log(...args) {\n if (silent) {\n return;\n }\n\n console.info(chalk.blue(`${timestamp ? `\\t[${new Date().toISOString()}]` : ''}`), ...args);\n },\n\n success(...args) {\n if (silent) {\n return;\n }\n\n console.info(\n chalk.green(`[SUCCESS]${timestamp ? `\\t[${new Date().toISOString()}]` : ''}`),\n ...args\n );\n },\n\n warn(...args) {\n state.warning += 1;\n\n if (silent) {\n return;\n }\n\n console.warn(\n chalk.yellow(`[WARN]${timestamp ? `\\t[${new Date().toISOString()}]` : ''}`),\n ...args\n );\n },\n\n error(...args) {\n state.errors += 1;\n\n if (silent) {\n return;\n }\n\n console.error(\n chalk.red(`[ERROR]${timestamp ? `\\t[${new Date().toISOString()}]` : ''}`),\n ...args\n );\n },\n\n spinner(text: string) {\n if (silent) {\n return silentSpinner;\n }\n\n return ora(text);\n },\n\n progressBar(totalSize: number, text: string) {\n if (silent) {\n return silentProgressBar;\n }\n\n const progressBar = new cliProgress.SingleBar({\n format: `${text ? `${text} |` : ''}${chalk.green('{bar}')}| {percentage}%`,\n barCompleteChar: '\\u2588',\n barIncompleteChar: '\\u2591',\n hideCursor: true,\n forceRedraw: true,\n });\n\n progressBar.start(totalSize, 0);\n\n return progressBar;\n },\n };\n};\n\nexport { createLogger };\n"],"names":["chalk","ora","cliProgress"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AA0BA,MAAM,gBAAgB;AAAA,EACpB,UAAU;AACD,WAAA;AAAA,EACT;AAAA,EACA,OAAO;AACE,WAAA;AAAA,EACT;AAAA,EACA,QAAQ;AACC,WAAA;AAAA,EACT;AAAA,EACA,MAAM;AAAA,EACN,YAAY;AACd;AAEA,MAAM,oBAAoB;AAAA,EACxB,QAAQ;AACC,WAAA;AAAA,EACT;AAAA,EACA,OAAO;AACE,WAAA;AAAA,EACT;AAAA,EACA,SAAS;AACA,WAAA;AAAA,EACT;AACF;AAEA,MAAM,eAAe,CAAC,UAAyB,OAAe;AAC5D,QAAM,EAAE,SAAS,OAAO,QAAQ,OAAO,YAAY,KAAS,IAAA;AAE5D,QAAM,QAAQ,EAAE,QAAQ,GAAG,SAAS,EAAE;AAE/B,SAAA;AAAA,IACL,IAAI,WAAW;AACb,aAAO,MAAM;AAAA,IACf;AAAA,IAEA,IAAI,SAAS;AACX,aAAO,MAAM;AAAA,IACf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