Socket
Socket
Sign inDemoInstall

@relative-ci/agent

Package Overview
Dependencies
Maintainers
1
Versions
157
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@relative-ci/agent - npm Package Compare versions

Comparing version 1.0.0-2 to 1.0.0

.travis.yml

8

.eslintrc.js
module.exports = {
'extends': 'airbnb-base',
'rules': {
extends: 'airbnb-base',
globals: {
describe: true,
it: true
},
rules: {
'no-console': 'off'
}
};

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

default: envs.build,
}
},
})

@@ -48,0 +48,0 @@ .help().argv;

@@ -1,8 +0,62 @@

const read = require('./read');
const fs = require('fs-extra');
const { get, omit, set } = require('lodash');
const { debug } = require('./utils');
const { extractWebpackStats } = require('./extract');
const send = require('./send');
module.exports = ({ config, params }) => {
const data = read(config);
const WEBPACK_STATS = 'webpack.stats';
return send(data, params);
const SOURCE_EXTRACTORS = {
[WEBPACK_STATS]: extractWebpackStats,
};
const getConfiguredArtifacts = config => Object.keys(SOURCE_EXTRACTORS)
.map((key) => {
const artifactConfig = get(config, key);
if (!artifactConfig) {
return null;
}
if (typeof artifactConfig === 'object') {
return {
key,
filepath: artifactConfig.filepath,
options: omit(artifactConfig, 'filepath'),
};
}
return {
key,
filepath: artifactConfig,
};
})
.filter(item => item);
const getDataFromArtifacts = async artifacts => Promise.all(
artifacts.map(async ({ key, filepath, options }) => {
debug('Read artifact', filepath);
const data = await fs.readJSON(filepath);
return {
key,
data,
options,
};
}),
);
const getFilteredData = artifactsData => artifactsData.reduce(
(agg, { key, data, options }) => set(agg, key, SOURCE_EXTRACTORS[key](data, options)),
{},
);
module.exports = async ({ config, params }) => {
const artifacts = getConfiguredArtifacts(config);
const artifactsData = await getDataFromArtifacts(artifacts);
const filteredData = getFilteredData(artifactsData);
return send(filteredData, params);
};
{
"name": "@relative-ci/agent",
"version": "1.0.0-2",
"version": "1.0.0",
"description": "Relative CI agent",

@@ -12,3 +12,3 @@ "repository": "relative-ci/agent",

"lint": "eslint lib",
"test": "echo \"Error: no test specified\" && exit 1"
"test": "mocha test/extract/*.js"
},

@@ -29,3 +29,4 @@ "keywords": [],

"eslint-config-airbnb-base": "^13.1.0",
"eslint-plugin-import": "^2.14.0"
"eslint-plugin-import": "^2.14.0",
"mocha": "^5.2.0"
},

@@ -32,0 +33,0 @@ "dependencies": {

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