This repository has been archived by the owner on Jul 3, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
gruntfile.js
119 lines (115 loc) · 3.52 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
/* jshint node: true*/
'use strict';
module.exports = function(grunt) {
var target = grunt.option('target') || 'http://localhost:5000',
port = process.env.PORT || 5000,
files = {
js: [
'gruntfile.js',
'public/**/*.js',
'public/**/*.json',
'*.json'
],
html: [
'public/**/*.html'
],
css: [
'public/**/*.css'
]
};
grunt.initConfig({
watch: {
code: {
files: [].concat(files.html, files.css, files.js),
tasks: [],
options: {
livereload: true
}
},
livereload: {
options: {
open: true,
base: [
'public'
]
},
files: [].concat(files.html, files.css, files.js)
}
},
connect: {
options: {
port: port,
// Change this to '0.0.0.0' to access the server from outside.
hostname: '0.0.0.0',
livereload: 35729
},
livereload: {
options: {
open: false,
base: [
'public'
]
}
}
},
openfin: {
options: {
configPath: target + '/app.json',
config: {
create: false,
filePath: 'public/app.json',
options: {
startup_app: {
url: target + '/index.html',
applicationIcon: target + '/favicon.ico'
},
appAssets: [{
src: target + '/service.zip',
version: '0.2.0',
alias: 'node-service',
target: 'node_6.5.0.exe'
}],
runtime: {
version: 'beta'
},
shortcut: {
icon: target + '/favicon.ico'
}
}
}
},
serve: {
open: true
}
},
compress: {
build: {
options: {
archive: 'public/service.zip'
},
files: [
{
expand: true,
cwd: 'node-service/',
src: ['**'],
dest: '/'
}
]
}
},
clean: {
all: [
'public/service.zip'
]}
});
// Write a batch file that the app config will be pointing to to start the server
grunt.registerTask('write_batch_file', function() {
grunt.file.write('node-service/service.bat', 'node_6.5.0.exe index.js');
});
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-contrib-connect');
grunt.loadNpmTasks('grunt-openfin');
grunt.loadNpmTasks('grunt-contrib-compress');
grunt.loadNpmTasks('grunt-contrib-clean');
grunt.registerTask('serve', ['clean', 'compress', 'connect:livereload', 'openfin:serve', 'watch']);
};