async function askForSubstitutionDataAsync(targetDir, options) {
    var _a, _b;
    const defaultPackageSlug = path_1.default.basename(targetDir);
    const defaultProjectName = defaultPackageSlug
        .replace(/^./, (match) => match.toUpperCase())
        .replace(/\W+(\w)/g, (_, p1) => p1.toUpperCase());
    const promptQueries = [
        {
            type: 'text',
            name: 'slug',
            message: 'What is the package slug?',
            initial: defaultPackageSlug,
            resolvedValue: options.target ? defaultPackageSlug : null,
        },
        {
            type: 'text',
            name: 'name',
            message: 'What is the project name?',
            initial: defaultProjectName,
        },
        {
            type: 'text',
            name: 'description',
            message: 'How would you describe the module?',
        },
        {
            type: 'text',
            name: 'package',
            message: 'What is the Android package name?',
            initial: `expo.modules.${defaultPackageSlug.replace(/\W/g, '').toLowerCase()}`,
        },
        {
            type: 'text',
            name: 'author',
            message: 'Who is the author?',
            initial: (_a = (await npmWhoamiAsync(targetDir))) !== null && _a !== void 0 ? _a : '',
        },
        {
            type: 'text',
            name: 'license',
            message: 'What is the license?',
            initial: 'MIT',
        },
        {
            type: 'text',
            name: 'repo',
            message: 'What is the repository URL?',
        },
    ];
    const answers = {};
    for (const query of promptQueries) {
        const { name, resolvedValue } = query;
        answers[name] = (_b = resolvedValue !== null && resolvedValue !== void 0 ? resolvedValue : options[name]) !== null && _b !== void 0 ? _b : (await (0, prompts_1.default)(query))[name];
    }
    const { slug, name, description, package: projectPackage, author, license, repo } = answers;
    return {
        project: {
            slug,
            name,
            version: '0.1.0',
            description,
            package: projectPackage,
        },
        author,
        license,
        repo,
    };
}
/**
 * Asks the user for some data necessary to render the template.
 * Some values may already be provided by command options, the prompt is skipped in that case.
 */
Asks the user for some data necessary to render the template.
Some values may already be provided by command options, the prompt is skipped in that case.
Asks the user for some data necessary to render the template . Some values may already be provided by command options the prompt is skipped in that case .
async function askForSubstitutionDataAsync(targetDir, options) {
    var _a, _b;
    const defaultPackageSlug = path_1.default.basename(targetDir);
    const defaultProjectName = defaultPackageSlug
        .replace(/^./, (match) => match.toUpperCase())
        .replace(/\W+(\w)/g, (_, p1) => p1.toUpperCase());
    const promptQueries = [
        {
            type: 'text',
            name: 'slug',
            message: 'What is the package slug?',
            initial: defaultPackageSlug,
            resolvedValue: options.target ? defaultPackageSlug : null,
        },
        {
            type: 'text',
            name: 'name',
            message: 'What is the project name?',
            initial: defaultProjectName,
        },
        {
            type: 'text',
            name: 'description',
            message: 'How would you describe the module?',
        },
        {
            type: 'text',
            name: 'package',
            message: 'What is the Android package name?',
            initial: `expo.modules.${defaultPackageSlug.replace(/\W/g, '').toLowerCase()}`,
        },
        {
            type: 'text',
            name: 'author',
            message: 'Who is the author?',
            initial: (_a = (await npmWhoamiAsync(targetDir))) !== null && _a !== void 0 ? _a : '',
        },
        {
            type: 'text',
            name: 'license',
            message: 'What is the license?',
            initial: 'MIT',
        },
        {
            type: 'text',
            name: 'repo',
            message: 'What is the repository URL?',
        },
    ];
    const answers = {};
    for (const query of promptQueries) {
        const { name, resolvedValue } = query;
        answers[name] = (_b = resolvedValue !== null && resolvedValue !== void 0 ? resolvedValue : options[name]) !== null && _b !== void 0 ? _b : (await (0, prompts_1.default)(query))[name];
    }
    const { slug, name, description, package: projectPackage, author, license, repo } = answers;
    return {
        project: {
            slug,
            name,
            version: '0.1.0',
            description,
            package: projectPackage,
        },
        author,
        license,
        repo,
    };
}
async function askForSubstitutionDataAsync ( targetDir , options ) { var _a , _b ; const defaultPackageSlug = path_1 . default . basename ( targetDir ) ; const defaultProjectName = defaultPackageSlug . replace ( / ^. / , ( match ) => match . toUpperCase ( ) ) . replace ( / \W+(\w) / g , ( _ , p1 ) => p1 . toUpperCase ( ) ) ; const promptQueries = [ { type : 'text' , name : 'slug' , message : 'What is the package slug?' , initial : defaultPackageSlug , resolvedValue : options . target ? defaultPackageSlug : null , } , { type : 'text' , name : 'name' , message : 'What is the project name?' , initial : defaultProjectName , } , { type : 'text' , name : 'description' , message : 'How would you describe the module?' , } , { type : 'text' , name : 'package' , message : 'What is the Android package name?' , initial : ` ${ defaultPackageSlug . replace ( / \W / g , '' ) . toLowerCase ( ) } ` , } , { type : 'text' , name : 'author' , message : 'Who is the author?' , initial : ( _a = ( await npmWhoamiAsync ( targetDir ) ) ) !== null && _a !== void 0 ? _a : '' , } , { type : 'text' , name : 'license' , message : 'What is the license?' , initial : 'MIT' , } , { type : 'text' , name : 'repo' , message : 'What is the repository URL?' , } , ] ; const answers = { } ; for ( const query of promptQueries ) { const { name , resolvedValue } = query ; answers [ name ] = ( _b = resolvedValue !== null && resolvedValue !== void 0 ? resolvedValue : options [ name ] ) !== null && _b !== void 0 ? _b : ( await ( 0 , prompts_1 . default ) ( query ) ) [ name ] ; } const { slug , name , description , package : projectPackage , author , license , repo } = answers ; return { project : { slug , name , version : '0.1.0' , description , package : projectPackage , } , author , license , repo , } ; }
Asks the user for some data necessary to render the template.
Asks the user for some data necessary to render the template .