Skip to content

Commit 790f70d

Browse files
Ben RubinBen Rubin
authored andcommitted
create release build process
1 parent 790888c commit 790f70d

File tree

4 files changed

+101
-5
lines changed

4 files changed

+101
-5
lines changed

gulp/cssBuild.js

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,26 @@ var rename = require('gulp-rename');
1010

1111

1212
exports.dev = function () {
13-
1413
return gulp.src(paths.css)
1514
.pipe(sass())
1615
.pipe(autoprefixer())
1716
.pipe(gulp.dest(paths.docs))
1817
.on('end', function() {
1918
gutil.log(gutil.colors.green('✔ CSS Dev'), 'Finished');
2019
});
21-
}
20+
};
21+
22+
23+
exports.release = function () {
24+
return gulp.src(paths.css)
25+
.pipe(sass())
26+
.pipe(autoprefixer())
27+
.pipe(concat('angular-material-tree.css'))
28+
.pipe(gulp.dest(paths.dist))
29+
.pipe(cssnano())
30+
.pipe(rename('angular-material-tree.min.css'))
31+
.pipe(gulp.dest(paths.dist))
32+
.on('end', function() {
33+
gutil.log(gutil.colors.green('✔ CSS Release'), 'Finished');
34+
});
35+
};

gulp/jsBuild.js

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ var ngAnnotate = require('gulp-ng-annotate');
1313

1414

1515
exports.dev = function () {
16-
1716
return gulp.src(paths.scripts)
1817
.pipe(wrap('(function(){"use strict";<%= contents %>}());'))
1918
.pipe(jshint())
@@ -22,4 +21,21 @@ exports.dev = function () {
2221
.on('end', function() {
2322
gutil.log(gutil.colors.green('✔ JS Dev'), 'Finished');
2423
});
25-
}
24+
};
25+
26+
exports.release = function () {
27+
return gulp.src(paths.scripts)
28+
.pipe(wrap('(function(){"use strict";<%= contents %>}());'))
29+
.pipe(ngAnnotate())
30+
.pipe(jshint())
31+
.pipe(jshint.reporter('default'))
32+
.pipe(concat('angular-material-tree.js'))
33+
.pipe(stripDebug())
34+
.pipe(gulp.dest(paths.dist))
35+
.pipe(uglify())
36+
.pipe(rename('angular-material-tree.min.js'))
37+
.pipe(gulp.dest(paths.dist))
38+
.on('end', function() {
39+
gutil.log(gutil.colors.green('✔ JS Dev'), 'Finished');
40+
});
41+
};

gulp/theme.js

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ var rename = require('gulp-rename');
99
var concat = require('gulp-concat');
1010
var wrap = require('gulp-wrap');
1111
var ngConstant = require('gulp-ng-constant');
12+
var uglify = require('gulp-uglify');
1213

1314

1415
exports.dev = function () {
@@ -30,4 +31,28 @@ exports.dev = function () {
3031
.pipe(wrap('(function(){"use strict";<%= contents %>}());'))
3132
.pipe(rename('_theme.js'))
3233
.pipe(gulp.dest(paths.docs))
33-
}
34+
};
35+
36+
37+
exports.release = function () {
38+
return gulp.src(paths.theme)
39+
.pipe(sass())
40+
.pipe(cssnano())
41+
.pipe(through2.obj(function (file, enc, cb) {
42+
var config = {
43+
name: 'angular-material-tree',
44+
deps: false,
45+
constants: {
46+
TREE_THEME: file.contents.toString()
47+
}
48+
};
49+
file.contents = new Buffer(JSON.stringify(config), 'utf-8');
50+
this.push(file);
51+
cb();
52+
}))
53+
.pipe(ngConstant({wrap: false}))
54+
.pipe(wrap('(function(){"use strict";<%= contents %>}());'))
55+
.pipe(uglify())
56+
.pipe(rename('_theme.js'))
57+
.pipe(gulp.dest(paths.dist));
58+
};

gulpfile.js

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,19 @@ var serve = require('gulp-serve');
44
var del = require('del');
55
var serve = require('gulp-serve');
66
var gulpSequence = require('gulp-sequence');
7+
var bump = require('gulp-bump');
78

89
var jsBuild = require('./gulp/jsBuild');
910
gulp.task('jsDev', jsBuild.dev);
11+
gulp.task('jsRelease', jsBuild.release);
1012

1113
var cssBuild = require('./gulp/cssBuild');
1214
gulp.task('cssDev', cssBuild.dev);
15+
gulp.task('cssRelease', cssBuild.release);
1316

1417
var themeBuild = require('./gulp/theme');
1518
gulp.task('themeDev', themeBuild.dev);
19+
gulp.task('themeRelease', themeBuild.release);
1620

1721
var docs = require('./gulp/docs');
1822
gulp.task('docsBuild', docs.build);
@@ -34,11 +38,24 @@ gulp.task('buildLocal', gulpSequence(
3438
'docsInject'
3539
));
3640

41+
gulp.task('release', gulpSequence(
42+
'cleanDist',
43+
[
44+
'jsRelease',
45+
'cssRelease',
46+
'themeRelease'
47+
]
48+
));
49+
3750

3851
gulp.task('cleanDocs', function () {
3952
return del(paths.docs);
4053
});
4154

55+
gulp.task('cleanDist', function () {
56+
return del(paths.dist);
57+
});
58+
4259
gulp.task('serve', serve({
4360
root: ['docs'],
4461
port: 8080
@@ -51,3 +68,27 @@ gulp.task('watch', function () {
5168
gulp.watch(paths.docsSrc+'**/*', ['docsBuild']);
5269
gulp.watch(paths.appPartials, ['docsBuild']);
5370
});
71+
72+
gulp.task('major', function(){
73+
gulp.src(['./bower.json', './package.json'])
74+
.pipe(bump({type:'major'}))
75+
.pipe(gulp.dest('./'));
76+
});
77+
78+
gulp.task('minor', function(){
79+
gulp.src(['./bower.json', './package.json'])
80+
.pipe(bump({type:'minor'}))
81+
.pipe(gulp.dest('./'));
82+
});
83+
84+
gulp.task('patch', function(){
85+
gulp.src(['./bower.json', './package.json'])
86+
.pipe(bump({type:'patch'}))
87+
.pipe(gulp.dest('./'));
88+
});
89+
90+
gulp.task('prerelease', function(){
91+
gulp.src(['./bower.json', './package.json'])
92+
.pipe(bump({type:'prerelease'}))
93+
.pipe(gulp.dest('./'));
94+
});

0 commit comments

Comments
 (0)