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

pluginstall

Package Overview
Dependencies
Maintainers
1
Versions
23
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

pluginstall - npm Package Compare versions

Comparing version 0.3.6 to 0.3.7

test/android-one-install.js

4

package.json

@@ -5,3 +5,3 @@ {

"description": "install Cordova plugins",
"version": "0.3.6",
"version": "0.3.7",
"repository": {

@@ -20,3 +20,3 @@ "type": "git",

"mkdirp":"0.2.2",
"xcode":"0.3.5",
"xcode":"0.4.0",
"plist":"git+https://github.com/joshfire/node-plist.git",

@@ -23,0 +23,0 @@ "glob":"3.0.1"

@@ -7,2 +7,3 @@ var fs = require('fs'),

asyncCopy = require('../util/asyncCopy'),
getConfigChanges = require('../util/config-changes'),
assetsDir = 'assets/www', // relative path to project's web assets

@@ -18,9 +19,20 @@ sourceDir = 'src',

libFiles = platformTag.findall('./library-file'),
pluginsChanges = platformTag.findall('./config-file[@target="res/xml/plugins.xml"]'),
manifestChanges = platformTag.findall('./config-file[@target="AndroidManifest.xml"]'),
callbackCount = assets.length + sourceFiles.length + pluginsChanges.length
+ libFiles.length + manifestChanges.length,
endCallback = nCallbacks(callbackCount, callback)
configChanges = getConfigChanges(platformTag),
callbackCount = assets.length + sourceFiles.length + libFiles.length,
endCallback;
// find which config-files we're interested in
Object.keys(configChanges).forEach(function (configFile) {
if (fs.existsSync(path.resolve(config.projectPath, configFile))) {
// if so, add length to callbackCount
callbackCount += configChanges[configFile].length
} else {
delete configChanges[configFile];
}
});
endCallback = nCallbacks(callbackCount, callback)
// move asset files

@@ -70,37 +82,20 @@ assets.forEach(function (asset) {

// edit plugins.xml
pluginsChanges.forEach(function (configNode) {
var pluginsPath = path.resolve(config.projectPath, 'res/xml/plugins.xml'),
pluginsDoc = readAsETSync(pluginsPath),
selector = configNode.attrib["parent"],
child = configNode.find('*');
Object.keys(configChanges).forEach(function (filename) {
configChanges[filename].forEach(function (configNode) {
var filepath = path.resolve(config.projectPath, filename),
xmlDoc = readAsETSync(filepath),
selector = configNode.attrib["parent"],
child = configNode.find('*');
if (addToDoc(pluginsDoc, child, selector)) {
fs.writeFile(pluginsPath, pluginsDoc.write(), function (err) {
if (err) endCallback(err);
if (addToDoc(xmlDoc, child, selector)) {
fs.writeFile(filepath, xmlDoc.write(), function (err) {
if (err) endCallback(err);
endCallback();
});
} else {
endCallback('failed to add node to plugins.xml');
}
endCallback();
});
} else {
endCallback('failed to add node to ' + filename);
}
});
});
// edit AndroidManifest.xml
manifestChanges.forEach(function (configNode) {
var manifestPath = path.resolve(config.projectPath, 'AndroidManifest.xml'),
manifestDoc = readAsETSync(manifestPath),
selector = configNode.attrib["parent"],
child = configNode.find('*');
if (addToDoc(manifestDoc, child, selector)) {
fs.writeFile(manifestPath, manifestDoc.write(), function (err) {
if (err) endCallback(err);
endCallback();
});
} else {
endCallback('failed to add node to AndroidManifest.xml')
}
})
}

@@ -107,0 +102,0 @@

@@ -11,5 +11,9 @@ var fs = require('fs'),

// helpers
helpers = require('../util/test-helpers'),
moveProjFile = helpers.moveProjFile,
config = {
platform: 'ios',
projectPath: fs.realpathSync('test/project'),
projectPath: fs.realpathSync('test/project/ios'),
pluginPath: fs.realpathSync('test/plugin')

@@ -22,11 +26,2 @@ },

function moveProjFile(origFile, callback) {
var src = path.resolve(config.projectPath, origFile),
dest = src.replace('.orig', '')
fs.createReadStream(src)
.pipe(fs.createWriteStream(dest))
.on('close', callback);
}
function unlinkIfThere(filepath, cb) {

@@ -62,4 +57,4 @@ fs.stat(filepath, function (err, stat) {

moveProjFile('SampleApp/PhoneGap.orig.plist', end);
moveProjFile('SampleApp.xcodeproj/project.orig.pbxproj', end);
moveProjFile('SampleApp/PhoneGap.orig.plist', config.projectPath, end);
moveProjFile('SampleApp.xcodeproj/project.orig.pbxproj', config.projectPath, end);
}

@@ -66,0 +61,0 @@

Sorry, the diff of this file is not supported yet

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