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

ardoq-local-plugins

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ardoq-local-plugins - npm Package Compare versions

Comparing version 0.0.2 to 0.0.3

9

index.js

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

var PluginUpdater = require('./plugin_updater.js'),
fs = require('fs');
fs = require('fs'),
_ = require('lodash');

@@ -17,4 +18,6 @@ var cwd = process.cwd(),

}, (curr, prev) => {
console.log('Detected changes (' + pluginPath + ')');
updater.push();
if (!_.isEqual(curr, prev)) {
console.log('Detected changes (' + pluginPath + ')');
updater.push();
}
});
{
"name": "ardoq-local-plugins",
"version": "0.0.2",
"version": "0.0.3",
"description": "Script that allows for local development of plugins.",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -87,24 +87,31 @@ var fs = require('fs'),

var remotePluginData = response.body;
var localPlugin = fs.readFileSync(that.pluginPath).toString('utf8');
try {
var localPlugin = fs.readFileSync(that.pluginPath).toString('utf8');
if (remotePluginData.script !== localPlugin) {
var backupPath = cwd + '/backup-';
console.warn('Warning: Local plugin code differs from the remote version!');
inquirer.prompt([{
type: 'rawlist',
name: 'overwriteChoice',
message: '-- Choose which file to keep (other will be backed up) --',
choices: ['Remote', 'Local']
}]).then(function (data) {
if (data.overwriteChoice === 'Local') {
backupPath += 'local-' + Date.now() + '.js';
fs.writeFile(backupPath, localPlugin, 'utf8');
fs.writeFile(that.pluginPath, remotePluginData.script, 'utf8');
} else {
backupPath += 'remote-' + Date.now() + '.js';
fs.writeFile(backupPath, remotePluginData.script, 'utf8');
// Overwrite to force a push
fs.writeFile(that.pluginPath, localPlugin, 'utf8');
}
});
if (remotePluginData.script !== localPlugin) {
var backupPath = cwd + '/backup-';
console.warn('Warning: Local plugin code differs from the remote version!');
inquirer.prompt([{
type: 'rawlist',
name: 'keepFile',
message: '-- Choose which file to keep (other will be backed up) --',
choices: ['Remote', 'Local']
}]).then(function (data) {
if (data.keepFile === 'Local') {
console.log('Overwriting remote with local version...');
backupPath += 'remote-' + Date.now() + '.js';
fs.writeFile(backupPath, remotePluginData.script, 'utf8');
// Overwrite to force a push
fs.writeFile(that.pluginPath, localPlugin, 'utf8');
} else {
backupPath += 'local-' + Date.now() + '.js';
fs.writeFile(backupPath, localPlugin, 'utf8');
fs.writeFile(that.pluginPath, remotePluginData.script, 'utf8');
console.log('Overwrote local with remote version.');
}
});
}
} catch (e) {
console.log('Created ' + that.pluginPath + ' from remote.');
fs.writeFile(that.pluginPath, remotePluginData.script, 'utf8');
}

@@ -134,2 +141,3 @@

}
console.log('Waiting for changes...');
} else {

@@ -162,2 +170,3 @@ console.warn('Couldn\'t get remote plugin', response.statusCode);

}
console.log('Waiting for changes...');
});

@@ -164,0 +173,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