Gruntfile.js 4.06 KB
module.exports = function (grunt) {
    "use strict";

// Project configuration.
    grunt.initConfig({
        pkg: grunt.file.readJSON('package.json'),
        copy: {
            dist: {
                files:[
                   {src: 'src/arcs_browser.js', dest: 'build/arcs_browser.js'}
                ]
                
            }            
        },
        jsdoc: {
            dist: {
                src: ['src/*.js', 'docs/Readme.md'], //, 'components/*.js'],
                options: {
                    /*verbose: true,
                    access: 'all',
                    private: true,*/
                    destination:  'docs/engine',
                    template: 'docs/arcs',
                    configure: 'docs/jsdoc.conf.json'

                }
            },
            components : {
                src: ['components/*.js', 'deps/surf/surf.js', 'deps/pose/posit_gen.js'],
                options: { 
                    verbose: true,
                    destination: 'docs/components',
                    template: 'docs/arcs',
                    configure: 'docs/jsdoc.conf.json'
                }
            }                
        },
        jslint: {
            dist: {
                src: ['*.js'],
                exclude: ['require.js', 'text.js'],
                directives: {
                    node: true,
                    sloppy: true,
                    plusplus: true,
                    forin: true,
                    devel: true,
                    white: true,
                    predef: ['define', 'arcs_module', 'document']
                    //browser: true,                    
                }
            }
        },
        terser: {
            build: {
                files: { 
                    'build/arcs.min.js': [
                        'build/arcs.js'
                    ],
                    'build/arcs_browser.min.js': [
                        'src/arcs_browser.js'
                    ],
                    'build/arcseditor.min.js': [
                        'build/arcseditor.js'
                    ]
                }
            }
        },
        bower: {
            options : {
                verbose: true,
                targetDir: './deps',
                copy: true,
                cleanBowerDir: true, 
                layout: 'byComponent'
            },
            install : {
                
            }
            
        },
	    concat: {
            dist: {
                src: [
                        'src/arcs.js',
                        'src/component.js',
                        'src/context.js',
                        'src/invocation.js',
                        'src/connection.js',
                        'src/sheet.js',
                        'src/eventlogicparser.js',
                        'src/tokenevent.js',
                        'src/transitionnetwork.js',
                        'src/statemachine.js',
                        'src/application.js',
                        'src/exports.js'
                    ],
                dest: 'build/arcs.js'
            }, 
            editor : {
                src: [ 
                        'utils/editor/arcseditor.js',
                        'utils/editor/dragdrop.js',
                        'utils/editor/template.js',
                        'utils/editor/dialog.js',
                        'utils/editor/componentdialog.js',
                        'utils/editor/invocationdialog.js',
                        'utils/editor/connectiondialog.js'
                     ],
                dest: 'build/arcseditor.js'
            }

	    }
	
    });

    // Load the plugin that provides the "uglify" task.
    grunt.loadNpmTasks('grunt-contrib-concat');
    grunt.loadNpmTasks('grunt-contrib-copy');
    grunt.loadNpmTasks('grunt-jsdoc');
    grunt.loadNpmTasks('grunt-jslint');
    grunt.loadNpmTasks('grunt-terser');
    grunt.loadNpmTasks('grunt-bower-task');

    // Default task(s).
    grunt.registerTask('default', ['concat','copy','terser']);
    grunt.registerTask('lint', ['jslint']);
    grunt.registerTask('doc', ['jsdoc']);
};