Skip to content

Commit

Permalink
Doc improvements, TypeScript refinements.
Browse files Browse the repository at this point in the history
  • Loading branch information
Silic0nS0ldier committed Oct 24, 2020
1 parent af571ad commit 2e45d3b
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 22 deletions.
8 changes: 5 additions & 3 deletions changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
* TypeScript definitions.

### Fixed
* Issues deleting files terminating the stream early despite other deletions potentially still occurring in background.
* File system errors during deletion being reported while other deletions are still in progress, causing the process to appear to "hang" after errors.<br/>
This issue is typically encountered if a file is removed by something else while unseen files are being deleted.

### Changed
* Only forward slashes supported in glob expression. [[email protected]](https://github.com/sindresorhus/globby/releases/tag/v10.0.0)[[email protected]](https://github.com/mrmlnc/fast-glob/releases/tag/3.0.0)
* Only forward slashes supported in filter expressions. [[email protected]](https://github.com/sindresorhus/globby/releases/tag/v10.0.0)[[email protected]](https://github.com/mrmlnc/fast-glob/releases/tag/3.0.0)
* Filter expressions are now passed to fast-glob (through globby) instead of the former node-glob (which use minimatch). Compatibility is high, however there may be some inconsistencies. [[email protected]](https://github.com/sindresorhus/globby/releases/tag/v8.0.0)
* Increased minimum NodeJS version from 6 to 10.

## [0.2.0] - 2016-06-19
Expand All @@ -37,4 +39,4 @@ _Unknown_
[0.2.0]: https://github.com/hh10k/gulp-prune/releases/tag/v0.2.0
[0.1.2]: https://github.com/hh10k/gulp-prune/releases/tag/v0.1.2
[0.1.1]: https://github.com/hh10k/gulp-prune/releases/tag/v0.1.1
[0.1.0: https://github.com/hh10k/gulp-prune/releases/tag/v0.1.0
[0.1.0]: https://github.com/hh10k/gulp-prune/releases/tag/v0.1.0
6 changes: 3 additions & 3 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -211,8 +211,8 @@ class PruneTransform extends Transform {
* @typedef {(dest: string) => PruneTransform} DestFunc
* @typedef {(dest: string, options: Options) => PruneTransform} DestWithOptionsFunc
* @typedef {(options: OptionsWithDest) => PruneTransform} DestAsOptionsFunc
* @type {DestFunc | DestWithOptionsFunc | DestAsOptionsFunc}
*/
* @type {DestFunc & DestWithOptionsFunc & DestAsOptionsFunc}
*/// @ts-ignore
module.exports = function prune(dest, options) {
// Parse, validate and normalize inputs to handle function overloads
verify(arguments.length <= 2, 'too many arguments');
Expand Down Expand Up @@ -254,7 +254,7 @@ module.exports = function prune(dest, options) {
if (!Array.isArray(options.ext)) {
options.ext = [ options.ext ];
}
verify((options.ext instanceof Array && options.ext.every(e => typeof e === 'string')), 'options.ext must be a string or string[]');
verify(Array.isArray(options.ext) && options.ext.every((/** @type {any} */ e) => typeof e === 'string'), 'options.ext must be a string or string[]');
strictOptions.ext = options.ext.slice();
}

Expand Down
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,15 @@
"eslint": "^7.12.0",
"mocha": "^8.2.0",
"mock-fs": "^4.13.0",
"typescript": "^4.0.3",
"vinyl": "^2.2.1"
"typescript": "^4.0.3"
},
"dependencies": {
"@ungap/promise-all-settled": "^1.1.2",
"aggregate-error": "^3.1.0",
"ansi-colors": "^4.1.1",
"fancy-log": "^1.3.3",
"globby": "^11.0.1",
"plugin-error": "^1.0.1"
"plugin-error": "^1.0.1",
"vinyl": "^2.2.1"
}
}
26 changes: 13 additions & 13 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,18 @@ This example will delete all files in the target directory that do not match a s
after transpiling changed files.

```js
var gulp = require('gulp');
var prune = require('gulp-prune');
var newer = require('gulp-newer');
var babel = require('gulp-babel');
const gulp = require('gulp');
const prune = require('gulp-prune');
const newer = require('gulp-newer');
const babel = require('gulp-babel');

gulp.task('build', () => {
module.exports.build = () => {
return gulp.src('src/**/*.js')
.pipe(prune('build/'))
.pipe(newer('build/'))
.pipe(babel({ presets: [ 'es2015' ] }))
.pipe(gulp.dest('build/'));
});
};
```

### Prune with custom mapping
Expand All @@ -33,21 +33,21 @@ The mapping can be customised if the source and destination file names are diffe
This example will prune all .js and .js.map files that aren't from the source .ts files.

```js
var gulp = require('gulp');
var prune = require('gulp-prune');
var newer = require('gulp-newer');
var sourcemaps = require('gulp-sourcemaps');
var typescript = require('gulp-typescript');
const gulp = require('gulp');
const prune = require('gulp-prune');
const newer = require('gulp-newer');
const sourcemaps = require('gulp-sourcemaps');
const typescript = require('gulp-typescript');

gulp.task('build', () => {
module.exports.build = () => {
return gulp.src('src/**/*.ts')
.pipe(prune({ dest: 'build/', ext: [ '.js', '.js.map' ] }))
.pipe(newer({ dest: 'build/', ext: '.js' }))
.pipe(sourcemaps.init())
.pipe(typescript())
.pipe(sourcemaps.write('.'))
.pipe(gulp.dest('build/'));
});
}
```

## API
Expand Down

0 comments on commit 2e45d3b

Please sign in to comment.