Comparing version 0.1.3 to 0.1.4
109
lib/index.js
@@ -1,13 +0,8 @@ | ||
var repo = 'https://github.com/DozerJS/dozerjs.git'; | ||
var commander = require('commander'); | ||
var fs = require('fs'); | ||
var fsx = require('fs-extra'); | ||
var async = require('async'); | ||
var spawn = require("child_process").spawn; | ||
var git = require('gift'); | ||
var clc = require('cli-color'); | ||
var cwd = process.cwd(); | ||
var args; | ||
var createProject = require('./create.js'); | ||
var generateAssets = require('./generate.js'); | ||
var output = require('./output.js'); | ||
// Primary function which handles arguments and routes to appropriate function | ||
@@ -23,2 +18,5 @@ var convertMod = function () { | ||
break; | ||
case 'generate': | ||
generateAssets(args[1]); | ||
break; | ||
default: | ||
@@ -30,95 +28,2 @@ output('error', 'Sorry, your command does not compute.'); | ||
// Simple output formatter | ||
var output = function(type, message) { | ||
switch (type) { | ||
case 'success': | ||
console.log(clc.white('#> ') + clc.greenBright(message)); | ||
break; | ||
case 'error': | ||
console.log(clc.redBright('#> ') + clc.white(message)); | ||
break; | ||
} | ||
}; | ||
// Well, this one creates a new project...so, yeah. | ||
var createProject = function(name) { | ||
var nameRegEx = /^[a-z0-9]+$/i; | ||
var path = cwd + '/' + name; | ||
var proc; | ||
async.series({ | ||
// Checks that name exists and is alpha-numeric | ||
checkName: function (callback) { | ||
if (!name || !nameRegEx.test(name)) { | ||
callback('You must provide an alpha-numeric project name.'); | ||
} else { | ||
callback(null); | ||
} | ||
}, | ||
// Make sure directory does not exists | ||
checkDir: function (callback) { | ||
if (fs.existsSync(path)) { | ||
callback('Directory already exists: ' + path); | ||
} else { | ||
callback(null); | ||
} | ||
}, | ||
// Clone the repo | ||
cloneRepo: function (callback) { | ||
output('success', 'Cloning from DozerJS repository.'); | ||
git.clone(repo, path, function(err, _repo) { | ||
if (err) { | ||
callback('Error cloning from source'); | ||
} else { | ||
callback(null); | ||
} | ||
}); | ||
}, | ||
// Remove the .git directory | ||
cleanupDir: function (callback) { | ||
output('success', 'Removing unneeded assets'); | ||
fsx.remove(path + '/.git', function (err) { | ||
if (err) { | ||
output('error', 'Could not remove .git, please update manually.'); | ||
} else { | ||
callback(null); | ||
} | ||
}); | ||
}, | ||
// Install dependencies | ||
installDeps: function (callback) { | ||
output('success', 'Installing dependencies via NPM.'); | ||
// Start process | ||
proc = spawn('npm', ['install'], { | ||
cwd: path | ||
}); | ||
// Check status on close | ||
proc.on("close", function (code) { | ||
if (code === 0) { | ||
// Success | ||
callback(null); | ||
} else { | ||
// Failure | ||
callback('NPM Install failed. Please run manually.'); | ||
} | ||
}); | ||
} | ||
}, function (err) { | ||
if (err) { | ||
output('error', err); | ||
} else { | ||
output('success', 'Project created at ' + path); | ||
} | ||
}); | ||
}; | ||
exports.convert = convertMod; |
{ | ||
"name": "dozerjs", | ||
"version": "0.1.3", | ||
"version": "0.1.4", | ||
"description": "NPM for Managing DozerJS", | ||
@@ -22,3 +22,4 @@ "repository": { | ||
"fs-extra": "~0.8.1", | ||
"async": "~0.2.10" | ||
"async": "~0.2.10", | ||
"request": "~2.33.0" | ||
}, | ||
@@ -25,0 +26,0 @@ "engines": { |
@@ -12,6 +12,5 @@ # DozerJS CLI (NPM) | ||
## Usage | ||
## Create Project Instance | ||
Currently this package only provides installation capabilities. To use, navigate | ||
to the directory one-before where you would like to install DozerJS, then: | ||
To create a new instance of DozerJS use: | ||
@@ -22,1 +21,17 @@ `dozerjs create ProjectName` | ||
foundational framework. | ||
## Generate Assets | ||
The command tool also allows you to generate an API, Model, Controller set. You | ||
must currently be in the root of a DozerJS project, then use: | ||
`dozerjs generate EndpointName` | ||
The above will create: | ||
* `/api/EndpointName.js` | ||
* `/models/EndpointName.js` | ||
* `/controllers/EndpointName.js` | ||
All of the above will have a basic structure including controller methods linked | ||
to the API requests. |
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
10310
10
244
36
6
4
2
+ Addedrequest@~2.33.0
+ Addedasn1@0.1.11(transitive)
+ Addedassert-plus@0.1.5(transitive)
+ Addedasync@0.9.2(transitive)
+ Addedaws-sign2@0.5.0(transitive)
+ Addedboom@0.4.2(transitive)
+ Addedcombined-stream@0.0.7(transitive)
+ Addedcryptiles@0.2.2(transitive)
+ Addedctype@0.5.3(transitive)
+ Addeddelayed-stream@0.0.5(transitive)
+ Addedforever-agent@0.5.2(transitive)
+ Addedform-data@0.1.4(transitive)
+ Addedhawk@1.0.0(transitive)
+ Addedhoek@0.9.1(transitive)
+ Addedhttp-signature@0.10.1(transitive)
+ Addedjson-stringify-safe@5.0.1(transitive)
+ Addedmime@1.2.11(transitive)
+ Addednode-uuid@1.4.8(transitive)
+ Addedoauth-sign@0.3.0(transitive)
+ Addedqs@0.6.6(transitive)
+ Addedrequest@2.33.0(transitive)
+ Addedsntp@0.2.4(transitive)
+ Addedtldts@6.1.77(transitive)
+ Addedtldts-core@6.1.77(transitive)
+ Addedtough-cookie@5.1.1(transitive)
+ Addedtunnel-agent@0.3.0(transitive)