Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
if (nov.novemberDir()) {
userArgs.shift();
return nov.logErr("You're trying to create a new November project inside an existing one! Did you mean to use `november generate " + userArgs.join(' ') + "?");
}
// Check if the folder already exists
try {
stats = fs.lstatSync(projectName);
return nov.logErr("There's already a project with the name " + projectName + " in this directory!");
}
catch (e) {
var spinner = new Spinner('%s Building November project...');
// Copy the contents of the blueprint folder to the user's app folder
ncp.ncpAsync(path.resolve(__dirname, '../template-files/blueprint-project'), projectName)
.then(function() {
return fs.readFileAsync(projectName + '/package.json', 'utf8');
})
// Set the name of the app in package.json
.then(function(packageJsonContents) {
packageJsonContents = nov.fillTemplatePlaceholders(packageJsonContents, projectName);
return fs.writeFileAsync(projectName + '/package.json', packageJsonContents, 'utf8');
})
.then(function() {
return fs.readFileAsync(projectName + '/public/index.html', 'utf8');
})
// Set the name of the app in index.html
.then(function(htmlContents) {
htmlContents = nov.fillTemplatePlaceholders(htmlContents, projectName);
return fs.writeFileAsync(projectName + '/public/index.html', htmlContents, 'utf8');
})