-
Notifications
You must be signed in to change notification settings - Fork 0
/
Gruntfile.js
133 lines (121 loc) · 4 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
module.exports = function(grunt) {
// Do grunt-related things in here
// Project configuration.
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
settings: {
banner:['/**',
'* <%= pkg.name %> ',
'* <%= pkg.description %> ',
'* Author: <%= pkg.author %> ',
'* Version: <%= pkg.version %> ',
'* Date: <%= grunt.template.today("yyyy-mm-dd") %> ',
'* Project github: <%= pkg.homepage %>',
'* License: <%= pkg.license %> ',
'*/'].join('\n'),
dirs: {
src: 'src/',
dest:'build/'
}
},
// concat task
concat: {
options: {
banner:['<%= settings.banner %>',
'(function (window, angular) {',
''].join('\n'),
footer:['',
'})(window, window.angular);'].join('\n')
},
build: {
src: ['<%= settings.dirs.src %><%= pkg.name %>.js'],
dest: '<%= settings.dirs.dest %><%= pkg.name %>.js'
}
},
// uglify task
uglify: {
options: {
banner: '<%= settings.banner %>',
sourceMap: true
},
build: {
src: ['<%= concat.build.dest %>'],
dest: '<%= settings.dirs.dest %><%= pkg.name %>.min.js'
}
},
bower: {
install: {
options: {
install: true,
copy: false,
targetDir: 'bower_components',
cleanTargetDir: true
}
}
},
jshint: {
all: [ 'Gruntfile.js', 'src/angular-window-storage.js', 'build/angular-window-storage.js' ]
},
karma: {
options: {
configFile: 'test/karma.conf.js'
},
unit: {
singleRun: true
},
continuous: {
singleRun: false,
autoWatch: true
}
},
nugetpack: {
advanced: {
options: {
id: '<%= pkg.name %>',
version: '<%= pkg.version %>',
authors: '<%= pkg.author %>',
description: '<%= pkg.description %>',
releaseNotes: 'Cookie chunking, encoders and decoders function by parameter bringing the possibility for third party compressors.',
summary: 'Easy interface to use web storage and cookies allowing old browsers to default to cookies when web storage not supported.',
language: 'en-us',
projectUrl: '<%= pkg.homepage %>',
licenseUrl: 'https://github.com/JoseCMRocha/angular-window-storage/blob/master/LICENSE',
//copyright: 'Copyright (c) 2017 <%= pkg.author %>',
requireLicenseAcceptance: true,
tags: 'angularjs, angular, session, local, storage, window, cookie, localStorage, sessionStorage, document',
outputDir: 'nuget'
},
files: [
{src: "<%= concat.build.dest %>", dest: "/content/scripts/<%= pkg.name %>/<%= pkg.name %>.js"},
{src: "<%= settings.dirs.dest %><%= pkg.name %>.min.js", dest: "/content/scripts/<%= pkg.name %>/<%= pkg.name %>.min.js"}
]
}
}
});
// Load the plugin that provides the "concat" task.
// Responsible for file concatenation.
grunt.loadNpmTasks('grunt-contrib-concat');
// Load the plugin that provides the "uglify" task.
// Responsible for file minification.
grunt.loadNpmTasks('grunt-contrib-uglify');
// Load the plugin that provides the "jshint" task.
// Responsible for validate code quality
grunt.loadNpmTasks('grunt-contrib-jshint');
// Load the plugin that provides the "bower" task.
// Responsible for automatically retrieve the latest Bower dependencies
grunt.loadNpmTasks('grunt-bower-task');
// Load the plugin that provides the "karma" task.
// Responsible for execute karma inside grunt ... tests
grunt.loadNpmTasks('grunt-karma');
// Load the plugin that provides the "nugget" task.
// to publish to the nugget
grunt.loadNpmTasks('grunt-nuget-pack');
// Test task(s).
grunt.registerTask('test', ['bower', 'concat', 'jshint', 'karma:unit']);
// Default task(s).
grunt.registerTask('default', ['bower', 'concat', 'jshint', 'karma:unit', 'uglify']);
// nuget publish
grunt.registerTask('nuget-pack', ['default', 'nugetpack:advanced']);
// skip tests
grunt.registerTask('skip-tests', ['bower', 'concat', 'jshint', 'uglify']);
};