Skip to content
This repository was archived by the owner on Feb 3, 2022. It is now read-only.

Commit ada2e0c

Browse files
committed
Make directories, copy files
1 parent 12b0f58 commit ada2e0c

File tree

1 file changed

+12
-8
lines changed

1 file changed

+12
-8
lines changed

src/create-twilio-function/create-files.js

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -45,15 +45,19 @@ function copyRecursively(src, dest) {
4545
return readdir(src).then(children => {
4646
return Promise.all(
4747
children.map(child =>
48-
copyFile(`./${src}/${child}`, `${dest}/${child}`, COPYFILE_EXCL).then(
49-
() => {
50-
return stat(`${src}/${child}`).then(stat => {
51-
if (stat.isDirectory()) {
52-
return copyRecursively(`${src}/${child}`, `${dest}/${child}`);
53-
}
54-
});
48+
stat(`${src}/${child}`).then(stat => {
49+
if (stat.isDirectory()) {
50+
return mkdir(`${dest}/${child}`).then(() =>
51+
copyRecursively(`${src}/${child}`, `${dest}/${child}`)
52+
);
53+
} else {
54+
return copyFile(
55+
`./${src}/${child}`,
56+
`${dest}/${child}`,
57+
COPYFILE_EXCL
58+
);
5559
}
56-
)
60+
})
5761
)
5862
);
5963
});

0 commit comments

Comments
 (0)