MCPcopy
hub / github.com/meteor/meteor / createAppConfiguration

Function createAppConfiguration

tools/cordova/builder.js:543–786  ·  view source on GitHub ↗
(builder)

Source from the content-addressed store, hash-verified

541}
542
543function createAppConfiguration(builder) {
544 const { settingsFile } = builder.options;
545 let settings = null;
546 if (settingsFile) {
547 settings = optimisticReadJsonOrNull(settingsFile);
548 if (! settings) {
549 throw new Error("Unreadable --settings file: " + settingsFile);
550 }
551 }
552
553 /**
554 * @namespace App
555 * @global
556 * @summary The App configuration object in mobile-config.js
557 */
558 return {
559 /**
560 * @summary Set your mobile app's core configuration information.
561 * @param {Object} options
562 * @param {String} [options.id,version,name,description,author,email,website]
563 * Each of the options correspond to a key in the app's core configuration
564 * as described in the [Cordova documentation](http://cordova.apache.org/docs/en/5.1.1/config_ref_index.md.html#The%20config.xml%20File_core_configuration_elements).
565 * @memberOf App
566 */
567 info: function (options) {
568 // check that every key is meaningful
569 _.each(options, function (value, key) {
570 if (!_.has(builder.metadata, key)) {
571 throw new Error("Unknown key in App.info configuration: " + key);
572 }
573 });
574
575 _.extend(builder.metadata, options);
576 },
577 /**
578 * @summary Add a preference for your build as described in the
579 * [Cordova documentation](http://cordova.apache.org/docs/en/5.1.1/config_ref_index.md.html#The%20config.xml%20File_global_preferences).
580 * @param {String} name A preference name supported by Cordova's
581 * `config.xml`.
582 * @param {String} value The value for that preference.
583 * @param {String} [platform] Optional. A platform name (either `ios` or `android`) to add a platform-specific preference.
584 * @memberOf App
585 */
586 setPreference: function (key, value, platform) {
587 if (platform) {
588 if (!_.contains(['ios', 'android'], platform)) {
589 throw new Error(`Unknown platform in App.setPreference: ${platform}. \
590Valid platforms are: ios, android.`);
591 }
592
593 builder.additionalConfiguration.platform[platform][key] = value;
594 } else {
595 builder.additionalConfiguration.global[key] = value;
596 }
597 },
598
599 /**
600 * @summary Like `Meteor.settings`, contains data read from a JSON

Callers 1

processControlFileMethod · 0.85

Calls 5

eachMethod · 0.80
includeMethod · 0.80
labelWarnMethod · 0.80
hasMethod · 0.45
extendMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…