How to use the plist.build function in plist

To help you get started, we’ve selected a few plist 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 dancing-bone-machine / dancing-bone-machine / library / vendors / cordova / node_modules / cordova / node_modules / plugman / src / util / config-changes.js View on Github external
Object.keys(config_munge[file]).forEach(function(key) {
                        if (global_munge[file][key] && plistObj) {
                            // TODO: REMOVE in 3.4 (https://issues.apache.org/jira/browse/CB-4456)
                            require('../../plugman').emit('warn', 'DEPRECATION WARNING: Plugin "' + plugin_id + '" uses  element(s), which are now deprecated. Support will be removed in Cordova 3.4.');
                            delete plistObj.Plugins[key];
                            // TODO: don't write out on every change, do it once.
                            fs.writeFileSync(plistfile, plist.build(plistObj));
                            delete global_munge[file][key];
                        }
                    });
                }
github nwjs / grunt-nw-builder / tasks / lib / utils.js View on Github external
// Handle the INfo.plist file
        var info = plist.parseFileSync(abspath);
        info.CFBundleDisplayName = options.app_name;
        info.CFBundleName = options.app_name;

        info.CFBundleDocumentTypes = []; // zero out any document binding
        info.UTExportedTypeDeclarations = [];

        info.CFBundleVersion = options.app_version; // TODO: if git, get commit hash!
        info.CFBundleShortVersionString = 'Version ' + options.app_version;

        if(appOptions.copyright) {
          info.NSHumanReadableCopyright = appOptions.copyright;
        }

        grunt.file.write(target_filename, plist.build(info));
    };
github rkoval / alfred-aws-console-services-workflow / src / generate_items.js View on Github external
function injectIntoXml(alfredProjects) {
  const plist = require('plist');
  const fs = require('fs-extra');
  const path = require('path');

  fs.copySync(path.resolve(`${__dirname}/../info.plist`), `${__dirname}/../info.plist.generatebackup`);
  const file = fs.readFileSync(`${__dirname}/../info.plist.generatebackup`, 'utf-8');
  const plistJson = plist.parse(file);
  plistJson.objects[1].config.items = JSON.stringify(alfredProjects);
  fixedPlistJson = fixPlistLibraryNullKey(plistJson);
  const updatedPlist = plist.build(fixedPlistJson)
  fs.writeFileSync(`${__dirname}/../info.plist`, updatedPlist);
}
github zackslash / XJourney / index.html View on Github external
function performFirstPassReplacements() {
        //Create base plist
        var out = plist.build(plistBase);
        //1st pass ensures values are 'real' as is required in Plist
        out = replaceAll(replaceWithReal,realReplacement,out);

        //Ensure real floating values are in 'LocationDeliveryBehavior'
        var oldLocDel = "<" + realReplacement + ">" + LocDelBehaviorPlaceholder + "";
        var newLocDel = "<" + realReplacement + ">" + LocationDeliveryBehavior + "";
        out = out.replace(oldLocDel,newLocDel);

        //Ensure real floating values are in 'LocationRepeatBehavior'
        var oldLocRep = "<" + realReplacement + ">" + LocRepBehaviorPlaceholder + "";
        var newLocRep = "<" + realReplacement + ">" + LocationRepeatBehavior + "";
        out = out.replace(oldLocRep,newLocRep);

        return out;
    }
github diegonetto / generator-ionic / templates / hooks / after_prepare / update_platform_config.js View on Github external
updateIosPlist: function (targetFile, configItems) {
            var infoPlist = plist.parse(fs.readFileSync(targetFile, 'utf-8')),
                tempInfoPlist;

            _.each(configItems, function (item) {
                var key = item.parent;
                var plistXml = '' + key + '';
                plistXml += platformConfig.eltreeToXmlString(item.data) + '';

                var configPlistObj = plist.parse(plistXml);
                infoPlist[key] = configPlistObj[key];
            });

            tempInfoPlist = plist.build(infoPlist);
            tempInfoPlist = tempInfoPlist.replace(/[\s\r\n]*<\/string>/g,'');
            fs.writeFileSync(targetFile, tempInfoPlist, 'utf-8');
        }
    };
github HiJesse / Demeter / util / IPAUtil.js View on Github external
items: [{
            assets: [{
                kind: "software-package",
                url: content.OTAUrl || '',
            }],
            metadata: {
                "bundle-identifier": content.CFBundleIdentifier || 'example',
                "bundle-version": content.CFBundleShortVersionString || '1.0.0',
                kind: "software",
                title: content.CFBundleDisplayName || '未知'
            }
        }]
    };

    try {
        plistContent = PList.build(plistJson);
        FileUtil.touch(filePath, plistContent);
    } catch (err) {
        LogUtil.e(`${TAG} buildPList ${JSON.stringify(err)}`);
        cb(err);
        return;
    }
    cb(null);
};
github jansmolders86 / mediacenterjs / lib / utils / airplay-server.js View on Github external
function serverInfo(req, res) {
    res.set('Content-Type', 'text/x-apple-plist+xml');
    res.send(plist.build({
        deviceid: "B8:E8:56:30:B9:84",
        features: 268446207,
        model: SERVER_MODEL,
        protovers: "1.0",
        srcvers: "150.33"
    }));
}
github stovmascript / react-native-version / index.js View on Github external
parsedPlistFiles.forEach((json, index) => {
						fs.writeFileSync(
							path.join(programOpts.ios, plistFilenames[index]),
							plist.build(
								Object.assign(
									{},
									json,
									!programOpts.incrementBuild
										? {
												CFBundleShortVersionString: appPkg.version
										  }
										: {},
									!programOpts.neverIncrementBuild
										? {
												CFBundleVersion: getNewVersionCode(
													programOpts,
													parseInt(json.CFBundleVersion, 10),
													appPkg.version,
													programOpts.resetBuild
												).toString()
github mimecorg / launchui-packager / index.js View on Github external
fs.readFile( plistPath, 'utf8', ( error, data ) => {
      if ( error != null )
        return callback( error, null );
      const metadata = plist.parse( data );
      metadata.CFBundleName = name;
      metadata.CFBundleExecutable = name;
      metadata.CFBundleIdentifier = identifier != null ? identifier : 'org.mimec.launchui.' + name;
      metadata.CFBundleVersion = version;
      metadata.CFBundleShortVersionString = version;
      if ( copyright != null )
        metadata.NSHumanReadableCopyright = copyright;
      if ( category != null )
        metadata.LSApplicationCategoryType = category;
      const newData = plist.build( metadata );
      fs.writeFile( plistPath, newData, 'utf8', error => {
        if ( error != null )
          return callback( error, null );
        renameExecutable();
      } );
    } );
  }

plist

Apple's property list parser/builder for Node.js and browsers

MIT
Latest version published 1 year ago

Package Health Score

74 / 100
Full package analysis