Sublime Forum

Structure repo how I want & distribute via Package Control?

#1

I just developed a Sublime Text plugin / package (Cycle Setting) for the first time, pushed it to github, then looked at the Package Control developer instructions. Is there any [easy] way to structure my repo the way I want (not necessarily putting all package files in the root / putting files in the root that I don’t want in the installed package) and still distribute via Package Control?

I’m thinking I’d like to be able to have files in a repo that are related to a package or its development without them actually being installed on users’ machines with the package.

If I understand correctly, it looks like it would be possible to zip it up with a .sublime-package extension and point to that from a repository JSON file. But, that would be extra work / steps. Is there any way to structure the repo how I want and just point Package Control to a github URL? I haven’t been able to find a way to request a zip of a subtree of a branch from github, so I’m guessing Package Control wouldn’t be able to do this without taking an additional path argument and either downloading each file individually or downloading the zip of the whole branch and then extracting the subtree from it. But maybe there’s a solution I haven’t thought of.

0 Likes

#2

You could always maintain a separate branch that was the distribution code and do your development in master. Some developers maintain a package.json file that points to a branch or tags on GitHub, if only for the sake of semantic versioning.

0 Likes

#3

Thanks for the reply and suggestion. I was looking into using a separate branch, but I wanted to make sure it was necessary before going through the hassle. Here’s the workflow I’m trying now:

Original repo layout:

Repo Root
	README
	...
	Packages
		Package Name
			...

One time:

  • Create empty branch, package-control (as here)

Each time:

$ git checkout package-control

$ # read-tree saves a bit of the hassle of shuffling files around

$ git read-tree -mu master:"Packages/Package Name" 

$ # repeat checkout for other files as necessary)

$ git checkout master -- README

$ git commit

Right, but that’s not necessary just to point to a branch or tag – that can be done from the main repositories.json file, correct? I already believe that’s the case, but if it is, I don’t want other people to get confused when they read this thread.

0 Likes