{"size": 6858, "ext": "js", "max_stars_repo_path": "Gruntfile.js", "max_stars_repo_name": "aivanochko/charttab", "max_stars_repo_stars_event_min_datetime": "2015-06-16T16:49:02.000Z", "max_stars_repo_stars_event_max_datetime": "2020-02-27T09:46:23.000Z", "max_issues_repo_path": "Gruntfile.js", "max_issues_repo_name": "aivanochko/charttab", "max_issues_repo_issues_event_min_datetime": "2015-06-16T07:59:09.000Z", "max_issues_repo_issues_event_max_datetime": "2018-05-02T10:34:04.000Z", "max_forks_repo_path": "Gruntfile.js", "max_forks_repo_name": "aivanochko/charttab", "max_forks_repo_forks_event_min_datetime": "2015-06-16T16:49:04.000Z", "max_forks_repo_forks_event_max_datetime": "2021-01-12T20:08:11.000Z"}
{"max_stars_count": 5, "max_issues_count": 6, "max_forks_count": 2, "avg_line_length": 27.2142857143, "max_line_length": 81, "alphanum_fraction": 0.3442694663}
module.exports = function (grunt) {

    // Load grunt tasks automatically
    require('load-grunt-tasks')(grunt);

    // Time how long tasks take. Can help when optimizing build times
    require('time-grunt')(grunt);

    grunt.initConfig({

        // Watches files for changes and runs tasks based on the changed files
        watch: {
            bower: {
                files: ['bower.json'],
                tasks: ['wiredep']
            },
            gruntfile: {
                files: ['Gruntfile.js']
            },
            livereload: {
                files: [
                    'app/*.html',
                    'app/views/{,*/}*.html',
                    'app/scripts/{,*/}*.js',
                    'app/styles/{,*/}*.css',
                    'app/images/{,*/}*.{png,jpg,jpeg,gif,webp,svg}',
                    'app/manifest.json',
                    'app/_locales/{,*/}*.json'
                ],
                options: {
                    livereload: '<%= connect.options.livereload %>'
                }
            }
        },

        // Grunt server and debug server setting
        connect: {
            options: {
                livereload: 35729,
                hostname: 'localhost',
                port: 9000
            },
            debug: {
                options: {
                    open: false,
                    base: [
                        'app'
                    ]
                }
            }
        },

        // Empties folders to start fresh
        clean: {
            debug: '.tmp',
            dist: {
                files: [{
                    dot: true,
                    src: [
                        '.tmp',
                        'dist/*',
                        '!dist/.git*'
                    ]
                }]
            }
        },

        // Automatically inject Bower components into the app
        wiredep: {
            app: {
                src: [
                    'app/newtab.html',
                    'app/options.html'
                ],
                exclude: [
                    'livereload'
                ]
            }
        },

        // Reads HTML for usemin blocks to enable smart builds that automatically
        // concat, minify and revision files. Creates configurations in memory so
        // additional tasks can operate on them
        useminPrepare: {
            options: {
                dest: 'dist'
            },
            html: [
                'app/newtab.html',
                'app/options.html'
            ]
        },

        // Performs rewrites based on rev and the useminPrepare configuration
        usemin: {
            options: {
                assetsDirs: ['dist', 'dist/images', 'dist/styles']
            },
            html: ['dist/{,*/}*.html'],
            css: ['dist/styles/{,*/}*.css']
        },

        // The following *-min tasks produce minifies files in the dist folder
        imagemin: {
            dist: {
                files: [{
                    expand: true,
                    cwd: 'app/images',
                    src: '{,*/}*.{gif,jpeg,jpg,png}',
                    dest: 'dist/images'
                }]
            }
        },

        svgmin: {
            dist: {
                files: [{
                    expand: true,
                    cwd: 'app/images',
                    src: '{,*/}*.svg',
                    dest: 'dist/images'
                }]
            }
        },

        htmlmin: {
            options: {
                removeComments: true,
                collapseWhitespace: true
            },
            dist: {
                files: [{
                    expand: true,
                    cwd: 'dist',
                    src: '*.html',
                    dest: 'dist'
                }, {
                    expand: true,
                    cwd: 'dist/views',
                    src: '{,*/}*.html',
                    dest: 'dist/views'
                }]
            }
        },

        // ng-annotate tries to make the code safe for minification automatically
        // by using the Angular long form for dependency injection.
        ngAnnotate: {
            dist: {
                files: [{
                    expand: true,
                    cwd: '.tmp/concat/scripts',
                    src: '*.js',
                    dest: '.tmp/concat/scripts'
                }]
            }
        },

        // Copies remaining files to places other tasks can use
        copy: {
            dist: {
                files: [{
                    expand: true,
                    dot: true,
                    cwd: 'app',
                    dest: 'dist',
                    src: [
                        '*.{ico,png,txt}',
                        'images/{,*/}*.{webp,gif}',
                        '{,*/}*.html',
                        'views/{,*/}*.html',
                        'styles/fonts/{,*/}*.*',
                        '_locales/{,*/}*.json'
                    ]
                }]
            }
        },

        // Run some tasks in parallel to speed up build process
        concurrent: {
            debug: [],
            dist: [
                'imagemin',
                'svgmin'
            ]
        },

        // Auto buildnumber, exclude debug files. smart builds that event pages
        chromeManifest: {
            dist: {
                options: {
                    indentSize: 2,
                    background: {
                        target: 'scripts/background.js'
                    }
                },
                src: 'app',
                dest: 'dist'
            }
        },

        // Compres dist files to package
        compress: {
            dist: {
                options: {
                    archive: function () {
                        var manifest = grunt.file.readJSON('app/manifest.json');
                        return 'package/charttab-' + manifest.version + '.zip';
                    }
                },
                files: [{
                    expand: true,
                    cwd: 'dist/',
                    src: ['**'],
                    dest: ''
                }]
            }
        }

    });

    grunt.registerTask('debug', function () {
        grunt.task.run([
            'clean:debug',
            'wiredep',
            'concurrent:debug',
            'connect:debug',
            'watch'
        ]);
    });

    grunt.registerTask('build', [
        'clean:dist',
        'chromeManifest:dist',
        'wiredep',
        'useminPrepare',
        'concurrent:dist',
        'concat',
        'ngAnnotate',
        'cssmin',
        'uglify',
        'copy',
        'usemin',
        'htmlmin',
        'compress'
    ]);

    grunt.registerTask('default', [
        'build'
    ]);
};
