How to use the simple-plist.writeFileSync function in simple-plist

To help you get started, we’ve selected a few simple-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 nowsecure / node-applesign / index.js View on Github external
additionalKeychainGroups.push(this.config.customKeychainGroup);
    }
    const infoPlist = path.join(this.config.appdir, 'Info.plist');
    const plistData = plist.readFileSync(infoPlist);
    if (this.config.bundleIdKeychainGroup) {
      if (typeof this.config.bundleid === 'string') {
        additionalKeychainGroups.push(this.config.bundleid);
      } else {
        const bundleid = plistData['CFBundleIdentifier'];
        additionalKeychainGroups.push(bundleid);
      }
    }
    if (this.config.osversion !== undefined) {
      // DTPlatformVersion
      plistData['MinimumOSVersion'] = this.config.osversion;
      plist.writeFileSync(infoPlist, plistData);
    }
    if (additionalKeychainGroups.length > 0) {
      const newGroups = additionalKeychainGroups.map(group => `${teamId}.${group}`);
      const groups = entMacho['keychain-access-groups'];
      if (typeof groups === 'undefined') {
        entMacho['keychain-access-groups'] = newGroups;
      } else {
        groups.push(...newGroups);
      }
      changed = true;
    }
    if (changed || this.config.entry) {
      const newEntitlementsFile = file + '.entitlements';
      let newEntitlements = (appId && teamId && this.config.entry)
        ? defaultEntitlements(appId, teamId)
        : (this.config.entitlement)
github nowsecure / node-applesign / lib / session.js View on Github external
if (this.config.bundleIdKeychainGroup) {
      if (typeof this.config.bundleid === 'string') {
        additionalKeychainGroups.push(this.config.bundleid);
      } else {
        const infoPlist = path.join(this.config.appdir, 'Info.plist');
        const plistData = plist.readFileSync(infoPlist);
        const bundleid = plistData['CFBundleIdentifier'];
        additionalKeychainGroups.push(bundleid);
      }
    }
    if (this.config.osversion !== undefined) {
      const infoPlist = path.join(this.config.appdir, 'Info.plist');
      const plistData = plist.readFileSync(infoPlist);
      plistData['MinimumOSVersion'] = this.config.osversion;
      // DTPlatformVersion
      plist.writeFileSync(infoPlist, plistData);
    }
    if (additionalKeychainGroups.length > 0) {
      const newGroups = additionalKeychainGroups.map(group => `${teamId}.${group}`);
      const groups = entMacho['keychain-access-groups'];
      if (typeof groups === 'undefined') {
        entMacho['keychain-access-groups'] = newGroups;
      } else {
        groups.push(...newGroups);
      }
      changed = true;
    }
    if (changed || this.config.entry) {
      const newEntitlementsFile = file + '.entitlements';
      let newEntitlements = (appId && teamId && this.config.entry)
        ? defaultEntitlements(appId, teamId)
        : (this.config.entitlement)
github EddyVerbruggen / nativescript-localize / src / hooks / converter.ios.ts View on Github external
private writeInfoPlist(infoPlistValues: I18nEntries) {
    const resourceFilePath = path.join(this.appResourcesDirectoryPath, "Info.plist");
    if (!fs.existsSync(resourceFilePath)) {
      this.logger.warn(`'${resourceFilePath}' doesn't exists: unable to set default language`);
      return this;
    }
    const data = plist.readFileSync(resourceFilePath);
    let resourceChanged = false;
    infoPlistValues.forEach((value, key) => {
      if (!data.hasOwnProperty(key) || data[key] !== value) {
        data[key] = value;
        resourceChanged = true;
      }
    });
    if (resourceChanged) {
      plist.writeFileSync(resourceFilePath, data);
    }
  }
}
github nowsecure / node-applesign / lib / info-plist.js View on Github external
data['NSAppTransportSecurity'] = {};
    }
    data['NSAppTransportSecurity']['NSAllowsArbitraryLoads'] = true;
    changed = true;
  }
  if (forceFamily) {
    if (performForceFamily(data, emit)) {
      changed = true;
    }
  }
  if (bundleid) {
    setBundleId(data, bundleid);
    changed = true;
  }
  if (changed) {
    plist.writeFileSync(file, data);
  }
}
github nowsecure / node-applesign / lib / session.js View on Github external
data['NSAppTransportSecurity'] = {};
      }
      data['NSAppTransportSecurity']['NSAllowsArbitraryLoads'] = true;
      changed = true;
    }
    if (this.config.forceFamily) {
      if (this.performForceFamily(data)) {
        changed = true;
      }
    }
    if (bundleid) {
      this.setBundleId(file, data, bundleid);
      changed = true;
    }
    if (changed) {
      plist.writeFileSync(file, data);
    }
    next();
  }
github hypery2k / nativescript-fabric / src / lib / after-prepare.js View on Github external
var options = { shellPath: '/bin/sh', shellScript: podsPath + '/Fabric/run ' + apiKey + ' ' + apiSecret };
                    var buildPhase = xcodeProject.addBuildPhase([], 'PBXShellScriptBuildPhase', 'Configure Fabric', xcodeProject.getFirstTarget().uuid, options).buildPhase;
                    $logger.trace('Written Xcode project');
                    fs.writeFileSync(projectPath, xcodeProject.writeSync());
                    var appPlist = plist.readFileSync(plistPath);
                    plist.Fabric = {
                        APIKey: apiKey,
                        Kits: [{
                            KitInfo: '',
                            KiteName: 'Crashlytics'
                        }, {
                            KitInfo: '',
                            KiteName: 'Answers'
                        }]
                    }
                    plist.writeFileSync(plistPath, appPlist);
                    $logger.trace('Written Info plist');
                    resolve();
                } else if (platform == 'windows') {
                    //TODO PRs gladly accepted :P
                    reject();
                }
            } catch (e) {
                $logger.error('Unknown error during prepare fabric', e);
                reject();
            }
        } else if (!hasFabricJSONFile) {
            $logger.error('Please create a fabric.json file in the root!');
            reject();
        } else {
            $logger.trace("Native project not prepared.");
            resolve();

simple-plist

A wrapper utility for interacting with plist data.

MIT
Latest version published 3 years ago

Package Health Score

65 / 100
Full package analysis