🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Book a DemoInstallSign in
Socket

speculate

Package Overview
Dependencies
Maintainers
13
Versions
40
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

speculate - npm Package Compare versions

Comparing version

to
2.0.0-alpha.4

4

lib/archiver.js

@@ -17,4 +17,4 @@ 'use strict';

// Extract the property from the whitelist
const { main, files } = whitelist;
const whitelistFromSections = [];
const { service, main, files } = whitelist;
const whitelistFromSections = [service];

@@ -21,0 +21,0 @@ /*

@@ -6,4 +6,7 @@ 'use strict';

module.exports = {
serviceFileName: function (pkg) {
return `${pkg.name}.service`;
},
serviceFile: function (root, pkg) {
return path.resolve(root, pkg.name + '.service');
return path.resolve(root, this.serviceFileName(pkg));
},

@@ -10,0 +13,0 @@ specsDirectory: function (root) {

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

function getArchiveWhitelist({ main, files }) {
return { main, files };
function getArchiveWhitelist(pkg) {
return {
service: files.serviceFileName(pkg),
main: pkg.main,
files: pkg.files
};
}

@@ -47,0 +51,0 @@

{
"name": "speculate",
"version": "2.0.0-alpha.3",
"version": "2.0.0-alpha.4",
"description": "Automatically generates an RPM Spec file for your Node.js project",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -81,2 +81,3 @@ 'use strict';

it('archives files on a whitelist if specified alongside required files', async () => {
const service = 'my-cool-api.service';
const files = [

@@ -87,3 +88,3 @@ 'lib',

];
const result = archiver.compress('/tmp/SOURCES', 'tmp.tar.gz', { files });
const result = archiver.compress('/tmp/SOURCES', 'tmp.tar.gz', { service, files });
writeStream.emit('close');

@@ -97,2 +98,3 @@

'node_modules',
'my-cool-api.service',
'lib',

@@ -106,3 +108,4 @@ 'routes',

it('does not include whitelist if none specified', async () => {
const result = archiver.compress('/tmp/SOURCES', 'tmp.tar.gz', {});
const service = 'my-cool-api.service';
const result = archiver.compress('/tmp/SOURCES', 'tmp.tar.gz', { service });
writeStream.emit('close');

@@ -118,2 +121,3 @@

it('adds the "main" file to the archive alongside "files" if specified', async () => {
const service = 'my-cool-api.service';
const main = 'server.js';

@@ -125,3 +129,3 @@ const files = [

];
const result = archiver.compress('/tmp/SOURCES', 'tmp.tar.gz', { main, files });
const result = archiver.compress('/tmp/SOURCES', 'tmp.tar.gz', { service, main, files });
writeStream.emit('close');

@@ -136,2 +140,3 @@

'node_modules',
'my-cool-api.service',
'server.js',

@@ -146,4 +151,5 @@ 'lib',

it('archives everything if only the "main" is specified', async () => {
const service = 'my-cool-api.service';
const main = 'server.js';
const result = archiver.compress('/tmp/SOURCES', 'tmp.tar.gz', { main });
const result = archiver.compress('/tmp/SOURCES', 'tmp.tar.gz', { service, main });
writeStream.emit('close');

@@ -150,0 +156,0 @@

@@ -65,3 +65,4 @@ 'use strict';

files: undefined,
main: 'index.js'
main: 'index.js',
service: 'my-cool-api.service'
}

@@ -114,3 +115,4 @@ );

files: undefined,
main: 'index.js'
main: 'index.js',
service: 'my-cool-api.service'
}

@@ -132,3 +134,4 @@ );

'index.js'
]
],
service: 'my-cool-api.service'
}

@@ -135,0 +138,0 @@ );