@strapi/strapi 5.0.0-beta.1 → 5.0.0-beta.2
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/dist/admin.d.ts.map +1 -1
- package/dist/admin.js +5 -0
- package/dist/admin.js.map +1 -1
- package/dist/admin.mjs +4 -0
- package/dist/admin.mjs.map +1 -1
- package/dist/cli/commands/admin/create-user.js +2 -2
- package/dist/cli/commands/admin/create-user.js.map +1 -1
- package/dist/cli/commands/admin/create-user.mjs +88 -0
- package/dist/cli/commands/admin/create-user.mjs.map +1 -0
- package/dist/cli/commands/admin/reset-user-password.js +2 -2
- package/dist/cli/commands/admin/reset-user-password.js.map +1 -1
- package/dist/cli/commands/admin/reset-user-password.mjs +44 -0
- package/dist/cli/commands/admin/reset-user-password.mjs.map +1 -0
- package/dist/cli/commands/build.mjs +30 -0
- package/dist/cli/commands/build.mjs.map +1 -0
- package/dist/cli/commands/components/list.js +2 -2
- package/dist/cli/commands/components/list.js.map +1 -1
- package/dist/cli/commands/components/list.mjs +24 -0
- package/dist/cli/commands/components/list.mjs.map +1 -0
- package/dist/cli/commands/configuration/dump.js +2 -2
- package/dist/cli/commands/configuration/dump.js.map +1 -1
- package/dist/cli/commands/configuration/dump.mjs +41 -0
- package/dist/cli/commands/configuration/dump.mjs.map +1 -0
- package/dist/cli/commands/configuration/restore.js +2 -2
- package/dist/cli/commands/configuration/restore.js.map +1 -1
- package/dist/cli/commands/configuration/restore.mjs +140 -0
- package/dist/cli/commands/configuration/restore.mjs.map +1 -0
- package/dist/cli/commands/console.js +2 -2
- package/dist/cli/commands/console.js.map +1 -1
- package/dist/cli/commands/console.mjs +27 -0
- package/dist/cli/commands/console.mjs.map +1 -0
- package/dist/cli/commands/content-types/list.js +2 -2
- package/dist/cli/commands/content-types/list.js.map +1 -1
- package/dist/cli/commands/content-types/list.mjs +24 -0
- package/dist/cli/commands/content-types/list.mjs.map +1 -0
- package/dist/cli/commands/controllers/list.js +2 -2
- package/dist/cli/commands/controllers/list.js.map +1 -1
- package/dist/cli/commands/controllers/list.mjs +24 -0
- package/dist/cli/commands/controllers/list.mjs.map +1 -0
- package/dist/cli/commands/develop.mjs +27 -0
- package/dist/cli/commands/develop.mjs.map +1 -0
- package/dist/cli/commands/export/action.mjs +116 -0
- package/dist/cli/commands/export/action.mjs.map +1 -0
- package/dist/cli/commands/export/command.mjs +24 -0
- package/dist/cli/commands/export/command.mjs.map +1 -0
- package/dist/cli/commands/generate.mjs +13 -0
- package/dist/cli/commands/generate.mjs.map +1 -0
- package/dist/cli/commands/hooks/list.js +2 -2
- package/dist/cli/commands/hooks/list.js.map +1 -1
- package/dist/cli/commands/hooks/list.mjs +24 -0
- package/dist/cli/commands/hooks/list.mjs.map +1 -0
- package/dist/cli/commands/import/action.mjs +105 -0
- package/dist/cli/commands/import/action.mjs.map +1 -0
- package/dist/cli/commands/import/command.mjs +68 -0
- package/dist/cli/commands/import/command.mjs.map +1 -0
- package/dist/cli/commands/index.mjs +71 -0
- package/dist/cli/commands/index.mjs.map +1 -0
- package/dist/cli/commands/middlewares/list.js +2 -2
- package/dist/cli/commands/middlewares/list.js.map +1 -1
- package/dist/cli/commands/middlewares/list.mjs +24 -0
- package/dist/cli/commands/middlewares/list.mjs.map +1 -0
- package/dist/cli/commands/plugin/build.mjs +85 -0
- package/dist/cli/commands/plugin/build.mjs.map +1 -0
- package/dist/cli/commands/plugin/init/action.js +1 -1
- package/dist/cli/commands/plugin/init/action.js.map +1 -1
- package/dist/cli/commands/plugin/init/action.mjs +409 -0
- package/dist/cli/commands/plugin/init/action.mjs.map +1 -0
- package/dist/cli/commands/plugin/init/command.mjs +10 -0
- package/dist/cli/commands/plugin/init/command.mjs.map +1 -0
- package/dist/cli/commands/plugin/init/files/admin.mjs +283 -0
- package/dist/cli/commands/plugin/init/files/admin.mjs.map +1 -0
- package/dist/cli/commands/plugin/init/files/editorConfig.mjs +26 -0
- package/dist/cli/commands/plugin/init/files/editorConfig.mjs.map +1 -0
- package/dist/cli/commands/plugin/init/files/eslint.mjs +11 -0
- package/dist/cli/commands/plugin/init/files/eslint.mjs.map +1 -0
- package/dist/cli/commands/plugin/init/files/gitIgnore.mjs +34 -0
- package/dist/cli/commands/plugin/init/files/gitIgnore.mjs.map +1 -0
- package/dist/cli/commands/plugin/init/files/prettier.mjs +25 -0
- package/dist/cli/commands/plugin/init/files/prettier.mjs.map +1 -0
- package/dist/cli/commands/plugin/init/files/server.mjs +360 -0
- package/dist/cli/commands/plugin/init/files/server.mjs.map +1 -0
- package/dist/cli/commands/plugin/init/files/typescript.mjs +66 -0
- package/dist/cli/commands/plugin/init/files/typescript.mjs.map +1 -0
- package/dist/cli/commands/plugin/link-watch.mjs +82 -0
- package/dist/cli/commands/plugin/link-watch.mjs.map +1 -0
- package/dist/cli/commands/plugin/verify.mjs +34 -0
- package/dist/cli/commands/plugin/verify.mjs.map +1 -0
- package/dist/cli/commands/plugin/watch.mjs +83 -0
- package/dist/cli/commands/plugin/watch.mjs.map +1 -0
- package/dist/cli/commands/policies/list.js +2 -2
- package/dist/cli/commands/policies/list.js.map +1 -1
- package/dist/cli/commands/policies/list.mjs +24 -0
- package/dist/cli/commands/policies/list.mjs.map +1 -0
- package/dist/cli/commands/report.js +2 -2
- package/dist/cli/commands/report.js.map +1 -1
- package/dist/cli/commands/report.mjs +35 -0
- package/dist/cli/commands/report.mjs.map +1 -0
- package/dist/cli/commands/routes/list.js +2 -2
- package/dist/cli/commands/routes/list.js.map +1 -1
- package/dist/cli/commands/routes/list.mjs +28 -0
- package/dist/cli/commands/routes/list.mjs.map +1 -0
- package/dist/cli/commands/services/list.js +2 -2
- package/dist/cli/commands/services/list.js.map +1 -1
- package/dist/cli/commands/services/list.mjs +24 -0
- package/dist/cli/commands/services/list.mjs.map +1 -0
- package/dist/cli/commands/start.js +1 -1
- package/dist/cli/commands/start.js.map +1 -1
- package/dist/cli/commands/start.mjs +24 -0
- package/dist/cli/commands/start.mjs.map +1 -0
- package/dist/cli/commands/telemetry/disable.mjs +67 -0
- package/dist/cli/commands/telemetry/disable.mjs.map +1 -0
- package/dist/cli/commands/telemetry/enable.mjs +86 -0
- package/dist/cli/commands/telemetry/enable.mjs.map +1 -0
- package/dist/cli/commands/templates/generate.mjs +74 -0
- package/dist/cli/commands/templates/generate.mjs.map +1 -0
- package/dist/cli/commands/transfer/action.mjs +131 -0
- package/dist/cli/commands/transfer/action.mjs.map +1 -0
- package/dist/cli/commands/transfer/command.mjs +84 -0
- package/dist/cli/commands/transfer/command.mjs.map +1 -0
- package/dist/cli/commands/ts/generate-types.js +2 -2
- package/dist/cli/commands/ts/generate-types.js.map +1 -1
- package/dist/cli/commands/ts/generate-types.mjs +35 -0
- package/dist/cli/commands/ts/generate-types.mjs.map +1 -0
- package/dist/cli/commands/version.mjs +13 -0
- package/dist/cli/commands/version.mjs.map +1 -0
- package/dist/cli/index.mjs +49 -0
- package/dist/cli/index.mjs.map +1 -0
- package/dist/cli/utils/commander.mjs +109 -0
- package/dist/cli/utils/commander.mjs.map +1 -0
- package/dist/cli/utils/data-transfer.js +2 -2
- package/dist/cli/utils/data-transfer.js.map +1 -1
- package/dist/cli/utils/data-transfer.mjs +339 -0
- package/dist/cli/utils/data-transfer.mjs.map +1 -0
- package/dist/cli/utils/helpers.mjs +100 -0
- package/dist/cli/utils/helpers.mjs.map +1 -0
- package/dist/cli/utils/logger.mjs +80 -0
- package/dist/cli/utils/logger.mjs.map +1 -0
- package/dist/cli/utils/pkg.d.ts.map +1 -1
- package/dist/cli/utils/pkg.js +18 -15
- package/dist/cli/utils/pkg.js.map +1 -1
- package/dist/cli/utils/pkg.mjs +87 -0
- package/dist/cli/utils/pkg.mjs.map +1 -0
- package/dist/cli/utils/telemetry.mjs +22 -0
- package/dist/cli/utils/telemetry.mjs.map +1 -0
- package/dist/cli/utils/tsconfig.mjs +23 -0
- package/dist/cli/utils/tsconfig.mjs.map +1 -0
- package/dist/node/build.mjs +58 -0
- package/dist/node/build.mjs.map +1 -0
- package/dist/node/core/admin-customisations.mjs +22 -0
- package/dist/node/core/admin-customisations.mjs.map +1 -0
- package/dist/node/core/aliases.d.ts.map +1 -1
- package/dist/node/core/aliases.js +3 -1
- package/dist/node/core/aliases.js.map +1 -1
- package/dist/node/core/aliases.mjs +30 -0
- package/dist/node/core/aliases.mjs.map +1 -0
- package/dist/node/core/config.mjs +16 -0
- package/dist/node/core/config.mjs.map +1 -0
- package/dist/node/core/dependencies.mjs +151 -0
- package/dist/node/core/dependencies.mjs.map +1 -0
- package/dist/node/core/env.d.ts.map +1 -1
- package/dist/node/core/env.js +7 -4
- package/dist/node/core/env.js.map +1 -1
- package/dist/node/core/env.mjs +23 -0
- package/dist/node/core/env.mjs.map +1 -0
- package/dist/node/core/errors.mjs +29 -0
- package/dist/node/core/errors.mjs.map +1 -0
- package/dist/node/core/files.mjs +43 -0
- package/dist/node/core/files.mjs.map +1 -0
- package/dist/node/core/managers.mjs +17 -0
- package/dist/node/core/managers.mjs.map +1 -0
- package/dist/node/core/monorepo.mjs +20 -0
- package/dist/node/core/monorepo.mjs.map +1 -0
- package/dist/node/core/plugins.mjs +93 -0
- package/dist/node/core/plugins.mjs.map +1 -0
- package/dist/node/core/timer.mjs +27 -0
- package/dist/node/core/timer.mjs.map +1 -0
- package/dist/node/create-build-context.js +1 -1
- package/dist/node/create-build-context.js.map +1 -1
- package/dist/node/create-build-context.mjs +91 -0
- package/dist/node/create-build-context.mjs.map +1 -0
- package/dist/node/develop.js +1 -1
- package/dist/node/develop.js.map +1 -1
- package/dist/node/develop.mjs +252 -0
- package/dist/node/develop.mjs.map +1 -0
- package/dist/node/staticFiles.d.ts.map +1 -1
- package/dist/node/staticFiles.js +25 -3
- package/dist/node/staticFiles.js.map +1 -1
- package/dist/node/staticFiles.mjs +76 -0
- package/dist/node/staticFiles.mjs.map +1 -0
- package/dist/node/vite/build.mjs +12 -0
- package/dist/node/vite/build.mjs.map +1 -0
- package/dist/node/vite/config.mjs +99 -0
- package/dist/node/vite/config.mjs.map +1 -0
- package/dist/node/vite/plugins.mjs +43 -0
- package/dist/node/vite/plugins.mjs.map +1 -0
- package/dist/node/vite/watch.mjs +52 -0
- package/dist/node/vite/watch.mjs.map +1 -0
- package/dist/node/webpack/build.mjs +39 -0
- package/dist/node/webpack/build.mjs.map +1 -0
- package/dist/node/webpack/config.mjs +228 -0
- package/dist/node/webpack/config.mjs.map +1 -0
- package/dist/node/webpack/watch.mjs +92 -0
- package/dist/node/webpack/watch.mjs.map +1 -0
- package/package.json +24 -24
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
import { createCommand } from "commander";
|
|
2
|
+
import fs from "fs";
|
|
3
|
+
import _ from "lodash";
|
|
4
|
+
import { compileStrapi, createStrapi } from "@strapi/core";
|
|
5
|
+
import { runAction } from "../../utils/helpers.mjs";
|
|
6
|
+
const action = async ({ file: filePath, strategy = "replace" }) => {
|
|
7
|
+
const input = filePath ? fs.readFileSync(filePath) : await readStdin();
|
|
8
|
+
const appContext = await compileStrapi();
|
|
9
|
+
const app = await createStrapi(appContext).load();
|
|
10
|
+
let dataToImport;
|
|
11
|
+
try {
|
|
12
|
+
dataToImport = JSON.parse(_.toString(input));
|
|
13
|
+
} catch (error) {
|
|
14
|
+
if (error instanceof Error) {
|
|
15
|
+
throw new Error(`Invalid input data: ${error.message}. Expected a valid JSON array.`);
|
|
16
|
+
}
|
|
17
|
+
throw error;
|
|
18
|
+
}
|
|
19
|
+
if (!Array.isArray(dataToImport)) {
|
|
20
|
+
throw new Error(`Invalid input data. Expected a valid JSON array.`);
|
|
21
|
+
}
|
|
22
|
+
if (!app.db) {
|
|
23
|
+
throw new Error("Cannot import configuration without a database connection.");
|
|
24
|
+
}
|
|
25
|
+
const importer = createImporter(app.db, strategy);
|
|
26
|
+
for (const config of dataToImport) {
|
|
27
|
+
await importer.import(config);
|
|
28
|
+
}
|
|
29
|
+
console.log(
|
|
30
|
+
`Successfully imported configuration with ${strategy} strategy. Statistics: ${importer.printStatistics()}.`
|
|
31
|
+
);
|
|
32
|
+
process.exit(0);
|
|
33
|
+
};
|
|
34
|
+
const readStdin = () => {
|
|
35
|
+
const { stdin } = process;
|
|
36
|
+
let result = "";
|
|
37
|
+
if (stdin.isTTY)
|
|
38
|
+
return Promise.resolve(result);
|
|
39
|
+
return new Promise((resolve, reject) => {
|
|
40
|
+
stdin.setEncoding("utf8");
|
|
41
|
+
stdin.on("readable", () => {
|
|
42
|
+
let chunk;
|
|
43
|
+
while (chunk = stdin.read()) {
|
|
44
|
+
result += chunk;
|
|
45
|
+
}
|
|
46
|
+
});
|
|
47
|
+
stdin.on("end", () => {
|
|
48
|
+
resolve(result);
|
|
49
|
+
});
|
|
50
|
+
stdin.on("error", reject);
|
|
51
|
+
});
|
|
52
|
+
};
|
|
53
|
+
const createImporter = (db, strategy) => {
|
|
54
|
+
switch (strategy) {
|
|
55
|
+
case "replace":
|
|
56
|
+
return createReplaceImporter(db);
|
|
57
|
+
case "merge":
|
|
58
|
+
return createMergeImporter(db);
|
|
59
|
+
case "keep":
|
|
60
|
+
return createKeepImporter(db);
|
|
61
|
+
default:
|
|
62
|
+
throw new Error(`No importer available for strategy "${strategy}"`);
|
|
63
|
+
}
|
|
64
|
+
};
|
|
65
|
+
const createReplaceImporter = (db) => {
|
|
66
|
+
const stats = {
|
|
67
|
+
created: 0,
|
|
68
|
+
replaced: 0
|
|
69
|
+
};
|
|
70
|
+
return {
|
|
71
|
+
printStatistics() {
|
|
72
|
+
return `${stats.created} created, ${stats.replaced} replaced`;
|
|
73
|
+
},
|
|
74
|
+
async import(conf) {
|
|
75
|
+
const matching = await db.query("strapi::core-store").count({ where: { key: conf.key } });
|
|
76
|
+
if (matching > 0) {
|
|
77
|
+
stats.replaced += 1;
|
|
78
|
+
await db.query("strapi::core-store").update({
|
|
79
|
+
where: { key: conf.key },
|
|
80
|
+
data: conf
|
|
81
|
+
});
|
|
82
|
+
} else {
|
|
83
|
+
stats.created += 1;
|
|
84
|
+
await db.query("strapi::core-store").create({ data: conf });
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
};
|
|
88
|
+
};
|
|
89
|
+
const createMergeImporter = (db) => {
|
|
90
|
+
const stats = {
|
|
91
|
+
created: 0,
|
|
92
|
+
merged: 0
|
|
93
|
+
};
|
|
94
|
+
return {
|
|
95
|
+
printStatistics() {
|
|
96
|
+
return `${stats.created} created, ${stats.merged} merged`;
|
|
97
|
+
},
|
|
98
|
+
async import(conf) {
|
|
99
|
+
const existingConf = await db.query("strapi::core-store").findOne({ where: { key: conf.key } });
|
|
100
|
+
if (existingConf) {
|
|
101
|
+
stats.merged += 1;
|
|
102
|
+
await db.query("strapi::core-store").update({
|
|
103
|
+
where: { key: conf.key },
|
|
104
|
+
data: _.merge(existingConf, conf)
|
|
105
|
+
});
|
|
106
|
+
} else {
|
|
107
|
+
stats.created += 1;
|
|
108
|
+
await db.query("strapi::core-store").create({ data: conf });
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
};
|
|
112
|
+
};
|
|
113
|
+
const createKeepImporter = (db) => {
|
|
114
|
+
const stats = {
|
|
115
|
+
created: 0,
|
|
116
|
+
untouched: 0
|
|
117
|
+
};
|
|
118
|
+
return {
|
|
119
|
+
printStatistics() {
|
|
120
|
+
return `${stats.created} created, ${stats.untouched} untouched`;
|
|
121
|
+
},
|
|
122
|
+
async import(conf) {
|
|
123
|
+
const matching = await db.query("strapi::core-store").count({ where: { key: conf.key } });
|
|
124
|
+
if (matching > 0) {
|
|
125
|
+
stats.untouched += 1;
|
|
126
|
+
return;
|
|
127
|
+
}
|
|
128
|
+
stats.created += 1;
|
|
129
|
+
await db.query("strapi::core-store").create({ data: conf });
|
|
130
|
+
}
|
|
131
|
+
};
|
|
132
|
+
};
|
|
133
|
+
const command = () => {
|
|
134
|
+
return createCommand("configuration:restore").alias("config:restore").description("Restore configurations of your application").option("-f, --file <file>", "Input file, default input is stdin").option("-s, --strategy <strategy>", 'Strategy name, one of: "replace", "merge", "keep"').action(runAction("configuration:restore", action));
|
|
135
|
+
};
|
|
136
|
+
export {
|
|
137
|
+
action,
|
|
138
|
+
command
|
|
139
|
+
};
|
|
140
|
+
//# sourceMappingURL=restore.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"restore.mjs","sources":["../../../../src/cli/commands/configuration/restore.ts"],"sourcesContent":["import { createCommand } from 'commander';\nimport fs from 'fs';\nimport _ from 'lodash';\nimport { createStrapi, compileStrapi } from '@strapi/core';\nimport type { Database } from '@strapi/database';\n\nimport type { StrapiCommand } from '../../types';\nimport { runAction } from '../../utils/helpers';\n\ntype Strategy = 'replace' | 'merge' | 'keep';\n\ninterface CmdOptions {\n file?: string;\n strategy?: Strategy;\n}\n\n/**\n * Will restore configurations. It reads from a file or stdin\n */\nconst action = async ({ file: filePath, strategy = 'replace' }: CmdOptions) => {\n const input = filePath ? fs.readFileSync(filePath) : await readStdin();\n\n const appContext = await compileStrapi();\n const app = await createStrapi(appContext).load();\n\n let dataToImport;\n try {\n dataToImport = JSON.parse(_.toString(input));\n } catch (error) {\n if (error instanceof Error) {\n throw new Error(`Invalid input data: ${error.message}. Expected a valid JSON array.`);\n }\n\n throw error;\n }\n\n if (!Array.isArray(dataToImport)) {\n throw new Error(`Invalid input data. Expected a valid JSON array.`);\n }\n\n if (!app.db) {\n throw new Error('Cannot import configuration without a database connection.');\n }\n\n const importer = createImporter(app.db, strategy);\n\n for (const config of dataToImport) {\n await importer.import(config);\n }\n\n console.log(\n `Successfully imported configuration with ${strategy} strategy. Statistics: ${importer.printStatistics()}.`\n );\n\n process.exit(0);\n};\n\nconst readStdin = () => {\n const { stdin } = process;\n let result = '';\n\n if (stdin.isTTY) return Promise.resolve(result);\n\n return new Promise((resolve, reject) => {\n stdin.setEncoding('utf8');\n stdin.on('readable', () => {\n let chunk;\n // eslint-disable-next-line no-cond-assign\n while ((chunk = stdin.read())) {\n result += chunk;\n }\n });\n\n stdin.on('end', () => {\n resolve(result);\n });\n\n stdin.on('error', reject);\n });\n};\n\nconst createImporter = (db: Database, strategy?: Strategy) => {\n switch (strategy) {\n case 'replace':\n return createReplaceImporter(db);\n case 'merge':\n return createMergeImporter(db);\n case 'keep':\n return createKeepImporter(db);\n default:\n throw new Error(`No importer available for strategy \"${strategy}\"`);\n }\n};\n\n/**\n * Replace importer. Will replace the keys that already exist and create the new ones\n */\nconst createReplaceImporter = (db: Database) => {\n const stats = {\n created: 0,\n replaced: 0,\n };\n\n return {\n printStatistics() {\n return `${stats.created} created, ${stats.replaced} replaced`;\n },\n\n async import(conf: Record<string, unknown>) {\n const matching = await db.query('strapi::core-store').count({ where: { key: conf.key } });\n if (matching > 0) {\n stats.replaced += 1;\n await db.query('strapi::core-store').update({\n where: { key: conf.key },\n data: conf,\n });\n } else {\n stats.created += 1;\n await db.query('strapi::core-store').create({ data: conf });\n }\n },\n };\n};\n\n/**\n * Merge importer. Will merge the keys that already exist with their new value and create the new ones\n */\nconst createMergeImporter = (db: Database) => {\n const stats = {\n created: 0,\n merged: 0,\n };\n\n return {\n printStatistics() {\n return `${stats.created} created, ${stats.merged} merged`;\n },\n\n async import(conf: Record<string, unknown>) {\n const existingConf = await db\n .query('strapi::core-store')\n .findOne({ where: { key: conf.key } });\n\n if (existingConf) {\n stats.merged += 1;\n await db.query('strapi::core-store').update({\n where: { key: conf.key },\n data: _.merge(existingConf, conf),\n });\n } else {\n stats.created += 1;\n await db.query('strapi::core-store').create({ data: conf });\n }\n },\n };\n};\n\n/**\n * Merge importer. Will keep the keys that already exist without changing them and create the new ones\n */\nconst createKeepImporter = (db: Database) => {\n const stats = {\n created: 0,\n untouched: 0,\n };\n\n return {\n printStatistics() {\n return `${stats.created} created, ${stats.untouched} untouched`;\n },\n\n async import(conf: Record<string, unknown>) {\n const matching = await db.query('strapi::core-store').count({ where: { key: conf.key } });\n if (matching > 0) {\n stats.untouched += 1;\n // if configuration already exists do not overwrite it\n return;\n }\n\n stats.created += 1;\n await db.query('strapi::core-store').create({ data: conf });\n },\n };\n};\n\n/**\n * `$ strapi configuration:restore`\n */\nconst command: StrapiCommand = () => {\n return createCommand('configuration:restore')\n .alias('config:restore')\n .description('Restore configurations of your application')\n .option('-f, --file <file>', 'Input file, default input is stdin')\n .option('-s, --strategy <strategy>', 'Strategy name, one of: \"replace\", \"merge\", \"keep\"')\n .action(runAction('configuration:restore', action));\n};\n\nexport { action, command };\n"],"names":[],"mappings":"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"}
|
|
@@ -7,8 +7,8 @@ const helpers = require("../utils/helpers.js");
|
|
|
7
7
|
const _interopDefault = (e) => e && e.__esModule ? e : { default: e };
|
|
8
8
|
const REPL__default = /* @__PURE__ */ _interopDefault(REPL);
|
|
9
9
|
const action = async () => {
|
|
10
|
-
const appContext = await core.
|
|
11
|
-
const app = await core.
|
|
10
|
+
const appContext = await core.compileStrapi();
|
|
11
|
+
const app = await core.createStrapi(appContext).load();
|
|
12
12
|
app.start().then(() => {
|
|
13
13
|
const repl = REPL__default.default.start(app.config.info.name + " > " || "strapi > ");
|
|
14
14
|
repl.on("exit", (err) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"console.js","sources":["../../../src/cli/commands/console.ts"],"sourcesContent":["import REPL from 'repl';\nimport { createCommand } from 'commander';\nimport {
|
|
1
|
+
{"version":3,"file":"console.js","sources":["../../../src/cli/commands/console.ts"],"sourcesContent":["import REPL from 'repl';\nimport { createCommand } from 'commander';\nimport { createStrapi, compileStrapi } from '@strapi/core';\n\nimport type { StrapiCommand } from '../types';\nimport { runAction } from '../utils/helpers';\n\nconst action = async () => {\n const appContext = await compileStrapi();\n const app = await createStrapi(appContext).load();\n\n app.start().then(() => {\n const repl = REPL.start(app.config.info.name + ' > ' || 'strapi > '); // eslint-disable-line prefer-template\n\n repl.on('exit', (err: Error) => {\n if (err) {\n app.log.error(err);\n process.exit(1);\n }\n\n app.server.destroy();\n process.exit(0);\n });\n });\n};\n\n/**\n * `$ strapi console`\n */\nconst command: StrapiCommand = () => {\n return createCommand('console')\n .description('Open the Strapi framework console')\n .action(runAction('console', action));\n};\n\nexport { action, command };\n"],"names":["compileStrapi","createStrapi","REPL","createCommand","runAction"],"mappings":";;;;;;;;AAOA,MAAM,SAAS,YAAY;AACnB,QAAA,aAAa,MAAMA,KAAAA;AACzB,QAAM,MAAM,MAAMC,KAAAA,aAAa,UAAU,EAAE,KAAK;AAE5C,MAAA,QAAQ,KAAK,MAAM;AACf,UAAA,OAAOC,sBAAK,MAAM,IAAI,OAAO,KAAK,OAAO,SAAS,WAAW;AAE9D,SAAA,GAAG,QAAQ,CAAC,QAAe;AAC9B,UAAI,KAAK;AACH,YAAA,IAAI,MAAM,GAAG;AACjB,gBAAQ,KAAK,CAAC;AAAA,MAChB;AAEA,UAAI,OAAO;AACX,cAAQ,KAAK,CAAC;AAAA,IAAA,CACf;AAAA,EAAA,CACF;AACH;AAKA,MAAM,UAAyB,MAAM;AAC5B,SAAAC,wBAAc,SAAS,EAC3B,YAAY,mCAAmC,EAC/C,OAAOC,kBAAU,WAAW,MAAM,CAAC;AACxC;;;"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import REPL from "repl";
|
|
2
|
+
import { createCommand } from "commander";
|
|
3
|
+
import { compileStrapi, createStrapi } from "@strapi/core";
|
|
4
|
+
import { runAction } from "../utils/helpers.mjs";
|
|
5
|
+
const action = async () => {
|
|
6
|
+
const appContext = await compileStrapi();
|
|
7
|
+
const app = await createStrapi(appContext).load();
|
|
8
|
+
app.start().then(() => {
|
|
9
|
+
const repl = REPL.start(app.config.info.name + " > " || "strapi > ");
|
|
10
|
+
repl.on("exit", (err) => {
|
|
11
|
+
if (err) {
|
|
12
|
+
app.log.error(err);
|
|
13
|
+
process.exit(1);
|
|
14
|
+
}
|
|
15
|
+
app.server.destroy();
|
|
16
|
+
process.exit(0);
|
|
17
|
+
});
|
|
18
|
+
});
|
|
19
|
+
};
|
|
20
|
+
const command = () => {
|
|
21
|
+
return createCommand("console").description("Open the Strapi framework console").action(runAction("console", action));
|
|
22
|
+
};
|
|
23
|
+
export {
|
|
24
|
+
action,
|
|
25
|
+
command
|
|
26
|
+
};
|
|
27
|
+
//# sourceMappingURL=console.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"console.mjs","sources":["../../../src/cli/commands/console.ts"],"sourcesContent":["import REPL from 'repl';\nimport { createCommand } from 'commander';\nimport { createStrapi, compileStrapi } from '@strapi/core';\n\nimport type { StrapiCommand } from '../types';\nimport { runAction } from '../utils/helpers';\n\nconst action = async () => {\n const appContext = await compileStrapi();\n const app = await createStrapi(appContext).load();\n\n app.start().then(() => {\n const repl = REPL.start(app.config.info.name + ' > ' || 'strapi > '); // eslint-disable-line prefer-template\n\n repl.on('exit', (err: Error) => {\n if (err) {\n app.log.error(err);\n process.exit(1);\n }\n\n app.server.destroy();\n process.exit(0);\n });\n });\n};\n\n/**\n * `$ strapi console`\n */\nconst command: StrapiCommand = () => {\n return createCommand('console')\n .description('Open the Strapi framework console')\n .action(runAction('console', action));\n};\n\nexport { action, command };\n"],"names":[],"mappings":";;;;AAOA,MAAM,SAAS,YAAY;AACnB,QAAA,aAAa,MAAM;AACzB,QAAM,MAAM,MAAM,aAAa,UAAU,EAAE,KAAK;AAE5C,MAAA,QAAQ,KAAK,MAAM;AACf,UAAA,OAAO,KAAK,MAAM,IAAI,OAAO,KAAK,OAAO,SAAS,WAAW;AAE9D,SAAA,GAAG,QAAQ,CAAC,QAAe;AAC9B,UAAI,KAAK;AACH,YAAA,IAAI,MAAM,GAAG;AACjB,gBAAQ,KAAK,CAAC;AAAA,MAChB;AAEA,UAAI,OAAO;AACX,cAAQ,KAAK,CAAC;AAAA,IAAA,CACf;AAAA,EAAA,CACF;AACH;AAKA,MAAM,UAAyB,MAAM;AAC5B,SAAA,cAAc,SAAS,EAC3B,YAAY,mCAAmC,EAC/C,OAAO,UAAU,WAAW,MAAM,CAAC;AACxC;"}
|
|
@@ -9,8 +9,8 @@ const _interopDefault = (e) => e && e.__esModule ? e : { default: e };
|
|
|
9
9
|
const CLITable__default = /* @__PURE__ */ _interopDefault(CLITable);
|
|
10
10
|
const chalk__default = /* @__PURE__ */ _interopDefault(chalk);
|
|
11
11
|
const action = async () => {
|
|
12
|
-
const appContext = await core.
|
|
13
|
-
const app = await core.
|
|
12
|
+
const appContext = await core.compileStrapi();
|
|
13
|
+
const app = await core.createStrapi(appContext).register();
|
|
14
14
|
const list = app.get("content-types").keys();
|
|
15
15
|
const infoTable = new CLITable__default.default({
|
|
16
16
|
head: [chalk__default.default.blue("Name")]
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"list.js","sources":["../../../../src/cli/commands/content-types/list.ts"],"sourcesContent":["import { createCommand } from 'commander';\nimport CLITable from 'cli-table3';\nimport chalk from 'chalk';\n\nimport {
|
|
1
|
+
{"version":3,"file":"list.js","sources":["../../../../src/cli/commands/content-types/list.ts"],"sourcesContent":["import { createCommand } from 'commander';\nimport CLITable from 'cli-table3';\nimport chalk from 'chalk';\n\nimport { createStrapi, compileStrapi } from '@strapi/core';\n\nimport type { StrapiCommand } from '../../types';\nimport { runAction } from '../../utils/helpers';\n\nconst action = async () => {\n const appContext = await compileStrapi();\n const app = await createStrapi(appContext).register();\n\n const list = app.get('content-types').keys();\n\n const infoTable = new CLITable({\n head: [chalk.blue('Name')],\n });\n\n list.forEach((name: string) => infoTable.push([name]));\n\n console.log(infoTable.toString());\n\n await app.destroy();\n};\n\n/**\n * `$ strapi content-types:list`\n */\nconst command: StrapiCommand = () => {\n return createCommand('content-types:list')\n .description('List all the application content-types')\n .action(runAction('content-types:list', action));\n};\n\nexport { action, command };\n"],"names":["compileStrapi","createStrapi","CLITable","chalk","createCommand","runAction"],"mappings":";;;;;;;;;;AASA,MAAM,SAAS,YAAY;AACnB,QAAA,aAAa,MAAMA,KAAAA;AACzB,QAAM,MAAM,MAAMC,KAAAA,aAAa,UAAU,EAAE,SAAS;AAEpD,QAAM,OAAO,IAAI,IAAI,eAAe,EAAE,KAAK;AAErC,QAAA,YAAY,IAAIC,0BAAS;AAAA,IAC7B,MAAM,CAACC,eAAAA,QAAM,KAAK,MAAM,CAAC;AAAA,EAAA,CAC1B;AAEI,OAAA,QAAQ,CAAC,SAAiB,UAAU,KAAK,CAAC,IAAI,CAAC,CAAC;AAE7C,UAAA,IAAI,UAAU,SAAU,CAAA;AAEhC,QAAM,IAAI;AACZ;AAKA,MAAM,UAAyB,MAAM;AAC5B,SAAAC,wBAAc,oBAAoB,EACtC,YAAY,wCAAwC,EACpD,OAAOC,kBAAU,sBAAsB,MAAM,CAAC;AACnD;;;"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { createCommand } from "commander";
|
|
2
|
+
import CLITable from "cli-table3";
|
|
3
|
+
import chalk from "chalk";
|
|
4
|
+
import { compileStrapi, createStrapi } from "@strapi/core";
|
|
5
|
+
import { runAction } from "../../utils/helpers.mjs";
|
|
6
|
+
const action = async () => {
|
|
7
|
+
const appContext = await compileStrapi();
|
|
8
|
+
const app = await createStrapi(appContext).register();
|
|
9
|
+
const list = app.get("content-types").keys();
|
|
10
|
+
const infoTable = new CLITable({
|
|
11
|
+
head: [chalk.blue("Name")]
|
|
12
|
+
});
|
|
13
|
+
list.forEach((name) => infoTable.push([name]));
|
|
14
|
+
console.log(infoTable.toString());
|
|
15
|
+
await app.destroy();
|
|
16
|
+
};
|
|
17
|
+
const command = () => {
|
|
18
|
+
return createCommand("content-types:list").description("List all the application content-types").action(runAction("content-types:list", action));
|
|
19
|
+
};
|
|
20
|
+
export {
|
|
21
|
+
action,
|
|
22
|
+
command
|
|
23
|
+
};
|
|
24
|
+
//# sourceMappingURL=list.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"list.mjs","sources":["../../../../src/cli/commands/content-types/list.ts"],"sourcesContent":["import { createCommand } from 'commander';\nimport CLITable from 'cli-table3';\nimport chalk from 'chalk';\n\nimport { createStrapi, compileStrapi } from '@strapi/core';\n\nimport type { StrapiCommand } from '../../types';\nimport { runAction } from '../../utils/helpers';\n\nconst action = async () => {\n const appContext = await compileStrapi();\n const app = await createStrapi(appContext).register();\n\n const list = app.get('content-types').keys();\n\n const infoTable = new CLITable({\n head: [chalk.blue('Name')],\n });\n\n list.forEach((name: string) => infoTable.push([name]));\n\n console.log(infoTable.toString());\n\n await app.destroy();\n};\n\n/**\n * `$ strapi content-types:list`\n */\nconst command: StrapiCommand = () => {\n return createCommand('content-types:list')\n .description('List all the application content-types')\n .action(runAction('content-types:list', action));\n};\n\nexport { action, command };\n"],"names":[],"mappings":";;;;;AASA,MAAM,SAAS,YAAY;AACnB,QAAA,aAAa,MAAM;AACzB,QAAM,MAAM,MAAM,aAAa,UAAU,EAAE,SAAS;AAEpD,QAAM,OAAO,IAAI,IAAI,eAAe,EAAE,KAAK;AAErC,QAAA,YAAY,IAAI,SAAS;AAAA,IAC7B,MAAM,CAAC,MAAM,KAAK,MAAM,CAAC;AAAA,EAAA,CAC1B;AAEI,OAAA,QAAQ,CAAC,SAAiB,UAAU,KAAK,CAAC,IAAI,CAAC,CAAC;AAE7C,UAAA,IAAI,UAAU,SAAU,CAAA;AAEhC,QAAM,IAAI;AACZ;AAKA,MAAM,UAAyB,MAAM;AAC5B,SAAA,cAAc,oBAAoB,EACtC,YAAY,wCAAwC,EACpD,OAAO,UAAU,sBAAsB,MAAM,CAAC;AACnD;"}
|
|
@@ -9,8 +9,8 @@ const _interopDefault = (e) => e && e.__esModule ? e : { default: e };
|
|
|
9
9
|
const CLITable__default = /* @__PURE__ */ _interopDefault(CLITable);
|
|
10
10
|
const chalk__default = /* @__PURE__ */ _interopDefault(chalk);
|
|
11
11
|
const action = async () => {
|
|
12
|
-
const appContext = await core.
|
|
13
|
-
const app = await core.
|
|
12
|
+
const appContext = await core.compileStrapi();
|
|
13
|
+
const app = await core.createStrapi(appContext).register();
|
|
14
14
|
const list = app.get("controllers").keys();
|
|
15
15
|
const infoTable = new CLITable__default.default({
|
|
16
16
|
head: [chalk__default.default.blue("Name")]
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"list.js","sources":["../../../../src/cli/commands/controllers/list.ts"],"sourcesContent":["import { createCommand } from 'commander';\nimport CLITable from 'cli-table3';\nimport chalk from 'chalk';\n\nimport {
|
|
1
|
+
{"version":3,"file":"list.js","sources":["../../../../src/cli/commands/controllers/list.ts"],"sourcesContent":["import { createCommand } from 'commander';\nimport CLITable from 'cli-table3';\nimport chalk from 'chalk';\n\nimport { createStrapi, compileStrapi } from '@strapi/core';\n\nimport type { StrapiCommand } from '../../types';\nimport { runAction } from '../../utils/helpers';\n\nconst action = async () => {\n const appContext = await compileStrapi();\n const app = await createStrapi(appContext).register();\n\n const list = app.get('controllers').keys();\n\n const infoTable = new CLITable({\n head: [chalk.blue('Name')],\n });\n\n list.forEach((name: string) => infoTable.push([name]));\n\n console.log(infoTable.toString());\n\n await app.destroy();\n};\n\n/**\n * `$ strapi controllers:list`\n */\nconst command: StrapiCommand = () => {\n return createCommand('controllers:list')\n .description('List all the application controllers')\n .action(runAction('controllers:list', action));\n};\n\nexport { action, command };\n"],"names":["compileStrapi","createStrapi","CLITable","chalk","createCommand","runAction"],"mappings":";;;;;;;;;;AASA,MAAM,SAAS,YAAY;AACnB,QAAA,aAAa,MAAMA,KAAAA;AACzB,QAAM,MAAM,MAAMC,KAAAA,aAAa,UAAU,EAAE,SAAS;AAEpD,QAAM,OAAO,IAAI,IAAI,aAAa,EAAE,KAAK;AAEnC,QAAA,YAAY,IAAIC,0BAAS;AAAA,IAC7B,MAAM,CAACC,eAAAA,QAAM,KAAK,MAAM,CAAC;AAAA,EAAA,CAC1B;AAEI,OAAA,QAAQ,CAAC,SAAiB,UAAU,KAAK,CAAC,IAAI,CAAC,CAAC;AAE7C,UAAA,IAAI,UAAU,SAAU,CAAA;AAEhC,QAAM,IAAI;AACZ;AAKA,MAAM,UAAyB,MAAM;AAC5B,SAAAC,wBAAc,kBAAkB,EACpC,YAAY,sCAAsC,EAClD,OAAOC,kBAAU,oBAAoB,MAAM,CAAC;AACjD;;;"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { createCommand } from "commander";
|
|
2
|
+
import CLITable from "cli-table3";
|
|
3
|
+
import chalk from "chalk";
|
|
4
|
+
import { compileStrapi, createStrapi } from "@strapi/core";
|
|
5
|
+
import { runAction } from "../../utils/helpers.mjs";
|
|
6
|
+
const action = async () => {
|
|
7
|
+
const appContext = await compileStrapi();
|
|
8
|
+
const app = await createStrapi(appContext).register();
|
|
9
|
+
const list = app.get("controllers").keys();
|
|
10
|
+
const infoTable = new CLITable({
|
|
11
|
+
head: [chalk.blue("Name")]
|
|
12
|
+
});
|
|
13
|
+
list.forEach((name) => infoTable.push([name]));
|
|
14
|
+
console.log(infoTable.toString());
|
|
15
|
+
await app.destroy();
|
|
16
|
+
};
|
|
17
|
+
const command = () => {
|
|
18
|
+
return createCommand("controllers:list").description("List all the application controllers").action(runAction("controllers:list", action));
|
|
19
|
+
};
|
|
20
|
+
export {
|
|
21
|
+
action,
|
|
22
|
+
command
|
|
23
|
+
};
|
|
24
|
+
//# sourceMappingURL=list.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"list.mjs","sources":["../../../../src/cli/commands/controllers/list.ts"],"sourcesContent":["import { createCommand } from 'commander';\nimport CLITable from 'cli-table3';\nimport chalk from 'chalk';\n\nimport { createStrapi, compileStrapi } from '@strapi/core';\n\nimport type { StrapiCommand } from '../../types';\nimport { runAction } from '../../utils/helpers';\n\nconst action = async () => {\n const appContext = await compileStrapi();\n const app = await createStrapi(appContext).register();\n\n const list = app.get('controllers').keys();\n\n const infoTable = new CLITable({\n head: [chalk.blue('Name')],\n });\n\n list.forEach((name: string) => infoTable.push([name]));\n\n console.log(infoTable.toString());\n\n await app.destroy();\n};\n\n/**\n * `$ strapi controllers:list`\n */\nconst command: StrapiCommand = () => {\n return createCommand('controllers:list')\n .description('List all the application controllers')\n .action(runAction('controllers:list', action));\n};\n\nexport { action, command };\n"],"names":[],"mappings":";;;;;AASA,MAAM,SAAS,YAAY;AACnB,QAAA,aAAa,MAAM;AACzB,QAAM,MAAM,MAAM,aAAa,UAAU,EAAE,SAAS;AAEpD,QAAM,OAAO,IAAI,IAAI,aAAa,EAAE,KAAK;AAEnC,QAAA,YAAY,IAAI,SAAS;AAAA,IAC7B,MAAM,CAAC,MAAM,KAAK,MAAM,CAAC;AAAA,EAAA,CAC1B;AAEI,OAAA,QAAQ,CAAC,SAAiB,UAAU,KAAK,CAAC,IAAI,CAAC,CAAC;AAE7C,UAAA,IAAI,UAAU,SAAU,CAAA;AAEhC,QAAM,IAAI;AACZ;AAKA,MAAM,UAAyB,MAAM;AAC5B,SAAA,cAAc,kBAAkB,EACpC,YAAY,sCAAsC,EAClD,OAAO,UAAU,oBAAoB,MAAM,CAAC;AACjD;"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { createCommand } from "commander";
|
|
2
|
+
import cluster from "node:cluster";
|
|
3
|
+
import { develop } from "../../node/develop.mjs";
|
|
4
|
+
import { handleUnexpectedError } from "../../node/core/errors.mjs";
|
|
5
|
+
const action = async (options) => {
|
|
6
|
+
try {
|
|
7
|
+
if (cluster.isPrimary) {
|
|
8
|
+
if (options.bundler === "webpack") {
|
|
9
|
+
options.logger.warn(
|
|
10
|
+
"[@strapi/strapi]: Using webpack as a bundler is deprecated. You should migrate to vite."
|
|
11
|
+
);
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
await develop(options);
|
|
15
|
+
} catch (err) {
|
|
16
|
+
handleUnexpectedError(err);
|
|
17
|
+
}
|
|
18
|
+
};
|
|
19
|
+
const command = ({ ctx }) => {
|
|
20
|
+
return createCommand("develop").alias("dev").option("--bundler [bundler]", "Bundler to use (webpack or vite)", "vite").option("-d, --debug", "Enable debugging mode with verbose logs", false).option("--silent", "Don't log anything", false).option("--polling", "Watch for file changes in network directories", false).option("--watch-admin", "Watch the admin panel for hot changes", true).option("--no-watch-admin", "Do not watch the admin panel for hot changes").option("--open", "Open the admin in your browser", true).description("Start your Strapi application in development mode").action(async (options) => {
|
|
21
|
+
return action({ ...options, ...ctx });
|
|
22
|
+
});
|
|
23
|
+
};
|
|
24
|
+
export {
|
|
25
|
+
command
|
|
26
|
+
};
|
|
27
|
+
//# sourceMappingURL=develop.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"develop.mjs","sources":["../../../src/cli/commands/develop.ts"],"sourcesContent":["import { createCommand } from 'commander';\nimport cluster from 'node:cluster';\nimport type { StrapiCommand } from '../types';\nimport { develop as nodeDevelop, DevelopOptions } from '../../node/develop';\nimport { handleUnexpectedError } from '../../node/core/errors';\n\ntype DevelopCLIOptions = DevelopOptions;\n\nconst action = async (options: DevelopCLIOptions) => {\n try {\n if (cluster.isPrimary) {\n if (options.bundler === 'webpack') {\n options.logger.warn(\n '[@strapi/strapi]: Using webpack as a bundler is deprecated. You should migrate to vite.'\n );\n }\n }\n\n await nodeDevelop(options);\n } catch (err) {\n handleUnexpectedError(err);\n }\n};\n\n/**\n * `$ strapi develop`\n */\nconst command: StrapiCommand = ({ ctx }) => {\n return createCommand('develop')\n .alias('dev')\n .option('--bundler [bundler]', 'Bundler to use (webpack or vite)', 'vite')\n .option('-d, --debug', 'Enable debugging mode with verbose logs', false)\n .option('--silent', \"Don't log anything\", false)\n .option('--polling', 'Watch for file changes in network directories', false)\n .option('--watch-admin', 'Watch the admin panel for hot changes', true)\n .option('--no-watch-admin', 'Do not watch the admin panel for hot changes')\n .option('--open', 'Open the admin in your browser', true)\n .description('Start your Strapi application in development mode')\n .action(async (options: DevelopCLIOptions) => {\n return action({ ...options, ...ctx });\n });\n};\n\nexport { command };\n"],"names":["nodeDevelop"],"mappings":";;;;AAQA,MAAM,SAAS,OAAO,YAA+B;AAC/C,MAAA;AACF,QAAI,QAAQ,WAAW;AACjB,UAAA,QAAQ,YAAY,WAAW;AACjC,gBAAQ,OAAO;AAAA,UACb;AAAA,QAAA;AAAA,MAEJ;AAAA,IACF;AAEA,UAAMA,QAAY,OAAO;AAAA,WAClB,KAAK;AACZ,0BAAsB,GAAG;AAAA,EAC3B;AACF;AAKA,MAAM,UAAyB,CAAC,EAAE,UAAU;AACnC,SAAA,cAAc,SAAS,EAC3B,MAAM,KAAK,EACX,OAAO,uBAAuB,oCAAoC,MAAM,EACxE,OAAO,eAAe,2CAA2C,KAAK,EACtE,OAAO,YAAY,sBAAsB,KAAK,EAC9C,OAAO,aAAa,iDAAiD,KAAK,EAC1E,OAAO,iBAAiB,yCAAyC,IAAI,EACrE,OAAO,oBAAoB,8CAA8C,EACzE,OAAO,UAAU,kCAAkC,IAAI,EACvD,YAAY,mDAAmD,EAC/D,OAAO,OAAO,YAA+B;AAC5C,WAAO,OAAO,EAAE,GAAG,SAAS,GAAG,IAAK,CAAA;AAAA,EAAA,CACrC;AACL;"}
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
import { isObject, isString, isFinite, toNumber } from "lodash/fp";
|
|
2
|
+
import fse from "fs-extra";
|
|
3
|
+
import chalk from "chalk";
|
|
4
|
+
import { engine, file, strapi } from "@strapi/data-transfer";
|
|
5
|
+
import { createStrapiInstance, DEFAULT_IGNORED_CONTENT_TYPES, formatDiagnostic, getTransferTelemetryPayload, abortTransfer, setSignalHandler, buildTransferTable, exitMessageText, loadersFactory, getDefaultExportName } from "../../utils/data-transfer.mjs";
|
|
6
|
+
import { exitWith } from "../../utils/helpers.mjs";
|
|
7
|
+
const {
|
|
8
|
+
providers: { createLocalFileDestinationProvider }
|
|
9
|
+
} = file;
|
|
10
|
+
const {
|
|
11
|
+
providers: { createLocalStrapiSourceProvider }
|
|
12
|
+
} = strapi;
|
|
13
|
+
const BYTES_IN_MB = 1024 * 1024;
|
|
14
|
+
const action = async (opts) => {
|
|
15
|
+
if (!isObject(opts)) {
|
|
16
|
+
exitWith(1, "Could not parse command arguments");
|
|
17
|
+
}
|
|
18
|
+
const strapi2 = await createStrapiInstance();
|
|
19
|
+
const source = createSourceProvider(strapi2);
|
|
20
|
+
const destination = createDestinationProvider(opts);
|
|
21
|
+
const engine$1 = engine.createTransferEngine(source, destination, {
|
|
22
|
+
versionStrategy: "ignore",
|
|
23
|
+
// for an export to file, versionStrategy will always be skipped
|
|
24
|
+
schemaStrategy: "ignore",
|
|
25
|
+
// for an export to file, schemaStrategy will always be skipped
|
|
26
|
+
exclude: opts.exclude,
|
|
27
|
+
only: opts.only,
|
|
28
|
+
throttle: opts.throttle,
|
|
29
|
+
transforms: {
|
|
30
|
+
links: [
|
|
31
|
+
{
|
|
32
|
+
filter(link) {
|
|
33
|
+
return !DEFAULT_IGNORED_CONTENT_TYPES.includes(link.left.type) && !DEFAULT_IGNORED_CONTENT_TYPES.includes(link.right.type);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
],
|
|
37
|
+
entities: [
|
|
38
|
+
{
|
|
39
|
+
filter(entity) {
|
|
40
|
+
return !DEFAULT_IGNORED_CONTENT_TYPES.includes(entity.type);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
]
|
|
44
|
+
}
|
|
45
|
+
});
|
|
46
|
+
engine$1.diagnostics.onDiagnostic(formatDiagnostic("export"));
|
|
47
|
+
const progress = engine$1.progress.stream;
|
|
48
|
+
const { updateLoader } = loadersFactory();
|
|
49
|
+
progress.on(`stage::start`, ({ stage, data }) => {
|
|
50
|
+
updateLoader(stage, data).start();
|
|
51
|
+
});
|
|
52
|
+
progress.on("stage::finish", ({ stage, data }) => {
|
|
53
|
+
updateLoader(stage, data).succeed();
|
|
54
|
+
});
|
|
55
|
+
progress.on("stage::progress", ({ stage, data }) => {
|
|
56
|
+
updateLoader(stage, data);
|
|
57
|
+
});
|
|
58
|
+
progress.on("transfer::start", async () => {
|
|
59
|
+
console.log(`Starting export...`);
|
|
60
|
+
await strapi2.telemetry.send("didDEITSProcessStart", getTransferTelemetryPayload(engine$1));
|
|
61
|
+
});
|
|
62
|
+
let results;
|
|
63
|
+
let outFile;
|
|
64
|
+
try {
|
|
65
|
+
setSignalHandler(() => abortTransfer({ engine: engine$1, strapi: strapi2 }));
|
|
66
|
+
results = await engine$1.transfer();
|
|
67
|
+
outFile = results.destination?.file?.path ?? "";
|
|
68
|
+
const outFileExists = await fse.pathExists(outFile);
|
|
69
|
+
if (!outFileExists) {
|
|
70
|
+
throw new engine.errors.TransferEngineTransferError(
|
|
71
|
+
`Export file not created "${outFile}"`
|
|
72
|
+
);
|
|
73
|
+
}
|
|
74
|
+
await strapi2.telemetry.send("didDEITSProcessFinish", getTransferTelemetryPayload(engine$1));
|
|
75
|
+
try {
|
|
76
|
+
const table = buildTransferTable(results.engine);
|
|
77
|
+
console.log(table?.toString());
|
|
78
|
+
} catch (e) {
|
|
79
|
+
console.error("There was an error displaying the results of the transfer.");
|
|
80
|
+
}
|
|
81
|
+
console.log(`Export archive is in ${chalk.green(outFile)}`);
|
|
82
|
+
exitWith(0, exitMessageText("export"));
|
|
83
|
+
} catch {
|
|
84
|
+
await strapi2.telemetry.send("didDEITSProcessFail", getTransferTelemetryPayload(engine$1));
|
|
85
|
+
exitWith(1, exitMessageText("export", true));
|
|
86
|
+
}
|
|
87
|
+
};
|
|
88
|
+
const createSourceProvider = (strapi2) => {
|
|
89
|
+
return createLocalStrapiSourceProvider({
|
|
90
|
+
async getStrapi() {
|
|
91
|
+
return strapi2;
|
|
92
|
+
}
|
|
93
|
+
});
|
|
94
|
+
};
|
|
95
|
+
const createDestinationProvider = (opts) => {
|
|
96
|
+
const { file: file2, compress, encrypt, key, maxSizeJsonl } = opts;
|
|
97
|
+
const filepath = isString(file2) && file2.length > 0 ? file2 : getDefaultExportName();
|
|
98
|
+
const maxSizeJsonlInMb = isFinite(toNumber(maxSizeJsonl)) ? toNumber(maxSizeJsonl) * BYTES_IN_MB : void 0;
|
|
99
|
+
return createLocalFileDestinationProvider({
|
|
100
|
+
file: {
|
|
101
|
+
path: filepath,
|
|
102
|
+
maxSizeJsonl: maxSizeJsonlInMb
|
|
103
|
+
},
|
|
104
|
+
encryption: {
|
|
105
|
+
enabled: encrypt ?? false,
|
|
106
|
+
key: encrypt ? key : void 0
|
|
107
|
+
},
|
|
108
|
+
compression: {
|
|
109
|
+
enabled: compress ?? false
|
|
110
|
+
}
|
|
111
|
+
});
|
|
112
|
+
};
|
|
113
|
+
export {
|
|
114
|
+
action as default
|
|
115
|
+
};
|
|
116
|
+
//# sourceMappingURL=action.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"action.mjs","sources":["../../../../src/cli/commands/export/action.ts"],"sourcesContent":["import { isObject, isString, isFinite, toNumber } from 'lodash/fp';\nimport fs from 'fs-extra';\nimport chalk from 'chalk';\nimport type { Core } from '@strapi/types';\n\nimport {\n engine as engineDataTransfer,\n strapi as strapiDataTransfer,\n file as fileDataTransfer,\n} from '@strapi/data-transfer';\n\nimport {\n getDefaultExportName,\n buildTransferTable,\n DEFAULT_IGNORED_CONTENT_TYPES,\n createStrapiInstance,\n formatDiagnostic,\n loadersFactory,\n exitMessageText,\n abortTransfer,\n getTransferTelemetryPayload,\n setSignalHandler,\n} from '../../utils/data-transfer';\nimport { exitWith } from '../../utils/helpers';\n\nconst {\n providers: { createLocalFileDestinationProvider },\n} = fileDataTransfer;\nconst {\n providers: { createLocalStrapiSourceProvider },\n} = strapiDataTransfer;\n\nconst BYTES_IN_MB = 1024 * 1024;\n\ninterface CmdOptions {\n file?: string;\n encrypt?: boolean;\n key?: string;\n compress?: boolean;\n only?: (keyof engineDataTransfer.TransferGroupFilter)[];\n exclude?: (keyof engineDataTransfer.TransferGroupFilter)[];\n throttle?: number;\n maxSizeJsonl?: number;\n}\n\n/**\n * Export command.\n *\n * It transfers data from a local Strapi instance to a file\n *\n * @param {ExportCommandOptions} opts\n */\nexport default async (opts: CmdOptions) => {\n // Validate inputs from Commander\n if (!isObject(opts)) {\n exitWith(1, 'Could not parse command arguments');\n }\n\n const strapi = await createStrapiInstance();\n\n const source = createSourceProvider(strapi);\n const destination = createDestinationProvider(opts);\n\n const engine = engineDataTransfer.createTransferEngine(source, destination, {\n versionStrategy: 'ignore', // for an export to file, versionStrategy will always be skipped\n schemaStrategy: 'ignore', // for an export to file, schemaStrategy will always be skipped\n exclude: opts.exclude,\n only: opts.only,\n throttle: opts.throttle,\n transforms: {\n links: [\n {\n filter(link) {\n return (\n !DEFAULT_IGNORED_CONTENT_TYPES.includes(link.left.type) &&\n !DEFAULT_IGNORED_CONTENT_TYPES.includes(link.right.type)\n );\n },\n },\n ],\n entities: [\n {\n filter(entity) {\n return !DEFAULT_IGNORED_CONTENT_TYPES.includes(entity.type);\n },\n },\n ],\n },\n });\n\n engine.diagnostics.onDiagnostic(formatDiagnostic('export'));\n\n const progress = engine.progress.stream;\n\n const { updateLoader } = loadersFactory();\n\n progress.on(`stage::start`, ({ stage, data }) => {\n updateLoader(stage, data).start();\n });\n\n progress.on('stage::finish', ({ stage, data }) => {\n updateLoader(stage, data).succeed();\n });\n\n progress.on('stage::progress', ({ stage, data }) => {\n updateLoader(stage, data);\n });\n\n progress.on('transfer::start', async () => {\n console.log(`Starting export...`);\n\n await strapi.telemetry.send('didDEITSProcessStart', getTransferTelemetryPayload(engine));\n });\n\n let results: engineDataTransfer.ITransferResults<typeof source, typeof destination>;\n let outFile: string;\n try {\n // Abort transfer if user interrupts process\n setSignalHandler(() => abortTransfer({ engine, strapi }));\n\n results = await engine.transfer();\n outFile = results.destination?.file?.path ?? '';\n const outFileExists = await fs.pathExists(outFile);\n if (!outFileExists) {\n throw new engineDataTransfer.errors.TransferEngineTransferError(\n `Export file not created \"${outFile}\"`\n );\n }\n\n // Note: we need to await telemetry or else the process ends before it is sent\n await strapi.telemetry.send('didDEITSProcessFinish', getTransferTelemetryPayload(engine));\n\n try {\n const table = buildTransferTable(results.engine);\n console.log(table?.toString());\n } catch (e) {\n console.error('There was an error displaying the results of the transfer.');\n }\n\n console.log(`Export archive is in ${chalk.green(outFile)}`);\n exitWith(0, exitMessageText('export'));\n } catch {\n await strapi.telemetry.send('didDEITSProcessFail', getTransferTelemetryPayload(engine));\n exitWith(1, exitMessageText('export', true));\n }\n};\n\n/**\n * It creates a local strapi destination provider\n */\nconst createSourceProvider = (strapi: Core.LoadedStrapi) => {\n return createLocalStrapiSourceProvider({\n async getStrapi() {\n return strapi;\n },\n });\n};\n\n/**\n * It creates a local file destination provider based on the given options\n */\nconst createDestinationProvider = (opts: CmdOptions) => {\n const { file, compress, encrypt, key, maxSizeJsonl } = opts;\n\n const filepath = isString(file) && file.length > 0 ? file : getDefaultExportName();\n\n const maxSizeJsonlInMb = isFinite(toNumber(maxSizeJsonl))\n ? toNumber(maxSizeJsonl) * BYTES_IN_MB\n : undefined;\n\n return createLocalFileDestinationProvider({\n file: {\n path: filepath,\n maxSizeJsonl: maxSizeJsonlInMb,\n },\n encryption: {\n enabled: encrypt ?? false,\n key: encrypt ? key : undefined,\n },\n compression: {\n enabled: compress ?? false,\n },\n });\n};\n"],"names":["fileDataTransfer","strapiDataTransfer","strapi","engine","engineDataTransfer","fs","file"],"mappings":"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"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { createCommand, Option } from "commander";
|
|
2
|
+
import { excludeOption, onlyOption, throttleOption, validateExcludeOnly } from "../../utils/data-transfer.mjs";
|
|
3
|
+
import { promptEncryptionKey } from "../../utils/commander.mjs";
|
|
4
|
+
import action from "./action.mjs";
|
|
5
|
+
const command = () => {
|
|
6
|
+
return createCommand("export").description("Export data from Strapi to file").allowExcessArguments(false).addOption(
|
|
7
|
+
new Option("--no-encrypt", `Disables 'aes-128-ecb' encryption of the output file`).default(
|
|
8
|
+
true
|
|
9
|
+
)
|
|
10
|
+
).addOption(
|
|
11
|
+
new Option("--no-compress", "Disables gzip compression of output file").default(true)
|
|
12
|
+
).addOption(
|
|
13
|
+
new Option(
|
|
14
|
+
"-k, --key <string>",
|
|
15
|
+
"Provide encryption key in command instead of using the prompt"
|
|
16
|
+
)
|
|
17
|
+
).addOption(
|
|
18
|
+
new Option("-f, --file <file>", "name to use for exported file (without extensions)")
|
|
19
|
+
).addOption(excludeOption).addOption(onlyOption).addOption(throttleOption).hook("preAction", validateExcludeOnly).hook("preAction", promptEncryptionKey).action(action);
|
|
20
|
+
};
|
|
21
|
+
export {
|
|
22
|
+
command as default
|
|
23
|
+
};
|
|
24
|
+
//# sourceMappingURL=command.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"command.mjs","sources":["../../../../src/cli/commands/export/command.ts"],"sourcesContent":["import { createCommand, Option } from 'commander';\n\nimport {\n excludeOption,\n onlyOption,\n throttleOption,\n validateExcludeOnly,\n} from '../../utils/data-transfer';\nimport { promptEncryptionKey } from '../../utils/commander';\nimport action from './action';\n\n/**\n * `$ strapi export`\n */\nconst command = () => {\n return createCommand('export')\n .description('Export data from Strapi to file')\n .allowExcessArguments(false)\n .addOption(\n new Option('--no-encrypt', `Disables 'aes-128-ecb' encryption of the output file`).default(\n true\n )\n )\n .addOption(\n new Option('--no-compress', 'Disables gzip compression of output file').default(true)\n )\n .addOption(\n new Option(\n '-k, --key <string>',\n 'Provide encryption key in command instead of using the prompt'\n )\n )\n .addOption(\n new Option('-f, --file <file>', 'name to use for exported file (without extensions)')\n )\n .addOption(excludeOption)\n .addOption(onlyOption)\n .addOption(throttleOption)\n .hook('preAction', validateExcludeOnly)\n .hook('preAction', promptEncryptionKey)\n .action(action);\n};\n\nexport default command;\n"],"names":[],"mappings":";;;;AAcA,MAAM,UAAU,MAAM;AACb,SAAA,cAAc,QAAQ,EAC1B,YAAY,iCAAiC,EAC7C,qBAAqB,KAAK,EAC1B;AAAA,IACC,IAAI,OAAO,gBAAgB,sDAAsD,EAAE;AAAA,MACjF;AAAA,IACF;AAAA,EAAA,EAED;AAAA,IACC,IAAI,OAAO,iBAAiB,0CAA0C,EAAE,QAAQ,IAAI;AAAA,EAAA,EAErF;AAAA,IACC,IAAI;AAAA,MACF;AAAA,MACA;AAAA,IACF;AAAA,EAAA,EAED;AAAA,IACC,IAAI,OAAO,qBAAqB,oDAAoD;AAAA,EAAA,EAErF,UAAU,aAAa,EACvB,UAAU,UAAU,EACpB,UAAU,cAAc,EACxB,KAAK,aAAa,mBAAmB,EACrC,KAAK,aAAa,mBAAmB,EACrC,OAAO,MAAM;AAClB;"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { createCommand } from "commander";
|
|
2
|
+
import { assertCwdContainsStrapiProject } from "../utils/helpers.mjs";
|
|
3
|
+
const command = ({ argv }) => {
|
|
4
|
+
return createCommand("generate").description("Launch the interactive API generator").action(() => {
|
|
5
|
+
assertCwdContainsStrapiProject("generate");
|
|
6
|
+
argv.splice(2, 1);
|
|
7
|
+
import("@strapi/generators").then((gen) => gen.runCLI());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
export {
|
|
11
|
+
command
|
|
12
|
+
};
|
|
13
|
+
//# sourceMappingURL=generate.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generate.mjs","sources":["../../../src/cli/commands/generate.ts"],"sourcesContent":["import { createCommand } from 'commander';\nimport { assertCwdContainsStrapiProject } from '../utils/helpers';\nimport type { StrapiCommand } from '../types';\n\n/**\n * `$ strapi generate`\n */\nconst command: StrapiCommand = ({ argv }) => {\n return createCommand('generate')\n .description('Launch the interactive API generator')\n .action(() => {\n assertCwdContainsStrapiProject('generate');\n argv.splice(2, 1);\n\n // NOTE: this needs to be lazy loaded in order for plop to work correctly\n import('@strapi/generators').then((gen) => gen.runCLI());\n });\n};\n\nexport { command };\n"],"names":[],"mappings":";;AAOA,MAAM,UAAyB,CAAC,EAAE,WAAW;AAC3C,SAAO,cAAc,UAAU,EAC5B,YAAY,sCAAsC,EAClD,OAAO,MAAM;AACZ,mCAA+B,UAAU;AACpC,SAAA,OAAO,GAAG,CAAC;AAGhB,WAAO,oBAAoB,EAAE,KAAK,CAAC,QAAQ,IAAI,QAAQ;AAAA,EAAA,CACxD;AACL;"}
|
|
@@ -9,8 +9,8 @@ const _interopDefault = (e) => e && e.__esModule ? e : { default: e };
|
|
|
9
9
|
const CLITable__default = /* @__PURE__ */ _interopDefault(CLITable);
|
|
10
10
|
const chalk__default = /* @__PURE__ */ _interopDefault(chalk);
|
|
11
11
|
const action = async () => {
|
|
12
|
-
const appContext = await core.
|
|
13
|
-
const app = await core.
|
|
12
|
+
const appContext = await core.compileStrapi();
|
|
13
|
+
const app = await core.createStrapi(appContext).register();
|
|
14
14
|
const list = app.get("hooks").keys();
|
|
15
15
|
const infoTable = new CLITable__default.default({
|
|
16
16
|
head: [chalk__default.default.blue("Name")]
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"list.js","sources":["../../../../src/cli/commands/hooks/list.ts"],"sourcesContent":["import { createCommand } from 'commander';\nimport CLITable from 'cli-table3';\nimport chalk from 'chalk';\nimport {
|
|
1
|
+
{"version":3,"file":"list.js","sources":["../../../../src/cli/commands/hooks/list.ts"],"sourcesContent":["import { createCommand } from 'commander';\nimport CLITable from 'cli-table3';\nimport chalk from 'chalk';\nimport { createStrapi, compileStrapi } from '@strapi/core';\n\nimport type { StrapiCommand } from '../../types';\nimport { runAction } from '../../utils/helpers';\n\nconst action = async () => {\n const appContext = await compileStrapi();\n const app = await createStrapi(appContext).register();\n\n const list = app.get('hooks').keys();\n\n const infoTable = new CLITable({\n head: [chalk.blue('Name')],\n });\n\n list.forEach((name: string) => infoTable.push([name]));\n\n console.log(infoTable.toString());\n\n await app.destroy();\n};\n\n/**\n * `$ strapi hooks:list`\n */\nconst command: StrapiCommand = () => {\n return createCommand('hooks:list')\n .description('List all the application hooks')\n .action(runAction('hooks:list', action));\n};\n\nexport { action, command };\n"],"names":["compileStrapi","createStrapi","CLITable","chalk","createCommand","runAction"],"mappings":";;;;;;;;;;AAQA,MAAM,SAAS,YAAY;AACnB,QAAA,aAAa,MAAMA,KAAAA;AACzB,QAAM,MAAM,MAAMC,KAAAA,aAAa,UAAU,EAAE,SAAS;AAEpD,QAAM,OAAO,IAAI,IAAI,OAAO,EAAE,KAAK;AAE7B,QAAA,YAAY,IAAIC,0BAAS;AAAA,IAC7B,MAAM,CAACC,eAAAA,QAAM,KAAK,MAAM,CAAC;AAAA,EAAA,CAC1B;AAEI,OAAA,QAAQ,CAAC,SAAiB,UAAU,KAAK,CAAC,IAAI,CAAC,CAAC;AAE7C,UAAA,IAAI,UAAU,SAAU,CAAA;AAEhC,QAAM,IAAI;AACZ;AAKA,MAAM,UAAyB,MAAM;AAC5B,SAAAC,wBAAc,YAAY,EAC9B,YAAY,gCAAgC,EAC5C,OAAOC,kBAAU,cAAc,MAAM,CAAC;AAC3C;;;"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { createCommand } from "commander";
|
|
2
|
+
import CLITable from "cli-table3";
|
|
3
|
+
import chalk from "chalk";
|
|
4
|
+
import { compileStrapi, createStrapi } from "@strapi/core";
|
|
5
|
+
import { runAction } from "../../utils/helpers.mjs";
|
|
6
|
+
const action = async () => {
|
|
7
|
+
const appContext = await compileStrapi();
|
|
8
|
+
const app = await createStrapi(appContext).register();
|
|
9
|
+
const list = app.get("hooks").keys();
|
|
10
|
+
const infoTable = new CLITable({
|
|
11
|
+
head: [chalk.blue("Name")]
|
|
12
|
+
});
|
|
13
|
+
list.forEach((name) => infoTable.push([name]));
|
|
14
|
+
console.log(infoTable.toString());
|
|
15
|
+
await app.destroy();
|
|
16
|
+
};
|
|
17
|
+
const command = () => {
|
|
18
|
+
return createCommand("hooks:list").description("List all the application hooks").action(runAction("hooks:list", action));
|
|
19
|
+
};
|
|
20
|
+
export {
|
|
21
|
+
action,
|
|
22
|
+
command
|
|
23
|
+
};
|
|
24
|
+
//# sourceMappingURL=list.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"list.mjs","sources":["../../../../src/cli/commands/hooks/list.ts"],"sourcesContent":["import { createCommand } from 'commander';\nimport CLITable from 'cli-table3';\nimport chalk from 'chalk';\nimport { createStrapi, compileStrapi } from '@strapi/core';\n\nimport type { StrapiCommand } from '../../types';\nimport { runAction } from '../../utils/helpers';\n\nconst action = async () => {\n const appContext = await compileStrapi();\n const app = await createStrapi(appContext).register();\n\n const list = app.get('hooks').keys();\n\n const infoTable = new CLITable({\n head: [chalk.blue('Name')],\n });\n\n list.forEach((name: string) => infoTable.push([name]));\n\n console.log(infoTable.toString());\n\n await app.destroy();\n};\n\n/**\n * `$ strapi hooks:list`\n */\nconst command: StrapiCommand = () => {\n return createCommand('hooks:list')\n .description('List all the application hooks')\n .action(runAction('hooks:list', action));\n};\n\nexport { action, command };\n"],"names":[],"mappings":";;;;;AAQA,MAAM,SAAS,YAAY;AACnB,QAAA,aAAa,MAAM;AACzB,QAAM,MAAM,MAAM,aAAa,UAAU,EAAE,SAAS;AAEpD,QAAM,OAAO,IAAI,IAAI,OAAO,EAAE,KAAK;AAE7B,QAAA,YAAY,IAAI,SAAS;AAAA,IAC7B,MAAM,CAAC,MAAM,KAAK,MAAM,CAAC;AAAA,EAAA,CAC1B;AAEI,OAAA,QAAQ,CAAC,SAAiB,UAAU,KAAK,CAAC,IAAI,CAAC,CAAC;AAE7C,UAAA,IAAI,UAAU,SAAU,CAAA;AAEhC,QAAM,IAAI;AACZ;AAKA,MAAM,UAAyB,MAAM;AAC5B,SAAA,cAAc,YAAY,EAC9B,YAAY,gCAAgC,EAC5C,OAAO,UAAU,cAAc,MAAM,CAAC;AAC3C;"}
|