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

s3-npm-cache

Package Overview
Dependencies
Maintainers
1
Versions
25
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

s3-npm-cache - npm Package Compare versions

Comparing version 0.0.2 to 0.0.3

bin/s3-npm-cache/s3-npm-cache

2

package.json
{
"name": "s3-npm-cache",
"version": "0.0.2",
"version": "0.0.3",
"description": "Forget lengthy npm install processes in your build pipeline. This script allows your build pipeline to cache your node_modules in S3 if your package.json hasn't changed.",

@@ -5,0 +5,0 @@ "license": "MIT",

@@ -5,32 +5,33 @@ /*

// Libararies
var md5 = require('md5-file'),
helpers = require('./helpers.js');
// Arguments
var s3BucketName = process.argv[3],
packageJsonFileLocation = process.argv[2],
packageJsonFile = packageJsonFileLocation + '/package.json',
nodeModulesFolder = packageJsonFileLocation + '/node_modules',
s3PackageName = md5.sync(packageJsonFile) + ".zip";
var init = function (s3BucketName, packageJsonFileLocation) {
var packageJsonFile = packageJsonFileLocation + '/package.json',
nodeModulesFolder = packageJsonFileLocation + '/node_modules',
s3PackageName = md5.sync(packageJsonFile) + ".zip";
// Actions
var unzipNodeModules = function (buffer) {
console.log('Found ZIP file. Unzipping.');
helpers.unzip(buffer, nodeModulesFolder);
};
var unzipNodeModules = function (buffer) {
console.log('Found ZIP file. Unzipping.');
helpers.unzip(buffer, nodeModulesFolder);
};
var uploadNewFile = function () {
console.log(s3PackageName, 'not found or error occurred. Uploading new package...');
helpers.installNodeModules(packageJsonFileLocation);
helpers.createZip(nodeModulesFolder, s3PackageName);
helpers.uploadFileToS3(s3PackageName);
var uploadNewFile = function () {
console.log(s3PackageName, 'not found or error occurred. Uploading new package...');
helpers.installNodeModules(packageJsonFileLocation);
helpers.createZip(nodeModulesFolder, s3PackageName);
helpers.uploadFileToS3(s3PackageName);
};
// Lift off!
console.log('Attempting to retrieve ZIP file from S3 -', s3BucketName, '/', s3PackageName);
helpers.setS3BucketName(s3BucketName);
helpers.getFileFromS3(s3PackageName)
.then(unzipNodeModules)
.catch(uploadNewFile);
};
// Lift off!
console.log('Attempting to retrieve ZIP file from S3 -', s3BucketName, '/', s3PackageName);
helpers.setS3BucketName(s3BucketName);
helpers.getFileFromS3(s3PackageName)
.then(unzipNodeModules)
.catch(uploadNewFile);
module.exports = {
init: init
};
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