{"size": 679, "ext": "js", "max_stars_repo_path": "cmds/clearblade-hot-reload.js", "max_stars_repo_name": "ClearBlade/cb-dev-k", "max_stars_repo_stars_event_min_datetime": "2019-07-19T15:39:17.000Z", "max_stars_repo_stars_event_max_datetime": "2021-02-11T18:16:46.000Z", "max_issues_repo_path": "cmds/clearblade-hot-reload.js", "max_issues_repo_name": "ClearBlade/cb-dev-k", "max_issues_repo_issues_event_min_datetime": "2019-05-07T15:13:44.000Z", "max_issues_repo_issues_event_max_datetime": "2022-02-08T20:26:13.000Z", "max_forks_repo_path": "cmds/clearblade-hot-reload.js", "max_forks_repo_name": "ClearBlade/cb-dev-kit", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": 2, "max_issues_count": 20, "max_forks_count": null, "avg_line_length": 32.3333333333, "max_line_length": 128, "alphanum_fraction": 0.5920471281}
const error = require('../templates/error');
const spawn = require('child_process').spawnSync;

module.exports = (args) => {
  // reliant on portals starting with p, services starting with s, etc...
  if (args.p) {
    let script = `npm run start:clearblade-hot-reload -portal=${args.p}`;
    if (args.m) {
      script += ` -messagePort=${args.m}`
    }
    if (args.n) {
      script += ` -noSSL=${args.n}`
    }
    if (args.c) {
      script += ` -caPath=${args.c}`
    }
    spawn(script, [], { shell: true, stdio: 'inherit' });
  } else {
    error('Please specify a -portal(-p) flag start hot reload. See cb-dev-kit help clearblade-hot-reload for more info.', true);
  }
}