Skip to content

Commit f8c4bd2

Browse files
committed
fix(cli): fix cli to work with yargs
Related to #893
1 parent b3dd26a commit f8c4bd2

File tree

5 files changed

+12
-9
lines changed

5 files changed

+12
-9
lines changed

bin/showdown.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/showdown.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/showdown.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/cli/cli.js

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,22 @@
22
* Created by tivie
33
*/
44
var fs = require('fs'),
5+
path = require('path'),
56
json = JSON.parse(fs.readFileSync('package.json', 'utf8')),
67
version = json.version,
78
Command = require('commander').Command,
89
program = new Command(),
10+
path1 = path.resolve(__dirname + '/../dist/showdown.js'),
11+
path2 = path.resolve(__dirname + '/../../.build/showdown.js'),
912
showdown;
1013

1114
// require shodown. We use conditional loading for each use case
12-
if (fs.existsSync('../dist/showdown.js')) {
15+
if (fs.existsSync(path1)) {
1316
// production. File lives in bin directory
14-
showdown = require('../dist/showdown');
15-
} else if (fs.existsSync('../../.build/showdown.js')) {
17+
showdown = require(path1);
18+
} else if (fs.existsSync(path2)) {
1619
// testing envo, uses the concatenated stuff for testing
17-
showdown = require('../../.build/showdown.js');
20+
showdown = require(path2);
1821
} else {
1922
// cold testing (manual) of cli.js in the src file. We load the dist file
2023
showdown = require('../../dist/showdown');

0 commit comments

Comments
 (0)