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

v0.7.0

Published

Parse and edit the config.xml file of a cordova project

Downloads

2,978

Readme

cordova-config

Build Status Coverage Status

Parse and edit the config.xml file of a cordova project.

Install

npm install --save cordova-config

Usage

const Config = require('cordova-config');

// Load and parse the config.xml
const config = new Config('config.xml');
config.setName('My application');
config.setDescription('This is the description of my application');
config.setAuthor('Sam Verschueren', '[email protected]', 'https://github.com/SamVerschueren');

// Write the config file
config.writeSync();

API

Config(file)

Loads and parses the file.

file

Required
Type: string

The path to the config.xml file.

#setName(name)

Sets the <name>name</name> tag in the xml file.

name

Required
Type: string

The name of the application.

#setElement(tag, [text], [attribs])

Sets a <tag>text</tag> tag in the xml file.

tag

Required
Type: string

The name of the element.

text

Type: string

The element text.

attribs

Type: object

The element attributes

#setDescription(description)

Sets the <description>description</description> tag in the xml file.

description

Required
Type: string

The description of the application.

#setAuthor(name [, email [, website]])

Sets the <author email="email" href="website">name</author> tag in the xml file.

name

Required
Type: string

The name of the author.

email

Type: string

The email address of the email.

website

Type: string

The website of the author.

#setVersion(version)

Sets the version attribute of the widget tag in the xml file.

version

Required
Type: string

The version in the format x.y.z.

#setAndroidVersionCode(version)

Sets the android-versionCode attribute of the widget tag in the xml file.

version

Required
Type: number

The Android version code.

#setAndroidPackageName(packageName)

Sets the Android package name of the config file.

packageName

Required
Type: string

The android package name.

#setIOSBundleVersion(version)

Sets the ios-CFBundleVersion attribute of the widget tag in the xml file.

version

Required
Type: string

The version in the format x.y.z.

#setIOSBundleIdentifier(identifier)

Sets the iOS CFBundleIdentifier of the config file.

identifier

Required
Type: string

The iOS CFBundleIdentifier.

#setPreference(name, value)

Adds a <preference name="name" value="value" /> tag to the xml file.

name

Required
Type: string

The name of the preference tag.

value

Required
Type: string|boolean

The value of the preference.

#removeAccessOrigins()

Removes all the <access /> tags in the xml file.

#removeAccessOrigin(origin)

Removes the <access /> tag with the origin equal to the parameter.

origin

Required
Type: string

The origin of the access tag you want to remove.

#setAccessOrigin(origin [, options])

Adds an <access /> tag to the xml file.

origin

Required
Type: string

The origin of the access tag.

options

Type: object

A map with extra attributes that will be added to the access tag.

#setID(id)

Sets the ID of the config file.

id

Required
Type: string

The id of the widget tag.

#addHook(type, src)

Adds the hook with type and src. see Apache Cordova API Documentation for more info.

type

Required
Type: string

Cordova hook type. ex) 'after_build', 'after_compile', 'after_clean'

src

Required
Type: string

Src path of hook script

#addRawXML(xml)

Adds a raw xml element to the root of the config file.

xml

Required
Type: string

A raw xml element. You can only pass in one element with one root.

#write()

Writes the config.xml file async.

Resolves a promise when the file is written.

#writeSync()

Writes the config.xml file synchronously.

Related

License

MIT © Sam Verschueren