Skip to content

Commit

Permalink
Use babel and gulp to compile to es5
Browse files Browse the repository at this point in the history
  • Loading branch information
unsupervisednn committed Feb 2, 2020
1 parent 19e0a57 commit 900720a
Show file tree
Hide file tree
Showing 5 changed files with 6,709 additions and 674 deletions.
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
10.12.0
29 changes: 29 additions & 0 deletions gulpfile.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
const gulp = require('gulp');
const babel = require('gulp-babel');
const sourcemaps = require('gulp-sourcemaps');
const ts = require('gulp-typescript');
const gulpif = require('gulp-if');

const tsProj = ts.createProject('tsconfig.json');

const babelConfig = {
"presets": [
// Target supported browser environments
["@babel/preset-env", { "targets": "> 0.25%, not dead" }]
],
"plugins": [
// Enable generator runtime support
["@babel/plugin-transform-runtime", { "regenerator": true }]
],
};

function build() {
return gulp.src('src/**/*.ts')
.pipe(sourcemaps.init())
.pipe(tsProj())
.pipe(gulpif(/[.]js$/, babel(babelConfig)))
.pipe(sourcemaps.write('.'))
.pipe(gulp.dest('target/src'));
};

exports.default = build;
Loading

0 comments on commit 900720a

Please sign in to comment.