Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
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
11 changes: 8 additions & 3 deletions lib/copy.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
/**
* Dependencies
*/
var extra = require('fs-extra'),
var wrench = require('wrench'),
fs = require('fs');

/**
Expand All @@ -28,8 +28,13 @@ module.exports = function (template, name, callback) {
if (!fs.existsSync(source)) return callback('Template not found.');
if (fs.existsSync(destination)) return callback('Path already exists.');

// Copy
extra.copy(source, destination, function (err) {
wrench.copyDirSyncRecursive(source, destination, {
forceDelete: false, // Whether to overwrite existing directory or not
excludeHiddenUnix: false, // Whether to copy hidden Unix files or not (preceding .)
preserveFiles: false, // If we're overwriting something and the file already exists, keep the existing
inflateSymlinks: true, // Whether to follow symlinks or not when copying files
}, function(err)
{
callback(err, destination);
});
};
9 changes: 7 additions & 2 deletions lib/setup.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
* Dependencies
*/
var colors = require('colors'),
extra = require('fs-extra'),
wrench = require('wrench'),
fs = require('fs');

/**
Expand All @@ -21,6 +21,11 @@ module.exports = function (callback) {

fs.exists(target, function (exists) {
if (exists) console.log('Re-initalizing default templates...'.yellow);
extra.copy(source, target, callback);
wrench.copyDirSyncRecursive(source, target, {
forceDelete : true, // Whether to overwrite existing directory or not
excludeHiddenUnix: false, // Whether to copy hidden Unix files or not (preceding .)
preserveFiles : false, // If we're overwriting something and the file already exists, keep the existing
inflateSymlinks : true // Whether to follow symlinks or not when copying files
}, callback);
});
};
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
"async": "~0.2.9",
"colors": "~0.6.2",
"findit": "~0.1.2",
"fs-extra": "~0.6.3",
"wrench": "~1.5.4",
"prompt": "~0.2.11",
"optimist": "~0.6.0",
"replace": "~0.2.7"
Expand Down