build-reporter
Advanced tools
Comparing version 0.1.1 to 0.1.2
module.exports = function(grunt) { | ||
grunt.initConfig({ | ||
watch: { | ||
scripts: { | ||
template: { | ||
files: ['template/**/*'], | ||
@@ -11,4 +11,13 @@ tasks: 'copy', | ||
} | ||
}, | ||
connect: { | ||
server: { | ||
options: { | ||
port: 8000, | ||
base: '_site' | ||
} | ||
} | ||
} | ||
}); | ||
var path = require('path'); | ||
@@ -20,4 +29,5 @@ var copy = require('./lib/copy'); | ||
grunt.loadNpmTasks('grunt-contrib-connect'); | ||
grunt.loadNpmTasks('grunt-contrib-watch'); | ||
grunt.registerTask('default', ['watch']); | ||
grunt.registerTask('default', ['connect', 'watch']); | ||
}; |
@@ -5,2 +5,6 @@ # History | ||
## 0.1.2 | ||
- 月报表显示所有天数 | ||
## 0.1.1 | ||
@@ -7,0 +11,0 @@ |
@@ -129,13 +129,36 @@ var path = require('path'); | ||
_(item).each(function(json) { | ||
var body = require(json); | ||
data['day_rate'].push({ | ||
type: json.match(/\/(\d{4}-\d{2}-\d{2})\.json$/)[1], | ||
success: body['all_rate'][0].value, | ||
fail: body['all_rate'][1].value | ||
}); | ||
var h = _.map(item, function(o) { | ||
return o.match(/-(\d{2})\.json$/)[1]; | ||
}); | ||
_() | ||
.range(lastDayOfMonth(key)) | ||
.each(function(item) { | ||
var body; | ||
item = padZero(item + 1); | ||
if (h.indexOf(item) > -1) { | ||
body = require(path.join(dataDir, util.format('%s-%s.json', key, item))); | ||
} | ||
data['day_rate'].push({ | ||
type: item, | ||
success: body ? body['all_rate'][0].value : 0, | ||
fail: body ? body['all_rate'][1].value : 0 | ||
}); | ||
}); | ||
fs.writeFileSync(path.join(dataDir, key + '.json'), JSON.stringify(data, null, 2)); | ||
}); | ||
} | ||
function lastDayOfMonth(str) { | ||
return moment(str, 'YYYY-MM') | ||
.add('months', 1) | ||
.subtract('days', 1) | ||
.date(); | ||
} | ||
function padZero(str) { | ||
str = str + ''; | ||
return str.length === 1 ? '0' + str : str; | ||
} | ||
{ | ||
"family": "site", | ||
"name": "build-reporter", | ||
"version": "0.1.1", | ||
"version": "0.1.2", | ||
"description": "", | ||
@@ -6,0 +6,0 @@ "dependencies": { |
@@ -64,5 +64,3 @@ seajs.config({ | ||
xkey: 'type', | ||
xLabelFormat: function(x) { | ||
return x.getDate(); | ||
}, | ||
parseTime: false, | ||
hideHover: 'auto', | ||
@@ -69,0 +67,0 @@ ykeys: ['success', 'fail'], |
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
27101
814