forked from passbolt/passbolt_api
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Gruntfile.js
179 lines (171 loc) · 5.72 KB
/
Gruntfile.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
/**
* Passbolt ~ Open source password manager for teams
* Copyright (c) Passbolt SA (https://www.passbolt.com)
*
* Licensed under GNU Affero General Public License version 3 of the or any later version.
* For full copyright and license information, please see the LICENSE.txt
* Redistributions of files must retain the above copyright notice.
*
* @copyright Copyright (c) Passbolt SA (https://www.passbolt.com)
* @license https://opensource.org/licenses/AGPL-3.0 AGPL License
* @link https://www.passbolt.com Passbolt(tm)
* @since 2.0.0
*/
var path = require('path');
/**
* This Gruntfile provides tasks and commands to build and distribute the project
*
* @param grunt object
*/
module.exports = function(grunt) {
/**
* Path shortcuts
* @type object
*/
var paths = {
node_modules: 'node_modules/',
node_modules_styleguide: 'node_modules/passbolt-styleguide/',
webroot: 'webroot/',
img: 'webroot/img/',
css: 'webroot/css/',
js: 'webroot/js/',
locales: 'resources/locales/',
cakephp_locales: 'vendor/cakephp/localized/resources/locales/'
};
/**
* Import package.json file content
* Allow to get access to version and project name for example
*/
var pkg = grunt.file.readJSON('package.json');
/**
* Load baseline NPM tasks
*/
grunt.loadNpmTasks('grunt-contrib-copy');
grunt.loadNpmTasks('grunt-contrib-watch');
/**
* Register project specific grunt tasks
*/
grunt.registerTask('default', ['dependencies-update', 'styleguide-update']);
grunt.registerTask('styleguide-update', 'copy:styleguide');
grunt.registerTask('styleguide-watch', ['watch:node-modules-styleguide']);
grunt.registerTask('dependencies-update', 'copy:dependencies');
/**
* Tasks definition
*/
grunt.initConfig({
pkg: pkg,
copy: {
dependencies: {
files: [{
// Openpgp
cwd: paths.node_modules + 'openpgp/dist',
src: ['openpgp.min.js'],
dest: paths.js + 'vendors',
expand: true
}, {
// jQuery
cwd: paths.node_modules + 'jquery/dist',
src: ['jquery.min.js'],
dest: paths.js + 'vendors',
expand: true
}]
},
styleguide: {
files: [{
// Fonts
cwd: paths.node_modules_styleguide + 'src/fonts',
src: '*',
dest: paths.webroot + 'fonts',
expand: true
}, {
// Images for webroots (favicons, etc.)
cwd: paths.node_modules_styleguide + 'src/img/webroot',
src: '*',
dest: paths.webroot,
expand: true
}, {
// Images
cwd: paths.node_modules_styleguide + 'src/img',
src: [
// Default Avatars
'avatar/**',
// Passbolt logos
'logo/icon-20_white.png', 'logo/icon-20_grey.png', 'logo/icon-20.png',
'logo/icon-48_white.png', 'logo/icon-48.png',
'logo/logo.png', 'logo/[email protected]', 'logo/logo.svg', 'logo/logo_white.svg', 'logo/logo_white.png',
// Image for inputs and controls
'controls/check_black.svg',
'controls/check_white.svg',
'controls/chevron-down_black.svg',
'controls/chevron-down_white.svg',
'controls/dot_white.svg',
'controls/dot_red.svg',
'controls/dot_black.svg',
'controls/infinite-bar.gif',
'controls/loading_light.svg',
'controls/loading_dark.svg',
'controls/overlay-opacity-50.png',
'controls/success.svg',
'controls/error.svg',
'controls/warning.svg',
// Login page 3rd party logo
'third_party/firefox_logo.png',
'third_party/FirefoxAMO_black.svg',
'third_party/FirefoxAMO_white.svg',
'third_party/ChromeWebStore_black.svg',
'third_party/ChromeWebStore_white.svg',
'third_party/edge-addon-black.svg',
'third_party/edge-addon-white.svg',
'third_party/chosen-sprite.png',
'third_party/[email protected]',
// Setup
'illustrations/email.png',
// Themes preview
'themes/*.png',
],
dest: paths.webroot + 'img',
expand: true
}, {
// CSS
cwd: paths.node_modules_styleguide + 'build/css/themes/default',
src: ['api_main.min.css', 'api_authentication.min.css', 'ext_authentication.min.css'],
dest: paths.webroot + 'css/themes/default',
expand: true
}, {
// Midgar css theme
cwd: paths.node_modules_styleguide + 'build/css/themes/midgar',
src: ['api_main.min.css', 'api_authentication.min.css', 'ext_authentication.min.css'],
dest: paths.webroot + 'css/themes/midgar',
expand: true
},{
// Translation files
cwd: paths.node_modules_styleguide + 'src/locales',
src: ['**'],
dest: paths.webroot + 'locales',
expand: true
}, {
// Javascript applications
cwd: paths.node_modules_styleguide + 'build/js/dist',
src: ['api-account-recovery.js', 'api-app.js', 'api-recover.js', 'api-setup.js', 'api-triage.js', 'api-vendors.js'],
dest: paths.js + 'app',
expand: true
},]
},
locales: {
// CakePHP Locale Resources
files: [{
cwd: paths.cakephp_locales,
src: ['fr_FR/*.po'],
dest: paths.locales,
expand: true
}]
}
},
watch: {
'node-modules-styleguide': {
files: [paths.node_modules_styleguide + 'build/**/*'],
tasks: ['styleguide-update']
}
}
});
};