-
Notifications
You must be signed in to change notification settings - Fork 0
/
Gruntfile.js
147 lines (137 loc) · 3.47 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
/**
* Gruntfile for freedom-social-wechat
*
* This repository allows WeChat to be used
* as a freedomjs social provider.
**/
var path = require('path');
var freedomChromePath = path.dirname(require.resolve(
'freedom-for-chrome/package.json'));
var freedomFirefoxPath = path.dirname(require.resolve(
'freedom-for-firefox/package.json'));
module.exports = function(grunt) {
grunt.initConfig({
// NOTE - some copy commands are written in order, i.e. depend on previous
copy: {
dist: {
src: ['src/*.js*'],
dest: 'dist/',
flatten: true,
filter: 'isFile',
expand: true,
onlyIf: 'modified'
},
freedom: {
src: [require.resolve('freedom')],
dest: 'build/demo/webapp/',
flatten: true,
filter: 'isFile',
expand: true,
onlyIf: 'modified'
},
freedomForChrome: {
cwd: freedomChromePath,
src: ['freedom-for-chrome.js*'],
dest: 'build/demo/chrome_app/',
flatten: true,
filter: 'isFile',
expand: true,
onlyIf: 'modified'
},
freedomForFirefox: {
cwd: freedomFirefoxPath,
src: ['freedom-for-firefox.jsm'],
dest: 'build/demo/firefox_addon/data/',
flatten: true,
filter: 'isFile',
expand: true,
onlyIf: 'modified'
},
demoMain: {
cwd: 'src/demo/',
src: ['**/**'],
dest: 'build/demo/',
flatten: false,
filter: 'isFile',
expand: true,
onlyIf: 'modified'
},
chromeDemo: {
src: ['dist/*.js*', 'build/demo/common/*'],
dest: 'build/demo/chrome_app/',
flatten: true,
filter: 'isFile',
expand: true,
onlyIf: 'modified'
},
webappDemo: {
src: ['dist/*.js*', 'build/demo/common/*'],
dest: 'build/demo/webapp/',
flatten: true,
filter: 'isFile',
expand: true,
onlyIf: 'modified'
},
firefoxDemo: {
src: ['build/demo/webapp/*'],
dest: 'build/demo/firefox_addon/data/',
flatten: true,
filter: 'isFile',
expand: true,
onlyIf: 'modified'
},
simple_chrome: {
cwd: 'node_modules',
src: ['freedom-for-chrome/**/*'],
dest: 'build/demo/simple_chrome/',
flatten: false,
expand: true,
onlyIf: 'modified'
}
},
browserify: {
dist: {
src: ['src/wechat-social-provider.js'],
dest: 'dist/wechat-social-provider.static.js'
},
simple_chrome: {
src: ['src/demo/simple_chrome/background.core-env.js'],
dest: 'build/demo/simple_chrome/background.core-env.static.js'
}
},
jshint: {
all: ['src/**/*.js'],
options: {
jshintrc: true
}
},
connect: {
demo: {
options: {
port: 8000,
keepalive: true,
base: ['./', 'build/demo/webapp'],
open: 'http://localhost:8000/main.html'
}
}
},
clean: ['build/', 'dist/']
});
grunt.loadNpmTasks('grunt-contrib-clean');
grunt.loadNpmTasks('grunt-contrib-connect');
grunt.loadNpmTasks('grunt-contrib-copy');
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-browserify');
grunt.registerTask('build', [
'jshint',
'browserify',
'copy'
]);
grunt.registerTask('webapp_demo', [
'build',
'connect'
]);
grunt.registerTask('default', [
'build'
]);
}