Comparing version 0.1.1 to 0.1.2
"use strict"; | ||
/*! | ||
@@ -13,2 +12,3 @@ * Artisan | ||
var program = require('commander') | ||
, config = require('./config') | ||
, fs = require('fs') | ||
@@ -34,3 +34,3 @@ , mkdirp = require('mkdirp') | ||
// Prompt user for top-level dir name | ||
program.prompt('Please name your node module: ', function ( name ) { | ||
program.prompt('Please name your new node module: ', function ( name ) { | ||
canCreate( name, bootstrap ); | ||
@@ -70,2 +70,16 @@ }); | ||
function writeDirectory( name, fname ) { | ||
mkdirp('./' + name + '/' + fname, function (err) { | ||
if (err) console.error(err) | ||
else console.log('│ ├── ' + fname) | ||
}); | ||
} | ||
function writeFile( name, fname ) { | ||
fs.writeFile('./' + name + '/' + fname, null, function (err) { | ||
if (err) return console.log(err); | ||
console.log('│ ├── ' + fname); | ||
}); | ||
} | ||
/** | ||
@@ -77,2 +91,3 @@ * Bootstrap app files. | ||
// Create top-level dir | ||
mkdirp('./' + name, function (err) { | ||
@@ -83,58 +98,16 @@ if (err) console.error(err) | ||
mkdirp('./' + name + '/examples/', function (err) { | ||
if (err) console.error(err) | ||
else console.log('│ ├── examples') | ||
}); | ||
var items = config.items; | ||
mkdirp('./' + name + '/lib/', function (err) { | ||
if (err) console.error(err) | ||
else console.log('│ ├── lib') | ||
}); | ||
for ( var i = 0; i < items.length; i++ ){ | ||
mkdirp('./' + name + '/test/', function (err) { | ||
if (err) console.error(err) | ||
else console.log('│ ├── test') | ||
}); | ||
var fname = items[i].name; | ||
fs.writeFile('./' + name + '/README.md', null, function (err) { | ||
if (err) return console.log(err); | ||
console.log('└── README.md'); | ||
}); | ||
fs.writeFile('./' + name + '/History.md', null, function (err) { | ||
if (err) return console.log(err); | ||
console.log('└── History.md'); | ||
}); | ||
fs.writeFile('./' + name + '/package.json', null, function (err) { | ||
if (err) return console.log(err); | ||
console.log('└── package.json'); | ||
}); | ||
fs.writeFile('./' + name + '/.gitignore', null, function (err) { | ||
if (err) return console.log(err); | ||
console.log('└── .gitignore'); | ||
}); | ||
fs.writeFile('./' + name + '/.npmignore', null, function (err) { | ||
if (err) return console.log(err); | ||
console.log('└── .npmignore'); | ||
}); | ||
fs.writeFile('./' + name + '/Makefile', null, function (err) { | ||
if (err) return console.log(err); | ||
console.log('└── Makefile'); | ||
}); | ||
fs.writeFile('./' + name + '/.travis.yml', null, function (err) { | ||
if (err) return console.log(err); | ||
console.log('└── .travis.yml'); | ||
}); | ||
fs.writeFile('./' + name + '/LICENSE', null, function (err) { | ||
if (err) return console.log(err); | ||
console.log('└── LICENSE'); | ||
}); | ||
if(items[i].type === 'file') { | ||
writeFile(name, fname); | ||
} | ||
else { | ||
writeDirectory(name, fname); | ||
} | ||
} | ||
cursor.reset(); | ||
} |
@@ -10,3 +10,3 @@ { | ||
], | ||
"version": "0.1.1", | ||
"version": "0.1.2", | ||
"author": "Kevin Coughlin <kevintcoughlin@gmail.com>", | ||
@@ -13,0 +13,0 @@ "license": "MIT", |
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
11
149
5256