fix(cli): fix cli to work with yargs

Related to #893
This commit is contained in:
Estevao Soares dos Santos 2022-03-07 19:24:08 +00:00
parent b3dd26a3a5
commit f8c4bd26fc
5 changed files with 9 additions and 6 deletions

Binary file not shown.

BIN
dist/showdown.js vendored

Binary file not shown.

BIN
dist/showdown.min.js vendored

Binary file not shown.

4
package-lock.json generated
View File

@ -1,12 +1,12 @@
{
"name": "showdown",
"version": "2.0.1",
"version": "2.0.2",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
"name": "showdown",
"version": "2.0.1",
"version": "2.0.2",
"license": "MIT",
"dependencies": {
"commander": "^9.0.0"

View File

@ -2,19 +2,22 @@
* Created by tivie
*/
var fs = require('fs'),
path = require('path'),
json = JSON.parse(fs.readFileSync('package.json', 'utf8')),
version = json.version,
Command = require('commander').Command,
program = new Command(),
path1 = path.resolve(__dirname + '/../dist/showdown.js'),
path2 = path.resolve(__dirname + '/../../.build/showdown.js'),
showdown;
// require shodown. We use conditional loading for each use case
if (fs.existsSync('../dist/showdown.js')) {
if (fs.existsSync(path1)) {
// production. File lives in bin directory
showdown = require('../dist/showdown');
} else if (fs.existsSync('../../.build/showdown.js')) {
showdown = require(path1);
} else if (fs.existsSync(path2)) {
// testing envo, uses the concatenated stuff for testing
showdown = require('../../.build/showdown.js');
showdown = require(path2);
} else {
// cold testing (manual) of cli.js in the src file. We load the dist file
showdown = require('../../dist/showdown');