Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
}
console.error('[ERROR] Using default config'.red);
console.error('[ERROR] Run "titanium setup" to reconfigure'.red + '\n');
}
// if there's a --config, mix it into our config
try {
var json = JSON.parse('' + getArg('--config') + '');
if (json && typeof json === 'object') {
appc.util.mixObj(config, json);
}
} catch (ex) {
console.log(ex);
}
var __ = appc.i18n(__dirname).__,
env = appc.environ,
afs = appc.fs,
logger = require('./logger'),
pkginfo = appc.pkginfo.package(module, 'version', 'about'),
defaultInstallLocation = config.get('sdk.defaultInstallLocation'),
sdkPaths = config.get('paths.sdks');
config.cli.colors || (colors.mode = 'none');
process.setMaxListeners(666);
if (defaultInstallLocation) {
defaultInstallLocation = afs.resolvePath(defaultInstallLocation);
}
// make sure our sdk paths are good to go
/*
* version.js: Titanium CLI version command
*
* Copyright (c) 2012, Appcelerator, Inc. All Rights Reserved.
* See the LICENSE file for more information.
*/
var appc = require('node-appc'),
i18n = appc.i18n(__dirname),
__ = i18n.__,
__n = i18n.__n;
exports.desc = __('print the version and exits');
exports.config = function (logger, config, cli) {
return {
noAuth: true
};
};
exports.run = function (logger, config, cli) {
// don't have to do anything... by default the banner will be displayed
};
/*
* clean.js: Titanium Mobile CLI clean command
*
* Copyright (c) 2012-2018, Appcelerator, Inc. All Rights Reserved.
* See the LICENSE file for more information.
*/
'use strict';
const appc = require('node-appc'),
i18n = appc.i18n(__dirname),
__ = i18n.__,
__n = i18n.__n,
ti = require('node-titanium-sdk'),
fs = require('fs-extra'),
path = require('path'),
sprintf = require('sprintf'),
async = require('async'),
tiappxml = require('node-titanium-sdk/lib/tiappxml');
exports.cliVersion = '>=3.2.1';
exports.desc = __('removes previous build directories');
exports.config = function (logger, config, cli) {
// start patching the logger here
patchLogger(logger, cli);
/**
* Titanium SDK Library for Node.js
* Copyright (c) 2012-2013 by Appcelerator, Inc. All Rights Reserved.
* Please see the LICENSE file for information about licensing.
*/
var appc = require('node-appc'),
i18n = appc.i18n(__dirname),
__ = i18n.__,
afs = appc.fs,
fs = require('fs'),
path = require('path');
function stripQuotes(s) {
return (''+s).replace(/^(['"])(.+)(['"])$/, '$2');
}
exports.load = function (dir, deviceFamilies, logger, callback) {
var entries = {};
afs.visitFiles(dir, function (file, full) {
if (/.+\.jss$/.test(file)) {
var base = file.substring(0, file.length - 4).split('.'),
density = base.pop(),
const appc = require('node-appc');
const { IncrementalFileTask } = require('appc-tasks');
const crypto = require('crypto');
const fs = require('fs-extra');
const jsanalyze = require('node-titanium-sdk/lib/jsanalyze');
const nodeify = require('nodeify');
const path = require('path');
const pLimit = require('p-limit');
const { promisify } = require('util');
const i18n = appc.i18n(__dirname);
const __ = i18n.__;
const MAX_SIMULTANEOUS_FILES = 256;
const limit = pLimit(MAX_SIMULTANEOUS_FILES);
/**
* Task that processes JS files by applying several transforms and copying them to their
* destination inside the build directory.
*/
class ProcessJsTask extends IncrementalFileTask {
/**
* Constructs a new processing task.
*
* @param {Object} options Configuration object for this task.
* @param {String} [options.name='process-js'] Name for the task.
* @param {String[]} options.inputFiles Array of input files this task will use.
* @param {String[]} options.incrementalDirectory Path to a folder where incremental task data will be stored.
ejs = require('ejs'),
EmulatorManager = require('titanium-sdk/lib/emulator'),
fields = require('fields'),
fs = require('fs'),
i18n = require('titanium-sdk/lib/i18n'),
jsanalyze = require('titanium-sdk/lib/jsanalyze'),
path = require('path'),
spawn = require('child_process').spawn,
temp = require('temp'),
ti = require('titanium-sdk'),
tiappxml = require('titanium-sdk/lib/tiappxml'),
util = require('util'),
wrench = require('wrench'),
afs = appc.fs,
i18nLib = appc.i18n(__dirname),
__ = i18nLib.__,
__n = i18nLib.__n,
version = appc.version,
xml = appc.xml;
function hash(s) {
return crypto.createHash('md5').update(s || '').digest('hex');
}
function assertIssue(logger, issues, name) {
var i = 0,
len = issues.length;
for (; i < len; i++) {
if ((typeof name == 'string' && issues[i].id == name) || (typeof name == 'object' && name.test(issues[i].id))) {
issues[i].message.split('\n').forEach(function (line) {
logger.error(line.replace(/(__(.+?)__)/g, '$2'.bold));
* @copyright
* Copyright (c) 2015-2016 by Appcelerator, Inc. All Rights Reserved.
*
* @license
* Licensed under the terms of the Apache Public License.
* Please see the LICENSE included with this distribution for details.
*/
'use strict';
const appc = require('node-appc');
const bplist = require('bplist-parser');
const crypto = require('crypto');
const EventEmitter = require('events').EventEmitter;
const fs = require('fs');
const __ = appc.i18n(__dirname).__;
const util = require('util');
exports.Handle = Handle;
exports.magik = magik;
exports.hash = hash;
exports.readPlist = readPlist;
/**
* Exposes both an event emitter API and a `stop()` method for canceling long
* running functions such as `trackDevices()` and `log()`.
*/
function Handle() {}
util.inherits(Handle, EventEmitter);
/**
* Creates an event emitting handle, validates that the platform is OS X,
*
* @module env
*
* @copyright
* Copyright (c) 2014-2017 by Appcelerator, Inc. All Rights Reserved.
*
* @license
* Licensed under the terms of the Apache Public License.
* Please see the LICENSE included with this distribution for details.
*/
const
appc = require('node-appc'),
async = require('async'),
magik = require('./utilities').magik,
__ = appc.i18n(__dirname).__;
var cache = null;
/**
* Fired when the developer profiles have been updated.
* @event module:env#detected
* @type {Object}
*/
/**
* Fired when there was an error retreiving the provisioning profiles.
* @event module:env#error
* @type {Error}
*/
/**
* Copyright (c) 2014-2016 by Appcelerator, Inc. All Rights Reserved.
*
* @license
* Licensed under the terms of the Apache Public License.
* Please see the LICENSE included with this distribution for details.
*/
'use strict';
const appc = require('node-appc');
const async = require('async');
const magik = require('./utilities').magik;
const fs = require('fs');
const iosDevice = require('node-ios-device');
const path = require('path');
const __ = appc.i18n(__dirname).__;
var cache;
exports.detect = detect;
exports.install = install;
/**
* Detects connected iOS devices.
*
* @param {Object} [options] - An object containing various settings.
* @param {Boolean} [options.bypassCache=false] - When true, re-detects all connected iOS devices.
* @param {Function} [callback(err, results)] - A function to call with the device information.
*
* @emits module:device#detected
* @emits module:device#error
*
*
* @module commands/login
*
* @copyright
* Copyright (c) 2009-2015 by Appcelerator, Inc. All Rights Reserved.
*
* @license
* Licensed under the terms of the Apache Public License
* Please see the LICENSE included with this distribution for details.
*
* @requires node-appc
*/
'use strict';
var appc = require('node-appc'),
__ = appc.i18n(__dirname).__;
/** Login command description. */
exports.desc = __('logs into the Appcelerator network **deprecated**'.grey);
/** Command is deprecated, so hide it from help */
exports.hidden = true;
/**
* This command has been deprecated and only shows a message.
* @param {Object} logger - The logger instance
* @param {Object} config - The CLI config object
* @param {CLI} cli - The CLI instance
* @param {Function} finished - Callback when the command finishes
*/
exports.run = function (logger, config, cli, finished) {
logger.log(__('Command has been deprecated and has no effect.') + '\n');