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

asset-rev

Package Overview
Dependencies
Maintainers
1
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

asset-rev - npm Package Compare versions

Comparing version 0.1.2 to 0.1.3

19

index.js

@@ -66,2 +66,4 @@ const fs = require('fs');

fs.readFile(file, 'utf8', (error, contents) => {
let newContents = contents;
if (error) {

@@ -72,12 +74,13 @@ console.error('Could not read file', err);

hashedFiles.forEach((hashFile, i) => {
contents = contents.replace(new RegExp(relativeHashingFiles[i], 'g'), hashFile); // eslint-disable-line
newContents = newContents.replace(new RegExp(relativeHashingFiles[i], 'g'), hashFile);
});
fs.writeFile(file, contents, writeError => {
if (writeError) {
console.error('Could not write file');
}
resolve();
});
if (newContents !== contents) {
fs.writeFile(file, newContents, writeError => {
if (writeError) {
console.error('Could not write file');
}
resolve();
});
}
});

@@ -84,0 +87,0 @@ });

@@ -19,3 +19,3 @@ const fs = require('fs');

mkdirp(workingDirFullPath);
fs.writeFile(`${workingDirFullPath}/${referenceFile}`, `'${patterns[0]}'`);
fs.writeFile(`${workingDirFullPath}/${referenceFile}`, `'${patterns[0]}''${patterns[0]}'`);
fs.writeFile(`${workingDirFullPath}/${patterns[0]}`, 'foo bar');

@@ -32,3 +32,3 @@

it('updates the reference inside the reference file', done => {
it('updates the reference inside the reference file', () => {
rev(workingDir, patterns).then(() => {

@@ -38,3 +38,2 @@ find.file(workingDirFullPath, files => {

expect(contents.indexOf(patterns[0]) > 1).toBeTruthy();
done();
});

@@ -41,0 +40,0 @@ });

{
"name": "asset-rev",
"version": "0.1.2",
"version": "0.1.3",
"description": "Append hash to assets and updates references in each file specified",

@@ -5,0 +5,0 @@ "repository": "git@github.com:Brianzchen/asset-rev.git",

# asset-rev
Append hash to assets and updates references in each file specified

@@ -65,3 +66,3 @@

I created this little script as I wanted an alternative to [grunt-usemin](https://github.com/yeoman/grunt-usemin), but without grunt. I searched quite a while a wasn't able to find a solid alternative that makes use of simple npm scripts so I decided to write my own.
I created this little script as I wanted an alternative to [grunt-usemin](https://github.com/yeoman/grunt-usemin), but without grunt. I searched for quite a while and wasn't able to find a solid alternative that makes use of npm scripts so I decided to write my own.

@@ -68,0 +69,0 @@ ## License

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