Giter VIP home page Giter VIP logo

vscode-vsce's Introduction

@vscode/vsce

The Visual Studio Code Extension Manager

Build Status Version

This tool assists in packaging and publishing Visual Studio Code extensions.

Read the Documentation on the VS Code website.

Requirements

Node.js at least 18.x.x.

Linux

In order to save credentials safely, this project uses keytar which uses libsecret, which you may need to install before publishing extensions. Setting the VSCE_STORE=file environment variable will revert back to the file credential store. Using the VSCE_PAT environment variable will also avoid using keytar.

Depending on your distribution, you will need to run the following command:

  • Debian/Ubuntu: sudo apt-get install libsecret-1-dev
  • Alpine: apk add libsecret
  • Red Hat-based: sudo yum install libsecret-devel
  • Arch Linux: sudo pacman -S libsecret

Usage

$ npx @vscode/vsce --version

@vscode/vsce is meant to be mainly used as a command-line tool. It can also be used as a library since it exposes a small API. When using @vscode/vsce as a library, be sure to sanitize any user input used in API calls to prevent security issues.

Supported package managers:

  • npm >=6
  • yarn >=1 <2

Configuration

You can configure the behavior of vsce by using CLI flags (run vsce --help to list them all). Example:

$ npx @vscode/vsce publish --baseImagesUrl https://my.custom/base/images/url

Or you can also set them in the package.json, so that you avoid having to retype the common options again. Example:

// package.json
{
  "vsce": {
    "baseImagesUrl": "https://my.custom/base/images/url",
    "dependencies": true,
    "yarn": false
  }
}

Development

First clone this repository, then:

$ npm install
$ npm run watch:build # or `watch:test` to also build tests

Once the watcher is up and running, you can run out of sources with:

$ node vsce

Tests can be executed with:

$ npm test

Note: Yarn is required to run the tests.

vscode-vsce's People

Contributors

alefragnani avatar bandantonio avatar barretlee avatar chrisdias avatar connor4312 avatar dependabot[bot] avatar felipecrs avatar isidorn avatar jamesgeorge007 avatar jeffreyca avatar jimic avatar joaomoreno avatar jrieken avatar kieferrm avatar lachriz avatar mjbvz avatar nhedger avatar octref avatar prashantvc avatar ramya-rao-a avatar rbuckton avatar rebornix avatar rid9 avatar ritwickdey avatar robertohuertasm avatar roblourens avatar sandy081 avatar srtobi avatar tylerleonhardt avatar wangweixuan avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

vscode-vsce's Issues

Categories

Categories are not passing through - see JSON to VSIX spec

Auto-increment package version?

From @lukehoban:

One small but nice thing that Atom’s publishing does is to auto-increment version number based on a version increment flag and commit/tag/push that in the repo before packaging.

This is definitely more opinionated – but makes it really convenient to re-publish frequently, and avoids accidentally re-publishing without incrementing version number.

Here's a snippet from the APM docs that talks about the behaviour.

Usage: apm publish [<newversion> | major | minor | patch | build]
       apm publish --tag <tagname>
       apm publish --rename <new-name>

Publish a new version of the package in the current working directory.

If a new version or version increment is specified, then a new Git tag is
created and the package.json file is updated with that new version before
it is published to the apm registry. The HEAD branch and the new tag are
pushed up to the remote repository automatically using this option.
...

Would it makes sense to add something similar for to vsce's publish command?

Add Other as category as default

When an extension does not have any categories defined in project.json add the other category in for them so they land there.

.vscodeignore and devDependencies

From @lukehoban

The vsce documentation mentions:

Note: development dependencies listed in devDependencies will be automatically ignored, you don't need to add them to the .vscodeignore file.

However, I'm not seeing this happen for my own extensions. I'm seeing whatever happens to be in my node_modules folder get pulled into the package. In my development environment where I am using npm install locally to pull in devDependencies, this includes those files.

I can go ahead and selectively ignore these, but not sure what that text above is intended to convey.

Add command to install and uninstall extensions

Similar to apm's install and uninstall commands, it would be great to have an official way of installing and uninstalling extensions via the command line in a platform independent way.

