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

liferay-npm-bundler

Package Overview
Dependencies
Maintainers
1
Versions
131
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

liferay-npm-bundler - npm Package Compare versions

Comparing version 1.6.0 to 1.6.1

lib/insight.js

142

lib/index.js

@@ -8,4 +8,2 @@ 'use strict';

exports.default = function (args) {
var promises = [];
var versionsInfo = config.getVersionsInfo();

@@ -16,56 +14,7 @@

return;
}
_report2.default.versionsInfo(versionsInfo);
var outputDir = _path2.default.resolve(config.getOutputDir());
// Create work directories
_fsExtra2.default.mkdirsSync(_path2.default.join(outputDir, 'node_modules'));
// Copy project's package.json
promises.push(copyRootPackageJson(outputDir));
// Grab NPM dependencies
var pkgs = (0, _dependencies.getPackageDependencies)('.', config.getIncludeDependencies());
pkgs = Object.keys(pkgs).map(function (id) {
return pkgs[id];
});
pkgs = pkgs.filter(function (pkg) {
return pkg.dir != '.';
});
_report2.default.dependencies(pkgs);
// Process NPM dependencies
var start = process.hrtime();
log.info('Bundling ' + pkgs.length + ' dependencies...');
if (config.isProcessSerially()) {
_report2.default.warn('Option process-serially is on: this may degrade build performance.');
promises.push(iterateSerially(pkgs, function (pkg) {
return bundlePackage(pkg, outputDir);
}));
} else {
promises.push.apply(promises, _toConsumableArray(pkgs.map(function (pkg) {
return bundlePackage(pkg, outputDir);
})));
_report2.default.versionsInfo(versionsInfo);
}
Promise.all(promises).then(function () {
var hrtime = process.hrtime(start);
log.info('Bundling took ' + (0, _prettyTime2.default)(hrtime));
_report2.default.executionTime(hrtime);
if (config.isDumpReport()) {
_fsExtra2.default.writeFileSync(config.getReportFilePath(), _report2.default.toHtml());
log.info('Report written to ' + config.getReportFilePath());
}
}).catch(function (err) {
log.error(err);
process.exit(1);
});
insight.init().then(run);
};

@@ -111,2 +60,6 @@

var _insight = require('./insight');
var insight = _interopRequireWildcard(_insight);
var _dependencies = require('./dependencies');

@@ -136,2 +89,65 @@

