markmap-cli
Advanced tools
Comparing version 0.4.6 to 0.5.0
#!/usr/bin/env node | ||
const fs = require('fs').promises; | ||
const { Command } = require('commander'); | ||
const open = require('open'); | ||
const updateNotifier = require('update-notifier'); | ||
const markmap = require('..'); | ||
const { main } = require('..'); | ||
const pkg = require('../package.json'); | ||
@@ -12,28 +9,2 @@ | ||
notifier.notify(); | ||
const program = new Command(); | ||
program | ||
.version(require('../package.json').version) | ||
.description('Create a markmap from a Markdown input file') | ||
.arguments('<input>') | ||
.option('-o, --output <output>', 'specify filename of the output HTML') | ||
.option('--no-open', 'do not open the output file after generation') | ||
.option('-w, --watch', 'watch the input file and update output on the fly, note that this feature is for development only') | ||
.action(async (input, cmd) => { | ||
const content = await fs.readFile(input, 'utf8'); | ||
const output = cmd.output || `${input.replace(/\.\w*$/, '')}.html`; | ||
if (cmd.watch) { | ||
await markmap.develop({ | ||
input, | ||
output, | ||
open: cmd.open, | ||
}); | ||
} | ||
await markmap.createMarkmap({ | ||
content, | ||
output, | ||
open: cmd.open, | ||
}); | ||
}); | ||
program.parse(process.argv); | ||
main(pkg.version); |
{ | ||
"name": "markmap-cli", | ||
"version": "0.4.6", | ||
"version": "0.5.0", | ||
"description": "Create markmaps from CLI", | ||
@@ -27,9 +27,5 @@ "author": "Gerald <gera2ld@live.com>", | ||
"clean": "del-cli dist", | ||
"prebuild": "run-s ci clean", | ||
"prepublishOnly": "run-s build", | ||
"ci": "run-s lint", | ||
"lint": "eslint --ext .ts .", | ||
"build:types": "tsc", | ||
"build:js": "rollup -c rollup.conf.js", | ||
"build": "run-s build:types build:js" | ||
"build:js": "rollup -c rollup.conf.js" | ||
}, | ||
@@ -47,11 +43,11 @@ "bugs": { | ||
"devDependencies": { | ||
"@babel/runtime": "^7.11.2", | ||
"markmap-lib": "^0.11.3" | ||
"@babel/runtime": "^7.13.10", | ||
"markmap-lib": "^0.11.4" | ||
}, | ||
"dependencies": { | ||
"chokidar": "^3.4.2", | ||
"commander": "^5.1.0", | ||
"koa": "^2.13.0", | ||
"open": "^7.0.3", | ||
"update-notifier": "^4.1.1" | ||
"chokidar": "^3.5.1", | ||
"commander": "^7.1.0", | ||
"koa": "^2.13.1", | ||
"open": "^8.0.3", | ||
"update-notifier": "^5.1.0" | ||
}, | ||
@@ -61,3 +57,3 @@ "engines": { | ||
}, | ||
"gitHead": "efdba06cf8ff88739cafc02e2b324aee91340abc" | ||
"gitHead": "cbb56b8ede93b15000a31013a0474891b774a977" | ||
} |
@@ -1,6 +0,4 @@ | ||
export declare function develop(options: { | ||
input: string; | ||
open: boolean; | ||
}): Promise<{ | ||
import { IDevelopOptions } from './util'; | ||
export declare function develop(fileName: string, options: IDevelopOptions): Promise<{ | ||
close(): Promise<void>; | ||
}>; |
import type { IMarkmapCreateOptions } from 'markmap-lib'; | ||
import { IDevelopOptions } from './util'; | ||
import { develop } from './dev-server'; | ||
export * from 'markmap-lib'; | ||
export * from './dev-server'; | ||
export declare function createMarkmap(options?: IMarkmapCreateOptions & { | ||
/** | ||
* whether to open the generated markmap in browser | ||
*/ | ||
open?: boolean; | ||
}): Promise<void>; | ||
export { develop }; | ||
export declare function createMarkmap(options: IMarkmapCreateOptions & IDevelopOptions): Promise<void>; | ||
export declare function main(version: string): void; |
Sorry, the diff of this file is too big to display
806584
8
14928
2
+ Addedboxen@5.1.2(transitive)
+ Addedcamelcase@6.3.0(transitive)
+ Addedchalk@4.1.2(transitive)
+ Addedcommander@7.2.0(transitive)
+ Addeddefine-lazy-prop@2.0.0(transitive)
+ Addedglobal-dirs@3.0.1(transitive)
+ Addedini@1.3.82.0.0(transitive)
+ Addedis-installed-globally@0.4.0(transitive)
+ Addedis-npm@5.0.0(transitive)
+ Addedopen@8.4.2(transitive)
+ Addedsemver@7.6.3(transitive)
+ Addedtype-fest@0.20.2(transitive)
+ Addedupdate-notifier@5.1.0(transitive)
+ Addedwrap-ansi@7.0.0(transitive)
- Removedboxen@4.2.0(transitive)
- Removedcamelcase@5.3.1(transitive)
- Removedchalk@3.0.0(transitive)
- Removedcommander@5.1.0(transitive)
- Removedglobal-dirs@2.1.0(transitive)
- Removedini@1.3.7(transitive)
- Removedis-installed-globally@0.3.2(transitive)
- Removedis-npm@4.0.0(transitive)
- Removedopen@7.4.2(transitive)
- Removedterm-size@2.2.1(transitive)
- Removedtype-fest@0.8.1(transitive)
- Removedupdate-notifier@4.1.3(transitive)
Updatedchokidar@^3.5.1
Updatedcommander@^7.1.0
Updatedkoa@^2.13.1
Updatedopen@^8.0.3
Updatedupdate-notifier@^5.1.0