mirror of https://github.com/status-im/fathom.git
update to babel v8
This commit is contained in:
parent
b75506ce8f
commit
4d2e8b5f6d
35
gulpfile.js
35
gulpfile.js
|
@ -1,6 +1,5 @@
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
const babelify = require("babelify")
|
|
||||||
const browserify = require('browserify')
|
const browserify = require('browserify')
|
||||||
const gulp = require('gulp')
|
const gulp = require('gulp')
|
||||||
const source = require('vinyl-source-stream')
|
const source = require('vinyl-source-stream')
|
||||||
|
@ -9,33 +8,26 @@ const rename = require('gulp-rename')
|
||||||
const gutil = require('gulp-util')
|
const gutil = require('gulp-util')
|
||||||
const sass = require('gulp-sass')
|
const sass = require('gulp-sass')
|
||||||
const uglify = require('gulp-uglify')
|
const uglify = require('gulp-uglify')
|
||||||
const pump = require('pump')
|
|
||||||
const es = require('event-stream');
|
|
||||||
const debug = process.env.NODE_ENV !== 'production';
|
const debug = process.env.NODE_ENV !== 'production';
|
||||||
let defaultTasks = [ 'browserify', 'sass', 'html', 'img' ] ;
|
let defaultTasks = [ 'app-js', 'tracker-js', 'sass', 'html', 'img' ] ;
|
||||||
|
const babel = require('gulp-babel');
|
||||||
|
|
||||||
gulp.task('default', defaultTasks);
|
gulp.task('default', defaultTasks);
|
||||||
|
|
||||||
gulp.task('browserify', function () {
|
gulp.task('app-js', function () {
|
||||||
let files = [
|
|
||||||
'./assets/src/js/script.js',
|
|
||||||
'./assets/src/js/tracker.js',
|
|
||||||
];
|
|
||||||
|
|
||||||
var tasks = files.map(function(entry) {
|
|
||||||
let stream = browserify({
|
let stream = browserify({
|
||||||
entries: entry,
|
entries: './assets/src/js/script.js',
|
||||||
debug: debug
|
debug: debug
|
||||||
})
|
})
|
||||||
.transform("babelify", {
|
.transform("babelify", {
|
||||||
presets: ["es2015"],
|
presets: ["@babel/preset-env"],
|
||||||
plugins: [
|
plugins: [
|
||||||
"transform-decorators-legacy",
|
["@babel/plugin-proposal-decorators", { "legacy": true }],
|
||||||
["transform-react-jsx", { "pragma":"h" } ]
|
["@babel/plugin-transform-react-jsx", { "pragma":"h" } ]
|
||||||
]
|
]
|
||||||
})
|
})
|
||||||
.bundle()
|
.bundle()
|
||||||
.pipe(source(entry.split('/').pop()))
|
.pipe(source('script.js'))
|
||||||
|
|
||||||
if(!debug) {
|
if(!debug) {
|
||||||
stream.pipe(buffer()).pipe(uglify())
|
stream.pipe(buffer()).pipe(uglify())
|
||||||
|
@ -44,8 +36,13 @@ gulp.task('browserify', function () {
|
||||||
return stream.pipe(gulp.dest(`./assets/build/js`))
|
return stream.pipe(gulp.dest(`./assets/build/js`))
|
||||||
});
|
});
|
||||||
|
|
||||||
// create a merged stream
|
gulp.task('tracker-js', function () {
|
||||||
return es.merge.apply(null, tasks);
|
return gulp.src('./assets/src/js/tracker.js')
|
||||||
|
.pipe(babel({
|
||||||
|
presets: ["@babel/preset-env"],
|
||||||
|
}))
|
||||||
|
.pipe(uglify())
|
||||||
|
.pipe(gulp.dest('./assets/build/js'));
|
||||||
});
|
});
|
||||||
|
|
||||||
gulp.task('img', function() {
|
gulp.task('img', function() {
|
||||||
|
@ -68,7 +65,7 @@ gulp.task('sass', function () {
|
||||||
});
|
});
|
||||||
|
|
||||||
gulp.task('watch', ['default'], function() {
|
gulp.task('watch', ['default'], function() {
|
||||||
gulp.watch(['./assets/src/js/**/*.js'], ['browserify'] );
|
gulp.watch(['./assets/src/js/**/*.js'], ['app-js', 'tracker-js'] );
|
||||||
gulp.watch(['./assets/src/sass/**/**/*.scss'], ['sass'] );
|
gulp.watch(['./assets/src/sass/**/**/*.scss'], ['sass'] );
|
||||||
gulp.watch(['./assets/src/**/*.html'], ['html'] );
|
gulp.watch(['./assets/src/**/*.html'], ['html'] );
|
||||||
gulp.watch(['./assets/src/img/**/*'], ['img'] );
|
gulp.watch(['./assets/src/img/**/*'], ['img'] );
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
18
package.json
18
package.json
|
@ -5,30 +5,28 @@
|
||||||
"url": "https://github.com/usefathom/fathom.git"
|
"url": "https://github.com/usefathom/fathom.git"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"babel-core": "^6.26.0",
|
"@babel/core": "^7.0.1",
|
||||||
"babel-plugin-transform-decorators-legacy": "^1.3.4",
|
"@babel/plugin-proposal-decorators": "^7.0.0",
|
||||||
"babel-plugin-transform-react-jsx": "^6.8.0",
|
"@babel/plugin-transform-react-jsx": "^7.0.0",
|
||||||
"babel-preset-es2015": "^6.18.0",
|
"@babel/preset-env": "^7.0.0",
|
||||||
"babelify": "^8.0.0",
|
"babelify": "^10.0.0",
|
||||||
"browserify": "^16.2.0",
|
"browserify": "^16.2.0",
|
||||||
"event-stream": "^3.3.4",
|
|
||||||
"gulp": "^3.9.1",
|
"gulp": "^3.9.1",
|
||||||
|
"gulp-babel": "^8.0.0",
|
||||||
"gulp-rename": "^1.2.2",
|
"gulp-rename": "^1.2.2",
|
||||||
"gulp-sass": "^4.0.1",
|
"gulp-sass": "^4.0.1",
|
||||||
|
"gulp-uglify": "^3.0.0",
|
||||||
"gulp-util": "^3.0.7",
|
"gulp-util": "^3.0.7",
|
||||||
"node-sass": "^4.9.0",
|
"node-sass": "^4.9.0",
|
||||||
"vinyl-buffer": "^1.0.0",
|
"vinyl-buffer": "^1.0.0",
|
||||||
"vinyl-source-stream": "^2.0.0"
|
"vinyl-source-stream": "^2.0.0"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"cookies-js": "^1.2.3",
|
|
||||||
"d3": "^5.4.0",
|
"d3": "^5.4.0",
|
||||||
"d3-tip": "^0.9.1",
|
"d3-tip": "^0.9.1",
|
||||||
"d3-transition": "^1.1.1",
|
"d3-transition": "^1.1.1",
|
||||||
"decko": "^1.2.0",
|
"decko": "^1.2.0",
|
||||||
"gulp-uglify": "^3.0.0",
|
|
||||||
"pikaday": "^1.7.0",
|
"pikaday": "^1.7.0",
|
||||||
"preact": "^8.2.7",
|
"preact": "^8.2.7"
|
||||||
"pump": "^3.0.0"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue