Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Continue fs-extra migration #1

Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,7 @@ function copyTemplateFiles (templateDir, projectDir, isSubDir) {
// if template is a www dir
if (path.basename(templateDir) === 'www') {
copyPath = path.resolve(templateDir);
fs.copySync(copyPath, projectDir);
fs.copySync(copyPath, path.resolve(projectDir, 'www'));
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am wondering why this problem does not show up when I run the spec?

Copy link
Author

@raphinesse raphinesse May 29, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't check, but this case might not be covered or not sufficiently tested. Or I'm just plainly wrong 😉

But as far as I understand it, with copySync you always have the full file path in either argument. Whether you copy file or folder. This leads to less surprising if a bit wordier copying IMO.

} else {
var templateFiles = fs.readdirSync(templateDir);
// Remove directories, and files that are unwanted
Expand Down Expand Up @@ -400,7 +400,7 @@ function linkFromTemplate (templateDir, projectDir) {
// if template/www/config.xml then copy to project/config.xml
copyDst = path.join(projectDir, 'config.xml');
if (!fs.existsSync(copyDst) && fs.existsSync(copySrc)) {
fs.copySync(copySrc, projectDir);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ditto: I am wondering why this problem does not show up when I run the spec?

fs.copySync(copySrc, copyDst);
}
}

Expand Down