-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathGruntfile.js
116 lines (111 loc) · 2.66 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
'use strict'
const dotenv = require('dotenv')
dotenv.config()
module.exports = function (grunt) {
grunt.initConfig({
manifest: grunt.file.readJSON('manifest.json'),
buildDir: './build',
eslint: {
src: [
'main.js',
'lib',
'scripts',
'Gruntfile.js',
'tasks'
],
options: {
configFile: '.eslintrc.json',
format: 'json',
outputFile: './test/reports/eslint-report.json'
}
},
copy: {
lib: {
files: [
{
expand: true,
src: 'lib/**/*.js',
dest: '<%= buildDir %>'
}
]
},
main: {
files: [
{
expand: true,
src: [
'scripts/**',
'LICENSE',
'main.js',
'manifest.json',
'package.json',
'README.md',
'reporters.json'
],
dest: '<%= buildDir %>'
}
]
}
},
clean: {
build: ['build'],
dist: ['dist']
},
uninstall: {
command: ['build', 'foxx', 'uninstall'],
options: {
'--server': process.env.ARANGO_SERVER
},
args: [process.env.MOUNT_POINT]
},
install: {
command: ['build', 'foxx', 'install'],
options: {
'--server': process.env.ARANGO_SERVER
},
args: [process.env.MOUNT_POINT]
},
replace: {
command: ['build', 'foxx', 'replace'],
options: {
'--server': process.env.ARANGO_SERVER
},
args: [process.env.MOUNT_POINT]
},
bundle: {
command: ['build', 'foxx', 'bundle'],
options: {
'--outfile': '../dist/foxx-tracer-collector-<%= manifest.version %>.zip'
},
flags: ['-f']
},
installSvcDeps: {
command: ['build', 'npm', 'install'],
options: {
'--only': 'prod'
},
flags: ['--no-package-lock', '--no-audit', '--prefer-offline']
},
exec: {
root: {
cmd: function (command, ...params) {
return `${command} ${params.join(' ')}`
}
},
build: {
cwd: '<%= buildDir %>',
cmd: function (command, ...params) {
return `${command} ${params.join(' ')}`
}
}
}
})
grunt.loadNpmTasks('gruntify-eslint')
grunt.loadNpmTasks('grunt-exec')
grunt.loadNpmTasks('grunt-contrib-copy')
grunt.loadNpmTasks('grunt-contrib-clean')
grunt.loadTasks('tasks')
grunt.registerTask('build', ['copy:lib', 'copy:main', 'installSvcDeps'])
grunt.registerTask('initialize', ['build', 'uninstall', 'install'])
grunt.registerTask('dist', ['build', 'mkdir:dist', 'bundle'])
}