Olo Gulp Build Helpers
This package provides a collection of internal helper functions and configurations specifically designed for Olo's Gulp build pipeline, with a particular focus on bundling frontend assets for their ASP.NET applications. While the current reported version is 0.9.1, its public release history indicates releases up to 0.2.3. The package aims to streamline the integration of modern web technologies such as TypeScript, Webpack, Karma, Mocha, and Sinon into Olo's existing build infrastructure. Its release cadence is sporadic and tied to Olo's internal development needs, rather than following a public roadmap. As an internal utility, its primary differentiator is its tailored fit for Olo's specific project requirements and development environment, making it less of a general-purpose Gulp library and more of an opinionated, company-specific solution for build automation.
Common errors
-
Error: Cannot find module 'olo-gulp-helpers'
cause Package not installed or incorrect path in `require` statement.fixRun `npm install olo-gulp-helpers` or `yarn add olo-gulp-helpers` in your project. Ensure the `require` path is correct. -
No command 'gulp' found
cause Gulp CLI is not globally installed or not in your system's PATH.fixInstall Gulp CLI globally: `npm install -g gulp-cli`. If it's installed, verify your system's PATH environment variable. -
TypeError: oloGulpHelpers.setupWebpack is not a function
cause Attempting to call a helper function that either doesn't exist, is misspelled, or is not exported by the package.fixVerify the correct function name and its export status. Review the `olo-gulp-helpers` source code or internal documentation for available exports and their signatures. -
Webpack compilation failed: 'sinon' module not found
cause Webpack is failing to resolve or properly ignore the 'sinon' module, potentially due to incorrect configuration or a regression of the path separator issue mentioned in v0.2.2.fixEnsure `olo-gulp-helpers` is at least version 0.2.2. Check Webpack configuration for proper aliasing or externalization of `sinon` if it's not meant to be bundled.
Warnings
- breaking The package's stated version (0.9.1) significantly diverges from its public release history (up to 0.2.3). This suggests potential undocumented breaking changes or features introduced in intermediate versions which are not publicly detailed, making upgrades or initial integration unpredictable.
- gotcha This package is specifically designed for 'Olo's gulp build pipeline' and 'ASP.NET sites'. It likely contains strong opinions, hardcoded paths, or specific configurations tailored to Olo's internal infrastructure. Using it outside of Olo's intended environment may lead to unexpected behavior or require significant customization.
- gotcha Version 0.2.2 fixed a 'path separator issue that prevented Sinon from being properly ignored by Webpack on Windows'. Older versions of this helper might exhibit cross-platform build failures, particularly on Windows, due to path resolution inconsistencies.
- breaking The underlying Gulp ecosystem has evolved, with Gulp 4 and 5 introducing significant breaking changes (e.g., `gulp.task` API, series/parallel composition, Node.js version requirements). Older versions of `olo-gulp-helpers` may be incompatible with newer Gulp CLI or core library versions.
Install
-
npm install olo-gulp-helpers -
yarn add olo-gulp-helpers -
pnpm add olo-gulp-helpers
Imports
- oloGulpHelpers
import oloGulpHelpers from 'olo-gulp-helpers';
const oloGulpHelpers = require('olo-gulp-helpers'); - setupWebpack
import { setupWebpack } from 'olo-gulp-helpers';const { setupWebpack } = require('olo-gulp-helpers'); - defineBundlingTasks
import defineBundlingTasks from 'olo-gulp-helpers/bundling';
const { defineBundlingTasks } = require('olo-gulp-helpers');
Quickstart
const gulp = require('gulp');
const { setupWebpack, defineBundlingTasks } = require('olo-gulp-helpers');
// Define paths for your project assets
const paths = {
scripts: 'src/scripts/**/*.js',
styles: 'src/styles/**/*.scss',
output: 'dist'
};
// Setup Webpack configuration using Olo's helpers
const webpackConfig = setupWebpack({
entry: './src/index.js',
output: { path: paths.output, filename: 'bundle.js' },
// Optionally pass environment variables, e.g., for API keys
apiUrl: process.env.API_URL ?? ''
});
// Define Gulp tasks using Olo's bundling helpers
const { compileScripts, compileStyles, watchFiles } = defineBundlingTasks(gulp, paths, webpackConfig);
// Export public tasks
exports.scripts = compileScripts;
exports.styles = compileStyles;
exports.watch = watchFiles;
exports.default = gulp.series(compileStyles, compileScripts, watchFiles);