microsoft/vscode-vsce

Why a .vscodeignore file? Use the files property instead

SamVerschueren opened this issue Β· 14 comments

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

We'll just support both.

That would be great!

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).

There is also .npmignore

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

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?

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.

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 Cool. I guess most people would say that it's not the most elegant solution?!

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

# Ignore everything
*
*/**

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!

@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 😞

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