Huge News!Announcing our $40M Series B led by Abstract Ventures.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.7.0 to 0.7.1

2

lib/commands/install.js

@@ -51,3 +51,3 @@ 'use strict';

//Get module and check if already installed
var module = modules.shift();
var module = modules.shift().replace('meanie-', '');
if (meanie.project.hasModule(module)) {

@@ -54,0 +54,0 @@ return meanie.commands.update(module, function() {

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

var fs = require('fs');
var jf = require('jsonfile');
var path = require('path');

@@ -77,17 +76,2 @@ var chalk = require('chalk');

//Create meanie.json
try {
jf.spaces = 2;
jf.writeFileSync(meanie.env.cwd + '/meanie.json', {
cliVersion: meanie.pkg.version,
destination: 'client/common/' + moduleName.replace('angular-', ''),
instructions: 'https://github.com/meanie/' + moduleName + '#usage',
postInstall: '',
dependencies: {}
});
}
catch (e) {
console.warn(chalk.yellow('Could not create meanie.json module manifest.'));
}
//Replace module name in files

@@ -94,0 +78,0 @@ replace({

@@ -60,3 +60,3 @@ 'use strict';

//Get module and log
var module = modules.shift();
var module = modules.shift().replace('meanie-', '');
console.log(chalk.magenta('Meanie'), 'is updating module', chalk.magenta(module));

@@ -63,0 +63,0 @@

@@ -47,36 +47,25 @@ 'use strict';

/**
* Read module manifest
* Determine package type
*/
function readManifest(modulePath, packageName, cb) {
//Get path and check if exists
var manifestPath = path.resolve(modulePath + '/meanie.json');
if (!fs.existsSync(manifestPath)) {
return cb(new Error('Could not find module manifest file'));
function determinePackageType(pkg, packagePath) {
if (pkg.packageType) {
return pkg.packageType;
}
//Try to read
var manifest;
try {
manifest = jf.readFileSync(manifestPath);
if (!manifest || typeof manifest !== 'object') {
return cb(new Error('Invalid module manifest file'));
}
var bowerPath = packagePath + '/bower.json';
if (fs.existsSync(bowerPath)) {
return 'front-end';
}
catch (e) {
return cb(new Error('Could not read module manifest file'));
}
return 'full-stack';
}
//Determine source and destination
if (manifest.packageType === 'vendor') {
manifest.source = modulePath;
manifest.destination = path.join(meanie.project.dir, getVendorDir(packageName));
/**
* Determine package dependencies
*/
function determinePackageDependencies(packagePath) {
var bowerPath = packagePath + '/bower.json';
if (fs.existsSync(bowerPath)) {
var bower = jf.readFileSync(bowerPath);
return bower.dependencies || null;
}
else {
manifest.source = path.join(modulePath, 'src');
manifest.destination = path.join(meanie.project.dir, manifest.destination || '');
}
//Return manifest
cb(null, manifest);
return null;
}

@@ -110,9 +99,4 @@

*/
function installDependencies(manifest, cb) {
function installDependencies(packageDependencies, cb) {
//No dependencies?
if (!manifest.dependencies || typeof manifest.dependencies !== 'object') {
return cb(null);
}
//Get number of dependencies

@@ -122,7 +106,12 @@ var toInstall = [];

//Go over the dependencies
for (var dependency in manifest.dependencies) {
if (manifest.dependencies.hasOwnProperty(dependency)) {
for (var dependency in packageDependencies) {
if (packageDependencies.hasOwnProperty(dependency)) {
//For now, only care about installing meanie dependencies
if (dependency.indexOf('meanie-') !== 0) {
continue;
}
//Get required version and check if we have it
var requiredVersion = manifest.dependencies[dependency];
var requiredVersion = packageDependencies[dependency];
var hasModuleVersion = meanie.project.hasModule(dependency) || '0.0.0';

@@ -168,3 +157,3 @@ if (semver.satisfies(hasModuleVersion, requiredVersion)) {

//Check version
//Check version and get package info
npm.commands.view([packageName], true, function(error, data) {

@@ -175,5 +164,8 @@ if (error) {

//Get latest version and check with our version if we're trying to update
//Get latest version and package info
var latestVersion = Object.keys(data).shift();
var packageInfo = data[latestVersion];
//Check with our version if we're trying to update
if (isUpdate) {
var latestVersion = Object.keys(data).shift();
var existingVersion = meanie.project.hasModule(module) || '0.0.0';

@@ -197,7 +189,22 @@ if (semver.gte(existingVersion, latestVersion)) {

data = data[0];
var version = data[0].split('@')[1];
var modulePath = data[1];
var packageVersion = data[0].split('@')[1];
var packagePath = data[1];
var packageType = determinePackageType(packageInfo, packagePath);
var packageDependencies = determinePackageDependencies(packagePath);
//Read meanie.json module manifest
readManifest(modulePath, packageName, function(error, manifest) {
//Determine source and destination
var source, destination;
if (packageType === 'front-end') {
source = packagePath;
destination = path.join(meanie.project.dir, getVendorDir(packageName));
}
else {
source = path.join(packagePath, 'src');
destination = meanie.project.dir;
}
//Copy files
copyFiles(source, destination, function(error) {
//Failed to copy
if (error) {

@@ -207,75 +214,50 @@ return cb(error);

//Validate CLI version
if (manifest.cliVersion) {
if (semver.satisfies(meanie.env.cliVersion, manifest.cliVersion)) {
if (!meanie.force) {
return cb(new Error(
'This module requires Meanie CLI version ' + manifest.cliVersion
));
}
console.warn(chalk.yellow(
'Module requires Meanie CLI version ', manifest.cliVersion + ',',
'but force installing anyway.'
));
}
//Add to meaniefile
try {
meanie.project.addModule(module, packageVersion);
}
catch (e) {
console.warn(chalk.yellow('Could not update meaniefile'));
}
//Copy files
copyFiles(manifest.source, manifest.destination, function(error) {
//Add to assets and bower dependencies if vendor type package
if (packageType === 'front-end') {
var assetFile = getVendorDir(packageName, true);
//Failed to copy
if (error) {
return cb(error);
//Add to meanie file
try {
meanie.project.addToAssets('client.js.vendor', assetFile);
}
catch (e) {
console.warn(chalk.yellow(
'Could not add module to assets file. Add it manually to the',
'`client.js.vendor` array: "' + assetFile + '"'
));
}
//Add to meaniefile
//Add to bower.json
try {
meanie.project.addModule(module, version);
addBowerDep(packageName, packageVersion);
console.log(chalk.grey('Added as a dependency to bower.json'));
}
catch (e) {
console.warn(chalk.yellow('Could not update meaniefile'));
console.warn(chalk.yellow(
'Could not add module to Bower dependencies. Add it manually',
'if needed: "' + packageName + '": "^' + packageVersion + '"'
));
}
//Add to assets and bower dependencies if vendor type package
if (manifest.packageType === 'vendor') {
var assetFile = getVendorDir(packageName, true);
//Add to meanie file
try {
meanie.project.addToAssets('client.js.vendor', assetFile);
}
catch (e) {
console.warn(chalk.yellow(
'Could not add module to assets file. Add it manually to the',
'`client.js.vendor` array: "' + assetFile + '"'
));
}
//Add to bower.json
try {
addBowerDep(packageName, version);
}
catch (e) {
console.warn(chalk.yellow(
'Could not add module to Bower dependencies. Add it manually',
'if needed: "' + packageName + '": "^' + version + '"'
));
}
}
//No dependencies or update operation?
if (!manifest.dependencies || isUpdate) {
return success(module, version, manifest, isUpdate, cb);
if (!isUpdate && packageDependencies) {
return installDependencies(packageDependencies, function(error) {
if (error) {
return cb(error);
}
success(module, packageVersion, packageInfo, isUpdate, cb);
});
}
}
//Install dependencies
installDependencies(manifest, function(error) {
if (error) {
return cb(error);
}
//Success
success(module, version, manifest, isUpdate, cb);
});
});
//Success
success(module, packageVersion, packageInfo, isUpdate, cb);
});

@@ -282,0 +264,0 @@ });

{
"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.7.0",
"version": "0.7.1",
"homepage": "https://github.com/meanie/#readme",

@@ -6,0 +6,0 @@ "author": {

@@ -20,2 +20,4 @@ {

},
"packageType": "front-end",
"instructions": "https://github.com/meanie/xxxxx#usage",
"keywords": [

@@ -29,4 +31,3 @@ "meanie",

"index.js",
"bower.json",
"meanie.json"
"bower.json"
],

@@ -33,0 +34,0 @@ "scripts": {

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