-
Notifications
You must be signed in to change notification settings - Fork 246
Fix pattern matching in .vscodeignore #271
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -26,12 +26,13 @@ const readFile = denodeify<string, string, string>(fs.readFile); | |
| const unlink = denodeify<string, void>(fs.unlink as any); | ||
| const exec = denodeify<string, { cwd?: string; env?: any; }, { stdout: string; stderr: string; }>(cp.exec as any, (err, stdout, stderr) => [err, { stdout, stderr }]); | ||
| const glob = denodeify<string, _glob.Options, string[]>(_glob); | ||
| const lstat = denodeify<string, fs.Stats>(fs.lstat); | ||
|
|
||
| const resourcesPath = path.join(path.dirname(__dirname), 'resources'); | ||
| const vsixManifestTemplatePath = path.join(resourcesPath, 'extension.vsixmanifest'); | ||
| const contentTypesTemplatePath = path.join(resourcesPath, '[Content_Types].xml'); | ||
|
|
||
| const MinimatchOptions = { dot: true }; | ||
| const MinimatchOptions: minimatch.Options = { dot: true }; | ||
|
|
||
| export interface IFile { | ||
| path: string; | ||
|
|
@@ -701,7 +702,15 @@ function collectFiles(cwd: string, useYarn = false): Promise<string[]> { | |
|
|
||
| return readFile(path.join(cwd, '.vscodeignore'), 'utf8') | ||
| .catch<string>(err => err.code !== 'ENOENT' ? Promise.reject(err) : Promise.resolve('')) | ||
| .then(rawIgnore => rawIgnore.split(/[\n\r]/).map(s => s.trim()).filter(s => !!s)) | ||
| .then(rawIgnore => rawIgnore.split(/[\n\r]/).filter(s => !!s).map(s => s.trim().replace(/\/$/, ''))) | ||
| .then(ignore => { | ||
| const promises = ignore.map(i => { | ||
| return lstat(i) | ||
| .catch<fs.Stats>(() => Promise.resolve()) | ||
| .then(stat => stat && stat.isDirectory() ? `${i}/**` : i); | ||
| }); | ||
| return Promise.all(promises).then<string[]>(i => Promise.resolve(i)); | ||
| }) | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is there really not a better way to do this without disk access?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I can't think of another way to determine if an entry is a directory or a file. Suggestions are welcome. |
||
| .then(ignore => [...defaultIgnore, ...ignore, '!package.json']) | ||
| .then(ignore => ignore.filter(i => !/^\s*#/.test(i))) | ||
| .then(ignore => _.partition(ignore, i => !/^\s*!/.test(i))) | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| { | ||
| "tasks": [], | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| # pattern of dotted directory without backslash | ||
| .vscode | ||
|
|
||
| # pattern of directory with trailing backslash | ||
| out/ | ||
|
|
||
| # pattern of file name | ||
| *.log |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| log |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| { | ||
| "name": "uuid", | ||
| "publisher": "joaomoreno", | ||
| "version": "1.0.0", | ||
| "engines": { "vscode": "*" } | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this actually change anything?
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is crucial, otherwise
minimatchdoes not matchdottedfiles and folders, resulting in.vscodeignorefile and.vscodefolder not getting included in the compiled output, thus the relative test fails.