Skip to content
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

Why a .vscodeignore file? Use the files property instead #12

Closed
SamVerschueren opened this issue Oct 19, 2015 · 14 comments
Closed

Why a .vscodeignore file? Use the files property instead #12

SamVerschueren opened this issue Oct 19, 2015 · 14 comments
Assignees

Comments

@SamVerschueren
Copy link

if I understand correctly, .vscodeignore is meant for files that should be ignored when the extension is installed.

In npm, this is already done by the files property in package.json. More information can be found under the files section https://docs.npmjs.com/files/package.json#files.

Where .vscodeignore is a blacklist of files that should not be installed, the files property is a whitelist of files that should be installed.

In my opinion, it would be way better to use the files property. Node package developers (should) already know about this setting and no extra file is used.


Originally posted at https://github.com/Microsoft/vscode-extensionbuilders/issues/35#event-438763500

@joaomoreno joaomoreno self-assigned this Oct 19, 2015
@joaomoreno
Copy link
Member

We'll just support both.

@SamVerschueren
Copy link
Author

That would be great!

@weinand
Copy link

weinand commented Nov 11, 2015

Yes, blacklisting is error prone: whenever I add another file to my project that should not end up in the extension, I have to add it to the .vscodeignore. It would be much simpler to have a whitelist (BOM).

@felixfbecker
Copy link

There is also .npmignore

@unional
Copy link

unional commented Jan 30, 2016

Should the .vscodeignore file includes README.md by default?

@joaomoreno joaomoreno assigned joaomoreno and unassigned joaomoreno Feb 29, 2016
@rebornix
Copy link
Member

rebornix commented Jun 2, 2016

Put my thoughts here and hope it help :)

Even though Bower is somewhat dead already, I do like how it does component referencing in old days. When you try to install bower packages, it will save the package in bower_components and inject the main js file of the newly added component to your index.html. Meanwhile you can specific a mapping for the bower components like below

{
  "backbone": "components/backbone/index.js",
  "jquery": "components/jquery/index.js",
  "underscore": "components/underscore/index.js"
}

This way you can specific which file is the main file for each component if you don't like the default one bower picks for you. If we can similar experience, I don't need to write any glob expressions in the vscodeignore file as it's always difficult to say which files are necessary and which are not in each npm_component folder.

Another thing is, we can always put debugger, code snippet or linters together in one extension, which means there might be multiple entry points for a single extension. In this case, we can't merge all javascript code to one file.

Above is just my draft idea and it should be carefully reconsidered, but I think a workable solution for now adding some grunt/gulp sample to the yeoman generator?

@hediet
Copy link
Member

hediet commented Dec 11, 2016

We'll just support both.

Neither vsce nor its source code look like the files section of package.json is respected.
Do you still plan to support both?

I prefer whitelists to blacklists too, as they explicitly state what is being included and what not.
Besides, I know what I want to include, but I don't know all the temp/dev files various tools create that I don't want to include.

@selvinortiz
Copy link

This might be incredibly ignorant or shortsighted of me, but would ignoring everything and unignoring what you want, accomplish the same thing?

VS Code Ignore

# Ignore everything
*

# Whitelist what you need
!.vscodeignore
!src/*

@weinand
Copy link

weinand commented Mar 12, 2017

@selvinortiz yes, that approach works fine. I'm using it here: https://github.com/Microsoft/vscode-mono-debug/blob/master/.vscodeignore

@selvinortiz
Copy link

@weinand Cool. I guess most people would say that it's not the most elegant solution?!

@adamvoss
Copy link

adamvoss commented Jun 5, 2017

@selvinortiz Semantics are different from .gitignore. You need the following for the ignore part:

# Ignore everything
*
*/**

@joaomoreno
Copy link
Member

This iteration we focus on issue grooming. This issue is being closed to keep the number of issues in our inbox on a manageable level, we are closing issues that are not going to be addressed in the foreseeable future: We look at the number of votes the issue has received and the number of duplicate issues filed. More details here. If you disagree and feel that this issue is crucial: We are happy to listen and to reconsider.

If you wonder what we are up to, please see our roadmap and issue reporting guidelines.

Thanks for your understanding and happy coding!

@gjsjohnmurray
Copy link

@weinand wrote:

@selvinortiz yes, that approach works fine. I'm using it here: https://github.com/Microsoft/vscode-mono-debug/blob/master/.vscodeignore

I just discovered that 1.92 broke this technique. See #576

Seems it's not going to be reinstated 😞

@danielbayley
Copy link

We'll just support both.

@joaomoreno So why does the package.json files property not work, as it should?


that approach works fine

1.92 broke this technique. See #576

To clarify, @SamVerschueren @weinand @selvinortiz @adamvoss @gjsjohnmurray, and for anyone else running into this… The following .vscodeignore does work:

# Ignore everything
**

# Whitelist
!*.js

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests