Skip to content

Commit

Permalink
v10.5.0 - Add customTasks to JS config (#204)
Browse files Browse the repository at this point in the history
Co-authored-by: Xander Marjoram <[email protected]>
  • Loading branch information
xander-marjoram and xander-marjoram authored May 25, 2022
1 parent dcdc9fd commit ddab060
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 5 deletions.
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,15 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).


v10.5.0
------------------------------
*May 25, 2022*

### Added
- `customTasks` property to JavaScript config.
- This allows tasks (provided by the consuming application) to be run as part of the `gulp:scripts` command, in parallel with `scripts:bundle`.


v10.4.0
------------------------------
*May 23, 2022*
Expand Down
18 changes: 18 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,11 @@ Runs the following tasks

Removes any JavaScript already in the dist directory.

- #### Custom Tasks

The names of custom tasks can be passed into the config object to be run here. See [`customTasks`](#customtasks) for more details.


- #### `scripts:bundle`

Performs a variety of tasks including;
Expand Down Expand Up @@ -319,6 +324,7 @@ Here is the outline of the configuration options, descriptions of each are below
},
],
customTasks,
jsDir,
lintPaths,
allowEmpty
Expand Down Expand Up @@ -508,6 +514,18 @@ Will add a content hash to the JS and CSS filenames, generating a new filename i
The filename for the JavaScript bundle once compiled.
- #### `customTasks`
Type: `array<string>`
Default: `[]`
Array of strings, containing the names of the custom tasks to be run as part of the `gulp:scripts` command, in parallel with `scripts:bundle`.
These should be defined by (or made available within) the consuming application, e.g., compiling third-party libraries within a `scripts:libs` task.
Gulp 4 does not easily allow for the entire default `gulp:scripts` implementation to be overridden, so any extra JS-related tasks that you need to run should be passed in here.
- #### `jsDir`
Type: `string`
Expand Down
1 change: 1 addition & 0 deletions config.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ const ConfigOptions = () => {
distFile: 'script.js'
}
},
customTasks: [],
jsDir: 'js',
lintPaths: [],
allowEmpty: true,
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@justeat/gulp-build-fozzie",
"version": "10.4.0",
"version": "10.5.0",
"description": "Gulp build tasks for use across Fozzie modules",
"main": "index.js",
"contributors": [
Expand Down
10 changes: 6 additions & 4 deletions tasks/javascript.js
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ gulp.task('scripts:bundle', async () => {
.pipe(gulpif(
config.misc.showFileSize,
size({
title: 'Bundled JS Report unminified build ',
title: 'Bundled JS Report - unminified build -',
showFiles: config.misc.showFiles
})
))
Expand Down Expand Up @@ -172,7 +172,7 @@ gulp.task('scripts:bundle', async () => {
.pipe(gulpif(
config.misc.showFileSize,
size({
title: 'Bundled JS Report minified build ',
title: 'Bundled JS Report - minified build -',
showFiles: config.misc.showFiles
})
))
Expand All @@ -183,7 +183,6 @@ gulp.task('scripts:bundle', async () => {
return merge(...bundleTasks);
});


/**
* `scripts` Task
* ---------------
Expand All @@ -194,6 +193,9 @@ gulp.task('scripts', gulp.series(
'scripts:lint',
'scripts:test',
'clean:scripts',
'scripts:bundle',
gulp.parallel(
...config.js.customScripts,
'scripts:bundle'
),
'copy:js'
));

0 comments on commit ddab060

Please sign in to comment.