create-preact-app
Advanced tools
Comparing version 0.1.0 to 0.2.0
24
index.js
@@ -44,2 +44,3 @@ #!/usr/bin/env node | ||
var argv = require('minimist')(process.argv.slice(2)); | ||
var pathExists = require('path-exists'); | ||
@@ -71,10 +72,11 @@ /** | ||
function createApp(name, verbose, version) { | ||
if (fs.existsSync(name)) { | ||
console.log('The directory `' + name + '` already exists. Aborting.'); | ||
var root = path.resolve(name); | ||
if (!pathExists.sync(name)) { | ||
fs.mkdirSync(root); | ||
} else if (!isGitHubBoilerplate(root)) { | ||
console.log('The directory `' + name + '` contains file(s) that could conflict. Aborting.'); | ||
process.exit(1); | ||
} | ||
var root = path.resolve(name); | ||
var appName = path.basename(root); | ||
console.log( | ||
@@ -85,4 +87,2 @@ 'Creating a new Preact app in ' + root + '.' | ||
fs.mkdirSync(root); | ||
var packageJson = { | ||
@@ -172,1 +172,13 @@ name: appName, | ||
} | ||
// Check if GitHub boilerplate compatible | ||
// https://github.com/facebookincubator/create-react-app/pull/368#issuecomment-237875655 | ||
function isGitHubBoilerplate(root) { | ||
var validFiles = [ | ||
'.DS_Store', 'Thumbs.db', '.git', '.gitignore', 'README.md', 'LICENSE' | ||
]; | ||
return fs.readdirSync(root) | ||
.every(function(file) { | ||
return validFiles.indexOf(file) >= 0; | ||
}); | ||
} |
{ | ||
"name": "create-preact-app", | ||
"version": "0.1.0", | ||
"version": "0.2.0", | ||
"keywords": [ | ||
@@ -24,4 +24,5 @@ "react", | ||
"minimist": "^1.2.0", | ||
"path-exists": "^3.0.0", | ||
"semver": "^5.0.3" | ||
} | ||
} |
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
6003
162
5
+ Addedpath-exists@^3.0.0
+ Addedpath-exists@3.0.0(transitive)