Skip to content

Commit

Permalink
1.1.3
Browse files Browse the repository at this point in the history
  • Loading branch information
dutchenkoOleg committed May 27, 2017
1 parent aac16e5 commit eef2488
Show file tree
Hide file tree
Showing 6 changed files with 46 additions and 25 deletions.
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,17 @@
> _This project adheres to [Semantic Versioning](http://semver.org/)._

### [1.1.3] - 2017-05-26

#### Added

- [snazzy](https://github.com/feross/snazzy) formatter for using with [happiness](https://github.com/JedWatson/happiness) lint in npm test

#### Changed

- Updated information and fix small bugs


### [1.1.1] - 2017-05-26

#### Changed
Expand Down
27 changes: 18 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -117,31 +117,40 @@ let notSupported = notSupportedFile(file, pluginError, options);
```


#### `noEmpty`

#### `noUnderscore`

type `boolean` /
default `true`

_File with empty content will be skipped_
_**Note!** Spaces, tabs and newlines will be treated as empty content._
_return `['isEmpty']` on fail_
File with empty content will be skipped and not using in stream next.

_You will receive message in console if it happens_
_Example of log:_

#### `noUnderscore`
![no-empty log example](https://raw.githubusercontent.com/dutchenkoOleg/gulp-not-supported-file/master/assets/no-underscore.png)


#### `noEmpty`

type `boolean` /
default `true`

_File starting with `_` will be skipped_
_return `['isUnderscore']` on fail_
File with empty content will be skipped and not using in stream next.
Return `['isEmpty']`
_**Note!** Spaces, tabs and newlines will be treated as empty content._

_You will receive message in console if it happens_stream next._
_Example of log:_

![no-empty log example](https://raw.githubusercontent.com/dutchenkoOleg/gulp-not-supported-file/master/assets/no-empty.png)

#### `silent`

type `boolean` /
default `false`

_No console logs if set `true`_
No logs about `noEmpty` and `noUnderscore` files

---

Expand All @@ -156,7 +165,7 @@ yarn add gulp-not-supported-file
## Tests

1. `npm test` for testing code style and run mocha tests
1. `npm run happiness-fix` for automatically fix problems
1. `npm run happiness-fix` for automatically fix most of problems with code style

## Changelog

Expand Down
Binary file modified assets/no-underscore.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions gulpfile.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
'use strict';

/**
* @fileOverview Testing with `gulp-mocha` and `chai`
* @author Oleg Dutchenko <dutchenko.o.wezom@gmail.com>
* @fileOverview Testing with `gulp-mocha`
* @author Oleg Dutchenko <dutchenko.o.dev@gmail.com>
*/

// ----------------------------------------
Expand Down
22 changes: 11 additions & 11 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,28 +88,28 @@ module.exports = function notSupportedFile (file, pluginError, options = {}) {
)];
}

if (noEmpty) {
let fileContent = String(file.contents);
if (noUnderscore) {
let hasUnderscore = path.basename(file.path).indexOf('_') === 0;

fileContent = fileContent.replace(/\s|\t|\n|\r/g, '');
if (!fileContent.length) {
if (hasUnderscore) {
if (silent !== true) {
console.log(chalk.yellow('Warning! File with empty content, skipped'));
console.log(chalk.yellow('Warning! Filename starts with \'_\' (underscore), skipped'));
console.log(chalk.magenta(file.path));
}
return ['isEmpty'];
return ['isUnderscore'];
}
}

if (noUnderscore) {
let hasUnderscore = path.basename(file.path).indexOf('_') === 0;
if (noEmpty) {
let fileContent = String(file.contents);

if (hasUnderscore) {
fileContent = fileContent.replace(/\s|\t|\n|\r/g, '');
if (!fileContent.length) {
if (silent !== true) {
console.log(chalk.yellow('Warning! File starting with \'_\', skipped'));
console.log(chalk.yellow('Warning! Filename with empty content, skipped'));
console.log(chalk.magenta(file.path));
}
return ['isUnderscore'];
return ['isEmpty'];
}
}

Expand Down
7 changes: 4 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"name": "gulp-not-supported-file",
"version": "1.1.2",
"version": "1.1.3",
"description": "Check the file before process it in your Gulp plugin",
"main": "index.js",
"scripts": {
"test": "happiness && gulp test",
"test": "happiness --verbose | snazzy && gulp test",
"happiness-fix": "happiness --fix"
},
"repository": {
Expand Down Expand Up @@ -34,6 +34,7 @@
"gulp-mocha": "^4.3.1",
"gulp-util": "^3.0.8",
"happiness": "^7.1.2",
"should": "^11.2.1"
"should": "^11.2.1",
"snazzy": "^7.0.0"
}
}

0 comments on commit eef2488

Please sign in to comment.