Skip to content

Commit

Permalink
v7.24.0 – gh-pages dependency changed and lintModules flag added (#135)
Browse files Browse the repository at this point in the history
  • Loading branch information
ashleynolan authored and DamianMullins committed Aug 20, 2018
1 parent 9f1b40d commit 04f9add
Show file tree
Hide file tree
Showing 8 changed files with 88 additions and 177 deletions.
15 changes: 15 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,21 @@
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).

v7.23.0
------------------------------
*August 20, 2018*

### Added
Can now lint sub-modules Sass (for local development) by using the `--lintModules` flag.

### Changed
- Dependency on gulp-gh-pages removed in favour of our own forked version (as the maintainer had moved it to Gulp 4, which hasn't been released).
- Tests updated in line with config changes to CSS lintPaths

### Removed
- Gemnasium removed from README


v7.22.0
------------------------------
*August 3, 2018*
Expand Down
7 changes: 6 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
[![npm version](https://badge.fury.io/js/%40justeat%2Fgulp-build-fozzie.svg)](https://badge.fury.io/js/%40justeat%2Fgulp-build-fozzie)
[![Build Status](https://travis-ci.org/justeat/gulp-build-fozzie.svg)](https://travis-ci.org/justeat/gulp-build-fozzie)
[![Coverage Status](https://coveralls.io/repos/github/justeat/gulp-build-fozzie/badge.svg)](https://coveralls.io/github/justeat/gulp-build-fozzie)
[![Dependency Status](https://gemnasium.com/badges/github.com/justeat/gulp-build-fozzie.svg)](https://gemnasium.com/github.com/justeat/gulp-build-fozzie)

Gulp build tasks for use across Fozzie modules.

Expand Down Expand Up @@ -899,6 +898,12 @@ The following options are also present in the config but cannot be overridden.

Set to the opposite value of `isProduction`.

- #### `lintModules`

Type: `boolean`

When set to true, by setting the `--lintModules` flag when running the build, the build will also lint SCSS files within sub-dependencies. This is intended to help with local development when using dependency linking.


## Path Builder

Expand Down
8 changes: 6 additions & 2 deletions config.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
const gutil = require('gulp-util');
const path = require('path');
const union = require('lodash.union');
const packageConfig = require('./package.json');

const consumingPackageConfig = require(`${process.cwd()}/package.json`); // eslint-disable-line import/no-dynamic-require
Expand All @@ -9,6 +10,7 @@ const ConfigOptions = () => {
const isProduction = !!gutil.env.prod;
const isDev = !isProduction;
const envLog = isProduction ? 'production' : 'development';
const { lintModules } = gutil.env;
const stripDebug = !gutil.env.noStripDebug;

gutil.log(gutil.colors.yellow(`🐻 Running Gulp task for ${consumingPackageConfig.name}@${consumingPackageConfig.version} in ${gutil.colors.bold(envLog)} mode ${gutil.colors.gray(`(v${packageConfig.version})`)}`));
Expand All @@ -28,7 +30,7 @@ const ConfigOptions = () => {
css: {
scssDir: 'scss',
cssDir: 'css',
lintPaths: [''],
lintPaths: [...lintModules ? ['node_modules/@justeat/**/*.scss', '!node_modules/@justeat/**/node_modules/**/*.scss'] : []],
sourcemaps: isDev,
usePackageVersion: false
},
Expand Down Expand Up @@ -182,7 +184,9 @@ const ConfigOptions = () => {

update (options = {}) {
config = Object.assign(config, options, {
css: Object.assign(config.css, options.css),
css: Object.assign(config.css, options.css, {
lintPaths: union(config.css.lintPaths, (options.css ? options.css.lintPaths : []))
}),
js: Object.assign(config.js, options.js, {
files: Object.assign(config.js.files, (options.js ? options.js.files : {}), {
main: Object.assign(config.js.files.main, (options.js && options.js.files ? options.js.files.main : {}))
Expand Down
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@justeat/gulp-build-fozzie",
"version": "7.22.0",
"version": "7.23.0",
"description": "Gulp build tasks for use across Fozzie modules",
"main": "index.js",
"author": "Damian Mullins <[email protected]> (http://www.damianmullins.com)",
Expand Down Expand Up @@ -30,6 +30,7 @@
"@justeat/eslint-config-fozzie": "^2.0.1",
"@justeat/f-copy-assets": "^0.6.0",
"@justeat/f-templates-loader": "0.1.0",
"@justeat/gulp-gh-pages": "^1.0.3",
"@justeat/stylelint-config-fozzie": "^2.0.1",
"assemble": "^0.24.3",
"autoprefixer": "^9.1.0",
Expand All @@ -52,7 +53,6 @@
"gulp-extname": "^0.2.2",
"gulp-file": "^0.4.0",
"gulp-filenames": "^4.0.1",
"gulp-gh-pages": "^0.6.0-1",
"gulp-if": "^2.0.2",
"gulp-imagemin": "^4.1.0",
"gulp-newer": "^1.4.0",
Expand All @@ -75,6 +75,7 @@
"helper-markdown": "^1.0.0",
"helper-md": "^0.2.2",
"jest-cli": "^23.4.2",
"lodash.union": "^4.6.0",
"merge-stream": "^1.0.1",
"postcss-assets": "^5.0.0",
"postcss-reporter": "^5.0.0",
Expand Down
2 changes: 1 addition & 1 deletion tasks-dev/docs.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const gulp = require('gulp');
const runSequence = require('run-sequence');
const ghPages = require('gulp-gh-pages');
const ghPages = require('@justeat/gulp-gh-pages');

const config = require('../config');
const pathBuilder = require('../pathBuilder');
Expand Down
2 changes: 1 addition & 1 deletion test/config.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ describe('css config', () => {
});

it('`lintPaths` should be set', () => {
expect(config.css.lintPaths).toEqual(['']);
expect(config.css.lintPaths).toEqual([]);
});

it('`lintPaths` can be updated', () => {
Expand Down
24 changes: 24 additions & 0 deletions test/env.test.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
const gutil = require('gulp-util');

// Act – set environment variables up
gutil.env.prod = true;
gutil.env.lintModules = true;

// Mock the log function to capture log outputs
const logMock = jest.fn();
Expand All @@ -16,4 +18,26 @@ describe('Environment variable', () => {
expect(config.isProduction).toBe(true);
});
});

describe('Setting `gutil.env.lintModules`', () => {
it('Will set `lintPaths` to include sub-module scss', () => {
// Assert
expect(config.css.lintPaths).toEqual(['node_modules/@justeat/**/*.scss', '!node_modules/@justeat/**/node_modules/**/*.scss']);
});

it('if config is updated, lintPaths should still include node_modules folder', () => {
// Arrange
const newConfig = {
css: {
lintPaths: ['./myFolder/']
}
};

// Act
config.update(newConfig);

// Assert
expect(config.css.lintPaths).toEqual(['node_modules/@justeat/**/*.scss', '!node_modules/@justeat/**/node_modules/**/*.scss', './myFolder/']);
});
});
});
Loading

0 comments on commit 04f9add

Please sign in to comment.