Socket
Socket
Sign inDemoInstall

28

Package Overview
Dependencies
Maintainers
1
Versions
100
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

28 - npm Package Compare versions

Comparing version 2.1.5 to 2.1.6

62

lib/28.js

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

var Client = syncLib.Client;
var Download = require('download');
var path = require('path');
var _ = require('lodash');
var fs = require('fs');
var Q = require('q');
var URL = require('url');
var $28 = (function() {
var toPath = function(ns) {
var url = URL.parse(ns);
var segments = url.hostname.split('.').reverse();
segments = segments.concat(url.path.split('/').slice(1));
return segments.join('/') + '.jq';
};
function $28(apiEndpoint){

@@ -58,51 +45,2 @@ this.api = require('28.io-nodejs').$28(apiEndpoint);

$28.prototype.install = function(){
var defered = Q.defer();
var manifest = JSON.parse(fs.readFileSync('28.json', 'utf-8'));
var root = path.dirname(path.resolve('28.json')) + '/';
_.forEach(manifest.dependencies, function(hash, path){
var href = _.template('https://github.com/<%= path %>/archive/<%= hash %>.zip')({
path: path,
hash: hash
});
console.log('Installing ' + path + '#' + hash + '...');
var name = path.split('/')[1];
var output = root + 'jsoniq_modules/';
var base = output + name + '-' + hash;
new Download({ mode: '755', extract: true })
.get(href)
.dest(output)
.run(function(){
var manifest = JSON.parse(fs.readFileSync(base + '/28.json', 'utf-8'));
manifest.exports.forEach(function(ns){
var path = toPath(ns);
fs.createReadStream(base + '/queries/modules/' + path)
.pipe(fs.createWriteStream('queries/modules/' + path)).on('finish', function(){
defered.resolve();
});
});
});
});
return defered.promise;
};
$28.prototype.uninstall = function(){
var defered = Q.defer();
var manifest = JSON.parse(fs.readFileSync('28.json', 'utf-8'));
var root = path.dirname(path.resolve('28.json')) + '/';
_.forEach(manifest.dependencies, function(hash, path){
console.log('Uninstalling ' + path + '#' + hash + '...');
var name = path.split('/')[1];
var output = root + 'jsoniq_modules/';
var base = output + name + '-' + hash;
var manifest = JSON.parse(fs.readFileSync(base + '/28.json', 'utf-8'));
manifest.exports.forEach(function(ns){
var path = toPath(ns);
fs.unlinkSync('queries/modules/' + path);
});
defered.resolve();
});
return defered.promise;
};
$28.prototype.refreshTokens = function(email, token){

@@ -109,0 +47,0 @@ return this.api.Auth.authenticate({

1

lib/cli.js

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

require('./commands/run');
require('./commands/install');

@@ -19,0 +18,0 @@ cli.command('projects', 'Project management');

3

package.json

@@ -9,3 +9,3 @@ {

"description": "Command line utility to download and upload 28.io queries.",
"version": "2.1.5",
"version": "2.1.6",
"keywords": [

@@ -32,3 +32,2 @@ "jsoniq",

"commander": "^2.7.1",
"download": "^4.1.2",
"final-fs": "~1.6.0",

@@ -35,0 +34,0 @@ "lodash": "3.7.0",

Sorry, the diff of this file is not supported yet

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