grunt-sort-json
Version:
Alphabetizing JSON files. Sort JSON files.
58 lines (52 loc) • 1.44 kB
JavaScript
'use strict';
module.exports = function(grunt) {
// default test task
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
sortJSON: {
noOptions: {
src: ['tests/results/file.json']
},
customSpacing: {
src: ['tests/results/customSpacing.json'],
options: {
spacing: 2
}
},
jshintSpacing: {
src: ['tests/results/jshintSpacing.json'],
options: {
jshint: true,
jshintrc: 'tests/.jshintrc'
}
}
},
copy: {
main: {
expand: true,
cwd: 'tests/template/',
src: '**',
dest: 'tests/results/'
}
},
clean: {
src: ['tests/results/']
},
nodeunit: {
all: ['tests/tags.test.js']
}
});
// Actually load this plugin's task(s).
grunt.loadTasks('tasks');
grunt.loadNpmTasks('grunt-contrib-copy');
grunt.loadNpmTasks('grunt-contrib-clean');
grunt.loadNpmTasks('grunt-contrib-nodeunit');
// Test tasks cleans folder, runs tags task, then runs nodeunit
grunt.registerTask('test', [
'clean',
'copy:main',
'sortJSON',
'nodeunit',
'clean'
]);
};