/**
* Real tool execution
* @return {void}
*/
function run() {
// Create work directories
var outputDir = _path2.default.resolve(config.getOutputDir());
_fsExtra2.default.mkdirsSync(_path2.default.join(outputDir, 'node_modules'));
var promises = [];
// Copy project's package.json
promises.push(copyRootPackageJson(outputDir));
// Grab NPM dependencies
var pkgs = (0, _dependencies.getPackageDependencies)('.', config.getIncludeDependencies());
pkgs = Object.keys(pkgs).map(function (id) {
return pkgs[id];
});
pkgs = pkgs.filter(function (pkg) {
return pkg.dir != '.';
});
_report2.default.dependencies(pkgs);
// Process NPM dependencies
var start = process.hrtime();
log.info('Bundling ' + pkgs.length + ' dependencies...');
if (config.isProcessSerially()) {
_report2.default.warn('Option process-serially is on: this may degrade build performance.');
promises.push(iterateSerially(pkgs, function (pkg) {
return bundlePackage(pkg, outputDir);
}));
} else {
promises.push.apply(promises, _toConsumableArray(pkgs.map(function (pkg) {
return bundlePackage(pkg, outputDir);
})));
}
Promise.all(promises).then(function () {
var hrtime = process.hrtime(start);
_report2.default.executionTime(hrtime);
log.info('Bundling took ' + (0, _prettyTime2.default)(hrtime));
// Send report analytics data
_report2.default.sendAnalytics();
// Write report if requested
if (config.isDumpReport()) {
_fsExtra2.default.writeFileSync(config.getReportFilePath(), _report2.default.toHtml());
log.info('Report written to ' + config.getReportFilePath());
}
}).catch(function (err) {
log.error(err);
process.exit(1);
});
}
/**
* Copy project root package.json file to output directory.

@@ -145,15 +161,17 @@ * @param {String} outputDir the output directory path

['dependencies', 'devDependencies'].forEach(function (scope) {
Object.keys(pkgJson[scope]).forEach(function (depName) {
var depVersion = pkgJson[scope][depName];
if (pkgJson[scope] != null) {
Object.keys(pkgJson[scope]).forEach(function (depName) {
var depVersion = pkgJson[scope][depName];
if (_semver2.default.validRange(depVersion) == null) {
var depPkgJsonPath = _path2.default.join(depVersion.substring(5), 'package.json');
if (_semver2.default.validRange(depVersion) == null) {
var depPkgJsonPath = _path2.default.join(depVersion.substring(5), 'package.json');
var depPkgJson = (0, _readJsonSync2.default)(depPkgJsonPath);
var depPkgJson = (0, _readJsonSync2.default)(depPkgJsonPath);
pkgJson[scope][depName] = depPkgJson.version;
pkgJson[scope][depName] = depPkgJson.version;
_report2.default.linkedDependency(depName, depVersion, depPkgJson.version);
}
});
_report2.default.linkedDependency(depName, depVersion, depPkgJson.version);
}
});
}
});

@@ -160,0 +178,0 @@

@@ -12,2 +12,4 @@ 'use strict';

var _analytics = require('./analytics');
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

@@ -46,2 +48,14 @@

/**
* Dump report information to insight package so that it gets exported to
* our Google Analytics account.
* @return {void}
*/
}, {
key: 'sendAnalytics',
value: function sendAnalytics() {
return (0, _analytics.analyticsDump)(this);
}
/**
* Register execution time.

@@ -48,0 +62,0 @@ * @param {Array} hrtime the time it took to execute

{
"name": "liferay-npm-bundler",
"version": "1.6.0",
"version": "1.6.1",
"description": "A CLI utility to bundle NPM dependencies of a Liferay OSGi bundle.",

@@ -21,3 +21,4 @@ "main": "lib/index.js",

"globby": "^6.1.0",
"liferay-npm-build-tools-common": "1.6.0",
"insight": "0.10.0",
"liferay-npm-build-tools-common": "1.6.1",
"pretty-time": "^0.2.0",

@@ -24,0 +25,0 @@ "read-json-sync": "^1.1.1",

@@ -164,2 +164,3 @@ # liferay-npm-bundler

"process-serially": <true|false>,
"dump-report": <true|false>,
"verbose": <true|false>

@@ -206,3 +207,6 @@ "*" : {

same time.
* **"verbose"**: dump detailed information about what the tool is doing.
* **"dump-report"**: write a report HTML file in the project directory with
details about how each package is transformed and what has been done.
* **"verbose"**: dump detailed information about what the tool is doing to the
console.
* **(list of plugins)**: is a comma separated list of strings defining the

@@ -209,0 +213,0 @@ `liferay-npm-bundler` plugins to call (note that the

@@ -12,2 +12,3 @@ import * as babel from 'babel-core';

import * as config from './config';
import * as insight from './insight';
import {getPackageDependencies} from './dependencies';

@@ -23,4 +24,2 @@ import * as log from './log';

export default function(args) {
let promises = [];
const versionsInfo = config.getVersionsInfo();

@@ -31,11 +30,20 @@

return;
} else {
report.versionsInfo(versionsInfo);
}
report.versionsInfo(versionsInfo);
insight.init().then(run);
}
/**
* Real tool execution
* @return {void}
*/
function run() {
// Create work directories
const outputDir = path.resolve(config.getOutputDir());
// Create work directories
fs.mkdirsSync(path.join(outputDir, 'node_modules'));
let promises = [];
// Copy project's package.json

@@ -72,5 +80,10 @@ promises.push(copyRootPackageJson(outputDir));

log.info(`Bundling took ${pretty(hrtime)}`);
report.executionTime(hrtime);
log.info(`Bundling took ${pretty(hrtime)}`);
// Send report analytics data
report.sendAnalytics();
// Write report if requested
if (config.isDumpReport()) {

@@ -96,22 +109,24 @@ fs.writeFileSync(config.getReportFilePath(), report.toHtml());

['dependencies', 'devDependencies'].forEach(scope => {
Object.keys(pkgJson[scope]).forEach(depName => {
const depVersion = pkgJson[scope][depName];
if (pkgJson[scope] != null) {
Object.keys(pkgJson[scope]).forEach(depName => {
const depVersion = pkgJson[scope][depName];
if (semver.validRange(depVersion) == null) {
const depPkgJsonPath = path.join(
depVersion.substring(5),
'package.json'
);
if (semver.validRange(depVersion) == null) {
const depPkgJsonPath = path.join(
depVersion.substring(5),
'package.json'
);
const depPkgJson = readJsonSync(depPkgJsonPath);
const depPkgJson = readJsonSync(depPkgJsonPath);
pkgJson[scope][depName] = depPkgJson.version;
pkgJson[scope][depName] = depPkgJson.version;
report.linkedDependency(
depName,
depVersion,
depPkgJson.version
);
}
});
report.linkedDependency(
depName,
depVersion,
depPkgJson.version
);
}
});
}
});

@@ -118,0 +133,0 @@

import {htmlDump} from './html';
import {analyticsDump} from './analytics';

@@ -28,2 +29,11 @@ /**

/**
* Dump report information to insight package so that it gets exported to
* our Google Analytics account.
* @return {void}
*/
sendAnalytics() {
return analyticsDump(this);
}
/**
* Register execution time.

@@ -30,0 +40,0 @@ * @param {Array} hrtime the time it took to execute

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