|
1 | 1 | #!/usr/bin/env node |
2 | 2 |
|
3 | | -import { Option, program } from "commander"; |
4 | | -import { setLogLevel } from "./log"; |
| 3 | +import { run } from "./run"; |
5 | 4 |
|
6 | | -import { notionPull, DocuNotionOptions } from "./pull"; |
7 | | -const pkg = require("../package.json"); |
8 | | -// eslint-disable-next-line @typescript-eslint/restrict-template-expressions |
9 | | -console.log(`docu-notion version ${pkg.version}`); |
| 5 | +run(); |
10 | 6 |
|
11 | | -program.name("docu-notion").description(""); |
12 | | -program.usage("-n <token> -r <root> [options]"); |
13 | | -program |
14 | | - .requiredOption( |
15 | | - "-n, --notion-token <string>", |
16 | | - "notion api token, which looks like secret_3bc1b50XFYb15123RHF243x43450XFY33250XFYa343" |
17 | | - ) |
18 | | - .requiredOption( |
19 | | - "-r, --root-page <string>", |
20 | | - "The 31 character ID of the page which is the root of your docs page in notion. The code will look like 9120ec9960244ead80fa2ef4bc1bba25. This page must have a child page named 'Outline'" |
21 | | - ) |
22 | | - .option( |
23 | | - "-m, --markdown-output-path <string>", |
24 | | - "Root of the hierarchy for md files. WARNING: node-pull-mdx will delete files from this directory. Note also that if it finds localized images, it will create an i18n/ directory as a sibling.", |
25 | | - "./docs" |
26 | | - ) |
27 | | - .option( |
28 | | - "-t, --status-tag <string>", |
29 | | - "Database pages without a Notion page property 'status' matching this will be ignored. Use '*' to ignore status altogether.", |
30 | | - "Publish" |
31 | | - ) |
32 | | - .option( |
33 | | - "--locales <codes>", |
34 | | - "Comma-separated list of iso 639-2 codes, the same list as in docusaurus.config.js, minus the primary (i.e. 'en'). This is needed for image localization.", |
35 | | - parseLocales, |
36 | | - [] |
37 | | - ) |
38 | | - .addOption( |
39 | | - new Option("-l, --log-level <level>", "Log level").choices([ |
40 | | - "info", |
41 | | - "verbose", |
42 | | - "debug", |
43 | | - ]) |
44 | | - ) |
45 | | - .option( |
46 | | - "-i, --img-output-path <string>", |
47 | | - "Path to directory where images will be stored. If this is not included, images will be placed in the same directory as the document that uses them, which then allows for localization of screenshots." |
48 | | - ) |
49 | | - .option( |
50 | | - "-p, --img-prefix-in-markdown <string>", |
51 | | - "When referencing an image from markdown, prefix with this path instead of the full img-output-path. Should be used only in conjunction with --img-output-path." |
52 | | - ); |
| 7 | +// for plugins to import |
53 | 8 |
|
54 | | -program.showHelpAfterError(); |
55 | | -program.parse(); |
56 | | -setLogLevel(program.opts().logLevel); |
57 | | -console.log(JSON.stringify(program.opts)); |
58 | | -notionPull(program.opts() as DocuNotionOptions).then(() => |
59 | | - console.log("docu-notion Finished.") |
60 | | -); |
61 | | - |
62 | | -function parseLocales(value: string): string[] { |
63 | | - return value.split(",").map(l => l.trim().toLowerCase()); |
64 | | -} |
| 9 | +export * as Log from "./log"; |
| 10 | +export * from "./config/configuration"; |
0 commit comments