@strapi/strapi 5.12.1 → 5.12.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/cli.js +89 -45
- package/dist/cli.js.map +1 -1
- package/dist/cli.mjs +90 -42
- package/dist/cli.mjs.map +1 -1
- package/dist/package.json.js +6 -0
- package/dist/package.json.js.map +1 -0
- package/dist/package.json.mjs +4 -0
- package/dist/package.json.mjs.map +1 -0
- package/dist/src/cli/commands/admin/create-user.js +124 -0
- package/dist/src/cli/commands/admin/create-user.js.map +1 -0
- package/dist/src/cli/commands/admin/create-user.mjs +121 -0
- package/dist/src/cli/commands/admin/create-user.mjs.map +1 -0
- package/dist/src/cli/commands/admin/reset-user-password.js +61 -0
- package/dist/src/cli/commands/admin/reset-user-password.js.map +1 -0
- package/dist/src/cli/commands/admin/reset-user-password.mjs +58 -0
- package/dist/src/cli/commands/admin/reset-user-password.mjs.map +1 -0
- package/dist/src/cli/commands/build.js +29 -0
- package/dist/src/cli/commands/build.js.map +1 -0
- package/dist/src/cli/commands/build.mjs +27 -0
- package/dist/src/cli/commands/build.mjs.map +1 -0
- package/dist/src/cli/commands/components/list.js +32 -0
- package/dist/src/cli/commands/components/list.js.map +1 -0
- package/dist/src/cli/commands/components/list.mjs +29 -0
- package/dist/src/cli/commands/components/list.mjs.map +1 -0
- package/dist/src/cli/commands/configuration/dump.js +53 -0
- package/dist/src/cli/commands/configuration/dump.js.map +1 -0
- package/dist/src/cli/commands/configuration/dump.mjs +50 -0
- package/dist/src/cli/commands/configuration/dump.mjs.map +1 -0
- package/dist/src/cli/commands/configuration/restore.js +173 -0
- package/dist/src/cli/commands/configuration/restore.js.map +1 -0
- package/dist/src/cli/commands/configuration/restore.mjs +170 -0
- package/dist/src/cli/commands/configuration/restore.mjs.map +1 -0
- package/dist/src/cli/commands/console.js +31 -0
- package/dist/src/cli/commands/console.js.map +1 -0
- package/dist/src/cli/commands/console.mjs +28 -0
- package/dist/src/cli/commands/console.mjs.map +1 -0
- package/dist/src/cli/commands/content-types/list.js +32 -0
- package/dist/src/cli/commands/content-types/list.js.map +1 -0
- package/dist/src/cli/commands/content-types/list.mjs +29 -0
- package/dist/src/cli/commands/content-types/list.mjs.map +1 -0
- package/dist/src/cli/commands/controllers/list.js +32 -0
- package/dist/src/cli/commands/controllers/list.js.map +1 -0
- package/dist/src/cli/commands/controllers/list.mjs +29 -0
- package/dist/src/cli/commands/controllers/list.mjs.map +1 -0
- package/dist/src/cli/commands/develop.js +32 -0
- package/dist/src/cli/commands/develop.js.map +1 -0
- package/dist/src/cli/commands/develop.mjs +30 -0
- package/dist/src/cli/commands/develop.mjs.map +1 -0
- package/dist/src/cli/commands/export/action.js +126 -0
- package/dist/src/cli/commands/export/action.js.map +1 -0
- package/dist/src/cli/commands/export/action.mjs +124 -0
- package/dist/src/cli/commands/export/action.mjs.map +1 -0
- package/dist/src/cli/commands/export/command.js +15 -0
- package/dist/src/cli/commands/export/command.js.map +1 -0
- package/dist/src/cli/commands/export/command.mjs +13 -0
- package/dist/src/cli/commands/export/command.mjs.map +1 -0
- package/dist/src/cli/commands/generate.js +18 -0
- package/dist/src/cli/commands/generate.js.map +1 -0
- package/dist/src/cli/commands/generate.mjs +16 -0
- package/dist/src/cli/commands/generate.mjs.map +1 -0
- package/dist/src/cli/commands/hooks/list.js +32 -0
- package/dist/src/cli/commands/hooks/list.js.map +1 -0
- package/dist/src/cli/commands/hooks/list.mjs +29 -0
- package/dist/src/cli/commands/hooks/list.mjs.map +1 -0
- package/dist/src/cli/commands/import/action.js +124 -0
- package/dist/src/cli/commands/import/action.js.map +1 -0
- package/dist/src/cli/commands/import/action.mjs +122 -0
- package/dist/src/cli/commands/import/action.mjs.map +1 -0
- package/dist/src/cli/commands/import/command.js +59 -0
- package/dist/src/cli/commands/import/command.js.map +1 -0
- package/dist/src/cli/commands/import/command.mjs +57 -0
- package/dist/src/cli/commands/import/command.mjs.map +1 -0
- package/dist/src/cli/commands/index.js +64 -0
- package/dist/src/cli/commands/index.js.map +1 -0
- package/dist/src/cli/commands/index.mjs +62 -0
- package/dist/src/cli/commands/index.mjs.map +1 -0
- package/dist/src/cli/commands/middlewares/list.js +32 -0
- package/dist/src/cli/commands/middlewares/list.js.map +1 -0
- package/dist/src/cli/commands/middlewares/list.mjs +29 -0
- package/dist/src/cli/commands/middlewares/list.mjs.map +1 -0
- package/dist/src/cli/commands/policies/list.js +32 -0
- package/dist/src/cli/commands/policies/list.js.map +1 -0
- package/dist/src/cli/commands/policies/list.mjs +29 -0
- package/dist/src/cli/commands/policies/list.mjs.map +1 -0
- package/dist/src/cli/commands/report.js +39 -0
- package/dist/src/cli/commands/report.js.map +1 -0
- package/dist/src/cli/commands/report.mjs +37 -0
- package/dist/src/cli/commands/report.mjs.map +1 -0
- package/dist/src/cli/commands/routes/list.js +40 -0
- package/dist/src/cli/commands/routes/list.js.map +1 -0
- package/dist/src/cli/commands/routes/list.mjs +37 -0
- package/dist/src/cli/commands/routes/list.mjs.map +1 -0
- package/dist/src/cli/commands/services/list.js +32 -0
- package/dist/src/cli/commands/services/list.js.map +1 -0
- package/dist/src/cli/commands/services/list.mjs +29 -0
- package/dist/src/cli/commands/services/list.mjs.map +1 -0
- package/dist/src/cli/commands/start.js +28 -0
- package/dist/src/cli/commands/start.js.map +1 -0
- package/dist/src/cli/commands/start.mjs +26 -0
- package/dist/src/cli/commands/start.mjs.map +1 -0
- package/dist/src/cli/commands/telemetry/disable.js +72 -0
- package/dist/src/cli/commands/telemetry/disable.js.map +1 -0
- package/dist/src/cli/commands/telemetry/disable.mjs +69 -0
- package/dist/src/cli/commands/telemetry/disable.mjs.map +1 -0
- package/dist/src/cli/commands/telemetry/enable.js +88 -0
- package/dist/src/cli/commands/telemetry/enable.js.map +1 -0
- package/dist/src/cli/commands/telemetry/enable.mjs +85 -0
- package/dist/src/cli/commands/telemetry/enable.mjs.map +1 -0
- package/dist/src/cli/commands/templates/generate.js +15 -0
- package/dist/src/cli/commands/templates/generate.js.map +1 -0
- package/dist/src/cli/commands/templates/generate.mjs +13 -0
- package/dist/src/cli/commands/templates/generate.mjs.map +1 -0
- package/dist/src/cli/commands/transfer/action.js +141 -0
- package/dist/src/cli/commands/transfer/action.js.map +1 -0
- package/dist/src/cli/commands/transfer/action.mjs +139 -0
- package/dist/src/cli/commands/transfer/action.mjs.map +1 -0
- package/dist/src/cli/commands/transfer/command.js +61 -0
- package/dist/src/cli/commands/transfer/command.js.map +1 -0
- package/dist/src/cli/commands/transfer/command.mjs +59 -0
- package/dist/src/cli/commands/transfer/command.mjs.map +1 -0
- package/dist/src/cli/commands/ts/generate-types.js +40 -0
- package/dist/src/cli/commands/ts/generate-types.js.map +1 -0
- package/dist/src/cli/commands/ts/generate-types.mjs +37 -0
- package/dist/src/cli/commands/ts/generate-types.mjs.map +1 -0
- package/dist/src/cli/commands/version.js +17 -0
- package/dist/src/cli/commands/version.js.map +1 -0
- package/dist/src/cli/commands/version.mjs +15 -0
- package/dist/src/cli/commands/version.mjs.map +1 -0
- package/dist/src/cli/utils/commander.js +125 -0
- package/dist/src/cli/utils/commander.js.map +1 -0
- package/dist/src/cli/utils/commander.mjs +116 -0
- package/dist/src/cli/utils/commander.mjs.map +1 -0
- package/dist/src/cli/utils/data-transfer.js +378 -0
- package/dist/src/cli/utils/data-transfer.js.map +1 -0
- package/dist/src/cli/utils/data-transfer.mjs +359 -0
- package/dist/src/cli/utils/data-transfer.mjs.map +1 -0
- package/dist/src/cli/utils/helpers.js +114 -0
- package/dist/src/cli/utils/helpers.js.map +1 -0
- package/dist/src/cli/utils/helpers.mjs +107 -0
- package/dist/src/cli/utils/helpers.mjs.map +1 -0
- package/dist/src/cli/utils/logger.js +125 -0
- package/dist/src/cli/utils/logger.js.map +1 -0
- package/dist/src/cli/utils/logger.mjs +104 -0
- package/dist/src/cli/utils/logger.mjs.map +1 -0
- package/dist/src/cli/utils/telemetry.js +27 -0
- package/dist/src/cli/utils/telemetry.js.map +1 -0
- package/dist/src/cli/utils/telemetry.mjs +25 -0
- package/dist/src/cli/utils/telemetry.mjs.map +1 -0
- package/dist/src/cli/utils/tsconfig.js +25 -0
- package/dist/src/cli/utils/tsconfig.js.map +1 -0
- package/dist/src/cli/utils/tsconfig.mjs +23 -0
- package/dist/src/cli/utils/tsconfig.mjs.map +1 -0
- package/dist/src/node/build.js +90 -0
- package/dist/src/node/build.js.map +1 -0
- package/dist/src/node/build.mjs +69 -0
- package/dist/src/node/build.mjs.map +1 -0
- package/dist/src/node/core/admin-customisations.js +27 -0
- package/dist/src/node/core/admin-customisations.js.map +1 -0
- package/dist/src/node/core/admin-customisations.mjs +25 -0
- package/dist/src/node/core/admin-customisations.mjs.map +1 -0
- package/dist/{chunks/aliases-BkD9BImE.js → src/node/core/aliases.js} +3 -42
- package/dist/src/node/core/aliases.js.map +1 -0
- package/dist/{chunks/aliases-CZgVGGH9.mjs → src/node/core/aliases.mjs} +4 -41
- package/dist/src/node/core/aliases.mjs.map +1 -0
- package/dist/src/node/core/config.js +18 -0
- package/dist/src/node/core/config.js.map +1 -0
- package/dist/src/node/core/config.mjs +16 -0
- package/dist/src/node/core/config.mjs.map +1 -0
- package/dist/src/node/core/dependencies.js +186 -0
- package/dist/src/node/core/dependencies.js.map +1 -0
- package/dist/src/node/core/dependencies.mjs +183 -0
- package/dist/src/node/core/dependencies.mjs.map +1 -0
- package/dist/src/node/core/env.js +32 -0
- package/dist/src/node/core/env.js.map +1 -0
- package/dist/src/node/core/env.mjs +29 -0
- package/dist/src/node/core/env.mjs.map +1 -0
- package/dist/src/node/core/errors.js +51 -0
- package/dist/src/node/core/errors.js.map +1 -0
- package/dist/src/node/core/errors.mjs +48 -0
- package/dist/src/node/core/errors.mjs.map +1 -0
- package/dist/src/node/core/files.js +68 -0
- package/dist/src/node/core/files.js.map +1 -0
- package/dist/src/node/core/files.mjs +63 -0
- package/dist/src/node/core/files.mjs.map +1 -0
- package/dist/src/node/core/managers.js +27 -0
- package/dist/src/node/core/managers.js.map +1 -0
- package/dist/src/node/core/managers.mjs +25 -0
- package/dist/src/node/core/managers.mjs.map +1 -0
- package/dist/src/node/core/monorepo.js +30 -0
- package/dist/src/node/core/monorepo.js.map +1 -0
- package/dist/src/node/core/monorepo.mjs +28 -0
- package/dist/src/node/core/monorepo.mjs.map +1 -0
- package/dist/src/node/core/plugins.js +140 -0
- package/dist/src/node/core/plugins.js.map +1 -0
- package/dist/src/node/core/plugins.mjs +137 -0
- package/dist/src/node/core/plugins.mjs.map +1 -0
- package/dist/src/node/core/timer.js +33 -0
- package/dist/src/node/core/timer.js.map +1 -0
- package/dist/src/node/core/timer.mjs +30 -0
- package/dist/src/node/core/timer.mjs.map +1 -0
- package/dist/src/node/create-build-context.js +111 -0
- package/dist/src/node/create-build-context.js.map +1 -0
- package/dist/src/node/create-build-context.mjs +109 -0
- package/dist/src/node/create-build-context.mjs.map +1 -0
- package/dist/src/node/develop.js +312 -0
- package/dist/src/node/develop.js.map +1 -0
- package/dist/src/node/develop.mjs +291 -0
- package/dist/src/node/develop.mjs.map +1 -0
- package/dist/src/node/staticFiles.js +81 -0
- package/dist/src/node/staticFiles.js.map +1 -0
- package/dist/src/node/staticFiles.mjs +78 -0
- package/dist/src/node/staticFiles.mjs.map +1 -0
- package/dist/src/node/vite/build.js +14 -0
- package/dist/src/node/vite/build.js.map +1 -0
- package/dist/src/node/vite/build.mjs +12 -0
- package/dist/src/node/vite/build.mjs.map +1 -0
- package/dist/{chunks/config-D3Y5s3ui.js → src/node/vite/config.js} +12 -50
- package/dist/src/node/vite/config.js.map +1 -0
- package/dist/{chunks/config-BFUn1raM.mjs → src/node/vite/config.mjs} +6 -44
- package/dist/src/node/vite/config.mjs.map +1 -0
- package/dist/src/node/vite/plugins.js +46 -0
- package/dist/src/node/vite/plugins.js.map +1 -0
- package/dist/src/node/vite/plugins.mjs +44 -0
- package/dist/src/node/vite/plugins.mjs.map +1 -0
- package/dist/{chunks/watch-gkyBsmAJ.js → src/node/vite/watch.js} +2 -45
- package/dist/src/node/vite/watch.js.map +1 -0
- package/dist/{chunks/watch-DUnlAAiK.mjs → src/node/vite/watch.mjs} +2 -45
- package/dist/src/node/vite/watch.mjs.map +1 -0
- package/dist/src/node/webpack/build.js +37 -0
- package/dist/src/node/webpack/build.js.map +1 -0
- package/dist/src/node/webpack/build.mjs +35 -0
- package/dist/src/node/webpack/build.mjs.map +1 -0
- package/dist/{chunks/config-Bcu3_xSp.js → src/node/webpack/config.js} +10 -8
- package/dist/src/node/webpack/config.js.map +1 -0
- package/dist/{chunks/config-DKpJU9io.mjs → src/node/webpack/config.mjs} +5 -3
- package/dist/src/node/webpack/config.mjs.map +1 -0
- package/dist/{chunks/watch-CNfkm7Fm.js → src/node/webpack/watch.js} +2 -51
- package/dist/src/node/webpack/watch.js.map +1 -0
- package/dist/{chunks/watch-BEC39t49.mjs → src/node/webpack/watch.mjs} +2 -51
- package/dist/src/node/webpack/watch.mjs.map +1 -0
- package/package.json +22 -22
- package/dist/chunks/aliases-BkD9BImE.js.map +0 -1
- package/dist/chunks/aliases-CZgVGGH9.mjs.map +0 -1
- package/dist/chunks/build-B6f5SABm.js +0 -87
- package/dist/chunks/build-B6f5SABm.js.map +0 -1
- package/dist/chunks/build-BQc6C2UF.mjs +0 -85
- package/dist/chunks/build-BQc6C2UF.mjs.map +0 -1
- package/dist/chunks/build-C4qN5x5L.js +0 -59
- package/dist/chunks/build-C4qN5x5L.js.map +0 -1
- package/dist/chunks/build-D6MP0Rwu.mjs +0 -57
- package/dist/chunks/build-D6MP0Rwu.mjs.map +0 -1
- package/dist/chunks/config-BFUn1raM.mjs.map +0 -1
- package/dist/chunks/config-Bcu3_xSp.js.map +0 -1
- package/dist/chunks/config-D3Y5s3ui.js.map +0 -1
- package/dist/chunks/config-DKpJU9io.mjs.map +0 -1
- package/dist/chunks/index-DGhshfMs.mjs +0 -3160
- package/dist/chunks/index-DGhshfMs.mjs.map +0 -1
- package/dist/chunks/index-DW2NjgW9.js +0 -3185
- package/dist/chunks/index-DW2NjgW9.js.map +0 -1
- package/dist/chunks/watch-BEC39t49.mjs.map +0 -1
- package/dist/chunks/watch-CNfkm7Fm.js.map +0 -1
- package/dist/chunks/watch-DUnlAAiK.mjs.map +0 -1
- package/dist/chunks/watch-gkyBsmAJ.js.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"list.js","sources":["../../../../../src/cli/commands/routes/list.ts"],"sourcesContent":["import { createCommand } from 'commander';\nimport CLITable from 'cli-table3';\nimport chalk from 'chalk';\nimport { toUpper } from 'lodash/fp';\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).load();\n\n const list = app.server.mount().listRoutes();\n\n const infoTable = new CLITable({\n head: [chalk.blue('Method'), chalk.blue('Path')],\n colWidths: [20],\n });\n\n list\n .filter((route) => route.methods.length)\n .forEach((route) => {\n infoTable.push([route.methods.map(toUpper).join('|'), route.path]);\n });\n\n console.log(infoTable.toString());\n\n await app.destroy();\n};\n\n/**\n * `$ strapi routes:list``\n */\nconst command: StrapiCommand = () => {\n return createCommand('routes:list')\n .description('List all the application routes')\n .action(runAction('routes:list', action));\n};\n\nexport { action, command };\n"],"names":["action","appContext","compileStrapi","app","createStrapi","load","list","server","mount","listRoutes","infoTable","CLITable","head","chalk","blue","colWidths","filter","route","methods","length","forEach","push","map","toUpper","join","path","console","log","toString","destroy","command","createCommand","description","runAction"],"mappings":";;;;;;;;;AAUA,MAAMA,MAAS,GAAA,UAAA;AACb,IAAA,MAAMC,aAAa,MAAMC,kBAAAA,EAAAA;AACzB,IAAA,MAAMC,GAAM,GAAA,MAAMC,iBAAaH,CAAAA,UAAAA,CAAAA,CAAYI,IAAI,EAAA;AAE/C,IAAA,MAAMC,OAAOH,GAAII,CAAAA,MAAM,CAACC,KAAK,GAAGC,UAAU,EAAA;IAE1C,MAAMC,SAAAA,GAAY,IAAIC,QAAS,CAAA;QAC7BC,IAAM,EAAA;AAACC,YAAAA,KAAAA,CAAMC,IAAI,CAAC,QAAA,CAAA;AAAWD,YAAAA,KAAAA,CAAMC,IAAI,CAAC,MAAA;AAAQ,SAAA;QAChDC,SAAW,EAAA;AAAC,YAAA;AAAG;AACjB,KAAA,CAAA;IAEAT,IACGU,CAAAA,MAAM,CAAC,CAACC,KAAUA,GAAAA,KAAAA,CAAMC,OAAO,CAACC,MAAM,CAAA,CACtCC,OAAO,CAAC,CAACH,KAAAA,GAAAA;AACRP,QAAAA,SAAAA,CAAUW,IAAI,CAAC;AAACJ,YAAAA,KAAAA,CAAMC,OAAO,CAACI,GAAG,CAACC,UAAAA,CAAAA,CAASC,IAAI,CAAC,GAAA,CAAA;AAAMP,YAAAA,KAAAA,CAAMQ;AAAK,SAAA,CAAA;AACnE,KAAA,CAAA;IAEFC,OAAQC,CAAAA,GAAG,CAACjB,SAAAA,CAAUkB,QAAQ,EAAA,CAAA;AAE9B,IAAA,MAAMzB,IAAI0B,OAAO,EAAA;AACnB;AAEA;;AAEC,UACKC,OAAyB,GAAA,IAAA;IAC7B,OAAOC,uBAAAA,CAAc,eAClBC,WAAW,CAAC,mCACZhC,MAAM,CAACiC,kBAAU,aAAejC,EAAAA,MAAAA,CAAAA,CAAAA;AACrC;;;;;"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { createCommand } from 'commander';
|
|
2
|
+
import CLITable from 'cli-table3';
|
|
3
|
+
import chalk from 'chalk';
|
|
4
|
+
import { toUpper } from 'lodash/fp';
|
|
5
|
+
import { compileStrapi, createStrapi } from '@strapi/core';
|
|
6
|
+
import { runAction } from '../../utils/helpers.mjs';
|
|
7
|
+
|
|
8
|
+
const action = async ()=>{
|
|
9
|
+
const appContext = await compileStrapi();
|
|
10
|
+
const app = await createStrapi(appContext).load();
|
|
11
|
+
const list = app.server.mount().listRoutes();
|
|
12
|
+
const infoTable = new CLITable({
|
|
13
|
+
head: [
|
|
14
|
+
chalk.blue('Method'),
|
|
15
|
+
chalk.blue('Path')
|
|
16
|
+
],
|
|
17
|
+
colWidths: [
|
|
18
|
+
20
|
|
19
|
+
]
|
|
20
|
+
});
|
|
21
|
+
list.filter((route)=>route.methods.length).forEach((route)=>{
|
|
22
|
+
infoTable.push([
|
|
23
|
+
route.methods.map(toUpper).join('|'),
|
|
24
|
+
route.path
|
|
25
|
+
]);
|
|
26
|
+
});
|
|
27
|
+
console.log(infoTable.toString());
|
|
28
|
+
await app.destroy();
|
|
29
|
+
};
|
|
30
|
+
/**
|
|
31
|
+
* `$ strapi routes:list``
|
|
32
|
+
*/ const command = ()=>{
|
|
33
|
+
return createCommand('routes:list').description('List all the application routes').action(runAction('routes:list', action));
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
export { action, command };
|
|
37
|
+
//# sourceMappingURL=list.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"list.mjs","sources":["../../../../../src/cli/commands/routes/list.ts"],"sourcesContent":["import { createCommand } from 'commander';\nimport CLITable from 'cli-table3';\nimport chalk from 'chalk';\nimport { toUpper } from 'lodash/fp';\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).load();\n\n const list = app.server.mount().listRoutes();\n\n const infoTable = new CLITable({\n head: [chalk.blue('Method'), chalk.blue('Path')],\n colWidths: [20],\n });\n\n list\n .filter((route) => route.methods.length)\n .forEach((route) => {\n infoTable.push([route.methods.map(toUpper).join('|'), route.path]);\n });\n\n console.log(infoTable.toString());\n\n await app.destroy();\n};\n\n/**\n * `$ strapi routes:list``\n */\nconst command: StrapiCommand = () => {\n return createCommand('routes:list')\n .description('List all the application routes')\n .action(runAction('routes:list', action));\n};\n\nexport { action, command };\n"],"names":["action","appContext","compileStrapi","app","createStrapi","load","list","server","mount","listRoutes","infoTable","CLITable","head","chalk","blue","colWidths","filter","route","methods","length","forEach","push","map","toUpper","join","path","console","log","toString","destroy","command","createCommand","description","runAction"],"mappings":";;;;;;;AAUA,MAAMA,MAAS,GAAA,UAAA;AACb,IAAA,MAAMC,aAAa,MAAMC,aAAAA,EAAAA;AACzB,IAAA,MAAMC,GAAM,GAAA,MAAMC,YAAaH,CAAAA,UAAAA,CAAAA,CAAYI,IAAI,EAAA;AAE/C,IAAA,MAAMC,OAAOH,GAAII,CAAAA,MAAM,CAACC,KAAK,GAAGC,UAAU,EAAA;IAE1C,MAAMC,SAAAA,GAAY,IAAIC,QAAS,CAAA;QAC7BC,IAAM,EAAA;AAACC,YAAAA,KAAAA,CAAMC,IAAI,CAAC,QAAA,CAAA;AAAWD,YAAAA,KAAAA,CAAMC,IAAI,CAAC,MAAA;AAAQ,SAAA;QAChDC,SAAW,EAAA;AAAC,YAAA;AAAG;AACjB,KAAA,CAAA;IAEAT,IACGU,CAAAA,MAAM,CAAC,CAACC,KAAUA,GAAAA,KAAAA,CAAMC,OAAO,CAACC,MAAM,CAAA,CACtCC,OAAO,CAAC,CAACH,KAAAA,GAAAA;AACRP,QAAAA,SAAAA,CAAUW,IAAI,CAAC;AAACJ,YAAAA,KAAAA,CAAMC,OAAO,CAACI,GAAG,CAACC,OAAAA,CAAAA,CAASC,IAAI,CAAC,GAAA,CAAA;AAAMP,YAAAA,KAAAA,CAAMQ;AAAK,SAAA,CAAA;AACnE,KAAA,CAAA;IAEFC,OAAQC,CAAAA,GAAG,CAACjB,SAAAA,CAAUkB,QAAQ,EAAA,CAAA;AAE9B,IAAA,MAAMzB,IAAI0B,OAAO,EAAA;AACnB;AAEA;;AAEC,UACKC,OAAyB,GAAA,IAAA;IAC7B,OAAOC,aAAAA,CAAc,eAClBC,WAAW,CAAC,mCACZhC,MAAM,CAACiC,UAAU,aAAejC,EAAAA,MAAAA,CAAAA,CAAAA;AACrC;;;;"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var commander = require('commander');
|
|
4
|
+
var CLITable = require('cli-table3');
|
|
5
|
+
var chalk = require('chalk');
|
|
6
|
+
var core = require('@strapi/core');
|
|
7
|
+
var helpers = require('../../utils/helpers.js');
|
|
8
|
+
|
|
9
|
+
const action = async ()=>{
|
|
10
|
+
const appContext = await core.compileStrapi();
|
|
11
|
+
const app = await core.createStrapi(appContext).register();
|
|
12
|
+
const list = app.get('services').keys();
|
|
13
|
+
const infoTable = new CLITable({
|
|
14
|
+
head: [
|
|
15
|
+
chalk.blue('Name')
|
|
16
|
+
]
|
|
17
|
+
});
|
|
18
|
+
list.forEach((name)=>infoTable.push([
|
|
19
|
+
name
|
|
20
|
+
]));
|
|
21
|
+
console.log(infoTable.toString());
|
|
22
|
+
await app.destroy();
|
|
23
|
+
};
|
|
24
|
+
/**
|
|
25
|
+
* `$ strapi services:list`
|
|
26
|
+
*/ const command = ()=>{
|
|
27
|
+
return commander.createCommand('services:list').description('List all the application services').action(helpers.runAction('services:list', action));
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
exports.action = action;
|
|
31
|
+
exports.command = command;
|
|
32
|
+
//# sourceMappingURL=list.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"list.js","sources":["../../../../../src/cli/commands/services/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('services').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 services:list`\n */\nconst command: StrapiCommand = () => {\n return createCommand('services:list')\n .description('List all the application services')\n .action(runAction('services:list', action));\n};\n\nexport { action, command };\n"],"names":["action","appContext","compileStrapi","app","createStrapi","register","list","get","keys","infoTable","CLITable","head","chalk","blue","forEach","name","push","console","log","toString","destroy","command","createCommand","description","runAction"],"mappings":";;;;;;;;AAQA,MAAMA,MAAS,GAAA,UAAA;AACb,IAAA,MAAMC,aAAa,MAAMC,kBAAAA,EAAAA;AACzB,IAAA,MAAMC,GAAM,GAAA,MAAMC,iBAAaH,CAAAA,UAAAA,CAAAA,CAAYI,QAAQ,EAAA;AAEnD,IAAA,MAAMC,IAAOH,GAAAA,GAAAA,CAAII,GAAG,CAAC,YAAYC,IAAI,EAAA;IAErC,MAAMC,SAAAA,GAAY,IAAIC,QAAS,CAAA;QAC7BC,IAAM,EAAA;AAACC,YAAAA,KAAAA,CAAMC,IAAI,CAAC,MAAA;AAAQ;AAC5B,KAAA,CAAA;AAEAP,IAAAA,IAAAA,CAAKQ,OAAO,CAAC,CAACC,IAAiBN,GAAAA,SAAAA,CAAUO,IAAI,CAAC;AAACD,YAAAA;AAAK,SAAA,CAAA,CAAA;IAEpDE,OAAQC,CAAAA,GAAG,CAACT,SAAAA,CAAUU,QAAQ,EAAA,CAAA;AAE9B,IAAA,MAAMhB,IAAIiB,OAAO,EAAA;AACnB;AAEA;;AAEC,UACKC,OAAyB,GAAA,IAAA;IAC7B,OAAOC,uBAAAA,CAAc,iBAClBC,WAAW,CAAC,qCACZvB,MAAM,CAACwB,kBAAU,eAAiBxB,EAAAA,MAAAA,CAAAA,CAAAA;AACvC;;;;;"}
|
|
@@ -0,0 +1,29 @@
|
|
|
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
|
+
|
|
7
|
+
const action = async ()=>{
|
|
8
|
+
const appContext = await compileStrapi();
|
|
9
|
+
const app = await createStrapi(appContext).register();
|
|
10
|
+
const list = app.get('services').keys();
|
|
11
|
+
const infoTable = new CLITable({
|
|
12
|
+
head: [
|
|
13
|
+
chalk.blue('Name')
|
|
14
|
+
]
|
|
15
|
+
});
|
|
16
|
+
list.forEach((name)=>infoTable.push([
|
|
17
|
+
name
|
|
18
|
+
]));
|
|
19
|
+
console.log(infoTable.toString());
|
|
20
|
+
await app.destroy();
|
|
21
|
+
};
|
|
22
|
+
/**
|
|
23
|
+
* `$ strapi services:list`
|
|
24
|
+
*/ const command = ()=>{
|
|
25
|
+
return createCommand('services:list').description('List all the application services').action(runAction('services:list', action));
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
export { action, command };
|
|
29
|
+
//# sourceMappingURL=list.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"list.mjs","sources":["../../../../../src/cli/commands/services/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('services').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 services:list`\n */\nconst command: StrapiCommand = () => {\n return createCommand('services:list')\n .description('List all the application services')\n .action(runAction('services:list', action));\n};\n\nexport { action, command };\n"],"names":["action","appContext","compileStrapi","app","createStrapi","register","list","get","keys","infoTable","CLITable","head","chalk","blue","forEach","name","push","console","log","toString","destroy","command","createCommand","description","runAction"],"mappings":";;;;;;AAQA,MAAMA,MAAS,GAAA,UAAA;AACb,IAAA,MAAMC,aAAa,MAAMC,aAAAA,EAAAA;AACzB,IAAA,MAAMC,GAAM,GAAA,MAAMC,YAAaH,CAAAA,UAAAA,CAAAA,CAAYI,QAAQ,EAAA;AAEnD,IAAA,MAAMC,IAAOH,GAAAA,GAAAA,CAAII,GAAG,CAAC,YAAYC,IAAI,EAAA;IAErC,MAAMC,SAAAA,GAAY,IAAIC,QAAS,CAAA;QAC7BC,IAAM,EAAA;AAACC,YAAAA,KAAAA,CAAMC,IAAI,CAAC,MAAA;AAAQ;AAC5B,KAAA,CAAA;AAEAP,IAAAA,IAAAA,CAAKQ,OAAO,CAAC,CAACC,IAAiBN,GAAAA,SAAAA,CAAUO,IAAI,CAAC;AAACD,YAAAA;AAAK,SAAA,CAAA,CAAA;IAEpDE,OAAQC,CAAAA,GAAG,CAACT,SAAAA,CAAUU,QAAQ,EAAA,CAAA;AAE9B,IAAA,MAAMhB,IAAIiB,OAAO,EAAA;AACnB;AAEA;;AAEC,UACKC,OAAyB,GAAA,IAAA;IAC7B,OAAOC,aAAAA,CAAc,iBAClBC,WAAW,CAAC,qCACZvB,MAAM,CAACwB,UAAU,eAAiBxB,EAAAA,MAAAA,CAAAA,CAAAA;AACvC;;;;"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var commander = require('commander');
|
|
4
|
+
var fs = require('fs');
|
|
5
|
+
var tsUtils = require('@strapi/typescript-utils');
|
|
6
|
+
var core = require('@strapi/core');
|
|
7
|
+
var helpers = require('../utils/helpers.js');
|
|
8
|
+
|
|
9
|
+
const action = async ()=>{
|
|
10
|
+
const appDir = process.cwd();
|
|
11
|
+
const isTSProject = await tsUtils.isUsingTypeScript(appDir);
|
|
12
|
+
const outDir = await tsUtils.resolveOutDir(appDir);
|
|
13
|
+
const distDir = isTSProject ? outDir : appDir;
|
|
14
|
+
const buildDirExists = fs.existsSync(outDir);
|
|
15
|
+
if (isTSProject && !buildDirExists) throw new Error(`${outDir} directory not found. Please run the build command before starting your application`);
|
|
16
|
+
core.createStrapi({
|
|
17
|
+
appDir,
|
|
18
|
+
distDir
|
|
19
|
+
}).start();
|
|
20
|
+
};
|
|
21
|
+
/**
|
|
22
|
+
* `$ strapi start`
|
|
23
|
+
*/ const command = ()=>{
|
|
24
|
+
return commander.createCommand('start').description('Start your Strapi application').action(helpers.runAction('start', action));
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
exports.command = command;
|
|
28
|
+
//# sourceMappingURL=start.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"start.js","sources":["../../../../src/cli/commands/start.ts"],"sourcesContent":["import { createCommand } from 'commander';\nimport fs from 'fs';\nimport tsUtils from '@strapi/typescript-utils';\nimport { createStrapi } from '@strapi/core';\n\nimport type { StrapiCommand } from '../types';\nimport { runAction } from '../utils/helpers';\n\nconst action = async () => {\n const appDir = process.cwd();\n\n const isTSProject = await tsUtils.isUsingTypeScript(appDir);\n\n const outDir = await tsUtils.resolveOutDir(appDir);\n const distDir = isTSProject ? outDir : appDir;\n\n const buildDirExists = fs.existsSync(outDir);\n if (isTSProject && !buildDirExists)\n throw new Error(\n `${outDir} directory not found. Please run the build command before starting your application`\n );\n\n createStrapi({ appDir, distDir }).start();\n};\n\n/**\n * `$ strapi start`\n */\nconst command: StrapiCommand = () => {\n return createCommand('start')\n .description('Start your Strapi application')\n .action(runAction('start', action));\n};\n\nexport { command };\n"],"names":["action","appDir","process","cwd","isTSProject","tsUtils","isUsingTypeScript","outDir","resolveOutDir","distDir","buildDirExists","fs","existsSync","Error","createStrapi","start","command","createCommand","description","runAction"],"mappings":";;;;;;;;AAQA,MAAMA,MAAS,GAAA,UAAA;IACb,MAAMC,MAAAA,GAASC,QAAQC,GAAG,EAAA;AAE1B,IAAA,MAAMC,WAAc,GAAA,MAAMC,OAAQC,CAAAA,iBAAiB,CAACL,MAAAA,CAAAA;AAEpD,IAAA,MAAMM,MAAS,GAAA,MAAMF,OAAQG,CAAAA,aAAa,CAACP,MAAAA,CAAAA;IAC3C,MAAMQ,OAAAA,GAAUL,cAAcG,MAASN,GAAAA,MAAAA;IAEvC,MAAMS,cAAAA,GAAiBC,EAAGC,CAAAA,UAAU,CAACL,MAAAA,CAAAA;IACrC,IAAIH,WAAAA,IAAe,CAACM,cAAAA,EAClB,MAAM,IAAIG,MACR,CAAC,EAAEN,MAAO,CAAA,mFAAmF,CAAC,CAAA;IAGlGO,iBAAa,CAAA;AAAEb,QAAAA,MAAAA;AAAQQ,QAAAA;AAAQ,KAAA,CAAA,CAAGM,KAAK,EAAA;AACzC,CAAA;AAEA;;AAEC,UACKC,OAAyB,GAAA,IAAA;IAC7B,OAAOC,uBAAAA,CAAc,SAClBC,WAAW,CAAC,iCACZlB,MAAM,CAACmB,kBAAU,OAASnB,EAAAA,MAAAA,CAAAA,CAAAA;AAC/B;;;;"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { createCommand } from 'commander';
|
|
2
|
+
import fs from 'fs';
|
|
3
|
+
import tsUtils__default from '@strapi/typescript-utils';
|
|
4
|
+
import { createStrapi } from '@strapi/core';
|
|
5
|
+
import { runAction } from '../utils/helpers.mjs';
|
|
6
|
+
|
|
7
|
+
const action = async ()=>{
|
|
8
|
+
const appDir = process.cwd();
|
|
9
|
+
const isTSProject = await tsUtils__default.isUsingTypeScript(appDir);
|
|
10
|
+
const outDir = await tsUtils__default.resolveOutDir(appDir);
|
|
11
|
+
const distDir = isTSProject ? outDir : appDir;
|
|
12
|
+
const buildDirExists = fs.existsSync(outDir);
|
|
13
|
+
if (isTSProject && !buildDirExists) throw new Error(`${outDir} directory not found. Please run the build command before starting your application`);
|
|
14
|
+
createStrapi({
|
|
15
|
+
appDir,
|
|
16
|
+
distDir
|
|
17
|
+
}).start();
|
|
18
|
+
};
|
|
19
|
+
/**
|
|
20
|
+
* `$ strapi start`
|
|
21
|
+
*/ const command = ()=>{
|
|
22
|
+
return createCommand('start').description('Start your Strapi application').action(runAction('start', action));
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
export { command };
|
|
26
|
+
//# sourceMappingURL=start.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"start.mjs","sources":["../../../../src/cli/commands/start.ts"],"sourcesContent":["import { createCommand } from 'commander';\nimport fs from 'fs';\nimport tsUtils from '@strapi/typescript-utils';\nimport { createStrapi } from '@strapi/core';\n\nimport type { StrapiCommand } from '../types';\nimport { runAction } from '../utils/helpers';\n\nconst action = async () => {\n const appDir = process.cwd();\n\n const isTSProject = await tsUtils.isUsingTypeScript(appDir);\n\n const outDir = await tsUtils.resolveOutDir(appDir);\n const distDir = isTSProject ? outDir : appDir;\n\n const buildDirExists = fs.existsSync(outDir);\n if (isTSProject && !buildDirExists)\n throw new Error(\n `${outDir} directory not found. Please run the build command before starting your application`\n );\n\n createStrapi({ appDir, distDir }).start();\n};\n\n/**\n * `$ strapi start`\n */\nconst command: StrapiCommand = () => {\n return createCommand('start')\n .description('Start your Strapi application')\n .action(runAction('start', action));\n};\n\nexport { command };\n"],"names":["action","appDir","process","cwd","isTSProject","tsUtils","isUsingTypeScript","outDir","resolveOutDir","distDir","buildDirExists","fs","existsSync","Error","createStrapi","start","command","createCommand","description","runAction"],"mappings":";;;;;;AAQA,MAAMA,MAAS,GAAA,UAAA;IACb,MAAMC,MAAAA,GAASC,QAAQC,GAAG,EAAA;AAE1B,IAAA,MAAMC,WAAc,GAAA,MAAMC,gBAAQC,CAAAA,iBAAiB,CAACL,MAAAA,CAAAA;AAEpD,IAAA,MAAMM,MAAS,GAAA,MAAMF,gBAAQG,CAAAA,aAAa,CAACP,MAAAA,CAAAA;IAC3C,MAAMQ,OAAAA,GAAUL,cAAcG,MAASN,GAAAA,MAAAA;IAEvC,MAAMS,cAAAA,GAAiBC,EAAGC,CAAAA,UAAU,CAACL,MAAAA,CAAAA;IACrC,IAAIH,WAAAA,IAAe,CAACM,cAAAA,EAClB,MAAM,IAAIG,MACR,CAAC,EAAEN,MAAO,CAAA,mFAAmF,CAAC,CAAA;IAGlGO,YAAa,CAAA;AAAEb,QAAAA,MAAAA;AAAQQ,QAAAA;AAAQ,KAAA,CAAA,CAAGM,KAAK,EAAA;AACzC,CAAA;AAEA;;AAEC,UACKC,OAAyB,GAAA,IAAA;IAC7B,OAAOC,aAAAA,CAAc,SAClBC,WAAW,CAAC,iCACZlB,MAAM,CAACmB,UAAU,OAASnB,EAAAA,MAAAA,CAAAA,CAAAA;AAC/B;;;;"}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var path = require('path');
|
|
4
|
+
var fse = require('fs-extra');
|
|
5
|
+
var chalk = require('chalk');
|
|
6
|
+
var commander = require('commander');
|
|
7
|
+
var helpers = require('../../utils/helpers.js');
|
|
8
|
+
var telemetry = require('../../utils/telemetry.js');
|
|
9
|
+
|
|
10
|
+
const readPackageJSON = async (path)=>{
|
|
11
|
+
try {
|
|
12
|
+
const packageObj = await fse.readJson(path);
|
|
13
|
+
const uuid = packageObj.strapi ? packageObj.strapi.uuid : null;
|
|
14
|
+
return {
|
|
15
|
+
uuid,
|
|
16
|
+
packageObj
|
|
17
|
+
};
|
|
18
|
+
} catch (err) {
|
|
19
|
+
if (err instanceof Error) {
|
|
20
|
+
console.error(`${chalk.red('Error')}: ${err.message}`);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
const writePackageJSON = async (path, file, spacing)=>{
|
|
25
|
+
try {
|
|
26
|
+
await fse.writeJson(path, file, {
|
|
27
|
+
spaces: spacing
|
|
28
|
+
});
|
|
29
|
+
return true;
|
|
30
|
+
} catch (err) {
|
|
31
|
+
if (err instanceof Error) {
|
|
32
|
+
console.error(`${chalk.red('Error')}: ${err.message}`);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
const action = async ()=>{
|
|
37
|
+
const packageJSONPath = path.resolve(process.cwd(), 'package.json');
|
|
38
|
+
const exists = await fse.pathExists(packageJSONPath);
|
|
39
|
+
if (!exists) {
|
|
40
|
+
console.log(`${chalk.yellow('Warning')}: could not find package.json`);
|
|
41
|
+
process.exit(0);
|
|
42
|
+
}
|
|
43
|
+
const { uuid, packageObj } = await readPackageJSON(packageJSONPath) ?? {};
|
|
44
|
+
if (packageObj.strapi && packageObj.strapi.telemetryDisabled || !uuid) {
|
|
45
|
+
console.log(`${chalk.yellow('Warning:')} telemetry is already disabled`);
|
|
46
|
+
process.exit(0);
|
|
47
|
+
}
|
|
48
|
+
const updatedPackageJSON = {
|
|
49
|
+
...packageObj,
|
|
50
|
+
strapi: {
|
|
51
|
+
...packageObj.strapi,
|
|
52
|
+
telemetryDisabled: true
|
|
53
|
+
}
|
|
54
|
+
};
|
|
55
|
+
const write = await writePackageJSON(packageJSONPath, updatedPackageJSON, 2);
|
|
56
|
+
if (!write) {
|
|
57
|
+
console.log(`${chalk.yellow('Warning')}: There has been an error, please set "telemetryDisabled": true in the "strapi" object of your package.json manually.`);
|
|
58
|
+
process.exit(0);
|
|
59
|
+
}
|
|
60
|
+
await telemetry.sendEvent('didOptOutTelemetry', uuid);
|
|
61
|
+
console.log(`${chalk.green('Successfully opted out of Strapi telemetry')}`);
|
|
62
|
+
process.exit(0);
|
|
63
|
+
};
|
|
64
|
+
/**
|
|
65
|
+
* `$ strapi telemetry:disable`
|
|
66
|
+
*/ const command = ()=>{
|
|
67
|
+
return commander.createCommand('telemetry:disable').description('Disable anonymous telemetry and metadata sending to Strapi analytics').action(helpers.runAction('telemetry:disable', action));
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
exports.action = action;
|
|
71
|
+
exports.command = command;
|
|
72
|
+
//# sourceMappingURL=disable.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"disable.js","sources":["../../../../../src/cli/commands/telemetry/disable.ts"],"sourcesContent":["import { resolve } from 'path';\nimport fse from 'fs-extra';\nimport chalk from 'chalk';\nimport { createCommand } from 'commander';\n\nimport type { StrapiCommand } from '../../types';\nimport { runAction } from '../../utils/helpers';\nimport { sendEvent } from '../../utils/telemetry';\n\nconst readPackageJSON = async (path: string) => {\n try {\n const packageObj = await fse.readJson(path);\n const uuid = packageObj.strapi ? packageObj.strapi.uuid : null;\n\n return { uuid, packageObj };\n } catch (err) {\n if (err instanceof Error) {\n console.error(`${chalk.red('Error')}: ${err.message}`);\n }\n }\n};\n\nconst writePackageJSON = async (path: string, file: object, spacing: number) => {\n try {\n await fse.writeJson(path, file, { spaces: spacing });\n return true;\n } catch (err) {\n if (err instanceof Error) {\n console.error(`${chalk.red('Error')}: ${err.message}`);\n }\n }\n};\n\nconst action = async () => {\n const packageJSONPath = resolve(process.cwd(), 'package.json');\n const exists = await fse.pathExists(packageJSONPath);\n\n if (!exists) {\n console.log(`${chalk.yellow('Warning')}: could not find package.json`);\n process.exit(0);\n }\n\n const { uuid, packageObj } = (await readPackageJSON(packageJSONPath)) ?? {};\n\n if ((packageObj.strapi && packageObj.strapi.telemetryDisabled) || !uuid) {\n console.log(`${chalk.yellow('Warning:')} telemetry is already disabled`);\n process.exit(0);\n }\n\n const updatedPackageJSON = {\n ...packageObj,\n strapi: {\n ...packageObj.strapi,\n telemetryDisabled: true,\n },\n };\n\n const write = await writePackageJSON(packageJSONPath, updatedPackageJSON, 2);\n\n if (!write) {\n console.log(\n `${chalk.yellow(\n 'Warning'\n )}: There has been an error, please set \"telemetryDisabled\": true in the \"strapi\" object of your package.json manually.`\n );\n process.exit(0);\n }\n\n await sendEvent('didOptOutTelemetry', uuid);\n console.log(`${chalk.green('Successfully opted out of Strapi telemetry')}`);\n process.exit(0);\n};\n\n/**\n * `$ strapi telemetry:disable`\n */\nconst command: StrapiCommand = () => {\n return createCommand('telemetry:disable')\n .description('Disable anonymous telemetry and metadata sending to Strapi analytics')\n .action(runAction('telemetry:disable', action));\n};\n\nexport { action, command };\n"],"names":["readPackageJSON","path","packageObj","fse","readJson","uuid","strapi","err","Error","console","error","chalk","red","message","writePackageJSON","file","spacing","writeJson","spaces","action","packageJSONPath","resolve","process","cwd","exists","pathExists","log","yellow","exit","telemetryDisabled","updatedPackageJSON","write","sendEvent","green","command","createCommand","description","runAction"],"mappings":";;;;;;;;;AASA,MAAMA,kBAAkB,OAAOC,IAAAA,GAAAA;IAC7B,IAAI;AACF,QAAA,MAAMC,UAAa,GAAA,MAAMC,GAAIC,CAAAA,QAAQ,CAACH,IAAAA,CAAAA;QACtC,MAAMI,IAAAA,GAAOH,WAAWI,MAAM,GAAGJ,WAAWI,MAAM,CAACD,IAAI,GAAG,IAAA;QAE1D,OAAO;AAAEA,YAAAA,IAAAA;AAAMH,YAAAA;AAAW,SAAA;AAC5B,KAAA,CAAE,OAAOK,GAAK,EAAA;AACZ,QAAA,IAAIA,eAAeC,KAAO,EAAA;AACxBC,YAAAA,OAAAA,CAAQC,KAAK,CAAC,CAAC,EAAEC,KAAMC,CAAAA,GAAG,CAAC,OAAA,CAAA,CAAS,EAAE,EAAEL,GAAIM,CAAAA,OAAO,CAAC,CAAC,CAAA;AACvD;AACF;AACF,CAAA;AAEA,MAAMC,gBAAAA,GAAmB,OAAOb,IAAAA,EAAcc,IAAcC,EAAAA,OAAAA,GAAAA;IAC1D,IAAI;AACF,QAAA,MAAMb,GAAIc,CAAAA,SAAS,CAAChB,IAAAA,EAAMc,IAAM,EAAA;YAAEG,MAAQF,EAAAA;AAAQ,SAAA,CAAA;QAClD,OAAO,IAAA;AACT,KAAA,CAAE,OAAOT,GAAK,EAAA;AACZ,QAAA,IAAIA,eAAeC,KAAO,EAAA;AACxBC,YAAAA,OAAAA,CAAQC,KAAK,CAAC,CAAC,EAAEC,KAAMC,CAAAA,GAAG,CAAC,OAAA,CAAA,CAAS,EAAE,EAAEL,GAAIM,CAAAA,OAAO,CAAC,CAAC,CAAA;AACvD;AACF;AACF,CAAA;AAEA,MAAMM,MAAS,GAAA,UAAA;AACb,IAAA,MAAMC,eAAkBC,GAAAA,YAAAA,CAAQC,OAAQC,CAAAA,GAAG,EAAI,EAAA,cAAA,CAAA;AAC/C,IAAA,MAAMC,MA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;AAC1EX,IAAAA,OAAAA,CAAQM,IAAI,CAAC,CAAA,CAAA;AACf;AAEA;;AAEC,UACKM,OAAyB,GAAA,IAAA;IAC7B,OAAOC,uBAAAA,CAAc,qBAClBC,WAAW,CAAC,wEACZjB,MAAM,CAACkB,kBAAU,mBAAqBlB,EAAAA,MAAAA,CAAAA,CAAAA;AAC3C;;;;;"}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { resolve } from 'path';
|
|
2
|
+
import fse from 'fs-extra';
|
|
3
|
+
import chalk from 'chalk';
|
|
4
|
+
import { createCommand } from 'commander';
|
|
5
|
+
import { runAction } from '../../utils/helpers.mjs';
|
|
6
|
+
import { sendEvent } from '../../utils/telemetry.mjs';
|
|
7
|
+
|
|
8
|
+
const readPackageJSON = async (path)=>{
|
|
9
|
+
try {
|
|
10
|
+
const packageObj = await fse.readJson(path);
|
|
11
|
+
const uuid = packageObj.strapi ? packageObj.strapi.uuid : null;
|
|
12
|
+
return {
|
|
13
|
+
uuid,
|
|
14
|
+
packageObj
|
|
15
|
+
};
|
|
16
|
+
} catch (err) {
|
|
17
|
+
if (err instanceof Error) {
|
|
18
|
+
console.error(`${chalk.red('Error')}: ${err.message}`);
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
const writePackageJSON = async (path, file, spacing)=>{
|
|
23
|
+
try {
|
|
24
|
+
await fse.writeJson(path, file, {
|
|
25
|
+
spaces: spacing
|
|
26
|
+
});
|
|
27
|
+
return true;
|
|
28
|
+
} catch (err) {
|
|
29
|
+
if (err instanceof Error) {
|
|
30
|
+
console.error(`${chalk.red('Error')}: ${err.message}`);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
const action = async ()=>{
|
|
35
|
+
const packageJSONPath = resolve(process.cwd(), 'package.json');
|
|
36
|
+
const exists = await fse.pathExists(packageJSONPath);
|
|
37
|
+
if (!exists) {
|
|
38
|
+
console.log(`${chalk.yellow('Warning')}: could not find package.json`);
|
|
39
|
+
process.exit(0);
|
|
40
|
+
}
|
|
41
|
+
const { uuid, packageObj } = await readPackageJSON(packageJSONPath) ?? {};
|
|
42
|
+
if (packageObj.strapi && packageObj.strapi.telemetryDisabled || !uuid) {
|
|
43
|
+
console.log(`${chalk.yellow('Warning:')} telemetry is already disabled`);
|
|
44
|
+
process.exit(0);
|
|
45
|
+
}
|
|
46
|
+
const updatedPackageJSON = {
|
|
47
|
+
...packageObj,
|
|
48
|
+
strapi: {
|
|
49
|
+
...packageObj.strapi,
|
|
50
|
+
telemetryDisabled: true
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
const write = await writePackageJSON(packageJSONPath, updatedPackageJSON, 2);
|
|
54
|
+
if (!write) {
|
|
55
|
+
console.log(`${chalk.yellow('Warning')}: There has been an error, please set "telemetryDisabled": true in the "strapi" object of your package.json manually.`);
|
|
56
|
+
process.exit(0);
|
|
57
|
+
}
|
|
58
|
+
await sendEvent('didOptOutTelemetry', uuid);
|
|
59
|
+
console.log(`${chalk.green('Successfully opted out of Strapi telemetry')}`);
|
|
60
|
+
process.exit(0);
|
|
61
|
+
};
|
|
62
|
+
/**
|
|
63
|
+
* `$ strapi telemetry:disable`
|
|
64
|
+
*/ const command = ()=>{
|
|
65
|
+
return createCommand('telemetry:disable').description('Disable anonymous telemetry and metadata sending to Strapi analytics').action(runAction('telemetry:disable', action));
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
export { action, command };
|
|
69
|
+
//# sourceMappingURL=disable.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"disable.mjs","sources":["../../../../../src/cli/commands/telemetry/disable.ts"],"sourcesContent":["import { resolve } from 'path';\nimport fse from 'fs-extra';\nimport chalk from 'chalk';\nimport { createCommand } from 'commander';\n\nimport type { StrapiCommand } from '../../types';\nimport { runAction } from '../../utils/helpers';\nimport { sendEvent } from '../../utils/telemetry';\n\nconst readPackageJSON = async (path: string) => {\n try {\n const packageObj = await fse.readJson(path);\n const uuid = packageObj.strapi ? packageObj.strapi.uuid : null;\n\n return { uuid, packageObj };\n } catch (err) {\n if (err instanceof Error) {\n console.error(`${chalk.red('Error')}: ${err.message}`);\n }\n }\n};\n\nconst writePackageJSON = async (path: string, file: object, spacing: number) => {\n try {\n await fse.writeJson(path, file, { spaces: spacing });\n return true;\n } catch (err) {\n if (err instanceof Error) {\n console.error(`${chalk.red('Error')}: ${err.message}`);\n }\n }\n};\n\nconst action = async () => {\n const packageJSONPath = resolve(process.cwd(), 'package.json');\n const exists = await fse.pathExists(packageJSONPath);\n\n if (!exists) {\n console.log(`${chalk.yellow('Warning')}: could not find package.json`);\n process.exit(0);\n }\n\n const { uuid, packageObj } = (await readPackageJSON(packageJSONPath)) ?? {};\n\n if ((packageObj.strapi && packageObj.strapi.telemetryDisabled) || !uuid) {\n console.log(`${chalk.yellow('Warning:')} telemetry is already disabled`);\n process.exit(0);\n }\n\n const updatedPackageJSON = {\n ...packageObj,\n strapi: {\n ...packageObj.strapi,\n telemetryDisabled: true,\n },\n };\n\n const write = await writePackageJSON(packageJSONPath, updatedPackageJSON, 2);\n\n if (!write) {\n console.log(\n `${chalk.yellow(\n 'Warning'\n )}: There has been an error, please set \"telemetryDisabled\": true in the \"strapi\" object of your package.json manually.`\n );\n process.exit(0);\n }\n\n await sendEvent('didOptOutTelemetry', uuid);\n console.log(`${chalk.green('Successfully opted out of Strapi telemetry')}`);\n process.exit(0);\n};\n\n/**\n * `$ strapi telemetry:disable`\n */\nconst command: StrapiCommand = () => {\n return createCommand('telemetry:disable')\n .description('Disable anonymous telemetry and metadata sending to Strapi analytics')\n .action(runAction('telemetry:disable', action));\n};\n\nexport { action, command };\n"],"names":["readPackageJSON","path","packageObj","fse","readJson","uuid","strapi","err","Error","console","error","chalk","red","message","writePackageJSON","file","spacing","writeJson","spaces","action","packageJSONPath","resolve","process","cwd","exists","pathExists","log","yellow","exit","telemetryDisabled","updatedPackageJSON","write","sendEvent","green","command","createCommand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AAEA;;AAEC,UACKM,OAAyB,GAAA,IAAA;IAC7B,OAAOC,aAAAA,CAAc,qBAClBC,WAAW,CAAC,wEACZjB,MAAM,CAACkB,UAAU,mBAAqBlB,EAAAA,MAAAA,CAAAA,CAAAA;AAC3C;;;;"}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var path = require('path');
|
|
4
|
+
var crypto = require('crypto');
|
|
5
|
+
var fse = require('fs-extra');
|
|
6
|
+
var chalk = require('chalk');
|
|
7
|
+
var commander = require('commander');
|
|
8
|
+
var helpers = require('../../utils/helpers.js');
|
|
9
|
+
var telemetry = require('../../utils/telemetry.js');
|
|
10
|
+
|
|
11
|
+
const readPackageJSON = async (path)=>{
|
|
12
|
+
try {
|
|
13
|
+
const packageObj = await fse.readJson(path);
|
|
14
|
+
return packageObj;
|
|
15
|
+
} catch (err) {
|
|
16
|
+
if (err instanceof Error) {
|
|
17
|
+
console.error(`${chalk.red('Error')}: ${err.message}`);
|
|
18
|
+
} else {
|
|
19
|
+
throw err;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
};
|
|
23
|
+
const writePackageJSON = async (path, file, spacing)=>{
|
|
24
|
+
try {
|
|
25
|
+
await fse.writeJson(path, file, {
|
|
26
|
+
spaces: spacing
|
|
27
|
+
});
|
|
28
|
+
return true;
|
|
29
|
+
} catch (err) {
|
|
30
|
+
if (err instanceof Error) {
|
|
31
|
+
console.error(`${chalk.red('Error')}: ${err.message}`);
|
|
32
|
+
console.log(`${chalk.yellow('Warning')}: There has been an error, please set "telemetryDisabled": false in the "strapi" object of your package.json manually.`);
|
|
33
|
+
return false;
|
|
34
|
+
}
|
|
35
|
+
throw err;
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
const generateNewPackageJSON = (packageObj)=>{
|
|
39
|
+
if (!packageObj.strapi) {
|
|
40
|
+
return {
|
|
41
|
+
...packageObj,
|
|
42
|
+
strapi: {
|
|
43
|
+
uuid: crypto.randomUUID(),
|
|
44
|
+
telemetryDisabled: false
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
return {
|
|
49
|
+
...packageObj,
|
|
50
|
+
strapi: {
|
|
51
|
+
...packageObj.strapi,
|
|
52
|
+
uuid: packageObj.strapi.uuid ? packageObj.strapi.uuid : crypto.randomUUID(),
|
|
53
|
+
telemetryDisabled: false
|
|
54
|
+
}
|
|
55
|
+
};
|
|
56
|
+
};
|
|
57
|
+
const action = async ()=>{
|
|
58
|
+
const packageJSONPath = path.resolve(process.cwd(), 'package.json');
|
|
59
|
+
const exists = await fse.pathExists(packageJSONPath);
|
|
60
|
+
if (!exists) {
|
|
61
|
+
console.log(`${chalk.yellow('Warning')}: could not find package.json`);
|
|
62
|
+
process.exit(0);
|
|
63
|
+
}
|
|
64
|
+
const packageObj = await readPackageJSON(packageJSONPath);
|
|
65
|
+
if (packageObj.strapi && packageObj.strapi.uuid) {
|
|
66
|
+
if (packageObj.strapi.telemetryDisabled === false) {
|
|
67
|
+
console.log(`${chalk.yellow('Warning:')} telemetry is already enabled`);
|
|
68
|
+
process.exit(0);
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
const updatedPackageJSON = generateNewPackageJSON(packageObj);
|
|
72
|
+
const write = await writePackageJSON(packageJSONPath, updatedPackageJSON, 2);
|
|
73
|
+
if (!write) {
|
|
74
|
+
process.exit(0);
|
|
75
|
+
}
|
|
76
|
+
await telemetry.sendEvent('didOptInTelemetry', updatedPackageJSON.strapi.uuid);
|
|
77
|
+
console.log(`${chalk.green('Successfully opted into and enabled Strapi telemetry')}`);
|
|
78
|
+
process.exit(0);
|
|
79
|
+
};
|
|
80
|
+
/**
|
|
81
|
+
* `$ strapi telemetry:enable`
|
|
82
|
+
*/ const command = ()=>{
|
|
83
|
+
return commander.createCommand('telemetry:enable').description('Enable anonymous telemetry and metadata sending to Strapi analytics').action(helpers.runAction('telemetry:enable', action));
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
exports.action = action;
|
|
87
|
+
exports.command = command;
|
|
88
|
+
//# sourceMappingURL=enable.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"enable.js","sources":["../../../../../src/cli/commands/telemetry/enable.ts"],"sourcesContent":["import { resolve } from 'path';\nimport { randomUUID } from 'crypto';\nimport fse from 'fs-extra';\nimport chalk from 'chalk';\nimport { createCommand } from 'commander';\n\nimport type { StrapiCommand } from '../../types';\nimport { runAction } from '../../utils/helpers';\nimport { sendEvent } from '../../utils/telemetry';\n\ntype PackageJson = {\n strapi?: {\n uuid?: string;\n telemetryDisabled?: boolean;\n };\n};\n\nconst readPackageJSON = async (path: string) => {\n try {\n const packageObj = await fse.readJson(path);\n return packageObj;\n } catch (err) {\n if (err instanceof Error) {\n console.error(`${chalk.red('Error')}: ${err.message}`);\n } else {\n throw err;\n }\n }\n};\n\nconst writePackageJSON = async (path: string, file: object, spacing: number) => {\n try {\n await fse.writeJson(path, file, { spaces: spacing });\n return true;\n } catch (err) {\n if (err instanceof Error) {\n console.error(`${chalk.red('Error')}: ${err.message}`);\n console.log(\n `${chalk.yellow(\n 'Warning'\n )}: There has been an error, please set \"telemetryDisabled\": false in the \"strapi\" object of your package.json manually.`\n );\n\n return false;\n }\n\n throw err;\n }\n};\n\nconst generateNewPackageJSON = (packageObj: PackageJson) => {\n if (!packageObj.strapi) {\n return {\n ...packageObj,\n strapi: {\n uuid: randomUUID(),\n telemetryDisabled: false,\n },\n };\n }\n return {\n ...packageObj,\n strapi: {\n ...packageObj.strapi,\n uuid: packageObj.strapi.uuid ? packageObj.strapi.uuid : randomUUID(),\n telemetryDisabled: false,\n },\n };\n};\n\nconst action = async () => {\n const packageJSONPath = resolve(process.cwd(), 'package.json');\n const exists = await fse.pathExists(packageJSONPath);\n\n if (!exists) {\n console.log(`${chalk.yellow('Warning')}: could not find package.json`);\n process.exit(0);\n }\n\n const packageObj = await readPackageJSON(packageJSONPath);\n\n if (packageObj.strapi && packageObj.strapi.uuid) {\n if (packageObj.strapi.telemetryDisabled === false) {\n console.log(`${chalk.yellow('Warning:')} telemetry is already enabled`);\n process.exit(0);\n }\n }\n\n const updatedPackageJSON = generateNewPackageJSON(packageObj);\n\n const write = await writePackageJSON(packageJSONPath, updatedPackageJSON, 2);\n\n if (!write) {\n process.exit(0);\n }\n\n await sendEvent('didOptInTelemetry', updatedPackageJSON.strapi.uuid);\n console.log(`${chalk.green('Successfully opted into and enabled Strapi telemetry')}`);\n process.exit(0);\n};\n\n/**\n * `$ strapi telemetry:enable`\n */\nconst command: StrapiCommand = () => {\n return createCommand('telemetry:enable')\n .description('Enable anonymous telemetry and metadata sending to Strapi analytics')\n .action(runAction('telemetry:enable', action));\n};\n\nexport { action, command };\n"],"names":["readPackageJSON","path","packageObj","fse","readJson","err","Error","console","error","chalk","red","message","writePackageJSON","file","spacing","writeJson","spaces","log","yellow","generateNewPackageJSON","strapi","uuid","randomUUID","telemetryDisabled","action","packageJSONPath","resolve","process","cwd","exists","pathExists","exit","updatedPackageJSON","write","sendEvent","green","command","createCommand","description","runAction"],"mappings":";;;;;;;;;;AAiBA,MAAMA,kBAAkB,OAAOC,IAAAA,GAAAA;IAC7B,IAAI;AACF,QAAA,MAAMC,UAAa,GAAA,MAAMC,GAAIC,CAAAA,QAAQ,CAACH,IAAAA,CAAAA;QACtC,OAAOC,UAAAA;AACT,KAAA,CAAE,OAAOG,GAAK,EAAA;AACZ,QAAA,IAAIA,eAAeC,KAAO,EAAA;AACxBC,YAAAA,OAAAA,CAAQC,KAAK,CAAC,CAAC,EAAEC,KAAMC,CAAAA,GAAG,CAAC,OAAA,CAAA,CAAS,EAAE,EAAEL,GAAIM,CAAAA,OAAO,CAAC,CAAC,CAAA;SAChD,MAAA;YACL,MAAMN,GAAAA;AACR;AACF;AACF,CAAA;AAEA,MAAMO,gBAAAA,GAAmB,OAAOX,IAAAA,EAAcY,IAAcC,EAAAA,OAAAA,GAAAA;IAC1D,IAAI;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,0 +1,85 @@
|
|
|
1
|
+
import { resolve } from 'path';
|
|
2
|
+
import { randomUUID } from 'crypto';
|
|
3
|
+
import fse from 'fs-extra';
|
|
4
|
+
import chalk from 'chalk';
|
|
5
|
+
import { createCommand } from 'commander';
|
|
6
|
+
import { runAction } from '../../utils/helpers.mjs';
|
|
7
|
+
import { sendEvent } from '../../utils/telemetry.mjs';
|
|
8
|
+
|
|
9
|
+
const readPackageJSON = async (path)=>{
|
|
10
|
+
try {
|
|
11
|
+
const packageObj = await fse.readJson(path);
|
|
12
|
+
return packageObj;
|
|
13
|
+
} catch (err) {
|
|
14
|
+
if (err instanceof Error) {
|
|
15
|
+
console.error(`${chalk.red('Error')}: ${err.message}`);
|
|
16
|
+
} else {
|
|
17
|
+
throw err;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
const writePackageJSON = async (path, file, spacing)=>{
|
|
22
|
+
try {
|
|
23
|
+
await fse.writeJson(path, file, {
|
|
24
|
+
spaces: spacing
|
|
25
|
+
});
|
|
26
|
+
return true;
|
|
27
|
+
} catch (err) {
|
|
28
|
+
if (err instanceof Error) {
|
|
29
|
+
console.error(`${chalk.red('Error')}: ${err.message}`);
|
|
30
|
+
console.log(`${chalk.yellow('Warning')}: There has been an error, please set "telemetryDisabled": false in the "strapi" object of your package.json manually.`);
|
|
31
|
+
return false;
|
|
32
|
+
}
|
|
33
|
+
throw err;
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
const generateNewPackageJSON = (packageObj)=>{
|
|
37
|
+
if (!packageObj.strapi) {
|
|
38
|
+
return {
|
|
39
|
+
...packageObj,
|
|
40
|
+
strapi: {
|
|
41
|
+
uuid: randomUUID(),
|
|
42
|
+
telemetryDisabled: false
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
return {
|
|
47
|
+
...packageObj,
|
|
48
|
+
strapi: {
|
|
49
|
+
...packageObj.strapi,
|
|
50
|
+
uuid: packageObj.strapi.uuid ? packageObj.strapi.uuid : randomUUID(),
|
|
51
|
+
telemetryDisabled: false
|
|
52
|
+
}
|
|
53
|
+
};
|
|
54
|
+
};
|
|
55
|
+
const action = async ()=>{
|
|
56
|
+
const packageJSONPath = resolve(process.cwd(), 'package.json');
|
|
57
|
+
const exists = await fse.pathExists(packageJSONPath);
|
|
58
|
+
if (!exists) {
|
|
59
|
+
console.log(`${chalk.yellow('Warning')}: could not find package.json`);
|
|
60
|
+
process.exit(0);
|
|
61
|
+
}
|
|
62
|
+
const packageObj = await readPackageJSON(packageJSONPath);
|
|
63
|
+
if (packageObj.strapi && packageObj.strapi.uuid) {
|
|
64
|
+
if (packageObj.strapi.telemetryDisabled === false) {
|
|
65
|
+
console.log(`${chalk.yellow('Warning:')} telemetry is already enabled`);
|
|
66
|
+
process.exit(0);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
const updatedPackageJSON = generateNewPackageJSON(packageObj);
|
|
70
|
+
const write = await writePackageJSON(packageJSONPath, updatedPackageJSON, 2);
|
|
71
|
+
if (!write) {
|
|
72
|
+
process.exit(0);
|
|
73
|
+
}
|
|
74
|
+
await sendEvent('didOptInTelemetry', updatedPackageJSON.strapi.uuid);
|
|
75
|
+
console.log(`${chalk.green('Successfully opted into and enabled Strapi telemetry')}`);
|
|
76
|
+
process.exit(0);
|
|
77
|
+
};
|
|
78
|
+
/**
|
|
79
|
+
* `$ strapi telemetry:enable`
|
|
80
|
+
*/ const command = ()=>{
|
|
81
|
+
return createCommand('telemetry:enable').description('Enable anonymous telemetry and metadata sending to Strapi analytics').action(runAction('telemetry:enable', action));
|
|
82
|
+
};
|
|
83
|
+
|
|
84
|
+
export { action, command };
|
|
85
|
+
//# sourceMappingURL=enable.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"enable.mjs","sources":["../../../../../src/cli/commands/telemetry/enable.ts"],"sourcesContent":["import { resolve } from 'path';\nimport { randomUUID } from 'crypto';\nimport fse from 'fs-extra';\nimport chalk from 'chalk';\nimport { createCommand } from 'commander';\n\nimport type { StrapiCommand } from '../../types';\nimport { runAction } from '../../utils/helpers';\nimport { sendEvent } from '../../utils/telemetry';\n\ntype PackageJson = {\n strapi?: {\n uuid?: string;\n telemetryDisabled?: boolean;\n };\n};\n\nconst readPackageJSON = async (path: string) => {\n try {\n const packageObj = await fse.readJson(path);\n return packageObj;\n } catch (err) {\n if (err instanceof Error) {\n console.error(`${chalk.red('Error')}: ${err.message}`);\n } else {\n throw err;\n }\n }\n};\n\nconst writePackageJSON = async (path: string, file: object, spacing: number) => {\n try {\n await fse.writeJson(path, file, { spaces: spacing });\n return true;\n } catch (err) {\n if (err instanceof Error) {\n console.error(`${chalk.red('Error')}: ${err.message}`);\n console.log(\n `${chalk.yellow(\n 'Warning'\n )}: There has been an error, please set \"telemetryDisabled\": false in the \"strapi\" object of your package.json manually.`\n );\n\n return false;\n }\n\n throw err;\n }\n};\n\nconst generateNewPackageJSON = (packageObj: PackageJson) => {\n if (!packageObj.strapi) {\n return {\n ...packageObj,\n strapi: {\n uuid: randomUUID(),\n telemetryDisabled: false,\n },\n };\n }\n return {\n ...packageObj,\n strapi: {\n ...packageObj.strapi,\n uuid: packageObj.strapi.uuid ? packageObj.strapi.uuid : randomUUID(),\n telemetryDisabled: false,\n },\n };\n};\n\nconst action = async () => {\n const packageJSONPath = resolve(process.cwd(), 'package.json');\n const exists = await fse.pathExists(packageJSONPath);\n\n if (!exists) {\n console.log(`${chalk.yellow('Warning')}: could not find package.json`);\n process.exit(0);\n }\n\n const packageObj = await readPackageJSON(packageJSONPath);\n\n if (packageObj.strapi && packageObj.strapi.uuid) {\n if (packageObj.strapi.telemetryDisabled === false) {\n console.log(`${chalk.yellow('Warning:')} telemetry is already enabled`);\n process.exit(0);\n }\n }\n\n const updatedPackageJSON = generateNewPackageJSON(packageObj);\n\n const write = await writePackageJSON(packageJSONPath, updatedPackageJSON, 2);\n\n if (!write) {\n process.exit(0);\n }\n\n await sendEvent('didOptInTelemetry', updatedPackageJSON.strapi.uuid);\n console.log(`${chalk.green('Successfully opted into and enabled Strapi telemetry')}`);\n process.exit(0);\n};\n\n/**\n * `$ strapi telemetry:enable`\n */\nconst command: StrapiCommand = () => {\n return createCommand('telemetry:enable')\n .description('Enable anonymous telemetry and metadata sending to Strapi analytics')\n .action(runAction('telemetry:enable', action));\n};\n\nexport { action, command };\n"],"names":["readPackageJSON","path","packageObj","fse","readJson","err","Error","console","error","chalk","red","message","writePackageJSON","file","spacing","writeJson","spaces","log","yellow","generateNewPackageJSON","strapi","uuid","randomUUID","telemetryDisabled","action","packageJSONPath","resolve","process","cwd","exists","pathExists","exit","updatedPackageJSON","write","sendEvent","green","command","createCommand","description","runAction"],"mappings":";;;;;;;;AAiBA,MAAMA,kBAAkB,OAAOC,IAAAA,GAAAA;IAC7B,IAAI;AACF,QAAA,MAAMC,UAAa,GAAA,MAAMC,GAAIC,CAAAA,QAAQ,CAACH,IAAAA,CAAAA;QACtC,OAAOC,UAAAA;AACT,KAAA,CAAE,OAAOG,GAAK,EAAA;AACZ,QAAA,IAAIA,eAAeC,KAAO,EAAA;AACxBC,YAAAA,OAAAA,CAAQC,KAAK,CAAC,CAAC,EAAEC,KAAMC,CAAAA,GAAG,CAAC,OAAA,CAAA,CAAS,EAAE,EAAEL,GAAIM,CAAAA,OAAO,CAAC,CAAC,CAAA;SAChD,MAAA;YACL,MAAMN,GAAAA;AACR;AACF;AACF,CAAA;AAEA,MAAMO,gBAAAA,GAAmB,OAAOX,IAAAA,EAAcY,IAAcC,EAAAA,OAAAA,GAAAA;IAC1D,IAAI;AACF,QAAA,MAAMX,GAAIY,CAAAA,SAAS,CAACd,IAAAA,EAAMY,IAAM,EAAA;YAAEG,MAAQF,EAAAA;AAAQ,SAAA,CAAA;QAClD,OAAO,IAAA;AACT,KAAA,CAAE,OAAOT,GAAK,EAAA;AACZ,QAAA,IAAIA,eAAeC,KAAO,EAAA;AACxBC,YAAAA,OAAAA,CAAQC,K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CAAAA;AAEzC,IAAA,IAAIvB,WAAWkB,MAAM,IAAIlB,WAAWkB,MAAM,CAACC,IAAI,EAAE;AAC/C,QAAA,IAAInB,UAAWkB,CAAAA,MAAM,CAACG,iBAAiB,KAAK,KAAO,EAAA;YACjDhB,OAAQU,CAAAA,GAAG,CAAC,CAAC,EAAER,MAAMS,MAAM,CAAC,UAAY,CAAA,CAAA,6BAA6B,CAAC,CAAA;AACtES,YAAAA,OAAAA,CAAQI,IAAI,CAAC,CAAA,CAAA;AACf;AACF;AAEA,IAAA,MAAMC,qBAAqBb,sBAAuBjB,CAAAA,UAAAA,CAAAA;AAElD,IAAA,MAAM+B,KAAQ,GAAA,MAAMrB,gBAAiBa,CAAAA,eAAAA,EAAiBO,kBAAoB,EAAA,CAAA,CAAA;AAE1E,IAAA,IAAI,CAACC,KAAO,EAAA;AACVN,QAAAA,OAAAA,CAAQI,IAAI,CAAC,CAAA,CAAA;AACf;AAEA,IAAA,MAAMG,SAAU,CAAA,mBAAA,EAAqBF,kBAAmBZ,CAAAA,MAAM,CAACC,IAAI,CAAA;IACnEd,OAAQU,CAAAA,GAAG,CAAC,CAAC,EAAER,MAAM0B,KAAK,CAAC,wDAAwD,CAAC,CAAA;AACpFR,IAAAA,OAAAA,CAAQI,IAAI,CAAC,CAAA,CAAA;AACf;AAEA;;AAEC,UACKK,OAAyB,GAAA,IAAA;IAC7B,OAAOC,aAAAA,CAAc,oBAClBC,WAAW,CAAC,uEACZd,MAAM,CAACe,UAAU,kBAAoBf,EAAAA,MAAAA,CAAAA,CAAAA;AAC1C;;;;"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var commander = require('commander');
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
*`$ strapi templates:generate <directory>`
|
|
7
|
+
*/ const command = ()=>{
|
|
8
|
+
return commander.createCommand('templates:generate <directory>').description('(deprecated) Generate template from Strapi project').action(()=>{
|
|
9
|
+
console.warn('This command is deprecated and will be removed in the next major release.');
|
|
10
|
+
console.warn('You can now copy an existing app and use it as a template.');
|
|
11
|
+
});
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
exports.command = command;
|
|
15
|
+
//# sourceMappingURL=generate.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generate.js","sources":["../../../../../src/cli/commands/templates/generate.ts"],"sourcesContent":["import { createCommand } from 'commander';\n\nimport type { StrapiCommand } from '../../types';\n\n/**\n *`$ strapi templates:generate <directory>`\n */\nconst command: StrapiCommand = () => {\n return createCommand('templates:generate <directory>')\n .description('(deprecated) Generate template from Strapi project')\n .action(() => {\n console.warn('This command is deprecated and will be removed in the next major release.');\n console.warn('You can now copy an existing app and use it as a template.');\n });\n};\n\nexport { command };\n"],"names":["command","createCommand","description","action","console","warn"],"mappings":";;;;AAIA;;AAEC,UACKA,OAAyB,GAAA,IAAA;AAC7B,IAAA,OAAOC,wBAAc,gCAClBC,CAAAA,CAAAA,WAAW,CAAC,oDAAA,CAAA,CACZC,MAAM,CAAC,IAAA;AACNC,QAAAA,OAAAA,CAAQC,IAAI,CAAC,2EAAA,CAAA;AACbD,QAAAA,OAAAA,CAAQC,IAAI,CAAC,4DAAA,CAAA;AACf,KAAA,CAAA;AACJ;;;;"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { createCommand } from 'commander';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
*`$ strapi templates:generate <directory>`
|
|
5
|
+
*/ const command = ()=>{
|
|
6
|
+
return createCommand('templates:generate <directory>').description('(deprecated) Generate template from Strapi project').action(()=>{
|
|
7
|
+
console.warn('This command is deprecated and will be removed in the next major release.');
|
|
8
|
+
console.warn('You can now copy an existing app and use it as a template.');
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
export { command };
|
|
13
|
+
//# sourceMappingURL=generate.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generate.mjs","sources":["../../../../../src/cli/commands/templates/generate.ts"],"sourcesContent":["import { createCommand } from 'commander';\n\nimport type { StrapiCommand } from '../../types';\n\n/**\n *`$ strapi templates:generate <directory>`\n */\nconst command: StrapiCommand = () => {\n return createCommand('templates:generate <directory>')\n .description('(deprecated) Generate template from Strapi project')\n .action(() => {\n console.warn('This command is deprecated and will be removed in the next major release.');\n console.warn('You can now copy an existing app and use it as a template.');\n });\n};\n\nexport { command };\n"],"names":["command","createCommand","description","action","console","warn"],"mappings":";;AAIA;;AAEC,UACKA,OAAyB,GAAA,IAAA;AAC7B,IAAA,OAAOC,cAAc,gCAClBC,CAAAA,CAAAA,WAAW,CAAC,oDAAA,CAAA,CACZC,MAAM,CAAC,IAAA;AACNC,QAAAA,OAAAA,CAAQC,IAAI,CAAC,2EAAA,CAAA;AACbD,QAAAA,OAAAA,CAAQC,IAAI,CAAC,4DAAA,CAAA;AACf,KAAA,CAAA;AACJ;;;;"}
|