fix(nxdev): verify whether srcFolder passed to generateFiles exists (#7219)
This commit is contained in:
parent
2898ccd8e2
commit
83a6ffb47a
@ -66,7 +66,14 @@ export function generateFiles(
|
|||||||
substitutions: { [k: string]: any }
|
substitutions: { [k: string]: any }
|
||||||
): void {
|
): void {
|
||||||
const ejs = require('ejs');
|
const ejs = require('ejs');
|
||||||
allFilesInDir(srcFolder).forEach((filePath) => {
|
|
||||||
|
const files = allFilesInDir(srcFolder);
|
||||||
|
if (files.length === 0) {
|
||||||
|
throw new Error(
|
||||||
|
`generateFiles: No files found in "${srcFolder}". Are you sure you specified the correct path?`
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
files.forEach((filePath) => {
|
||||||
let newContent: Buffer | string;
|
let newContent: Buffer | string;
|
||||||
const computedPath = computePath(
|
const computedPath = computePath(
|
||||||
srcFolder,
|
srcFolder,
|
||||||
@ -89,6 +96,7 @@ export function generateFiles(
|
|||||||
|
|
||||||
tree.write(computedPath, newContent);
|
tree.write(computedPath, newContent);
|
||||||
});
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function computePath(
|
function computePath(
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user