Kite Gulp Tasks
A collection of gulp tasks which can be shared between
JavaScript and Typescript projects.
Installation
Via NPM:
npm install --save-dev kite-gulp-tasks
Usage
Configuration
Two files need to be created in the base of your project.
gulpfile.js which is the main gulpfile. This passes the config
to the child gulp processes.
require('kite-gulp-tasks')(
require('./gulpfile.config')
);
gulpfile.config.js is a config file for the gulp tasks.
It should take the format:
const _buildDir = 'dist';
const _srcDir = _buildDir + '/src';
const config = {
preWatchTasks: [
'svgstore',
'browser-sync',
],
watchTasks: [
'unit-tests',
'tslint',
'watch:build',
],
buildTasksDev: [
'clean',
'compile-ts',
'scripts-dev',
],
buildTasksDist: [
'clean',
'compile-ts',
'scripts-dist',
],
cdnUrl: process.env.CDN_BASE_URL,
clientEntryPoint: _srcDir + '/client/kite.client.window.js',
dir: {
build: _buildDir,
src: _srcDir,
test: _buildDir + '/test',
coverageOutput: 'coverage',
sourceMaps: 'sourcemaps',
},
filesToBuild: [
'**/*.ts',
'!node_modules/**',
'!example/**',
'!dist/**',
'!build-scripts/**',
],
filesToWatch: [
'./src/**/*.ts',
'./test/**/*.ts',
'./example/app.client.js',
],
jestConfig: {
moduleFileExtensions: [
'js',
'jsx',
'json',
'ts',
'tsx'
],
transform: {
'\\.ts$': '<rootDir>/node_modules/ts-jest/preprocessor.js'
},
collectCoverageFrom: ["**/*.{js,ts,tsx,jsx}", "!**/node_modules/**", "!**/vendor/**"],
testRegex: '.*spec.ts$'
},
jestOptions: {
runInBand: true,
bail: true
},
bsConfig: {
},
svgConfig: {
svgPath: './assets/images/*.svg',
inHtmlPath: './index.html',
},
outputFileName: 'kite.js',
tsConfig: 'tsconfig.json',
webpackConfig: 'webpack.config.js',
};
module.exports = config;
Running tasks
The name of the tasks match to the filename in the
gulp project.
e.g The task in gulp.watch.js can be run using the
command
gulp watch
Or gulp.unit-tests.js can be run with
gulp unit-tests
Development and testing
To develop Kite-Gulp-Tasks, you should test within your project.
You can either link locally following npm's guides or fetch the kite-gulp-tasks
package from GitHub, where you have pushed your changes in a branch.
To fetch from GitHub in package.json
use:
{
"dependencies": {
"kite-gulp-tasks": "git@github.com:OceanLabs/Kite-Gulp-Tasks.git#${YOUR_COMMIT_SHA}"
}
}
Where YOUR_COMMIT_SHA
is the hash (SHA-1) of the commit you want to test.
You can then run npm install
to get that commit's version of Kite-Gulp-Tasks.