forked from IjzerenHein/famous-flex
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Gruntfile.js
155 lines (152 loc) · 5.18 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
/*global module:false*/
module.exports = function(grunt) {
// Project configuration.
grunt.initConfig({
watch: {
source: {
spawn: false,
debounceDelay: 1000,
atBegin: true,
files: ['src/**/*.js'],
tasks: ['lint', 'build']
}
},
eslint: {
target: ['src/**/*.js'],
options: {
config: '.eslintrc'
}
},
jscs: {
src: ['src/**/*.js'],
options: {
config: '.jscsrc'
}
},
csslint: {
strict: {
options: {
import: 2
},
src: ['src/**/*.css']
},
lax: {
options: {
import: false
},
src: ['src/**/*.css']
},
options: {
csslintrc: '.csslintrc'
}
},
jsdoc2md: {
separateOutputFilePerInput: {
options: {
index: true
},
files: [
// core
{ src: 'src/LayoutContext.js', dest: 'docs/LayoutContext.md' },
{ src: 'src/LayoutController.js', dest: 'docs/LayoutController.md' },
{ src: 'src/ScrollController.js', dest: 'docs/ScrollController.md' },
{ src: 'src/FlexScrollView.js', dest: 'docs/FlexScrollView.md' },
{ src: 'src/LayoutUtility.js', dest: 'docs/LayoutUtility.md' },
{ src: 'src/VirtualViewSequence.js', dest: 'docs/VirtualViewSequence.md' },
{ src: 'src/LinkedListViewSequence.js', dest: 'docs/LinkedListViewSequence.md' },
{ src: 'src/AnimationController.js', dest: 'docs/AnimationController.md' },
// widgets
{ src: 'src/widgets/DatePicker.js', dest: 'docs/widgets/DatePicker.md' },
{ src: 'src/widgets/TabBar.js', dest: 'docs/widgets/TabBar.md' },
{ src: 'src/widgets/TabBarController.js', dest: 'docs/widgets/TabBarController.md' },
// helpers
{ src: 'src/helpers/LayoutDockHelper.js', dest: 'docs/helpers/LayoutDockHelper.md' },
// layouts
{ src: 'src/layouts/CollectionLayout.js', dest: 'docs/layouts/CollectionLayout.md' },
{ src: 'src/layouts/GridLayout.js', dest: 'docs/layouts/GridLayout.md' },
{ src: 'src/layouts/ListLayout.js', dest: 'docs/layouts/ListLayout.md' },
{ src: 'src/layouts/HeaderFooterLayout.js', dest: 'docs/layouts/HeaderFooterLayout.md' },
{ src: 'src/layouts/NavBarLayout.js', dest: 'docs/layouts/NavBarLayout.md' },
{ src: 'src/layouts/WheelLayout.js', dest: 'docs/layouts/WheelLayout.md' },
{ src: 'src/layouts/CoverLayout.js', dest: 'docs/layouts/CoverLayout.md' },
{ src: 'src/layouts/ProportionalLayout.js', dest: 'docs/layouts/ProportionalLayout.md' },
{ src: 'src/layouts/TabBarLayout.js', dest: 'docs/layouts/TabBarLayout.md' }
]
}
},
requirejs: {
compile: {
options: {
baseUrl: '.',
name: 'template.js',
out: 'dist/famous-flex.js',
paths: {
'famous': 'empty:',
'famous-flex': './src'
},
optimize: 'none'
}
}
},
browserify: {
dist: {
files: {
'./dist/famous-flex-global.js': ['./template-global.js']
},
options: {
transform: ['browserify-shim']
}
}
},
uglify: {
noglobal: {
src: './dist/famous-flex.js',
dest: './dist/famous-flex.min.js'
},
global: {
src: './dist/famous-flex-global.js',
dest: './dist/famous-flex-global.min.js'
}
},
usebanner: {
dist: {
options: {
position: 'top',
banner:
'/**\n' +
'* This Source Code is licensed under the MIT license. If a copy of the\n' +
'* MIT-license was not distributed with this file, You can obtain one at:\n' +
'* http://opensource.org/licenses/mit-license.html.\n' +
'*\n' +
'* @author: Hein Rutjes (IjzerenHein)\n' +
'* @license MIT\n' +
'* @copyright Gloey Apps, 2014/2015\n' +
'*\n' +
'* @library famous-flex\n' +
'* @version ' + grunt.file.readJSON('package.json').version + '\n' +
'* @generated <%= grunt.template.today("dd-mm-yyyy") %>\n' +
'*/'
},
files: {
src: ['dist/*.js']
}
}
}
});
// These plugins provide necessary tasks.
grunt.loadNpmTasks('grunt-eslint');
grunt.loadNpmTasks('grunt-jscs');
grunt.loadNpmTasks('grunt-contrib-csslint');
grunt.loadNpmTasks('grunt-jsdoc-to-markdown');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-contrib-requirejs');
grunt.loadNpmTasks('grunt-browserify');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-banner');
// Tasks
grunt.registerTask('lint', ['eslint', 'jscs', 'csslint']);
grunt.registerTask('doc', ['jsdoc2md']);
grunt.registerTask('dist', ['requirejs', 'browserify', 'uglify', 'usebanner']);
grunt.registerTask('develop', ['watch:source']); // Develop: Watches source files. Trigger lint & build upon change.
grunt.registerTask('default', ['lint', 'doc', 'dist']);
};