Skip to content
Snippets Groups Projects
Select Git revision
  • 98bcedbe7ba9f809c805c24f62e56278bd34a6a2
  • develop default
  • documentation
  • F10114glyphiconToFontAwesome
  • F21622-settings-table-changes
  • F17481_BS_Modal_window
  • F20975_Dynamic_DateTimePicker
  • revertB5221downloadModal
  • B21533-Hidden-Pill-Required
  • B21510_Validation_error_when_date_field_is_left_empty
  • F8044-Transactions
  • master protected
  • F12532-view-sip-in-Browser-consol-log
  • S21288-Store-Parent-Remove-Prefix
  • F21203-Render-MultiSql-Columns-like-Subrecord
  • F11535_ipa-qfq-db-editor
  • F21130-multiform-toggle
  • S20463-V-Store-not-updated-after-form-save
  • B18601-typeahead-sanatize-applied-to-value
  • F16113-MultiAction
  • F20931-inotify-service-file
  • v25.6.0
  • v24.12.0
  • v24.10.0
  • v24.7.0
  • v24.5.1
  • v24.5.0
  • v24.3.0
  • test-alfred20
  • v23.10.1
  • v23.10.0
  • v23.6.4
  • v23.6.3
  • v23.6.2
  • v23.6.1
  • v23.6.0
  • v23.3.1
  • v23.3.0
  • v23.2.0
  • v23.1.1
  • v23.1.0
41 results

Gruntfile.js

