Comparing version 0.0.15 to 0.0.17
@@ -17,2 +17,3 @@ /* | ||
var fs = require('fs-extra'); | ||
var git = require('gift'); | ||
@@ -38,2 +39,11 @@ /** | ||
/** | ||
* The possible project templates to use | ||
* | ||
* @type {Object} | ||
*/ | ||
projectUrls: { | ||
demo: "https://github.com/congajs/conga-demo-project" | ||
}, | ||
/** | ||
* Run the command | ||
@@ -66,25 +76,32 @@ * | ||
console.log('Step 1/4: creating project directory'); | ||
console.log('Step 1/5: cloning project directory'); | ||
// copy the empty project to the target path | ||
fs.copySync(path.join(resourcesDir, 'projects', 'empty'), projectDir); | ||
this.cloneDemoProject('demo', projectDir, function() { | ||
// copy parameters.ini.dist to parameters.ini | ||
fs.linkSync( | ||
path.join(projectDir, 'app', 'config', 'parameters.ini.dist'), | ||
path.join(projectDir, 'app', 'config', 'parameters.ini') | ||
); | ||
console.log('Step 2/5: setting up parameters.ini'); | ||
console.log('Step 2/4: creating package.json'); | ||
// copy parameters.ini.dist to parameters.ini | ||
fs.linkSync( | ||
path.join(projectDir, 'app', 'config', 'parameters.ini.dist'), | ||
path.join(projectDir, 'app', 'config', 'parameters.ini') | ||
); | ||
// fix the package.json file | ||
this.fixPackageJsonFile(projectDir, projectName); | ||
console.log('Step 3/4: installing npm dependencies'); | ||
console.log('Step 3/5: setting up demo data'); | ||
// install the project dependencies | ||
this.runNpmInstall(projectDir, function(){ | ||
self.copyDemoData(projectDir); | ||
console.log('Step 4/4: setting up demo bundles'); | ||
console.log('Step 4/5: creating package.json'); | ||
// fix the package.json file | ||
self.fixPackageJsonFile(projectDir, projectName); | ||
console.log('Step 5/5: installing npm dependencies'); | ||
// install the project dependencies | ||
self.runNpmInstall(projectDir, function(){ | ||
console.log('project created at: ' + projectDir) + '!!!'; | ||
}); | ||
}); | ||
@@ -94,2 +111,28 @@ }, | ||
/** | ||
* Clone the demo project to the given path via GIT | ||
* | ||
* @param {String} type | ||
* @param {String} projectDir | ||
* @param {String} projectName | ||
* @param {Function} cb | ||
* @return {void} | ||
*/ | ||
cloneDemoProject: function(type, projectDir, cb) { | ||
var self = this; | ||
git.clone(this.projectUrls[type], projectDir, null, function(err, repository) { | ||
if (err) { | ||
self.exitWithError(err); | ||
} | ||
// remove .git directory | ||
fs.removeSync(path.join(projectDir, '.git')); | ||
cb(); | ||
}); | ||
}, | ||
/** | ||
* Fix some stuff in the package.json file | ||
@@ -101,3 +144,4 @@ * | ||
*/ | ||
fixPackageJsonFile: function(projectDir, projectName){ | ||
fixPackageJsonFile: function(projectDir, projectName) { | ||
var jsonPath = path.join(projectDir, 'package.json'); | ||
@@ -115,2 +159,17 @@ var package = require(jsonPath); | ||
/** | ||
* Copy demo data from the demo-bundle to the var directory | ||
* | ||
* @param {String} projectDir | ||
* @return {void} | ||
*/ | ||
copyDemoData: function(projectDir) { | ||
var dataPath = path.join(projectDir, 'src', 'demo-bundle', 'lib', 'resources', 'demo-data', 'nedb'); | ||
if (fs.existsSync(dataPath)) { | ||
fs.copySync(dataPath, path.join(projectDir, 'var', 'data')); | ||
} | ||
}, | ||
/** | ||
* Run npm install in the project | ||
@@ -122,3 +181,3 @@ * | ||
*/ | ||
runNpmInstall: function(projectDir, cb){ | ||
runNpmInstall: function(projectDir, cb) { | ||
@@ -149,3 +208,3 @@ var self = this; | ||
*/ | ||
exitWithError: function(error){ | ||
exitWithError: function(error) { | ||
console.error("Error: " + error); | ||
@@ -152,0 +211,0 @@ process.exit(); |
@@ -163,4 +163,9 @@ /* | ||
var configPath = path.join(this.path, 'app', 'config', 'bundles.yml'); | ||
var bundles = yaml.parse(fs.readFileSync(configPath, 'utf-8')).bundles; | ||
var config = yaml.parse(fs.readFileSync(configPath, 'utf-8')); | ||
//console.log(configPath); | ||
//console.log(config); | ||
var bundles = config.bundles.all;; | ||
// add the core framework bundle | ||
@@ -313,2 +318,2 @@ bundles.push('conga-framework'); | ||
} | ||
}; | ||
}; |
{ | ||
"name": "conga", | ||
"version": "0.0.15", | ||
"version": "0.0.17", | ||
"description": "MVC framework for node.js", | ||
@@ -28,2 +28,3 @@ "directories": { | ||
"fs-extra": "0.30.0", | ||
"gift": "0.9.0", | ||
"inflect": "0.3.0", | ||
@@ -30,0 +31,0 @@ "supervisor": "0.5.2", |
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
44642
912
7
+ Addedgift@0.9.0
+ Addedgift@0.9.0(transitive)
+ Addedunderscore@1.13.7(transitive)