pxt icon indicating copy to clipboard operation
pxt copied to clipboard

How to choose extension's tag or branch?

Open AITosee opened this issue 2 years ago • 2 comments

Hi,

I'm a developer of makercode extensions, I want to ask, is there any way to choose extension version(tag) or branch while I add extensions?

I had tried the method in Additional notes

You can use a non-master branch by going to Import URL and saying something like https://github.com/jrandomhacker/pxt-mypkg#mybranch. User note, this hasn’t been extensively tested yet.

Unfortunately, it's useless, is there another way to choose branch or tag?

Thank you very much.

AITosee avatar Mar 19 '22 14:03 AITosee

To clarify, is this when you are developing the extension itself or adding a dependency?

For when you are developing an extension, you can click on the tag right next to the extension title in the project github view to select or create a branch

image --> image

for using a specific release as a dependency in a project, we don't have any nice UI elements to handle this :( it can be accomplished by manually editing the pxt.json file for the project. (Be very careful when editing this file -- I would highly suggest trying this in an empty project / making a share link or duplicate of the file you are working before editing pxt.json, as it may be hard to recover the project if that file because invalid).

below the sim (depending on the target you are using, you may need to be in the javascript view):

image

edit settings as text

image

and then you can change the tag / branch you want to use for your extension by changing the portion after the # for the given extension:

image

note that specifying releases is better than branches, as you will likely run into caching issues with branches (e.g. it'll have a local copy of the extension after it first fetches the branch and not update for a while, if ever).

jwunderl avatar Mar 19 '22 15:03 jwunderl

Hi @jwunderl

Thanks for your reply, sorry my question description may not be very clear.

I want to know while I use MakeCode and adding an extensions: image

For example, if I enter link:

github.com/User/repo

The main branch will be added to my makecode project. if I enter:

github.com/User/repo#branchA

The sub-branchA will be added to my makecode project.

=========================================================================

I reason why I want to know this is because My MakeCode Extension is very large, if I add all functions the binary after compiled will be too large and can't upload to microbit. So I figured out a way (maybe stupid):

I create another branch in my extension, and user can choose the complete version or the minimum version by choose the difference branch.

I know I can also create 2 repos, but it's maybe a little bit difficult to manage(need to create a lot of repos).

So, it would be fantastic if I can choose the branch or tag while I adding extension like:

https://github.com/User/repo  // add the default branch
https://github.com/User/repo#branchA  // add the branchA(may be a pre-release version)
https://github.com/User/repo#tagA  // add the tagA(may be need to rollback to the old version or frozen the version)

Thanks~

AITosee avatar Mar 20 '22 05:03 AITosee