File tree Expand file tree Collapse file tree 1 file changed +6
-3
lines changed Expand file tree Collapse file tree 1 file changed +6
-3
lines changed Original file line number Diff line number Diff line change 3
3
*/
4
4
var fs = require ( 'fs' ) ,
5
5
path = require ( 'path' ) ,
6
- json = JSON . parse ( fs . readFileSync ( 'package.json' , 'utf8' ) ) ,
7
- version = json . version ,
8
6
Command = require ( 'commander' ) . Command ,
9
7
program = new Command ( ) ,
10
8
path1 = path . resolve ( __dirname + '/../dist/showdown.js' ) ,
11
9
path2 = path . resolve ( __dirname + '/../../.build/showdown.js' ) ,
12
- showdown ;
10
+ showdown ,
11
+ version ;
13
12
14
13
// require shodown. We use conditional loading for each use case
15
14
if ( fs . existsSync ( path1 ) ) {
16
15
// production. File lives in bin directory
17
16
showdown = require ( path1 ) ;
17
+ version = require ( path . resolve ( __dirname + '/../package.json' ) ) . version ;
18
18
} else if ( fs . existsSync ( path2 ) ) {
19
19
// testing envo, uses the concatenated stuff for testing
20
20
showdown = require ( path2 ) ;
21
+ version = require ( path . resolve ( __dirname + '/../../package.json' ) ) . version ;
21
22
} else {
22
23
// cold testing (manual) of cli.js in the src file. We load the dist file
23
24
showdown = require ( '../../dist/showdown' ) ;
25
+ version = require ( '../../package.json' ) ;
24
26
}
25
27
28
+
26
29
program
27
30
. name ( 'showdown' )
28
31
. description ( 'CLI to Showdownjs markdown parser v' + version )
You can’t perform that action at this time.
0 commit comments