This would enable a nicer way of maintaining a consistent development environment across multiple PCs/platforms without resorting to symlinking the extensions to cloud storage (see microsoft/vscode#679).

Enable extensions to specify an icon

From @willsmythe :

Hi Joao,

  1.   At a minimum, the developer should provide a 128x128 icon for his/her extension
    
  2.   Your packaging tool should include any icons specified by the developer in the generated vsix package
    
    · Don’t worry about “wide” --- we’re not planning on using it
    · I wouldn’t inject a default icon at package time if the developer didn’t specify one. The Marketplace should present a default icon if none was specified. This gives the Marketplace more control over how it present extensions without icons. Sandeep - can you make sure this happens/works?
  3.   Set the `<icon>xxx</icon>` tag in the `<metadata>` section of the .vsixmanifest to the “default” icon (128x128). The value is the path to the icon from the root of the .vsix package.
    
  4.   Define an asset for the icon in the Assets section of the .vsixmanifest:
    
    · For example: <Asset Type="Microsoft.VisualStudio.Services.Icons.Default" d:Source="File" Path="icons/myicon.png" Addressable="true"/>
    · Note: the Marketplace should (but currently doesn’t) extract the icon from the .vsixmanifest and make it the Icons.Default addressable resource.

https://www.visualstudio.com/en-us/integrate/extensions/get-started/visual-studio

Ignore .vsixmanifest files by default

João:

Great catch!
Actually there is an extension.vsixmanifest file and a extension/.vsixmanifest. That is scary and probably a mistake from the user that created it.
Is that (multiple *.vsixmanifest) the thing that makes it fail, you think? If so, I'll fix it right now in our tool and be sure no other .vsixmanifest ends up in the archive.

Sean Lumley:

I do think that is the cause. I think we process both of them and since one of the properties is in both we are hitting a dup key exception. We need to handle that better, but I think removing one of them will work.

Images and links in README.md need to be massaged

From @willsmythe:

You may have already noticed a problem, but if not, you will J … the problem: relative images and links in the readme are not going to resolve when the readme (details content) is rendered on the Marketplace site. This is because an item’s assets are not addressable relative to the “item details” page of the Marketplace (the assets are also served from a different domain).

One quick, but not great option is: allow an extension developer to specify a base absolute URI that all relative URIs in the readme will get transformed as (during packaging). For example: vsce --baseContentUri=https://raw.githubusercontent.com/MyOrg/MyRepo/master. You’ll then need to parse the readme, possibly update it with absolute URLs (for any relative URLs), and include this version of the readme as the details content.

Longer term, we’ll find a way to make this work. But, at a minimum this means ensuring all files referenced by the readme (and therefore referenced from the Marketplace items details page) are marked as “Addressable” assets in the .vsix.

vsce list [publisher] - publisher isn't optional

@egamma

'vsce help' tells me:

  list [publisher]             Lists all extensions published by the given publisher

'vsce list' tells me

 C:\Users\egamma\Projects\go-code>vsce list
Error: Missing publisher name

OR I just misunderstood the notation OR the help message should be

     vsce list <publisher> 

see the npm help for an example:
owner npm owner add

Ignore dependencies of devDependencies

Are dependencies of devDependencies ignored?

When I use npm install and then vsce ls a lot of node_modules are still listed. the devDependencies are ignored but their dependencies are not.

Wouldn't it be better to include all production dependencies and their production dependencies and ignore all other modules?

Should validate name and publisher

Extension names may only contain A through Z, a through z, 0 through 9 and -. The extension name must start with an alphabetic or numeric character.

Publisher names have the same validation rules.

publisher name validation rules don't actually allow .

Publisher human-friendly name: (adam.baldwin) Adam Baldwin
Personal Access Token: ****************************************************

Error: Failed Request: Bad Request(400) - The publisher name 'adam.baldwin' is invalid. Publisher names may only contain 'A' through 'Z', 'a' through 'z', '0' through '9', '.' and '-'. The publisher name must start with an alphabetic or numeric character.

however when I tried adambaldwin it worked just great.

Readme Matching

This is not working as expected. The RegExp does not get the correct 2nd match:

Something more like:
github\.com\/([^]+)\/([^]+)\/([\w-_]*|$) is required

for:
https://github.com/Microsoft/vscode-spell-check.git

Why a .vscodeignore file? Use the files property instead

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

API is not exposed

API should be exposed so vsce commands can easily be automated using a gulp task.

running "vsce create-publisher <publisher>" fails (vsce -V => 0.9.0)

See error below
/usr/local/lib/node_modules/vsce/node_modules/denodeify/index.js:40
return new Promise(promiseHandler);
^
ReferenceError: Promise is not defined
at /usr/local/lib/node_modules/vsce/node_modules/denodeify/index.js:40:15
at Object.read (/usr/local/lib/node_modules/vsce/out/util.js:30:12)
at Object.createPublisher (/usr/local/lib/node_modules/vsce/out/store.js:90:19)
at Command. (/usr/local/lib/node_modules/vsce/out/main.js:51:73)
at Command.listener (/usr/local/lib/node_modules/vsce/node_modules/commander/index.js:301:8)
at Command.EventEmitter.emit (events.js:98:17)
at Command.parseArgs (/usr/local/lib/node_modules/vsce/node_modules/commander/index.js:615:12)
at Command.parse (/usr/local/lib/node_modules/vsce/node_modules/commander/index.js:458:21)
at module.exports (/usr/local/lib/node_modules/vsce/out/main.js:67:13)
at Object. (/usr/local/lib/node_modules/vsce/out/vsce:2:18)

README.md is not picked up by vsce

Hi There,

I have published my snippet extension over marketplace. I have put all details in package.json.

But in extension home page, it doesn't show any description about tool.

https://marketplace.visualstudio.com/items/UVBrain.Angular2

If you go to my extension above, it mention as
"No overview has been entered by publisher"

I do have readme.md file in my github

https://github.com/ultrasonicsoft/vscode-ng2-typescript-snippets

Could you please let me know how can I provide description in overview section?

Thanks!

Relative paths in READMEs are being directed at raw instead of rendered contents

I'm not sure whether this is a vsce issue or a gallery issue.

Relative paths from READMEs are being redirected to GitHub, which is nice, but they appear to be redirected to /raw which looks pretty bad – seems they can be directed to the normal GitHub page instead which renders content in the expected way (e.g. As markdown):

Current:
https://github.com/Microsoft/vscode-go/raw/master/src/debugAdapter/Readme.md

Expected:
https://github.com/Microsoft/vscode-go/blob/master/src/debugAdapter/Readme.md

Add Options for Publish without Packaging step

I'd like to be able to separate out the package step and the publishing step. At the moment I can create a package without uploading it, but I can't upload a package without first building the package. I'd love to have a variation of the package command that is something like this:

vsce publish --vsix [path to vsix] --publisher [publisher name] --name [extension name]

VSCE publisher case sensitivity inconsistent

From @Wosi:

This is a small bug. I write it just for documentation purpose.

When I published my plugin I used the publisher "wosi". I was able to login and publish the package. I could see it in the extension gallery but I when I tried to install it I received a publisher mismatch error.
After updating the package.json to use the publisher "Wosi" I could install it. Obviously VSCE ignores the case while VSCode does not.

TargetID

Disallow an engine of '*' on packaging
Set a target ID
Will get details on the XML tomorrow

Getting 403 forbidden trying to publish an extension

I followed the instructions here and when I do vsce publish I get the forbidden error. See full stack below:

peterj at Peter-MacBook-Pro in ~/projects/work/github/vscode-docker on master [!?]
$ vsce create-publisher DockerTools
Publisher human-friendly name: (DockerTools) DockerTools
Personal Access Token: ****************************************************

Successfully created publisher 'DockerTools'.

peterj at Peter-MacBook-Pro in ~/projects/work/github/vscode-docker on master [!?]
$ vsce login DockerTools
Publisher 'DockerTools' is already known
Do you want to overwrite its PAT? [y/N] y
Personal Access Token for publisher 'DockerTools': ****************************************************

Authentication successful. Found publisher 'DockerTools'.

peterj at Peter-MacBook-Pro in ~/projects/work/github/vscode-docker on master [!?]
$ vsce publish
Executing prepublish script 'tsc'...
Publishing [email protected]...
Error: Failed Request: Forbidden(403) - https://app.market.visualstudio.com/_apis/gallery/extensions

vsce list publisher doesn't filter extensions

@egamma

vsce list publisherName lists all extensions and not only the extensions of the given publisher.

C:\Users\egamma\Projects\go-code>vsce list eg2
uuid-improved @ 3.0.2
movelines @ 0.0.1
go-code @ 1.0.1
uuid @ 3.1.2
theme-green @ 0.1.0
ben-best @ 0.0.2
benbest @ 0.0.2

C:\Users\egamma\Projects\go-code>vsce list
Error: Missing publisher name

C:\Users\egamma\Projects\go-code>vsce list eg
uuid-improved @ 3.0.2
movelines @ 0.0.1
go-code @ 1.0.1
uuid @ 3.1.2
theme-green @ 0.1.0
ben-best @ 0.0.2
benbest @ 0.0.2

Categories

Categories did not end up in my VSIX for spell-check.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.