Fix pattern matching in .vscodeignore#271
Fix pattern matching in .vscodeignore#271joaomoreno merged 2 commits intomicrosoft:masterfrom JimiC:fix-pattern-matching
Conversation
|
@joaomoreno Is there something blocking the merging? |
| const resources = gulp.src('src/**') | ||
| .pipe(filter(['**', '!**/*.ts'])); | ||
| const resources = gulp.src('src/**', { dot: true }) | ||
| .pipe(filter(['**', '!**/*.ts'], { dot: true })); |
There was a problem hiding this comment.
Does this actually change anything?
There was a problem hiding this comment.
This is crucial, otherwise minimatch does not match dotted files and folders, resulting in .vscodeignore file and .vscode folder not getting included in the compiled output, thus the relative test fails.
gulpfile.js
Outdated
|
|
||
| function watch(task) { | ||
| return cb => gulp.watch(['src/**', 'typings/**'], [task]); | ||
| return () => gulp.watch(['src/**', 'typings/**'], [task]); |
There was a problem hiding this comment.
This is wrong since gulp checks for the args length of the function. If there is no parameter in the function, gulp expects a stream. If it doesn't return a stream, it marks the task as immediately completed. I suggest to leave the cb there.
There was a problem hiding this comment.
Have abandoned gulp years ago, so I have to admit that I don't remember how it works. Since it's crucial I'll revert this.
src/test/package.test.ts
Outdated
| // pattern of file name | ||
| if (!fs.existsSync(path.join(cwd, 'logger.log'))) { | ||
| fs.writeFileSync(path.join(cwd, 'logger.log'), 'log'); | ||
| } |
There was a problem hiding this comment.
We should create a fixture instead of generating it dynamically here, it would be easier to grasp and maintain.
There was a problem hiding this comment.
My original thought but I tried to keep the coding pattern. Will switch to fixture files.
| .then(stat => stat && stat.isDirectory() ? `${i}/**` : i); | ||
| }); | ||
| return Promise.all(promises).then<string[]>(i => Promise.resolve(i)); | ||
| }) |
There was a problem hiding this comment.
Is there really not a better way to do this without disk access?
There was a problem hiding this comment.
I can't think of another way to determine if an entry is a directory or a file. Suggestions are welcome.
Only my vacation 😎 |
|
Thanks! 🎆 I removed the |
|
🙄 Interesting approach. Since it works, fine by me. |
|
I guess no one was aware of the |
Fixes #265
This PR attempts to keep backward compatibility and be compliant with
Gitignoring pattern format (.gitignore)Test fixtures and case have been included.
Note:
fs.lstathas been used instead offs.exists(line 708), in order to be compliant with deprecation offs.existsin[email protected].fs.existsSyncwas not used deliberately, in order to avoid I/O blocking.