Update Travis CI and NPM configuration
To be compatible with their newest versions.
This commit is contained in:
parent
c285521caa
commit
8761735a54
@ -1,8 +1,7 @@
|
||||
language: node_js
|
||||
node_js:
|
||||
- '0.10'
|
||||
before_script:
|
||||
- npm install -g gulp
|
||||
- 0.12
|
||||
- 4
|
||||
deploy:
|
||||
provider: releases
|
||||
api_key:
|
||||
@ -13,5 +12,4 @@ deploy:
|
||||
branch: master
|
||||
tags: true
|
||||
before_deploy:
|
||||
- gulp
|
||||
- gulp compress
|
||||
- npm run before-deploy
|
||||
|
94
gulpfile.js
94
gulpfile.js
@ -2,14 +2,17 @@
|
||||
|
||||
var gulp = require('gulp')
|
||||
, browserify = require('browserify')
|
||||
, buffer = require('vinyl-buffer')
|
||||
, bump = require('gulp-bump')
|
||||
, connect = require('gulp-connect')
|
||||
, del = require('del')
|
||||
, eslint = require('gulp-eslint')
|
||||
, insert = require('gulp-insert')
|
||||
, path = require('path')
|
||||
, rename = require('gulp-rename')
|
||||
, rimraf = require('gulp-rimraf')
|
||||
, sass = require('gulp-sass')
|
||||
, transform = require('vinyl-transform')
|
||||
, source = require('vinyl-source-stream')
|
||||
, stream = require('event-stream')
|
||||
, uglify = require('gulp-uglify')
|
||||
, zip = require('gulp-zip');
|
||||
|
||||
@ -23,63 +26,66 @@ gulp.task('lint', function () {
|
||||
});
|
||||
|
||||
gulp.task('clean:js', function () {
|
||||
return gulp.src('./dist/js/*.js', {read: false})
|
||||
.pipe(rimraf());
|
||||
return del(['./dist/js/*.js']);
|
||||
});
|
||||
|
||||
gulp.task('clean:js:min', function () {
|
||||
return gulp.src('./dist/js/min/*.js', {read: false})
|
||||
.pipe(rimraf());
|
||||
return del(['./dist/js/min/*.js']);
|
||||
});
|
||||
|
||||
function browserified() {
|
||||
return transform(function (filename) {
|
||||
var b = browserify(filename);
|
||||
return b.bundle();
|
||||
});
|
||||
}
|
||||
var jsEntries = [
|
||||
'./src/js/adaptor/global.js',
|
||||
'./src/js/adaptor/jquery.js'
|
||||
];
|
||||
|
||||
gulp.task('js', ['clean:js'], function () {
|
||||
return gulp.src('./src/js/adaptor/*.js')
|
||||
.pipe(browserified())
|
||||
.pipe(insert.prepend(version))
|
||||
.pipe(rename(function (path) {
|
||||
if (path.basename === 'global') {
|
||||
path.basename = 'perfect-scrollbar';
|
||||
} else {
|
||||
path.basename = 'perfect-scrollbar.' + path.basename;
|
||||
}
|
||||
}))
|
||||
.pipe(gulp.dest('./dist/js'))
|
||||
.pipe(connect.reload());
|
||||
var tasks = jsEntries.map(function (src) {
|
||||
return browserify([src]).bundle()
|
||||
.pipe(source(path.basename(src)))
|
||||
.pipe(buffer())
|
||||
.pipe(insert.prepend(version))
|
||||
.pipe(rename(function (path) {
|
||||
if (path.basename === 'global') {
|
||||
path.basename = 'perfect-scrollbar';
|
||||
} else {
|
||||
path.basename = 'perfect-scrollbar.' + path.basename;
|
||||
}
|
||||
}))
|
||||
.pipe(gulp.dest('./dist/js'))
|
||||
.pipe(connect.reload());
|
||||
});
|
||||
return stream.merge.apply(null, tasks);
|
||||
});
|
||||
|
||||
gulp.task('js:min', ['clean:js:min'], function () {
|
||||
return gulp.src('./src/js/adaptor/*.js')
|
||||
.pipe(browserified())
|
||||
.pipe(uglify())
|
||||
.pipe(insert.prepend(version))
|
||||
.pipe(rename(function (path) {
|
||||
if (path.basename === 'global') {
|
||||
path.basename = 'perfect-scrollbar.min';
|
||||
} else {
|
||||
path.basename = 'perfect-scrollbar.' + path.basename + '.min';
|
||||
}
|
||||
}))
|
||||
.pipe(gulp.dest('./dist/js/min'));
|
||||
var tasks = jsEntries.map(function (src) {
|
||||
return browserify([src]).bundle()
|
||||
.pipe(source(path.basename(src)))
|
||||
.pipe(buffer())
|
||||
.pipe(uglify())
|
||||
.pipe(insert.prepend(version))
|
||||
.pipe(rename(function (path) {
|
||||
if (path.basename === 'global') {
|
||||
path.basename = 'perfect-scrollbar';
|
||||
} else {
|
||||
path.basename = 'perfect-scrollbar.' + path.basename;
|
||||
}
|
||||
}))
|
||||
.pipe(gulp.dest('./dist/js/min'))
|
||||
.pipe(connect.reload());
|
||||
});
|
||||
return stream.merge.apply(null, tasks);
|
||||
});
|
||||
|
||||
gulp.task('clean:css', function () {
|
||||
return gulp.src('./dist/css/perfect-scrollbar.css', {read: false})
|
||||
.pipe(rimraf());
|
||||
return del(['./dist/css/perfect-scrollbar.css']);
|
||||
});
|
||||
|
||||
gulp.task('clean:css:min', function () {
|
||||
return gulp.src('./dist/css/perfect-scrollbar.min.css', {read: false})
|
||||
.pipe(rimraf());
|
||||
return del(['./dist/css/perfect-scrollbar.min.css']);
|
||||
});
|
||||
|
||||
gulp.task('sass', ['clean:css'], function () {
|
||||
gulp.task('css', ['clean:css'], function () {
|
||||
return gulp.src('./src/css/main.scss')
|
||||
.pipe(sass())
|
||||
.pipe(insert.prepend(version))
|
||||
@ -88,7 +94,7 @@ gulp.task('sass', ['clean:css'], function () {
|
||||
.pipe(connect.reload());
|
||||
});
|
||||
|
||||
gulp.task('sass:min', ['clean:css:min'], function () {
|
||||
gulp.task('css:min', ['clean:css:min'], function () {
|
||||
return gulp.src('./src/css/main.scss')
|
||||
.pipe(sass({outputStyle: 'compressed'}))
|
||||
.pipe(insert.prepend(version))
|
||||
@ -114,7 +120,7 @@ gulp.task('bump', function () {
|
||||
|
||||
gulp.task('release', ['bump', 'build']);
|
||||
|
||||
gulp.task('build', ['js', 'js:min', 'sass', 'sass:min']);
|
||||
gulp.task('build', ['js', 'js:min', 'css', 'css:min']);
|
||||
|
||||
gulp.task('connect', ['build'], function () {
|
||||
connect.server({
|
||||
@ -125,7 +131,7 @@ gulp.task('connect', ['build'], function () {
|
||||
|
||||
gulp.task('watch', function () {
|
||||
gulp.watch(['src/js/**/*'], ['js']);
|
||||
gulp.watch(['src/css/**/*'], ['sass']);
|
||||
gulp.watch(['src/css/**/*'], ['css']);
|
||||
});
|
||||
|
||||
gulp.task('serve', ['connect', 'watch']);
|
||||
|
29
package.json
29
package.json
@ -24,24 +24,27 @@
|
||||
"scrollbar"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">= 0.8.0"
|
||||
"node": ">= 0.12.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"browserify": "^8.1.1",
|
||||
"gulp": "^3.8.10",
|
||||
"gulp-bump": "^0.1.11",
|
||||
"browserify": "^11.2.0",
|
||||
"del": "^2.0.2",
|
||||
"event-stream": "^3.3.1",
|
||||
"gulp": "^3.9.0",
|
||||
"gulp-bump": "^1.0.0",
|
||||
"gulp-connect": "^2.2.0",
|
||||
"gulp-eslint": "^0.2.0",
|
||||
"gulp-insert": "^0.4.0",
|
||||
"gulp-rename": "^1.2.0",
|
||||
"gulp-rimraf": "^0.1.1",
|
||||
"gulp-sass": "^1.3.1",
|
||||
"gulp-uglify": "^1.0.2",
|
||||
"gulp-zip": "^2.0.2",
|
||||
"vinyl-transform": "^1.0.0"
|
||||
"gulp-eslint": "^1.0.0",
|
||||
"gulp-insert": "^0.5.0",
|
||||
"gulp-rename": "^1.2.2",
|
||||
"gulp-sass": "^2.0.4",
|
||||
"gulp-uglify": "^1.4.1",
|
||||
"gulp-zip": "^3.0.2",
|
||||
"vinyl-buffer": "^1.0.0",
|
||||
"vinyl-source-stream": "^1.1.0"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "gulp"
|
||||
"test": "gulp",
|
||||
"before-deploy": "gulp && gulp compress"
|
||||
},
|
||||
"license": "MIT"
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user