Skip to content

Commit 9d7a86e

Browse files
committed
feat(version): Add support for setting plugin version
1 parent 35657ae commit 9d7a86e

File tree

2 files changed

+11
-32
lines changed

2 files changed

+11
-32
lines changed

README.md

Lines changed: 9 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,45 +1,35 @@
1-
# cordova-xml
1+
# cordova-plugin-xml
22

3-
Edit cordova config.xml from the command line or via API. Uses the awesome [node-xmlpoke](https://github.com/mikeobrien/node-xmlpoke).
3+
Edit cordova plugin.xml from the command line or via API. Based on this [node package](https://github.com/mikeobrien/node-xmlpoke).
44

55
## Install
66
```
7-
npm install --save-dev cordova-xml
7+
npm install --save-dev cordova-plugin-xml
88
```
99
or global:
1010
```
11-
npm install -g cordova-xml
11+
npm install -g cordova-plugin-xml
1212
```
1313

1414
## CLI Usage
1515
```
16-
cordova-xml <action> <args>
16+
cordova-plugin-xml <action> <args>
1717
```
1818

1919
## CLI examples
2020
```
21-
cordova-xml setId com.example.myid --config /path/to/config.xml
22-
cordova-xml setVersion 1.2.3
23-
cordova-xml setId com.example.myid
24-
cordova-xml setAndroidVersion 1.4.5
25-
cordova-xml setIosVersion 1.1.2
26-
cordova-xml setName TestApp
27-
cordova-xml setDescription 'my app description'
28-
cordova-xml setAuthorEmail 'email@example.com'
29-
cordova-xml setAuthorName 'Author Authsson'
30-
cordova-xml setAuthorWebsite 'http://example.com'
31-
cordova-xml setXml "/w:widget/w:platform[@name='android']" '<test>hey</test>'
21+
cordova-plugin-xml setVersion 1.2.3
3222
```
3323

3424
## lib examples
3525
```
36-
require('cordova-xml')().setId('com.example.myid')
37-
require('cordova-xml')('/path/to/config.xml').setId('com.example.myid')
26+
require('cordova-plugin-xml')().setVersion('123')
27+
require('cordova-plugin-xml')('/path/to/config.xml').setVersion('123')
3828
```
3929

4030
## Use xmlpoke directly
4131
```
42-
const cordovaXml = require('cordova-xml')();
32+
const cordovaXml = require('cordova-plugin-xml')();
4333
cordovaXml.withPoke(xml => xml.add("/w:widget/w:platform[@name='android']/something", xml.XmlString('<text>hey</text>')));
4434
```
4535
See [node-xmlpoke](https://github.com/mikeobrien/node-xmlpoke) for more info.

index.js

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ const xmlpoke = require('xmlpoke');
55
module.exports = configxml;
66

77
function configxml(inFile) {
8-
const defaultFile = 'config.xml';
8+
const defaultFile = 'plugin.xml';
99
const file = inFile || defaultFile;
1010

1111
function poke(cb) {
@@ -18,18 +18,7 @@ function configxml(inFile) {
1818
}
1919

2020
return {
21-
setId: set.bind(null, '/w:widget/@id'),
22-
setAndroidId: set.bind(null, '/w:widget/@android-packageName'),
23-
setIosId: set.bind(null, '/w:widget/@ios-CFBundleIdentifier'),
24-
setVersion: set.bind(null, '/w:widget/@version'),
25-
setAndroidVersion: set.bind(null, '/w:widget/@android-versionCode'),
26-
setIosVersion: set.bind(null, '/w:widget/@ios-CFBundleVersion'),
27-
setName: set.bind(null, '/w:widget/w:name'),
28-
setDescription: set.bind(null, '/w:widget/w:description'),
29-
setAuthorEmail: set.bind(null, '/w:widget/w:author/@email'),
30-
setAuthorName: set.bind(null, '/w:widget/w:author'),
31-
setAuthorWebsite: set.bind(null, '/w:widget/w:author/@href'),
32-
setXml: (xpath, xmlStr) => poke(xml => xml.setOrAdd(xpath, xml.XmlString(xmlStr))),
21+
setVersion: set.bind(null, '/p:plugin/@version'),
3322
withPoke: poke,
3423
}
3524
}

0 commit comments

Comments
 (0)