This repository has been archived by the owner on Sep 12, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 104
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e1823d5
commit 0ea45f6
Showing
7 changed files
with
249 additions
and
223 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,8 @@ | ||
language: node_js | ||
node_js: | ||
- "node" | ||
before_install: | ||
before_run: | ||
- npm install -g bower gulp | ||
- bower install | ||
script: gulp test | ||
- gulp clean | ||
script: gulp travis-ci |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
import gulp from 'gulp'; | ||
import fs from 'fs'; | ||
import gulpLoadPlugins from 'gulp-load-plugins'; | ||
import browserSync from 'browser-sync'; | ||
|
||
const $ = gulpLoadPlugins(); | ||
const reload = browserSync.reload; | ||
|
||
|
||
function readJson(path) { | ||
return JSON.parse(fs.readFileSync(path, 'utf8')); | ||
} | ||
|
||
function banner() { | ||
var pkg = readJson('./package.json'); | ||
var bower = readJson('./bower.json'); | ||
return ` | ||
/*! | ||
* ${bower.name} | ||
* version: ${pkg.version} | ||
* authors: ${bower.authors} | ||
* license: ${bower.license} | ||
* ${bower.homepage} | ||
*/ | ||
`.replace(/\n\s{0,4}/g, '\n').replace('\n', ''); | ||
} | ||
|
||
gulp.task('styles', () => { | ||
return gulp.src([ | ||
'src/styles/*.scss', | ||
'website/styles/*.scss' | ||
]) | ||
.pipe($.plumber()) | ||
.pipe($.sass.sync({ | ||
outputStyle: 'expanded', | ||
precision: 10, | ||
includePaths: ['.'] | ||
}).on('error', $.util.log)) | ||
.pipe($.autoprefixer({browsers: ['last 1 version']})) | ||
.pipe(gulp.dest('.tmp/styles')) | ||
.pipe(reload({stream: true})); | ||
}); | ||
|
||
gulp.task('scripts', () => { | ||
return gulp.src([ | ||
'src/scripts/*.coffee', | ||
'website/scripts/*.coffee' | ||
]) | ||
.pipe($.include()).on('error', $.util.log) | ||
.pipe($.plumber()) | ||
.pipe($.coffee().on('error', $.util.log)) | ||
.pipe(gulp.dest('.tmp/scripts')) | ||
.pipe(reload({stream: true})); | ||
}); | ||
|
||
gulp.task('build', ['scripts', 'styles'], () => { | ||
return gulp.src(['.tmp/scripts/daterangepicker.js', '.tmp/styles/daterangepicker.css']) | ||
.pipe($.header(banner())) | ||
.pipe(gulp.dest('dist/')) | ||
.pipe($.size({title: 'build', gzip: true})); | ||
}); | ||
|
||
gulp.task('build:min', ['build'], () => { | ||
return gulp.src(['dist/daterangepicker.js', 'dist/daterangepicker.css']) | ||
.pipe($.if('*.js', $.uglify({preserveComments: 'license'}))) | ||
.pipe($.if('*.css', $.minifyCss({compatibility: '*'}))) | ||
.pipe($.if('*.js', $.extReplace('.min.js'))) | ||
.pipe($.if('*.css', $.extReplace('.min.css'))) | ||
.pipe(gulp.dest('dist/')) | ||
.pipe($.size({title: 'build:min', gzip: true})); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import gulp from 'gulp'; | ||
import gulpLoadPlugins from 'gulp-load-plugins'; | ||
|
||
const $ = gulpLoadPlugins(); | ||
|
||
|
||
function bump(type) { | ||
return gulp.src('./package.json') | ||
.pipe($.bump({type: type})) | ||
.pipe(gulp.dest('./')) | ||
.pipe($.callback(() => { gulp.start('build:min'); })); | ||
}; | ||
|
||
gulp.task('bump:major', () => { | ||
return bump('major'); | ||
}); | ||
|
||
gulp.task('bump:minor', () => { | ||
return bump('minor'); | ||
}); | ||
|
||
gulp.task('bump:patch', () => { | ||
return bump('patch'); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
import gulp from 'gulp'; | ||
import gulpLoadPlugins from 'gulp-load-plugins'; | ||
|
||
const $ = gulpLoadPlugins(); | ||
|
||
|
||
gulp.task('github:pages', ['build:website'], () => { | ||
return gulp.src('./dist/website/**/*') | ||
.pipe($.ghPages()); | ||
}); | ||
|
||
gulp.task('consistency-check', ['build:min'], (cb) => { | ||
exec('git status', function callback(error, stdout, stderr) { | ||
const pendingChanges = stdout.match(/modified:\s*dist/) | ||
if (pendingChanges) { | ||
throw new Error('consistency check failed'); | ||
} else { | ||
cb(); | ||
} | ||
}); | ||
}); | ||
|
||
gulp.task('github:release', ['consistency-check'], () => { | ||
if (!process.env.GITHUB_TOKEN) { | ||
throw new Error('env.GITHUB_TOKEN is empty'); | ||
} | ||
|
||
var manifest = readJson('./package.json'); | ||
const match = manifest.repository.url.split('/').slice(-2) | ||
|
||
return gulp.src([ | ||
'dist/daterangepicker.js', | ||
'dist/daterangepicker.css', | ||
'dist/daterangepicker.min.js', | ||
'dist/daterangepicker.min.css' | ||
]) | ||
.pipe($.githubRelease({ | ||
manifest: manifest, | ||
owner: match[0], | ||
repo: match[1] | ||
})); | ||
}); |
Oops, something went wrong.