{"size": 959, "ext": "js", "max_stars_repo_path": "gulpfile.js", "max_stars_repo_name": "gogocat/dataBind", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "gulpfile.js", "max_issues_repo_name": "gogocat/dataBind", "max_issues_repo_issues_event_min_datetime": "2021-08-07T03:24:41.000Z", "max_issues_repo_issues_event_max_datetime": "2021-08-07T03:24:43.000Z", "max_forks_repo_path": "gulpfile.js", "max_forks_repo_name": "gogocat/dataBind", "max_forks_repo_forks_event_min_datetime": "2019-03-10T14:06:19.000Z", "max_forks_repo_forks_event_max_datetime": "2019-03-10T14:06:19.000Z"}
{"max_stars_count": null, "max_issues_count": 8, "max_forks_count": 1, "avg_line_length": 29.0606060606, "max_line_length": 61, "alphanum_fraction": 0.6131386861}
const gulp = require('gulp');
const sourcemaps = require('gulp-sourcemaps');
const uglify = require('gulp-uglify-es').default;
const rename = require('gulp-rename');
const replace = require('gulp-replace');

const pkg = require('./package.json');
const verionToken = '@version@';

const distJsPath = './dist/js/';
const bundledFile = 'dataBind.js';

// set release version to source
gulp.task('versioning', function(cb) {
    return gulp
        .src(`${distJsPath}${bundledFile}`)
        .pipe(replace(verionToken, `${pkg.version}`))
        .pipe(gulp.dest(distJsPath));
});

// uglify
gulp.task('compress', function(cb) {
    return gulp
        .src(`${distJsPath}${bundledFile}`)
        .pipe(rename({extname: '.min.js'}))
        .pipe(sourcemaps.init())
        .pipe(uglify())
        .pipe(sourcemaps.write(''))
        .pipe(gulp.dest(distJsPath));
});

gulp.task('default', gulp.series('versioning', 'compress'));
