From 36c1eb09c5b60077caaaa84c18626eca745305fb Mon Sep 17 00:00:00 2001 From: Phap Date: Sun, 22 Sep 2019 18:24:48 -0400 Subject: [PATCH] convert Gruntfile from coffeescript to javascript --- Gruntfile.coffee | 82 ------------------------------------ Gruntfile.js | 107 +++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 107 insertions(+), 82 deletions(-) delete mode 100644 Gruntfile.coffee create mode 100644 Gruntfile.js diff --git a/Gruntfile.coffee b/Gruntfile.coffee deleted file mode 100644 index 9d072fc9..00000000 --- a/Gruntfile.coffee +++ /dev/null @@ -1,82 +0,0 @@ -module.exports = (grunt) -> - - grunt.initConfig - pkg: require './package' - coffee: - src: - options: - bare: true - noHeader: true - expand: true - cwd: 'src' - src: '**/*.coffee' - dest: 'lib' - ext: '.js' - index: - src: 'index.coffee' - dest: 'index.js' - clean: - lib: - src: 'lib' - index: - src: 'index.js' - coffeelint: - options: - indentation: - level: 'ignore' - no_backticks: - level: 'ignore' - src: - src: '<%= coffee.src.cwd %>/<%= coffee.src.src %>' - index: - src: '<%= coffee.index.src %>' - test: - src: 'test/**/*.coffee' - tasks: - src: 'tasks/**/*.coffee' - gruntfile: - src: 'Gruntfile.coffee' - jsonlint: - packagejson: - src: 'package.json' - watch: - src: - files: '<%= coffee.src.cwd %>/<%= coffee.src.src %>' - tasks: ['coffeelint:src', 'test'] - index: - files: '<%= coffee.index.src %>' - tasks: ['coffeelint:index', 'test'] - test: - files: '<%= coffeelint.test.src %>', - tasks: ['coffeelint:test', 'test'] - gruntfile: - files: '<%= coffeelint.gruntfile.src %>' - tasks: ['coffeelint:gruntfile'] - packagejson: - files: '<%= jsonlint.packagejson.src %>' - tasks: ['jsonlint:packagejson'] - exec: - mocha: - options: [ - '--compilers coffee:coffee-script/register' - '--reporter spec' - '--colors' - '--recursive' - ], - cmd: './node_modules/.bin/mocha <%= exec.mocha.options.join(" ") %>' - keycode: - generate: - dest: 'src/adb/keycode.coffee' - - grunt.loadNpmTasks 'grunt-contrib-clean' - grunt.loadNpmTasks 'grunt-contrib-coffee' - grunt.loadNpmTasks 'grunt-coffeelint' - grunt.loadNpmTasks 'grunt-jsonlint' - grunt.loadNpmTasks 'grunt-contrib-watch' - grunt.loadNpmTasks 'grunt-notify' - grunt.loadNpmTasks 'grunt-exec' - grunt.loadTasks './tasks' - - grunt.registerTask 'test', ['jsonlint', 'coffeelint', 'exec:mocha'] - grunt.registerTask 'build', ['coffee'] - grunt.registerTask 'default', ['test'] diff --git a/Gruntfile.js b/Gruntfile.js new file mode 100644 index 00000000..183cb241 --- /dev/null +++ b/Gruntfile.js @@ -0,0 +1,107 @@ +(function() { + module.exports = function(grunt) { + grunt.initConfig({ + pkg: require('./package'), + coffee: { + src: { + options: { + bare: true, + noHeader: true + }, + expand: true, + cwd: 'src', + src: '**/*.coffee', + dest: 'lib', + ext: '.js' + }, + index: { + src: 'index.coffee', + dest: 'index.js' + } + }, + clean: { + lib: { + src: 'lib' + }, + index: { + src: 'index.js' + } + }, + coffeelint: { + options: { + indentation: { + level: 'ignore' + }, + no_backticks: { + level: 'ignore' + } + }, + src: { + src: '<%= coffee.src.cwd %>/<%= coffee.src.src %>' + }, + index: { + src: '<%= coffee.index.src %>' + }, + test: { + src: 'test/**/*.coffee' + }, + tasks: { + src: 'tasks/**/*.coffee' + }, + gruntfile: { + src: 'Gruntfile.coffee' + } + }, + jsonlint: { + packagejson: { + src: 'package.json' + } + }, + watch: { + src: { + files: '<%= coffee.src.cwd %>/<%= coffee.src.src %>', + tasks: ['coffeelint:src', 'test'] + }, + index: { + files: '<%= coffee.index.src %>', + tasks: ['coffeelint:index', 'test'] + }, + test: { + files: '<%= coffeelint.test.src %>', + tasks: ['coffeelint:test', 'test'] + }, + gruntfile: { + files: '<%= coffeelint.gruntfile.src %>', + tasks: ['coffeelint:gruntfile'] + }, + packagejson: { + files: '<%= jsonlint.packagejson.src %>', + tasks: ['jsonlint:packagejson'] + } + }, + exec: { + mocha: { + options: ['--compilers coffee:coffee-script/register', '--reporter spec', '--colors', '--recursive'], + cmd: './node_modules/.bin/mocha <%= exec.mocha.options.join(" ") %>' + } + }, + keycode: { + generate: { + dest: 'src/adb/keycode.coffee' + } + } + }); + grunt.loadNpmTasks('grunt-contrib-clean'); + grunt.loadNpmTasks('grunt-contrib-coffee'); + grunt.loadNpmTasks('grunt-coffeelint'); + grunt.loadNpmTasks('grunt-jsonlint'); + grunt.loadNpmTasks('grunt-contrib-watch'); + grunt.loadNpmTasks('grunt-notify'); + grunt.loadNpmTasks('grunt-exec'); + grunt.loadTasks('./tasks'); + grunt.registerTask('test', ['jsonlint', 'coffeelint', 'exec:mocha']); + grunt.registerTask('build', ['coffee']); + return grunt.registerTask('default', ['test']); + }; + +}).call(this);