babel-plugin-snoretify
Advanced tools
Comparing version 1.0.0 to 1.0.1
22
index.js
var path = require('path'); | ||
global.snoret = { count: 0 }; | ||
module.exports = function(babel) { | ||
@@ -24,13 +26,27 @@ var importantMessages = [ | ||
exit(node, state) { | ||
if (global.snoret.count === 0) { | ||
console.log('\n\nSnöre:\n'); | ||
} | ||
var filename = path.basename(state.file.opts.filename); | ||
var parts = [' /', '|', ' \\', ' \\', ' |', ' /']; | ||
var timestamp = Math.round(Date.now() / 1000); | ||
var index = timestamp % parts.length; | ||
var part = parts[global.snoret.count % parts.length]; | ||
var output = part; | ||
if (filename.length >= 35) { | ||
console.log(filename + ' (jättelångt filnamn)'); | ||
output += ' ' + filename + ' (jättelångt filnamn)'; | ||
} | ||
else if (/reducer\.js$/.test(filename) && Math.random() >= 0.6) { | ||
console.log(filename.replace(/reducer\.js$/, 'rädisor.js')); | ||
output += ' ' + filename.replace(/reducer\.js$/, 'rädisor.js'); | ||
} | ||
else if (Math.random() >= 0.92) { | ||
console.log(filename + ' ' + importantMessages[Math.round(Math.random() * (importantMessages.length - 1))]); | ||
output += ' ' + filename + ' - ' + importantMessages[Math.round(Math.random() * (importantMessages.length - 1))]; | ||
} | ||
console.log(output); | ||
global.snoret.count += 1; | ||
} | ||
@@ -37,0 +53,0 @@ } |
{ | ||
"name": "babel-plugin-snoretify", | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"description": "A bit of Snöret in your build pipeline", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
1895
47