Blame
  • Benjamin Baer's avatar
    Benjamin Baer authored
    # Conflicts:
    #   mockup/displayFile.html
    bf6e6b4b
    History
    Gruntfile.js 19.98 KiB
    var path = require('path');
    module.exports = function (grunt) {
        'use strict';
    
        var typo3_css = 'extension/Resources/Public/Css/';
        var typo3_js = 'extension/Resources/Public/JavaScript/';
        var typo3_fonts = 'extension/Resources/Public/fonts/';
        var js_sources = [
            'javascript/src/Helper/*.js',
            'javascript/src/Element/*.js',
            'javascript/src/*.js'
        ];
        var js_plugins = 'javascript/src/Plugins/*.js';
        var js_worker = 'javascript/src/Worker/*.js';
    
        // Project configuration.
        grunt.initConfig({
            pkg: grunt.file.readJSON('package.json'),
            copy: {
                bootstrap: {
                    files: [
                        {
                            cwd: 'node_modules/bootstrap/dist/css/',
                            src: [
                                'bootstrap.min.css',
                                'bootstrap-theme.min.css'
                            ],
                            dest: typo3_css,
                            filter: 'isFile',
                            expand: true,
                            flatten: true
                        },
                        {
                            cwd: 'node_modules/bootstrap/dist/js/',
                            src: [
                                'bootstrap.min.js'
                            ],
                            dest: typo3_js,
                            expand: true,
                            flatten: true
                        },
                        {
                            cwd: 'node_modules/bootstrap/dist/fonts/',
                            expand: true,
                            src: [
                                '*'
                            ],
                            dest: typo3_fonts,
                            flatten: true
                        }
                    ]
                },
                bootstrap_dev: {
                    files: [
                        {
                            cwd: 'node_modules/bootstrap/dist/css/',
                            src: [
                                'bootstrap.min.css',
                                'bootstrap-theme.min.css'
                            ],
                            dest: 'css/',
                            filter: 'isFile',
                            expand: true,
                            flatten: true
                        },
                        {
                            cwd: 'node_modules/bootstrap/dist/js/',
                            src: [
                                'bootstrap.min.js'
                            ],
                            dest: 'js/',
                            expand: true,
                            flatten: true
                        },
                        {
                            cwd: 'node_modules/bootstrap/dist/fonts/',
                            expand: true,
                            src: [
                                '*'
                            ],
                            dest: 'fonts/',
                            flatten: true
                        }
                    ]
                },
                bootstrap_validator: {
                    files: [
                        {
                            cwd: 'node_modules/bootstrap-validator/dist/',
                            src: [
                                'validator.min.js'
                            ],
                            dest: 'js/',
                            expand: true,
                            flatten: true
                        },
                        {
                            cwd: 'node_modules/bootstrap-validator/dist/',
                            src: [
                                'validator.min.js'
                            ],
                            dest: typo3_js,
                            expand: true,
                            flatten: true
                        }
                    ]
                },
                jquery: {
                    files: [
                        {
                            cwd: 'node_modules/jquery/dist/',
                            src: [
                                'jquery.min.js'
                            ],
                            expand: true,
                            dest: typo3_js,
                            flatten: true
                        },
                        {
                            cwd: 'node_modules/jquery/dist/',
                            src: [
                                'jquery.min.js'
                            ],
                            expand: true,
                            dest: "js/",
                            flatten: true
                        }
                    ]
                },
                jquery_tablesorter: {
                    files: [
                        {
                            cwd: 'node_modules/tablesorter/dist/js/',
                            src: [
                                'jquery.tablesorter.min.js'
                            ],
                            expand: true,
                            dest: typo3_js,
                            flatten: true
                        },
                        {
                            cwd: 'node_modules/tablesorter/dist/js/',
                            src: [
                                'jquery.tablesorter.min.js',
                                'jquery.tablesorter.widgets.min.js',
                                'widgets/widget-grouping.min.js'
                            ],
                            expand: true,
                            dest: 'js/',
                            flatten: true
                        }
                    ]
                },
                ChartJS: {
                    files: [
                        {
                            cwd: 'node_modules/chart.js/dist/',
                            src: [
                                'Chart.min.js'
                            ],
                            expand: true,
                            dest: typo3_js,
                            flatten: true
                        },
                        {
                            cwd: 'node_modules/chart.js/dist/',
                            src: [
                                'Chart.min.js'
                            ],
                            expand: true,
                            dest: "js/",
                            flatten: true
                        }
                    ]
                },
                jqwidgets: {
                    files: [
                        {
                            cwd: 'node_modules/jqwidgets-framework/jqwidgets/',
                            src: [
                                'jqx-all.js',
                                'globalization/globalize.js'
                            ],
                            expand: true,
                            dest: typo3_js,
                            flatten: true
                        },
                        {
                            cwd: 'node_modules/jqwidgets-framework/jqwidgets/styles/',
                            src: [
                                'jqx.base.css',
                                'jqx.bootstrap.css'
                            ],
                            expand: true,
                            dest: typo3_css,
                            flatten: true
                        },
                        {
                            cwd: 'node_modules/jqwidgets-framework/jqwidgets/styles/',
                            src: [
                                'images/**'
                            ],
                            expand: true,
                            dest: typo3_css
                        }
                    ]
                },
                jqwidgets_devel: {
                    files: [
                        {
                            cwd: 'node_modules/jqwidgets-framework/jqwidgets/',
                            src: [
                                'jqx-all.js',
                                'globalization/globalize.js'
                            ],
                            expand: true,
                            dest: 'js/',
                            flatten: true
                        },
                        {
                            cwd: 'node_modules/jqwidgets-framework/jqwidgets/styles/',
                            src: [
                                'jqx.base.css',
                                'jqx.bootstrap.css'
                            ],
                            expand: true,
                            dest: 'css/',
                            flatten: true
                        },
                        {
                            cwd: 'node_modules/jqwidgets-framework/jqwidgets/styles/',
                            src: [
                                'images/**'
                            ],
                            expand: true,
                            dest: 'css/'
                        }
                    ]
                },
                tinymce: {
                    files: [
                        {
                            cwd: 'node_modules/tinymce/',
                            src: [
                                'tinymce.min.js'
                            ],
                            expand: true,
                            dest: typo3_js,
                            flatten: true
                        },
                        {
                            cwd: 'node_modules/tinymce/',
                            src: [
                                'themes/*/theme.min.js',
                                'plugins/*/plugin.min.js',
                                'skins/**'
                            ],
                            dest: typo3_js,
                            expand: true,
                            flatten: false
                        }
                    ]
                },
                tinymce_devel: {
                    files: [
                        {
                            cwd: 'node_modules/tinymce/',
                            src: [
                                'tinymce.min.js'
                            ],
                            expand: true,
                            dest: 'js/',
                            flatten: true
                        },
                        {
                            cwd: 'node_modules/tinymce/',
                            src: [
                                'themes/*/theme.min.js',
                                'plugins/*/plugin.min.js',
                                'skins/**'
                            ],
                            dest: 'js/',
                            expand: true,
                            flatten: false
                        }
                    ]
                },
                eventEmitter: {
                    files: [
                        {
                            cwd: 'node_modules/wolfy87-eventemitter/',
                            src: [
                                'EventEmitter.min.js'
                            ],
                            expand: true,
                            dest: typo3_js,
                            flatten: true
                        },
                        {
                            cwd: 'node_modules/wolfy87-eventemitter/',
                            src: [
                                'EventEmitter.min.js'
                            ],
                            expand: true,
                            dest: 'js/',
                            flatten: true
                        }
                    ]
                },
                fabric: {
                    files: [
                        {
                            cwd: 'javascript/',
                            src: [
                                'fabric.min.js'
                            ],
                            expand: true,
                            dest: typo3_js,
                            flatten: true
                        },
                        {
                            cwd: 'javascript/',
                            src: [
                                'fabric.min.js'
                            ],
                            expand: true,
                            dest: 'js/',
                            flatten: true
                        }
                    ]
                },
                typeahead: {
                    files: [
                        {
                            cwd: 'node_modules/corejs-typeahead/dist',
                            src: [
                                "typeahead.bundle.min.js"
                            ],
                            expand: true,
                            dest: typo3_js,
                            flatten: true
                        },
                        {
                            cwd: 'node_modules/corejs-typeahead/dist',
                            src: [
                                "typeahead.bundle.min.js"
                            ],
                            expand: true,
                            dest: 'js/',
                            flatten: true
                        }
                    ]
                },
                codemirror: {
                    files: [
                        {
                            cwd: 'node_modules/codemirror/lib',
                            src: [
                                "codemirror.js"
                            ],
                            expand: true,
                            dest: typo3_js,
                            flatten: true
                        },
                        {
                            cwd: 'node_modules/codemirror/lib',
                            src: [
                                "codemirror.js"
                            ],
                            expand: true,
                            dest: 'js/',
                            flatten: true
                        },
                        {
                            cwd: 'node_modules/codemirror/lib',
                            src: [
                                "codemirror.css"
                            ],
                            expand: true,
                            dest: typo3_css,
                            flatten: true
                        },
                        {
                            cwd: 'node_modules/codemirror/lib',
                            src: [
                                "codemirror.css"
                            ],
                            expand: true,
                            dest: 'css/',
                            flatten: true
                        },
                        {
                            cwd: 'node_modules/codemirror/mode',
                            src: [
                                "**"
                            ],
                            expand: true,
                            dest: typo3_js + "/code-mirror-mode",
                            flatten: false
                        },
                        {
                            cwd: 'node_modules/codemirror/mode',
                            src: [
                                "**"
                            ],
                            expand: true,
                            dest: "js/code-mirror-mode",
                            flatten: false
                        }
                    ]
    
                },
                qfqPlugins: {
                    files: [
                        {
                            src: js_plugins,
                            expand: true,
                            dest: "js/",
                            flatten: true
                        },
                        {
                            src: js_plugins,
                            expand: true,
                            dest: typo3_js,
                            flatten: true
                        }
                    ]
                },
                worker: {
                    files: [
                        {
                            src: js_worker,
                            expand: true,
                            dest: "js/Worker/",
                            flatten: true
                        },
                        {
                            src: js_worker,
                            expand: true,
                            dest: typo3_js,
                            flatten: true
                        },
                        {
                            src: js_worker,
                            expand: true,
                            dest: "mockup/Worker/",
                            flatten: true
                        }
                    ]
                }
            },
            uglify: {
                options: {
                    banner: '/*! <%= pkg.name %> <%= grunt.template.today("yyyy-mm-dd") %> */\n',
                },
                build: {
                    src: ['js/<%= pkg.name %>.debug.js'],
                    dest: typo3_js + '<%= pkg.name %>.min.js'
                },
                qfqFabric: {
                    src: ['javascript/src/Plugins/qfq.fabric.js'],
                    dest: typo3_js + 'qfq.fabric.min.js'
                }
            },
            jshint: {
                all: js_sources
            },
            concat_in_order: {
                debug_standalone: {
                    options: {
                        extractRequired: function (filepath, filecontent) {
                            var workingdir = path.normalize(filepath).split(path.sep);
                            workingdir.pop();
    
                            var deps = this.getMatches(/\*\s*@depend\s(.*\.js)/g, filecontent);
                            deps.forEach(function (dep, i) {
                                var dependency = workingdir.concat([dep]);
                                deps[i] = path.join.apply(null, dependency);
                            });
                            return deps;
                        },
                        extractDeclared: function (filepath) {
                            return [filepath];
                        },
                        onlyConcatRequiredFiles: false
                    },
                    files: {
                        'js/<%= pkg.name %>.debug.js': js_sources
                    }
                },
                debug_extension: {
                    options: {
                        extractRequired: function (filepath, filecontent) {
                            var workingdir = path.normalize(filepath).split(path.sep);
                            workingdir.pop();
    
                            var deps = this.getMatches(/\*\s*@depend\s(.*\.js)/g, filecontent);
                            deps.forEach(function (dep, i) {
                                var dependency = workingdir.concat([dep]);
                                deps[i] = path.join.apply(null, dependency);
                            });
                            return deps;
                        },
                        extractDeclared: function (filepath) {
                            return [filepath];
                        },
                        onlyConcatRequiredFiles: false
                    },
                    files: {
                        'extension/Resources/Public/JavaScript/<%= pkg.name %>.debug.js': js_sources
                    }
                }
            },
            less: {
                production: {
                    files: {
                        "extension/Resources/Public/Css/qfq-bs.css": "less/qfq-bs.css.less",
                        "extension/Resources/Public/Css/qfq-letter.css": "less/qfq-letter.css.less",
                        "extension/Resources/Public/Css/qfq-plain.css": "less/qfq-plain.css.less",
                        "extension/Resources/Public/Css/bs-tablesorter.css": "less/bs-tablesorter.less"
                    },
                    options: {
                        compress: true
                    }
                },
                devel: {
                    files: {
                        "css/qfq-bs.css": "less/qfq-bs.css.less",
                        "css/qfq-letter.css": "less/qfq-letter.css.less",
                        "css/qfq-plain.css": "less/qfq-plain.css.less",
                        "css/bs-tablesorter.css": "less/bs-tablesorter.less"
                    },
                    options: {
                        banner: "/* Change qfq-bs.css.less, not qfq-bs.css */"
                    }
                }
            },
            jasmine: {
                unit: {
                    src: ['tests/jasmine/unit/spec/*Spec.js'],
                    options: {
                        vendor: [
                            'js/jquery.min.js',
                            'js/bootstrap.min.js',
                            'js/EventEmitter.min.js',
                            'js/jqx-all.js',
                            'js/qfq.debug.js'
                        ],
                        helpers: ['tests/jasmine/helper/mock-ajax.js'],
                        template: 'tests/jasmine/unit/SpecRunner.tmpl'
                    }
                }
            },
            watch: {
                scripts: {
                    files: js_sources.concat(['less/*.less']),
                    tasks: ['default'],
                    options: {
                        spawn: true
                    }
                }
            }
    
        });
    
        // Load the plugin that provides the "uglify" task.
        grunt.loadNpmTasks('grunt-contrib-uglify');
        grunt.loadNpmTasks('grunt-contrib-copy');
        grunt.loadNpmTasks('grunt-contrib-concat');
        grunt.loadNpmTasks('grunt-concat-in-order');
        grunt.loadNpmTasks('grunt-contrib-jshint');
        grunt.loadNpmTasks('grunt-contrib-watch');
        grunt.loadNpmTasks('grunt-contrib-less');
        grunt.loadNpmTasks('grunt-contrib-jasmine');
    
        // Default task(s).
        grunt.registerTask('default', ['jshint', 'concat_in_order', 'uglify', 'copy', 'less']);
    
        grunt.registerTask('run-jasmine', ['jshint', 'concat_in_order', 'jasmine']);
    
    };