How to use the monaca-lib.Monaca function in monaca-lib

To help you get started, we’ve selected a few monaca-lib examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github monaca / monaca-cli / src / transpile.js View on Github external
TranspileTask.run = function(taskName, info) {
  let projectDir;
  monaca = new Monaca(info);

  lib.findProjectDir(process.cwd(), monaca)
  // Checking if the user needs to upgrade the project
  .then(
    (dir) => {
      projectDir= dir;
      lib.needToUpgrade(projectDir, monaca);

      if (!monaca.hasTranspileScript(projectDir)) util.fail('This project is not transpilable.');
      else util.checkNodeRequirement();

      let report = {
        event: 'transpile'
      };
    
      monaca.reportAnalytics(report);
github monaca / monaca-cli / src / sync.js View on Github external
SyncTask.run = function(taskName, info, options) {
  monaca = new Monaca(info);
  if (taskName === 'debug') {
    return monaca.relogin().then(this.livesync.bind(this), function() {
      return util.displayLoginErrors();
    }.bind(this));
  } else {
    return monaca.prepareSession().then(
      function() {
        if (taskName === 'clone') {
          this.clone(true); // 'true' flag ensures that cloud project id is saved locally.
        } else if (taskName === 'import') {
          this.clone(false);
        } else if (taskName === 'upload' || taskName === 'download') {
          this.load(taskName, options);
        }
      }.bind(this),
      util.displayLoginErrors
github monaca / monaca-cli / src / signing.js View on Github external
run: (task, info) => {
    monaca = new Monaca(info);
    let step = '';
    let action = '';
    let target = '';

    lib.findProjectDir(process.cwd(), monaca)
      .then(
        (cwd) => {
          // Checking project directory.
          return lib.assureMonacaProject(cwd, monaca);
        }
      )
      .then(
        (projectInfo) => {
          // Assuring this is a Monaca-like project.
          _project_id = projectInfo.projectId
        }
github monaca / monaca-cli / src / remote.js View on Github external
RemoteTask.run = function(taskName, info) {
  monaca = new Monaca(info);

  monaca.prepareSession().then(
    function() {
      var task = argv._[1];

      if (task === 'build' || task === 'config') {
        this.remote(task);
      } else {
        util.fail('No such command.');
      }
    }.bind(this),
    util.displayLoginErrors
  );
};
github monaca / monaca-cli / src / docs.js View on Github external
ConfigTask.run = function(taskName, info) {
    monaca = new Monaca(info);
    var docsType = argv._[1];
    if (taskName === 'docs') {
      this.openDocs(docsType);
    }
  };
github monaca / monaca-cli / src / auth.js View on Github external
AuthTask.run = function(taskName, info) {
  monaca = new Monaca(info)
  if (taskName == 'login') {
    return this.login();
  } else if (taskName === 'signup') {
    this.signup();
  } else {
    this.logout();
  }
};
github monaca / monaca-cli / src / cordova.js View on Github external
CordovaTask.run = function(taskName, info) {
  
  monaca = new Monaca(info);
  
  lib.findProjectDir(process.cwd(), monaca)
  .then( (projectDir) => {
    try { lib.needToUpgrade(projectDir, monaca); } catch (err) { util.fail(`${err}`); }

    let cordovaJson;
    
    try {
      cordovaJson = require(path.join(projectDir, 'node_modules', 'cordova', 'package.json'));
    } catch (err) {
      util.fail(`${err}\n`);
    }
    
    util.warn('Attention, the requested command is a Cordova CLI ' + (cordovaJson.version ? cordovaJson.version : '') + ' command.');
    util.warn('In case of issue, refer to the official Cordova CLI documentation.\n');
github monaca / monaca-cli / src / serve.js View on Github external
ServeTask.run = function (taskName, info) {
  monaca = new Monaca(info);
  lib.findProjectDir(process.cwd(), monaca)
    .then( dir => {
      lib.needToUpgrade(dir, monaca);
      try { spawn('npm', ['run', 'monaca:preview'], {stdio: 'inherit'}); } catch(ex) { throw ex; }
    })
    .catch( util.fail.bind(null, 'Project ' + taskName + ' failed: ') );
};
github monaca / monaca-cli / src / info.js View on Github external
ConfigTask.run = function(taskName, info) {
    monaca = new Monaca(info);

    this.showInfo(info);
  };
github monaca / monaca-cli / src / create.js View on Github external
CreateTask.run = function(taskName, info) {
  monaca = new Monaca(info),
  monacaInfo = info;

  if (argv && argv['template-list']) {
    util.print("The following templates can be installed by executing\n\nmonaca create [projectName] --template [templateName]\n");
    this.displayTemplates(argv);
  } else {
    fs.exists(path.resolve(dirName), function(exists) {
      if (exists) {
        util.fail('Directory already exists.');
      } else {
        monaca.reportAnalytics(report);
        if (argv.url) {
          this.createApp({
            name: 'Custom Template',
            resource: argv.url
          });

monaca-lib

Monaca cloud and localkit API bindings for JavaScript

Unrecognized
Latest version published 13 days ago

Package Health Score

67 / 100
Full package analysis