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

meanie

Package Overview
Dependencies
Maintainers
1
Versions
64
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

meanie - npm Package Compare versions

Comparing version 0.2.7 to 0.3.0

4

bin/meanie-cli.js

@@ -39,3 +39,3 @@ #!/usr/bin/env node

cwd: argv.cwd,
configPath: argv.meanfile
configPath: argv.meaniefile
}, run);

@@ -51,3 +51,3 @@

//Change working directory of process if needed
//Change working directory of process if different from current
if (process.cwd() !== env.cwd) {

@@ -54,0 +54,0 @@ process.chdir(env.cwd);

@@ -9,2 +9,3 @@ 'use strict';

var tildify = require('tildify');
var replaceInFile = require('replace-in-file');

@@ -22,5 +23,10 @@ /**

//Set project dir
this.setProjectDir(args[0] || '.');
//Get self
var meanie = this;
//Check if project name given
if (args[0]) {
this.setProjectName(args[0]);
}
//Log

@@ -37,3 +43,10 @@ console.log(

if (files.length > 1 || files[0].indexOf('meaniefile') === -1) {
return cb(new Error('Destination directory is not empty!'));
if (this.force) {
console.warn(chalk.yellow(
'Destination directory is not empty, but force installing anyway.'
));
}
else {
return cb(new Error('Destination directory is not empty!'));
}
}

@@ -55,10 +68,33 @@ }

if (error) {
console.error(
chalk.red('Failed to create project:', error.message)
);
console.error(chalk.red('Failed to create project:', error.message));
return cb(new Error('Failed to create project'));
}
console.log(chalk.green('Meanie project created successfully'));
console.log(chalk.grey('Run `npm install` to install all the dependencies'));
cb(null);
//Update package info
meanie.readProjectPackage();
if (meanie.projectName) {
meanie.projectPackage.name = meanie.projectName.toLowerCase().replace(/\s/g, '-');
}
//Write again
meanie.writeProjectPackage(function(error, data) {
if (error) {
return console.warn(chalk.yellow('Failed to update project package file!'));
}
});
//Try to replace application name in env file
if (meanie.projectName && meanie.projectDir) {
replaceInFile([
meanie.projectDir + '/env/all.js',
meanie.projectDir + '/env/development.js'
], /My\sApplication/g, meanie.projectName, function(error) {
if (error) {
console.warn(chalk.yellow('Could not replace project name in env files'));
}
console.log(chalk.green('Meanie project created successfully'));
console.log(chalk.grey('Run `npm install` to install all the project dependencies now'));
cb(null);
});
}
});

@@ -65,0 +101,0 @@ }

@@ -6,3 +6,5 @@ 'use strict';

*/
var fs = require('fs');
var path = require('path');
var chalk = require('chalk');
var jf = require('jsonfile');

@@ -24,16 +26,93 @@

/**
* Properties
* Internal properties
*/
commands: {},
force: false,
pkg: pkg,
/**
* Project properties
*/
projectPackage: null,
projectDir: '',
commands: {},
projectName: '',
/**
* Project dir setter
* Determine project dir
*/
determineProjectDir: function() {
//Determine from env
if (this.env) {
if (this.env.configBase) {
return this.setProjectDir(this.env.configBase);
}
if (this.env.cwd) {
return this.setProjectDir(this.env.cwd);
}
}
//Use process CWD
var cwd = process.cwd();
this.setProjectDir(cwd);
},
/**
* Set project dir
*/
setProjectDir: function(dir) {
meanie.projectDir = path.resolve(dir);
this.projectDir = path.resolve(dir);
},
/**
* Set project name
*/
setProjectName: function(name) {
this.projectName = name;
},
/**
* Read project package
*/
readProjectPackage: function() {
if (this.projectDir) {
try {
var projectPackage = fs.readFileSync(this.projectDir + '/package.json', 'utf8');
if (projectPackage) {
return this.projectPackage = JSON.parse(projectPackage);
}
}
catch(e) {
return null;
}
}
return null;
},
/**
* Write project package
*/
writeProjectPackage: function(cb) {
cb = cb || function() {};
//Must have project dir and package data
if (!this.projectDir || !this.projectPackage) {
return cb(new Error('No project dir or no project package data'));
}
//Determine package file
var packageFile = this.projectDir + '/package.json';
//Write contents
jf.spaces = 2;
try {
jf.writeFileSync(packageFile, this.projectPackage);
}
catch (e) {
return cb(e);
}
cb(null, [packageFile, this.projectPackage]);
},
/**
* Command resolver

@@ -59,5 +138,15 @@ */

//Set default project dir
this.setProjectDir(env.cwd);
//Determine project dir and read project package
this.determineProjectDir();
this.readProjectPackage();
//Force flag
if (argv.force) {
this.force = true;
console.warn(chalk.yellow(
'Forcing', chalk.magenta('Meanie'), 'with --force flag.',
'I hope you know what you\'re doing.'
));
}
//Determine command

@@ -126,2 +215,3 @@ if (argv.v || argv.version) {

this.write({
name: meanie.projectName || '',
version: meanie.pkg.version,

@@ -128,0 +218,0 @@ modules: {}

{
"name": "meanie",
"description": "Meanie is a boilerplate for developing, testing and building full-stack modular javascript applications using MEAN (MongoDB, Express, AngularJS and Node.js). Meanie is powered by the Gulp task runner.",
"version": "0.2.7",
"homepage": "https://github.com/meanie/",
"version": "0.3.0",
"homepage": "https://github.com/meanie/#readme",
"author": {

@@ -59,2 +59,3 @@ "name": "Adam Buczynski",

"npm-registry-client": "^6.4.0",
"replace-in-file": "0.0.1",
"semver": "^4.3.6",

@@ -61,0 +62,0 @@ "tildify": "^1.1.0",

@@ -22,3 +22,3 @@ # Meanie

```shell
meanie create
meanie create AppName
```

@@ -25,0 +25,0 @@

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