npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

cordova-config-utils

v2.3.0

Published

Modify your config.xml after cordova prepare

Downloads

12

Readme

cordova-config-utils

This hook can update platform configuration files based on preferences and config-file data defined in your normal config.xml, that are normally not used/ignored by Cordova. Use-cases include e.g. on iOS setting ENABLE_BITCODE = NO or disabling Application Transport Security (ATS). Currently only the AndroidManifest.xml, iOS *-Info.plist and *.xcodeproj/project.pbxproj files are supported.

Based off this awesome hook from Diego Netto, thanks!

Install

npm install cordova-config-utils

After install an after_prepare folder will be added to your hooks folder with the 011_update_config.js script in it.

Usage

You can use <preference> and <config-file> tags:

Preferences

  1. Preferences defined outside of the platform element will apply to all platforms
  2. Preferences defined inside a platform element will apply only to the specified platform
  3. Platform preferences take precedence over common preferences
  4. The preferenceMappingData object contains all of the possible custom preferences to date including the target file they belong to, parent element, and destination element or attribute Config Files

Config-Files

  1. config-file elements MUST be defined inside a platform element, otherwise they will be ignored.
  2. config-file target attributes specify the target file to update. (AndroidManifest.xml or *-Info.plist)
  3. config-file parent attributes specify the parent element (AndroidManifest.xml) or parent key (*-Info.plist) that the child data will replace or be appended to.
  4. config-file elements are uniquely indexed by target AND parent for each platform.
  5. If there are multiple config-file's defined with the same target AND parent, the last config-file will be used
  6. Elements defined WITHIN a config-file will replace or be appended to the same elements relative to the parent element
  7. If a unique config-file contains multiples of the same elements (other than uses-permssion elements which are selected by by the uses-permission name attribute), the last defined element will be retrieved.

Examples

Android

<platform name="android">
  <!-- These preferences are actually available in Cordova by default although not currently documented -->
  <preference name="android-minSdkVersion" value="8" />
  <preference name="android-maxSdkVersion" value="19" />
  <preference name="android-targetSdkVersion" value="19" />
  <!-- Custom preferences examples -->
  <preference name="android-windowSoftInputMode" value="stateVisible" />
  <preference name="android-installLocation" value="auto" />
  <preference name="android-launchMode" value="singleTop" />
  <preference name="android-activity-hardwareAccelerated" value="false" />
  <preference name="android-manifest-hardwareAccelerated" value="false" />
  <preference name="android-configChanges" value="orientation" />
  <preference name="android-theme" value="@android:style/Theme.Black.NoTitleBar" />
  <config-file target="AndroidManifest.xml" parent="/*">
      <supports-screens
          android:xlargeScreens="false"
          android:largeScreens="false"
          android:smallScreens="false" />
      <uses-permission android:name="android.permission.READ_CONTACTS" android:maxSdkVersion="15" />
      <uses-permission android:name="android.permission.WRITE_CONTACTS" />
  </config-file>
</platform>

NOTE: For possible manifest values see http://developer.android.com/guide/topics/manifest/manifest-intro.html

iOS

<platform name="ios">
    <config-file platform="ios" target="*-Info.plist" parent="NSAppTransportSecurity">
      <dict>
        <key>NSAllowsArbitraryLoads</key><true/>
      </dict>
    </config-file>

    <config-file platform="ios" target="project.pbxproj">
      <build-property name="ENABLE_BITCODE" value="NO" />
    </config-file>
</platform>

Notes

  • Currently, items aren't removed from the platform config files if you remove them from config.xml. For example, if you add a custom permission, build, then remove it, it will still be in the manifest.
  • If you make a mistake, for example adding an element to the wrong parent, you may need to remove and add your platform, or revert to your previous manifest/plist file.