本文整理汇总了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;未经允许,请勿转载。 |
请发表评论