cordova-import-npm
Advanced tools
Comparing version 1.0.4 to 1.0.5
{ | ||
"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: { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Install scripts
Supply chain riskInstall scripts are run when the package is installed. The majority of malware in npm is hidden in install scripts.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Install scripts
Supply chain riskInstall scripts are run when the package is installed. The majority of malware in npm is hidden in install scripts.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
356987
1323
3
0
1