Typescript - Add gulp tasks to compile less, typescript and copy files

This commit is contained in:
Kiran Niranjan 2019-01-08 12:20:50 +05:30
parent 6038c429ae
commit 02c4dd4319
3 changed files with 37 additions and 9 deletions

View File

@ -1,12 +1,37 @@
const gulp = require('gulp');
const less = require('gulp-less');
const sourcemaps = require('gulp-sourcemaps');
const tsc = require('gulp-tsc');
const del = require('del');
const path = require('path');
// TODO: Add gulp watch tasks
gulp.task('clean', function() {
return del('lib');
});
gulp.task('compile', function() {
return gulp.src(['src/**/*.ts'])
.pipe(tsc({ project: './tsconfig.json' }))
.pipe(gulp.dest('lib/'))
});
gulp.task('less', function () {
return gulp.src('./src/**/*.less')
.pipe(sourcemaps.init())
.pipe(less())
.pipe(sourcemaps.write())
.pipe(gulp.dest(path.join(__dirname, 'src')));
});
.pipe(gulp.dest(path.join(__dirname, 'lib/src')));
});
gulp.task('copy', function () {
return gulp.src([
'./src/renderer/assets/*',
'./src/renderer/*.html'
], {
"base": "./src"
}).pipe(gulp.dest('lib/src'))
});
gulp.task('build', gulp.series('clean', 'compile', 'less', 'copy'));

View File

@ -6,15 +6,14 @@
"buildNumber": "0",
"description": "Symphony desktop app (Foundation ODP)",
"author": "Symphony",
"main": "src/browser/main.js",
"types": "src/browser/main.d.ts",
"main": "lib/src/browser/main.js",
"types": "lib/src/browser/main.d.ts",
"scripts": {
"tsc": "git clean -xdf ./lib && npm run lint && tsc",
"compile": "npm run lint && gulp build",
"lint": "tslint --project tsconfig.json",
"start": "npm run compile-css && npm run browserify-preload && cross-env ELECTRON_DEV=true electron .",
"compile-css": "gulp less",
"start": "npm run compile && npm run browserify-preload && cross-env ELECTRON_DEV=true electron .",
"prebuild": "npm run rebuild && npm run browserify-preload",
"browserify-preload": "browserify -o src/renderer/_preload-main.js -x electron --insert-global-vars=__filename,__dirname src/renderer/preload-main.js",
"browserify-preload": "browserify -o lib/src/renderer/_preload-main.js -x electron --insert-global-vars=__filename,__dirname lib/src/renderer/preload-main.js",
"rebuild": "electron-rebuild -f",
"dev": "npm run prebuild && cross-env ELECTRON_DEV=true electron .",
"test": "npm run lint && npm rebuild --build-from-source && cross-env ELECTRON_QA=true jest --config jest.unit.config.json --runInBand && npm run rebuild",
@ -111,6 +110,7 @@
"gulp": "4.0.0",
"gulp-less": "4.0.1",
"gulp-sourcemaps": "2.6.4",
"gulp-tsc": "^1.3.2",
"jest": "23.6.0",
"jest-html-reporter": "2.4.2",
"less": "3.8.1",
@ -120,7 +120,8 @@
"spectron": "5.0.0",
"tslint": "5.11.0",
"typescript": "3.1.1",
"wdio-selenium-standalone-service": "0.0.12"
"wdio-selenium-standalone-service": "0.0.12",
"del": "latest"
},
"dependencies": {
"@types/ffi": "0.2.1",

View File

@ -5,7 +5,9 @@
"target": "ES2016",
"resolveJsonModule": true,
"jsx": "react",
"outDir": "lib",
"lib": [
"es2015",
"es2016",
"dom"
],