@strapi/strapi 4.10.0-beta.1 → 4.10.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/bin/strapi.js +2 -468
- package/ee/LICENSE.txt +21 -0
- package/ee/index.js +3 -1
- package/ee/license.js +8 -7
- package/lib/Strapi.js +3 -0
- package/lib/commands/{admin-create.js → actions/admin/create-user/action.js} +2 -2
- package/lib/commands/actions/admin/create-user/command.js +19 -0
- package/lib/commands/{admin-reset.js → actions/admin/reset-user-password/action.js} +2 -2
- package/lib/commands/actions/admin/reset-user-password/command.js +17 -0
- package/lib/commands/{configurationDump.js → actions/configuration/dump/action.js} +1 -1
- package/lib/commands/actions/configuration/dump/command.js +17 -0
- package/lib/commands/{configurationRestore.js → actions/configuration/restore/action.js} +1 -1
- package/lib/commands/actions/configuration/restore/command.js +17 -0
- package/lib/commands/{console.js → actions/console/action.js} +2 -2
- package/lib/commands/actions/console/command.js +14 -0
- package/lib/commands/{content-types/list.js → actions/content-types/list/action.js} +2 -2
- package/lib/commands/actions/content-types/list/command.js +14 -0
- package/lib/commands/{controllers/list.js → actions/controllers/list/action.js} +2 -2
- package/lib/commands/actions/controllers/list/command.js +14 -0
- package/lib/commands/{develop.js → actions/develop/action.js} +3 -3
- package/lib/commands/actions/develop/command.js +19 -0
- package/lib/commands/{transfer/export.js → actions/export/action.js} +3 -2
- package/lib/commands/actions/export/command.js +45 -0
- package/lib/commands/actions/generate/command.js +18 -0
- package/lib/commands/{hooks/list.js → actions/hooks/list/action.js} +2 -2
- package/lib/commands/actions/hooks/list/command.js +14 -0
- package/lib/commands/{transfer/import.js → actions/import/action.js} +2 -2
- package/lib/commands/actions/import/command.js +97 -0
- package/lib/commands/{install.js → actions/install/action.js} +1 -1
- package/lib/commands/actions/install/command.js +14 -0
- package/lib/commands/{middlewares/list.js → actions/middlewares/list/action.js} +2 -2
- package/lib/commands/actions/middlewares/list/command.js +14 -0
- package/lib/commands/{new.js → actions/new/action.js} +1 -1
- package/lib/commands/actions/new/command.js +35 -0
- package/lib/commands/{policies/list.js → actions/policies/list/action.js} +2 -2
- package/lib/commands/actions/policies/list/command.js +14 -0
- package/lib/commands/{report.js → actions/report/action.js} +1 -1
- package/lib/commands/actions/report/command.js +17 -0
- package/lib/commands/{routes/list.js → actions/routes/list/action.js} +2 -2
- package/lib/commands/actions/routes/list/command.js +14 -0
- package/lib/commands/{services/list.js → actions/services/list/action.js} +2 -2
- package/lib/commands/actions/services/list/command.js +14 -0
- package/lib/commands/{start.js → actions/start/action.js} +1 -1
- package/lib/commands/actions/start/command.js +14 -0
- package/lib/commands/{opt-out-telemetry.js → actions/telemetry/disable/action.js} +1 -1
- package/lib/commands/actions/telemetry/disable/command.js +14 -0
- package/lib/commands/{opt-in-telemetry.js → actions/telemetry/enable/action.js} +1 -1
- package/lib/commands/actions/telemetry/enable/command.js +14 -0
- package/lib/commands/actions/templates/generate/command.js +14 -0
- package/lib/commands/{transfer/transfer.js → actions/transfer/action.js} +2 -2
- package/lib/commands/actions/transfer/command.js +115 -0
- package/lib/commands/{ts/generate-types.js → actions/ts/generate-types/action.js} +2 -2
- package/lib/commands/actions/ts/generate-types/command.js +21 -0
- package/lib/commands/{uninstall.js → actions/uninstall/action.js} +1 -1
- package/lib/commands/actions/uninstall/command.js +15 -0
- package/lib/commands/actions/version/command.js +19 -0
- package/lib/commands/{watchAdmin.js → actions/watch-admin/action.js} +4 -4
- package/lib/commands/actions/watch-admin/command.js +15 -0
- package/lib/commands/index.js +66 -0
- package/lib/commands/{transfer/utils.js → utils/data-transfer.js} +2 -2
- package/lib/commands/utils/helpers.js +54 -3
- package/lib/core/registries/custom-fields.js +19 -2
- package/lib/services/metrics/sender.js +1 -2
- package/lib/services/webhook-runner.js +4 -4
- package/lib/types/core/commands/index.d.ts +6 -0
- package/lib/utils/fetch.js +23 -0
- package/package.json +17 -16
- package/lib/commands/build.js +0 -18
- /package/lib/commands/{generate-template.js → actions/templates/generate/action.js} +0 -0
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const { getLocalScript } = require('../../../utils/helpers');
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* `$ strapi configuration:restore`
|
|
7
|
+
* @param {import('../../../../types/core/commands').AddCommandOptions} options
|
|
8
|
+
*/
|
|
9
|
+
module.exports = ({ command }) => {
|
|
10
|
+
command
|
|
11
|
+
.command('configuration:restore')
|
|
12
|
+
.alias('config:restore')
|
|
13
|
+
.description('Restore configurations of your application')
|
|
14
|
+
.option('-f, --file <file>', 'Input file, default input is stdin')
|
|
15
|
+
.option('-s, --strategy <strategy>', 'Strategy name, one of: "replace", "merge", "keep"')
|
|
16
|
+
.action(getLocalScript('configuration/restore'));
|
|
17
|
+
};
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
const REPL = require('repl');
|
|
4
4
|
|
|
5
|
-
const strapi = require('
|
|
5
|
+
const strapi = require('../../../index');
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* `$ strapi console`
|
|
@@ -14,7 +14,7 @@ module.exports = async () => {
|
|
|
14
14
|
app.start().then(() => {
|
|
15
15
|
const repl = REPL.start(app.config.info.name + ' > ' || 'strapi > '); // eslint-disable-line prefer-template
|
|
16
16
|
|
|
17
|
-
repl.on('exit',
|
|
17
|
+
repl.on('exit', (err) => {
|
|
18
18
|
if (err) {
|
|
19
19
|
app.log.error(err);
|
|
20
20
|
process.exit(1);
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const { getLocalScript } = require('../../utils/helpers');
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* `$ strapi console`
|
|
7
|
+
* @param {import('../../../types/core/commands').AddCommandOptions} options
|
|
8
|
+
*/
|
|
9
|
+
module.exports = ({ command }) => {
|
|
10
|
+
command
|
|
11
|
+
.command('console')
|
|
12
|
+
.description('Open the Strapi framework console')
|
|
13
|
+
.action(getLocalScript('console'));
|
|
14
|
+
};
|
|
@@ -3,9 +3,9 @@
|
|
|
3
3
|
const CLITable = require('cli-table3');
|
|
4
4
|
const chalk = require('chalk');
|
|
5
5
|
|
|
6
|
-
const strapi = require('
|
|
6
|
+
const strapi = require('../../../../index');
|
|
7
7
|
|
|
8
|
-
module.exports = async
|
|
8
|
+
module.exports = async () => {
|
|
9
9
|
const appContext = await strapi.compile();
|
|
10
10
|
const app = await strapi(appContext).register();
|
|
11
11
|
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const { getLocalScript } = require('../../../utils/helpers');
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* `$ strapi content-types:list`
|
|
7
|
+
* @param {import('../../../../types/core/commands').AddCommandOptions} options
|
|
8
|
+
*/
|
|
9
|
+
module.exports = ({ command }) => {
|
|
10
|
+
command
|
|
11
|
+
.command('content-types:list')
|
|
12
|
+
.description('List all the application content-types')
|
|
13
|
+
.action(getLocalScript('content-types/list'));
|
|
14
|
+
};
|
|
@@ -3,9 +3,9 @@
|
|
|
3
3
|
const CLITable = require('cli-table3');
|
|
4
4
|
const chalk = require('chalk');
|
|
5
5
|
|
|
6
|
-
const strapi = require('
|
|
6
|
+
const strapi = require('../../../../index');
|
|
7
7
|
|
|
8
|
-
module.exports = async
|
|
8
|
+
module.exports = async () => {
|
|
9
9
|
const appContext = await strapi.compile();
|
|
10
10
|
const app = await strapi(appContext).register();
|
|
11
11
|
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const { getLocalScript } = require('../../../utils/helpers');
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* `$ strapi controllers:list`
|
|
7
|
+
* @param {import('../../../../types/core/commands').AddCommandOptions} options
|
|
8
|
+
*/
|
|
9
|
+
module.exports = ({ command }) => {
|
|
10
|
+
command
|
|
11
|
+
.command('controllers:list')
|
|
12
|
+
.description('List all the application controllers')
|
|
13
|
+
.action(getLocalScript('controllers/list'));
|
|
14
|
+
};
|
|
@@ -9,9 +9,9 @@ const { getOr } = require('lodash/fp');
|
|
|
9
9
|
const { joinBy } = require('@strapi/utils');
|
|
10
10
|
const tsUtils = require('@strapi/typescript-utils');
|
|
11
11
|
|
|
12
|
-
const loadConfiguration = require('
|
|
13
|
-
const strapi = require('
|
|
14
|
-
const { buildTypeScript, buildAdmin } = require('
|
|
12
|
+
const loadConfiguration = require('../../../core/app-configuration');
|
|
13
|
+
const strapi = require('../../../index');
|
|
14
|
+
const { buildTypeScript, buildAdmin } = require('../../builders');
|
|
15
15
|
|
|
16
16
|
/**
|
|
17
17
|
* `$ strapi develop`
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const { getLocalScript } = require('../../utils/helpers');
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* `$ strapi develop`
|
|
7
|
+
* @param {import('../../../types/core/commands').AddCommandOptions} options
|
|
8
|
+
*/
|
|
9
|
+
module.exports = ({ command }) => {
|
|
10
|
+
command
|
|
11
|
+
.command('develop')
|
|
12
|
+
.alias('dev')
|
|
13
|
+
.option('--no-build', 'Disable build')
|
|
14
|
+
.option('--watch-admin', 'Enable watch', false)
|
|
15
|
+
.option('--polling', 'Watch for file changes in network directories', false)
|
|
16
|
+
.option('--browser <name>', 'Open the browser', true)
|
|
17
|
+
.description('Start your Strapi application in development mode')
|
|
18
|
+
.action(getLocalScript('develop'));
|
|
19
|
+
};
|
|
@@ -25,8 +25,9 @@ const {
|
|
|
25
25
|
exitMessageText,
|
|
26
26
|
abortTransfer,
|
|
27
27
|
getTransferTelemetryPayload,
|
|
28
|
-
} = require('
|
|
29
|
-
const { exitWith } = require('
|
|
28
|
+
} = require('../../utils/data-transfer');
|
|
29
|
+
const { exitWith } = require('../../utils/helpers');
|
|
30
|
+
|
|
30
31
|
/**
|
|
31
32
|
* @typedef ExportCommandOptions Options given to the CLI import command
|
|
32
33
|
*
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const { Option } = require('commander');
|
|
4
|
+
const {
|
|
5
|
+
excludeOption,
|
|
6
|
+
onlyOption,
|
|
7
|
+
throttleOption,
|
|
8
|
+
validateExcludeOnly,
|
|
9
|
+
} = require('../../utils/data-transfer');
|
|
10
|
+
const { promptEncryptionKey } = require('../../utils/commander');
|
|
11
|
+
const { getLocalScript } = require('../../utils/helpers');
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* `$ strapi export`
|
|
15
|
+
* @param {import('../../../types/core/commands').AddCommandOptions} options
|
|
16
|
+
*/
|
|
17
|
+
module.exports = ({ command }) => {
|
|
18
|
+
command
|
|
19
|
+
.command('export')
|
|
20
|
+
.description('Export data from Strapi to file')
|
|
21
|
+
.allowExcessArguments(false)
|
|
22
|
+
.addOption(
|
|
23
|
+
new Option('--no-encrypt', `Disables 'aes-128-ecb' encryption of the output file`).default(
|
|
24
|
+
true
|
|
25
|
+
)
|
|
26
|
+
)
|
|
27
|
+
.addOption(
|
|
28
|
+
new Option('--no-compress', 'Disables gzip compression of output file').default(true)
|
|
29
|
+
)
|
|
30
|
+
.addOption(
|
|
31
|
+
new Option(
|
|
32
|
+
'-k, --key <string>',
|
|
33
|
+
'Provide encryption key in command instead of using the prompt'
|
|
34
|
+
)
|
|
35
|
+
)
|
|
36
|
+
.addOption(
|
|
37
|
+
new Option('-f, --file <file>', 'name to use for exported file (without extensions)')
|
|
38
|
+
)
|
|
39
|
+
.addOption(excludeOption)
|
|
40
|
+
.addOption(onlyOption)
|
|
41
|
+
.addOption(throttleOption)
|
|
42
|
+
.hook('preAction', validateExcludeOnly)
|
|
43
|
+
.hook('preAction', promptEncryptionKey)
|
|
44
|
+
.action(getLocalScript('export'));
|
|
45
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const { assertCwdContainsStrapiProject } = require('../../utils/helpers');
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* `$ strapi generate`
|
|
7
|
+
* @param {import('../../../types/core/commands').AddCommandOptions} options
|
|
8
|
+
*/
|
|
9
|
+
module.exports = ({ command, argv }) => {
|
|
10
|
+
command
|
|
11
|
+
.command('generate')
|
|
12
|
+
.description('Launch the interactive API generator')
|
|
13
|
+
.action(() => {
|
|
14
|
+
assertCwdContainsStrapiProject('generate');
|
|
15
|
+
argv.splice(2, 1);
|
|
16
|
+
require('@strapi/generators').runCLI();
|
|
17
|
+
});
|
|
18
|
+
};
|
|
@@ -3,9 +3,9 @@
|
|
|
3
3
|
const CLITable = require('cli-table3');
|
|
4
4
|
const chalk = require('chalk');
|
|
5
5
|
|
|
6
|
-
const strapi = require('
|
|
6
|
+
const strapi = require('../../../../index');
|
|
7
7
|
|
|
8
|
-
module.exports = async
|
|
8
|
+
module.exports = async () => {
|
|
9
9
|
const appContext = await strapi.compile();
|
|
10
10
|
const app = await strapi(appContext).register();
|
|
11
11
|
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const { getLocalScript } = require('../../../utils/helpers');
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* `$ strapi hooks:list`
|
|
7
|
+
* @param {import('../../../../types/core/commands').AddCommandOptions} options
|
|
8
|
+
*/
|
|
9
|
+
module.exports = ({ command }) => {
|
|
10
|
+
command
|
|
11
|
+
.command('hooks:list')
|
|
12
|
+
.description('List all the application hooks')
|
|
13
|
+
.action(getLocalScript('hooks/list'));
|
|
14
|
+
};
|
|
@@ -21,8 +21,8 @@ const {
|
|
|
21
21
|
exitMessageText,
|
|
22
22
|
abortTransfer,
|
|
23
23
|
getTransferTelemetryPayload,
|
|
24
|
-
} = require('
|
|
25
|
-
const { exitWith } = require('
|
|
24
|
+
} = require('../../utils/data-transfer');
|
|
25
|
+
const { exitWith } = require('../../utils/helpers');
|
|
26
26
|
|
|
27
27
|
/**
|
|
28
28
|
* @typedef {import('@strapi/data-transfer/src/file/providers').ILocalFileSourceProviderOptions} ILocalFileSourceProviderOptions
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const { Option } = require('commander');
|
|
4
|
+
const path = require('path');
|
|
5
|
+
const inquirer = require('inquirer');
|
|
6
|
+
const {
|
|
7
|
+
excludeOption,
|
|
8
|
+
onlyOption,
|
|
9
|
+
throttleOption,
|
|
10
|
+
validateExcludeOnly,
|
|
11
|
+
} = require('../../utils/data-transfer');
|
|
12
|
+
const { confirmMessage, forceOption } = require('../../utils/commander');
|
|
13
|
+
const { getLocalScript, exitWith } = require('../../utils/helpers');
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* `$ strapi import`
|
|
17
|
+
* @param {import('../../../types/core/commands').AddCommandOptions} options
|
|
18
|
+
*/
|
|
19
|
+
module.exports = ({ command }) => {
|
|
20
|
+
command
|
|
21
|
+
.command('import')
|
|
22
|
+
.description('Import data from file to Strapi')
|
|
23
|
+
.allowExcessArguments(false)
|
|
24
|
+
.requiredOption(
|
|
25
|
+
'-f, --file <file>',
|
|
26
|
+
'path and filename for the Strapi export file you want to import'
|
|
27
|
+
)
|
|
28
|
+
.addOption(
|
|
29
|
+
new Option(
|
|
30
|
+
'-k, --key <string>',
|
|
31
|
+
'Provide encryption key in command instead of using the prompt'
|
|
32
|
+
)
|
|
33
|
+
)
|
|
34
|
+
.addOption(forceOption)
|
|
35
|
+
.addOption(excludeOption)
|
|
36
|
+
.addOption(onlyOption)
|
|
37
|
+
.addOption(throttleOption)
|
|
38
|
+
.hook('preAction', validateExcludeOnly)
|
|
39
|
+
.hook('preAction', async (thisCommand) => {
|
|
40
|
+
const opts = thisCommand.opts();
|
|
41
|
+
const ext = path.extname(String(opts.file));
|
|
42
|
+
|
|
43
|
+
// check extension to guess if we should prompt for key
|
|
44
|
+
if (ext === '.enc') {
|
|
45
|
+
if (!opts.key) {
|
|
46
|
+
const answers = await inquirer.prompt([
|
|
47
|
+
{
|
|
48
|
+
type: 'password',
|
|
49
|
+
message: 'Please enter your decryption key',
|
|
50
|
+
name: 'key',
|
|
51
|
+
},
|
|
52
|
+
]);
|
|
53
|
+
if (!answers.key?.length) {
|
|
54
|
+
exitWith(1, 'No key entered, aborting import.');
|
|
55
|
+
}
|
|
56
|
+
opts.key = answers.key;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
})
|
|
60
|
+
// set decrypt and decompress options based on filename
|
|
61
|
+
.hook('preAction', (thisCommand) => {
|
|
62
|
+
const opts = thisCommand.opts();
|
|
63
|
+
|
|
64
|
+
const { extname, parse } = path;
|
|
65
|
+
|
|
66
|
+
let file = opts.file;
|
|
67
|
+
|
|
68
|
+
if (extname(file) === '.enc') {
|
|
69
|
+
file = parse(file).name; // trim the .enc extension
|
|
70
|
+
thisCommand.opts().decrypt = true;
|
|
71
|
+
} else {
|
|
72
|
+
thisCommand.opts().decrypt = false;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
if (extname(file) === '.gz') {
|
|
76
|
+
file = parse(file).name; // trim the .gz extension
|
|
77
|
+
thisCommand.opts().decompress = true;
|
|
78
|
+
} else {
|
|
79
|
+
thisCommand.opts().decompress = false;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
if (extname(file) !== '.tar') {
|
|
83
|
+
exitWith(
|
|
84
|
+
1,
|
|
85
|
+
`The file '${opts.file}' does not appear to be a valid Strapi data file. It must have an extension ending in .tar[.gz][.enc]`
|
|
86
|
+
);
|
|
87
|
+
}
|
|
88
|
+
})
|
|
89
|
+
.hook(
|
|
90
|
+
'preAction',
|
|
91
|
+
confirmMessage(
|
|
92
|
+
'The import will delete all assets and data in your database. Are you sure you want to proceed?',
|
|
93
|
+
{ failMessage: 'Import process aborted' }
|
|
94
|
+
)
|
|
95
|
+
)
|
|
96
|
+
.action(getLocalScript('import'));
|
|
97
|
+
};
|
|
@@ -4,7 +4,7 @@ const { join } = require('path');
|
|
|
4
4
|
const { existsSync } = require('fs-extra');
|
|
5
5
|
const ora = require('ora');
|
|
6
6
|
const execa = require('execa');
|
|
7
|
-
const findPackagePath = require('
|
|
7
|
+
const findPackagePath = require('../../../load/package-path');
|
|
8
8
|
|
|
9
9
|
module.exports = async (plugins) => {
|
|
10
10
|
const loader = ora();
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const { getLocalScript } = require('../../utils/helpers');
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* `$ strapi install`
|
|
7
|
+
* @param {import('../../../types/core/commands').AddCommandOptions} options
|
|
8
|
+
*/
|
|
9
|
+
module.exports = ({ command }) => {
|
|
10
|
+
command
|
|
11
|
+
.command('install [plugins...]')
|
|
12
|
+
.description('Install a Strapi plugin')
|
|
13
|
+
.action(getLocalScript('install'));
|
|
14
|
+
};
|
|
@@ -3,9 +3,9 @@
|
|
|
3
3
|
const CLITable = require('cli-table3');
|
|
4
4
|
const chalk = require('chalk');
|
|
5
5
|
|
|
6
|
-
const strapi = require('
|
|
6
|
+
const strapi = require('../../../../index');
|
|
7
7
|
|
|
8
|
-
module.exports = async
|
|
8
|
+
module.exports = async () => {
|
|
9
9
|
const appContext = await strapi.compile();
|
|
10
10
|
const app = await strapi(appContext).register();
|
|
11
11
|
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const { getLocalScript } = require('../../../utils/helpers');
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* `$ strapi middlewares:list`
|
|
7
|
+
* @param {import('../../../../types/core/commands').AddCommandOptions} options
|
|
8
|
+
*/
|
|
9
|
+
module.exports = ({ command }) => {
|
|
10
|
+
command
|
|
11
|
+
.command('middlewares:list')
|
|
12
|
+
.description('List all the application middlewares')
|
|
13
|
+
.action(getLocalScript('middlewares/list'));
|
|
14
|
+
};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const { yellow } = require('chalk');
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* `$ strapi new`
|
|
7
|
+
* @param {import('../../../types/core/commands').AddCommandOptions} options
|
|
8
|
+
*/
|
|
9
|
+
module.exports = ({ command }) => {
|
|
10
|
+
command
|
|
11
|
+
.command('new <directory>')
|
|
12
|
+
.option('--no-run', 'Do not start the application after it is created')
|
|
13
|
+
.option('--use-npm', 'Force usage of npm instead of yarn to create the project')
|
|
14
|
+
.option('--debug', 'Display database connection errors')
|
|
15
|
+
.option('--quickstart', 'Create quickstart app')
|
|
16
|
+
.option('--dbclient <dbclient>', 'Database client')
|
|
17
|
+
.option('--dbhost <dbhost>', 'Database host')
|
|
18
|
+
.option('--dbport <dbport>', 'Database port')
|
|
19
|
+
.option('--dbname <dbname>', 'Database name')
|
|
20
|
+
.option('--dbusername <dbusername>', 'Database username')
|
|
21
|
+
.option('--dbpassword <dbpassword>', 'Database password')
|
|
22
|
+
.option('--dbssl <dbssl>', 'Database SSL')
|
|
23
|
+
.option('--dbfile <dbfile>', 'Database file path for sqlite')
|
|
24
|
+
.option('--dbforce', 'Allow overwriting existing database content')
|
|
25
|
+
.option('-ts, --typescript', 'Create a typescript project')
|
|
26
|
+
.description('Create a new application')
|
|
27
|
+
.hook('preAction', () => {
|
|
28
|
+
console.warn(
|
|
29
|
+
yellow(
|
|
30
|
+
'The `strapi new` command has been deprecated in v4 and will be removed in v5. `create-strapi-app` should be used to create a new Strapi project.'
|
|
31
|
+
)
|
|
32
|
+
);
|
|
33
|
+
})
|
|
34
|
+
.action(require('./action'));
|
|
35
|
+
};
|
|
@@ -3,9 +3,9 @@
|
|
|
3
3
|
const CLITable = require('cli-table3');
|
|
4
4
|
const chalk = require('chalk');
|
|
5
5
|
|
|
6
|
-
const strapi = require('
|
|
6
|
+
const strapi = require('../../../../index');
|
|
7
7
|
|
|
8
|
-
module.exports = async
|
|
8
|
+
module.exports = async () => {
|
|
9
9
|
const appContext = await strapi.compile();
|
|
10
10
|
const app = await strapi(appContext).register();
|
|
11
11
|
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const { getLocalScript } = require('../../../utils/helpers');
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* `$ strapi policies:list`
|
|
7
|
+
* @param {import('../../../../types/core/commands').AddCommandOptions} options
|
|
8
|
+
*/
|
|
9
|
+
module.exports = ({ command }) => {
|
|
10
|
+
command
|
|
11
|
+
.command('policies:list')
|
|
12
|
+
.description('List all the application policies')
|
|
13
|
+
.action(getLocalScript('policies/list'));
|
|
14
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const { getLocalScript } = require('../../utils/helpers');
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* `$ strapi report`
|
|
7
|
+
* @param {import('../../../types/core/commands').AddCommandOptions} options
|
|
8
|
+
*/
|
|
9
|
+
module.exports = ({ command }) => {
|
|
10
|
+
command
|
|
11
|
+
.command('report')
|
|
12
|
+
.description('Get system stats for debugging and submitting issues')
|
|
13
|
+
.option('-u, --uuid', 'Include Project UUID')
|
|
14
|
+
.option('-d, --dependencies', 'Include Project Dependencies')
|
|
15
|
+
.option('--all', 'Include All Information')
|
|
16
|
+
.action(getLocalScript('report'));
|
|
17
|
+
};
|
|
@@ -4,9 +4,9 @@ const CLITable = require('cli-table3');
|
|
|
4
4
|
const chalk = require('chalk');
|
|
5
5
|
const { toUpper } = require('lodash/fp');
|
|
6
6
|
|
|
7
|
-
const strapi = require('
|
|
7
|
+
const strapi = require('../../../../index');
|
|
8
8
|
|
|
9
|
-
module.exports = async
|
|
9
|
+
module.exports = async () => {
|
|
10
10
|
const appContext = await strapi.compile();
|
|
11
11
|
const app = await strapi(appContext).load();
|
|
12
12
|
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const { getLocalScript } = require('../../../utils/helpers');
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* `$ strapi routes:list``
|
|
7
|
+
* @param {import('../../../../types/core/commands').AddCommandOptions} options
|
|
8
|
+
*/
|
|
9
|
+
module.exports = ({ command }) => {
|
|
10
|
+
command
|
|
11
|
+
.command('routes:list')
|
|
12
|
+
.description('List all the application routes')
|
|
13
|
+
.action(getLocalScript('routes/list'));
|
|
14
|
+
};
|
|
@@ -3,9 +3,9 @@
|
|
|
3
3
|
const CLITable = require('cli-table3');
|
|
4
4
|
const chalk = require('chalk');
|
|
5
5
|
|
|
6
|
-
const strapi = require('
|
|
6
|
+
const strapi = require('../../../../index');
|
|
7
7
|
|
|
8
|
-
module.exports = async
|
|
8
|
+
module.exports = async () => {
|
|
9
9
|
const appContext = await strapi.compile();
|
|
10
10
|
const app = await strapi(appContext).register();
|
|
11
11
|
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const { getLocalScript } = require('../../../utils/helpers');
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* `$ strapi services:list`
|
|
7
|
+
* @param {import('../../../../types/core/commands').AddCommandOptions} options
|
|
8
|
+
*/
|
|
9
|
+
module.exports = ({ command }) => {
|
|
10
|
+
command
|
|
11
|
+
.command('services:list')
|
|
12
|
+
.description('List all the application services')
|
|
13
|
+
.action(getLocalScript('services/list'));
|
|
14
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const { getLocalScript } = require('../../utils/helpers');
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* `$ strapi start`
|
|
7
|
+
* @param {import('../../../types/core/commands').AddCommandOptions} options
|
|
8
|
+
*/
|
|
9
|
+
module.exports = ({ command }) => {
|
|
10
|
+
command
|
|
11
|
+
.command('start')
|
|
12
|
+
.description('Start your Strapi application')
|
|
13
|
+
.action(getLocalScript('start'));
|
|
14
|
+
};
|
|
@@ -4,7 +4,7 @@ const { resolve } = require('path');
|
|
|
4
4
|
const fse = require('fs-extra');
|
|
5
5
|
const chalk = require('chalk');
|
|
6
6
|
const fetch = require('node-fetch');
|
|
7
|
-
const machineID = require('
|
|
7
|
+
const machineID = require('../../../../utils/machine-id');
|
|
8
8
|
|
|
9
9
|
const readPackageJSON = async (path) => {
|
|
10
10
|
try {
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const { getLocalScript } = require('../../../utils/helpers');
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* `$ strapi telemetry:disable`
|
|
7
|
+
* @param {import('../../../../types/core/commands').AddCommandOptions} options
|
|
8
|
+
*/
|
|
9
|
+
module.exports = ({ command }) => {
|
|
10
|
+
command
|
|
11
|
+
.command('telemetry:disable')
|
|
12
|
+
.description('Disable anonymous telemetry and metadata sending to Strapi analytics')
|
|
13
|
+
.action(getLocalScript('telemetry/disable'));
|
|
14
|
+
};
|
|
@@ -5,7 +5,7 @@ const fse = require('fs-extra');
|
|
|
5
5
|
const chalk = require('chalk');
|
|
6
6
|
const fetch = require('node-fetch');
|
|
7
7
|
const { v4: uuidv4 } = require('uuid');
|
|
8
|
-
const machineID = require('
|
|
8
|
+
const machineID = require('../../../../utils/machine-id');
|
|
9
9
|
|
|
10
10
|
const readPackageJSON = async (path) => {
|
|
11
11
|
try {
|