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