mirror of
https://github.com/strapi/strapi.git
synced 2025-11-03 03:17:11 +00:00
chore: implement a new prompt to enable A/B test and track the event (#24125)
* chore: implement a new prompt to enable A/B test and track the event * chore: update the name of the event * chore: lint
This commit is contained in:
parent
1dfd60174c
commit
6a38f974ec
@ -41,6 +41,7 @@ async function createApp(scope: Scope) {
|
||||
packageManager,
|
||||
gitInit,
|
||||
runApp,
|
||||
isABTestEnabled,
|
||||
} = scope;
|
||||
|
||||
const shouldRunSeed = useExample && installDependencies;
|
||||
@ -254,6 +255,10 @@ async function createApp(scope: Scope) {
|
||||
logger.fatal('Failed to start your Strapi application');
|
||||
}
|
||||
}
|
||||
|
||||
if (isABTestEnabled) {
|
||||
await trackUsage({ event: 'didEnableABTest', scope });
|
||||
}
|
||||
}
|
||||
|
||||
async function runInstall({ rootPath, packageManager }: Scope) {
|
||||
|
||||
@ -161,6 +161,7 @@ async function run(args: string[]): Promise<void> {
|
||||
'styled-components': '^6.0.0',
|
||||
},
|
||||
shouldCreateGrowthSsoTrial,
|
||||
isABTestEnabled: false,
|
||||
};
|
||||
|
||||
if (options.template !== undefined) {
|
||||
@ -207,6 +208,8 @@ async function run(args: string[]): Promise<void> {
|
||||
scope.gitInit = await prompts.gitInit();
|
||||
}
|
||||
|
||||
scope.isABTestEnabled = await prompts.enableABTests();
|
||||
|
||||
addDatabaseDependencies(scope);
|
||||
|
||||
try {
|
||||
|
||||
@ -75,4 +75,19 @@ async function installDependencies(packageManager: string) {
|
||||
return installDependencies;
|
||||
}
|
||||
|
||||
export { directory, typescript, example, gitInit, installDependencies };
|
||||
async function enableABTests() {
|
||||
const { enableABTests } = await inquirer.prompt<{
|
||||
enableABTests: boolean;
|
||||
}>([
|
||||
{
|
||||
type: 'confirm',
|
||||
name: 'enableABTests',
|
||||
message: `Participate in anonymous A/B testing (to improve Strapi)?`,
|
||||
default: false,
|
||||
},
|
||||
]);
|
||||
|
||||
return enableABTests;
|
||||
}
|
||||
|
||||
export { directory, typescript, example, gitInit, installDependencies, enableABTests };
|
||||
|
||||
@ -64,6 +64,7 @@ export interface Scope {
|
||||
useExample?: boolean;
|
||||
gitInit?: boolean;
|
||||
shouldCreateGrowthSsoTrial: boolean;
|
||||
isABTestEnabled: boolean;
|
||||
}
|
||||
|
||||
export type ClientName = 'mysql' | 'postgres' | 'sqlite';
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user