SymphonyElectron/gulpfile.js
Kiran Niranjan 0431a9f5ad fix: Upgrade master to 6.x (#795)
* Upgrade Electron version to 6.x

* fix: SDA-1347 (Group multiple processes into a single task bar icon) (#778)

* update mac build script

* update mac packager

* feat: ELECTRON-1462 (Combine more information into about app window) (#777)

* ELECTRON-1462 - Merge more info window in to about app window

* ELECTRON-1462 - Adjust window size

* ELECTRON-1462 - Add line space

* ELECTRON-1462 - Resize for windows

* ELECTRON-1462 - Add translation for swift search

* ELECTRON-1462 - Adjust width for Windows OS

* ELECTRON-1462 - Add about app snapshots file

* SDA-1347 - Group multiple processes into single task bar icon

* Change dependency from gulp-tsc to gulp-typescript

* 6.x Update activity detection api

* 6.x Update aip file to remove unwanted spellchecker files

* 6.x Update electron version to 6.1.2

* 6.x Update SDA version and change spellchecker base

* 6.x Update electron-builder version to support 6.x

* 6.x fix escape char for window build command

* 6.x Optimize log path set and get methods

* 6.x Change yml to json

* 6.x Make Window local path as default user data path
2019-10-30 20:58:25 +05:30

80 lines
2.2 KiB
JavaScript

const fs = require('fs');
const gulp = require('gulp');
const less = require('gulp-less');
const sourcemaps = require('gulp-sourcemaps');
const tsc = require('gulp-typescript');
const del = require('del');
const path = require('path');
const tsProject = tsc.createProject('./tsconfig.json');
gulp.task('clean', function() {
return del('lib');
});
/**
* Compile all typescript files
* and copy to the destination
*/
gulp.task('compile', function() {
return tsProject.src()
.pipe(tsProject())
.on('error', (err) => console.log(err))
.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, 'lib/src')));
});
/**
* Copy all assets to JS codebase
*/
gulp.task('copy', function () {
return gulp.src([
'./src/renderer/assets/*',
'./src/renderer/*.html',
'./src/locale/*',
'./package.json'
], {
"base": "./src"
}).pipe(gulp.dest('lib/src'))
});
/**
* Set expiry time for test builds
*/
gulp.task('setExpiry', function (done) {
// Set expiry of 15 days for test builds we create from CI
const expiryDays = process.argv[4] || 15;
console.log(`Setting expiry to ${expiryDays} days`);
const milliseconds = 24*60*60*1000;
const expiryTime = new Date().getTime() + (expiryDays * milliseconds);
console.log(`Setting expiry time to ${expiryTime}`);
const ttlHandlerFile = path.join(__dirname, 'src/app/ttl-handler.ts');
fs.readFile(ttlHandlerFile, 'utf8', function (err,data) {
if (err) {
console.error(err);
return done(err);
}
// Do a simple search and replace in the `ttl-handler.ts` file
const replacementString = `const ttlExpiryTime = ${expiryTime}`;
const result = data.replace(/const ttlExpiryTime = -1/g, replacementString);
fs.writeFile(ttlHandlerFile, result, 'utf8', function (err) {
if (err) {
return done(err);
}
done();
});
});
});
gulp.task('build', gulp.series('clean', 'compile', 'less', 'copy'));