Comparing version 2.0.0 to 2.1.0
@@ -14,3 +14,3 @@ #!/usr/bin/env node | ||
function generify (source, dest, data, done) { | ||
function generify (source, dest, data, onFile, done) { | ||
var count = 1 // the walker counts as 1 | ||
@@ -22,3 +22,7 @@ var keys = Object.keys(data) | ||
if (!done) done = function () {} | ||
if (typeof done !== 'function') { | ||
done = onFile | ||
onFile = function () {} | ||
} | ||
if (!data) data = {} | ||
@@ -37,2 +41,3 @@ | ||
copyAndReplace(file, destFile) | ||
onFile(relativePath) | ||
}) | ||
@@ -84,5 +89,16 @@ }) | ||
generify(source, dest, json) | ||
generify(source, dest, json, onData, done) | ||
function onData (file) { | ||
console.log('> writing ' + file) | ||
} | ||
function done (err) { | ||
if (err) { | ||
throw err | ||
} | ||
console.log('> completed ' + dest) | ||
} | ||
} | ||
if (require.main === module) execute() |
{ | ||
"name": "generify", | ||
"version": "2.0.0", | ||
"version": "2.1.0", | ||
"description": "A reusable project generator", | ||
@@ -5,0 +5,0 @@ "main": "generify.js", |
@@ -16,3 +16,4 @@ # generify [![Build Status](https://travis-ci.org/mcollina/generify.svg?branch=master)](https://travis-ci.org/mcollina/generify) | ||
generify(source, dest, data, function(err) { | ||
// without notification | ||
generify(source, dest, data, function (err) { | ||
if (err) { | ||
@@ -24,2 +25,17 @@ console.log(err) | ||
}) | ||
// with notification | ||
generify(source, dest, data, onData, done) | ||
function onData (file) { | ||
console.log('writing file') | ||
} | ||
function done (err) { | ||
if (err) { | ||
console.log(err) | ||
} else { | ||
console.log('ok!') | ||
} | ||
} | ||
``` | ||
@@ -26,0 +42,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
10169
232
64
0