Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

fis-command-install

Package Overview
Dependencies
Maintainers
2
Versions
56
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

fis-command-install - npm Package Compare versions

Comparing version 0.1.0-beta to 0.1.0-beta2

74

install.js

@@ -13,2 +13,9 @@ /*

var logger = require('./lib/logger');
var factory = require('./lib/remotes/factory.js');
var _ = require('./lib/util.js');
var fs = require('fs');
var path = require('path');
var exists = fs.existsSync;
var write = fs.writeFileSync;
exports.register = function(commander) {

@@ -62,4 +69,2 @@

.then(function() {
var path = require('path');
var exists = require('fs').existsSync;
var filepath = path.join(settings.root, 'fis-conf.js');

@@ -98,4 +103,2 @@

.then(function(ret) {
var _ = require('./lib/util.js');
settings.config = ret;

@@ -118,4 +121,2 @@

var factory = require('./lib/remotes/factory.js');
factory.setSettings(settings);

@@ -125,16 +126,3 @@

// 过滤掉不能识别的依赖。
return components
.map(function(component) {
var type = factory.detect(component);
if (!type) {
logger.warn('`%s` is not a valid repository.', component);
return null;
}
return factory(component);
})
.filter(function(item) {
return item != null;
});
return strToRemote(components);
})

@@ -153,3 +141,2 @@

.then(function(components) {
var _ = require('./lib/util.js');

@@ -240,2 +227,3 @@ // 过滤掉本地的仓库。已经同名的包。

console.log('Installed\n%s', arrs.join('\n'));
return components;
});

@@ -246,5 +234,25 @@ });

// 保存 components.json
.then(function() {
// todo
.then(function(installed) {
// 如果指定了 --save, 则需要把数据写入到 components.josn 文件里面。
if (settings.save && args.length && installed && installed.length) {
var config = settings.config;
var specified = strToRemote(args.concat());
config.dependencies = config.dependencies || [];
var oldList = strToRemote(config.dependencies);
specified.forEach(function(item) {
var idx;
if (!~_.indexOfArray('name', item.name, oldList) && ~(idx = _.indexOfArray('name', item.name, installed))) {
var found = installed[idx];
config.dependencies.push(found.type + ':' + found.address + '@' + found.version);
}
});
var componentJson = path.join(settings.root, 'component.json');
write(componentJson, JSON.stringify(config, null, 2));
}
})

@@ -260,2 +268,20 @@

});
};
};
function strToRemote(components, ignoreInvalid) {
return components
.map(function(component) {
var type = factory.detect(component);
if (!type) {
ignoreInvalid || logger.warn('`%s` is not a valid repository.', component);
return null;
}
return factory(component);
})
.filter(function(item) {
return item != null;
});
}
{
"name": "fis-command-install",
"description": "fis install command.",
"version": "0.1.0-beta",
"version": "0.1.0-beta2",
"author": "FIS Team <fis@baidu.com>",

@@ -6,0 +6,0 @@ "homepage": "http://fis.baidu.com/",

@@ -8,4 +8,6 @@ # fis-command-install

Options:
-h, --help output usage information
-r, --repos <url> repository url
--save save component(s) dependencies into `components.json` file.
-r, --repos <url> repository url
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