File tree Expand file tree Collapse file tree 2 files changed +17
-8
lines changed Expand file tree Collapse file tree 2 files changed +17
-8
lines changed Original file line number Diff line number Diff line change 2
2
'use strict' ;
3
3
4
4
const meow = require ( 'meow' ) ;
5
- const configXml = require ( './' ) ;
5
+ const configPluginXml = require ( './' ) ;
6
6
7
7
const cli = meow ( {
8
8
help : [ `
9
9
Usage
10
- See https://github.com/mifi /cordova-xml
11
- $ cordova-xml <action> <args>
10
+ See https://github.com/hypery2k /cordova-plugin -xml
11
+ $ cordova-plugin- xml <action> <args>
12
12
Options
13
13
--config Config path
14
14
` ]
15
15
} ) ;
16
16
17
17
try {
18
- const config = configXml ( cli . flags . config ) ;
18
+ const config = configPluginXml ( cli . flags . config ) ;
19
19
const action = cli . input . shift ( ) ;
20
20
const args = cli . input ;
21
21
Original file line number Diff line number Diff line change 1
1
'use strict' ;
2
2
3
3
const xmlpoke = require ( 'xmlpoke' ) ;
4
+ const packageJSON = require ( process . cwd ( ) + '/package.json' ) ;
4
5
5
- module . exports = configxml ;
6
+ console . log ( process . cwd ( ) )
6
7
7
- function configxml ( inFile ) {
8
+ function configpluginxml ( inFile ) {
8
9
const defaultFile = 'plugin.xml' ;
10
+ const packageFile = 'package.json' ;
9
11
const file = inFile || defaultFile ;
10
12
11
13
function poke ( cb ) {
12
14
// https://github.com/mikeobrien/node-xmlpoke/issues/3
13
- xmlpoke ( file , xml => cb ( xml . addNamespace ( 'w ' , 'http://www.w3. org/ns/widgets ' ) ) ) ;
15
+ xmlpoke ( file , xml => cb ( xml . addNamespace ( 'p ' , 'http://apache. org/cordova/ ns/plugins/1.0 ' ) ) ) ;
14
16
}
15
17
16
18
function set ( xpath , val ) {
17
19
poke ( xml => xml . setOrAdd ( xpath , val ) ) ;
18
20
}
19
21
22
+ function setVersion ( xpath , val ) {
23
+ poke ( xml => xml . setOrAdd ( xpath , val || packageJSON . version ) ) ;
24
+ }
25
+
20
26
return {
21
- setVersion : set . bind ( null , '/p:plugin/@version' ) ,
27
+ setVersion : setVersion . bind ( null , '/p:plugin/@version' ) ,
22
28
withPoke : poke ,
23
29
}
24
30
}
31
+
32
+
33
+ module . exports = configpluginxml ;
You can’t perform that action at this time.
0 commit comments