How to use monaca-lib - 10 common examples

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 / init.js View on Github external
const util = require('./util');
const lib = require('./lib');
const Monaca = require('monaca-lib').Monaca;
const common = require('monaca-lib').common;
const inquirer = require('inquirer');

const CLI_MIGRATION_DOC_URL = common.migrationDocUrl();

let printInitInfo = (commands) => {
  // Main steps to keep in mind
  util.warn('\nBefore using Monaca, take a look at the following points:');
  // www folder
  util.print(`A. Change the output folder to ${'www'.commands}.`);
  // config.xml
  util.print(`B. In case of not having a ${'config.xml'.commands} file, a new one has been created with Monaca's default settings.`); 
  // monaca commands
  util.print(`C. Some new commands have been added:\n`
    + `\t${'monaca:preview'.commands}: ${commands.serve.commands}\n`
    + `\t${'monaca:build'.commands}:   ${commands.build ? commands.build.commands : 'not transpile'}\n`
    + `\t${'monaca:debug'.commands}:   ${commands.watch ? commands.watch.commands : 'not transpile'}\n`
github monaca / monaca-cli / src / init.js View on Github external
const util = require('./util');
const lib = require('./lib');
const Monaca = require('monaca-lib').Monaca;
const common = require('monaca-lib').common;
const inquirer = require('inquirer');

const CLI_MIGRATION_DOC_URL = common.migrationDocUrl();

let printInitInfo = (commands) => {
  // Main steps to keep in mind
  util.warn('\nBefore using Monaca, take a look at the following points:');
  // www folder
  util.print(`A. Change the output folder to ${'www'.commands}.`);
  // config.xml
  util.print(`B. In case of not having a ${'config.xml'.commands} file, a new one has been created with Monaca's default settings.`); 
  // monaca commands
  util.print(`C. Some new commands have been added:\n`
    + `\t${'monaca:preview'.commands}: ${commands.serve.commands}\n`
    + `\t${'monaca:build'.commands}:   ${commands.build ? commands.build.commands : 'not transpile'}\n`
    + `\t${'monaca:debug'.commands}:   ${commands.watch ? commands.watch.commands : 'not transpile'}\n`
    + `   Make sure that the commands you have specified before are working properly because Monaca will need them.`);
  // public folder
  util.print(`D. Make sure that opening ${'index.html'.commands} over ${'file://'.commands} works. For example, you may need to change\n`
github monaca / monaca-cli / src / sync.js View on Github external
SyncTask.livesync = function() {
  var localkit, nwError = false, projectDir;

  try {
    localkit = new Localkit(monaca, false);
  } catch (error) {
    return monaca
      .reportFail(report, 'Unable to start debug: ' + util.parseError(error))
      .catch(util.fail);
  }

  if (Object.keys(localkit.pairingKeys).length == 0) {
    util.print('');
    util.print('Welcome to Monaca debug - Live-reload and debug in the real device');
    util.print('');
    util.print('To get started, you need to install Monaca Debugger on your phone.')
    util.print('');
    util.print('   For Android Devices: Search and install "Monaca" in Google Play');
    util.print('   For iOS Devices: Search and install "Monaca" in App Store');
    util.print('')
    util.print('After installation, connect your device to the same WiFi network');
github monaca / monaca-cli / src / auth.js View on Github external
AuthTask.logout = function() {
  util.print('Signing out from Monaca Cloud...\n');

  var localkit = new Localkit(monaca);

  return monaca.logout()
    .then(
      function() {
        util.print('You have been signed out.');
        return localkit.clearPairing();
      },
      util.fail.bind(null, 'Unable to sign out: ')
    )
    .then(
      util.print.bind(null, 'Removed Monaca Debugger pairing information.'),
      util.fail.bind(null, 'Unable to remove Monaca Debugger pairing information: ')
    )
};
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();
  }
};

monaca-lib

Monaca cloud and localkit API bindings for JavaScript

Unrecognized
Latest version published 2 months ago

Package Health Score

65 / 100
Full package analysis