forked from Erikmitk/kitodo-workflow-editor
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Gruntfile.js
160 lines (143 loc) · 4.08 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
var path = require('path');
module.exports = function(grunt) {
require('load-grunt-tasks')(grunt);
/**
* Resolve external project resource as file path
*/
function resolvePath(project, file) {
return path.join(path.dirname(require.resolve(project)), file);
}
grunt.initConfig({
browserify: {
options: {
browserifyOptions: {
debug: false
},
transform: [
[ 'stringify', { extensions: [ '.bpmn' ] } ],
[ 'babelify', { global: true, 'presets': ['@babel/preset-env'] }]
],
banner: '/**\n * (c) Kitodo. Key to digital objects e. V. <contact@kitodo.org>\n *\n * This file is part of the Kitodo project.\n *\n * It is licensed under MIT License by camunda Services GmbH\n *\n * For the full copyright and license information, please read the\n * Camunda-License.txt file that was distributed with this source code.\n*/\n\n\n'
},
src: {
files: {
'build/modeler.js': [ 'src/**/*.js', '!src/js/**/*.*', '!src/language/**/*.*' ]
}
},
},
copy: {
bpmn_assets: {
files: [
{
expand: true,
cwd: resolvePath('bpmn-js', 'dist/assets'),
src: ['**/*.*', '!**/font/**/*.*', '!**/*.js', '!**/bpmn-codes.css', '!**/bpmn.css'],
dest: 'build/vendor'
}
]
},
localization: {
files: [
{
expand: true,
cwd: 'src/language/',
src: ['*.js'],
dest: 'build/language'
}
]
},
src_assets: {
files: [
{
expand: true,
cwd: 'src/',
src: ['**/*.*', '!**/*.js', '!**/*.json'],
dest: 'dist'
}
]
},
custom_js: {
files: [ {
expand: true,
cwd: 'src/js/',
src: ['modeler_custom.js'],
dest: 'dist/js'
}
]
}
},
less: {
options: {
dumpLineNumbers: 'comments',
paths: [
'node_modules'
]
},
styles: {
files: {
'build/css/src.css': 'styles/src.less'
}
}
},
uglify: {
modeler: {
options: {
mangle:false,
compress: true,
preserveComments: true,
yuicompress: true,
optimization: 2,
banner: '/**\n * (c) Kitodo. Key to digital objects e. V. <contact@kitodo.org>\n *\n * This file is part of the Kitodo project.\n *\n * It is licensed under MIT License by camunda Services GmbH\n *\n * For the full copyright and license information, please read the\n * Camunda-License.txt file that was distributed with this source code.\n*/\n\n'
},
files: {
'dist/js/modeler_min.js' : ['build/modeler.js', 'build/language/*.js']
}
}
},
concat: {
css: {
src: 'build/**/*.css',
dest: 'dist/css/modeler.css',
options: {
banner: '/**\n * (c) Kitodo. Key to digital objects e. V. <contact@kitodo.org>\n *\n * This file is part of the Kitodo project.\n *\n * It is licensed under MIT License by camunda Services GmbH\n *\n * For the full copyright and license information, please read the\n * Camunda-License.txt file that was distributed with this source code.\n*/\n\n'
}
}
},
watch: {
assets: {
files: [ 'src/**/*.*' ],
tasks: [ 'copy:src_assets', 'copy:custom_js' , 'copy:localization']
},
less: {
files: [
'styles/**/*.less',
'node_modules/bpmn-js-properties-panel/styles/**/*.less'
],
tasks: [
'less',
'concat:css'
]
},
js: {
files : [ 'src/**/*.js'],
tasks : ['browserify:src','uglify']
}
}
});
grunt.registerTask('build', [
'copy',
'less',
'concat:css',
'browserify:src',
'uglify'
]);
grunt.registerTask('auto-build', [
'copy',
'less',
'concat:css',
'browserify:src',
'uglify',
'watch'
]);
grunt.registerTask('default', [ 'auto-build' ]);
};