Skip to content

Commit 2619588

Browse files
committed
upgrade npm packages to the latest one
1 parent 8226f1b commit 2619588

File tree

5 files changed

+3246
-2803
lines changed

5 files changed

+3246
-2803
lines changed

.eslintrc.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"extends": "google",
3-
"parser": "babel-eslint",
3+
"parser": "@babel/eslint-parser",
44
"globals": {},
55
"rules": {
66
"strict": 0,

gulpfile.js

+47-39
Original file line numberDiff line numberDiff line change
@@ -2,66 +2,74 @@
22

33
const gulp = require('gulp');
44
const del = require('del');
5-
const runSequence = require('run-sequence');
65
const browserSync = require('browser-sync');
7-
const gulpLoadPlugins = require('gulp-load-plugins');
86
const lazypipe = require('lazypipe');
7+
const eslint = require('gulp-eslint');
8+
const uglify = require('gulp-uglify');
9+
const rename = require('gulp-rename');
10+
const header = require('gulp-header');
11+
const babel = require('gulp-babel');
912

10-
const $ = gulpLoadPlugins();
11-
const reload = browserSync.reload;
1213
const pkg = require('./package.json');
13-
const today = $.util.date('dd-mm-yyyy HH:MM');
1414

15-
const browserSyncConfigs = {
16-
notify: false,
17-
// Disable open automatically when Browsersync starts.
18-
open: false,
19-
server: ['./'],
20-
port: 3000
21-
};
15+
const [todayDateISO, todayTimeISO] = new Date().toISOString().split('T');
16+
const [todayYear, todayMonth, todayDay] = todayDateISO.split('-');
17+
const [todayHour, todayMinute] = todayTimeISO.split(':');
18+
const today = `${todayDay}-${todayMonth}-${todayYear} ${todayHour}:${todayMinute}`;
2219

2320
const banner = [
2421
'/*!',
2522
' * MoveTo - ' + pkg.description,
2623
' * Version ' + pkg.version + ' (' + today + ')',
2724
' * Licensed under ' + pkg.license,
28-
' * Copyright ' + $.util.date('yyyy') + ' ' + pkg.author,
25+
' * Copyright ' + todayYear + ' ' + pkg.author,
2926
' */\n\n'
3027
].join('\n');
3128

32-
33-
gulp.task('scripts:lint', (cb) => {
29+
function jsLint() {
3430
return gulp.src('src/**/*.js')
35-
.pipe($.eslint())
36-
.pipe($.eslint.format())
37-
.pipe(browserSync.active ? $.util.noop() : $.eslint.failOnError());
38-
});
31+
.pipe(eslint())
32+
.pipe(eslint.format())
33+
.pipe(browserSync.active ? () => undefined : eslint.failOnError());
34+
}
3935

40-
gulp.task('scripts', ['scripts:lint'], () => {
36+
function jsMain(cb) {
4137
const scriptsMinChannel = lazypipe()
42-
.pipe($.uglify)
43-
.pipe($.rename, {suffix: '.min'})
44-
.pipe($.header, banner)
38+
.pipe(uglify)
39+
.pipe(rename, {suffix: '.min'})
40+
.pipe(header, banner)
4541
.pipe(gulp.dest, 'dist/');
4642

4743
return gulp.src('src/**/*.js')
48-
.pipe($.babel({presets: ['@babel/preset-env']}))
49-
.pipe($.header(banner))
44+
.pipe(babel({ presets: ['@babel/preset-env'] }))
45+
.pipe(header(banner))
5046
.pipe(gulp.dest('dist'))
51-
.pipe(scriptsMinChannel());
52-
});
47+
.pipe(scriptsMinChannel())
48+
.on('end', cb);
49+
}
50+
51+
function reload(cb) {
52+
browserSync.reload();
53+
cb();
54+
}
55+
56+
function serve() {
57+
browserSync.init({
58+
ghostMode: false,
59+
notify: false,
60+
server: ['./'],
61+
port: 3000
62+
});
63+
64+
gulp.watch('src/**/*.js', gulp.series('scripts', reload));
65+
}
66+
67+
gulp.task('scripts:lint', jsLint);
68+
gulp.task('scripts:main', jsMain);
69+
gulp.task('scripts', gulp.series('scripts:lint', 'scripts:main'));
5370

54-
gulp.task('clean:dist', () => del(['dist/*'], {dot: true}));
71+
gulp.task('clean:dist', () => del(['dist/*'], { dot: true }));
5572

56-
gulp.task('build', (cb) =>
57-
runSequence(
58-
['clean:dist'],
59-
['scripts'],
60-
cb
61-
)
62-
);
73+
gulp.task('build', gulp.series('clean:dist', 'scripts'));
6374

64-
gulp.task('serve', () => {
65-
browserSync(browserSyncConfigs);
66-
gulp.watch(['src/**/*.js'], ['scripts', reload]);
67-
});
75+
gulp.task('serve', serve);

package.json

+17-16
Original file line numberDiff line numberDiff line change
@@ -34,25 +34,26 @@
3434
"node": ">=8.9.4"
3535
},
3636
"devDependencies": {
37-
"@babel/core": "^7.5.5",
38-
"@babel/preset-env": "^7.5.5",
39-
"ava": "^2.2.0",
40-
"babel-eslint": "^10.0.2",
41-
"browser-sync": "^2.26.7",
42-
"del": "^5.0.0",
43-
"eslint": "^6.1.0",
44-
"eslint-config-google": "^0.13.0",
45-
"gulp": "^3.9.1",
37+
"@ava/babel": "^1.0.1",
38+
"@babel/core": "^7.14.3",
39+
"@babel/eslint-parser": "^7.14.3",
40+
"@babel/preset-env": "^7.14.2",
41+
"ava": "^3.15.0",
42+
"browser-sync": "^2.26.14",
43+
"del": "^6.0.0",
44+
"eslint": "^7.26.0",
45+
"eslint-config-google": "^0.14.0",
46+
"gulp": "^4.0.2",
4647
"gulp-babel": "^8.0.0",
4748
"gulp-eslint": "^6.0.0",
4849
"gulp-header": "^2.0.9",
49-
"gulp-load-plugins": "^2.0.0",
50-
"gulp-rename": "^1.4.0",
50+
"gulp-rename": "^2.0.0",
5151
"gulp-uglify": "^3.0.1",
52-
"gulp-util": "^3.0.8",
53-
"jsdom": "15.1.1",
52+
"jsdom": "16.5.3",
5453
"jsdom-global": "3.0.2",
55-
"lazypipe": "^1.0.1",
56-
"run-sequence": "^2.2.1"
57-
}
54+
"lazypipe": "^1.0.1"
55+
},
56+
"ava": {
57+
"babel": true
58+
}
5859
}

src/moveTo.js

+2-3
Original file line numberDiff line numberDiff line change
@@ -91,9 +91,8 @@ const MoveTo = (() => {
9191

9292
const href = dom.getAttribute('href') || dom.getAttribute('data-target');
9393
// The element to be scrolled
94-
const target = (href && href !== '#')
95-
? document.getElementById(href.substring(1))
96-
: document.body;
94+
const target =
95+
(href && href !== '#') ? document.getElementById(href.substring(1)) : document.body;
9796
const options = mergeObject(this.options, _getOptionsFromTriggerDom(dom, this.options));
9897

9998
if (typeof callback === 'function') {

0 commit comments

Comments
 (0)