grunt - fix grunt.file.expand errors (#29299)

- patterns can be a string or a string array
- options can have a 'cwd' property
This commit is contained in:
Per Rovegård
2018-10-05 23:50:25 +02:00
committed by Wesley Wigham
parent 1748f1af66
commit eb7be7c32c
2 changed files with 12 additions and 1 deletions

View File

@@ -133,4 +133,9 @@ exports.exports = function(grunt: IGrunt) {
let myTest = function (grunt: IGrunt) {
grunt.file.expand(['*.ts']);
grunt.file.expand('*.ts');
// 'cwd' in options, and string pattern
grunt.file.expand({
cwd: '.'
}, '*.ts');
}

View File

@@ -446,7 +446,7 @@ declare namespace grunt {
* grunt.file.setBase or the --base command-line option.
*/
expand(patterns: string | string[]): string[];
expand(options: IFilesConfig, patterns: string[]): string[];
expand(options: IFilesConfig, patterns: string | string[]): string[];
/**
* Returns an array of src-dest file mapping objects.
@@ -595,6 +595,12 @@ declare namespace grunt {
// filter?: string
// filter?: (src: string) => boolean
filter?: any;
/**
* Patterns will be matched relative to this path, and all returned filepaths will
* also be relative to this path.
*/
cwd?: string;
}
/**