fix(schematics): ensure path to file before writing

This commit is contained in:
Emilio Martinez 2018-11-07 19:12:35 -08:00 committed by Victor Savkin
parent e7e9fac7d9
commit ace390e6f7

View File

@ -1,9 +1,11 @@
import { statSync } from 'fs';
import * as fs from 'fs';
import * as path from 'path';
import { ensureDirSync } from 'fs-extra';
export function writeToFile(path: string, str: string) {
fs.writeFileSync(path, str);
export function writeToFile(filePath: string, str: string) {
ensureDirSync(path.dirname(filePath));
fs.writeFileSync(filePath, str);
}
/**