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

cordova-import-npm

Package Overview
Dependencies
Maintainers
1
Versions
40
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cordova-import-npm - npm Package Compare versions

Comparing version 1.0.4 to 1.0.5

9

package.json
{
"name": "cordova-import-npm",
"version": "1.0.4",
"version": "1.0.5",
"description": "Import files from npm packages into your cordova www directory automatically, upon cordova prepare or cordova build",
"scripts": {
"test": "npm i jquery bootstrap && node test/test.js && npm remove jquery bootstrap && node scripts/postinstall.js --test && echo \"TEST OK\"",
"postinstall": "node postinstall.js"
"test": "standard && npm i jquery bootstrap && node test/test.js && npm remove jquery bootstrap && node scripts/postinstall.js --test && echo \"TEST OK\"",
"postinstall": "node scripts/postinstall.js"
},

@@ -22,3 +22,6 @@ "keywords": [

"xml2js": "^0.4.23"
},
"devDependencies": {
"standard": "^16.0.3"
}
}

@@ -8,3 +8,3 @@ const fs = require('fs')

var projectRoot
let projectRoot

@@ -17,9 +17,10 @@ module.exports = function (context) {

var npmFilesToImportFileName = path.join(__dirname, 'npmFilesToImport.json')
const npmFilesToImportFileName = path.join(__dirname, 'npmFilesToImport.json')
console.log(twoSpaces + 'Importing npm files to copy from ' + colors.cyan(npmFilesToImportFileName) + '\n')
var rawdata = fs.readFileSync(npmFilesToImportFileName, 'utf8')
const rawdata = fs.readFileSync(npmFilesToImportFileName, 'utf8')
let npmFilesToImport
try {
var npmFilesToImport = JSON.parse(rawdata);
} catch(e) {
npmFilesToImport = JSON.parse(rawdata)
} catch (e) {
console.log(colors.red(`\nERROR: Your JSON file "${npmFilesToImportFileName}" has syntax errors:\n`))

@@ -30,9 +31,9 @@ console.log(rawdata)

for (let npmPackage in npmFilesToImport) {
let npmFiles = npmFilesToImport[npmPackage]
for (const npmPackage in npmFilesToImport) {
const npmFiles = npmFilesToImport[npmPackage]
if (!Array.isArray(npmFiles) && typeof npmFiles === 'object') {
copyFile(npmPackage, path.join.apply(this, npmFiles.from), path.join.apply(this, npmFiles.to))
} else if (Array.isArray(npmFiles)){
} else if (Array.isArray(npmFiles)) {
for (let i = 0; i < npmFiles.length; i++) {
npmFilesI = npmFiles[i]
const npmFilesI = npmFiles[i]
copyFile(npmPackage, path.join.apply(this, npmFilesI.from), path.join.apply(this, npmFilesI.to))

@@ -39,0 +40,0 @@ }

@@ -1,10 +0,10 @@

const fs = require('fs')
const fse = require('fs-extra')
const path = require('path')
// const fs = require('fs')
// const fse = require('fs-extra')
// const path = require('path')
const colors = require('colors/safe')
const xml2js = require('xml2js')
const parser = new xml2js.Parser()
// const xml2js = require('xml2js')
// const parser = new xml2js.Parser()
var isTest = process.argv[2] === '--test'
// const isTest = process.argv[2] === '--test'
console.log('Postinstall script running on ' + colors.cyan(__dirname))

@@ -11,0 +11,0 @@

@@ -1,4 +0,4 @@

var cordovaImportNpm = require('../scripts/importNpmPackages.js')
var context = {
hook: "before_prepare",
const cordovaImportNpm = require('../scripts/importNpmPackages.js')
const context = {
hook: 'before_prepare',
scriptLocation: __dirname,

@@ -5,0 +5,0 @@ opts: {

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