2015-01-05 05:27:45 +08:00
|
|
|
/**
|
|
|
|
* Created by Tivie on 12-11-2014.
|
|
|
|
*/
|
|
|
|
|
|
|
|
module.exports = function (grunt) {
|
|
|
|
|
2015-01-19 23:43:47 +08:00
|
|
|
// Project configuration.
|
|
|
|
var config = {
|
|
|
|
pkg: grunt.file.readJSON('package.json'),
|
|
|
|
concat: {
|
|
|
|
options: {
|
|
|
|
sourceMap: true,
|
|
|
|
banner: ';/*! <%= pkg.name %> <%= grunt.template.today("dd-mm-yyyy") %> */\n(function(){\n',
|
2015-05-28 19:50:57 +08:00
|
|
|
footer: '}).call(this);'
|
2015-01-19 23:43:47 +08:00
|
|
|
},
|
|
|
|
dist: {
|
|
|
|
src: [
|
|
|
|
'src/showdown.js',
|
|
|
|
'src/helpers.js',
|
|
|
|
'src/subParsers/*.js',
|
|
|
|
'src/loader.js'
|
|
|
|
],
|
|
|
|
dest: 'dist/<%= pkg.name %>.js'
|
|
|
|
}
|
|
|
|
},
|
|
|
|
uglify: {
|
|
|
|
options: {
|
|
|
|
sourceMap: true,
|
|
|
|
banner: '/*! <%= pkg.name %> <%= grunt.template.today("dd-mm-yyyy") %> */\n'
|
|
|
|
},
|
|
|
|
dist: {
|
|
|
|
files: {
|
|
|
|
'dist/<%= pkg.name %>.min.js': ['<%= concat.dist.dest %>']
|
2015-01-05 05:27:45 +08:00
|
|
|
}
|
2015-01-19 23:43:47 +08:00
|
|
|
}
|
|
|
|
},
|
|
|
|
jshint: {
|
|
|
|
files: [
|
|
|
|
'Gruntfile.js',
|
|
|
|
'src/**/*.js',
|
|
|
|
'test/**/*.js'
|
|
|
|
]
|
|
|
|
},
|
|
|
|
jscs: {
|
|
|
|
options: {
|
|
|
|
config: '.jscs.json',
|
2015-04-22 23:56:31 +08:00
|
|
|
},
|
|
|
|
files: {
|
|
|
|
src: [
|
2015-01-19 23:43:47 +08:00
|
|
|
'Gruntfile.js',
|
|
|
|
'src/**/*.js',
|
|
|
|
'test/**/*.js'
|
|
|
|
]
|
|
|
|
}
|
|
|
|
},
|
2015-01-20 00:27:28 +08:00
|
|
|
changelog: {
|
2015-05-14 08:59:33 +08:00
|
|
|
options: {
|
|
|
|
repository: 'http://github.com/showdownjs/showdown',
|
|
|
|
dest: 'CHANGELOG.md'
|
|
|
|
}
|
2015-01-20 00:27:28 +08:00
|
|
|
},
|
2015-05-27 09:21:36 +08:00
|
|
|
bump: {
|
|
|
|
options: {
|
|
|
|
files: ['package.json'],
|
|
|
|
updateConfigs: [],
|
|
|
|
commit: true,
|
|
|
|
commitMessage: 'Release version %VERSION%',
|
|
|
|
commitFiles: ['package.json'],
|
|
|
|
createTag: true,
|
|
|
|
tagName: '%VERSION%',
|
|
|
|
tagMessage: 'Version %VERSION%',
|
|
|
|
push: true,
|
|
|
|
pushTo: 'upstream',
|
|
|
|
gitDescribeOptions: '--tags --always --abbrev=1 --dirty=-d',
|
|
|
|
globalReplace: false,
|
|
|
|
prereleaseName: 'alpha',
|
|
|
|
regExp: false
|
|
|
|
}
|
|
|
|
},
|
2015-01-19 23:43:47 +08:00
|
|
|
simplemocha: {
|
|
|
|
node: {
|
|
|
|
src: 'test/node/**/*.js',
|
|
|
|
options: {
|
|
|
|
globals: ['should'],
|
|
|
|
timeout: 3000,
|
|
|
|
ignoreLeaks: false,
|
|
|
|
reporter: 'spec'
|
|
|
|
}
|
|
|
|
},
|
|
|
|
browser: {
|
|
|
|
src: 'test/browser/**/*.js',
|
|
|
|
options: {
|
|
|
|
reporter: 'spec'
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
grunt.initConfig(config);
|
2015-01-05 05:27:45 +08:00
|
|
|
|
2015-01-19 23:43:47 +08:00
|
|
|
grunt.loadNpmTasks('grunt-contrib-concat');
|
|
|
|
grunt.loadNpmTasks('grunt-contrib-uglify');
|
|
|
|
grunt.loadNpmTasks('grunt-contrib-jshint');
|
|
|
|
grunt.loadNpmTasks('grunt-simple-mocha');
|
|
|
|
grunt.loadNpmTasks('grunt-jscs');
|
2015-01-20 00:27:28 +08:00
|
|
|
grunt.loadNpmTasks('grunt-conventional-changelog');
|
2015-05-27 09:21:36 +08:00
|
|
|
grunt.loadNpmTasks('grunt-bump');
|
2015-01-05 05:27:45 +08:00
|
|
|
|
2015-01-19 23:43:47 +08:00
|
|
|
grunt.registerTask('lint', ['jshint', 'jscs']);
|
|
|
|
grunt.registerTask('test', ['lint', 'concat', 'simplemocha']);
|
|
|
|
grunt.registerTask('test-without-building', ['simplemocha']);
|
|
|
|
grunt.registerTask('build', ['lint', 'test', 'uglify']);
|
2015-05-23 09:07:19 +08:00
|
|
|
grunt.registerTask('prep-release', ['build', 'changelog']);
|
2015-01-05 05:27:45 +08:00
|
|
|
|
2015-01-19 23:43:47 +08:00
|
|
|
// Default task(s).
|
2015-05-27 09:21:36 +08:00
|
|
|
grunt.registerTask('default', ['test']);
|
2015-01-05 05:27:45 +08:00
|
|
|
};
|