First attempt at premium plugin / bitbucket / composer setup

I’m having trouble setting this up, I’ve read @swalkinshaw posts and a few other discourse posts but I keep getting errors and feel like I’m missing a trick.

I have downloaded gravityforms plugin and created a bitbucket private repo… Git not Mercurial as I don’t really know the difference.

in my composer.json file under “repositories” I have:

{
      "type": "package",
      "package": {
        "name": "accountname/gravityforms",
        "type": "wordpress-plugin",
        "version": "master",
        "dist": {
          "type": "vcs",
          "url": "git@bitbucket.org/accountname/gravityforms.git"
        },
        "require" : {
          "composer/installers": "*"
        }
    }
}

and in require I have: "accountname/gravityforms":"dev-master"

I also have a composer.json file in my bitbucket repo but I’m not too clear on whether this is needed or not? The code in this file is the same as under “repositories” above. I think I might be getting a bit confused here.

My current error when I run composer update is:

[InvalidArgumentException]                                                                      
  Unknown downloader type: vcs. Available types: git, svn, hg, perforce, zip, rar, tar, gzip, ph  
  ar, file. 

But to be honest, I’ve tried loads of different things and get different errors whatever I try. If someone could help point me in the right direction, or post a really simple “just do this = a, b, c”, to get this working I’d really appreciate it!

Hey @noob ,

I asked a similar question a while ago which might be worth having a look at. What worked for me is you would need the code above inside the plugin’s bitbucket repo with

{
      "type": "vcs",
      "url": "git@bitbucket.org:accountname/reponame.git"
}

and

"accountname/reponame":"dev-master"

inside your site’s composer.json file, however others did it slightly differently.

For simplicity’s sake (or to just get this working quickly) nowadays I copy the plugin to the /plugins folder and update the .gitignore in the /site folder to include these folders and check them into git:

# ignore plugins folder
web/app/plugins/*
# but don't ignore these folders (these lines begin with !)
!web/app/plugins/.gitkeep
!web/app/plugins/advanced-custom-fields-pro
!web/app/plugins/gravityforms
2 Likes