Gruntfile.js   A
last analyzed

Complexity

Total Complexity 1
Complexity/F 1

Size

Lines of Code 144
Function Count 1

Duplication

Duplicated Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
cc 0
c 1
b 0
f 1
nc 1
dl 0
loc 144
rs 10
wmc 1
mnd 0
bc 1
fnc 1
bpm 1
cpm 1
noi 0
1
module.exports = function (grunt) {
2
    var jsResources = [];
3
4
    // Project configuration.
5
    grunt.initConfig({
6
        jsResources: [],
7
        cssResources: [],
8
        pkg: grunt.file.readJSON('package.json'),
9
        jshint: {
10
            options: {
11
                reporter: require('jshint-stylish'),
12
                curly: false,
13
                eqeqeq: true,
14
                eqnull: true,
15
                browser: true,
16
                globals: {
17
                    "angular": true,
18
                    "PassmanImporter": true,
19
                    "PassmanExporter": true,
20
                    "OC": true,
21
                    "window": true,
22
                    "console": true,
23
                    "CRYPTO": true,
24
                    "C_Promise": true,
25
                    "forge": true,
26
                    "sjcl": true,
27
                    "jQuery": true,
28
                    "$": true,
29
                    "_": true,
30
                    "oc_requesttoken": true
31
                }
32
            },
33
            all: ['js/*', '!js/vendor']
34
        },
35
        sass: {
36
            options: {
37
                sourceMap: true
38
            },
39
            dist: {
40
                files: {
41
                    'css/auto-login-popup.css': 'style/auto-login-popup.scss',
42
                    'css/browser_action.css': 'style/browser_action.scss',
43
                    'css/doorhanger.css': 'style/doorhanger.scss',
44
                    'css/doorhanger-iframe.css': 'style/doorhanger-iframe.scss',
45
                    'css/main.css': 'style/main.scss',
46
                    'css/password_picker.css': 'style/password_picker.scss',
47
                }
48
            }
49
        },
50
        watch: {
51
            scripts: {
52
                files: ['style/**/*.scss', 'style/*.scss'],
53
                tasks: ['sass'],
54
                options: {
55
                    spawn: false
56
                }
57
            }
58
        },
59
        mkdir: {
60
            dist: {
61
                options: {
62
                    mode: 0700,
63
                    create: ['dist']
64
                }
65
            }
66
        },
67
        copy: {
68
            dist: {
69
                src: [
70
                    '**',
71
                    '*.xpi',
72
                    '!fixLocale.js',
73
                    '!tests/*/**/*',
74
                    '!tests/*',
75
                    '!tests',
76
                    '!style/*/**/*',
77
                    '!style/*',
78
                    '!style',
79
                    '!node_modules/*',
80
                    '!node_modules/**',
81
                    '!dist/**',
82
                    '!dist/*',
83
                    '!.drone.yml',
84
                    '!.gitignore',
85
                    '!.jshintrc',
86
                    '!.scrutinizer.yml',
87
                    '!.travis.yml',
88
                    '!Gruntfile.js',
89
                    '!karma.conf.js',
90
                    '!launch_phpunit.sh',
91
                    '!Makefile',
92
                    '!package.json',
93
                    '!phpunit.*',
94
                    '!Dockerfile',
95
                    '!*.md',
96
                    '!*.zip',
97
                    '!swagger.yaml',
98
                    '!.tx'
99
                ],
100
                dest: 'dist/'
101
            }
102
        },
103
        karma: {
104
            unit: {
105
                configFile: './karma.conf.js',
106
                background: false
107
            }
108
        },
109
        compress: {
110
            dist: {
111
                options: {
112
                    archive: 'extension.zip'
113
                },
114
                files: [
115
                    {src: ['**'], dest: '.', cwd: 'dist/'}, // includes files in path
116
                ]
117
            }
118
        },
119
        clean: {
120
            dist: ['dist']
121
        },
122
        execute: {
123
            fixLocale: {
124
                src: ['fixLocale.js']
125
            }
126
        }
127
    });
128
129
    grunt.loadNpmTasks('grunt-mkdir');
130
    grunt.loadNpmTasks('grunt-contrib-compress');
131
    grunt.loadNpmTasks('grunt-contrib-copy');
132
    grunt.loadNpmTasks('grunt-contrib-jshint');
133
    grunt.loadNpmTasks('grunt-contrib-clean');
134
    grunt.loadNpmTasks('grunt-execute');
135
    grunt.loadNpmTasks('grunt-karma');
136
    grunt.loadNpmTasks('grunt-sass');
137
    grunt.loadNpmTasks('grunt-contrib-watch');
138
    // Default task(s).
139
140
    grunt.registerTask('test', ['karma', 'jshint']);
141
    grunt.registerTask('build', ['execute:fixLocale', 'sass', 'jshint', 'clean:dist', 'mkdir:dist', 'copy:dist', 'compress:dist']);
142
    grunt.registerTask('dist', ['']);
143
144
};
145