-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathbin.js
More file actions
executable file
·116 lines (111 loc) · 2.26 KB
/
bin.js
File metadata and controls
executable file
·116 lines (111 loc) · 2.26 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
#!/usr/bin/env node
const sitedown = require('.')
const clopts = require('cliclopts')([
{
name: 'build',
abbr: 'b',
help: 'path to build directory',
default: 'build'
},
{
name: 'pretty',
help: 'use directory indexes for pretty URLs',
boolean: true,
default: true
},
{
name: 'el',
abbr: 'e',
help: 'css selector for target element',
default: '.markdown-body'
},
{
name: 'layout',
abbr: 'l',
help: 'path to layout file'
},
{
name: 'github-headings',
abbr: 'g',
alias: 'githubHeadings',
help: 'add anchors to headings just like GitHub',
boolean: true,
default: false
},
{
name: 'no-hljs-class',
alias: 'noHljsClass',
help: 'don\'t add the hljs class to codeblocks',
boolean: true,
default: false
},
{
name: 'silent',
abbr: 's',
help: 'make less noise during build',
boolean: true
},
{
name: 'watch',
abbr: 'w',
help: 'watch a directory or file (experimental)',
boolean: true
},
{
name: 'dev',
abbr: 'd',
help: 'start development server (experimental)',
default: false
},
{
name: 'assets',
abbr: 'a',
help: 'assets folder to copy',
default: 'assets'
},
{
name: 'version',
abbr: 'v',
boolean: true,
help: 'show version information'
},
{
name: 'help',
abbr: 'h',
help: 'show help',
boolean: true
}
])
const argv = require('minimist')(process.argv.slice(2), {
alias: clopts.alias(),
boolean: clopts.boolean(),
default: clopts.default()
})
if (argv.version) {
console.log(require('./package').version)
process.exit(0)
}
if (argv.help) {
console.log('Usage: sitedown [source] [options]\n')
console.log(' Example: sitedown . -b dist -l layout.html\n')
console.log(' source path to source directory (default: current working directory)')
clopts.print()
process.exit(0)
}
argv.source = argv.source || argv._[0] || '.'
argv.build = argv.build || 'build'
argv.silent = argv.silent || false
if (argv.dev) {
sitedown.dev(argv)
} else if (argv.watch) {
sitedown.watch(argv)
} else {
sitedown(argv, function (err) {
if (err) {
console.error(err.message)
process.exit(1)
} else {
process.exit(0)
}
})
}