当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript underline.bgMagenta方法代码示例

本文整理汇总了TypeScript中chalk.underline.bgMagenta方法的典型用法代码示例。如果您正苦于以下问题:TypeScript underline.bgMagenta方法的具体用法?TypeScript underline.bgMagenta怎么用?TypeScript underline.bgMagenta使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在chalk.underline的用法示例。


在下文中一共展示了underline.bgMagenta方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。

示例1: async

// delete and restore firestore
// delete (TODO) and restore authentication users
// delete and restore storage files
export default async (
  foldername: string,
  {
    firestore,
    storage,
    accounts,
  }: { firestore?: boolean; storage?: boolean; accounts?: boolean }
): Promise<void> => {
  if (
    !(await prompt<{ confirmed: boolean }>([
      {
        type: 'confirm',
        name: 'confirmed',
        message: chalk.underline.bgMagenta(
          'Are you sure you want to restore from a backup? This WILL delete all live data in your firebase project!'
        ),
        initial: false,
      },
    ])).confirmed
  ) {
    return;
  }

  console.log('  - now restoring');

  const restoreAll = !firestore && !storage && !accounts;

  try {
    const projectId = await getProjectId();
    await initializeAndEnsureAuth(projectId);

    if (firestore || restoreAll) {
      console.log('restoring firestore');
      console.log('delete firestore');
      await deleteFirestore();
      console.log('import firestore');
      await importFirestore(
        path.join(resolveApp(foldername), 'firestore.json')
      );
    }

    if (accounts || restoreAll) {
      console.log('restoring authentication users');
      await deleteAuthenticationUsers();
      await importAuthenticationUsers(
        path.join(resolveApp(foldername), 'accounts.json')
      );
    }

    if (storage || restoreAll) {
      console.log('restoring storage');
      await deleteStorage(projectId);

      // upload all files from backup
      await importStorage(
        projectId,
        path.join(resolveApp(foldername), 'storage')
      );
    }
  } catch (error) {
    console.log(error);
  }
};
开发者ID:accosine,项目名称:poltergeist,代码行数:66,代码来源:restore.ts


注:本文中的chalk.underline.bgMagenta方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。