adaptlearning / adapt-cli

Command line and library interface for the Adapt Framework
https://community.adaptlearning.org/
25 stars 21 forks source link

v6 registry issues #78

Open oliverfoster opened 7 years ago

oliverfoster commented 7 years ago

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/"
    ]
  }
}
chris-steele commented 6 years ago

@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?)

oliverfoster commented 6 years ago

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