mirror of
https://github.com/strapi/strapi.git
synced 2025-11-13 08:38:09 +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,
|
packageManager,
|
||||||
gitInit,
|
gitInit,
|
||||||
runApp,
|
runApp,
|
||||||
|
isABTestEnabled,
|
||||||
} = scope;
|
} = scope;
|
||||||
|
|
||||||
const shouldRunSeed = useExample && installDependencies;
|
const shouldRunSeed = useExample && installDependencies;
|
||||||
@ -254,6 +255,10 @@ async function createApp(scope: Scope) {
|
|||||||
logger.fatal('Failed to start your Strapi application');
|
logger.fatal('Failed to start your Strapi application');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (isABTestEnabled) {
|
||||||
|
await trackUsage({ event: 'didEnableABTest', scope });
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async function runInstall({ rootPath, packageManager }: Scope) {
|
async function runInstall({ rootPath, packageManager }: Scope) {
|
||||||
|
|||||||
@ -161,6 +161,7 @@ async function run(args: string[]): Promise<void> {
|
|||||||
'styled-components': '^6.0.0',
|
'styled-components': '^6.0.0',
|
||||||
},
|
},
|
||||||
shouldCreateGrowthSsoTrial,
|
shouldCreateGrowthSsoTrial,
|
||||||
|
isABTestEnabled: false,
|
||||||
};
|
};
|
||||||
|
|
||||||
if (options.template !== undefined) {
|
if (options.template !== undefined) {
|
||||||
@ -207,6 +208,8 @@ async function run(args: string[]): Promise<void> {
|
|||||||
scope.gitInit = await prompts.gitInit();
|
scope.gitInit = await prompts.gitInit();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
scope.isABTestEnabled = await prompts.enableABTests();
|
||||||
|
|
||||||
addDatabaseDependencies(scope);
|
addDatabaseDependencies(scope);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|||||||
@ -75,4 +75,19 @@ async function installDependencies(packageManager: string) {
|
|||||||
return installDependencies;
|
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;
|
useExample?: boolean;
|
||||||
gitInit?: boolean;
|
gitInit?: boolean;
|
||||||
shouldCreateGrowthSsoTrial: boolean;
|
shouldCreateGrowthSsoTrial: boolean;
|
||||||
|
isABTestEnabled: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
export type ClientName = 'mysql' | 'postgres' | 'sqlite';
|
export type ClientName = 'mysql' | 'postgres' | 'sqlite';
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user