Sublime Forum

How is the Preferences->Package Settings menu constructed?

#1

I have a plugin that I’d like to distribute to some other users, and I’d like to make it easy for them to customize. I have a Packages/MyPackage/MyPackage.sublime-settings file, but that doesn’t seem to automatically make a Package Settings submenu.

Is this something Package Control sets up? I would love to be able to use Package Control, but I’m not sure it would work for me. I need to keep some packages private (no GitHub or BitBucket), but I can connect to a git server via ssh (not https). I don’t see a way to configure package control for this, though. Is it possible?

0 Likes

#2

I figured out how the menus are constructed (Main.sublime-menu files). I’d still like to be able to set up Package Control, if that’s possible.

0 Likes

#3

Referring to packages stored in git repositories, PackageControl can only install packages that exist on GitHub or BitBucket and those repositories have to be publicly available; as far as I’m aware there is no facility to enter user credentials at all.

That said, you can distribute private packages without using Git by creating your own repository JSON file and having it serve sublime-package files; note that here the name repository refers to a repository of packages and not a git repository.

To do so you need to set up a web server that can serve files via https and which is accessible to everyone who will install the packages. PackageControl will only handle files that are served over an https connection.

The first step would be to create your sublime-package files, which you can do via PackageControl itself by using the PackageControl: Create Package File command from the command palette. The package_destination and package_profiles settings in the Package Control settings control how this works, but by default you can just pick the Default profile when you’re prompted and the package file will appear on your desktop.

The next step is to create the repository JSON file, which would look something like the following (fill out the package fields as appropriate):

{
    "schema_version": "3.0.0",

    "packages": [
        {
            "name": "My Package Name",
            "description": "My Package Description",
            "homepage": "https://packagehomepage.com/",
            "author": "youusernamehere",
            "releases": [
                {
                    "version": "1.0.0",
                    "url": "https://packagehomepage.com/PackageFile.sublime-package",
                    "date": "2019-05-28 21:33:25",
                    "sublime_text": ">=3126",
                    "platforms": ["*"]
                }
            ]
        }
    ]
}

To use it, you tell your users to select the Package Control: Add Repository command from the command palette and enter the URL to the json file that you created. Once that’s done, your packages will be offered along with all other packages when you use the Install Package command.

When doing this, you’re responsible for updating the sublime-package file and updating the information in the json file to show a new version number and so on.

More information on this is in the PackageControl docs page and the links from that page (such as the example repository file shown there).

1 Like

#4

Thanks for the help! It was unclear from the Package Control docs that you could only use git with GitHub or BitBucket. If the URL for a private package needs to just be a file, that shouldn’t be hard to set up.

0 Likes