當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript fs-extra-promise.ensureDirAsync函數代碼示例

本文整理匯總了TypeScript中fs-extra-promise.ensureDirAsync函數的典型用法代碼示例。如果您正苦於以下問題:TypeScript ensureDirAsync函數的具體用法?TypeScript ensureDirAsync怎麽用?TypeScript ensureDirAsync使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了ensureDirAsync函數的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。

示例1: generateTypescript

export async function generateTypescript (columns: IColumn[], dir: string) {
  const DIR = resolve(dir);
  await removeAsync(DIR);
  await ensureDirAsync(DIR);

  const schemas = mapSchemas(columns);

  // tslint:disable-next-line:forin
  for (const schema in schemas) {
    const schemaDir = resolve(DIR, schema);

    let outputInterfaces = '';

    // tslint:disable-next-line:forin
    for (const table in schemas[schema]) {

      const interfaceName = normalizeTableName(table);
      const interfaceContent = schemas[schema][table].map(col => col.type).join('\n');

      outputInterfaces += `
        export interface ${ interfaceName } {
          ${ interfaceContent }
        }
      `;

    }

    await ensureDirAsync(schemaDir);
    await writeTypescriptFile(join(schemaDir, INDEX), outputInterfaces);
  }

  await writeTypescriptFile(join(DIR, INDEX), `
    ${ Object.keys(schemas).map(schema => `
      import * as ${ schema } from './${ schema }';
      export { ${ schema } };
    ` ).join('') }
  `);
}
開發者ID:chasidic,項目名稱:mysql,代碼行數:38,代碼來源:GenerateTypescript.ts

示例2: promptToAddAssets

 promptToAddAssets().then(addAssets => {
     if (!addAssets) {
         return;
     }
     
     const paths = getPaths();
     
     return fs.ensureDirAsync(paths.vscodeFolder).then(() => {
         return Promise.all([
             addTasksJsonIfNecessary(info.DotNet, paths, operations),
             addLaunchJsonIfNecessary(info.DotNet, paths, operations)
         ]);
     });
 });
開發者ID:Jeffiy,項目名稱:omnisharp-vscode,代碼行數:14,代碼來源:assets.ts

示例3: writeTypescriptFile

async function writeTypescriptFile (filename: string, output: string) {
  const result = await processString('', output.trim(), {
    replace: false,
    verify: false,
    tsconfig: false,
    tslint: false,
    editorconfig: false,
    tsfmt: true,
    tsconfigFile: null,
    tslintFile: null,
    tsfmtFile: null,
    vscode: false,
    vscodeFile: null
  });

  await ensureDirAsync(dirname(filename));
  await writeFileAsync(filename, result.dest, { encoding: 'utf-8' });
}
開發者ID:chasidic,項目名稱:mysql,代碼行數:18,代碼來源:GenerateTypescript.ts


注:本文中的fs-extra-promise.ensureDirAsync函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。