generators/init-product/templates/plain/build.js
function toRepoUrl(url) {
  if (url.startsWith('git@')) {
    if (argv.useSSH) {
      return url;
    }
    // have an ssh url need an http url
    const m = url.match(/(https?:\/\/([^/]+)\/|git@(.+):)([\w\d-_/]+)(.git)?/);
    return `https://${m[3]}/${m[4]}.git`;
  }
  if (url.startsWith('http')) {
    if (!argv.useSSH) {
      return url;
    }
    // have a http url need an ssh url
    const m = url.match(/(https?:\/\/([^/]+)\/|git@(.+):)([\w\d-_/]+)(.git)?/);
    return `git@${m[2]}:${m[4]}.git`;
  }
  if (!url.includes('/')) {
    url = `Caleydo/${url}`;
  }
  if (argv.useSSH) {
    return `git@github.com:${url}.git`;
  }
  return `https://github.com/${url}.git`;
}
function toRepoUrl(url) {
  if (url.startsWith('git@')) {
    if (argv.useSSH) {
      return url;
    }
    // have an ssh url need an http url
    const m = url.match(/(https?:\/\/([^/]+)\/|git@(.+):)([\w\d-_/]+)(.git)?/);
    return `https://${m[3]}/${m[4]}.git`;
  }
  if (url.startsWith('http')) {
    if (!argv.useSSH) {
      return url;
    }
    // have a http url need an ssh url
    const m = url.match(/(https?:\/\/([^/]+)\/|git@(.+):)([\w\d-_/]+)(.git)?/);
    return `git@${m[2]}:${m[4]}.git`;
  }
  if (!url.includes('/')) {
    url = `Caleydo/${url}`;
  }
  if (argv.useSSH) {
    return `git@github.com:${url}.git`;
  }
  return `https://github.com/${url}.git`;
}
function toRepoUrl ( url ) { if ( url . startsWith ( 'git@' ) ) { if ( argv . useSSH ) { return url ; } // have an ssh url need an http url const m = url . match ( / (https?:\/\/([^/]+)\/|git@(.+):)([\w\d-_/]+)(.git)? / ) ; return ` ${ m [ 3 ] } ${ m [ 4 ] } ` ; } if ( url . startsWith ( 'http' ) ) { if ( ! argv . useSSH ) { return url ; } // have a http url need an ssh url const m = url . match ( / (https?:\/\/([^/]+)\/|git@(.+):)([\w\d-_/]+)(.git)? / ) ; return ` ${ m [ 2 ] } ${ m [ 4 ] } ` ; } if ( ! url . includes ( '/' ) ) { url = ` ${ url } ` ; } if ( argv . useSSH ) { return ` ${ url } ` ; } return ` ${ url } ` ; }
generates a repo url to clone depending on the argv.useSSH option
@param {string} url the repo url either in git@ for https:// form
@returns the clean repo url
generates a repo url to clone depending on the argv . useSSH option