Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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);
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
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
}
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
);
};
ConfigTask.run = function(taskName, info) {
monaca = new Monaca(info);
var docsType = argv._[1];
if (taskName === 'docs') {
this.openDocs(docsType);
}
};
AuthTask.run = function(taskName, info) {
monaca = new Monaca(info)
if (taskName == 'login') {
return this.login();
} else if (taskName === 'signup') {
this.signup();
} else {
this.logout();
}
};
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');
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: ') );
};
ConfigTask.run = function(taskName, info) {
monaca = new Monaca(info);
this.showInfo(info);
};
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
});