adapt-cli icon indicating copy to clipboard operation
adapt-cli copied to clipboard

v6 registry issues

Open oliverfoster opened this issue 8 years ago • 2 comments

https://github.com/adaptlearning/adapt-cli/blob/issue/v4/lib/Constants.js#L36 can drop the .publish

this means we can have multiple search registries.

function getRegistry() {
    if (process.env.ADAPT_REGISTRY) return process.env.ADAPT_REGISTRY;
    if (fs.existsSync('./.bowerrc')) { // ./adapt-pluginfolder
        return JSON.parse(fs.readFileSync('./.bowerrc').toString()).registry;
    }
    if (fs.existsSync('../../.bowerrc')) { // ../../adapt-pluginfolder
        return JSON.parse(fs.readFileSync('../../.bowerrc').toString()).registry;
    }
    return 'http://adapt-bower-repository.herokuapp.com/';
}

https://github.com/adaptlearning/adapt-cli/blob/issue/v4/lib/commands/register.js#L17 < would need to updated accordingly

this allows for:

{
  "directory": "src",
  "registry": {
    "register": "http://adapt-bower-repository-v4.herokuapp.com/",
    "search": [
        "http://adapt-bower-repository-v4.herokuapp.com/",
        "http://adapt-bower-repository.herokuapp.com/"
    ]
  }
}

oliverfoster avatar Oct 09 '17 17:10 oliverfoster

@oliverfoster I like this idea. So just to confirm, we'd need to update the various commands (install, register, search etc) to check for two main cases: in the first case registry is just a string; in the second case registry is a hash of paths to use for each of the various commands (we'd need a default path presumably so that there isn't the need to provide paths for every command?)

chris-steele avatar Oct 17 '17 08:10 chris-steele

or make sure it's always an object up front and change everything else accordingly? save having type switching logic in all the commands?

oliverfoster avatar Oct 17 '17 08:10 oliverfoster