react-native-adaptivecards/gulpfile.js

80 строки
2.1 KiB
JavaScript
Исходник Постоянная ссылка Обычный вид История

2017-11-17 08:00:07 +03:00
var del = require('del');
var gulp = require('gulp');
var imagemin = require('gulp-imagemin');
var rename = require('gulp-rename');
var gulpTslint = require('gulp-tslint');
2019-02-18 09:08:35 +03:00
var ts = require('gulp-typescript');
var tslint = require('tslint');
2019-02-18 09:08:35 +03:00
var tsProject = ts.createProject('tsconfig.json');
var path = {
src: './src/',
dist: './dist/',
example: './examples/AdaptiveCards/',
tool: './tool/src/assets/AdaptiveCards/',
};
2019-02-18 09:08:35 +03:00
function clean() {
return del([path.dist, path.example, path.tool]);
2019-02-18 09:08:35 +03:00
}
2019-02-18 09:08:35 +03:00
function minifyImage() {
return gulp.src(path.src + 'Assets/**/*.png')
.pipe(imagemin())
.pipe(gulp.dest(path.dist + 'Assets'))
.pipe(gulp.dest(path.example + 'Assets'))
2019-02-18 09:08:35 +03:00
.pipe(gulp.dest(path.tool + 'Assets'))
.pipe(rename(function (opt) {
opt.basename = opt.basename.replace(/@[^.]*/, '');
return opt;
2019-02-18 09:08:35 +03:00
}));
}
2019-02-18 09:08:35 +03:00
function lintTs() {
var program = tslint.Linter.createProgram('./tsconfig.json');
return gulp.src([path.src + '**/*.ts', path.src + '**/*.tsx'])
.pipe(gulpTslint({
formatter: 'stylish',
program: program
}))
.pipe(gulpTslint.report({
emitError: true
}));
2019-02-18 09:08:35 +03:00
}
function copyJson() {
return gulp.src(path.src + '**/*.json')
.pipe(gulp.dest(path.dist))
.pipe(gulp.dest(path.example))
.pipe(gulp.dest(path.tool));
}
2019-02-18 09:08:35 +03:00
function copyDefinition() {
return gulp.src(path.src + '**/*.d.ts')
.pipe(gulp.dest(path.dist))
.pipe(gulp.dest(path.example))
.pipe(gulp.dest(path.tool));
2019-02-18 09:08:35 +03:00
}
2019-02-18 09:08:35 +03:00
function compileTs() {
var tsResult = tsProject.src()
.pipe(tsProject());
2019-02-18 09:08:35 +03:00
return tsResult
.pipe(gulp.dest(path.dist))
.pipe(gulp.dest(path.example))
.pipe(gulp.dest(path.tool));
2019-02-18 09:08:35 +03:00
}
2019-02-18 09:08:35 +03:00
exports.clean = clean;
exports.minifyImage = minifyImage;
exports.lintTs = lintTs;
exports.copyJson = copyJson;
exports.compileTs = compileTs;
exports.copyDefinition = copyDefinition;
exports.build = gulp.series(
lintTs,
clean,
compileTs,
gulp.parallel(minifyImage, copyJson),
);
exports.default = exports.build;