New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

dozerjs

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

dozerjs - npm Package Compare versions

Comparing version 0.1.3 to 0.1.4

lib/create.js

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.
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc